Add May not annex cities unique (#9314)

* Add `May not annex cities` unique, following same behaviour as Civ5 Venice. Hopefully this time I won't need to re-install windows.

* Add `May not annex cities` unique, following same behaviour as Civ5 Venice. Hopefully this time I won't need to re-install windows.

* Fix raze button being unavailable in city screen

* Fixed raze button being available in city screen, as per civ5

* Corrected indentation

* mayAnnex instead of canAnnex, hasUnique rather than getMatchingUniques

* AI will follow rules

* Replaced getMatchingUniques with hasUnique, for real this time
This commit is contained in:
Skekdog
2023-05-09 21:02:19 +01:00
committed by GitHub
parent 203477eca1
commit a3ef6fa314
8 changed files with 53 additions and 21 deletions

View File

@ -1016,7 +1016,7 @@ object NextTurnAutomation {
ownMilitaryStrength < sumOfEnemiesMilitaryStrength * 0.66f
for (city in civInfo.cities) {
if (city.isPuppet && city.population.population > 9
&& !city.isInResistance()
&& !city.isInResistance() && !civInfo.hasUnique(UniqueType.MayNotAnnexCities)
) {
city.annexCity()
}
@ -1124,7 +1124,7 @@ object NextTurnAutomation {
if ((city.population.population < 4 || civInfo.isCityState())
&& city.foundingCiv != civInfo.civName && city.canBeDestroyed(justCaptured = true)) {
// raze if attacker is a city state
city.annexCity()
if (!civInfo.hasUnique(UniqueType.MayNotAnnexCities)) { city.annexCity() }
city.isBeingRazed = true
}
}

View File

@ -595,6 +595,7 @@ object Battle {
if (city.isOriginalCapital && city.foundingCiv == attackerCiv.civName) {
// retaking old capital
city.puppetCity(attackerCiv)
//Although in Civ5 Venice is unable to re-annex their capital, that seems a bit silly. No check for May not annex cities here.
city.annexCity()
} else if (attackerCiv.isHuman()) {
// we're not taking our former capital

View File

@ -315,6 +315,13 @@ class CityInfoConquestFunctions(val city: City){
if (civ.gameInfo.isReligionEnabled()) religion.removeUnknownPantheons()
if (newCiv.hasUnique(UniqueType.MayNotAnnexCities)) {
isPuppet = true
cityConstructions.currentConstructionIsUserSet = false
cityConstructions.constructionQueue.clear()
cityConstructions.chooseNextConstruction()
}
tryUpdateRoadStatus()
cityStats.update()