package com.bernard.greposimu.model; import java.util.AbstractMap; import java.util.Collection; import java.util.Map; import java.util.Map.Entry; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; import com.bernard.greposimu.model.game.GameConfig; import com.bernard.greposimu.model.game.units.Hero; import com.bernard.greposimu.model.game.units.Unit; public class DefContext { // UNITS Map units; // HEROS Hero hero; int heroLevel; // BUILDINGS int wallLevel; boolean hasTower; // RESEARCHES boolean divineSelection, phalanx, ram; // COUNSELLORS boolean commander; boolean priest; boolean captain; // EFFECTS boolean acumen, divineSenses, myrmidionAttack, trojanDefense, defenseBoost, defensePenalty, longtermDefenseBoost, assassinsAcumen, rareDefenseBoost, epicDefenseBoost, missionsPower4, divineBattleStrategyRare, divineBattleStrategyEpic, navalBattleStrategyRare, navalBattleStrategyEpic, landBattleStrategyRare, landBattleStrategyEpic; int olympicSensesGrepolympiaSummerLevel = 0; int olympicTorchGrepolympiaSummerLevel = 0; int soteriasShrineLevel = 0; // BONUSES boolean nightBonus; public DefContext(Map units, Hero hero, int heroLevel, int wallLevel, boolean hasTower, Set powers, int soteriasShrinePowerLevel, int olympicTorchGrepolympiaSummerLevel, int olympicSensesGrepolympiaSummerLevel, Set researches, Set counsellors, boolean nightBonus) { this.units = units; this.hero = hero; this.heroLevel = heroLevel; this.wallLevel = wallLevel; this.hasTower = hasTower; if(powers.contains("acumen"))this.acumen = true; if(powers.contains("divine_senses"))this.divineSenses = true; if(powers.contains("myrmdion_attack"))this.myrmidionAttack = true; if(powers.contains("trojan_defense"))this.trojanDefense = true; if(powers.contains("defense_boost"))this.defenseBoost = true; if(powers.contains("defense_penalty"))this.defensePenalty = true; if(powers.contains("longterm_defense_boost"))this.longtermDefenseBoost = true; if(powers.contains("assassins_acumen"))this.assassinsAcumen = true; if(powers.contains("rare_defense_boost"))this.rareDefenseBoost = true; if(powers.contains("epic_defense_boost"))this.defenseBoost = true; if(powers.contains("olympic_torch"))this.olympicTorchGrepolympiaSummerLevel = olympicTorchGrepolympiaSummerLevel; if(powers.contains("olympic_senses"))this.olympicSensesGrepolympiaSummerLevel = olympicSensesGrepolympiaSummerLevel; if(powers.contains("missions_power_4"))this.missionsPower4 = true; if(powers.contains("divine_battle_strategy_rare"))this.divineBattleStrategyRare = true; if(powers.contains("divine_battle_strategy_epic"))this.divineBattleStrategyEpic = true; if(powers.contains("naval_battle_strategy_rare"))this.navalBattleStrategyRare = true; if(powers.contains("naval_battle_strategy_epic"))this.navalBattleStrategyEpic = true; if(powers.contains("land_battle_strategy_rare"))this.landBattleStrategyRare = true; if(powers.contains("land_battle_strategy_epic"))this.landBattleStrategyEpic = true; if(powers.contains("soterias_shrine"))this.soteriasShrineLevel = soteriasShrinePowerLevel; if(researches.contains("divine_selection"))this.divineSelection = true; if(researches.contains("phalanx"))this.phalanx = true; if(researches.contains("ram"))this.ram = true; if(counsellors.contains("commander"))this.commander = true; if(counsellors.contains("priest"))this.priest = true; if(counsellors.contains("captain"))this.captain = true; this.nightBonus = nightBonus; } public Map getUnits() { return units; } public int unitCount(Unit u) { return Optional.ofNullable(units.getOrDefault(u,0)).orElse(0); } public Hero getHero() { return hero; } public int getHeroLevel() { return heroLevel; } public int getWallLevel() { return wallLevel; } public boolean hasTower() { return hasTower; } public boolean isNightBonus() { return nightBonus; } public boolean hasDivineSelection() { return divineSelection; } public boolean hasPhalanx() { return phalanx; } public boolean hasRam() { return ram; } public boolean hasCommander() { return commander; } public boolean hasPriest() { return priest; } public boolean hasCaptain() { return captain; } public boolean hasAcumen() { return acumen; } public boolean hasDivineSenses() { return divineSenses; } public boolean hasMyrmidionAttack() { return myrmidionAttack; } public boolean hasTrojanDefense() { return trojanDefense; } public boolean hasDefenseBoost() { return defenseBoost; } public boolean hasDefensePenalty() { return defensePenalty; } public boolean hasLongtermDefenseBoost() { return longtermDefenseBoost; } public boolean hasAssassinsAcumen() { return assassinsAcumen; } public boolean hasRareDefenseBoost() { return rareDefenseBoost; } public boolean hasEpicDefenseBoost() { return epicDefenseBoost; } public boolean hasMhassionsPower4() { return missionsPower4; } public boolean hasDivineBattleStrategyRare() { return divineBattleStrategyRare; } public boolean hasDivineBattleStrategyEpic() { return divineBattleStrategyEpic; } public boolean hasNavalBattleStrategyRare() { return navalBattleStrategyRare; } public boolean hasNavalBattleStrategyEpic() { return navalBattleStrategyEpic; } public boolean hasLandBattleStrategyRare() { return landBattleStrategyRare; } public boolean hasLandBattleStrategyEpic() { return landBattleStrategyEpic; } public int getOlympicSensesGrepolympiaSummerLevel() { return olympicSensesGrepolympiaSummerLevel; } public int getOlympicTorchGrepolympiaSummerLevel() { return olympicTorchGrepolympiaSummerLevel; } public int getSoteriasShrineLevel() { return soteriasShrineLevel; } }