Add "Will be destroyed when pillaged" unique (#12943)

* Add Will be destroyed when pillaged unique

* Applied the suggestions of yairm210
This commit is contained in:
PLynx 2025-02-13 19:34:32 +01:00 committed by GitHub
parent 5dc4a28707
commit 34b281ebfc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 0 deletions

View File

@ -642,6 +642,7 @@ enum class UniqueType(
Unpillagable("Unpillagable", UniqueTarget.Improvement),
PillageYieldRandom("Pillaging this improvement yields approximately [stats]", UniqueTarget.Improvement),
PillageYieldFixed("Pillaging this improvement yields [stats]", UniqueTarget.Improvement),
DestroyedWhenPillaged("Destroyed when pillaged", UniqueTarget.Improvement),
Irremovable("Irremovable", UniqueTarget.Improvement),
AutomatedUnitsWillNotReplace("Will not be replaced by automated units", UniqueTarget.Improvement),
ImprovesResources("Improves [resourceFilter] resource in this tile", UniqueTarget.Improvement, flags = UniqueFlag.setOfNoConditionals,

View File

@ -63,6 +63,11 @@ object UnitActionsPillage {
if (pillagingImprovement) // only Improvements heal HP
unit.healBy(25)
if (tile.getImprovementToPillage()?.hasUnique(UniqueType.DestroyedWhenPillaged) == true) {
tile.removeImprovement()
}
}.takeIf { unit.hasMovement() && canPillage(unit, tile) }
)
}

View File

@ -2510,6 +2510,9 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
Applicable to: Improvement
??? example "Will be destroyed when pillaged"
Applicable to: Improvement
??? example "Irremovable"
Applicable to: Improvement