mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-24 10:01:39 +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:
parent
2193e24364
commit
371690a678
@ -256,9 +256,8 @@ object Automation {
|
||||
city: City,
|
||||
construction: INonPerpetualConstruction
|
||||
): Boolean {
|
||||
return !(construction is Building && construction.isWonder && city.isPuppet)
|
||||
&& allowCreateImprovementBuildings(civInfo, city, construction)
|
||||
&& allowSpendingResource(civInfo, construction, city)
|
||||
return allowCreateImprovementBuildings(civInfo, city, construction)
|
||||
&& allowSpendingResource(civInfo, construction, city)
|
||||
}
|
||||
|
||||
@Suppress("MemberVisibilityCanBePrivate")
|
||||
|
@ -388,32 +388,32 @@ class Building : RulesetStatsObject(), INonPerpetualConstruction {
|
||||
if (!civ.tech.isResearched(requiredTech))
|
||||
yield(RejectionReasonType.RequiresTech.toInstance("$requiredTech not researched!"))
|
||||
|
||||
// Regular wonders
|
||||
if (isWonder) {
|
||||
if (civ.gameInfo.getCities().any { it.cityConstructions.isBuilt(name) })
|
||||
yield(RejectionReasonType.WonderAlreadyBuilt.toInstance())
|
||||
|
||||
// All Wonders
|
||||
if(isAnyWonder()) {
|
||||
if (civ.cities.any { it != cityConstructions.city && it.cityConstructions.isBeingConstructedOrEnqueued(name) })
|
||||
yield(RejectionReasonType.WonderBeingBuiltElsewhere.toInstance())
|
||||
|
||||
if (civ.isCityState())
|
||||
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
|
||||
if (name in ruleSet.eras[startingEra]!!.startingObsoleteWonders)
|
||||
yield(RejectionReasonType.WonderDisabledEra.toInstance())
|
||||
}
|
||||
|
||||
// National wonders
|
||||
// National Wonders
|
||||
if (isNationalWonder) {
|
||||
if (civ.cities.any { it.cityConstructions.isBuilt(name) })
|
||||
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!!)) {
|
||||
|
@ -143,7 +143,6 @@ class RejectionReason(val type: RejectionReasonType,
|
||||
private val orderedImportantRejectionTypes = listOf(
|
||||
RejectionReasonType.ShouldNotBeDisplayed,
|
||||
RejectionReasonType.WonderBeingBuiltElsewhere,
|
||||
RejectionReasonType.NationalWonderBeingBuiltElsewhere,
|
||||
RejectionReasonType.RequiresBuildingInAllCities,
|
||||
RejectionReasonType.RequiresBuildingInThisCity,
|
||||
RejectionReasonType.RequiresBuildingInSomeCity,
|
||||
@ -206,9 +205,8 @@ enum class RejectionReasonType(val shouldShow: Boolean, val errorMessage: String
|
||||
WonderAlreadyBuilt(false, "Wonder already built"),
|
||||
NationalWonderAlreadyBuilt(false, "National Wonder already built"),
|
||||
WonderBeingBuiltElsewhere(true, "Wonder is being built elsewhere"),
|
||||
NationalWonderBeingBuiltElsewhere(true, "National Wonder is being built elsewhere"),
|
||||
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"),
|
||||
|
||||
ConsumesResources(true, "Consumes resources which you are lacking"),
|
||||
|
Loading…
Reference in New Issue
Block a user