@chrischall/warapp-mcp 0.21.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.
@@ -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.21.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.21.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.21.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
@@ -154,14 +154,14 @@ Locally `WARAPP_AUTH_TOKEN` is ignored.
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
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 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. |
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. |
@@ -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
- const concededSource = (x, t, cost) => concededSourceBase(x, t, cost) || leadConceded(x, t);
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) => {
@@ -44,6 +44,7 @@ export function newPlanState() {
44
44
  staged: new Map(),
45
45
  anchor: undefined,
46
46
  assumeGone: () => false,
47
+ breakTarget: undefined,
47
48
  refusal: undefined,
48
49
  evenTradesOnly: false,
49
50
  plainRepulsed: false,
@@ -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
- const starved = before.filter((u) => !after.has(u));
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
@@ -10,6 +10,11 @@
10
10
  // attack deploy on one stack next to a territory I hold (or will hold after my own
11
11
  // orders) and attack it with everything that stack can move, its commander too;
12
12
  // reinforce deploy on a territory my plan attacks and sit still;
13
+ // gather (#593 5c) deploy on a territory my plan attacks and move every stack of its own
14
+ // beside it in first (all each can move, its commander left behind): the bait a
15
+ // lightly held territory beside a big stack is. Tried when one of those stacks can
16
+ // move, with it moving first only and never when I am known to move first, as a dodge
17
+ // is (moving second, its stacks strike what I took: the attack reply covers that);
13
18
  // all-attack every stack with a target attacks at once, the deploy on the largest: once
14
19
  // spread (each stack takes the most valuable target no other has taken) and once
15
20
  // concentrated (each takes its most valuable target). Tried when two or more
@@ -249,6 +254,15 @@ export function stressPlan(input) {
249
254
  const dep = deployOn(opp, s);
250
255
  if (myTargets.has(s) && dep > 0)
251
256
  candidates.push({ player: opp.id, kind: 'reinforce', deployTo: s, deploy: dep, orders: [] });
257
+ // #593 5c: its stacks beside the target move in first, largest first.
258
+ if (myTargets.has(s) && input.firstMover !== 'me') {
259
+ const beside = neighborsOf(graph, s)
260
+ .filter((n) => start.get(n)?.owner === opp.id && (start.get(n)?.armies ?? 0) > guard)
261
+ .sort((a, b) => (start.get(b)?.armies ?? 0) - (start.get(a)?.armies ?? 0) || a - b);
262
+ if (beside.length) {
263
+ candidates.push({ player: opp.id, kind: 'gather', deployTo: s, deploy: dep, orders: beside.map((n) => ({ from: n, to: s, armies: allOf(n, 0) })) });
264
+ }
265
+ }
252
266
  }
253
267
  if (reach.size >= 2) {
254
268
  const bySize = [...reach.keys()].sort((a, b) => (start.get(b)?.armies ?? 0) - (start.get(a)?.armies ?? 0) || a - b);
@@ -412,6 +426,11 @@ export function stressPlan(input) {
412
426
  deployTo: c.deployTo,
413
427
  deploy: c.deploy,
414
428
  ...(single ? { from: c.orders[0].from, to: c.orders[0].to, armies: sent ?? 0 } : {}),
429
+ ...(c.kind === 'gather'
430
+ ? {
431
+ movedIn: c.orders.map((o, i) => ({ from: o.from, armies: r.log.find((e) => e.player === c.player && e.index === i)?.sent ?? 0 })),
432
+ }
433
+ : {}),
415
434
  ...(c.kind === 'all-attack' || c.kind === 'joint' ? { attacks: sides.flatMap((x) => x.orders.map((o) => ({ from: o.from, to: o.to }))) } : {}),
416
435
  ...(c.partner ? { partner: c.partner.player, partnerDeployTo: c.partner.deployTo, partnerDeploy: c.partner.deploy } : {}),
417
436
  ...(run.firstOpponent !== undefined ? { firstOpponent: run.firstOpponent } : {}),
@@ -433,7 +452,7 @@ export function stressPlan(input) {
433
452
  /** Two outcomes are the same when they cost me the same things. */
434
453
  const signature = (x) => JSON.stringify({ ...x, firstMover: undefined, firstOpponent: undefined });
435
454
  const runsFor = (c) => {
436
- const firsts = c.kind === 'dodge' ? ['opponent'] : input.firstMover !== undefined ? [input.firstMover] : ['me', 'opponent'];
455
+ const firsts = c.kind === 'dodge' || c.kind === 'gather' ? ['opponent'] : input.firstMover !== undefined ? [input.firstMover] : ['me', 'opponent'];
437
456
  if (!c.partner)
438
457
  return firsts.map((f) => ({ firstMover: f, moveOrder: f === 'me' ? [me, c.player] : [c.player, me] }));
439
458
  const pair = [c.player, c.partner.player];
package/dist/bundle.js CHANGED
@@ -101781,6 +101781,7 @@ function newPlanState() {
101781
101781
  staged: /* @__PURE__ */ new Map(),
101782
101782
  anchor: void 0,
101783
101783
  assumeGone: () => false,
101784
+ breakTarget: void 0,
101784
101785
  refusal: void 0,
101785
101786
  evenTradesOnly: false,
101786
101787
  plainRepulsed: false,
@@ -107136,7 +107137,8 @@ function captureHelper(pc, ps, pass, book, threats, hd, tgt, prev) {
107136
107137
  });
107137
107138
  const leadConceded = (x, t) => leadSteps.has(t) && conceded.has(x) && !myCommanders.has(x);
107138
107139
  const fundedOnConceded = /* @__PURE__ */ new Set();
107139
- const concededSource = (x, t, cost) => concededSourceBase(x, t, cost) || leadConceded(x, t);
107140
+ const breakConceded = (x, t) => ps.breakTarget === t && conceded.has(x) && !myCommanders.has(x);
107141
+ const concededSource = (x, t, cost) => concededSourceBase(x, t, cost) || leadConceded(x, t) || breakConceded(x, t);
107140
107142
  const holdSource = (x, t) => leadSteps.has(t) && locked.has(x) && !conceded.has(x) && !myCommanders.has(x);
107141
107143
  const holdKeep = (x, t) => {
107142
107144
  const b = borderAt(x, (n) => captured.has(n) || n === t);
@@ -107266,6 +107268,7 @@ function captureHelper(pc, ps, pass, book, threats, hd, tgt, prev) {
107266
107268
  const farKeep = far ? twoStepKeep(src, (n) => n === t) : 0;
107267
107269
  const farBinds = far !== null && farKeep > 0 && farKeep >= keepOf(src, t);
107268
107270
  const viaLead = !fromHold && !force && need2 > 0 && src !== fromConceded && leadConceded(src, t) && !concededSourceBase(src, t, tg.cost);
107271
+ const viaBreak = !viaLead && !fromHold && !force && need2 > 0 && src !== fromConceded && breakConceded(src, t) && !concededSourceBase(src, t, tg.cost);
107269
107272
  deploy(src, need2);
107270
107273
  const sent = noSplit ? Math.max(tg.cost, avail.get(src)) : tg.cost;
107271
107274
  avail.set(src, avail.get(src) - sent);
@@ -107302,6 +107305,10 @@ function captureHelper(pc, ps, pass, book, threats, hd, tgt, prev) {
107302
107305
  rationale.push(
107303
107306
  `${label3(src)} is conceded, but the deploy there leaves with the attack on ${label3(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).`
107304
107307
  );
107308
+ } else if (viaBreak) {
107309
+ rationale.push(
107310
+ `${label3(src)} is conceded, but the deploy there leaves with the attack on ${label3(t)}: a break may be funded on a conceded source, the deploy sized for the attack alone (#593).`
107311
+ );
107305
107312
  } else if (farBinds) rationale.push(twoStepCite(src, far, (c) => `The attack on ${label3(t)} leaves ${label3(src)} ${c}.`));
107306
107313
  else if (forHold > 0) {
107307
107314
  const th = borderAt(src, (n) => captured.has(n));
@@ -111839,7 +111846,8 @@ function reportOffence(pc, ps, book, threats, hd, tgt, holdLocked, leadSpareFor)
111839
111846
  leadLever,
111840
111847
  ffaLeader,
111841
111848
  leadText,
111842
- myCommanders
111849
+ myCommanders,
111850
+ guard
111843
111851
  } = pc;
111844
111852
  const { warnings, rationale, deployed, avail, spared, unabsorbed, captured, moves } = ps;
111845
111853
  const { gainWith, orderOf, pools, coverOf } = book;
@@ -111952,6 +111960,17 @@ function reportOffence(pc, ps, book, threats, hd, tgt, holdLocked, leadSpareFor)
111952
111960
  const st = state.get(n);
111953
111961
  return !mineSet.has(n) && !attacked.has(n) && st?.owner.kind === "player" && foe(st.owner.playerId) && st.armies !== null;
111954
111962
  });
111963
+ const baitNote = (n) => {
111964
+ const owner = state.get(n).owner;
111965
+ const stacks = neighborsOf(g, n).flatMap((x) => {
111966
+ const st = state.get(x);
111967
+ return st && st.armies !== null && st.owner.kind === "player" && owner.kind === "player" && st.owner.playerId === owner.playerId && st.armies > guard ? [{ x, moves: st.armies - guard }] : [];
111968
+ }).sort((a, b) => b.moves - a.moves || a.x - b.x);
111969
+ if (!stacks.length) return "";
111970
+ const k = stacks.reduce((t, s) => t + s.moves, 0);
111971
+ const then = costAt(n, defenceAt(n) + k);
111972
+ return `; its stacks beside it can move ${k} in before an attack lands (${stacks.map((s) => `${label3(s.x)} ${s.moves}`).join(", ")}): ${then === null ? "no attack takes it then" : `${then} to take it then`} (#593)`;
111973
+ };
111955
111974
  const reasonFor = (n) => {
111956
111975
  const st = state.get(n);
111957
111976
  const p = st.owner.playerId;
@@ -111986,8 +112005,8 @@ function reportOffence(pc, ps, book, threats, hd, tgt, holdLocked, leadSpareFor)
111986
112005
  return `a lead strike (my army lead is ${leadText()}, over ${SECOND_FRONT_LEAD}\xD7) needs ${sure} \u2014 sized for its ${defenceAt(n)} defenders plus player ${p}'s ~${extra} deploy \u2014 and the most a neighbour of mine can spare for it is ${lead.spare}${lead.spare > 0 ? ` (${label3(lead.x)})` : ""}${deployText}`;
111987
112006
  }
111988
112007
  if (tgt.foggedMember.has(n))
111989
- return `${label3(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`;
111990
- return `${label3(best.x)} could spare ${best.spare} for it, but it breaks no bonus and is no counter-attack, finishing blow or strike \u2014 the only reasons the plan attacks a player's territory (rule 2), besides rule 4e's fallback when nothing else is captured${!ffaLead ? "" : !leadLever ? ` (a lead strike takes one only with an army lead over ${SECOND_FRONT_LEAD}\xD7; mine is ${leadText()})` : noSplit ? ` (no lead strike under No-Split: an order carries the whole stack)` : ""}`;
112008
+ return `${label3(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)}`;
112009
+ return `${label3(best.x)} could spare ${best.spare} for it, but it breaks no bonus and is no counter-attack, finishing blow or strike \u2014 the only reasons the plan attacks a player's territory (rule 2), besides rule 4e's fallback when nothing else is captured${!ffaLead ? "" : !leadLever ? ` (a lead strike takes one only with an army lead over ${SECOND_FRONT_LEAD}\xD7; mine is ${leadText()})` : noSplit ? ` (no lead strike under No-Split: an order carries the whole stack)` : ""}${baitNote(n)}`;
111991
112010
  };
111992
112011
  const capNote = (n) => {
111993
112012
  const why = ps.capRefused.get(n);
@@ -112716,6 +112735,14 @@ function planPass(input2, pass) {
112716
112735
  });
112717
112736
  return true;
112718
112737
  };
112738
+ const asBreak = (t, f) => {
112739
+ ps.breakTarget = t;
112740
+ try {
112741
+ return f();
112742
+ } finally {
112743
+ ps.breakTarget = void 0;
112744
+ }
112745
+ };
112719
112746
  const breakOptionOf = (b) => bonusTerritories(g, b.bonusId).filter((t) => targets.has(t)).map((t) => breakOption(t)).sort((a, b2) => a.cost - b2.cost || a.scoreCost - b2.scoreCost || a.t - b2.t)[0];
112720
112747
  const pileBreak = (() => {
112721
112748
  if (!pc.pile) return void 0;
@@ -112774,13 +112801,13 @@ function planPass(input2, pass) {
112774
112801
  const was = worstCase.get(o.t);
112775
112802
  targets.set(o.t, { ...tg, cost: o.cost });
112776
112803
  worstCase.set(o.t, defenceAt(o.t) + reinforcementAt(o.t));
112777
- if (!tryCapture(o.t, reasonOf2(`${breakReason(b)}, sized to land against player ${b.player}'s ~${reinforcementAt(o.t)} deploy (#201: I lead this free-for-all)`))) {
112804
+ if (!asBreak(o.t, () => tryCapture(o.t, reasonOf2(`${breakReason(b)}, sized to land against player ${b.player}'s ~${reinforcementAt(o.t)} deploy (#201: I lead this free-for-all)`)))) {
112778
112805
  targets.set(o.t, tg);
112779
112806
  if (was === void 0) worstCase.delete(o.t);
112780
112807
  else worstCase.set(o.t, was);
112781
112808
  return;
112782
112809
  }
112783
- } else if (!tryCapture(o.t, reasonOf2(breakReason(b)))) return;
112810
+ } else if (!asBreak(o.t, () => tryCapture(o.t, reasonOf2(breakReason(b))))) return;
112784
112811
  ps.anchor ??= moves[moves.length - 1].from;
112785
112812
  warnRetake(b, o);
112786
112813
  })
@@ -112824,7 +112851,7 @@ function planPass(input2, pass) {
112824
112851
  const was = worstCase.get(o.t);
112825
112852
  if (raised) targets.set(o.t, { ...tg, cost: o.cost });
112826
112853
  worstCase.set(o.t, Math.max(was ?? 0, defenceAt(o.t) + partial2));
112827
- const ok = tryCapture(o.t, reason);
112854
+ const ok = asBreak(o.t, () => tryCapture(o.t, reason));
112828
112855
  if (raised) targets.set(o.t, tg);
112829
112856
  if (!ok) {
112830
112857
  if (was === void 0) worstCase.delete(o.t);
@@ -113058,7 +113085,7 @@ function planPass(input2, pass) {
113058
113085
  const left = expansionLeft;
113059
113086
  c.run();
113060
113087
  const after2 = new Set(fundable(pending, ps.budget));
113061
- const starved = before.filter((u) => !after2.has(u));
113088
+ const starved = before.filter((u) => !after2.has(u) && !(u.hubOnly && u.floored));
113062
113089
  const lost = starved.reduce((n, u) => n + u.value, 0);
113063
113090
  const kept2 = starved.map((u) => keptShort(u, local ? Math.min(ps.budget, leftFor(u)) : ps.budget));
113064
113091
  const conceding = starved.filter((_, i2) => !kept2[i2]).reduce((n, u) => n + u.value, 0);
@@ -116117,7 +116144,7 @@ function serverBuild() {
116117
116144
  }
116118
116145
 
116119
116146
  // src/version.ts
116120
- var VERSION2 = "0.21.0";
116147
+ var VERSION2 = "0.22.0";
116121
116148
 
116122
116149
  // src/decision-log.ts
116123
116150
  var DECISION_LOG_VERSION = 1;
@@ -148732,6 +148759,12 @@ function stressPlan(input2) {
148732
148759
  for (const s of stacks) {
148733
148760
  const dep = deployOn(opp, s);
148734
148761
  if (myTargets.has(s) && dep > 0) candidates2.push({ player: opp.id, kind: "reinforce", deployTo: s, deploy: dep, orders: [] });
148762
+ if (myTargets.has(s) && input2.firstMover !== "me") {
148763
+ const beside = neighborsOf(graph, s).filter((n) => start.get(n)?.owner === opp.id && (start.get(n)?.armies ?? 0) > guard).sort((a, b) => (start.get(b)?.armies ?? 0) - (start.get(a)?.armies ?? 0) || a - b);
148764
+ if (beside.length) {
148765
+ candidates2.push({ player: opp.id, kind: "gather", deployTo: s, deploy: dep, orders: beside.map((n) => ({ from: n, to: s, armies: allOf(n, 0) })) });
148766
+ }
148767
+ }
148735
148768
  }
148736
148769
  if (reach.size >= 2) {
148737
148770
  const bySize = [...reach.keys()].sort((a, b) => (start.get(b)?.armies ?? 0) - (start.get(a)?.armies ?? 0) || a - b);
@@ -148861,6 +148894,9 @@ function stressPlan(input2) {
148861
148894
  deployTo: c.deployTo,
148862
148895
  deploy: c.deploy,
148863
148896
  ...single ? { from: c.orders[0].from, to: c.orders[0].to, armies: sent ?? 0 } : {},
148897
+ ...c.kind === "gather" ? {
148898
+ movedIn: c.orders.map((o, i2) => ({ from: o.from, armies: r.log.find((e) => e.player === c.player && e.index === i2)?.sent ?? 0 }))
148899
+ } : {},
148864
148900
  ...c.kind === "all-attack" || c.kind === "joint" ? { attacks: sides.flatMap((x) => x.orders.map((o) => ({ from: o.from, to: o.to }))) } : {},
148865
148901
  ...c.partner ? { partner: c.partner.player, partnerDeployTo: c.partner.deployTo, partnerDeploy: c.partner.deploy } : {},
148866
148902
  ...run2.firstOpponent !== void 0 ? { firstOpponent: run2.firstOpponent } : {},
@@ -148881,7 +148917,7 @@ function stressPlan(input2) {
148881
148917
  };
148882
148918
  const signature = (x) => JSON.stringify({ ...x, firstMover: void 0, firstOpponent: void 0 });
148883
148919
  const runsFor = (c) => {
148884
- const firsts = c.kind === "dodge" ? ["opponent"] : input2.firstMover !== void 0 ? [input2.firstMover] : ["me", "opponent"];
148920
+ const firsts = c.kind === "dodge" || c.kind === "gather" ? ["opponent"] : input2.firstMover !== void 0 ? [input2.firstMover] : ["me", "opponent"];
148885
148921
  if (!c.partner) return firsts.map((f) => ({ firstMover: f, moveOrder: f === "me" ? [me, c.player] : [c.player, me] }));
148886
148922
  const pair2 = [c.player, c.partner.player];
148887
148923
  return firsts.flatMap(
@@ -149481,6 +149517,43 @@ var OWN_PLAN_STEPS = [
149481
149517
  "Submit with warapp_submit_turn; when your orders differ from the plan, pass override_reason so the decision log keeps why."
149482
149518
  ];
149483
149519
 
149520
+ // src/tools/bait.ts
149521
+ function baitAttackWarning(input2) {
149522
+ const { graph, board, me, settings, label: label3, name } = input2;
149523
+ const teammates = input2.teammates ?? /* @__PURE__ */ new Set();
149524
+ const standing = new Map(board.map((t) => [t.territoryId, t]));
149525
+ const guard = settings.oneArmyStandsGuard === false ? 0 : 1;
149526
+ const rates = {
149527
+ ...settings.offensiveKillRate !== void 0 ? { offensiveKillRate: settings.offensiveKillRate } : {},
149528
+ ...settings.defensiveKillRate !== void 0 ? { defensiveKillRate: settings.defensiveKillRate } : {}
149529
+ };
149530
+ const byTarget = /* @__PURE__ */ new Map();
149531
+ for (const m of input2.moves) {
149532
+ const t = standing.get(m.to.id);
149533
+ if (m.mode === "transfer-only" || !t || t.fogged || t.owner === me || t.owner < 0) continue;
149534
+ if (teammates.has(t.owner) && m.attackTeammates !== true) continue;
149535
+ const power = m.armies + (m.commander ? COMMANDER_STRENGTH : 0);
149536
+ const g = byTarget.get(m.to.id);
149537
+ if (g) g.armies += power;
149538
+ else byTarget.set(m.to.id, { from: m.from, to: m.to, armies: power });
149539
+ }
149540
+ const parts = [];
149541
+ for (const [id, a] of byTarget) {
149542
+ const target = standing.get(id);
149543
+ const owner = target.owner;
149544
+ const stacks = neighborsOf(graph, id).map((n) => standing.get(n)).filter((s) => s !== void 0 && !s.fogged && s.owner === owner && (s.armies ?? 0) > guard).map((s) => ({ id: s.territoryId, moves: (s.armies ?? 0) - guard })).sort((x, y) => y.moves - x.moves || x.id - y.id);
149545
+ if (!stacks.length) continue;
149546
+ const defenders2 = (target.armies ?? 0) + specialUnitStrength(target.specialUnits) + stacks.reduce((n, s) => n + s.moves, 0);
149547
+ const needs = armiesToTake(defenders2, rates);
149548
+ if (needs !== null && a.armies >= needs) continue;
149549
+ parts.push(
149550
+ `${label3(a.from)} \u2192 ${label3(a.to)} with ${a.armies}: player ${owner}'s stacks beside it can move in first (${stacks.map((s) => `${label3(name(s.id))} ${s.moves}`).join(", ")}), ${defenders2} defenders before any deploy, which ${needs === null ? "no attack can take" : `needs ${needs}`}`
149551
+ );
149552
+ }
149553
+ if (!parts.length) return void 0;
149554
+ return `Possible bait (#593): ${parts.join("; ")}. That happens when it moves first, or when its moves run before the attack in the zigzag. warapp_check_plan tries it with its deploy too (the \`gather\` reply).`;
149555
+ }
149556
+
149484
149557
  // src/analysis/chat-advice.ts
149485
149558
  var CLOSE_RATIO = 0.85;
149486
149559
  var CLEAR_LEAD_RATIO = 1.2;
@@ -157079,6 +157152,17 @@ function registerTurnTools(server, ctx, opts = {}) {
157079
157152
  );
157080
157153
  const hopeless = hopelessAttackWarning(attacks, label2);
157081
157154
  if (hopeless) warnings.push(hopeless);
157155
+ const bait = baitAttackWarning({
157156
+ graph: graphOf(map2),
157157
+ board: territories,
157158
+ me: playerId,
157159
+ moves: moves.map((m, i2) => ({ ...m, armies: m.percent ? options.estimates.get(i2) ?? 0 : m.armies })),
157160
+ settings: plannerSettings(game.settings),
157161
+ label: label2,
157162
+ name: (id) => ({ id, name: map2.territories.find((t) => t.id === id)?.name ?? String(id) }),
157163
+ teammates
157164
+ });
157165
+ if (bait) warnings.push(bait);
157082
157166
  const subTeams = teamsOf(game.players);
157083
157167
  const givenDeploys = deploys.map((d) => ({ territoryId: d.territory.id, armies: d.armies }));
157084
157168
  const givenMoves = moves.map((m, i2) => ({
@@ -160720,7 +160804,7 @@ function registerCheckPlanTool(server, ctx) {
160720
160804
  {
160721
160805
  title: "Stress-test a planned turn in a war.app game",
160722
160806
  description: untrustedDescription(
160723
- `Stress-test a list of orders for your turn in an in-progress war.app (Warzone) game before you submit it (in a game of more than 16 opponents, \`unseenOpponents\` lists only those near your land \u2014 \`unseenOpponentsMore\` counts the rest \u2014 and \`scale\` sums the opponents not in view or within 2 steps of your land): the orders (the \`orders\` array warapp_plan_turn returns, or your own edit of it) are carried out on the live board, turn rules included (deploys first, then attacks and transfers interleaved in the zigzag move order; each order an attack or a transfer by who holds its target when it runs; kill rates, the guard army, each army moving once, commanders), against the replies each opponent could make with ONE deploy: its whole estimated deploy on one stack and an attack on a territory you hold or are about to take, its whole deploy on a territory you attack, or every stack attacking at once; a stack you attack moving out first (a dodge: into its own territory, or a neutral or one of yours it can take \u2014 \`dodges\` lists each with the armies that got away and what your strike then hit); two opponents striking one of your territories together (teammates always; any two in a free-for-all when you lead \u2014 \`jointFalls\` gives the armies each such territory needs to hold); and, under Multi-Attack, each stack's most damaging chain of captures. Under Local Deployment each deploy is bounded by where its bonus armies may land. Each reply is tried with you moving first and with the opponent moving first unless \`first_mover\` says which. A reply that keeps alive a player your orders finish off is \`eliminationsFailed\`. Returns \`safe\` (true, false, or null when no reply could be tried), a one-line \`summary\`, the \`worst\` reply and \`otherReplies\` that cost you something (territories \`lost\`, captures that fail or are \`retaken\`, bonuses and income lost, your commander), everything \`atRisk\` to some single reply (only one of them happens: one deploy, one place), what your orders do unanswered (\`plan\`: captures, attacks that fail, orders that send fewer armies than ordered or none), \`blindBorders\`: your territories next to the fog, where nothing could be tested, and \`exposedNextTurn\`: territories no enemy stack touches today that one could take next turn by first taking the territory in between (yours or neutral), each with the armies it would need to hold, if you add nothing next turn. Decide on the fields (\`safe\`, \`worst\`, \`exposedNextTurn\`), not on the wording of \`summary\`, which may change. With your commander on the board, \`commander\` says where it stands after the orders, the armies there and \`needs\`: the armies its territory needs to survive every reply tried, by the check warapp_submit_turn refuses on (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. \`commander.fogged\` tests it against \`fogged_attackers\` (default as warapp_plan_turn: 2 in a Commanders free-for-all of eight or more players under fog, else off) unknown opponents the fog may hide within two moves of where it ends, striking together (each a start of the game's starting armies, else your largest stack, plus a deploy of your income; luck-free): \`safe\`, \`needs\`, where they may come from; the summary names it when it can fall, and it never changes \`safe\`. Exact with no luck and straight rounding; otherwise battles are resolved at their expectation and \`exact\` is false. It does not try: ${CHECK_PLAN_NOT_COVERED.join("; ")}. When this server kept your pick list, \`award\` says what the award of picks showed (as in warapp_plan_turn): the opponent's proven starts stand on the board the orders are tried on even while fogged, and \`award.firstMover\` is who moves first this turn under a \`Cycle\` move order (not NoLuckCycle, where play speed sets it) \u2014 pass it as \`first_mover\` to judge by it; both orders are still tried by default. \`headroom\` lists, weakest first, each border of yours with the smallest single deploy by a neighbouring opponent that takes it after these orders, and what falls with it (the bonuses it breaks, the territories behind it and their bonus income). An opponent whose estimate one observation broke (see warapp_plan_turn) is tried at the larger of what it implied and your own income (\`enemyDeploy\` source \`untrusted\`), said in the first warning. Each \`enemyDeploy\` entry shows the Reinforcement card the clock says it may hold apart as \`cardBonus\` (in \`deploy\` unless \`assume_enemy_cards\` is "none"; a progressive card's source in \`cardBonusBasis\`, as warapp_plan_turn has it) and, under Sanctions, \`sanctionApplied\` (its income before and after the cut). A Sanctions card in the orders is projected onto next turn in \`sanctionsPlayed\` (\`nextIncome\`: 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), and a card on the wrong side for its sign is a warning (warapp_submit_turn refuses it). \`belowPlan\` compares these orders with the default plan made now on the same board (warapp_plan_turn with no options, the award of picks read as it reads it), or with its border guess when the deploys given are the guess's (\`belowPlanAgainst\`: plan or guess): each border they leave below what that plan leaves standing there, with \`planLeaves\`, \`left\` and \`short\`, the largest shortfall first (empty: none). \`planLeaves\` carries the plan's surplus, so a border named may still hold (see \`headroom\`); orders warapp_plan_turn made with options differ from the default plan by design. In a free-for-all with a truce in force (the agreement ledger), its partner is still tried \u2014 \`safe\` is safe against a break too \u2014 each reply that attacks a territory a truce covers is marked \`breaksTruce\`, and \`safeIfTruceHolds\` is the verdict over the other replies (null when every reply is a break); a partner-approved truce exception on this turn opens its territories (no break) and is listed under \`relations\`. In a game running the Diplomacy 2 mod, an ally is such a truce too, and a warning names any order that attacks a territory an ally holds (the game skips it; its armies sit idle). Refuses outside a turn phase. ${BRIDGE_NOTE} Read-only on war.app; it never submits orders.`
160807
+ `Stress-test a list of orders for your turn in an in-progress war.app (Warzone) game before you submit it (in a game of more than 16 opponents, \`unseenOpponents\` lists only those near your land \u2014 \`unseenOpponentsMore\` counts the rest \u2014 and \`scale\` sums the opponents not in view or within 2 steps of your land): the orders (the \`orders\` array warapp_plan_turn returns, or your own edit of it) are carried out on the live board, turn rules included (deploys first, then attacks and transfers interleaved in the zigzag move order; each order an attack or a transfer by who holds its target when it runs; kill rates, the guard army, each army moving once, commanders), against the replies each opponent could make with ONE deploy: its whole estimated deploy on one stack and an attack on a territory you hold or are about to take, its whole deploy on a territory you attack, or that plus its stacks beside it moving in first (\`gather\`, the bait: \`movedIn\` names each), or every stack attacking at once; a stack you attack moving out first (a dodge: into its own territory, or a neutral or one of yours it can take \u2014 \`dodges\` lists each with the armies that got away and what your strike then hit); two opponents striking one of your territories together (teammates always; any two in a free-for-all when you lead \u2014 \`jointFalls\` gives the armies each such territory needs to hold); and, under Multi-Attack, each stack's most damaging chain of captures. Under Local Deployment each deploy is bounded by where its bonus armies may land. Each reply is tried with you moving first and with the opponent moving first unless \`first_mover\` says which. A reply that keeps alive a player your orders finish off is \`eliminationsFailed\`. Returns \`safe\` (true, false, or null when no reply could be tried), a one-line \`summary\`, the \`worst\` reply and \`otherReplies\` that cost you something (territories \`lost\`, captures that fail or are \`retaken\`, bonuses and income lost, your commander), everything \`atRisk\` to some single reply (only one of them happens: one deploy, one place), what your orders do unanswered (\`plan\`: captures, attacks that fail, orders that send fewer armies than ordered or none), \`blindBorders\`: your territories next to the fog, where nothing could be tested, and \`exposedNextTurn\`: territories no enemy stack touches today that one could take next turn by first taking the territory in between (yours or neutral), each with the armies it would need to hold, if you add nothing next turn. Decide on the fields (\`safe\`, \`worst\`, \`exposedNextTurn\`), not on the wording of \`summary\`, which may change. With your commander on the board, \`commander\` says where it stands after the orders, the armies there and \`needs\`: the armies its territory needs to survive every reply tried, by the check warapp_submit_turn refuses on (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. \`commander.fogged\` tests it against \`fogged_attackers\` (default as warapp_plan_turn: 2 in a Commanders free-for-all of eight or more players under fog, else off) unknown opponents the fog may hide within two moves of where it ends, striking together (each a start of the game's starting armies, else your largest stack, plus a deploy of your income; luck-free): \`safe\`, \`needs\`, where they may come from; the summary names it when it can fall, and it never changes \`safe\`. Exact with no luck and straight rounding; otherwise battles are resolved at their expectation and \`exact\` is false. It does not try: ${CHECK_PLAN_NOT_COVERED.join("; ")}. When this server kept your pick list, \`award\` says what the award of picks showed (as in warapp_plan_turn): the opponent's proven starts stand on the board the orders are tried on even while fogged, and \`award.firstMover\` is who moves first this turn under a \`Cycle\` move order (not NoLuckCycle, where play speed sets it) \u2014 pass it as \`first_mover\` to judge by it; both orders are still tried by default. \`headroom\` lists, weakest first, each border of yours with the smallest single deploy by a neighbouring opponent that takes it after these orders, and what falls with it (the bonuses it breaks, the territories behind it and their bonus income). An opponent whose estimate one observation broke (see warapp_plan_turn) is tried at the larger of what it implied and your own income (\`enemyDeploy\` source \`untrusted\`), said in the first warning. Each \`enemyDeploy\` entry shows the Reinforcement card the clock says it may hold apart as \`cardBonus\` (in \`deploy\` unless \`assume_enemy_cards\` is "none"; a progressive card's source in \`cardBonusBasis\`, as warapp_plan_turn has it) and, under Sanctions, \`sanctionApplied\` (its income before and after the cut). A Sanctions card in the orders is projected onto next turn in \`sanctionsPlayed\` (\`nextIncome\`: 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), and a card on the wrong side for its sign is a warning (warapp_submit_turn refuses it). \`belowPlan\` compares these orders with the default plan made now on the same board (warapp_plan_turn with no options, the award of picks read as it reads it), or with its border guess when the deploys given are the guess's (\`belowPlanAgainst\`: plan or guess): each border they leave below what that plan leaves standing there, with \`planLeaves\`, \`left\` and \`short\`, the largest shortfall first (empty: none). \`planLeaves\` carries the plan's surplus, so a border named may still hold (see \`headroom\`); orders warapp_plan_turn made with options differ from the default plan by design. In a free-for-all with a truce in force (the agreement ledger), its partner is still tried \u2014 \`safe\` is safe against a break too \u2014 each reply that attacks a territory a truce covers is marked \`breaksTruce\`, and \`safeIfTruceHolds\` is the verdict over the other replies (null when every reply is a break); a partner-approved truce exception on this turn opens its territories (no break) and is listed under \`relations\`. In a game running the Diplomacy 2 mod, an ally is such a truce too, and a warning names any order that attacks a territory an ally holds (the game skips it; its armies sit idle). Refuses outside a turn phase. ${BRIDGE_NOTE} Read-only on war.app; it never submits orders.`
160724
160808
  ),
160725
160809
  _meta: lookupMeta(["check my plan", "stress test my orders", "what can my opponent do to this turn", "is this plan safe"]),
160726
160810
  annotations: readAnnotations("Stress-test a war.app turn"),
@@ -160998,7 +161082,7 @@ function registerCheckPlanTool(server, ctx) {
160998
161082
  const some = (ids2) => `${ids2.slice(0, LIST_MAX2).join(", ")}${ids2.length > LIST_MAX2 ? ` and ${ids2.length - LIST_MAX2} more` : ""}`;
160999
161083
  const capped2 = (ids2) => ids2.slice(0, LIST_MAX2).map(name);
161000
161084
  const sentence = (r) => {
161001
- const act = r.kind === "reinforce" ? `deploys ${r.deploy} on territory ${r.deployTo} and holds` : r.kind === "attack" ? `deploys ${r.deploy} on territory ${r.deployTo} and attacks territory ${r.to} with ${r.armies}` : r.kind === "dodge" ? `deploys ${r.deploy} on territory ${r.deployTo} and moves it out first, ${r.armies} into territory ${r.to}` : r.kind === "chain" ? `deploys ${r.deploy} on territory ${r.deployTo} and attacks on through territories ${r.path.slice(1).join(" \u2192 ")}` : r.kind === "joint" ? `and player ${r.partner} strike territory ${r.to} together from territories ${r.from} and ${r.partnerDeployTo} (deploying ${r.deploy} and ${r.partnerDeploy})` : `attacks with every stack at once (${r.attacks.length} attacks), its ${r.deploy} on territory ${r.deployTo}`;
161085
+ const act = r.kind === "reinforce" ? `deploys ${r.deploy} on territory ${r.deployTo} and holds` : r.kind === "gather" ? `${r.deploy > 0 ? `deploys ${r.deploy} on territory ${r.deployTo} and ` : ""}moves ${(r.movedIn ?? []).map((m) => `${m.armies} in from territory ${m.from}`).join(" and ")} onto territory ${r.deployTo}` : r.kind === "attack" ? `deploys ${r.deploy} on territory ${r.deployTo} and attacks territory ${r.to} with ${r.armies}` : r.kind === "dodge" ? `deploys ${r.deploy} on territory ${r.deployTo} and moves it out first, ${r.armies} into territory ${r.to}` : r.kind === "chain" ? `deploys ${r.deploy} on territory ${r.deployTo} and attacks on through territories ${r.path.slice(1).join(" \u2192 ")}` : r.kind === "joint" ? `and player ${r.partner} strike territory ${r.to} together from territories ${r.from} and ${r.partnerDeployTo} (deploying ${r.deploy} and ${r.partnerDeploy})` : `attacks with every stack at once (${r.attacks.length} attacks), its ${r.deploy} on territory ${r.deployTo}`;
161002
161086
  const when = (needs(r) === "you" ? ", and you move first" : needs(r) === "opponent" ? `, and ${r.kind === "joint" ? "they move" : "it moves"} first` : "") + (r.firstOpponent !== void 0 ? `, player ${r.firstOpponent} before the other` : "");
161003
161087
  const cost = r.commanderLost ? ["you lose your commander and the game"] : [
161004
161088
  ...r.lost.length ? [`you lose territor${r.lost.length === 1 ? "y" : "ies"} ${some(r.lost)}`] : [],
@@ -161016,6 +161100,8 @@ function registerCheckPlanTool(server, ctx) {
161016
161100
  deploy: r.deploy,
161017
161101
  deployTo: name(r.deployTo),
161018
161102
  ...r.kind === "attack" || r.kind === "dodge" || r.kind === "chain" ? { attack: { from: name(r.from), to: name(r.to), armies: r.armies } } : {},
161103
+ // #593 5c: the stacks a gather moved into the target, and what arrived from each.
161104
+ ...r.movedIn ? { movedIn: r.movedIn.map((m) => ({ from: name(m.from), armies: m.armies })) } : {},
161019
161105
  // #180: a chain's every territory, and a joint strike's second opponent.
161020
161106
  ...r.path ? { path: r.path.map(name) } : {},
161021
161107
  ...r.partner !== void 0 ? {
@@ -0,0 +1,58 @@
1
+ // #593 5c: the bait warning. A lightly held territory of a player's beside its big stack reads as
2
+ // a cheap capture, but that stack can move in before my attack lands (it moves first in the
3
+ // zigzag, or my attack is not my first order), and the attack then meets everything at once. The
4
+ // owner's rematch lost four 2–3 army attacks this way; the Tibet one met 24 moved in and 12
5
+ // deployed. The submit preview has no deploy estimate (warapp_check_plan's `gather` reply adds it):
6
+ // this counts only the armies there and what its stacks beside it can move in, so whatever it
7
+ // names is short before a single army is deployed.
8
+ import { armiesToTake, COMMANDER_STRENGTH, specialUnitStrength } from '../analysis/combat.js';
9
+ import { neighborsOf } from '../analysis/graph.js';
10
+ /** The preview's warning, or `undefined` when no attack can be met that way. */
11
+ export function baitAttackWarning(input) {
12
+ const { graph, board, me, settings, label, name } = input;
13
+ const teammates = input.teammates ?? new Set();
14
+ const standing = new Map(board.map((t) => [t.territoryId, t]));
15
+ const guard = settings.oneArmyStandsGuard === false ? 0 : 1;
16
+ const rates = {
17
+ ...(settings.offensiveKillRate !== undefined ? { offensiveKillRate: settings.offensiveKillRate } : {}),
18
+ ...(settings.defensiveKillRate !== undefined ? { defensiveKillRate: settings.defensiveKillRate } : {}),
19
+ };
20
+ /** My attacks by target, in the order first listed: a player's visible territory, not a teammate's unless asked. */
21
+ const byTarget = new Map();
22
+ for (const m of input.moves) {
23
+ const t = standing.get(m.to.id);
24
+ if (m.mode === 'transfer-only' || !t || t.fogged || t.owner === me || t.owner < 0)
25
+ continue;
26
+ if (teammates.has(t.owner) && m.attackTeammates !== true)
27
+ continue;
28
+ const power = m.armies + (m.commander ? COMMANDER_STRENGTH : 0);
29
+ const g = byTarget.get(m.to.id);
30
+ if (g)
31
+ g.armies += power;
32
+ else
33
+ byTarget.set(m.to.id, { from: m.from, to: m.to, armies: power });
34
+ }
35
+ const parts = [];
36
+ for (const [id, a] of byTarget) {
37
+ const target = standing.get(id);
38
+ const owner = target.owner;
39
+ const stacks = neighborsOf(graph, id)
40
+ .map((n) => standing.get(n))
41
+ .filter((s) => s !== undefined && !s.fogged && s.owner === owner && (s.armies ?? 0) > guard)
42
+ .map((s) => ({ id: s.territoryId, moves: (s.armies ?? 0) - guard }))
43
+ .sort((x, y) => y.moves - x.moves || x.id - y.id);
44
+ if (!stacks.length)
45
+ continue;
46
+ const defenders = (target.armies ?? 0) + specialUnitStrength(target.specialUnits) + stacks.reduce((n, s) => n + s.moves, 0);
47
+ const needs = armiesToTake(defenders, rates);
48
+ if (needs !== null && a.armies >= needs)
49
+ continue;
50
+ parts.push(`${label(a.from)} → ${label(a.to)} with ${a.armies}: player ${owner}'s stacks beside it can move in first (${stacks
51
+ .map((s) => `${label(name(s.id))} ${s.moves}`)
52
+ .join(', ')}), ${defenders} defenders before any deploy, which ${needs === null ? 'no attack can take' : `needs ${needs}`}`);
53
+ }
54
+ if (!parts.length)
55
+ return undefined;
56
+ return (`Possible bait (#593): ${parts.join('; ')}. That happens when it moves first, or when its moves run before the attack in the zigzag. ` +
57
+ 'warapp_check_plan tries it with its deploy too (the `gather` reply).');
58
+ }
@@ -87,7 +87,8 @@ export function registerCheckPlanTool(server, ctx) {
87
87
  'order; each order an attack or a transfer by who holds its target when it runs; kill rates, the guard ' +
88
88
  'army, each army moving once, commanders), against the replies each opponent could make with ONE deploy: ' +
89
89
  'its whole estimated deploy on one stack and an attack on a territory you hold or are about to take, its ' +
90
- 'whole deploy on a territory you attack, or every stack attacking at once; a stack you attack moving out ' +
90
+ 'whole deploy on a territory you attack, or that plus its stacks beside it moving in first (`gather`, the bait: ' +
91
+ '`movedIn` names each), or every stack attacking at once; a stack you attack moving out ' +
91
92
  'first (a dodge: into its own territory, or a neutral or one of yours it can take — `dodges` lists each ' +
92
93
  'with the armies that got away and what your strike then hit); two opponents striking one of your ' +
93
94
  'territories together (teammates always; any two in a free-for-all when you lead — `jointFalls` gives the ' +
@@ -509,15 +510,19 @@ export function registerCheckPlanTool(server, ctx) {
509
510
  const sentence = (r) => {
510
511
  const act = r.kind === 'reinforce'
511
512
  ? `deploys ${r.deploy} on territory ${r.deployTo} and holds`
512
- : r.kind === 'attack'
513
- ? `deploys ${r.deploy} on territory ${r.deployTo} and attacks territory ${r.to} with ${r.armies}`
514
- : r.kind === 'dodge'
515
- ? `deploys ${r.deploy} on territory ${r.deployTo} and moves it out first, ${r.armies} into territory ${r.to}`
516
- : r.kind === 'chain'
517
- ? `deploys ${r.deploy} on territory ${r.deployTo} and attacks on through territories ${r.path.slice(1).join(' → ')}`
518
- : r.kind === 'joint'
519
- ? `and player ${r.partner} strike territory ${r.to} together from territories ${r.from} and ${r.partnerDeployTo} (deploying ${r.deploy} and ${r.partnerDeploy})`
520
- : `attacks with every stack at once (${r.attacks.length} attacks), its ${r.deploy} on territory ${r.deployTo}`;
513
+ : r.kind === 'gather'
514
+ ? `${r.deploy > 0 ? `deploys ${r.deploy} on territory ${r.deployTo} and ` : ''}moves ${(r.movedIn ?? [])
515
+ .map((m) => `${m.armies} in from territory ${m.from}`)
516
+ .join(' and ')} onto territory ${r.deployTo}`
517
+ : r.kind === 'attack'
518
+ ? `deploys ${r.deploy} on territory ${r.deployTo} and attacks territory ${r.to} with ${r.armies}`
519
+ : r.kind === 'dodge'
520
+ ? `deploys ${r.deploy} on territory ${r.deployTo} and moves it out first, ${r.armies} into territory ${r.to}`
521
+ : r.kind === 'chain'
522
+ ? `deploys ${r.deploy} on territory ${r.deployTo} and attacks on through territories ${r.path.slice(1).join(' → ')}`
523
+ : r.kind === 'joint'
524
+ ? `and player ${r.partner} strike territory ${r.to} together from territories ${r.from} and ${r.partnerDeployTo} (deploying ${r.deploy} and ${r.partnerDeploy})`
525
+ : `attacks with every stack at once (${r.attacks.length} attacks), its ${r.deploy} on territory ${r.deployTo}`;
521
526
  const when = (needs(r) === 'you' ? ', and you move first' : needs(r) === 'opponent' ? `, and ${r.kind === 'joint' ? 'they move' : 'it moves'} first` : '') +
522
527
  (r.firstOpponent !== undefined ? `, player ${r.firstOpponent} before the other` : '');
523
528
  // With my commander gone everything is: the rest is not listed.
@@ -541,6 +546,8 @@ export function registerCheckPlanTool(server, ctx) {
541
546
  deploy: r.deploy,
542
547
  deployTo: name(r.deployTo),
543
548
  ...(r.kind === 'attack' || r.kind === 'dodge' || r.kind === 'chain' ? { attack: { from: name(r.from), to: name(r.to), armies: r.armies } } : {}),
549
+ // #593 5c: the stacks a gather moved into the target, and what arrived from each.
550
+ ...(r.movedIn ? { movedIn: r.movedIn.map((m) => ({ from: name(m.from), armies: m.armies })) } : {}),
544
551
  // #180: a chain's every territory, and a joint strike's second opponent.
545
552
  ...(r.path ? { path: r.path.map(name) } : {}),
546
553
  ...(r.partner !== undefined
@@ -35,6 +35,7 @@ import { planBlockade, planWall } from '../analysis/blockade-plan.js';
35
35
  import { alternativePlans, STRATEGY_NOTE, stressSummary, turnOptions } from '../analysis/options.js';
36
36
  import { FACT_PARTS, FACTS_AVAILABLE, MORE_ON_REQUEST, OWN_PLAN_STEPS, pickFacts, situation } from '../analysis/situation.js';
37
37
  import { stressPlan } from '../analysis/stress.js';
38
+ import { baitAttackWarning } from './bait.js';
38
39
  import { breaksInOrders } from '../mod-alliances.js';
39
40
  import { allyAttackLine, attacksOnAllies, MOD_ALLIANCES_NOTE, modAllianceWarnings, readModAlliances } from './mod-alliances.js';
40
41
  import { adviseCards, cardGame, cardPieceOption, giftInOrders, intelOrders, handOwners, lastTurnPlays, opponentCanHold, opponentReinforcement, reinforcementPlaysShown, seenReinforcementPlays, TEAM_HAND } from './card-advice.js';
@@ -4071,6 +4072,19 @@ export function registerTurnTools(server, ctx, opts = {}) {
4071
4072
  const hopeless = hopelessAttackWarning(attacks, label);
4072
4073
  if (hopeless)
4073
4074
  warnings.push(hopeless);
4075
+ // #593 5c: an attack its stacks beside the target can reinforce before it lands.
4076
+ const bait = baitAttackWarning({
4077
+ graph: graphOf(map),
4078
+ board: territories,
4079
+ me: playerId,
4080
+ moves: moves.map((m, i) => ({ ...m, armies: m.percent ? (options.estimates.get(i) ?? 0) : m.armies })),
4081
+ settings: plannerSettings(game.settings),
4082
+ label,
4083
+ name: (id) => ({ id, name: map.territories.find((t) => t.id === id)?.name ?? String(id) }),
4084
+ teammates,
4085
+ });
4086
+ if (bait)
4087
+ warnings.push(bait);
4074
4088
  // #275 (c): a border of a held bonus these orders leave falling to a deploy below my own income.
4075
4089
  // A warning, never a refusal; the stress test (warapp_check_plan) tries the replies in full.
4076
4090
  const subTeams = teamsOf(game.players);
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  // Single source of truth for the server version. release-please bumps the
2
2
  // literal on the marked line (registered in release-please-config.json
3
3
  // extra-files); every other module imports VERSION from here.
4
- export const VERSION = '0.21.0'; // x-release-please-version
4
+ export const VERSION = '0.22.0'; // x-release-please-version
package/manifest.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "manifest_version": "0.3",
4
4
  "name": "warapp-mcp",
5
5
  "display_name": "war.app (Warzone)",
6
- "version": "0.21.0",
6
+ "version": "0.22.0",
7
7
  "description": "war.app (Warzone) game advisor for Claude — your games, maps, bonuses, board analysis and routes via the GameFeed API, plus your games list (waiting on you first), opponent scouting with your head-to-head, the live board, territory picks, cards, turn planning and submission, turn notifications, and chat through your signed-in war.app tab (ContextMint Bridge). 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 into a hosted server and linking a session (local only) are confirm-gated.",
8
8
  "author": {
9
9
  "name": "Chris Hall",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chrischall/warapp-mcp",
3
- "version": "0.21.0",
3
+ "version": "0.22.0",
4
4
  "mcpName": "io.github.chrischall/warapp-mcp",
5
5
  "description": "war.app (Warzone) game advisor MCP server for Claude — games, maps, bonuses and board analysis via the GameFeed API, plus your games list, opponent scouting, the live board, territory picks, cards, turn planning and submission, turn notifications and chat through your signed-in war.app tab. Developed and maintained by AI (Claude Code).",
6
6
  "author": "Claude Code (AI) <https://www.anthropic.com/claude>",
package/server.json CHANGED
@@ -6,12 +6,12 @@
6
6
  "url": "https://github.com/chrischall/warapp-mcp",
7
7
  "source": "github"
8
8
  },
9
- "version": "0.21.0",
9
+ "version": "0.22.0",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "identifier": "@chrischall/warapp-mcp",
14
- "version": "0.21.0",
14
+ "version": "0.22.0",
15
15
  "transport": {
16
16
  "type": "stdio"
17
17
  },