diff --git a/resources/images/TraitorIcon.png b/resources/images/TraitorIcon.png deleted file mode 100644 index 23f5d252a..000000000 Binary files a/resources/images/TraitorIcon.png and /dev/null differ diff --git a/resources/images/TraitorIcon.svg b/resources/images/TraitorIcon.svg index 49f230962..567be0cd0 100644 --- a/resources/images/TraitorIcon.svg +++ b/resources/images/TraitorIcon.svg @@ -1,5 +1,89 @@ - - - - + + + + + + + + + + + + + + + + diff --git a/src/core/configuration/Config.ts b/src/core/configuration/Config.ts index 35fa3368c..2fdf9a813 100644 --- a/src/core/configuration/Config.ts +++ b/src/core/configuration/Config.ts @@ -119,6 +119,7 @@ export interface Config { difficultyModifier(difficulty: Difficulty): number; // 0-1 traitorDefenseDebuff(): number; + traitorDuration(): number; nukeMagnitudes(unitType: UnitType): NukeMagnitude; defaultNukeSpeed(): number; nukeDeathFactor(humans: number, tilesOwned: number): number; diff --git a/src/core/configuration/DefaultConfig.ts b/src/core/configuration/DefaultConfig.ts index 4f36e1183..e0c4d240c 100644 --- a/src/core/configuration/DefaultConfig.ts +++ b/src/core/configuration/DefaultConfig.ts @@ -141,7 +141,10 @@ export class DefaultConfig implements Config { } traitorDefenseDebuff(): number { - return 0.8; + return 0.5; + } + traitorDuration(): number { + return 30 * 10; // 30 seconds } spawnImmunityDuration(): Tick { return 5 * 10; diff --git a/src/core/game/Game.ts b/src/core/game/Game.ts index 25a7c9328..b82016ed9 100644 --- a/src/core/game/Game.ts +++ b/src/core/game/Game.ts @@ -315,6 +315,7 @@ export interface Player { // State & Properties isAlive(): boolean; isTraitor(): boolean; + markTraitor(): void; largestClusterBoundingBox: { min: Cell; max: Cell } | null; lastTileChange(): Tick; diff --git a/src/core/game/GameImpl.ts b/src/core/game/GameImpl.ts index 8a1051fb3..06bcc57ba 100644 --- a/src/core/game/GameImpl.ts +++ b/src/core/game/GameImpl.ts @@ -518,7 +518,7 @@ export class GameImpl implements Game { ); } if (!other.isTraitor()) { - (breaker as PlayerImpl).isTraitor_ = true; + breaker.markTraitor(); } const breakerSet = new Set(breaker.alliances()); diff --git a/src/core/game/PlayerImpl.ts b/src/core/game/PlayerImpl.ts index bec1b255a..7f2786183 100644 --- a/src/core/game/PlayerImpl.ts +++ b/src/core/game/PlayerImpl.ts @@ -68,7 +68,7 @@ export class PlayerImpl implements Player { // 0 to 100 private _targetTroopRatio: bigint; - isTraitor_ = false; + markedTraitorTick = -1; private embargoes: Set = new Set(); @@ -373,7 +373,14 @@ export class PlayerImpl implements Player { } isTraitor(): boolean { - return this.isTraitor_; + return ( + this.markedTraitorTick >= 0 && + this.mg.ticks() - this.markedTraitorTick < + this.mg.config().traitorDuration() + ); + } + markTraitor(): void { + this.markedTraitorTick = this.mg.ticks(); } createAllianceRequest(recipient: Player): AllianceRequest {