Buildings requiring nearnby resources now say so - thanks zivvel!

Promotion bonuses no longer override unit-specific ones, but are added - thanks ninjatao!
This commit is contained in:
Yair Morgenstern 2018-11-28 17:54:00 +02:00
parent 43ec085b89
commit defeb7431b
2 changed files with 14 additions and 3 deletions

View File

@ -28,14 +28,20 @@ class BattleDamage{
private fun getGeneralModifiers(combatant: ICombatant, enemy: ICombatant): HashMap<String, Float> {
val modifiers = HashMap<String, Float>()
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

View File

@ -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())