Exemplo n.º 1
0
        public bool TroopsCountRecieved(Account acc, int[] troopsAtHome)
        {
            // Attack with all offensive troops
            for (int i = 0; i < 10; i++)
            {
                var troop = TroopsHelper.TroopFromInt(acc, i);
                if (!TroopsData.IsTroopOffensive(troop))
                {
                    continue;
                }
                base.TroopsMovement.Troops[i] = troopsAtHome[i];
            }
            // Hero
            if (troopsAtHome.Length == 11 && troopsAtHome[10] == 1)
            {
                base.TroopsMovement.Troops[10] = 1;
            }

            // Check if we have enough offensive troops to send
            var upkeep = TroopsHelper.GetTroopsUpkeep(acc, base.TroopsMovement.Troops);

            if (upkeep < this.Vill.FarmingNonGold.MinTroops)
            {
                var log = $"Village {Vill.Name} does not have enough offensive troops to attack the oasis!";
                log += $"Required {this.Vill.FarmingNonGold.MinTroops}, but only {upkeep} (crop consumption) ";
                log += "of off was in the village. Bot won't send the attack.";
                acc.Wb.Log(log);
                return(false);
            }
            return(true);
        }