Example #1
0
 public override void DoTick()
 {
     base.DoTick();
     if (Progress == 0 && Inventory.RecipeApplicable(InputRecipe) && TroopInventory.GetAvailableSpace() > 0)
     {
         Progress = 1;
         Inventory.ApplyRecipe(InputRecipe);
     }
 }
Example #2
0
 public Headquarter(
     HexCell Cell,
     byte Tribe,
     byte Level,
     byte Health,
     TroopInventory TroopInventory,
     BuildingInventory Inventory
     ) : base(Cell, Tribe, Level, Health, TroopInventory, Inventory)
 {
 }
Example #3
0
 public ProtectedBuilding(
     HexCell Cell,
     byte Tribe,
     byte Level,
     byte Health,
     TroopInventory TroopInventory
     ) : base(Cell, Tribe, Level, Health)
 {
     this.TroopInventory = TroopInventory;
 }
Example #4
0
 public ProductionBuilding(
     HexCell Cell,
     byte Tribe,
     byte Level,
     byte Health,
     TroopInventory TroopInventory,
     BuildingInventory Inventory,
     int Progress
     ) : base(Cell, Tribe, Level, Health, TroopInventory, Inventory, Progress)
 {
 }
Example #5
0
 public Woodcutter(
     HexCell Cell,
     byte Tribe,
     byte Level,
     byte Health,
     TroopInventory TroopInventory,
     BuildingInventory Inventory,
     int Progress
     ) : base(Cell, Tribe, Level, Health, TroopInventory, Inventory, Progress)
 {
 }
Example #6
0
 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);
 }
Example #7
0
 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>();
 }
Example #9
0
 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;
 }
Example #10
0
        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);
        }
Example #11
0
 public ProtectedBuilding() : base()
 {
     this.TroopInventory = new TroopInventory();
 }