diff --git a/src/core/execution/SAMLauncherExecution.ts b/src/core/execution/SAMLauncherExecution.ts index 2e1682abb..7d8faefff 100644 --- a/src/core/execution/SAMLauncherExecution.ts +++ b/src/core/execution/SAMLauncherExecution.ts @@ -116,12 +116,20 @@ class SAMTargetingSystem { detectionRange, [UnitType.AtomBomb, UnitType.HydrogenBomb], ({ unit }) => { - return ( - isUnit(unit) && - unit.owner() !== this.sam.owner() && - !this.sam.owner().isFriendly(unit.owner()) && - !unit.targetedBySAM() - ); + if (!isUnit(unit) || unit.targetedBySAM()) return false; + if (unit.owner() === this.sam.owner()) return false; + + const samOwner = this.sam.owner(); + const nukeOwner = unit.owner(); + + // After game-over in team games, SAMs also target teammate nukes (aftergame fun) + if (samOwner.isFriendly(nukeOwner)) { + return ( + this.mg.getWinner() !== null && samOwner.isOnSameTeam(nukeOwner) + ); + } + + return true; }, ); @@ -271,7 +279,18 @@ export class SAMLauncherExecution implements Execution { ({ unit }) => { if (!isUnit(unit)) return false; if (unit.owner() === this.player) return false; - if (this.player.isFriendly(unit.owner())) return false; + + // After game-over in team games, SAMs also target teammate MIRVs (aftergame fun) + const nukeOwner = unit.owner(); + if (this.player.isFriendly(nukeOwner)) { + if ( + this.mg.getWinner() === null || + !this.player.isOnSameTeam(nukeOwner) + ) { + return false; + } + } + const dst = unit.targetTile(); return ( this.sam !== null && diff --git a/src/core/game/PlayerImpl.ts b/src/core/game/PlayerImpl.ts index 975d5a70f..f8c5b88cb 100644 --- a/src/core/game/PlayerImpl.ts +++ b/src/core/game/PlayerImpl.ts @@ -1180,16 +1180,20 @@ export class PlayerImpl implements Player { return false; } const owner = this.mg.owner(tile); + // Allow nuking teammates after the game is over (aftergame fun) + const gameOver = this.mg.getWinner() !== null; if (owner.isPlayer()) { - if (this.isOnSameTeam(owner)) { + if (this.isOnSameTeam(owner) && !gameOver) { return false; } } - // Prevent launching nukes that would hit teammate structures (only in team games) + // Prevent launching nukes that would hit teammate structures (only in team games). + // Disabled after game-over so players can nuke teammates in the aftergame. if ( this.mg.config().gameConfig().gameMode === GameMode.Team && - nukeType !== UnitType.MIRV + nukeType !== UnitType.MIRV && + !gameOver ) { const magnitude = this.mg.config().nukeMagnitudes(nukeType); const wouldHitTeammate = this.mg.anyUnitNearby(