@chrischall/warapp-mcp 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +5 -4
- package/dist/analysis/card-support.js +12 -4
- package/dist/analysis/coalition.js +55 -0
- package/dist/analysis/local-deploy.js +14 -0
- package/dist/analysis/opponents.js +2 -1
- package/dist/analysis/picks.js +270 -37
- package/dist/analysis/plan/after-leftover.js +26 -4
- package/dist/analysis/plan/captures.js +86 -14
- package/dist/analysis/plan/completed.js +8 -1
- package/dist/analysis/plan/conceded-out.js +16 -11
- package/dist/analysis/plan/deploy-estimates.js +544 -0
- package/dist/analysis/plan/doomed-out.js +135 -0
- package/dist/analysis/plan/estimates.js +4 -1
- package/dist/analysis/plan/free-capture.js +34 -0
- package/dist/analysis/plan/holds.js +8 -309
- package/dist/analysis/plan/horizon.js +42 -0
- package/dist/analysis/plan/leftover.js +43 -5
- package/dist/analysis/plan/observe.js +896 -0
- package/dist/analysis/plan/orders.js +35 -1
- package/dist/analysis/plan/report.js +10 -4
- package/dist/analysis/plan/shared.js +4 -1376
- package/dist/analysis/plan/spread-bind.js +49 -0
- package/dist/analysis/plan/stand-still.js +5 -3
- package/dist/analysis/plan/state.js +12 -0
- package/dist/analysis/plan/strike-stack.js +467 -0
- package/dist/analysis/plan/strike.js +3 -463
- package/dist/analysis/plan/targets.js +219 -28
- package/dist/analysis/plan/threats.js +23 -9
- package/dist/analysis/plan/transfers.js +24 -1
- package/dist/analysis/plan/two-move.js +1 -1
- package/dist/analysis/plan/withdraw.js +316 -0
- package/dist/analysis/planner.js +106 -43
- package/dist/analysis/player.js +4 -0
- package/dist/analysis/relations.js +8 -2
- package/dist/analysis/stress.js +1 -1
- package/dist/bundle.js +4578 -3405
- package/dist/cards.js +37 -0
- package/dist/my-games.js +2 -0
- package/dist/my-orders.js +134 -0
- package/dist/open-games.js +94 -10
- package/dist/team-cards.js +2 -2
- package/dist/team-orders.js +51 -23
- package/dist/tools/card-advice.js +57 -13
- package/dist/tools/card-support-advice.js +17 -1
- package/dist/tools/check-plan.js +2 -1
- package/dist/tools/commander-check.js +2 -1
- package/dist/tools/decision-capture.js +4 -2
- package/dist/tools/index.js +3 -0
- package/dist/tools/join-game.js +44 -8
- package/dist/tools/live.js +43 -5
- package/dist/tools/my-orders.js +110 -0
- package/dist/tools/open-games.js +2 -2
- package/dist/tools/picks.js +128 -51
- package/dist/tools/team-brief.js +1 -1
- package/dist/tools/team.js +25 -9
- package/dist/tools/turn.js +61 -6
- package/dist/tools/uncommit.js +27 -5
- package/dist/trend.js +36 -1
- package/dist/version.js +1 -1
- package/manifest.json +5 -1
- package/package.json +1 -1
- package/server.json +2 -2
- package/skills/warapp-mcp/SKILL.md +9 -2
|
@@ -29,6 +29,8 @@ export const DETERRENT_MIN_VALUE = 5;
|
|
|
29
29
|
/** #440: how many times the most any border being topped up protects that territory must protect. */
|
|
30
30
|
export const DETERRENT_VALUE_RATIO = 2;
|
|
31
31
|
import { knownFirst, lateArrivals, lateNet } from './holds.js';
|
|
32
|
+
import { isDoomedOut } from './doomed-out.js';
|
|
33
|
+
import { paybackLive } from './state.js';
|
|
32
34
|
import { stackFacing } from './strike.js';
|
|
33
35
|
/**
|
|
34
36
|
* The leftover deploy (rule 5). `stack` is the strike stack rule 0p.3c chose (plan/strike.ts),
|
|
@@ -39,7 +41,7 @@ import { stackFacing } from './strike.js';
|
|
|
39
41
|
export function leftoverDeploy(pc, ps, book, threats, hd, tgt, saveStep, stack, open, stays) {
|
|
40
42
|
const { g, territories: state, label, bonusName, mine, mineSet, armiesOf, unitsAt, toTake, noSplit, bombOn } = pc;
|
|
41
43
|
const { warnings, rationale, deployed, avail, locked, captured, moves, incoming } = ps;
|
|
42
|
-
const { orderOf, deploy, undeploy, pools, roomAt, valueOf } = book;
|
|
44
|
+
const { orderOf, deploy, undeploy, pools, roomAt, valueOf, coverOf } = book;
|
|
43
45
|
const { borders } = threats;
|
|
44
46
|
const { conceded, kept, garrisoned, stood, threatened, stayAt } = hd;
|
|
45
47
|
const { committing, byCloseness, bonusTarget, targets, repulsed } = tgt;
|
|
@@ -776,6 +778,8 @@ export function leftoverDeploy(pc, ps, book, threats, hd, tgt, saveStep, stack,
|
|
|
776
778
|
let spreadRest;
|
|
777
779
|
let where;
|
|
778
780
|
let why;
|
|
781
|
+
/** #431: the move out of a doomed stack's border the leftover goes with (every territory of mine left). */
|
|
782
|
+
let ridesOut;
|
|
779
783
|
let lock = false;
|
|
780
784
|
/** #163: the leftover concentrates for one attack (strike, saving, expansion): no Bomb split. */
|
|
781
785
|
let concentrating = false;
|
|
@@ -793,14 +797,22 @@ export function leftoverDeploy(pc, ps, book, threats, hd, tgt, saveStep, stack,
|
|
|
793
797
|
* #288: a source facing no threat whose every neighbour is mine or captured this turn has nothing
|
|
794
798
|
* left to attack once the captures land, so a leftover there idles: it goes with its attacks whose
|
|
795
799
|
* targets still have a step onward (most steps onward first, then id). Never under No-Split (an
|
|
796
|
-
* order already carries the whole stack), nor with a combined capture or a softener
|
|
800
|
+
* order already carries the whole stack), nor with a combined capture or a softener, nor onto a
|
|
801
|
+
* member a #422 payback completion may lose next turn.
|
|
797
802
|
*/
|
|
798
803
|
const joinsOf = (src) => {
|
|
799
804
|
if (noSplit || borders.has(src) || pc.myCommanders.has(src) || leftToAttack(src).length)
|
|
800
805
|
return undefined;
|
|
801
806
|
const onward = (t) => leftToAttack(t).filter((n) => n !== src).length;
|
|
802
807
|
const out = moves
|
|
803
|
-
.filter((m) => m.kind === 'attack' &&
|
|
808
|
+
.filter((m) => m.kind === 'attack' &&
|
|
809
|
+
m.from === src &&
|
|
810
|
+
captured.has(m.to) &&
|
|
811
|
+
!ps.combined.has(m.to) &&
|
|
812
|
+
// #422: never onto a member a payback completion expects to lose next turn.
|
|
813
|
+
!paybackLive(ps, ps.paybackFalls, m.to) &&
|
|
814
|
+
state.get(m.to)?.owner.kind === 'neutral' &&
|
|
815
|
+
onward(m.to) > 0)
|
|
804
816
|
.sort((a, b) => onward(b.to) - onward(a.to) || a.to - b.to);
|
|
805
817
|
return out.length ? out : undefined;
|
|
806
818
|
};
|
|
@@ -976,9 +988,15 @@ export function leftoverDeploy(pc, ps, book, threats, hd, tgt, saveStep, stack,
|
|
|
976
988
|
why = 'my biggest stack';
|
|
977
989
|
}
|
|
978
990
|
else {
|
|
979
|
-
|
|
991
|
+
// #431: never the border a doomed stack just left, while another territory of mine remains;
|
|
992
|
+
// when none does, the leftover leaves with that stack's move out (deploys land before moves).
|
|
993
|
+
const others = mine.filter((x) => !ps.doomedOut.has(x));
|
|
994
|
+
where = biggest(others.length ? others : mine);
|
|
980
995
|
why = 'my biggest stack';
|
|
981
|
-
|
|
996
|
+
ridesOut = ps.doomedOut.has(where) ? moves.find((m) => m.from === where && isDoomedOut(m)) : undefined;
|
|
997
|
+
warnings.push(ridesOut
|
|
998
|
+
? `Every territory I hold is conceded; the leftover ${ps.budget} goes to ${label(where)} and leaves with its move out (#431).`
|
|
999
|
+
: `Every territory I hold is conceded; the leftover ${ps.budget} goes to ${label(where)} anyway.`);
|
|
982
1000
|
}
|
|
983
1001
|
}
|
|
984
1002
|
let n = roomAt(where);
|
|
@@ -1086,6 +1104,23 @@ export function leftoverDeploy(pc, ps, book, threats, hd, tgt, saveStep, stack,
|
|
|
1086
1104
|
else if (n > 0 && !spreadRest) {
|
|
1087
1105
|
rationale.push(`Deploy the leftover ${n} to ${label(where)}: ${why}.`);
|
|
1088
1106
|
deploy(where, n);
|
|
1107
|
+
// #431: the border its doomed stack left is lost for sure: the deploy goes with that stack.
|
|
1108
|
+
if (ridesOut) {
|
|
1109
|
+
const m = ridesOut;
|
|
1110
|
+
const add = Math.min(n, avail.get(where) - (pc.noSplit ? 0 : coverOf(where)));
|
|
1111
|
+
if (add > 0) {
|
|
1112
|
+
avail.set(where, avail.get(where) - add);
|
|
1113
|
+
m.armies += add;
|
|
1114
|
+
if (m.kind === 'transfer')
|
|
1115
|
+
incoming.set(m.to, (incoming.get(m.to) ?? 0) + add);
|
|
1116
|
+
else {
|
|
1117
|
+
if (ps.survivorsAt.has(m.to))
|
|
1118
|
+
ps.survivorsAt.set(m.to, ps.survivorsAt.get(m.to) + add);
|
|
1119
|
+
m.winChance = pc.chanceOf(m.armies, pc.defenceAt(m.to));
|
|
1120
|
+
}
|
|
1121
|
+
rationale.push(`The ${add} deployed on ${label(where)} leave with its move out to ${label(m.to)} (#431): ${m.armies} go.`);
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1089
1124
|
// Keep a strike or expansion stack there: the transfer step must not walk it back as "idle
|
|
1090
1125
|
// interior" armies. Only when it got deploys (under Local Deployment it may get none).
|
|
1091
1126
|
if (lock)
|
|
@@ -1120,6 +1155,9 @@ export function leftoverDeploy(pc, ps, book, threats, hd, tgt, saveStep, stack,
|
|
|
1120
1155
|
const m = [...p.territoryIds].sort((a, b) =>
|
|
1121
1156
|
// No-Split (#124): a member that issues an order would send the pool away with it.
|
|
1122
1157
|
Number(orderOf(a) !== undefined) - Number(orderOf(b) !== undefined) ||
|
|
1158
|
+
// #431: a border a doomed stack left (merged or attacked out of) is lost for sure: the pool
|
|
1159
|
+
// goes to any other member first, even an interior one.
|
|
1160
|
+
Number(ps.doomedOut.has(a)) - Number(ps.doomedOut.has(b)) ||
|
|
1123
1161
|
Number(borders.has(b)) - Number(borders.has(a)) ||
|
|
1124
1162
|
Number(lost(a)) - Number(lost(b)) ||
|
|
1125
1163
|
danger(b) - danger(a) ||
|