diff --git a/TODO.txt b/TODO.txt index c735a10a0..7ff2644f0 100644 --- a/TODO.txt +++ b/TODO.txt @@ -93,10 +93,10 @@ * boats leave trails DONE 9/3/2024 * send boat even if touching DONE 9/4/2024 * when attacking by boat, attack execution only starts from boat pixel DONE 9/4/2024 +* Make three terrain types: Plains, highlands, mountains DONE 9/5/2024 * directed expansion * more random names for game id & client id * Make fake humans -* Make three terrain types: Plains, highlands, mountains * UI: win condition & popup * UI: boats * UI: current attacks diff --git a/resources/images/Favicon.png b/resources/images/Favicon.png index 1db1cb9c5..71c071e73 100644 Binary files a/resources/images/Favicon.png and b/resources/images/Favicon.png differ diff --git a/src/core/configuration/DefaultConfig.ts b/src/core/configuration/DefaultConfig.ts index 8df80ef47..8340a460b 100644 --- a/src/core/configuration/DefaultConfig.ts +++ b/src/core/configuration/DefaultConfig.ts @@ -1,4 +1,4 @@ -import {Player, PlayerInfo, TerraNullius, Tile} from "../Game"; +import {Player, PlayerInfo, TerrainType, TerraNullius, Tile} from "../Game"; import {within} from "../Util"; import {Config, Theme} from "./Config"; import {pastelTheme} from "./PastelTheme"; @@ -30,10 +30,18 @@ export class DefaultConfig implements Config { theme(): Theme {return pastelTheme;} attackLogic(attacker: Player, defender: Player | TerraNullius, tileToConquer: Tile): {attackerTroopLoss: number; defenderTroopLoss: number; tilesPerTickUsed: number} { - const mag = tileToConquer.magnitude() / 5 + let mag = 0 + switch (tileToConquer.terrain()) { + case TerrainType.Plains: + mag = -5 + case TerrainType.Highland: + mag = 3 + case TerrainType.Mountain: + mag = 10 + } if (defender.isPlayer()) { return { - attackerTroopLoss: Math.min(defender.troops() / 2000, 10) + mag, + attackerTroopLoss: within(defender.troops() / 2000 + mag, 1, 10), defenderTroopLoss: Math.min(attacker.troops() / 3000, 5), tilesPerTickUsed: mag + 1 } @@ -41,14 +49,14 @@ export class DefaultConfig implements Config { return { attackerTroopLoss: mag, defenderTroopLoss: 0, - tilesPerTickUsed: mag + 1 + tilesPerTickUsed: Math.max(mag / 2, 1) } } } attackTilesPerTick(attacker: Player, defender: Player | TerraNullius, numAdjacentTilesWithEnemy: number): number { if (defender.isPlayer()) { - return within(attacker.numTilesOwned() / defender.numTilesOwned() * 2, .01, .5) * numAdjacentTilesWithEnemy * 2 / 10 + return within(attacker.troops() / defender.troops() * 2, .01, .5) * numAdjacentTilesWithEnemy * 2 / 10 } else { return numAdjacentTilesWithEnemy * 2 / 10 } @@ -68,9 +76,9 @@ export class DefaultConfig implements Config { startTroops(playerInfo: PlayerInfo): number { if (playerInfo.isBot) { - return 5000 + return 10000 } - return 5000 + return 10000 } troopAdditionRate(player: Player): number { diff --git a/src/core/configuration/DevConfig.ts b/src/core/configuration/DevConfig.ts index 7585634c9..aed273853 100644 --- a/src/core/configuration/DevConfig.ts +++ b/src/core/configuration/DevConfig.ts @@ -16,21 +16,21 @@ export const devConfig = new class extends DefaultConfig { } numBots(): number { - return 50 + return 350 } - startTroops(playerInfo: PlayerInfo): number { - if (playerInfo.isBot) { - return 5000 - } - return 5000 - } + // startTroops(playerInfo: PlayerInfo): number { + // if (playerInfo.isBot) { + // return 5000 + // } + // return 5000 + // } - troopAdditionRate(player: Player): number { - if (player.isBot()) { - return 1000 - } else { - return 10000 - } - } + // troopAdditionRate(player: Player): number { + // if (player.isBot()) { + // return 1000 + // } else { + // return 10000 + // } + // } } \ No newline at end of file diff --git a/src/core/execution/AttackExecution.ts b/src/core/execution/AttackExecution.ts index 88d62b5d1..6fdff3650 100644 --- a/src/core/execution/AttackExecution.ts +++ b/src/core/execution/AttackExecution.ts @@ -1,7 +1,8 @@ import {PriorityQueue} from "@datastructures-js/priority-queue"; -import {Cell, Execution, MutableGame, MutablePlayer, PlayerID, TerraNullius, Tile} from "../Game"; +import {Cell, Execution, MutableGame, MutablePlayer, PlayerID, TerrainType, TerraNullius, Tile} from "../Game"; import {PseudoRandom} from "../PseudoRandom"; import {manhattanDist} from "../Util"; +import {Terrain} from "../TerrainMapLoader"; export class AttackExecution implements Execution { private active: boolean = true; @@ -135,6 +136,15 @@ export class AttackExecution implements Execution { if (numOwnedByMe > 2) { numOwnedByMe = 10 } + let mag = 0 + switch (tile.terrain()) { + case TerrainType.Plains: + mag = 1 + case TerrainType.Highland: + mag = 2 + case TerrainType.Mountain: + mag = 5 + } this.toConquer.enqueue(new TileContainer( neighbor, dist / 100 + this.random.nextInt(0, 2) - numOwnedByMe + Math.floor(tile.magnitude() / 10),