mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-22 17:16:38 +00:00
add localAttackLossMultiplier
This commit is contained in:
@@ -100,6 +100,7 @@ export interface Config {
|
||||
attackLogic(
|
||||
gm: Game,
|
||||
attackTroops: number,
|
||||
attackLossMultiplier: number,
|
||||
attacker: Player,
|
||||
defender: Player | TerraNullius,
|
||||
tileToConquer: TileRef,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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