mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-19 08:47:57 +07:00
Trigger resource recalculation upon gaining a unit that requires resources
This commit is contained in:
parent
fcd309781d
commit
a7107fa04d
@ -70,10 +70,13 @@ class UnitManager(val civInfo:Civilization) {
|
||||
fun placeUnitNearTile(location: Vector2, unitName: String): MapUnit? {
|
||||
val unit = civInfo.gameInfo.tileMap.placeUnitNearTile(location, unitName, civInfo)
|
||||
|
||||
if (unit != null)
|
||||
if (unit != null) {
|
||||
for (unique in civInfo.getTriggeredUniques(UniqueType.TriggerUponGainingUnit))
|
||||
if (unit.matchesFilter(unique.params[0]))
|
||||
UniqueTriggerActivation.triggerCivwideUnique(unique, civInfo)
|
||||
if (unit.baseUnit.getResourceRequirementsPerTurn().isNotEmpty())
|
||||
civInfo.cache.updateCivResources()
|
||||
}
|
||||
return unit
|
||||
}
|
||||
fun getCivUnitsSize(): Int = unitList.size
|
||||
|
@ -278,7 +278,7 @@ class CivInfoTransientCache(val civInfo: Civilization) {
|
||||
for (city in civInfo.cities) newDetailedCivResources.add(city.getCityResources())
|
||||
|
||||
for (resourceSupply in newDetailedCivResources)
|
||||
if(resourceSupply.amount > 0)
|
||||
if (resourceSupply.amount > 0)
|
||||
resourceSupply.amount = (resourceSupply.amount * civInfo.getResourceModifier(resourceSupply.resource)).toInt()
|
||||
|
||||
if (!civInfo.isCityState()) {
|
||||
|
Loading…
Reference in New Issue
Block a user