mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 09:20:47 +00:00
made 3 terrain types, rebalanced game
This commit is contained in:
@@ -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
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 7.7 KiB |
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
// }
|
||||
// }
|
||||
}
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user