add localAttackLossMultiplier

This commit is contained in:
Aotumuri
2026-01-11 09:18:22 +09:00
parent f0bfefc831
commit 67c4d5ec6b
3 changed files with 19 additions and 2 deletions
+1
View File
@@ -100,6 +100,7 @@ export interface Config {
attackLogic(
gm: Game,
attackTroops: number,
attackLossMultiplier: number,
attacker: Player,
defender: Player | TerraNullius,
tileToConquer: TileRef,
+5 -2
View File
@@ -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,
+13
View File
@@ -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");