mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-04 23:40:01 +07:00
Fixed a bug where WLTKD would continue after conquering/trading a city (#5748)
This commit is contained in:
@ -559,6 +559,14 @@ class CityInfo {
|
||||
fun setFlag(flag: CityFlags, amount: Int) {
|
||||
flagsCountdown[flag.name] = amount
|
||||
}
|
||||
|
||||
fun resetWLTKD() {
|
||||
// Removes the flags for we love the king & resource demand
|
||||
// The resource demand flag will automatically be readded with 15 turns remaining, see startTurn()
|
||||
flagsCountdown.remove(CityFlags.WeLoveTheKing.name)
|
||||
flagsCountdown.remove(CityFlags.ResourceDemand.name)
|
||||
demandedResource = ""
|
||||
}
|
||||
|
||||
fun reassignPopulation() {
|
||||
var foodWeight = 1f
|
||||
|
@ -68,10 +68,23 @@ class CityInfoConquestFunctions(val city: CityInfo){
|
||||
}
|
||||
cityConstructions.freeBuildingsProvidedFromThisCity.clear()
|
||||
|
||||
// Remove national wonders
|
||||
for (building in cityConstructions.getBuiltBuildings()) {
|
||||
// Remove national wonders
|
||||
if (building.isNationalWonder && !building.hasUnique("Never destroyed when the city is captured"))
|
||||
cityConstructions.removeBuilding(building.name)
|
||||
|
||||
// Check if we exceed MaxNumberBuildable for any buildings
|
||||
for (unique in building.getMatchingUniques(UniqueType.MaxNumberBuildable)) {
|
||||
if (civInfo.cities
|
||||
.count {
|
||||
it.cityConstructions.containsBuildingOrEquivalent(building.name)
|
||||
|| it.cityConstructions.isBeingConstructedOrEnqueued(building.name)
|
||||
} >= unique.params[0].toInt()
|
||||
) {
|
||||
// For now, just destroy in new city. Even if constructing in own cities
|
||||
city.cityConstructions.removeBuilding(building.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -256,24 +269,13 @@ class CityInfoConquestFunctions(val city: CityInfo){
|
||||
population.autoAssignPopulation()
|
||||
}
|
||||
|
||||
// Stop WLTKD if it's still going
|
||||
resetWLTKD()
|
||||
|
||||
// Remove their free buildings from this city and remove free buildings provided by the city from their cities
|
||||
removeBuildingsOnMoveToCiv(oldCiv)
|
||||
// Add our free buildings to this city and add free buildings provided by the city to other cities
|
||||
civInfo.civConstructions.tryAddFreeBuildings()
|
||||
// Check if we exceed MaxNumberBuildable for any buildings
|
||||
for (building in cityConstructions.getBuiltBuildings()) {
|
||||
for (unique in building.getMatchingUniques(UniqueType.MaxNumberBuildable)) {
|
||||
if (civInfo.cities.count {
|
||||
it.cityConstructions.containsBuildingOrEquivalent(building.name) ||
|
||||
it.cityConstructions.isBeingConstructedOrEnqueued(building.name)
|
||||
}
|
||||
>= unique.params[0].toInt()) {
|
||||
// For now, just destroy in new city. Even if constructing in own cities
|
||||
city.cityConstructions.removeBuilding(building.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Place palace for newCiv if this is the only city they have
|
||||
if (newCivInfo.cities.count() == 1) {
|
||||
|
Reference in New Issue
Block a user