public override void DoTick() { base.DoTick(); if (Progress == 0 && Inventory.RecipeApplicable(InputRecipe) && TroopInventory.GetAvailableSpace() > 0) { Progress = 1; Inventory.ApplyRecipe(InputRecipe); } }
public Headquarter( HexCell Cell, byte Tribe, byte Level, byte Health, TroopInventory TroopInventory, BuildingInventory Inventory ) : base(Cell, Tribe, Level, Health, TroopInventory, Inventory) { }
public ProtectedBuilding( HexCell Cell, byte Tribe, byte Level, byte Health, TroopInventory TroopInventory ) : base(Cell, Tribe, Level, Health) { this.TroopInventory = TroopInventory; }
public ProductionBuilding( HexCell Cell, byte Tribe, byte Level, byte Health, TroopInventory TroopInventory, BuildingInventory Inventory, int Progress ) : base(Cell, Tribe, Level, Health, TroopInventory, Inventory, Progress) { }
public Woodcutter( HexCell Cell, byte Tribe, byte Level, byte Health, TroopInventory TroopInventory, BuildingInventory Inventory, int Progress ) : base(Cell, Tribe, Level, Health, TroopInventory, Inventory, Progress) { }
public bool MoveTroops(TroopInventory destination, TroopType troopType, int amount) { if (this.Troops[troopType] - amount >= 0 && destination.GetTroopCount() + amount <= destination.TroopLimit) { //Move troops this.Troops[troopType] -= amount; destination.Troops[troopType] += amount; return(true); } return(false); }
public ProgressBuilding( HexCell Cell, byte Tribe, byte Level, byte Health, TroopInventory TroopInventory, BuildingInventory Inventory, int Progress ) : base(Cell, Tribe, Level, Health, TroopInventory, Inventory) { this.Progress = Progress; }
public InventoryBuilding( HexCell Cell, byte Tribe, byte Level, byte Health, TroopInventory TroopInventory, BuildingInventory Inventory ) : base(Cell, Tribe, Level, Health, TroopInventory) { this.Inventory = Inventory; this.ConnectedInventories = new Dictionary <InventoryBuilding, Tuple <HexDirection, int, int> >(); this.Carts = new List <Cart>(); }
public Market( HexCell Cell, byte Tribe, byte Level, byte Health, TroopInventory TroopInventory, BuildingInventory Inventory, int Progress, RessourceType TradeInput, RessourceType TradeOutput ) : base(Cell, Tribe, Level, Health, TroopInventory, Inventory, Progress) { this.TradeInput = TradeInput; this.TradeOutput = TradeOutput; }
public bool Fight(TroopInventory defender) { TroopInventory attacker = this; Troop attackerTroop = attacker.GetInitialTroop(); Troop defenderTroop = defender.GetInitialTroop(); while (attackerTroop != null && defenderTroop != null) { attackerTroop.Fight(defenderTroop); if (attackerTroop.health <= 0) { attacker.RemoveUnit(attackerTroop.type, 1); attackerTroop = attacker.GetNextTroop(attackerTroop.type); } if (defenderTroop.health <= 0) { defender.RemoveUnit(defenderTroop.type, 1); defenderTroop = defender.GetNextTroop(defenderTroop.type); } } return(defender.GetTroopCount() > 0 ? false : true); }
public ProtectedBuilding() : base() { this.TroopInventory = new TroopInventory(); }