From 67c4d5ec6b0a2e2f4b42d16c7d5002df3fae1a7e Mon Sep 17 00:00:00 2001 From: Aotumuri Date: Sun, 11 Jan 2026 09:18:22 +0900 Subject: [PATCH] add localAttackLossMultiplier --- src/core/configuration/Config.ts | 1 + src/core/configuration/DefaultConfig.ts | 7 +++++-- src/core/execution/AttackExecution.ts | 13 +++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/core/configuration/Config.ts b/src/core/configuration/Config.ts index 58a83f68b..3009d3be2 100644 --- a/src/core/configuration/Config.ts +++ b/src/core/configuration/Config.ts @@ -100,6 +100,7 @@ export interface Config { attackLogic( gm: Game, attackTroops: number, + attackLossMultiplier: number, attacker: Player, defender: Player | TerraNullius, tileToConquer: TileRef, diff --git a/src/core/configuration/DefaultConfig.ts b/src/core/configuration/DefaultConfig.ts index 72f0bdc3e..bcd115a1b 100644 --- a/src/core/configuration/DefaultConfig.ts +++ b/src/core/configuration/DefaultConfig.ts @@ -645,6 +645,7 @@ export class DefaultConfig implements Config { attackLogic( gm: Game, attackTroops: number, + attackLossMultiplier: number, attacker: Player, defender: Player | TerraNullius, tileToConquer: TileRef, @@ -739,7 +740,8 @@ export class DefaultConfig implements Config { 0.8 * largeDefenderAttackDebuff * largeAttackBonus * - (defender.isTraitor() ? this.traitorDefenseDebuff() : 1), + (defender.isTraitor() ? this.traitorDefenseDebuff() : 1) * + attackLossMultiplier, defenderTroopLoss: defender.troops() / defender.numTilesOwned(), tilesPerTickUsed: within(defender.troops() / (5 * attackTroops), 0.2, 1.5) * @@ -751,7 +753,8 @@ export class DefaultConfig implements Config { } else { return { attackerTroopLoss: - attacker.type() === PlayerType.Bot ? mag / 10 : mag / 5, + (mag / (attacker.type() === PlayerType.Bot ? 10 : 5)) * + attackLossMultiplier, defenderTroopLoss: 0, tilesPerTickUsed: within( (2000 * Math.max(10, speed)) / attackTroops, diff --git a/src/core/execution/AttackExecution.ts b/src/core/execution/AttackExecution.ts index 4d721df4e..d0433ffd4 100644 --- a/src/core/execution/AttackExecution.ts +++ b/src/core/execution/AttackExecution.ts @@ -17,6 +17,7 @@ import { assertNever } from "../Util"; import { FlatBinaryHeap } from "./utils/FlatBinaryHeap"; // adjust path if needed const malusForRetreat = 25; +const localAttackLossMultiplier = 1.5; export class AttackExecution implements Execution { private active: boolean = true; private toConquer = new FlatBinaryHeap(); @@ -289,6 +290,7 @@ export class AttackExecution implements Execution { .attackLogic( this.mg, troopCount, + this.attackLossMultiplier(), this._owner, this.target, tileToConquer, @@ -328,6 +330,17 @@ export class AttackExecution implements Execution { return null; } + private attackLossMultiplier(): number { + if ( + this.sourceTile === null || + !this.target.isPlayer() || + !this.removeTroops + ) { + return 1; + } + return localAttackLossMultiplier; + } + private addNeighbors(tile: TileRef) { if (this.attack === null) { throw new Error("Attack not initialized");