mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 22:06:05 -04:00
Fixed a bug where WLTKD would continue after conquering/trading a city (#5748)
This commit is contained in:
parent
c60381f712
commit
d1224a36cf
@ -560,6 +560,14 @@ class CityInfo {
|
|||||||
flagsCountdown[flag.name] = amount
|
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() {
|
fun reassignPopulation() {
|
||||||
var foodWeight = 1f
|
var foodWeight = 1f
|
||||||
var foodPerTurn = 0f
|
var foodPerTurn = 0f
|
||||||
|
@ -68,10 +68,23 @@ class CityInfoConquestFunctions(val city: CityInfo){
|
|||||||
}
|
}
|
||||||
cityConstructions.freeBuildingsProvidedFromThisCity.clear()
|
cityConstructions.freeBuildingsProvidedFromThisCity.clear()
|
||||||
|
|
||||||
// Remove national wonders
|
|
||||||
for (building in cityConstructions.getBuiltBuildings()) {
|
for (building in cityConstructions.getBuiltBuildings()) {
|
||||||
|
// Remove national wonders
|
||||||
if (building.isNationalWonder && !building.hasUnique("Never destroyed when the city is captured"))
|
if (building.isNationalWonder && !building.hasUnique("Never destroyed when the city is captured"))
|
||||||
cityConstructions.removeBuilding(building.name)
|
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()
|
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
|
// Remove their free buildings from this city and remove free buildings provided by the city from their cities
|
||||||
removeBuildingsOnMoveToCiv(oldCiv)
|
removeBuildingsOnMoveToCiv(oldCiv)
|
||||||
// Add our free buildings to this city and add free buildings provided by the city to other cities
|
// Add our free buildings to this city and add free buildings provided by the city to other cities
|
||||||
civInfo.civConstructions.tryAddFreeBuildings()
|
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
|
// Place palace for newCiv if this is the only city they have
|
||||||
if (newCivInfo.cities.count() == 1) {
|
if (newCivInfo.cities.count() == 1) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user