Unhappiness combat penalty capped at 90% - kudos anh pham-vu!

This commit is contained in:
Yair Morgenstern 2018-12-04 13:09:38 +02:00
parent eba64d38ee
commit 3fe6bbeecc
2 changed files with 7 additions and 2 deletions

View file

@ -133,13 +133,15 @@ class Battle(val gameInfo:GameInfo) {
else {
val currentPopulation = city.population.population
if(currentPopulation>1) city.population.population -= 1 + currentPopulation/4 // so from 2-4 population, remove 1, from 5-8, remove 2, etc.
city.population.unassignExtraPopulation()
city.health = city.getMaxHealth() / 2 // I think that cities recover to half health when conquered?
if(!attacker.getCivilization().policies.isAdopted("Police State")) {
city.expansion.cultureStored = 0
city.expansion.reset()
}
city.population.unassignExtraPopulation()
city.moveToCiv(attacker.getCivilization())
}

View file

@ -2,6 +2,7 @@ package com.unciv.logic.battle
import com.unciv.logic.map.MapUnit
import com.unciv.models.gamebasics.unit.UnitType
import kotlin.math.max
class BattleDamageModifier(val vs:String,val modificationAmount:Float){
fun getText(): String = "vs $vs"
@ -43,8 +44,10 @@ class BattleDamage{
if(BDM.vs == "land units" && enemy.getUnitType().isLandUnit())
addToModifiers(BDM)
}
//https://www.carlsguides.com/strategy/civilization5/war/combatbonuses.php
if (combatant.getCivilization().happiness < 0)
modifiers["Unhappiness"] = 0.02f * combatant.getCivilization().happiness //https://www.carlsguides.com/strategy/civilization5/war/combatbonuses.php
modifiers["Unhappiness"] = max(0.02f * combatant.getCivilization().happiness,0.9f)
if(combatant.getCivilization().policies.isAdopted("Populism"))
modifiers["Populism"] = 0.25f