@chrischall/warapp-mcp 0.20.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +3 -3
- package/dist/analysis/options.js +157 -0
- package/dist/analysis/plan/captures.js +12 -1
- package/dist/analysis/plan/report.js +23 -3
- package/dist/analysis/plan/state.js +1 -0
- package/dist/analysis/planner.js +16 -4
- package/dist/analysis/situation.js +243 -0
- package/dist/analysis/stress.js +20 -1
- package/dist/bundle.js +578 -93
- package/dist/tools/bait.js +58 -0
- package/dist/tools/check-plan.js +17 -10
- package/dist/tools/turn.js +116 -1
- package/dist/version.js +1 -1
- package/manifest.json +1 -1
- package/package.json +1 -1
- package/server.json +2 -2
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
},
|
|
8
8
|
"metadata": {
|
|
9
9
|
"description": "MCP server for war.app (Warzone) — your games, players, settings, map bonuses and chokepoints, board analysis and route planning through war.app's per-player GameFeed API, plus the live board, territory picks, cards, turn planning and submission, turn notifications and game chat through your signed-in war.app tab (joining, leaving or surrendering a game, closing out a finished game, accepting another player's surrender, Begin on a speed first turn, picks, turn orders, withdrawing them, chat sends, marking notifications and chat read, deleting notifications, importing local history and linking a session are confirm-gated).",
|
|
10
|
-
"version": "0.
|
|
10
|
+
"version": "0.22.0"
|
|
11
11
|
},
|
|
12
12
|
"plugins": [
|
|
13
13
|
{
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"displayName": "war.app (Warzone)",
|
|
16
16
|
"source": "./",
|
|
17
17
|
"description": "war.app (Warzone) game advisor for Claude — games, maps, bonuses, routes, live board, picks, turns, cards and chat",
|
|
18
|
-
"version": "0.
|
|
18
|
+
"version": "0.22.0",
|
|
19
19
|
"author": {
|
|
20
20
|
"name": "Chris Hall"
|
|
21
21
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "warapp-mcp",
|
|
3
3
|
"displayName": "war.app (Warzone)",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.22.0",
|
|
5
5
|
"description": "war.app (Warzone) game advisor for Claude — games, maps, bonuses, routes, live board, picks, turns, cards and chat",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Chris Hall",
|
package/README.md
CHANGED
|
@@ -153,15 +153,15 @@ Locally `WARAPP_AUTH_TOKEN` is ignored.
|
|
|
153
153
|
| `warapp_get_live_board` | The live board through your war.app tab: every territory with its owner (player, `neutral`, or `pickable` during picks), armies and fog, and in a Commanders game whose `commander` stands there. Works in the pick phase and mid-game. `view`: compact / full (every special unit — commanders, bosses — with its owner). Narrow it with `owner` (`me`, `neutral`, `pickable` or a player), `territories`, and `limit`/`offset` paging. Fog levels use war.app's own names: `You` (yours), `Visible`, `OwnerOnly` (owner shown, armies hidden: `armies` is null) and `Fogged` (owner and armies hidden). |
|
|
154
154
|
| `warapp_get_my_picks` | Your submitted territory picks in priority order, and how many the game allows. |
|
|
155
155
|
| `warapp_get_my_orders` | Your orders for the current turn read back from war.app (what the web client shows in "Modify orders"), read-only: `committed`, `orders` in exactly the shape `warapp_submit_turn` takes (card GUIDs and targets, players by GameFeed id, move options, Order Delay `before`) and `shown` (one line per order, with names). Resubmit them after `warapp_uncommit_turn` to change a committed turn without losing hand-made orders. `null` is unknown, never "none"; `unread` lists orders it could not read back. Committed orders verified live 2026-11-22; entered-but-uncommitted ones unverified. |
|
|
156
|
-
| `warapp_plan_turn` | A plan for your turn from the live board (defaults to the signed-in account): income, your cards and whether you must play one, deploys and moves by name and id, expected captures, bonuses and next income, the `frontier` budget (borders left, those facing an enemy, what they need to hold next turn, next income), warnings and reasoning, and an `orders` array (card plays included); `chat.unread` counts the chat messages not yet marked seen (counts only, from GameFeed, so every count is under `unknown`; its `note` says so); `surrenderPending` lists other players' surrenders still pending (from the game details, unverified live; `null` when unreadable), and when one waits on your acceptance the first warning says so. `goal`: balanced (default: best income per army across holds, bonuses and breaking enemy bonuses, with at least 30% on expansion) / expand / complete-bonus / defend / siege (one opponent, `siege_target` by GameFeed id, default the strongest one bordering you: its bonus breaks are funded cheapest per income lost first, its other territories are left alone and the spare deploys build one strike stack facing it until the assault trigger fires — its income at 0.6× its baseline — the most the tracker saw it deploy over its window, or its income when the siege began — yours at 1.8× its, or a stack of yours able to take a member of its held bonus against its whole deploy — then the stack strikes; `siege` reports `target`, `opponentIncome`, `baseline`, `ratio`, `fallenTo`, `breaks`, `brokenThisTurn`, `ready`, `trigger` and `memory` — the siege's first turn, its turns, the target's income trend and the bonuses broken and broken again, kept per game while the siege runs, a gap of more than 3 turns starting a new one) — omit it and the game profile (`profile`: the One Army Must Stand Guard case and what it means for interior defence, format, phase, standing) picks it (never the siege, which plays only when you pass `goal: 'siege'`, #603): defend when behind on income outside a 1v1, else balanced tuned to the format (1v1 in contact: holds and breaks before expansion that completes nothing; behind on income in a 1v1: strike — break their bonuses, inferred ones too, sized to land; behind on armies: no trade below even; in a 1v1, spare deploys build one strike stack facing the opponent; FFA: no second front; ahead in a 1v1: more fog pressure); an explicit goal overrides it; `focus` bonuses; `reserve`; `enemy_deploy` (armies an enemy is assumed to deploy; default per opponent from its visible bonuses, or what it was observed to deploy when that is larger — its tracked income, carried across turns, once `warapp_track_opponents` has 2+ turns of it; growth beside the fog beyond twice what it was expected to deploy reads as a move out of the fog, not a deploy; in an even-start 1v1 or free-for-all an opponent bordering the fog is assumed to earn at least your income, a player out of a free-for-all having its share of the hidden board split among the rest; while its income was read from under half its frontier, an opponent is sized at the midpoint between its lower bound — its tracked figure, raised to its trend's next step when its tracked income rose two turns running — and its upper bound — that fog prior, else the most it could earn — moving toward what the evidence gives as more of its frontier is read; a rising track read from more of its frontier raises it to that lower bound); the `outlook` adds `leaning: behind` when it read even for 3 turns while a bonus of yours fell on each; `known_income` (per-player incomes you know, by GameFeed id — what a player said in chat, say: each replaces that opponent's estimate, a Reinforcement card the clock adds kept on top, said in its warning; `enemy_deploy` wins over it; the commander block keeps the submit's sizing); `min_win_chance` (0.5–1; default 1 = certain captures with no luck, 0.95 with luck on; below 1, each capture is sized for that exact win chance, and the captures a bonus still needs reach it together); `first_mover` (`me` or `opponent`, when you know who moves first this turn — Cycle move orders swap the first mover every turn; when you move first, Order Priority is not advised; the same argument as `warapp_check_plan`'s). Every attack carries `winChance` (its exact probability of capturing at the game's kill rates, luck and rounding); idle armies top an attack up to its next efficient size when the extra kill can matter. Reports the borders it gives up (`conceded`: not worth or not affordable to hold, never deployed to unless every territory you hold is conceded; it may still attack out with the armies already on it; an idle interior stack beside one that would make it hold transfers in, and it is then held), `cardAdvice` (`order-priority` when you hold one and it protects your first order: a commander strike while your commander is threatened, or a move out of a conceded border carrying enough armies to be worth a card — any size when the card must go anyway; never when `first_mover` is `me`; otherwise `order-delay` when you hold Order Delay and the schedule puts an attack last — the orders then carry the card with `before`, placed above the first non-urgent order, see `cards.advice.orderDelay`; an Order Delay that must leave the hand is played there rather than discarded), `cards.advice` for the cards `warapp_submit_turn` plays but the plan never does — `diplomacy` (the opponent tying down most of your border armies, only with two or more in contact, never a truce partner the truce already covers unless the card adds protection), `sanctions` (the leader, passing over a truce partner or a player a Diplomacy card keeps at peace with you, with the reason; yourself when the game's Sanctions percentage is negative — the card then raises the target's income — with `income`: your next income before and after the boost, by the client's rule (not under Local Deployment); never a negative card on an opponent nor a positive one on you), `airlift` (a border of yours or a teammate's that falls without it), `gift` (the members that complete a teammate's bonus), `spy` / `reconnaissance` / `surveillance` (only where the fog hides what the plan needs: an opponent out of view, a hidden territory on your border, a fogged member of a bonus you are completing; never with fog off) — each with an `order` to pass as is, never added to the orders save a completing `gift` (its play verified live 2026-11-23, #435: its card plays go into `orders` and the transfers out of or into the gifted members are dropped; never a territory with a special unit such as your commander, never one an attack leaves from) and a Reconnaissance (in a team game only cards read under you are played, discarded or advised; unverified live) and `trendSource` (where last turn's board came from — `history`, `cache` or null — for growing enemy stacks). Obeys the game's kill rates, Local Deployment and No-Split (`view: "full"` echoes the settings it assumed: `idleTransfers`, the planner's own switch for moving idle armies, beside the game's own `allowTransferOnly` and `allowAttackOnly`, `null` when GameFeed does not state them). Read-only; refuses outside a turn phase. In a Commanders game a commander counts as 7 armies, your commander's territory is never conceded (it gets the deploys it needs to hold against the worst case — the opponent's whole deploy, at least your own income, plus every enemy stack within two moves — or every army when that is not enough), and an adjacent enemy commander is attacked first, sized for its owner's full deploy. Within three moves of an enemy or the fog, with a safer territory of yours reachable, your commander walks one step a turn toward safety: a move in `orders` with `commander: true` (encoding not yet verified live), said in the first warning; the territory it leaves is held only for its own worth, plus what survives the attacks that may land before the walk (every enemy stack beside it, even when you move first: `warapp_submit_turn` checks both move orders; when that does not fit, each player's strongest attack, with the walk as your first order), no other order leaves it before the walk but a strike that ends a player, and Order Priority is advised for the walk only when even that falls short or the fog borders it; under No-Split a commander kill the walk displaces is named in a warning. Every turn of such a game `commander` reports your commander (#274): its territory, the armies there after the plan, `movesToEnemy` (to the nearest enemy or fog), `killedBy` (the smallest deploy, made by each opponent at once, at which a reply kills it: `player`, and `partner` when it is two opponents striking together; null when none reaches it this turn), and `safe` / `needs` at the larger of the estimate and your income; when it is not safe the first warning says so and whether `warapp_submit_turn` would refuse those orders (it does not without Commanders in the settings, nor when only an `enemy_deploy` what-if makes the commander unsafe). When the server kept your pick list, `award` says what the award of picks showed: the territories of your list that are another player's start for certain (in a two-player game planned as the opponent's while still fogged), whether you were awarded first or second and who moves first this turn under a `Cycle` move order, and with commanders the opponent's first award when the award pins it. `relations` reports each truce recorded with `warapp_record_agreement` as the plan treated it (honoured in a free-for-all; in a team or two-player game only its covered territories stay off-limits): while active or in notice no covered territory of the partner is attacked, a covered border facing only the partner is held against its stacks without a deploy (never your commander's, a border worth more than a quarter of your income, or any while trust is `watch`), and a border cap is kept: no move of yours fills that border past it, and the excess moves one step back (a warning when your own deploy for a hold is what exceeds it — deploy less, or give notice and ask before exceeding it — or when the cap leaves a border that also faces another opponent, or your commander's, short of its hold); `advice` says `give-notice` when the endgame or the partner outgrowing you made the trust `watch`; a truce the board shows broken is planned as an ordinary opponent, with the evidence (record it as `broken-by-them` before submitting: `warapp_submit_turn` reads only the ledger); each honoured truce reports `lossIfBroken` (what you would lose this turn if the partner landed its whole deploy beside your costliest covered territory, from any territory of its there, and attacked, carried out against the plan's orders: territories, armies, bonuses and income; logged per turn in the ledger beside the armies it freed); `tacit` lists quiet borders with no agreement (a report, never a truce). A Diplomacy card in effect between you and a player, read from the live board, is honoured in any format (that player is no threat and no target this turn), and Sanctions on you cut the plan's income (Sanctions on an opponent cut its estimate when that is read off the board, `sanctionsOnOthers`), when the decoder is sure of them (the card in play, its expiry within the game's duration); `cardsInEffect` lists them, marked `verified: false` (the active-card decoder is not yet checked live). Otherwise a warning says what was read and why it was not relied on. In a team game a bonus with a teammate's territory in it is never planned toward (a bonus pays one holder), and `team.sharedBonuses` lists each bonus you and a teammate both hold members of and who is `nearer` to holding it (advisory; team vision unverified). With your teammate's entered orders on the live board (unverified live): of two otherwise equal captures the one on the opponent they attack goes first (a "Team focus" rationale line); `team.support` lists a teammate's border that falls given their orders where your idle armies beside it would make it hold (each idle army offered to one border only, the border needing fewest first: the most borders held, not the most worth); `team.jointCaptures` a target neither of you takes alone but both together, resolved on the turn simulator in both orders (under a cyclic move order, `mustGoFirst`); and `cards.team` says who plays each card of the team hand — a card your teammate has entered is left to them and kept out of your plays. Support and joint captures are advice only (a move onto a teammate's territory is unverified live): never in `orders`. When one opponent touches two or more of your borders and no fixed split of the deploys there holds them all, `guess` offers a randomized split weighted by what each border is worth (each border's chance of being held, the best fixed split's worst case, the mix's expected loss, one draw seeded by the game, the turn and a local secret, so re-planning gives the same draw and the public code cannot reproduce it) and `guessOrders`, the plan's `orders` with that draw in place of its deploys on those borders — optional, a model of one opponent with one deploy, never taking armies off the territory your commander stands on or walks to, and dropped when its draw would be refused by the submit's commander check; the plan's `orders` are unchanged (`view: "full"` says why there is none). Holding an Airlift card, `airliftPlan` is an alternative beside the plan, its `orders` unchanged: the same planner on the board after the Airlifts (an interior stack flown onto a border the plan concedes, or a conceded border's armies flown to the border most pressed), the best compared by the plan's own measure — next income if its conceded borders fall, then next income, fewer concessions, more captures — with `airlifts`, `orders` (Airlift plays included), `expected`, `delta` (income, captures, borders saved, bonuses kept or completed), `cardsSpent` and `cardsLeft`; `keep_cards` holds cards in reserve; `null` with `airliftPlanNote` when none beats the plan. Airlifted armies cannot attack that turn, so a capture is staged for next turn instead (`staging`: an interior stack flown beside a target the plan does not take whose capture completes a bonus of yours or breaks an opponent's, with `nextTurnAttack` and the bonus value), scored on a two-turn objective — this turn's measure plus 0.8 × that bonus (`delta.twoTurn`) — and only when the staged stack holds against the plan's threat at that border; a plan the submit's commander check would refuse is not offered. Holding a Bomb card, `bombPlan` is the same kind of alternative: the planner on the board the Bomb leaves (its target keeps half its armies, rounded down, as the client bundle's Bomb result does) — an opponent's territory beside yours, a held bonus's member first, then the largest stacks, never a player at peace with you — with `bomb`, `orders` (the Bomb play included), `expected` and `delta`; `null` with `bombPlanNote` when none beats the plan. Holding an Emergency Blockade, `blockadePlan` walls off a border the plan concedes (neutral at its armies × the game's multiplier, before every move), worth the bonus its fall would hand an opponent when the wall holds this turn; holding a Blockade, the plain orders plus a Blockade on a territory of yours the stress-tested line keeps through the attacks (it walls it after them), worth the same denial less any bonus of yours it gives up — the better of the two is offered (owner-approved 2026-11-24). `reads` (opponent profiles, reported only — the plan never uses them): each opponent in contact with a habit at confidence 0.5 or a label, its `labels`, those habits with `n` and `basis`, and `gamesMet` (full adds the counter-play lines); absent with `WARAPP_PLAYER_PROFILE=off` or while a game's teams cannot be read. `headroom` (#275), weakest first: each border of yours with the smallest single deploy by a neighbouring opponent that takes it after the plan's orders, whether that is below your income, and what falls with it (bonuses, the territories behind it and their bonus income, and `breach`: the hollow territories within two moves behind it that only it shields, with their bonus income). The whole turn is carried out for it, so it may differ from the leftover spread's "~D" line (#268, reckoned on the deploys before any move); a player out of the game whose seat no AI plays gets no row. With the guard off the plan counts half of a border's breach income in its value. When one observation broke an opponent's estimate by 1.5× or more (a stack out of the fog, a capture, or an attack of yours it held), the first warning says so for 3 turns and the borders of your held bonuses facing it are sized for the larger of what it implied and your income (no `guess` is drawn against it then). Nothing is read once an opponent may hold an Airlift card or while the game's teams cannot be read (each `headroom` row then says `mayBeTeammate`); under Multi-Attack only a stack out of the fog is read. After turns 4 and 8 on a map you have finished games on, `pace` puts your income beside the median winner's there (reported only). `chat.messages` lists the newest unread messages other players sent (text delimited) with their `intent` and `advice` (compact: the stance and one reason; `messagesOmitted` counts the rest), from the plan's own standing: reported only, the orders never read chat. `chat.chatBlocks` lists the unread messages that would block the submit under `WARAPP_CHAT_BLOCKS_TURN` (report only). Once the outlook's surrender line (advice only) is crossed in a free-for-all with three or more still playing, `coalition` says whether a coalition against the leader is viable: the trailing players together out-earning it on the calibrated estimates, now or once a bonus of its that one of you borders breaks. While viable, for 2 turns from the crossing and as long as the leader's lead over you is not growing, "Try a coalition first" replaces the surrender warning; `coalition.partners` ranks every player who borders the leader, is not at war with you and has not broken a truce with you on the cross-game record (`leftOut` says why the others are not), and `coalition.drafts` holds a `propose` message for the top two naming the leader's bonus you could break together. Nothing is sent: send a draft yourself with `warapp_send_chat`, or with `WARAPP_CHAT_AUTOMATION=on` a draft carries `send`, still confirm-gated. |
|
|
157
|
-
| `warapp_check_plan` | A stress test of a list of orders before you submit it (`warapp_plan_turn`'s `orders`, or your own edit): the orders are carried out on the live board by the game's turn rules (deploys, then attacks and transfers in the zigzag move order, each an attack or a transfer by who holds its target when it runs) against the replies each opponent could make with one deploy — all of it on one stack and an attack on a territory you hold or are about to take, all of it on a territory you attack, or every stack attacking at once — with you moving first and with the opponent moving first unless `first_mover` says which. Returns `safe` (`null` when no reply could be tried), a one-line `summary`, the `worst` reply and the `otherReplies` that cost something (territories lost, captures that fail or are taken straight back, bonuses and income, your commander), everything `atRisk` to some single reply, `commander` (with your commander on the board: its territory, the armies there and `needs`, the armies that survive every reply tried — by `warapp_submit_turn`'s own check, each reply at the larger of the estimate and your income, `enemy_deploy` only raising it, both move orders, your Airlifts counted; when a reply kills it the `summary` starts with it), what the orders do unanswered, `blindBorders` (your territories next to the fog, where nothing could be tested) and `exposedNextTurn` (territories no stack touches today that one could take next turn by first taking the territory in between, each with the armies it would need to hold). Exact with no luck and straight rounding; otherwise `exact` is false. `known_income` (as `warapp_plan_turn`'s) tries a per-player income you know in place of that opponent's estimate (`enemyDeploy` source `known_income`; `enemy_deploy` wins over it; `commander` keeps the submit's sizing). Not tried: hidden stacks, a deploy above the estimate (`enemy_deploy` tests one), split deploys, opponents acting together, under Multi-Attack any chain but the one most damaging per stack, cards other than your own Order Priority, Airlifts, Bombs and Blockades: a Bomb is carried out after every deploy, its target keeping half its armies, rounded down; an Emergency Blockade (before the moves) and a Blockade (after them) turn their territory neutral at its armies × the game's multiplier, and the walled border is never counted lost (a wall with no multiplier in the settings is warned of as not simulated). An Airlift in the orders is carried out at its phase — after every deploy, before every move: its source loses the armies, its destination gains them, and they cannot move again that turn — so every reply is tried on the board it leaves. `award` (when the server kept your pick list) is the same reading `warapp_plan_turn` gives; its `firstMover` can be passed as `first_mover`. In a free-for-all with a recorded truce in force its partner is still tried (`safe` is safe against a break), a reply that attacks a territory the truce covers is marked `breaksTruce`, and `safeIfTruceHolds` is the verdict over the rest (`null` when every reply is a break); a Diplomacy card in effect that the decoder is sure of counts as such a truce in any format (`enforced`, `verified: false`). In a team game it warns, as `warapp_submit_turn` does, of a card play or discard your teammate has already entered. `headroom` (as `warapp_plan_turn`'s) gives each border the smallest single deploy that takes it after these orders; an opponent whose estimate an observation broke is tried at the larger of what it implied and your income (`enemyDeploy` source `untrusted`, said in the first warning). `belowPlan` (#275) compares the orders with the default plan made now on the same board, as `warapp_plan_turn` makes it with no options (or with its border guess when the deploys are the guess's: `belowPlanAgainst`): each border they leave below what that plan leaves standing there, with `planLeaves`, `left` and `short`, the largest shortfall first. `planLeaves` includes the plan's surplus, so a border named may still hold (see `headroom`). A Sanctions card in the orders is projected onto next turn in `sanctionsPlayed` (`nextIncome`: before, after and the change — yours from this turn's income when the game's percentage is negative and you play it on yourself, an opponent's estimate when positive); a card on the wrong side for its sign is a warning (`warapp_submit_turn` refuses it). Read-only. |
|
|
156
|
+
| `warapp_plan_turn` | A plan for your turn from the live board (defaults to the signed-in account): income, your cards and whether you must play one, deploys and moves by name and id, expected captures, bonuses and next income, the `frontier` budget (borders left, those facing an enemy, what they need to hold next turn, next income), warnings and reasoning, and an `orders` array (card plays included); `chat.unread` counts the chat messages not yet marked seen (counts only, from GameFeed, so every count is under `unknown`; its `note` says so); `surrenderPending` lists other players' surrenders still pending (from the game details, unverified live; `null` when unreadable), and when one waits on your acceptance the first warning says so. `goal`: balanced (default: best income per army across holds, bonuses and breaking enemy bonuses, with at least 30% on expansion) / expand / complete-bonus / defend / siege (one opponent, `siege_target` by GameFeed id, default the strongest one bordering you: its bonus breaks are funded cheapest per income lost first, its other territories are left alone and the spare deploys build one strike stack facing it until the assault trigger fires — its income at 0.6× its baseline — the most the tracker saw it deploy over its window, or its income when the siege began — yours at 1.8× its, or a stack of yours able to take a member of its held bonus against its whole deploy — then the stack strikes; `siege` reports `target`, `opponentIncome`, `baseline`, `ratio`, `fallenTo`, `breaks`, `brokenThisTurn`, `ready`, `trigger` and `memory` — the siege's first turn, its turns, the target's income trend and the bonuses broken and broken again, kept per game while the siege runs, a gap of more than 3 turns starting a new one) — omit it and the game profile (`profile`: the One Army Must Stand Guard case and what it means for interior defence, format, phase, standing) picks it (never the siege, which plays only when you pass `goal: 'siege'`, #603): defend when behind on income outside a 1v1, else balanced tuned to the format (1v1 in contact: holds and breaks before expansion that completes nothing; behind on income in a 1v1: strike — break their bonuses, inferred ones too, sized to land; behind on armies: no trade below even; in a 1v1, spare deploys build one strike stack facing the opponent; FFA: no second front; ahead in a 1v1: more fog pressure); an explicit goal overrides it; `focus` bonuses; `reserve`; `enemy_deploy` (armies an enemy is assumed to deploy; default per opponent from its visible bonuses, or what it was observed to deploy when that is larger — its tracked income, carried across turns, once `warapp_track_opponents` has 2+ turns of it; growth beside the fog beyond twice what it was expected to deploy reads as a move out of the fog, not a deploy; in an even-start 1v1 or free-for-all an opponent bordering the fog is assumed to earn at least your income, a player out of a free-for-all having its share of the hidden board split among the rest; while its income was read from under half its frontier, an opponent is sized at the midpoint between its lower bound — its tracked figure, raised to its trend's next step when its tracked income rose two turns running — and its upper bound — that fog prior, else the most it could earn — moving toward what the evidence gives as more of its frontier is read; a rising track read from more of its frontier raises it to that lower bound); the `outlook` adds `leaning: behind` when it read even for 3 turns while a bonus of yours fell on each; `known_income` (per-player incomes you know, by GameFeed id — what a player said in chat, say: each replaces that opponent's estimate, a Reinforcement card the clock adds kept on top, said in its warning; `enemy_deploy` wins over it; the commander block keeps the submit's sizing); `min_win_chance` (0.5–1; default 1 = certain captures with no luck, 0.95 with luck on; below 1, each capture is sized for that exact win chance, and the captures a bonus still needs reach it together); `first_mover` (`me` or `opponent`, when you know who moves first this turn — Cycle move orders swap the first mover every turn; when you move first, Order Priority is not advised; the same argument as `warapp_check_plan`'s). Every attack carries `winChance` (its exact probability of capturing at the game's kill rates, luck and rounding); idle armies top an attack up to its next efficient size when the extra kill can matter. Reports the borders it gives up (`conceded`: not worth or not affordable to hold, never deployed to unless every territory you hold is conceded; it may still attack out with the armies already on it; an idle interior stack beside one that would make it hold transfers in, and it is then held), `cardAdvice` (`order-priority` when you hold one and it protects your first order: a commander strike while your commander is threatened, or a move out of a conceded border carrying enough armies to be worth a card — any size when the card must go anyway; never when `first_mover` is `me`; otherwise `order-delay` when you hold Order Delay and the schedule puts an attack last — the orders then carry the card with `before`, placed above the first non-urgent order, see `cards.advice.orderDelay`; an Order Delay that must leave the hand is played there rather than discarded), `cards.advice` for the cards `warapp_submit_turn` plays but the plan never does — `diplomacy` (the opponent tying down most of your border armies, only with two or more in contact, never a truce partner the truce already covers unless the card adds protection), `sanctions` (the leader, passing over a truce partner or a player a Diplomacy card keeps at peace with you, with the reason; yourself when the game's Sanctions percentage is negative — the card then raises the target's income — with `income`: your next income before and after the boost, by the client's rule (not under Local Deployment); never a negative card on an opponent nor a positive one on you), `airlift` (a border of yours or a teammate's that falls without it), `gift` (the members that complete a teammate's bonus), `spy` / `reconnaissance` / `surveillance` (only where the fog hides what the plan needs: an opponent out of view, a hidden territory on your border, a fogged member of a bonus you are completing; never with fog off) — each with an `order` to pass as is, never added to the orders save a completing `gift` (its play verified live 2026-11-23, #435: its card plays go into `orders` and the transfers out of or into the gifted members are dropped; never a territory with a special unit such as your commander, never one an attack leaves from) and a Reconnaissance (in a team game only cards read under you are played, discarded or advised; unverified live) and `trendSource` (where last turn's board came from — `history`, `cache` or null — for growing enemy stacks). Obeys the game's kill rates, Local Deployment and No-Split (`view: "full"` echoes the settings it assumed: `idleTransfers`, the planner's own switch for moving idle armies, beside the game's own `allowTransferOnly` and `allowAttackOnly`, `null` when GameFeed does not state them). Read-only; refuses outside a turn phase. In a Commanders game a commander counts as 7 armies, your commander's territory is never conceded (it gets the deploys it needs to hold against the worst case — the opponent's whole deploy, at least your own income, plus every enemy stack within two moves — or every army when that is not enough), and an adjacent enemy commander is attacked first, sized for its owner's full deploy. Within three moves of an enemy or the fog, with a safer territory of yours reachable, your commander walks one step a turn toward safety: a move in `orders` with `commander: true` (encoding not yet verified live), said in the first warning; the territory it leaves is held only for its own worth, plus what survives the attacks that may land before the walk (every enemy stack beside it, even when you move first: `warapp_submit_turn` checks both move orders; when that does not fit, each player's strongest attack, with the walk as your first order), no other order leaves it before the walk but a strike that ends a player, and Order Priority is advised for the walk only when even that falls short or the fog borders it; under No-Split a commander kill the walk displaces is named in a warning. Every turn of such a game `commander` reports your commander (#274): its territory, the armies there after the plan, `movesToEnemy` (to the nearest enemy or fog), `killedBy` (the smallest deploy, made by each opponent at once, at which a reply kills it: `player`, and `partner` when it is two opponents striking together; null when none reaches it this turn), and `safe` / `needs` at the larger of the estimate and your income; when it is not safe the first warning says so and whether `warapp_submit_turn` would refuse those orders (it does not without Commanders in the settings, nor when only an `enemy_deploy` what-if makes the commander unsafe). When the server kept your pick list, `award` says what the award of picks showed: the territories of your list that are another player's start for certain (in a two-player game planned as the opponent's while still fogged), whether you were awarded first or second and who moves first this turn under a `Cycle` move order, and with commanders the opponent's first award when the award pins it. `relations` reports each truce recorded with `warapp_record_agreement` as the plan treated it (honoured in a free-for-all; in a team or two-player game only its covered territories stay off-limits): while active or in notice no covered territory of the partner is attacked, a covered border facing only the partner is held against its stacks without a deploy (never your commander's, a border worth more than a quarter of your income, or any while trust is `watch`), and a border cap is kept: no move of yours fills that border past it, and the excess moves one step back (a warning when your own deploy for a hold is what exceeds it — deploy less, or give notice and ask before exceeding it — or when the cap leaves a border that also faces another opponent, or your commander's, short of its hold); `advice` says `give-notice` when the endgame or the partner outgrowing you made the trust `watch`; a truce the board shows broken is planned as an ordinary opponent, with the evidence (record it as `broken-by-them` before submitting: `warapp_submit_turn` reads only the ledger); each honoured truce reports `lossIfBroken` (what you would lose this turn if the partner landed its whole deploy beside your costliest covered territory, from any territory of its there, and attacked, carried out against the plan's orders: territories, armies, bonuses and income; logged per turn in the ledger beside the armies it freed); `tacit` lists quiet borders with no agreement (a report, never a truce). A Diplomacy card in effect between you and a player, read from the live board, is honoured in any format (that player is no threat and no target this turn), and Sanctions on you cut the plan's income (Sanctions on an opponent cut its estimate when that is read off the board, `sanctionsOnOthers`), when the decoder is sure of them (the card in play, its expiry within the game's duration); `cardsInEffect` lists them, marked `verified: false` (the active-card decoder is not yet checked live). Otherwise a warning says what was read and why it was not relied on. In a team game a bonus with a teammate's territory in it is never planned toward (a bonus pays one holder), and `team.sharedBonuses` lists each bonus you and a teammate both hold members of and who is `nearer` to holding it (advisory; team vision unverified). With your teammate's entered orders on the live board (unverified live): of two otherwise equal captures the one on the opponent they attack goes first (a "Team focus" rationale line); `team.support` lists a teammate's border that falls given their orders where your idle armies beside it would make it hold (each idle army offered to one border only, the border needing fewest first: the most borders held, not the most worth); `team.jointCaptures` a target neither of you takes alone but both together, resolved on the turn simulator in both orders (under a cyclic move order, `mustGoFirst`); and `cards.team` says who plays each card of the team hand — a card your teammate has entered is left to them and kept out of your plays. Support and joint captures are advice only (a move onto a teammate's territory is unverified live): never in `orders`. When one opponent touches two or more of your borders and no fixed split of the deploys there holds them all, `guess` offers a randomized split weighted by what each border is worth (each border's chance of being held, the best fixed split's worst case, the mix's expected loss, one draw seeded by the game, the turn and a local secret, so re-planning gives the same draw and the public code cannot reproduce it) and `guessOrders`, the plan's `orders` with that draw in place of its deploys on those borders — optional, a model of one opponent with one deploy, never taking armies off the territory your commander stands on or walks to, and dropped when its draw would be refused by the submit's commander check; the plan's `orders` are unchanged (`view: "full"` says why there is none). Holding an Airlift card, `airliftPlan` is an alternative beside the plan, its `orders` unchanged: the same planner on the board after the Airlifts (an interior stack flown onto a border the plan concedes, or a conceded border's armies flown to the border most pressed), the best compared by the plan's own measure — next income if its conceded borders fall, then next income, fewer concessions, more captures — with `airlifts`, `orders` (Airlift plays included), `expected`, `delta` (income, captures, borders saved, bonuses kept or completed), `cardsSpent` and `cardsLeft`; `keep_cards` holds cards in reserve; `null` with `airliftPlanNote` when none beats the plan. Airlifted armies cannot attack that turn, so a capture is staged for next turn instead (`staging`: an interior stack flown beside a target the plan does not take whose capture completes a bonus of yours or breaks an opponent's, with `nextTurnAttack` and the bonus value), scored on a two-turn objective — this turn's measure plus 0.8 × that bonus (`delta.twoTurn`) — and only when the staged stack holds against the plan's threat at that border; a plan the submit's commander check would refuse is not offered. Holding a Bomb card, `bombPlan` is the same kind of alternative: the planner on the board the Bomb leaves (its target keeps half its armies, rounded down, as the client bundle's Bomb result does) — an opponent's territory beside yours, a held bonus's member first, then the largest stacks, never a player at peace with you — with `bomb`, `orders` (the Bomb play included), `expected` and `delta`; `null` with `bombPlanNote` when none beats the plan. Holding an Emergency Blockade, `blockadePlan` walls off a border the plan concedes (neutral at its armies × the game's multiplier, before every move), worth the bonus its fall would hand an opponent when the wall holds this turn; holding a Blockade, the plain orders plus a Blockade on a territory of yours the stress-tested line keeps through the attacks (it walls it after them), worth the same denial less any bonus of yours it gives up — the better of the two is offered (owner-approved 2026-11-24). `reads` (opponent profiles, reported only — the plan never uses them): each opponent in contact with a habit at confidence 0.5 or a label, its `labels`, those habits with `n` and `basis`, and `gamesMet` (full adds the counter-play lines); absent with `WARAPP_PLAYER_PROFILE=off` or while a game's teams cannot be read. `headroom` (#275), weakest first: each border of yours with the smallest single deploy by a neighbouring opponent that takes it after the plan's orders, whether that is below your income, and what falls with it (bonuses, the territories behind it and their bonus income, and `breach`: the hollow territories within two moves behind it that only it shields, with their bonus income). The whole turn is carried out for it, so it may differ from the leftover spread's "~D" line (#268, reckoned on the deploys before any move); a player out of the game whose seat no AI plays gets no row. With the guard off the plan counts half of a border's breach income in its value. When one observation broke an opponent's estimate by 1.5× or more (a stack out of the fog, a capture, or an attack of yours it held), the first warning says so for 3 turns and the borders of your held bonuses facing it are sized for the larger of what it implied and your income (no `guess` is drawn against it then). Nothing is read once an opponent may hold an Airlift card or while the game's teams cannot be read (each `headroom` row then says `mayBeTeammate`); under Multi-Attack only a stack out of the fog is read. After turns 4 and 8 on a map you have finished games on, `pace` puts your income beside the median winner's there (reported only). `chat.messages` lists the newest unread messages other players sent (text delimited) with their `intent` and `advice` (compact: the stance and one reason; `messagesOmitted` counts the rest), from the plan's own standing: reported only, the orders never read chat. `chat.chatBlocks` lists the unread messages that would block the submit under `WARAPP_CHAT_BLOCKS_TURN` (report only). Once the outlook's surrender line (advice only) is crossed in a free-for-all with three or more still playing, `coalition` says whether a coalition against the leader is viable: the trailing players together out-earning it on the calibrated estimates, now or once a bonus of its that one of you borders breaks. While viable, for 2 turns from the crossing and as long as the leader's lead over you is not growing, "Try a coalition first" replaces the surrender warning; `coalition.partners` ranks every player who borders the leader, is not at war with you and has not broken a truce with you on the cross-game record (`leftOut` says why the others are not), and `coalition.drafts` holds a `propose` message for the top two naming the leader's bonus you could break together. Nothing is sent: send a draft yourself with `warapp_send_chat`, or with `WARAPP_CHAT_AUTOMATION=on` a draft carries `send`, still confirm-gated. `strategy: true` (#606) adds a menu for choosing a turn yourself: ranked capture and hold options with their costs and the default plan beside the planner under other goals, each stress-tested. `facts` adds the raw state behind them, only the parts you name: `me`, `territories`, `bonuses`, `opponents` (each income estimate and how it was read), `changes` since last turn and `past` turns. Every plan's `more` line says both can be asked for; the plan itself is unchanged. |
|
|
157
|
+
| `warapp_check_plan` | A stress test of a list of orders before you submit it (`warapp_plan_turn`'s `orders`, or your own edit): the orders are carried out on the live board by the game's turn rules (deploys, then attacks and transfers in the zigzag move order, each an attack or a transfer by who holds its target when it runs) against the replies each opponent could make with one deploy — all of it on one stack and an attack on a territory you hold or are about to take, all of it on a territory you attack (or that plus its stacks beside it moving in first: `gather`, the bait, with `movedIn`), or every stack attacking at once — with you moving first and with the opponent moving first unless `first_mover` says which. Returns `safe` (`null` when no reply could be tried), a one-line `summary`, the `worst` reply and the `otherReplies` that cost something (territories lost, captures that fail or are taken straight back, bonuses and income, your commander), everything `atRisk` to some single reply, `commander` (with your commander on the board: its territory, the armies there and `needs`, the armies that survive every reply tried — by `warapp_submit_turn`'s own check, each reply at the larger of the estimate and your income, `enemy_deploy` only raising it, both move orders, your Airlifts counted; when a reply kills it the `summary` starts with it), what the orders do unanswered, `blindBorders` (your territories next to the fog, where nothing could be tested) and `exposedNextTurn` (territories no stack touches today that one could take next turn by first taking the territory in between, each with the armies it would need to hold). Exact with no luck and straight rounding; otherwise `exact` is false. `known_income` (as `warapp_plan_turn`'s) tries a per-player income you know in place of that opponent's estimate (`enemyDeploy` source `known_income`; `enemy_deploy` wins over it; `commander` keeps the submit's sizing). Not tried: hidden stacks, a deploy above the estimate (`enemy_deploy` tests one), split deploys, opponents acting together, under Multi-Attack any chain but the one most damaging per stack, cards other than your own Order Priority, Airlifts, Bombs and Blockades: a Bomb is carried out after every deploy, its target keeping half its armies, rounded down; an Emergency Blockade (before the moves) and a Blockade (after them) turn their territory neutral at its armies × the game's multiplier, and the walled border is never counted lost (a wall with no multiplier in the settings is warned of as not simulated). An Airlift in the orders is carried out at its phase — after every deploy, before every move: its source loses the armies, its destination gains them, and they cannot move again that turn — so every reply is tried on the board it leaves. `award` (when the server kept your pick list) is the same reading `warapp_plan_turn` gives; its `firstMover` can be passed as `first_mover`. In a free-for-all with a recorded truce in force its partner is still tried (`safe` is safe against a break), a reply that attacks a territory the truce covers is marked `breaksTruce`, and `safeIfTruceHolds` is the verdict over the rest (`null` when every reply is a break); a Diplomacy card in effect that the decoder is sure of counts as such a truce in any format (`enforced`, `verified: false`). In a team game it warns, as `warapp_submit_turn` does, of a card play or discard your teammate has already entered. `headroom` (as `warapp_plan_turn`'s) gives each border the smallest single deploy that takes it after these orders; an opponent whose estimate an observation broke is tried at the larger of what it implied and your income (`enemyDeploy` source `untrusted`, said in the first warning). `belowPlan` (#275) compares the orders with the default plan made now on the same board, as `warapp_plan_turn` makes it with no options (or with its border guess when the deploys are the guess's: `belowPlanAgainst`): each border they leave below what that plan leaves standing there, with `planLeaves`, `left` and `short`, the largest shortfall first. `planLeaves` includes the plan's surplus, so a border named may still hold (see `headroom`). A Sanctions card in the orders is projected onto next turn in `sanctionsPlayed` (`nextIncome`: before, after and the change — yours from this turn's income when the game's percentage is negative and you play it on yourself, an opponent's estimate when positive); a card on the wrong side for its sign is a warning (`warapp_submit_turn` refuses it). Read-only. |
|
|
158
158
|
| `warapp_turn_history` | A game turn by turn as you saw it, beside what this server planned, sent and expected (read from the game's decision log; ids only): per turn the board in view (summary, or whole with `board: true`), `changedHands` since the turn before, every player's visible `orders` that turn (deploys, moves, card plays, discards — kept from the next turn's live board since #570), the `plan`, the orders `sent` and `differsFromPlan`, the `outcome` next turn, cards, events, and once finished the turn's `truth` and `accuracy`. `from_turn`/`to_turn` (default the newest 5, at most 20 per call, `next` pages on); `view: "full"` adds the plan's rationale and warnings, checks, times and first mover; `read_last_turn: true` reads the live board once to keep the turn just resolved. Read-only; attack results are not decoded. |
|
|
159
159
|
| `warapp_track_opponents` | Each opponent over your own board history (the boards `warapp_plan_turn` and this tool read, the last 10 turns, or the game history when war.app sends it), by name: its observed deploy each turn (territories visible both turns only — a stack that came out of the fog is not income), an income estimate (each observed deploy is a lower bound under fog, so the largest of its last three observed turns, or its visible army growth plus losses per turn (stacks out of the fog left out) when that is more; capped at what it could earn, at least its base plus the bonuses it visibly holds; `method` and `observedRange` say which term set it and how spread the observations were), `unexplainedArmies` (income earned since first seen minus its visible army change, its visible losses and its likely combat deaths: armies in the fog, spent there, or a misread) and `inferredBonuses` (the combinations of bonuses it could hold that best explain the gap, only those within 4 hops of its territories that it could have paid for, nearest first — candidates, never one asserted; none listed when more than 8 fit), with confidence notes. Every opponent still playing is listed, even with no territory in view (`visible` territories in view, `turnsUnseen` — a floor, `turnsUnseenAtLeast`, when your boards do not reach back to when it was last seen); one with nothing in view gets `earnedAtLeast` — its starting armies plus the base income for every turn so far, a lower bound on armies received (not held: its expansion cost some) — and a warning, also in `warapp_plan_turn`, when that beats your largest stack or your total visible armies. Once an opponent has 2+ observed turns, `warapp_plan_turn` uses this income in place of the single-turn observed figure. `view`: compact / full. Read-only on war.app (it caches the board it read); refuses outside a turn phase. `full` adds `pastGames`: the lessons of your finished games — how they were lost, when your income went flat, and this tracker's estimate ÷ the true income by format and coverage band (reported only). |
|
|
160
160
|
| `warapp_locate_opponents` | Where each opponent probably is and what it may be doing, by name. `seen` is the only fact: its territories in view, and those your earlier boards last showed as its own. Everything else is a simple model's guess with its `basis`, and every `likelihood` is that model's estimate, not a measured probability: `starts` (proven by the award of your picks, then the likely ones among the territories the live board showed as pickable — kept by `warapp_plan_picks` and the `warapp_submit_picks` preview — or, in a game dealt automatically from a map distribution mode, that mode's territories — read once from war.app's map details and kept with the map, with a `warnings` line when unknown — less those a board showed as a neutral or as yours), `presence` (hidden territories it may hold: last seen, start, the corridor between a likely start and a sighting, what it could have grown into from that start, bonuses that explain its tracked income), `bonuses` it probably holds, its tracked `income` and `hiddenArmies` (`warapp_track_opponents`' `unexplainedArmies`), `approaches` (the earliest turn it could attack each of your border territories, from a stack in view with the armies that could arrive, or `guessed`) and `doing`; then `prepare` (`hold`, `contested`, `scout`). The start prior is uniform, or — locally with `WARAPP_STATS=1`, never hosted — weighted by the starts in the finished games `warapp_map_stats` already cached for the map. No war.app request beyond the live board and the game feed, and the map details once per map for a mode's territories. `view`: compact / full (adds the assumptions). Read-only on war.app (it caches the board it read); refuses outside a turn phase. `warapp_plan_turn` does not use it yet. `startCandidates` says where the start candidates came from (and, for a distribution mode, its id and name). |
|
|
161
161
|
| `warapp_profile_opponents` | What each opponent tends to do, by name, counted from your boards and the orders this server sent: per opponent `seen.turnsObserved` (the only fact) and `habits` — `reinforce` (your attack on its territory met more armies than the board showed; measured only at 0% luck with straight rounding), `attack` (turns in contact it attacked you), `firstStrike`, `stacking` (share of its visible growth on one territory), `retaliate` and `retake` (within two turns) — each this game's counts pooled with the player's faded counts from your earlier finished games (`seen.gamesMet`) and shrunk toward a prior (all players in this format, then all players, once that pool has 10 opportunities; the AI pool for an AI seat; else a neutral default) — a `value`, its `n`, `confidence` and `basis` (`this-game`, `past-games`, `population` or `default`), then `labels` and `counter` lines at confidence 0.5 or more. Known teammates are never profiled; while a game's teams cannot be read, nothing is kept and every other player carries `mayBeTeammate: true`. The turns are kept per game (`<dataDir>/profiles/games/`, ids and counts only) by this tool, `warapp_plan_turn` (not a what-if plan), `warapp_track_opponents`, `warapp_locate_opponents` and `warapp_get_relations`, unless `WARAPP_PLAYER_PROFILE=off`. `profile` says whether the turns are `kept`, `not-kept` (no data dir, or the teams unknown) or `off`. `detail`: compact / full (adds the counts and each observed turn). `lastAttackTurn` beside the labels is the last turn it attacked you (null: none seen); `turtle` is never given within two turns of one. Given a finished game it folds it into the cross-game counts instead (`fold`: once, from the turns kept while it was played, else a backfill from the boards cached then — no other request, nothing while its teams are unknown — or "counts start with games played on this build"); `warapp_get_game` does the same on a finished game (`profileFold`). Read-only on war.app (it caches the board it read); refuses any other state outside a turn phase. `warapp_plan_turn` reports a compact read as `reads` (with `lastAttackTurn`) but does not use it. A habit whose past weighs most and was mostly read from finished games' histories reads `basis: history`. |
|
|
162
162
|
| `warapp_plan_picks` | A pick list for a manual-distribution game in the picking stage, from the map, the settings and the live board's pickable territories: priority order by name and id, a compact primary group (the territory limit) and a disjoint fallback group (as long as war.app's client allows), each pick's score and reasons (bonus, value, turns to complete, first-turn bonus, entry points, contested), the award (the sets the award order can grant, and the worst), the primary's `coverage` (the reasonable bonuses its picks can stand next to within 2 moves) and, in a 1v1 when it covers more, a coverage-first `alternative` list with its own `submitPicks` (compact is the default; the alternative suits a small board), warnings for assumed settings, and `submitPicks` — the ids in order, ready for `warapp_submit_picks`. In a team game only the players off your team are threats, `team` names your teammates, and the list is judged by both award orders that fit (`award.orders`; a team game's is unverified); `warapp_submit_picks` warns when a team game's list is shorter than starts × all players. When a teammate's pick list can be read (their entered orders, else `GetTerritoryPicks`; unverified live), each teammate carries `picks` and `team.coordination` reports the overlap with your list, the bonuses their top picks into (a bonus pays one holder, so your picks there are not credited) and a `mirrored` alternative — the same top picks in both lists, laid on the positions a reversing award gives one player, with the bonuses a repeating order would split and its own `submitPicks` — beside the split list in `submitPicks`, which leaves their top picks to them and is shortened only when disjoint from their list and theirs is full length; every `submitPicks` fits war.app's client limit. With no list read the plan is unchanged. The heuristics are in [docs/STRATEGY.md](docs/STRATEGY.md). `view`: compact / full. Read-only; refuses outside the picking stage. With finished games on the map, `mapRecord` reports them beside the list (reported only): your results by start bonus, where winners started, and the median income after turns 4 and 8. In a game that overrides bonus values with a territory limit of 1 on a huge map (1,000+ territories, 3+ players), `startRanking` ranks single starts instead — income at the game's values, turns to the first income above the base, wastelands, commander safety — 25 per `page`, with `submitPicks` the ranking cut at players × 1. |
|
|
163
163
|
| `warapp_submit_picks` | **Writes.** Replace your territory picks (priority order, pickable territories only; a list longer than war.app's client allows — players × territories per player — or shorter than each player's share is warned about in the preview). Confirm-gated; reads the picks back and reports `verified` only on an exact match. |
|
|
164
|
-
| `warapp_submit_turn` | **Writes.** Commit your turn's orders (e.g. `warapp_plan_turn`'s `orders`) as the signed-in account: card plays (Reinforcement, Order Priority, Order Delay, Blockade, Airlift, Diplomacy — the Blockade and Airlift plays verified live 2026-11-16, Diplomacy 2026-11-18, Gift 2026-11-23; Reconnaissance accepted live 2026-11-20 (the reveal itself not yet seen); and, encoded as the client does but not yet verified live, Spy, Surveillance, Sanctions, Bomb and Emergency Blockade with their targets — refused where war.app would refuse them, e.g. a commander gifted or airlifted to a teammate, a Spy on your own side, Sanctions on your own side while the game's percentage is positive or unreadable (a negative percentage raises the target's income, so the card then goes on yourself or a teammate and never on an opponent; the preview says the boost), a Spy on the neutral (player `0`) unless the game's Spy card allows it, Diplomacy between teammates or naming a player who is out, a Bomb on your own side or not next to you, an Emergency Blockade on a territory not yours or on your commander; in a team game the preview warns when the orders play or discard a card your teammate has already entered (a card named by type is one nobody entered when there is one; their orders are read from the live board, unverified); an Airlift may send `armies: 0` with `commander` to move the commander alone, leaves at least one army behind while One Army Must Stand Guard is on, and once the orders read as committed every Airlift sent is read back from war.app's copy of them (the `warapp_get_my_orders` read): the result carries `airliftReadBack` (`verified`, or `unread` / `not-read` with why), and a missing or altered Airlift makes the result an error naming it — nothing is resent; a Sanctions play is read back the same way (`cardReadBack`: its card and player; missing, or read back on another player, is an error); and a Gift to an opponent is named as one in the preview); a Bomb, Blockade or Emergency Blockade in the orders is read back the same way after the commit (`cardReadBack`: its card and target), discards, deploys and moves. Confirm-gated; validated on the live board (cards in your hand, your territories, adjacent moves, armies available, deploys = income + played Reinforcement armies; bonus armies inside their bonus under Local Deployment; one attack/transfer per territory under No-Split, with a warning when one sends less than the whole stack; enough card plays or discards when you hold more cards than the limit); confirmed from game state (`resolved` / `committed` / `unknown`). An order that attacks (or a Bomb that hits) a territory an active or in-notice truce covers (`warapp_record_agreement`) is refused unless `break_agreement: true`: the preview then names the agreement, and once the orders are committed the ledger records it broken by you (and the partner's player record says so). In a Commanders game, orders that leave your commander takeable by one opponent's single deploy, or two striking together when you lead a free-for-all (each reply sized at the larger of its estimate and your income, on the live board; your Airlifts are counted, after the deploys and before the moves, the commander with one that takes it), are refused with the armies that would hold (under Local Deployment the hint says a deploy there must come from a pool that reaches it), and so is a Blockade or Gift of a territory your commander stands on before or after the orders (not simulated), unless `accept_commander_risk: true` (ask first: losing the commander loses the game); the preview then warns first and the result records `commanderRiskAccepted`. The preview also warns when the orders break a promise a chat message declared (`warapp_send_chat`'s `commitments`): an attack you said you would not make, or an attack you said you would make and left out. It warns too (never refuses) when the orders leave a border of a bonus you hold falling to a single deploy below your own income (#275 headroom), and when they leave any border below what the default plan made now (as `warapp_plan_turn` makes it with no options, or its border guess when the deploys are the guess's) leaves standing there, naming each with the difference (#275). Other players see the results. Optional `override_reason` (at most 500 characters) and `override_by` (`hand` or `agent`, default `agent`) say why and by whom the orders differ from `warapp_plan_turn`'s for the turn: they change nothing sent, and are kept (names scrubbed) in the [decision log](#decision-log) beside the plan only when the orders do differ. Unread chat that may change the turn is listed in the preview's `chatWarnings`; with `WARAPP_CHAT_BLOCKS_TURN=on` it is refused instead, unless `chat_reviewed: true` (see [Chat advice](#chat-advice)). |
|
|
164
|
+
| `warapp_submit_turn` | **Writes.** Commit your turn's orders (e.g. `warapp_plan_turn`'s `orders`) as the signed-in account: card plays (Reinforcement, Order Priority, Order Delay, Blockade, Airlift, Diplomacy — the Blockade and Airlift plays verified live 2026-11-16, Diplomacy 2026-11-18, Gift 2026-11-23; Reconnaissance accepted live 2026-11-20 (the reveal itself not yet seen); and, encoded as the client does but not yet verified live, Spy, Surveillance, Sanctions, Bomb and Emergency Blockade with their targets — refused where war.app would refuse them, e.g. a commander gifted or airlifted to a teammate, a Spy on your own side, Sanctions on your own side while the game's percentage is positive or unreadable (a negative percentage raises the target's income, so the card then goes on yourself or a teammate and never on an opponent; the preview says the boost), a Spy on the neutral (player `0`) unless the game's Spy card allows it, Diplomacy between teammates or naming a player who is out, a Bomb on your own side or not next to you, an Emergency Blockade on a territory not yours or on your commander; in a team game the preview warns when the orders play or discard a card your teammate has already entered (a card named by type is one nobody entered when there is one; their orders are read from the live board, unverified); an Airlift may send `armies: 0` with `commander` to move the commander alone, leaves at least one army behind while One Army Must Stand Guard is on, and once the orders read as committed every Airlift sent is read back from war.app's copy of them (the `warapp_get_my_orders` read): the result carries `airliftReadBack` (`verified`, or `unread` / `not-read` with why), and a missing or altered Airlift makes the result an error naming it — nothing is resent; a Sanctions play is read back the same way (`cardReadBack`: its card and player; missing, or read back on another player, is an error); and a Gift to an opponent is named as one in the preview); a Bomb, Blockade or Emergency Blockade in the orders is read back the same way after the commit (`cardReadBack`: its card and target), discards, deploys and moves. Confirm-gated; validated on the live board (cards in your hand, your territories, adjacent moves, armies available, deploys = income + played Reinforcement armies; bonus armies inside their bonus under Local Deployment; one attack/transfer per territory under No-Split, with a warning when one sends less than the whole stack; enough card plays or discards when you hold more cards than the limit); confirmed from game state (`resolved` / `committed` / `unknown`). An order that attacks (or a Bomb that hits) a territory an active or in-notice truce covers (`warapp_record_agreement`) is refused unless `break_agreement: true`: the preview then names the agreement, and once the orders are committed the ledger records it broken by you (and the partner's player record says so). In a Commanders game, orders that leave your commander takeable by one opponent's single deploy, or two striking together when you lead a free-for-all (each reply sized at the larger of its estimate and your income, on the live board; your Airlifts are counted, after the deploys and before the moves, the commander with one that takes it), are refused with the armies that would hold (under Local Deployment the hint says a deploy there must come from a pool that reaches it), and so is a Blockade or Gift of a territory your commander stands on before or after the orders (not simulated), unless `accept_commander_risk: true` (ask first: losing the commander loses the game); the preview then warns first and the result records `commanderRiskAccepted`. The preview warns of bait too: an attack on a player's territory that its owner's stacks beside it can reinforce first so it fails before any deploy (`warapp_check_plan`'s `gather` reply adds the deploy). The preview also warns when the orders break a promise a chat message declared (`warapp_send_chat`'s `commitments`): an attack you said you would not make, or an attack you said you would make and left out. It warns too (never refuses) when the orders leave a border of a bonus you hold falling to a single deploy below your own income (#275 headroom), and when they leave any border below what the default plan made now (as `warapp_plan_turn` makes it with no options, or its border guess when the deploys are the guess's) leaves standing there, naming each with the difference (#275). Other players see the results. Optional `override_reason` (at most 500 characters) and `override_by` (`hand` or `agent`, default `agent`) say why and by whom the orders differ from `warapp_plan_turn`'s for the turn: they change nothing sent, and are kept (names scrubbed) in the [decision log](#decision-log) beside the plan only when the orders do differ. Unread chat that may change the turn is listed in the preview's `chatWarnings`; with `WARAPP_CHAT_BLOCKS_TURN=on` it is refused instead, unless `chat_reviewed: true` (see [Chat advice](#chat-advice)). |
|
|
165
165
|
| `warapp_uncommit_turn` | **Writes.** Withdraw your committed orders for the current turn (war.app's UnCommit, the game's "Modify orders") so you can submit corrected ones with `warapp_submit_turn`. Confirm-gated; refuses outside a turn phase and when your orders are not committed; reads the outcome from GameFeed (`uncommitted` / `unconfirmed`, or `unknown` when war.app did not answer — never resent). The game waits on you again, so recommit before the boot timer. A truce recorded broken by you on that turn (`break_agreement`) stays recorded: `agreementsStillBroken` names it. The orders withdrawn are read back first and carried in the preview and result (`withdrawnOrders`, `warapp_submit_turn`'s shape; `null` when unreadable). |
|
|
166
166
|
| `warapp_chat_inbox` | The chat you have not marked seen, across all your games in one call (your lobbies and games being picked or played, from your games list, and a finished game when war.app flags its chat unread, or when those flags do not read (`finishedUnflagged` counts these) — or exactly the games in `game_ids`; `gamesFrom` says which, and from the list `listed`/`complete` whether it was whole): per game with something new, `unread` per channel and only the new messages (the newest `limit`, delimited, as `warapp_get_chat` shows them); games with nothing new in `quiet`, a game whose read failed in `failed` (never an error for the call). At most `max_games` (default and max 10) games per call, read one at a time: pass `next` back as `cursor` for the rest. Reading marks nothing; `mark_seen: true` marks every channel of each game read as seen, on this machine only (war.app still shows them unread until `warapp_mark_chat_read` marks them read there). Read-only. Each new message from another player carries `intent` and `advice`, as `warapp_get_chat` gives them. |
|
|
167
167
|
| `warapp_get_notifications` | Your war.app in-app notifications (the game's notifications screen), 30 per page and by id only: each with `id`, `kind` (`game-ended` when the title is war.app's `Game "…" has ended.` line, else `other`), `gameId` (the game its link names, or null), `time` and `unread`; never the title or body, which carry other players' names. `total`, `next` (pass back as `start`) and `unread_only`. A game-ended notification runs the end-of-game pass on that game once, as `warapp_get_game` does (`endOfGame`: `processed`, each with `profileFold`, and `pending`; at most two games a call, one history read each, none for a game already processed), and folds the opponent profile kept for it (`profilesFolded`: one game read, only when such a profile is still kept unfolded). Read from war.app's client code, unverified live. Read-only. |
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { bonusTerritories } from './bonuses.js';
|
|
2
|
+
import { armiesToTake } from './combat.js';
|
|
3
|
+
import { neighborsOf } from './graph.js';
|
|
4
|
+
import { planTurn } from './planner.js';
|
|
5
|
+
/** Said with every `strategy` view: what the options are, and what they are not. */
|
|
6
|
+
export const STRATEGY_NOTE = 'Mechanics, not advice: capture costs at the game\'s kill rates with no luck beyond them, deploy estimates as warapp_plan_turn ' +
|
|
7
|
+
'reads them, and each alternative stress-tested against single-deploy replies only (as warapp_check_plan). The default ' +
|
|
8
|
+
'plan is the planner\'s pick; choosing another or your own is yours to judge — check it with warapp_check_plan.';
|
|
9
|
+
/** The most options of each kind listed. */
|
|
10
|
+
export const MAX_OPTIONS = 15;
|
|
11
|
+
const ownerOf = (t) => t?.owner.kind === 'neutral' ? 'neutral' : t?.owner.kind === 'player' ? t.owner.playerId : null;
|
|
12
|
+
/** The capture and hold options on this board, ranked. */
|
|
13
|
+
export function turnOptions(input, limit = MAX_OPTIONS) {
|
|
14
|
+
const { graph: g, board, me } = input;
|
|
15
|
+
const state = new Map(board.territories.map((t) => [t.territoryId, t]));
|
|
16
|
+
const guard = input.guard === false ? 0 : 1;
|
|
17
|
+
const mine = new Set(board.territories.filter((t) => ownerOf(t) === me).map((t) => t.territoryId));
|
|
18
|
+
const foe = (o) => typeof o === 'number' && o !== me && !input.friends?.has(o);
|
|
19
|
+
const armies = (t) => state.get(t)?.armies ?? 0;
|
|
20
|
+
const take = (defenders) => armiesToTake(defenders, input.rates);
|
|
21
|
+
const bonusesOf = new Map();
|
|
22
|
+
for (const b of g.map.bonuses)
|
|
23
|
+
for (const t of bonusTerritories(g, b.id))
|
|
24
|
+
bonusesOf.set(t, [...(bonusesOf.get(t) ?? []), b.id]);
|
|
25
|
+
const missing = (bonusId, held) => bonusTerritories(g, bonusId).filter((t) => !held.has(t)).length;
|
|
26
|
+
const captures = [];
|
|
27
|
+
const seen = new Set();
|
|
28
|
+
for (const m of [...mine].sort((a, b) => a - b))
|
|
29
|
+
for (const t of neighborsOf(g, m)) {
|
|
30
|
+
if (mine.has(t) || seen.has(t))
|
|
31
|
+
continue;
|
|
32
|
+
seen.add(t);
|
|
33
|
+
const st = state.get(t);
|
|
34
|
+
const owner = ownerOf(st);
|
|
35
|
+
if (owner === null || st.armies === null)
|
|
36
|
+
continue;
|
|
37
|
+
if (typeof owner === 'number' && input.friends?.has(owner))
|
|
38
|
+
continue;
|
|
39
|
+
const defenders = st.armies;
|
|
40
|
+
const after = new Set([...mine, t]);
|
|
41
|
+
const completes = [];
|
|
42
|
+
const advances = [];
|
|
43
|
+
for (const id of bonusesOf.get(t) ?? []) {
|
|
44
|
+
const b = g.bonusById.get(id);
|
|
45
|
+
if (b.value <= 0)
|
|
46
|
+
continue;
|
|
47
|
+
const left = missing(id, after);
|
|
48
|
+
if (left === 0)
|
|
49
|
+
completes.push({ bonusId: id, value: b.value });
|
|
50
|
+
else
|
|
51
|
+
advances.push({ bonusId: id, value: b.value, missingAfter: left });
|
|
52
|
+
}
|
|
53
|
+
const opens = neighborsOf(g, t).filter((n) => !mine.has(n) && foe(ownerOf(state.get(n))) && !neighborsOf(g, n).some((x) => mine.has(x))).length;
|
|
54
|
+
captures.push({
|
|
55
|
+
target: t,
|
|
56
|
+
owner,
|
|
57
|
+
defenders,
|
|
58
|
+
needs: take(defenders),
|
|
59
|
+
...(typeof owner === 'number' ? { needsIfReinforced: take(defenders + Math.max(0, input.deployOf(owner))) } : {}),
|
|
60
|
+
from: neighborsOf(g, t)
|
|
61
|
+
.filter((n) => mine.has(n))
|
|
62
|
+
.map((n) => ({ territoryId: n, spare: Math.max(0, armies(n) - guard) }))
|
|
63
|
+
.sort((a, b) => b.spare - a.spare || a.territoryId - b.territoryId),
|
|
64
|
+
completes,
|
|
65
|
+
advances: advances.sort((a, b) => a.missingAfter - b.missingAfter || b.value - a.value || a.bonusId - b.bonusId),
|
|
66
|
+
incomeGain: completes.reduce((n, c) => n + c.value, 0),
|
|
67
|
+
opensBorders: opens,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
const nearest = (c) => (c.advances.length ? c.advances[0].missingAfter : Infinity);
|
|
71
|
+
const cost = (c) => c.needs ?? Infinity;
|
|
72
|
+
captures.sort((a, b) => b.incomeGain / Math.max(1, cost(b)) - a.incomeGain / Math.max(1, cost(a)) ||
|
|
73
|
+
nearest(a) - nearest(b) ||
|
|
74
|
+
cost(a) - cost(b) ||
|
|
75
|
+
a.target - b.target);
|
|
76
|
+
const holds = [];
|
|
77
|
+
for (const t of [...mine].sort((a, b) => a - b)) {
|
|
78
|
+
const byPlayer = new Map();
|
|
79
|
+
for (const n of neighborsOf(g, t)) {
|
|
80
|
+
const o = ownerOf(state.get(n));
|
|
81
|
+
if (!foe(o))
|
|
82
|
+
continue;
|
|
83
|
+
byPlayer.set(o, (byPlayer.get(o) ?? 0) + Math.max(0, armies(n) - guard));
|
|
84
|
+
}
|
|
85
|
+
if (!byPlayer.size)
|
|
86
|
+
continue;
|
|
87
|
+
const have = armies(t);
|
|
88
|
+
const facing = [...byPlayer].sort((a, b) => a[0] - b[0]).map(([player, stacks]) => ({ player, stacks, deploy: Math.max(0, input.deployOf(player)) }));
|
|
89
|
+
/** Armies to add to `have` so `attack` attackers do not take it. */
|
|
90
|
+
const add = (attack) => {
|
|
91
|
+
let n = 0;
|
|
92
|
+
while ((take(have + n) ?? Infinity) <= attack)
|
|
93
|
+
n++;
|
|
94
|
+
return n;
|
|
95
|
+
};
|
|
96
|
+
const stacks = Math.max(...facing.map((f) => f.stacks));
|
|
97
|
+
const deployed = Math.max(...facing.map((f) => f.stacks + f.deploy));
|
|
98
|
+
const protects = (bonusesOf.get(t) ?? [])
|
|
99
|
+
.map((id) => g.bonusById.get(id))
|
|
100
|
+
.filter((b) => b.value > 0 && bonusTerritories(g, b.id).every((x) => mine.has(x)))
|
|
101
|
+
.map((b) => ({ bonusId: b.id, value: b.value }));
|
|
102
|
+
holds.push({ territoryId: t, armies: have, facing, addAgainstStacks: add(stacks), addAgainstDeploy: add(deployed), protects });
|
|
103
|
+
}
|
|
104
|
+
const worth = (h) => h.protects.reduce((n, p) => n + p.value, 0);
|
|
105
|
+
holds.sort((a, b) => worth(b) - worth(a) || b.addAgainstDeploy - a.addAgainstDeploy || a.territoryId - b.territoryId);
|
|
106
|
+
return { captures: captures.slice(0, limit), holds: holds.slice(0, limit) };
|
|
107
|
+
}
|
|
108
|
+
/** The other goals an alternative plan is made under. */
|
|
109
|
+
export const ALTERNATIVE_GOALS = ['expand', 'defend'];
|
|
110
|
+
/**
|
|
111
|
+
* The default plan and the planner under {@link ALTERNATIVE_GOALS} (each a goal the default did not pick), each with
|
|
112
|
+
* its orders, what it expects and (`stress` given) its stress summary. A plan whose orders match one already listed
|
|
113
|
+
* is left out.
|
|
114
|
+
*/
|
|
115
|
+
export function alternativePlans(input, base, stress) {
|
|
116
|
+
const view = (name, p) => {
|
|
117
|
+
const s = stress?.(p);
|
|
118
|
+
return {
|
|
119
|
+
name,
|
|
120
|
+
goal: p.goal,
|
|
121
|
+
deploys: p.deploys.map((d) => ({ territoryId: d.territoryId, armies: d.armies })),
|
|
122
|
+
moves: p.moves.map((m) => ({ from: m.from, to: m.to, armies: m.armies, kind: m.kind })),
|
|
123
|
+
expected: {
|
|
124
|
+
nextIncome: p.expected.nextIncome,
|
|
125
|
+
captures: p.expected.captures,
|
|
126
|
+
bonusesCompleted: p.expected.bonusesCompleted,
|
|
127
|
+
...(p.expected.nextIncomeIfConcededFall !== undefined ? { nextIncomeIfConcededFall: p.expected.nextIncomeIfConcededFall } : {}),
|
|
128
|
+
},
|
|
129
|
+
conceded: p.conceded,
|
|
130
|
+
...(s ? { stress: s } : {}),
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
const key = (p) => JSON.stringify([p.deploys.map((d) => [d.territoryId, d.armies]), p.moves.map((m) => [m.from, m.to, m.armies])]);
|
|
134
|
+
const out = [view('default', base)];
|
|
135
|
+
const keys = new Set([key(base)]);
|
|
136
|
+
for (const goal of ALTERNATIVE_GOALS) {
|
|
137
|
+
if (goal === base.goal)
|
|
138
|
+
continue;
|
|
139
|
+
const p = planTurn({ ...input, options: { ...input.options, goal } });
|
|
140
|
+
if (keys.has(key(p)))
|
|
141
|
+
continue;
|
|
142
|
+
keys.add(key(p));
|
|
143
|
+
out.push(view(goal, p));
|
|
144
|
+
}
|
|
145
|
+
return out;
|
|
146
|
+
}
|
|
147
|
+
/** A stress report boiled down to what a choice between plans needs. */
|
|
148
|
+
export function stressSummary(r) {
|
|
149
|
+
return {
|
|
150
|
+
safe: r.considered === 0 ? null : r.harmful === 0,
|
|
151
|
+
harmful: r.harmful,
|
|
152
|
+
considered: r.considered,
|
|
153
|
+
...(r.worst
|
|
154
|
+
? { worst: { opponent: r.worst.opponent, lost: r.worst.lost, capturesFailed: r.worst.capturesFailed, incomeLost: r.worst.incomeLost } }
|
|
155
|
+
: {}),
|
|
156
|
+
};
|
|
157
|
+
}
|
|
@@ -256,7 +256,14 @@ export function captureHelper(pc, ps, pass, book, threats, hd, tgt, prev) {
|
|
|
256
256
|
* taking one alone.
|
|
257
257
|
*/
|
|
258
258
|
const fundedOnConceded = new Set();
|
|
259
|
-
|
|
259
|
+
/**
|
|
260
|
+
* #593 follow-up (owner, 2026-11-27; the Kenya case): a break (`ps.breakTarget`) may attack out of a conceded border
|
|
261
|
+
* too, funded from this turn's deploy: the deploy is sized for the attack and leaves with it, so nothing is spent on
|
|
262
|
+
* the border's hold. Left out, a border conceded for its own sake beside an enemy bonus's member never deployed to
|
|
263
|
+
* break it. Never my commander's territory.
|
|
264
|
+
*/
|
|
265
|
+
const breakConceded = (x, t) => ps.breakTarget === t && conceded.has(x) && !myCommanders.has(x);
|
|
266
|
+
const concededSource = (x, t, cost) => concededSourceBase(x, t, cost) || leadConceded(x, t) || breakConceded(x, t);
|
|
260
267
|
/**
|
|
261
268
|
* #212: a lead step (#203) may attack out of a border held under `balanced` — locked so its armies
|
|
262
269
|
* stay put for its hold — when this turn's deploy covers the attack and the hold together. Left
|
|
@@ -509,6 +516,7 @@ export function captureHelper(pc, ps, pass, book, threats, hd, tgt, prev) {
|
|
|
509
516
|
const farBinds = far !== null && farKeep > 0 && farKeep >= keepOf(src, t);
|
|
510
517
|
// #214: judged on the state the source was opened under, before the attack spends it.
|
|
511
518
|
const viaLead = !fromHold && !force && need > 0 && src !== fromConceded && leadConceded(src, t) && !concededSourceBase(src, t, tg.cost);
|
|
519
|
+
const viaBreak = !viaLead && !fromHold && !force && need > 0 && src !== fromConceded && breakConceded(src, t) && !concededSourceBase(src, t, tg.cost);
|
|
512
520
|
deploy(src, need);
|
|
513
521
|
// No-Split: the whole stack goes, every army deployed there so far included (#124).
|
|
514
522
|
const sent = noSplit ? Math.max(tg.cost, avail.get(src)) : tg.cost;
|
|
@@ -547,6 +555,9 @@ export function captureHelper(pc, ps, pass, book, threats, hd, tgt, prev) {
|
|
|
547
555
|
fundedOnConceded.add(t);
|
|
548
556
|
rationale.push(`${label(src)} is conceded, but the deploy there leaves with the attack on ${label(t)}: a lead step into a bonus (rule 4f's order) may be funded on a conceded source, the deploy sized for the attack alone (#214).`);
|
|
549
557
|
}
|
|
558
|
+
else if (viaBreak) {
|
|
559
|
+
rationale.push(`${label(src)} is conceded, but the deploy there leaves with the attack on ${label(t)}: a break may be funded on a conceded source, the deploy sized for the attack alone (#593).`);
|
|
560
|
+
}
|
|
550
561
|
else if (farBinds)
|
|
551
562
|
rationale.push(twoStepCite(src, far, (c) => `The attack on ${label(t)} leaves ${label(src)} ${c}.`));
|
|
552
563
|
else if (forHold > 0) {
|
|
@@ -263,7 +263,7 @@ export function reportExpected(pc, ps, book, threats, hd, tgt, caps) {
|
|
|
263
263
|
}
|
|
264
264
|
/** The offence report (#72), the warnings that follow the deploys, and the "Not attacking" line (#167). */
|
|
265
265
|
export function reportOffence(pc, ps, book, threats, hd, tgt, holdLocked, leadSpareFor) {
|
|
266
|
-
const { g, foe, profile, auto, goal, territories: state, label, mine, mineSet, unitsAt, uncounted, uncountedKind, defenceAt, costAt, toTake, noSplit, leadLever, ffaLeader, leadText, myCommanders, } = pc;
|
|
266
|
+
const { g, foe, profile, auto, goal, territories: state, label, mine, mineSet, unitsAt, uncounted, uncountedKind, defenceAt, costAt, toTake, noSplit, leadLever, ffaLeader, leadText, myCommanders, guard, } = pc;
|
|
267
267
|
const { warnings, rationale, deployed, avail, spared, unabsorbed, captured, moves } = ps;
|
|
268
268
|
const { gainWith, orderOf, pools, coverOf } = book;
|
|
269
269
|
// As the deploy book reads it (Local Deployment).
|
|
@@ -448,6 +448,26 @@ export function reportOffence(pc, ps, book, threats, hd, tgt, holdLocked, leadSp
|
|
|
448
448
|
const st = state.get(n);
|
|
449
449
|
return !mineSet.has(n) && !attacked.has(n) && st?.owner.kind === 'player' && foe(st.owner.playerId) && st.armies !== null;
|
|
450
450
|
});
|
|
451
|
+
/**
|
|
452
|
+
* #593 5c: what its owner's stacks beside `n` can move in before an attack lands (each less its
|
|
453
|
+
* guard), and what taking it costs then: a cheap-looking territory beside a big stack is bait.
|
|
454
|
+
*/
|
|
455
|
+
const baitNote = (n) => {
|
|
456
|
+
const owner = state.get(n).owner;
|
|
457
|
+
const stacks = neighborsOf(g, n)
|
|
458
|
+
.flatMap((x) => {
|
|
459
|
+
const st = state.get(x);
|
|
460
|
+
return st && st.armies !== null && st.owner.kind === 'player' && owner.kind === 'player' && st.owner.playerId === owner.playerId && st.armies > guard
|
|
461
|
+
? [{ x, moves: st.armies - guard }]
|
|
462
|
+
: [];
|
|
463
|
+
})
|
|
464
|
+
.sort((a, b) => b.moves - a.moves || a.x - b.x);
|
|
465
|
+
if (!stacks.length)
|
|
466
|
+
return '';
|
|
467
|
+
const k = stacks.reduce((t, s) => t + s.moves, 0);
|
|
468
|
+
const then = costAt(n, defenceAt(n) + k);
|
|
469
|
+
return `; its stacks beside it can move ${k} in before an attack lands (${stacks.map((s) => `${label(s.x)} ${s.moves}`).join(', ')}): ${then === null ? 'no attack takes it then' : `${then} to take it then`} (#593)`;
|
|
470
|
+
};
|
|
451
471
|
const reasonFor = (n) => {
|
|
452
472
|
const st = state.get(n);
|
|
453
473
|
const p = st.owner.playerId;
|
|
@@ -528,14 +548,14 @@ export function reportOffence(pc, ps, book, threats, hd, tgt, holdLocked, leadSp
|
|
|
528
548
|
}
|
|
529
549
|
// #593: a member of a bonus probably held behind the fog is a break candidate that was not funded.
|
|
530
550
|
if (tgt.foggedMember.has(n))
|
|
531
|
-
return `${label(best.x)} could spare ${best.spare} for it, and it probably breaks a bonus behind the fog (#593), but that break, sized for a partial deploy, did not fit or ranked below what the turn funded`;
|
|
551
|
+
return `${label(best.x)} could spare ${best.spare} for it, and it probably breaks a bonus behind the fog (#593), but that break, sized for a partial deploy, did not fit or ranked below what the turn funded${baitNote(n)}`;
|
|
532
552
|
return `${label(best.x)} could spare ${best.spare} for it, but it breaks no bonus and is no counter-attack, finishing blow or strike — the only reasons the plan attacks a player's territory (rule 2), besides rule 4e's fallback when nothing else is captured${!ffaLead
|
|
533
553
|
? ''
|
|
534
554
|
: !leadLever
|
|
535
555
|
? ` (a lead strike takes one only with an army lead over ${SECOND_FRONT_LEAD}×; mine is ${leadText()})`
|
|
536
556
|
: noSplit
|
|
537
557
|
? ` (no lead strike under No-Split: an order carries the whole stack)`
|
|
538
|
-
: ''}`;
|
|
558
|
+
: ''}${baitNote(n)}`;
|
|
539
559
|
};
|
|
540
560
|
/** #253: why rule 4h, the army cap's spend of idle armies, did not take it either. */
|
|
541
561
|
const capNote = (n) => {
|
package/dist/analysis/planner.js
CHANGED
|
@@ -2351,6 +2351,16 @@ function planPass(input, pass) {
|
|
|
2351
2351
|
});
|
|
2352
2352
|
return true;
|
|
2353
2353
|
};
|
|
2354
|
+
/** #593 follow-up: run a break's capture with `t` marked as a break, so a conceded border beside it may fund it. */
|
|
2355
|
+
const asBreak = (t, f) => {
|
|
2356
|
+
ps.breakTarget = t;
|
|
2357
|
+
try {
|
|
2358
|
+
return f();
|
|
2359
|
+
}
|
|
2360
|
+
finally {
|
|
2361
|
+
ps.breakTarget = undefined;
|
|
2362
|
+
}
|
|
2363
|
+
};
|
|
2354
2364
|
/** The member a break of `b` takes: its cheapest visible member (#72: a break only has to land), then the least frontier, then id. */
|
|
2355
2365
|
const breakOptionOf = (b) => bonusTerritories(g, b.bonusId)
|
|
2356
2366
|
.filter((t) => targets.has(t))
|
|
@@ -2432,7 +2442,7 @@ function planPass(input, pass) {
|
|
|
2432
2442
|
const was = worstCase.get(o.t);
|
|
2433
2443
|
targets.set(o.t, { ...tg, cost: o.cost });
|
|
2434
2444
|
worstCase.set(o.t, defenceAt(o.t) + reinforcementAt(o.t));
|
|
2435
|
-
if (!tryCapture(o.t, reasonOf(`${breakReason(b)}, sized to land against player ${b.player}'s ~${reinforcementAt(o.t)} deploy (#201: I lead this free-for-all)`))) {
|
|
2445
|
+
if (!asBreak(o.t, () => tryCapture(o.t, reasonOf(`${breakReason(b)}, sized to land against player ${b.player}'s ~${reinforcementAt(o.t)} deploy (#201: I lead this free-for-all)`)))) {
|
|
2436
2446
|
targets.set(o.t, tg);
|
|
2437
2447
|
if (was === undefined)
|
|
2438
2448
|
worstCase.delete(o.t);
|
|
@@ -2441,7 +2451,7 @@ function planPass(input, pass) {
|
|
|
2441
2451
|
return;
|
|
2442
2452
|
}
|
|
2443
2453
|
}
|
|
2444
|
-
else if (!tryCapture(o.t, reasonOf(breakReason(b))))
|
|
2454
|
+
else if (!asBreak(o.t, () => tryCapture(o.t, reasonOf(breakReason(b)))))
|
|
2445
2455
|
return;
|
|
2446
2456
|
ps.anchor ??= moves[moves.length - 1].from;
|
|
2447
2457
|
warnRetake(b, o);
|
|
@@ -2503,7 +2513,7 @@ function planPass(input, pass) {
|
|
|
2503
2513
|
if (raised)
|
|
2504
2514
|
targets.set(o.t, { ...tg, cost: o.cost });
|
|
2505
2515
|
worstCase.set(o.t, Math.max(was ?? 0, defenceAt(o.t) + partial));
|
|
2506
|
-
const ok = tryCapture(o.t, reason);
|
|
2516
|
+
const ok = asBreak(o.t, () => tryCapture(o.t, reason));
|
|
2507
2517
|
if (raised)
|
|
2508
2518
|
targets.set(o.t, tg);
|
|
2509
2519
|
if (!ok) {
|
|
@@ -2803,7 +2813,9 @@ function planPass(input, pass) {
|
|
|
2803
2813
|
const left = expansionLeft;
|
|
2804
2814
|
c.run();
|
|
2805
2815
|
const after = new Set(fundable(pending, ps.budget));
|
|
2806
|
-
|
|
2816
|
+
// #602: a unit that pays only for its hub share and is already floored stays floored either way (it is never
|
|
2817
|
+
// conceded); it cannot be starved, so it never holds a completion back (owner, 2026-11-27).
|
|
2818
|
+
const starved = before.filter((u) => !after.has(u) && !(u.hubOnly && u.floored));
|
|
2807
2819
|
const lost = starved.reduce((n, u) => n + u.value, 0);
|
|
2808
2820
|
// #122: a starved unit that cannot even be kept short (near miss, floor) is conceded. Waiting
|
|
2809
2821
|
// costs the completion one turn of its value; conceding a held bonus loses its value every
|