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