make bots receive half troops, update version

This commit is contained in:
evanpelle
2024-09-07 09:52:21 -07:00
parent 5bc7d6e023
commit 8ff03496c6
2 changed files with 8 additions and 4 deletions
+1 -1
View File
@@ -10,7 +10,7 @@
<body>
<div class="content">
<h1>OpenFront.io</h1>
<h2>(v0.2.0)</h2>
<h2>(v0.3.0)</h2>
<div id="username-container">
<input type="text" id="username" placeholder="Enter your username">
</div>
+7 -3
View File
@@ -16,7 +16,7 @@ export class DefaultConfig implements Config {
return 100
}
numBots(): number {
return 350
return 400
}
turnIntervalMs(): number {
return 100
@@ -39,14 +39,14 @@ export class DefaultConfig implements Config {
mag = 15
break
case TerrainType.Mountain:
mag = 50
mag = 40
break
}
if (defender.isPlayer()) {
return {
attackerTroopLoss: within(defender.troops() / attacker.troops() * mag, 1, 1000),
defenderTroopLoss: within(attacker.troops() / defender.troops(), 1, 1000),
tilesPerTickUsed: mag + 1
tilesPerTickUsed: within(attacker.numTilesOwned() / defender.numTilesOwned(), 1, 5) * mag
}
} else {
return {
@@ -94,6 +94,10 @@ export class DefaultConfig implements Config {
toAdd *= ratio
// console.log(`to add ${toAdd}`)
if (player.type() == PlayerType.Bot) {
toAdd *= .5
}
return Math.min(player.troops() + toAdd, max)
}
}