mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-20 04:38:18 +07:00
Fix Puppets building wonders (#11480)
* Fix Puppets building wonders * Revert 'Disallow wonders from being selected in puppets, even when 'just' choosing best stat building' * Simplify wonder logic to not check national wonders separately * Whoops, world wonder and national wonders have different already built checks
This commit is contained in:
@ -256,8 +256,7 @@ object Automation {
|
|||||||
city: City,
|
city: City,
|
||||||
construction: INonPerpetualConstruction
|
construction: INonPerpetualConstruction
|
||||||
): Boolean {
|
): Boolean {
|
||||||
return !(construction is Building && construction.isWonder && city.isPuppet)
|
return allowCreateImprovementBuildings(civInfo, city, construction)
|
||||||
&& allowCreateImprovementBuildings(civInfo, city, construction)
|
|
||||||
&& allowSpendingResource(civInfo, construction, city)
|
&& allowSpendingResource(civInfo, construction, city)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -388,32 +388,32 @@ class Building : RulesetStatsObject(), INonPerpetualConstruction {
|
|||||||
if (!civ.tech.isResearched(requiredTech))
|
if (!civ.tech.isResearched(requiredTech))
|
||||||
yield(RejectionReasonType.RequiresTech.toInstance("$requiredTech not researched!"))
|
yield(RejectionReasonType.RequiresTech.toInstance("$requiredTech not researched!"))
|
||||||
|
|
||||||
// Regular wonders
|
// All Wonders
|
||||||
if (isWonder) {
|
if(isAnyWonder()) {
|
||||||
if (civ.gameInfo.getCities().any { it.cityConstructions.isBuilt(name) })
|
|
||||||
yield(RejectionReasonType.WonderAlreadyBuilt.toInstance())
|
|
||||||
|
|
||||||
if (civ.cities.any { it != cityConstructions.city && it.cityConstructions.isBeingConstructedOrEnqueued(name) })
|
if (civ.cities.any { it != cityConstructions.city && it.cityConstructions.isBeingConstructedOrEnqueued(name) })
|
||||||
yield(RejectionReasonType.WonderBeingBuiltElsewhere.toInstance())
|
yield(RejectionReasonType.WonderBeingBuiltElsewhere.toInstance())
|
||||||
|
|
||||||
if (civ.isCityState())
|
if (civ.isCityState())
|
||||||
yield(RejectionReasonType.CityStateWonder.toInstance())
|
yield(RejectionReasonType.CityStateWonder.toInstance())
|
||||||
|
|
||||||
|
if (cityConstructions.city.isPuppet)
|
||||||
|
yield(RejectionReasonType.PuppetWonder.toInstance())
|
||||||
|
}
|
||||||
|
|
||||||
|
// World Wonders
|
||||||
|
if (isWonder) {
|
||||||
|
if (civ.gameInfo.getCities().any { it.cityConstructions.isBuilt(name) })
|
||||||
|
yield(RejectionReasonType.WonderAlreadyBuilt.toInstance())
|
||||||
|
|
||||||
val startingEra = civ.gameInfo.gameParameters.startingEra
|
val startingEra = civ.gameInfo.gameParameters.startingEra
|
||||||
if (name in ruleSet.eras[startingEra]!!.startingObsoleteWonders)
|
if (name in ruleSet.eras[startingEra]!!.startingObsoleteWonders)
|
||||||
yield(RejectionReasonType.WonderDisabledEra.toInstance())
|
yield(RejectionReasonType.WonderDisabledEra.toInstance())
|
||||||
}
|
}
|
||||||
|
|
||||||
// National wonders
|
// National Wonders
|
||||||
if (isNationalWonder) {
|
if (isNationalWonder) {
|
||||||
if (civ.cities.any { it.cityConstructions.isBuilt(name) })
|
if (civ.cities.any { it.cityConstructions.isBuilt(name) })
|
||||||
yield(RejectionReasonType.NationalWonderAlreadyBuilt.toInstance())
|
yield(RejectionReasonType.NationalWonderAlreadyBuilt.toInstance())
|
||||||
|
|
||||||
if (civ.cities.any { it != cityConstructions.city && it.cityConstructions.isBeingConstructedOrEnqueued(name) })
|
|
||||||
yield(RejectionReasonType.NationalWonderBeingBuiltElsewhere.toInstance())
|
|
||||||
|
|
||||||
if (civ.isCityState())
|
|
||||||
yield(RejectionReasonType.CityStateNationalWonder.toInstance())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (requiredBuilding != null && !cityConstructions.containsBuildingOrEquivalent(requiredBuilding!!)) {
|
if (requiredBuilding != null && !cityConstructions.containsBuildingOrEquivalent(requiredBuilding!!)) {
|
||||||
|
@ -143,7 +143,6 @@ class RejectionReason(val type: RejectionReasonType,
|
|||||||
private val orderedImportantRejectionTypes = listOf(
|
private val orderedImportantRejectionTypes = listOf(
|
||||||
RejectionReasonType.ShouldNotBeDisplayed,
|
RejectionReasonType.ShouldNotBeDisplayed,
|
||||||
RejectionReasonType.WonderBeingBuiltElsewhere,
|
RejectionReasonType.WonderBeingBuiltElsewhere,
|
||||||
RejectionReasonType.NationalWonderBeingBuiltElsewhere,
|
|
||||||
RejectionReasonType.RequiresBuildingInAllCities,
|
RejectionReasonType.RequiresBuildingInAllCities,
|
||||||
RejectionReasonType.RequiresBuildingInThisCity,
|
RejectionReasonType.RequiresBuildingInThisCity,
|
||||||
RejectionReasonType.RequiresBuildingInSomeCity,
|
RejectionReasonType.RequiresBuildingInSomeCity,
|
||||||
@ -206,9 +205,8 @@ enum class RejectionReasonType(val shouldShow: Boolean, val errorMessage: String
|
|||||||
WonderAlreadyBuilt(false, "Wonder already built"),
|
WonderAlreadyBuilt(false, "Wonder already built"),
|
||||||
NationalWonderAlreadyBuilt(false, "National Wonder already built"),
|
NationalWonderAlreadyBuilt(false, "National Wonder already built"),
|
||||||
WonderBeingBuiltElsewhere(true, "Wonder is being built elsewhere"),
|
WonderBeingBuiltElsewhere(true, "Wonder is being built elsewhere"),
|
||||||
NationalWonderBeingBuiltElsewhere(true, "National Wonder is being built elsewhere"),
|
|
||||||
CityStateWonder(false, "No Wonders for city-states"),
|
CityStateWonder(false, "No Wonders for city-states"),
|
||||||
CityStateNationalWonder(false, "No National Wonders for city-states"),
|
PuppetWonder(false, "No Wonders for Puppets"),
|
||||||
WonderDisabledEra(false, "This Wonder is disabled when starting in this era"),
|
WonderDisabledEra(false, "This Wonder is disabled when starting in this era"),
|
||||||
|
|
||||||
ConsumesResources(true, "Consumes resources which you are lacking"),
|
ConsumesResources(true, "Consumes resources which you are lacking"),
|
||||||
|
Reference in New Issue
Block a user