public bool TryBuy(Player p) { bool result = true; Dictionary<Res, int> r = p.PlayerHand.Resources; List<Res> l = new List<Res>(TheCost.Keys); foreach (Res x in l) { if (r.Keys.Contains(x)) { if (!(TheCost[x] <= r.First(y => y.Key == x).Value)) result = false; } else { result = false; break; } } if (result) { foreach (Res x in l) { r[r.First(y => y.Key == x).Key] -= TheCost[x]; p.PlayerHand.Cards.RemoveAll(z => z is Resource && (z as Resource).TheResource == x); } } return result; }
public bool TryBuy(Player p) { bool b = ResCost.TryBuy(p); if (b) p.Discard.Add(this); return b; }
public override bool Act(Player p) { bool result = true; if (p.ArmyLevel < 10) p.ArmyLevel++; else result = false; return result; }
public override bool Act(Player p) { bool result = true; if (p.WarTechLevel < 5) p.WarTechLevel++; else result = false; return result; }
/* public bool Attack(Borderland b) { } */ public bool Attack(Player p, int sent) { int def = p.CalcDefense(); int atk = CalcAttack(sent); bool result = false; if (atk > def) { //code } else { //code } return result; }
public Borderland(String n, Player p, List<Player> players) { Name = n; Relations = new Dictionary<Player, int>(); BorderingPlayer = p; IsOccupied = false; FortLevel = 0; ArmyLevel = 0; WarTechLevel = 0; PopArmyRatio = .15; Population = 10000; ArmyPop = 0; DefendingArmy = 0; Unrest = false; foreach (Player pl in players) Relations.Add(pl, 3); }
public override bool Act(Player p) { bool result = true; bool b = false; if (p.PopArmyRatio < .51) { p.PopArmyRatio += .3; b = true; } if (p.ArmyPop < p.Population * p.PopArmyRatio) { p.ArmyPop += (int)(p.Population * .3); if (p.ArmyPop > p.Population * p.PopArmyRatio) p.ArmyPop = (int)(p.Population * p.PopArmyRatio); } else if (!b) result = false; return result; }
public override bool Act(Player p) { return false; }
public bool CanAttack(Player p) { bool result = false; if (this is Borderland && (this as Borderland).BorderingPlayer == p) result = true; else { if (this is Player) { //May have to allow other players to attack target if borderland occupied by another player, requiring a prompt if (p.MyBorders.Exists(x => x.BorderRelation < x.Relations[(this as Player)] || x.Occupier == this)) result = true; } else { if (p.MyBorders.Exists(x => x.BorderRelation < x.Relations[(this as Borderland).BorderingPlayer] || x.Occupier == this)) result = true; } } return result; }
public abstract bool Act(Player p);