From 13f186da5f473c77d32a174fbfff7867c3f97381 Mon Sep 17 00:00:00 2001 From: evanpelle Date: Tue, 10 Dec 2024 07:54:14 -0800 Subject: [PATCH] only break alliance if more than 100 tiles destroyed on nuke --- TODO.txt | 17 +++++++++++------ src/core/configuration/DevConfig.ts | 2 +- src/core/execution/NukeExecution.ts | 18 ++++++++++++------ 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/TODO.txt b/TODO.txt index bae144a32..d6a685791 100644 --- a/TODO.txt +++ b/TODO.txt @@ -220,8 +220,13 @@ * max price for units DONE 12/9/2024 * better unit scaling DONE 12/9/2024 * make hard & impossible harder DONE 12/9/2024 +* clicking on a player's name in the rank UI should teleport you to him DONE 12/9/2024 +* nuking an enemy and accidentally destroying a trade ship shouldn't break the alliance and make you a traitor +* emojis should be displayed on top of your name not under it +* the notification for a successful trade should be shorter, example: " 70k Gold from trade with "X" " +* countries don't actually spawn with some randomness, it's always the same exact spawn +* you should get a notification and a reward (some money) for eliminating an enemy (perhaps take wtvr gold the enemy had) * store in BigQuery -* clicking on a player's name in the rank UI should teleport you to him (pretty useful to know who's who and to locate small nations) * make boats work on lakes (& oceania) * record game winner * add panama canal NA @@ -234,12 +239,12 @@ * alert on unit captured or destroyed * put delay on adjust troop ratio to reduce number of messages * make clientID & playerID smaller -* nuking an enemy and accidentally destroying a trade ship shouldn't break the alliance and make you a traitor -* you should get a notification and a reward (some money) for eliminating an enemy (perhaps take wtvr gold the enemy had) -* emojis should be displayed on top of your name not under it -* the notification for a successful trade should be shorter, example: " 70k Gold from trade with "X" " -* countries don't actually spawn with some randomness, it's always the same exact spawn * allow longer names and allow them to be displayed in the Rank UI not be cut (many are cut for now, even for countries) +* pause button in single player +* when hovering over another player have the name not appear ontop of the exit cross +* have a visual thing of who your attacking and how many boats you sent +* make the sliders bigger. Like vertically. +* add way to hide leaderboard n such * create behavior tests * create perf test diff --git a/src/core/configuration/DevConfig.ts b/src/core/configuration/DevConfig.ts index db8e9aae1..a36a8b23f 100644 --- a/src/core/configuration/DevConfig.ts +++ b/src/core/configuration/DevConfig.ts @@ -5,7 +5,7 @@ export const devConfig = new class extends DefaultConfig { unitInfo(type: UnitType): UnitInfo { const info = super.unitInfo(type) const oldCost = info.cost - // info.cost = (p: Player) => oldCost(p) / 1000 + info.cost = (p: Player) => oldCost(p) / 1000000 return info } maxUnitCost(): number { diff --git a/src/core/execution/NukeExecution.ts b/src/core/execution/NukeExecution.ts index ce24c64ac..4b7083a08 100644 --- a/src/core/execution/NukeExecution.ts +++ b/src/core/execution/NukeExecution.ts @@ -74,23 +74,29 @@ export class NukeExecution implements Execution { const ratio = Object.fromEntries( this.mg.players().map(p => [p.id(), (p.troops() + p.workers()) / p.numTilesOwned()]) ) - const others = new Set() + const attacked = new Map() for (const tile of toDestroy) { const owner = tile.owner() if (owner.isPlayer()) { const mp = this.mg.player(owner.id()) mp.relinquish(tile) mp.removeTroops(2 * ratio[mp.id()]) - others.add(mp) + if (!attacked.has(mp)) { + attacked.set(mp, 0) + } + const prev = attacked.get(mp) + attacked.set(mp, prev + 1) } if (tile.isLand()) { this.mg.addFallout(tile) } } - for (const other of others) { - const alliance = this.player.allianceWith(other) - if (alliance != null) { - this.player.breakAlliance(alliance) + for (const [other, tilesDestroyed] of attacked) { + if (tilesDestroyed > 100) { + const alliance = this.player.allianceWith(other) + if (alliance != null) { + this.player.breakAlliance(alliance) + } } }