From 8912e4a68c95ef0af509632990bdc8467edf65e2 Mon Sep 17 00:00:00 2001 From: evanpelle Date: Tue, 3 Jun 2025 21:07:42 -0700 Subject: [PATCH] attack based on density --- src/core/configuration/DefaultConfig.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/core/configuration/DefaultConfig.ts b/src/core/configuration/DefaultConfig.ts index 738e0987b..94ca2eacd 100644 --- a/src/core/configuration/DefaultConfig.ts +++ b/src/core/configuration/DefaultConfig.ts @@ -555,9 +555,20 @@ export class DefaultConfig implements Config { } if (defender.isPlayer()) { + const defenderDensity = defender.troops() / defender.numTilesOwned(); + const attackerDensity = attacker.troops() / attacker.numTilesOwned(); + const densityRatio = defenderDensity / attackerDensity; + + const attackDefenseRatio = defender.troops() / attackTroops; + const modifier = within( + Math.sqrt(densityRatio * attackDefenseRatio), + 0.6, + 2, + ); + return { attackerTroopLoss: - within(defender.troops() / attackTroops, 0.6, 2) * + modifier * mag * 0.8 * largeLossModifier *