diff --git a/TODO.txt b/TODO.txt index f48352fa9..55aabdc87 100644 --- a/TODO.txt +++ b/TODO.txt @@ -96,6 +96,7 @@ * Make three terrain types: Plains, highlands, mountains DONE 9/5/2024 * more random names for game id & client id DONE 9/5/2024 * BUG: attacks speed up DONE 9/6/2024 +* rebalance income DONE 9/7/2024 * Make fake humans * directed expansion * UI: win condition & popup diff --git a/src/client/graphics/UIRenderer.ts b/src/client/graphics/UIRenderer.ts index fb2da610b..aea1290f2 100644 --- a/src/client/graphics/UIRenderer.ts +++ b/src/client/graphics/UIRenderer.ts @@ -48,20 +48,20 @@ export class UIRenderer { } render(context: CanvasRenderingContext2D) { - const p = this.game.players().find(p => p.clientID() == this.clientID); - let troopCount = p ? `${renderTroops(p.troops())}` : ''; + // const p = this.game.players().find(p => p.clientID() == this.clientID); + // let troopCount = p ? `${renderTroops(p.troops())}` : ''; - context.save(); - context.fillStyle = 'rgba(0, 0, 0, 0.7)'; // Black with 70% opacity - context.textAlign = 'center'; - context.textBaseline = 'top'; + // context.save(); + // context.fillStyle = 'rgba(0, 0, 0, 0.7)'; // Black with 70% opacity + // context.textAlign = 'center'; + // context.textBaseline = 'top'; - const x = context.canvas.width / 2; // Center horizontally - const y = 40; // Distance from the top + // const x = context.canvas.width / 2; // Center horizontally + // const y = 40; // Distance from the top - context.font = `bold ${60}px ${this.theme.font()}`; - context.fillText(troopCount, x, y); - context.restore(); + // context.font = `bold ${60}px ${this.theme.font()}`; + // context.fillText(troopCount, x, y); + // context.restore(); } onExitButtonClick() { diff --git a/src/core/configuration/DefaultConfig.ts b/src/core/configuration/DefaultConfig.ts index fb26b7001..f34bd1043 100644 --- a/src/core/configuration/DefaultConfig.ts +++ b/src/core/configuration/DefaultConfig.ts @@ -85,7 +85,11 @@ export class DefaultConfig implements Config { let max = Math.sqrt(player.numTilesOwned()) * 3000 + 50000 max = Math.min(max, 1_000_000) - let toAdd = 10 + (player.troops() + Math.sqrt(player.troops() * player.numTilesOwned())) / 150 + let toAdd = 10 + (player.troops() + Math.sqrt(player.troops() * player.numTilesOwned())) / 100 + + const ratio = 1 - (player.troops() / max) + toAdd *= ratio + // console.log(`to add ${toAdd}`) return Math.min(player.troops() + toAdd, max) } diff --git a/src/core/execution/BoatAttackExecution.ts b/src/core/execution/BoatAttackExecution.ts index 778de6eb4..529595790 100644 --- a/src/core/execution/BoatAttackExecution.ts +++ b/src/core/execution/BoatAttackExecution.ts @@ -51,6 +51,7 @@ export class BoatAttackExecution implements Execution { if (this.attacker.boats().length >= mg.config().boatMaxNumber()) { console.log('too many boats') this.active = false + this.attacker.addTroops(this.troops) return }