Added "Self-destructs when attacking" unique

This commit is contained in:
Yair Morgenstern
2021-04-30 12:11:49 +03:00
parent 222e322230
commit 81c1e34f0f
2 changed files with 3 additions and 3 deletions

View File

@ -1050,7 +1050,7 @@
"cost": 600,
"requiredTech": "Nuclear Fission",
"requiredResource": "Uranium",
"uniques": ["Nuclear weapon", "Requires [Manhattan Project]"]
"uniques": ["Nuclear weapon", "Requires [Manhattan Project]", "Self-destructs when attacking"]
// Plane rather than a missile - can be based in city or Carrier only. But cannot be intercepted because of a civ 5 bug that was never fixed.
// Single-use like missile
// No strength/rangedStrength tags in civ 5 xmls. Instead has NukeDamageLevel = 1 tag (Nuclear Missile has NukeDamageLevel = 2)

View File

@ -32,7 +32,7 @@ object Battle {
}
}
if (attacker.getUnitType() == UnitType.Missile) {
if (attacker is MapUnitCombatant && attacker.unit.hasUnique("Nuclear weapon")) {
return nuke(attacker, attackableTile.tileToAttack)
}
attack(attacker, getMapCombatantOfTile(attackableTile.tileToAttack)!!)
@ -86,7 +86,7 @@ object Battle {
}
if (attacker is MapUnitCombatant) {
if (attacker.getUnitType() == UnitType.Missile)
if (attacker.unit.hasUnique("Self-destructs when attacking"))
attacker.unit.destroy()
else if (attacker.unit.isMoving())
attacker.unit.action = null