|
|
@ -10,10 +10,10 @@ namespace Models.Game
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public Player CurentPlayer { get; set; }
|
|
|
|
public Player CurentPlayer { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public Map NameMap { get; set; }
|
|
|
|
public Map UsedMap { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public De De1 { get; set; }
|
|
|
|
public De Dice1 { get; set; }
|
|
|
|
public De De2 { get; set; }
|
|
|
|
public De Dice2 { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public int Turn { get; set; }
|
|
|
|
public int Turn { get; set; }
|
|
|
|
|
|
|
|
|
|
|
@ -22,18 +22,18 @@ namespace Models.Game
|
|
|
|
|
|
|
|
|
|
|
|
public Game(Player player,Map map)
|
|
|
|
public Game(Player player,Map map)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
NameMap = map;
|
|
|
|
UsedMap = map;
|
|
|
|
CurentPlayer = player;
|
|
|
|
CurentPlayer = player;
|
|
|
|
De1 = new De();
|
|
|
|
Dice1 = new De();
|
|
|
|
De2 = new De(1);
|
|
|
|
Dice2 = new De(1);
|
|
|
|
Turn = 0;
|
|
|
|
Turn = 0;
|
|
|
|
rules = new Rules.Rules();
|
|
|
|
rules = new Rules.Rules();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void ThrowDice()
|
|
|
|
public void ThrowDice()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
De1.Lancer();
|
|
|
|
Dice1.Lancer();
|
|
|
|
De2.Lancer();
|
|
|
|
Dice2.Lancer();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int ResultOperation(Operation o)
|
|
|
|
public int ResultOperation(Operation o)
|
|
|
@ -41,31 +41,19 @@ namespace Models.Game
|
|
|
|
switch (o)
|
|
|
|
switch (o)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
case Operation.LOWER:
|
|
|
|
case Operation.LOWER:
|
|
|
|
if (De1.IsLower(De2))
|
|
|
|
return Dice1.IsLower(Dice2) ? Dice1.Nb : Dice2.Nb;
|
|
|
|
{
|
|
|
|
|
|
|
|
return De1.Nb;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return De2.Nb;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case Operation.HIGHER:
|
|
|
|
case Operation.HIGHER:
|
|
|
|
if (De1.IsLower(De2))
|
|
|
|
return Dice1.IsLower(Dice2) ? Dice2.Nb : Dice1.Nb;
|
|
|
|
{
|
|
|
|
|
|
|
|
return De2.Nb;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return De1.Nb;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case Operation.SUBTRACTION:
|
|
|
|
case Operation.SUBTRACTION:
|
|
|
|
if (De1.IsLower(De2))
|
|
|
|
return Dice1.IsLower(Dice2) ? Dice2.Nb - Dice1.Nb : Dice1.Nb - Dice2.Nb;
|
|
|
|
{
|
|
|
|
|
|
|
|
return De2.Nb - De1.Nb;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return De1.Nb - De2.Nb;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case Operation.ADDITION:
|
|
|
|
case Operation.ADDITION:
|
|
|
|
return De2.Nb + De1.Nb;
|
|
|
|
return Dice2.Nb + Dice1.Nb;
|
|
|
|
|
|
|
|
|
|
|
|
case Operation.MULTIPLICATION:
|
|
|
|
case Operation.MULTIPLICATION:
|
|
|
|
return De2.Nb * De1.Nb;
|
|
|
|
return Dice2.Nb * Dice1.Nb;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -77,12 +65,12 @@ namespace Models.Game
|
|
|
|
{
|
|
|
|
{
|
|
|
|
playerChoice.Value = result;
|
|
|
|
playerChoice.Value = result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(rules.NearCell(playerChoice,NameMap.Cells))
|
|
|
|
if(rules.NearCell(playerChoice,UsedMap.Cells))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
playerChoice.Value = result;
|
|
|
|
playerChoice.Value = result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|