public static float GetAttackStrength(int townHallLevel, int castleUpgLevel, LogicArrayList <LogicHeroData> unlockedHeroes, int[] heroUpgLevel, LogicArrayList <LogicCharacterData> unlockedCharacters, int[] characterUpgLevel, int totalHousingSpace, LogicArrayList <LogicSpellData> unlockedSpells, int[] spellUpgLevel, int totalSpellHousingSpace) { float castleStrength = 0f; float heroStrength = 0f; float housingSpellStrength = 0f; float[] chStrengths = new float[unlockedCharacters.Size()]; if (castleUpgLevel > -1) { castleStrength = (castleUpgLevel + 1) * 10f * (castleUpgLevel >= 4 ? 4f : 2f); Debugger.HudPrint("(Attack Strength) Clan Castle: " + castleStrength); } for (int i = 0; i < unlockedHeroes.Size(); i++) { heroStrength += LogicStrengthUtil.GetHeroStrength(unlockedHeroes[i], heroUpgLevel[i], false); } for (int i = 0; i < unlockedCharacters.Size(); i++) { chStrengths[i] = LogicStrengthUtil.GetCharacterStrength(unlockedCharacters[i], characterUpgLevel[i]); } float housingCharacterStrength = LogicStrengthUtil.GetGlobalCharacterStrength(unlockedCharacters, chStrengths, townHallLevel); float characterStrength = totalHousingSpace * 0.01f * housingCharacterStrength; for (int i = 0; i < unlockedSpells.Size(); i++) { housingSpellStrength += LogicStrengthUtil.GetSpellStrength(unlockedSpells[i], spellUpgLevel[i]); } float spellStrength = totalSpellHousingSpace * 0.5f * housingSpellStrength; Debugger.HudPrint(string.Format("(Attack Strength) Heroes: {0}", heroStrength)); Debugger.HudPrint(string.Format("(Attack Strength) Troops: ({0} * {1} army capacity) {2}", housingCharacterStrength, totalHousingSpace, characterStrength)); Debugger.HudPrint(string.Format("(Attack Strength) Spells: ({0} * {1} spell capacity) {2}", housingSpellStrength, totalSpellHousingSpace, spellStrength)); return(castleStrength + heroStrength + characterStrength + spellStrength); }
public static float GetDefenseStrength(LogicArrayList <LogicGameObject> buildings, LogicArrayList <LogicGameObject> traps, LogicArrayList <LogicHeroData> heroes, int[] heroUpgLevel) { float heroStrength = 0f; float buildingStrength = 0f; float trapStrength = 0; for (int i = 0; i < heroes.Size(); i++) { heroStrength += LogicStrengthUtil.GetHeroStrength(heroes[i], heroUpgLevel[i], true); } for (int i = 0; i < buildings.Size(); i++) { LogicBuilding building = (LogicBuilding)buildings[i]; if (!building.IsLocked()) { if (!building.IsConstructing() || building.IsUpgrading()) { buildingStrength += LogicStrengthUtil.GetBuildingStrength(building.GetBuildingData(), building.GetUpgradeLevel()); } } } for (int i = 0; i < traps.Size(); i++) { LogicTrap trap = (LogicTrap)traps[i]; if (!trap.IsConstructing() || trap.IsUpgrading()) { trapStrength += LogicStrengthUtil.GetTrapStrength(trap.GetTrapData(), trap.GetUpgradeLevel()); } } return(buildingStrength + trapStrength + heroStrength); }