mirror of
https://github.com/yairm210/Unciv.git
synced 2025-03-04 22:50:50 +07:00
Make city center unpillagable using a unique (#3818)
This commit is contained in:
parent
1eb3629c09
commit
e2c6ae450d
@ -209,8 +209,8 @@
|
||||
"shortcutKey": "F"
|
||||
},
|
||||
|
||||
{ "name": "Ancient ruins" },
|
||||
{ "name": "City ruins" },
|
||||
{ "name": "City center" },
|
||||
{ "name": "Barbarian encampment" }
|
||||
{ "name": "Ancient ruins", "uniques": ["Unpillagable"] },
|
||||
{ "name": "City ruins", "uniques": ["Unpillagable"] },
|
||||
{ "name": "City center", "uniques": ["Unpillagable"] },
|
||||
{ "name": "Barbarian encampment", "uniques": ["Unpillagable"] }
|
||||
]
|
||||
|
@ -439,9 +439,9 @@ object UnitActions {
|
||||
}
|
||||
|
||||
fun canPillage(unit: MapUnit, tile: TileInfo): Boolean {
|
||||
if (tile.improvement == null || tile.improvement == Constants.barbarianEncampment
|
||||
|| tile.improvement == Constants.ancientRuins
|
||||
|| tile.improvement == "City ruins") return false
|
||||
val tileImprovement = tile.getTileImprovement()
|
||||
// City ruins, Ancient Ruins, Barbarian Camp, City Center marked in json
|
||||
if (tileImprovement == null || tileImprovement.hasUnique("Unpillagable")) return false
|
||||
val tileOwner = tile.getOwner()
|
||||
// Can't pillage friendly tiles, just like you can't attack them - it's an 'act of war' thing
|
||||
return tileOwner == null || tileOwner == unit.civInfo || unit.civInfo.isAtWarWith(tileOwner)
|
||||
|
Loading…
Reference in New Issue
Block a user