Fix: Oligarchy (#1740)
* Fix: Oligarchy applying to civilian, water and air units * Fix: moving unit into/out of city doesn't trigger income refresh
This commit is contained in:
parent
5c42e7f1fb
commit
73fc55eb0c
3 changed files with 13 additions and 1 deletions
|
@ -18,7 +18,11 @@ class CivInfoStats(val civInfo: CivilizationInfo){
|
||||||
val freeUnits = 3
|
val freeUnits = 3
|
||||||
var unitsToPayFor = civInfo.getCivUnits()
|
var unitsToPayFor = civInfo.getCivUnits()
|
||||||
if(civInfo.policies.isAdopted("Oligarchy"))
|
if(civInfo.policies.isAdopted("Oligarchy"))
|
||||||
unitsToPayFor = unitsToPayFor.filterNot { it.getTile().isCityCenter() }
|
// Only land military units can truly "garrison"
|
||||||
|
unitsToPayFor = unitsToPayFor.filterNot {
|
||||||
|
it.getTile().isCityCenter()
|
||||||
|
&& it.canGarrison()
|
||||||
|
}
|
||||||
|
|
||||||
var numberOfUnitsToPayFor = max(0f, unitsToPayFor.count().toFloat() - freeUnits)
|
var numberOfUnitsToPayFor = max(0f, unitsToPayFor.count().toFloat() - freeUnits)
|
||||||
if(civInfo.nation.unique=="67% chance to earn 25 Gold and recruit a Barbarian unit from a conquered encampment, -25% land units maintenance."){
|
if(civInfo.nation.unique=="67% chance to earn 25 Gold and recruit a Barbarian unit from a conquered encampment, -25% land units maintenance."){
|
||||||
|
|
|
@ -280,6 +280,8 @@ class MapUnit {
|
||||||
if(hasUnique("This unit and all others in adjacent tiles heal 5 additional HP. This unit heals 5 additional HP outside of friendly territory.")) healingBonus +=5
|
if(hasUnique("This unit and all others in adjacent tiles heal 5 additional HP. This unit heals 5 additional HP outside of friendly territory.")) healingBonus +=5
|
||||||
return healingBonus
|
return healingBonus
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun canGarrison() = type.isMilitary() && type.isLandUnit()
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
|
|
|
@ -243,6 +243,12 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
|
||||||
unit.removeFromTile()
|
unit.removeFromTile()
|
||||||
unit.putInTile(destination)
|
unit.putInTile(destination)
|
||||||
|
|
||||||
|
// Unit maintenance changed
|
||||||
|
if (unit.canGarrison()
|
||||||
|
&& (origin.isCityCenter() || destination.isCityCenter())
|
||||||
|
&& unit.civInfo.policies.isAdopted("Oligarchy")
|
||||||
|
) unit.civInfo.updateStatsForNextTurn()
|
||||||
|
|
||||||
if(unit.type.isAircraftCarrierUnit() || unit.type.isMissileCarrierUnit()){ // bring along the payloads
|
if(unit.type.isAircraftCarrierUnit() || unit.type.isMissileCarrierUnit()){ // bring along the payloads
|
||||||
for(airUnit in origin.airUnits.filter { !it.isUnitInCity }){
|
for(airUnit in origin.airUnits.filter { !it.isUnitInCity }){
|
||||||
airUnit.removeFromTile()
|
airUnit.removeFromTile()
|
||||||
|
|
Loading…
Reference in a new issue