parent
3422518fd8
commit
0eb056ab03
@ -0,0 +1,21 @@
|
||||
import { ImageSourcePropType } from 'react-native';
|
||||
import { Game } from './game'
|
||||
|
||||
export class GameCasino extends Game{
|
||||
readonly Coef:number;
|
||||
|
||||
constructor(name:string, imageSource:ImageSourcePropType, gameSource:string, coef:number){
|
||||
super(name, imageSource, gameSource);
|
||||
this.Coef=coef;
|
||||
}
|
||||
|
||||
//Get the coefficient of the casino game
|
||||
getCoef(){
|
||||
return this.Coef;
|
||||
}
|
||||
|
||||
//Returns the coins gained with the initial bet of the user times the coefficient of the game
|
||||
betToCoins(bet:number){
|
||||
return this.Coef*bet;
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
import { ImageSourcePropType } from 'react-native';
|
||||
import { Game } from './game'
|
||||
|
||||
export class GameMulti extends Game{
|
||||
readonly RankToCoins:Map<number,number>
|
||||
|
||||
constructor(name:string, imageSource:ImageSourcePropType, gameSource:string, rankToCoins:Map<number,number>){
|
||||
super(name, imageSource, gameSource);
|
||||
this.RankToCoins=rankToCoins;
|
||||
}
|
||||
|
||||
//Get the map of the game with the rank as the key and the coins as the values
|
||||
getMultiMap(){
|
||||
return this.RankToCoins;
|
||||
}
|
||||
|
||||
//Returns the coins gained depending on the rank
|
||||
CoinsWithRank(rank:number){
|
||||
let coins;
|
||||
for (let key of this.RankToCoins.keys()){
|
||||
coins = this.RankToCoins.get(key);
|
||||
if (rank==key ){
|
||||
return coins;
|
||||
}
|
||||
}
|
||||
return coins;
|
||||
}
|
||||
}
|
Loading…
Reference in new issue