make attack troop lost and speed depend on # of troops

This commit is contained in:
evanpelle
2024-08-12 07:54:42 -07:00
parent fe52f6035d
commit ca546919bb
2 changed files with 17 additions and 6 deletions
+6 -3
View File
@@ -5,13 +5,16 @@
* better troop addition logic DONE 8/11/2024
* better expansion, add back directed expansion DONE 8/11/2024
* use pastel theme for territories DONE 8/11/2024
* cache border in AttackExecution for perf
* harder to expand on other players (defense)
* lose troops when attacked
* cache border in AttackExecution for perf DONE 8/11/2024
* harder to expand on other players (defense) DONE 8/12/2024
* lose troops when attacked DONE 8/12/2024
* slower to attack stronger players DONE 8/12/2024
* move all attack related config to Settings
* fix boat bugs
* add username in front page
* improve front page
* upload and start server
* fix enemy islands when attacking
* make boats larger
* have boats not get close to shore
* better algorithm for name render placement
+11 -3
View File
@@ -48,7 +48,7 @@ export class AttackExecution implements Execution {
return
}
if (this.toConquer.size() < this.numTilesWithEnemy / 1.5) {
if (this.toConquer.size() < this.numTilesWithEnemy / 2) {
this.calculateToConquer()
}
if (this.toConquer.size() == 0 || badTiles > 100) {
@@ -65,8 +65,13 @@ export class AttackExecution implements Execution {
continue
}
this._owner.conquer(tileToConquer)
this.troops -= 1
numTilesPerTick -= 1
if (this.target.isPlayer()) {
this.troops -= Math.max(this.target.troops() / this._owner.troops(), 1)
numTilesPerTick -= Math.max(this.target.troops() / this._owner.troops(), .25)
} else {
this.troops -= 1
numTilesPerTick -= 1
}
}
}
@@ -94,6 +99,9 @@ export class AttackExecution implements Execution {
if (this.targetCell != null) {
dist = manhattanDist(tile.cell(), this.targetCell)
}
if (numOwnedByMe > 2) {
numOwnedByMe = 1000
}
this.toConquer.add(new TileContainer(neighbor, dist + -numOwnedByMe + (tile.cell().x * tile.cell().y) % 2))
}
}