traitor only lasts 30 seconds, 50% defense debuff

This commit is contained in:
Evan
2025-04-17 20:30:52 -07:00
parent 7342caaafd
commit ae4f4d3ed6
7 changed files with 104 additions and 8 deletions
+1
View File
@@ -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;
+4 -1
View File
@@ -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;
+1
View File
@@ -315,6 +315,7 @@ export interface Player {
// State & Properties
isAlive(): boolean;
isTraitor(): boolean;
markTraitor(): void;
largestClusterBoundingBox: { min: Cell; max: Cell } | null;
lastTileChange(): Tick;
+1 -1
View File
@@ -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());
+9 -2
View File
@@ -68,7 +68,7 @@ export class PlayerImpl implements Player {
// 0 to 100
private _targetTroopRatio: bigint;
isTraitor_ = false;
markedTraitorTick = -1;
private embargoes: Set<PlayerID> = 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 {