rebalance nuclear blast

This commit is contained in:
Evan
2024-11-23 19:58:24 -08:00
parent 3a2f8c9538
commit 110daccdc4
2 changed files with 4 additions and 4 deletions
+1
View File
@@ -191,6 +191,7 @@
* NPC builds ports DONE 11/20/2024
* BUG: fix matchmaking DONE 11/22/2024
* destroyer can capture trade ships DONE 11/22/2024
* have bots recapture after nuclear blast
* NPC has relations
* make NPC difficult scale better (not just start troops)
* add battleship
+3 -4
View File
@@ -61,21 +61,20 @@ export class NukeExecution implements Execution {
}
private detonate() {
const magnitude = this.type == UnitType.AtomBomb ? 15 : 115
const magnitude = this.type == UnitType.AtomBomb ? { inner: 20, outer: 40 } : { inner: 160, outer: 180 }
const rand = new PseudoRandom(this.mg.ticks())
const tile = this.mg.tile(this.cell)
const toDestroy = bfs(tile, (n: Tile) => {
const d = euclideanDist(tile.cell(), n.cell())
return (d <= magnitude || rand.chance(2)) && d <= magnitude * 2
return (d <= magnitude.inner || rand.chance(2)) && d <= magnitude.outer
})
const ratio = Object.fromEntries(
this.mg.players().map(p => [p.id(), p.troops() / p.numTilesOwned()])
)
for (const tile of toDestroy) {
const owner = tile.owner()
if (owner.isPlayer()) {
@@ -85,7 +84,7 @@ export class NukeExecution implements Execution {
}
}
for (const unit of this.mg.units()) {
if (euclideanDist(this.cell, unit.tile().cell()) < magnitude * 2) {
if (euclideanDist(this.cell, unit.tile().cell()) < magnitude.outer) {
unit.delete()
}
}