When out of gold, units disband at a rate dependant on your deficit

This commit is contained in:
Yair Morgenstern 2018-07-17 23:05:08 +03:00
parent 5fed13eb76
commit 9e50051c61

View file

@ -191,14 +191,15 @@ class CivilizationInfo {
policies.endTurn(nextTurnStats.culture.toInt())
// disband units until there are none left OR the gold values are normal
if(!isBarbarianCivilization() && gold < -100){
var civMilitaryUnits = getCivUnits().filter { it.getBaseUnit().unitType!=UnitType.Civilian }
if(nextTurnStats.gold.toInt() < 0
&& civMilitaryUnits.isNotEmpty()){
val unitToDisband = civMilitaryUnits.first()
unitToDisband.removeFromTile()
civMilitaryUnits -= unitToDisband
addNotification("Cannot provide unit upkeep for "+unitToDisband.name+" - unit has been disbanded!".tr(),null, Color.RED)
if(!isBarbarianCivilization() && gold < -100 && nextTurnStats.gold.toInt() < 0) {
for (i in 1 until (gold / -100)) {
var civMilitaryUnits = getCivUnits().filter { it.getBaseUnit().unitType != UnitType.Civilian }
if (civMilitaryUnits.isNotEmpty()) {
val unitToDisband = civMilitaryUnits.first()
unitToDisband.removeFromTile()
civMilitaryUnits -= unitToDisband
addNotification("Cannot provide unit upkeep for " + unitToDisband.name + " - unit has been disbanded!".tr(), null, Color.RED)
}
}
}