Exemplo n.º 1
0
 public Result <Game> Deploy(CountryId country, Army army)
 => Must.BeInPhase(GamePhase.Deploy)
 | (g => g.Must.BeActivePlayer(army.Owner))
 | (g => g.Must.Exist(country))
 | (g => g.Must.BeOwnedBy(country, army.Owner))
 | (g => g.Must.NotExceedArmyBuffer(army))
 | (g => g.ApplyEvent(new Deployed(country, army)));
Exemplo n.º 2
0
 public Result <Game> Reinforce(CountryId from, CountryId to, Army army)
 => Must.BeInPhase(GamePhase.Reinforce)
 | (g => g.Must.Exist(from))
 | (g => g.Must.Exist(to))
 | (g => g.Must.BeOwnedBy(from, army.Owner))
 | (g => g.Must.BeOwnedBy(to, army.Owner))
 | (g => g.Must.BeReachable(to, by: from))
 | (g => g.ApplyEvent(new Reinforced(from, to, army)));
Exemplo n.º 3
0
 public Result <Game> AutoAttack(
     CountryId attacker,
     CountryId defender,
     IGenerator rnd)
 => Must.BeInPhase(GamePhase.Attack)
 | (g => g.Must.Exist(attacker))
 | (g => g.Must.Exist(defender))
 | (g => g.Must.BeOwnedBy(attacker, ActivePlayer))
 | (g => g.Must.NotBeOwnedBy(defender, ActivePlayer))
 | (g => g.Must.BeReachable(defender, by: attacker))
 | (g => g.Must.HaveArmiesToAttack(attacker))
 | (g => g.Attack(attacker, defender, Dice
                  .AutoAttack(
                      Countries.ById(attacker).Army,
                      Countries.ById(defender).Army,
                      rnd)));
Exemplo n.º 4
0
 public Result <Game> Advance(Army to)
 => Must.BeInPhase(GamePhase.Advance)
 | (g => g.Must.BeActivePlayer(to.Owner))
 | (g => g.Must.BeOwnedBy(To.Id, to.Owner))
 | (g => g.Must.NotExceedArmyBuffer(to))
 | (g => g.ApplyEvent(new Advanced(to)));