mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 16:10:53 +00:00
bugfix: ColorAllocator not copying fallbackColors causing it to be empty, causing npes
This commit is contained in:
@@ -349,7 +349,7 @@ export class ColorAllocator {
|
||||
return this.assigned.get(id)!;
|
||||
}
|
||||
if (this.availableColors.length === 0) {
|
||||
this.availableColors = this.fallbackColors;
|
||||
this.availableColors = [...this.fallbackColors];
|
||||
}
|
||||
const index = 0;
|
||||
const color = this.availableColors.splice(index, 1)[0];
|
||||
|
||||
@@ -579,9 +579,19 @@ export class DefaultConfig implements Config {
|
||||
const densityRatio = defenderDensity / attackerDensity;
|
||||
|
||||
const attackDefenseRatio = defender.troops() / attackTroops;
|
||||
|
||||
if (attacker.type() === PlayerType.Human) {
|
||||
console.log("densityRatio", densityRatio);
|
||||
console.log("attackDefenseRatio", attackDefenseRatio);
|
||||
console.log(
|
||||
"modifier",
|
||||
Math.sqrt(densityRatio * attackDefenseRatio) / 2,
|
||||
);
|
||||
}
|
||||
|
||||
const modifier = within(
|
||||
Math.sqrt(densityRatio * attackDefenseRatio),
|
||||
0.6,
|
||||
Math.sqrt(densityRatio * attackDefenseRatio) / 2,
|
||||
0.5,
|
||||
2,
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user