From defeb7431bc333a3b1db4cd981f4918307eb67c1 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Wed, 28 Nov 2018 17:54:00 +0200 Subject: [PATCH] Buildings requiring nearnby resources now say so - thanks zivvel! Promotion bonuses no longer override unit-specific ones, but are added - thanks ninjatao! --- core/src/com/unciv/logic/battle/BattleDamage.kt | 12 +++++++++--- core/src/com/unciv/models/gamebasics/Building.kt | 5 +++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/core/src/com/unciv/logic/battle/BattleDamage.kt b/core/src/com/unciv/logic/battle/BattleDamage.kt index 30552c9fa3..4028dfbf15 100644 --- a/core/src/com/unciv/logic/battle/BattleDamage.kt +++ b/core/src/com/unciv/logic/battle/BattleDamage.kt @@ -28,14 +28,20 @@ class BattleDamage{ private fun getGeneralModifiers(combatant: ICombatant, enemy: ICombatant): HashMap { val modifiers = HashMap() + fun addToModifiers(BDM:BattleDamageModifier){ + val text = BDM.getText() + if(!modifiers.containsKey(text)) modifiers[text]=0f + modifiers[text]=modifiers[text]!!+BDM.modificationAmount + } + if (combatant is MapUnitCombatant) { for (BDM in getBattleDamageModifiersOfUnit(combatant.unit)) { if (BDM.vs == enemy.getUnitType().toString()) - modifiers[BDM.getText()] = BDM.modificationAmount + addToModifiers(BDM) if(BDM.vs == "wounded units" && enemy is MapUnitCombatant && enemy.getHealth()<100) - modifiers[BDM.getText()] = BDM.modificationAmount + addToModifiers(BDM) if(BDM.vs == "land units" && enemy.getUnitType().isLandUnit()) - modifiers[BDM.getText()] = BDM.modificationAmount + addToModifiers(BDM) } if (combatant.getCivilization().happiness < 0) modifiers["Unhappiness"] = 0.02f * combatant.getCivilization().happiness //https://www.carlsguides.com/strategy/civilization5/war/combatbonuses.php diff --git a/core/src/com/unciv/models/gamebasics/Building.kt b/core/src/com/unciv/models/gamebasics/Building.kt index 261b7bc607..d7765a8557 100644 --- a/core/src/com/unciv/models/gamebasics/Building.kt +++ b/core/src/com/unciv/models/gamebasics/Building.kt @@ -60,6 +60,8 @@ class Building : NamedStats(), IConstruction{ // buildings that improve resources infoList += improvedResources.joinToString()+ " {provide} ".tr()+ resourceBonusStats.toString() } + if(requiredNearbyImprovedResources!=null) + infoList += "requires worked "+requiredNearbyImprovedResources!!.joinToString("/")+" near city" if(uniques.isNotEmpty()) infoList += uniques.map { it.tr() }.joinToString() if(cityStrength!=0) infoList+="{City strength} +".tr()+cityStrength if(cityHealth!=0) infoList+="{City health} +".tr()+cityHealth @@ -103,6 +105,9 @@ class Building : NamedStats(), IConstruction{ stringBuilder.appendln("$resources {provide} $resourceBonusStats".tr()) } + if(requiredNearbyImprovedResources!=null) + stringBuilder.appendln("Requires worked "+requiredNearbyImprovedResources!!.joinToString("/")+" near city") + if(cityStrength!=0) stringBuilder.appendln("{City strength} +".tr() + cityStrength) if(cityHealth!=0) stringBuilder.appendln("{City health} +".tr() + cityHealth) if(xpForNewUnits!=0) stringBuilder.appendln("+$xpForNewUnits {XP for new units}".tr())