mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-17 16:29:24 +00:00
add eq for zoom, chagne meta give more bonus large players, don't throw exception when attack self
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import { renderNumber } from "../../client/Utils";
|
||||
import {
|
||||
Difficulty,
|
||||
Game,
|
||||
GameType,
|
||||
Gold,
|
||||
MessageType,
|
||||
Player,
|
||||
PlayerInfo,
|
||||
PlayerType,
|
||||
@@ -298,13 +300,23 @@ export class DefaultConfig implements Config {
|
||||
}
|
||||
}
|
||||
|
||||
let largeModifier = 1;
|
||||
if (attacker.numTilesOwned() > 50_000) {
|
||||
largeModifier = Math.sqrt(50_000 / attacker.numTilesOwned());
|
||||
}
|
||||
|
||||
if (defender.isPlayer()) {
|
||||
return {
|
||||
attackerTroopLoss:
|
||||
within(defender.troops() / attackTroops, 0.5, 2) * mag * 0.8,
|
||||
within(defender.troops() / attackTroops, 0.5, 2) *
|
||||
mag *
|
||||
0.8 *
|
||||
largeModifier,
|
||||
defenderTroopLoss: defender.troops() / defender.numTilesOwned(),
|
||||
tilesPerTickUsed:
|
||||
within(defender.troops() / (5 * attackTroops), 0.2, 1.5) * speed,
|
||||
within(defender.troops() / (5 * attackTroops), 0.2, 1.5) *
|
||||
speed *
|
||||
largeModifier,
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
|
||||
@@ -69,7 +69,9 @@ export class AttackExecution implements Execution {
|
||||
: mg.player(this._targetID);
|
||||
|
||||
if (this._owner == this.target) {
|
||||
throw new Error(`Player ${this._owner} cannot attack itself`);
|
||||
console.error(`Player ${this._owner} cannot attack itself`);
|
||||
this.active = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user