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); }
/// <summary> /// Populate the troops array with negative values - which means bot will send /// all available units of that type /// </summary> private int[] SendAllTroops() { var ret = new int[11]; var acc = GetSelectedAcc(); for (int i = 0; i < 10; i++) { if (TroopsData.IsTroopOffensive(acc, i) || i == 6 /* Rams */) { ret[i] = -1; } } return(ret); }