branch if pre-interceptor invulnerability. Added logic to refire interceptor, added communication to attk/defender that interceptors have been destroyed.

This commit is contained in:
calebco
2026-03-04 12:09:14 -06:00
parent e137fcaa6c
commit 4319bc422a
2 changed files with 23 additions and 1 deletions
+2
View File
@@ -771,6 +771,8 @@
"received_gold_from_conquest": "Conquered {name}, received {gold} gold",
"conquered_no_gold": "Conquered {name} (didn't play, no gold awarded)",
"missile_intercepted": "Missile intercepted {unit}",
"interceptor_destroyed": "Interceptor destroyed, retargeting {unit}",
"interceptor_destroyed_attacker": "{unit} survived interception, new interceptor inbound",
"mirv_warheads_intercepted": "{count, plural, one {{count} MIRV warhead intercepted} other {{count} MIRV warheads intercepted}}",
"sent_troops_to_player": "Sent {troops} troops to {name}",
"received_troops_from_player": "Received {troops} troops from {name}",
+21 -1
View File
@@ -39,6 +39,26 @@ export class SAMMissileExecution implements Execution {
{},
);
if (!this.SAMMissile.isActive()) {
// Interceptor was destroyed (e.g. by nuke blast) — allow SAMs to re-target this nuke
if (this.target.isActive()) {
this.target.setTargetedBySAM(false);
// Notify defender their interceptor was destroyed
this.mg.displayMessage(
"events_display.interceptor_destroyed",
MessageType.SAM_MISS,
this._owner.id(),
undefined,
{ unit: this.target.type() },
);
// Notify attacker their nuke survived interception
this.mg.displayMessage(
"events_display.interceptor_destroyed_attacker",
MessageType.SAM_MISS,
this.target.owner().id(),
undefined,
{ unit: this.target.type() },
);
}
this.active = false;
return;
}
@@ -50,7 +70,7 @@ export class SAMMissileExecution implements Execution {
this.target.owner() === this.SAMMissile.owner() ||
!nukesWhitelist.includes(this.target.type())
) {
// Clear the flag so other SAMs can re-target this nuke
// If the nuke is still active but we're aborting (e.g. SAM destroyed), allow re-targeting
if (this.target.isActive()) {
this.target.setTargetedBySAM(false);
}