mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-26 21:35:14 -04:00
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
@ -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."){
|
||||||
|
@ -281,6 +281,8 @@ class MapUnit {
|
|||||||
return healingBonus
|
return healingBonus
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun canGarrison() = type.isMilitary() && type.isLandUnit()
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
//region state-changing functions
|
//region state-changing functions
|
||||||
|
@ -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…
x
Reference in New Issue
Block a user