remove name, rebalance income

This commit is contained in:
evanpelle
2024-09-06 15:49:54 -07:00
parent 31a7ef393d
commit 0f37fc0c31
4 changed files with 18 additions and 12 deletions
+11 -11
View File
@@ -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() {
+5 -1
View File
@@ -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)
}
@@ -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
}