mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-01 06:03:27 +00:00
add localAttackLossMultiplier
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user