rebalancing

This commit is contained in:
evanpelle
2024-08-31 15:54:26 -07:00
parent 9c58f99968
commit c3b36eeea2
3 changed files with 22 additions and 16 deletions
+8 -3
View File
@@ -52,10 +52,12 @@ export class TerritoryRenderer {
}
boatEvent(event: BoatEvent) {
bfs(event.oldTile, dist(event.oldTile, 2)).forEach(t => this.clearCell(t.cell()))
bfs(event.oldTile, dist(event.oldTile, 3)).forEach(t => {
this.paintTerritory(t)
})
if (event.boat.isActive()) {
bfs(event.boat.tile(), dist(event.boat.tile(), 2)).forEach(t => this.paintCell(t.cell(), this.theme.borderColor(event.boat.owner().id()), 255))
bfs(event.boat.tile(), dist(event.boat.tile(), 1)).forEach(t => this.paintCell(t.cell(), this.theme.territoryColor(event.boat.owner().id()), 255))
bfs(event.boat.tile(), dist(event.boat.tile(), 1)).forEach(t => this.paintCell(t.cell(), this.theme.territoryColor(event.boat.owner().id()), 150))
}
}
@@ -74,6 +76,9 @@ export class TerritoryRenderer {
}
paintTerritory(tile: Tile) {
if (!tile.hasOwner()) {
this.clearCell(tile.cell())
}
if (tile.isBorder()) {
this.paintCell(
tile.cell(),
@@ -84,7 +89,7 @@ export class TerritoryRenderer {
this.paintCell(
tile.cell(),
this.theme.territoryColor(tile.owner().id()),
75
100
)
}
}
+9 -8
View File
@@ -30,26 +30,27 @@ 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
if (defender.isPlayer()) {
return {
attackerTroopLoss: Math.min(defender.troops() / 2000, 10) + tileToConquer.magnitude(),
attackerTroopLoss: Math.min(defender.troops() / 2000, 10) + mag,
defenderTroopLoss: Math.min(attacker.troops() / 3000, 5),
tilesPerTickUsed: tileToConquer.magnitude() + 1
tilesPerTickUsed: mag + 1
}
} else {
return {
attackerTroopLoss: tileToConquer.magnitude(),
attackerTroopLoss: mag,
defenderTroopLoss: 0,
tilesPerTickUsed: tileToConquer.magnitude() + 1
tilesPerTickUsed: mag + 1
}
}
}
attackTilesPerTick(attacker: Player, defender: Player | TerraNullius, numAdjacentTilesWithEnemy: number): number {
if (defender.isPlayer()) {
return within(attacker.numTilesOwned() / defender.numTilesOwned() * 2, .01, .5) * numAdjacentTilesWithEnemy
return within(attacker.numTilesOwned() / defender.numTilesOwned() * 2, .01, .5) * numAdjacentTilesWithEnemy * 2
} else {
return numAdjacentTilesWithEnemy
return numAdjacentTilesWithEnemy * 2
}
}
@@ -73,10 +74,10 @@ export class DefaultConfig implements Config {
}
troopAdditionRate(player: Player): number {
let max = Math.sqrt(player.numTilesOwned()) * 1000 + 10000 + 100000
let max = Math.sqrt(player.numTilesOwned()) * 2000 + 10000 + 10000
max = Math.min(max, 1_000_000)
let toAdd = 10 + (player.troops() + Math.sqrt(player.troops() * player.numTilesOwned())) / 250
let toAdd = 10 + (player.troops() + Math.sqrt(player.troops() * player.numTilesOwned())) / 200
return Math.min(player.troops() + toAdd, max)
}
+5 -5
View File
@@ -78,7 +78,7 @@ export class AttackExecution implements Execution {
return
}
let numTilesPerTick = this.mg.config().attackTilesPerTick(this._owner, this.target, this.numTilesWithEnemy)
let numTilesPerTick = this.mg.config().attackTilesPerTick(this._owner, this.target, this.numTilesWithEnemy + this.random.nextInt(0, 5))
if (this.targetCell != null) {
numTilesPerTick /= 2
}
@@ -165,10 +165,10 @@ export class AttackExecution implements Execution {
if (this.targetCell != null) {
dist = manhattanDist(tile.cell(), this.targetCell)
}
if (numOwnedByMe > 2) {
numOwnedByMe = 1000
}
this.toConquer.enqueue(new TileContainer(neighbor, -numOwnedByMe + tile.magnitude()))
// if (numOwnedByMe > 3) {
// numOwnedByMe = 1000
// }
this.toConquer.enqueue(new TileContainer(neighbor, this.random.nextInt(0, 2) - numOwnedByMe + tile.magnitude() / 5))
}
}
this.borderTiles = newBorder