Example #1
0
 public override (IAction[], State.Province) Perform(State.Province province, State.Player active)
 {
     if (Province == province.Id)
     {
         var(attacked, actions) = province.AttackedBy(Army);
         return(actions, attacked);
     }
     return(new[] { this }, province);
 }
Example #2
0
 public (IAction[], State.Province) Perform(State.Province province, State.Player active)
 {
     if (province.Occupied && province is State.Land Land && Land.IsControlledBy(active.Id) && rand.NextDouble() < Land.Instability)
     {
         var(land, actions) = Land.Revolt();
         return(actions.Concat(this), land);
     }
     return(new[] { this }, province);
 }
Example #3
0
 public (IAction[], State.Province) Perform(State.Province province, State.Player active)
 {
     if (active.Id == Debtor && province is State.Land land && land.IsControlledBy(Debtor) && Debt > settings.DebtLimit + active.Money)
     {
         var(new_province, actions) = land.Revolt();
         return(land.Price > Debt ? actions : actions.Concat(new Loan(Debtor, Debt - land.Price, settings)), new_province);
     }
     return(new[] { this }, province);
 }
Example #4
0
 public (IAction[], State.Province) Perform(State.Province province, State.Player active)
 {
     if (province is State.Land land && land.IsControlledBy(Player) && Amount > 0)
     {
         var(new_province, actions) = land.Revolt();
         return(Amount <= land.Price ? actions : actions.Concat(new Seizure(Player, Amount - land.Price)), new_province);
     }
     return(new[] { this }, province);
 }
Example #5
0
 public (IAction[], State.Player) Perform(State.Player player, State.Player active, State.IProvinces provinces)
 {
     if (player == active && player.Id == Debtor)
     {
         if (Debt > settings.DebtLimit)
         {
             return(Array.Empty <IAction>(), player.Pay(player.Money));
         }
         return(new[] { new Loan(Debtor, (int)Math.Ceiling(Debt * (1 + settings.Interest)), settings) }, player);
     }
     return(new[] { this }, player);
 }
Example #6
0
 public override (IAction[], State.Province) Perform(State.Province province, State.Player active)
 {
     return(Province == province.Id ? (System.Array.Empty <IAction>(), province.ReinforcedBy(Army)) : (new[] { this }, province));
 }
Example #7
0
 public (IAction[], State.Player) Perform(State.Player player, State.Player active, State.IProvinces provinces)
 {
     return(player.Id == Player ? (System.Array.Empty <IAction>(), player.ChangeIncome(Change)) : (new[] { this }, player));
 }
Example #8
0
 public (IAction[], State.Player) Perform(State.Player player, State.IProvinces provinces)
 {
     return(player.Id == Player ? (new[] { new Actions.Loan(Player, Amount, settings) }, player.GainMoney(Amount)) : (System.Array.Empty <IAction>(), player));
 }
Example #9
0
 public (IAction[], State.Player) Perform(State.Player player, State.IProvinces provinces)
 {
     return(System.Array.Empty <IAction>(), player.Id == Player ? player.Pay(Amount) : player.Id == Recipient ? player.GainMoney(Amount) : player);
 }
Example #10
0
 public abstract (IAction[], State.Province) Perform(State.Province province, State.Player active);
Example #11
0
 public (IAction[], State.Player) Perform(State.Player player, State.IProvinces provinces)
 {
     return(player.Id == Player
                         ? (new[] { new Actions.Reinforcement(Land, Army) }, player.Pay(Army.Soldiers.Price))
                         : (System.Array.Empty <IAction>(), player));
 }
Example #12
0
 public (IAction[], State.Player) Perform(State.Player player, State.Player active, State.IProvinces provinces)
 {
     return(new[] { this }, player == active ? player.Earn() : player);
 }
Example #13
0
 public (IAction[], State.Player) Perform(State.Player player, State.IProvinces provinces)
 {
     return(System.Array.Empty <IAction>(), player.Id == Debtor ? player.Pay(Amount) : player);
 }