From b2d9bb670aefb8b1c8511df73c0c02e7e008dafe Mon Sep 17 00:00:00 2001 From: Ilan Schemoul Date: Sun, 16 Mar 2025 02:22:14 +0100 Subject: [PATCH] nerf SAM (#258) More costly (start at 1.5M), increase cost cap (4.5M), biggest timeout (5s->10s), much lower chance to stop hydrogen (70%->10%), triple construction time (10s->30s) otherwise it's trivial to build a SAM right before a nuke hits --- src/core/configuration/DefaultConfig.ts | 6 +++--- src/core/execution/SAMLauncherExecution.ts | 2 +- src/core/execution/SAMMissileExecution.ts | 14 +++++++++++++- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/core/configuration/DefaultConfig.ts b/src/core/configuration/DefaultConfig.ts index bcd7cbec1..8ad7f7fee 100644 --- a/src/core/configuration/DefaultConfig.ts +++ b/src/core/configuration/DefaultConfig.ts @@ -261,13 +261,13 @@ export class DefaultConfig implements Config { p.type() == PlayerType.Human && this.infiniteGold() ? 0 : Math.min( - 1_000_000, + 1_500_000 * 3, (p.unitsIncludingConstruction(UnitType.SAMLauncher).length + 1) * - 1_000_000, + 1_500_000, ), territoryBound: true, - constructionDuration: this.instantBuild() ? 0 : 10 * 10, + constructionDuration: this.instantBuild() ? 0 : 30 * 10, }; case UnitType.City: return { diff --git a/src/core/execution/SAMLauncherExecution.ts b/src/core/execution/SAMLauncherExecution.ts index c5403e292..cbf2f583a 100644 --- a/src/core/execution/SAMLauncherExecution.ts +++ b/src/core/execution/SAMLauncherExecution.ts @@ -22,7 +22,7 @@ export class SAMLauncherExecution implements Execution { private searchRange = 100; - private missileAttackRate = 50; + private missileAttackRate = 100; // 10 seconds private lastMissileAttack = 0; private pseudoRandom: PseudoRandom; diff --git a/src/core/execution/SAMMissileExecution.ts b/src/core/execution/SAMMissileExecution.ts index df7d22682..218f755f1 100644 --- a/src/core/execution/SAMMissileExecution.ts +++ b/src/core/execution/SAMMissileExecution.ts @@ -24,7 +24,9 @@ export class SAMMissileExecution implements Execution { private mg: Game, private pseudoRandom: number, private speed: number = 6, + // Regular atom bomb or warhead of MIRV private hittingChance: number = 0.75, + private hittingChanceHydrogen: number = 0.1, ) {} init(mg: Game, ticks: number): void { @@ -61,7 +63,17 @@ export class SAMMissileExecution implements Execution { switch (result.type) { case PathFindResultType.Completed: this.active = false; - if (this.pseudoRandom < this.hittingChance) { + let hit = false; + if ( + this.target.type() == UnitType.HydrogenBomb && + this.pseudoRandom < this.hittingChanceHydrogen + ) { + hit = true; + } else if (this.pseudoRandom < this.hittingChance) { + hit = true; + } + + if (hit) { this.target.delete(); this.mg.displayMessage(