Prototype Planetologist movement and Special-card battles
Connect capped extra range, two-origin gathering, Fremen cancellation and saved replacement choices. Add human controls and actual first-choice AI paths for all four profiles. Admit the exact nine base green Specials in the actual skilled leader's weapon slot for +2 on survival, with mandatory physical discard and no native utility effect. Reject stale dead-disc plans. Independent movement/battle review closed after the saved-dead-disc fix. 84 focused tests passed. Two four-profile Basic/Advanced samples completed (194/186 accepted actions, six JSON restorations each, zero rejected actions). Basic used both movement branches; Advanced used added range. Browser genuine setup/gather/refresh and a separate targeted Special/traitor-loss fixture passed. Required verification: types, lint, 4435 offline tests, build and 43 HTTP tests passed. First attempt stopped at missing explicit test promise markers; corrected before the successful broad run. Final check/build/HTTP durations: 144157/6638/25048 ms. Source fingerprint (1260 files): bb7be69cf3e925bf7338ea444f77279ed7b37faadc3c44ed7db01b941f27b861 Private report: checkpoints/20260913-planetologist/checks-final/report.json. Preserved all 325 opening games and all original application/seat/recovery records; 359 rooms after 34 new QA/HTTP rooms. SQLite quick_check ok and zero foreign-key violations. Healthy existing server reused; no reset/restart. Boundaries: eight other Leader Skills, enemy-only mixed BG gather response, expansion roster/green-card/optional-module combinations remain unfinished. Winning traitor caller discard remains a documented card-specific inference. No mode or publication gates opened. Efficiency measure: aggregate goal counter 67321978 -> 68710948 (1388970), including context and coordination; not billing tokens or a savings claim. One skill's three connected effects, selective implementation/research/review, one interrupted lint attempt followed by the required complete verification.
This commit is contained in:
1 parent
6e6fecc9d4
commit
5082c81353
22 files changed
+2473
-93
No files matched your search
@@ -51,6 +51,7 @@ import { LeaderSkillsPanel } from './leader-skills';
|
||||
import { NullentropyBox, NullentropySearch } from './nullentropy-box';
|
||||
import { OrnithopterMovement } from './ornithopter-movement';
|
||||
import { DiscoveryOrnithopterMovement } from './discovery-flight-movement';
|
||||
import { PlanetologistMovement } from './planetologist-movement';
|
||||
import { ResidualPoison, BattleLeaderOpportunity } from './residual-poison';
|
||||
import { PortableSnooper } from './portable-snooper';
|
||||
import {
|
||||
@@ -141,6 +142,8 @@ import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { BattlePreparation, battlePlanCommitments, bindBattlePlanCommitments, NexusInspectionHistory } from './battle-preparation';
|
||||
import { PrivateBattlePlan } from './private-battle-plan';
|
||||
import { canUsePlanetologistBattleSpecial, validLeaderSkillBattleCardPair } from '../game/leader-skill-combat';
|
||||
import type { Card } from '../game/cards';
|
||||
import { RevealedBattle } from './revealed-battle';
|
||||
import { EliteCount } from './elite-count';
|
||||
import { HelpTip } from './help-tip';
|
||||
@@ -404,6 +407,12 @@ export function GameTable({
|
||||
const [discardCards, setDiscardCards] = useState<Record<string, boolean>>({});
|
||||
const stormLosses = g.decision?.kind === 'stormLosses' ? g.decision : null;
|
||||
const committed = battlePlanCommitments(g);
|
||||
const planetologistSpecial = (card: Card) => canUsePlanetologistBattleSpecial({
|
||||
assignments: g.leaderSkills?.assignments.filter(a => a.controller === me.id) ?? [],
|
||||
selectedLeader: committed.leader ? String(committed.leader.value ?? '') : leader,
|
||||
card,
|
||||
});
|
||||
const selectedBattleWeapon = me.hand?.find(c => c.id === (committed.weapon ? committed.weapon.value : weapon));
|
||||
const selectedStone = me.hand?.find(
|
||||
(c) =>
|
||||
c.id === (committed.weapon ? committed.weapon.value : weapon) &&
|
||||
@@ -4010,6 +4019,28 @@ export function GameTable({
|
||||
}
|
||||
}
|
||||
/>
|
||||
<PlanetologistMovement
|
||||
game={g}
|
||||
act={act}
|
||||
busy={busy}
|
||||
destination={selected}
|
||||
sector={sector}
|
||||
unavailableReason={
|
||||
!movementAvailable
|
||||
? 'No ordinary movement is currently available.'
|
||||
: (me.moved ?? 0) >= (me.movesAllowed ?? 1)
|
||||
? 'No ordinary movement remains this turn.'
|
||||
: selectedDestinationInStorm
|
||||
? 'Choose a destination outside the storm.'
|
||||
: liveShipmentPromises(
|
||||
g.shipmentPromises,
|
||||
me.id,
|
||||
g.turn,
|
||||
).some((promise) => promise.answer)
|
||||
? 'Complete the promised shipment before moving.'
|
||||
: null
|
||||
}
|
||||
/>
|
||||
<p className="fine">
|
||||
{guildCunning?.stage === 'secondShipment'
|
||||
? 'Choose or decline the second shipment before any Hajr movement.'
|
||||
@@ -4430,17 +4461,24 @@ export function GameTable({
|
||||
{me.hand
|
||||
?.filter((c) =>
|
||||
name === 'Defense'
|
||||
? isDefenseCard(c)
|
||||
: isWeaponCard(c),
|
||||
? isDefenseCard(c) && (!selectedBattleWeapon || !planetologistSpecial(selectedBattleWeapon) || validLeaderSkillBattleCardPair(selectedBattleWeapon,c,true))
|
||||
: isWeaponCard(c) || planetologistSpecial(c),
|
||||
)
|
||||
.map((c) => (
|
||||
<option key={c.id} value={c.id}>
|
||||
{c.name}
|
||||
{c.name}{name === 'Weapon' && planetologistSpecial(c) ? ' · Planetologist +2, discard after battle' : ''}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
))}
|
||||
{selectedBattleWeapon && planetologistSpecial(selectedBattleWeapon) && (
|
||||
<p className="notice">
|
||||
{selectedBattleWeapon.name} adds 2 to the surviving Planetologist leader.
|
||||
It makes no weapon attack and does not use its normal effect.
|
||||
Discard it after this battle, even if you win.
|
||||
</p>
|
||||
)}
|
||||
{selectedStone && (
|
||||
<div className="my-3 flex flex-col gap-3">
|
||||
<p>
|
||||
|
||||
@@ -109,7 +109,8 @@ export function LeaderSkillsPanel({
|
||||
<p className="fine">
|
||||
This development-only module currently connects the card-role strength
|
||||
modifiers for Warmaster, Master of Assassins, Swordmaster of Ginaz,
|
||||
Killer Medic and Prana-Bindu Adept. Other Leader Skill effects are
|
||||
Killer Medic and Prana-Bindu Adept, plus Planetologist movement and
|
||||
Special-card battle use. Other Leader Skill effects are
|
||||
unfinished.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,269 @@
|
||||
'use client';
|
||||
|
||||
import { useId, useState } from 'react';
|
||||
import type { Action, GameView } from '@/game/engine';
|
||||
import {
|
||||
planetologistLeader,
|
||||
type PlanetologistMoveMode,
|
||||
} from '@/game/planetologist-movement';
|
||||
import { botGroundMoveAllowed } from '@/game/bot-mobility';
|
||||
import {
|
||||
gameTerritories,
|
||||
location,
|
||||
splitLocation,
|
||||
territory,
|
||||
} from '@/game/board';
|
||||
import { isAdvisor } from '@/game/advisors';
|
||||
import { presenceAt } from '@/game/force-presence';
|
||||
import { faction } from '@/game/catalog';
|
||||
import { Button } from './ui/button';
|
||||
import { Input } from './ui/input';
|
||||
|
||||
type Counts = Record<string, number>;
|
||||
|
||||
export function planetologistMoveDraft(
|
||||
game: GameView,
|
||||
mode: PlanetologistMoveMode,
|
||||
destination: string,
|
||||
sector: number,
|
||||
forces: Counts,
|
||||
elites: Counts,
|
||||
): { action: Action | null; blocked: string | null } {
|
||||
const me = game.players.find((player) => player.id === game.me);
|
||||
if (!me || !planetologistLeader(game, me.id))
|
||||
return {
|
||||
action: null,
|
||||
blocked: 'A living, uncaptured Planetologist is required.',
|
||||
};
|
||||
if (
|
||||
game.players.some((player) => faction(player.faction).expansion !== 'base')
|
||||
)
|
||||
return {
|
||||
action: null,
|
||||
blocked:
|
||||
'Planetologist movement with expansion factions awaits its movement audit.',
|
||||
};
|
||||
const selected = Object.entries(forces).filter(([, count]) => count > 0);
|
||||
for (const [from, count] of selected) {
|
||||
const owned = me.forces[from] ?? 0;
|
||||
if (!Number.isSafeInteger(count) || count < 1 || count > owned)
|
||||
return { action: null, blocked: 'Choose available whole force counts.' };
|
||||
const elite = elites[from] ?? 0;
|
||||
const ownedElite = me.elites?.forces[from] ?? 0;
|
||||
const minimumElite = Math.max(0, count - (owned - ownedElite));
|
||||
if (
|
||||
!Number.isSafeInteger(elite) ||
|
||||
elite < minimumElite ||
|
||||
elite > Math.min(count, ownedElite)
|
||||
)
|
||||
return {
|
||||
action: null,
|
||||
blocked: 'Choose an available normal and elite mix for every source.',
|
||||
};
|
||||
}
|
||||
const origins = new Set(
|
||||
selected.map(([from]) => splitLocation(from).territory),
|
||||
);
|
||||
if (
|
||||
(mode === 'range' && origins.size !== 1) ||
|
||||
(mode === 'gather' && origins.size !== 2)
|
||||
)
|
||||
return {
|
||||
action: null,
|
||||
blocked:
|
||||
mode === 'range'
|
||||
? 'Select forces from one territory.'
|
||||
: 'Select forces from exactly two different territories.',
|
||||
};
|
||||
if (
|
||||
game.advanced &&
|
||||
me.faction === 'beneGesserit' &&
|
||||
new Set([...origins].map((origin) => isAdvisor(me, origin))).size > 1 &&
|
||||
!presenceAt(me, destination) &&
|
||||
game.players.some(
|
||||
(player) => player.id !== me.id && presenceAt(player, destination),
|
||||
)
|
||||
)
|
||||
return {
|
||||
action: null,
|
||||
blocked:
|
||||
'Gathering advisors and fighters into an enemy-only territory is still being implemented.',
|
||||
};
|
||||
const target = location(destination, sector);
|
||||
if (
|
||||
selected.some(
|
||||
([from]) =>
|
||||
!botGroundMoveAllowed(game, me, from, target, elites[from] ?? 0, mode),
|
||||
)
|
||||
)
|
||||
return {
|
||||
action: null,
|
||||
blocked:
|
||||
mode === 'range'
|
||||
? 'The selected route is beyond the boosted range or is blocked.'
|
||||
: 'Each selected source must reach the destination using its normal range.',
|
||||
};
|
||||
return {
|
||||
action: {
|
||||
type: 'move',
|
||||
planetologist: mode,
|
||||
forces: Object.fromEntries(selected),
|
||||
...(me.elites
|
||||
? {
|
||||
eliteForces: Object.fromEntries(
|
||||
selected.map(([from]) => [from, elites[from] ?? 0]),
|
||||
),
|
||||
}
|
||||
: {}),
|
||||
territory: destination,
|
||||
sector,
|
||||
},
|
||||
blocked: null,
|
||||
};
|
||||
}
|
||||
|
||||
export function PlanetologistMovement({
|
||||
game,
|
||||
act,
|
||||
busy,
|
||||
destination,
|
||||
sector,
|
||||
unavailableReason,
|
||||
}: {
|
||||
game: GameView;
|
||||
act: (action: Action) => void;
|
||||
busy: boolean;
|
||||
destination: string;
|
||||
sector: number;
|
||||
unavailableReason?: string | null;
|
||||
}) {
|
||||
const id = useId();
|
||||
const [mode, setMode] = useState<PlanetologistMoveMode>('range');
|
||||
const [forces, setForces] = useState<Counts>({});
|
||||
const [elites, setElites] = useState<Counts>({});
|
||||
const me = game.players.find((player) => player.id === game.me);
|
||||
const leader = me && planetologistLeader(game, me.id);
|
||||
if (!me || !leader) return null;
|
||||
const sources = Object.entries(me.forces).filter(([, count]) => count > 0);
|
||||
const draft = planetologistMoveDraft(
|
||||
game,
|
||||
mode,
|
||||
destination,
|
||||
sector,
|
||||
forces,
|
||||
elites,
|
||||
);
|
||||
const blocked =
|
||||
unavailableReason ??
|
||||
(game.phase !== 5 || game.active !== me.id
|
||||
? 'Planetologist movement is available only during your movement turn.'
|
||||
: game.ornithopter?.active
|
||||
? 'Finish the current Ornithopter movement first.'
|
||||
: game.truthtrance || game.nexusTraitors?.pending
|
||||
? 'Resolve the current private response first.'
|
||||
: me.autopilot || game.automaticContinuationPending
|
||||
? 'Wait for the current automatic action to finish.'
|
||||
: draft.blocked);
|
||||
const leaderName =
|
||||
game.allLeaders.find((candidate) => candidate.id === leader)?.name ??
|
||||
leader;
|
||||
return (
|
||||
<section
|
||||
className="my-4 flex min-w-0 flex-col gap-3"
|
||||
aria-labelledby={`${id}-heading`}
|
||||
>
|
||||
<h3 id={`${id}-heading`}>Planetologist movement</h3>
|
||||
<p>
|
||||
{leaderName} may add one territory to one movement, up to three, or
|
||||
gather forces from exactly two territories into the selected
|
||||
destination.
|
||||
</p>
|
||||
<label htmlFor={`${id}-mode`}>Movement mode</label>
|
||||
<select
|
||||
id={`${id}-mode`}
|
||||
value={mode}
|
||||
disabled={busy}
|
||||
onChange={(event) =>
|
||||
setMode(event.target.value as PlanetologistMoveMode)
|
||||
}
|
||||
>
|
||||
<option value="range">One territory farther, maximum three</option>
|
||||
<option value="gather">Gather from two territories</option>
|
||||
</select>
|
||||
<p className="fine">
|
||||
Destination: {territory(destination).name}, sector {sector}. Select the
|
||||
physical forces to move below.
|
||||
</p>
|
||||
{sources.length ? (
|
||||
sources.map(([from, owned]) => {
|
||||
const source = splitLocation(from);
|
||||
const sourceName =
|
||||
gameTerritories(game).find(
|
||||
(candidate) => candidate.id === source.territory,
|
||||
)?.name ?? source.territory;
|
||||
const selected = forces[from] ?? 0;
|
||||
const ownedElite = me.elites?.forces[from] ?? 0;
|
||||
const minimumElite = Math.max(0, selected - (owned - ownedElite));
|
||||
return (
|
||||
<div className="grid gap-2" key={from}>
|
||||
<label htmlFor={`${id}-${from}-forces`}>
|
||||
{sourceName}, sector {source.sector} · {owned} forces
|
||||
<Input
|
||||
id={`${id}-${from}-forces`}
|
||||
type="number"
|
||||
min={0}
|
||||
max={owned}
|
||||
value={selected}
|
||||
disabled={busy || source.sector === game.storm}
|
||||
onChange={(event) =>
|
||||
setForces({ ...forces, [from]: Number(event.target.value) })
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
{me.elites && (
|
||||
<label htmlFor={`${id}-${from}-elites`}>
|
||||
Elite from this group · {ownedElite} available
|
||||
<Input
|
||||
id={`${id}-${from}-elites`}
|
||||
type="number"
|
||||
min={minimumElite}
|
||||
max={Math.min(selected, ownedElite)}
|
||||
value={elites[from] ?? 0}
|
||||
disabled={busy || selected === 0}
|
||||
onChange={(event) =>
|
||||
setElites({
|
||||
...elites,
|
||||
[from]: Number(event.target.value),
|
||||
})
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})
|
||||
) : (
|
||||
<p className="fine">No board forces are available to move.</p>
|
||||
)}
|
||||
{blocked && (
|
||||
<output className="notice" id={`${id}-reason`}>
|
||||
{blocked}
|
||||
</output>
|
||||
)}
|
||||
<Button
|
||||
className="min-h-11 whitespace-normal motion-reduce:transition-none"
|
||||
disabled={busy || !!blocked || !draft.action}
|
||||
aria-describedby={blocked ? `${id}-reason` : undefined}
|
||||
onClick={() => {
|
||||
if (!busy && !blocked && draft.action) act(draft.action);
|
||||
}}
|
||||
>
|
||||
Move with Planetologist
|
||||
</Button>
|
||||
<p className="fine">
|
||||
This does not combine with a No-Field or either Ornithopter movement.
|
||||
Normal movement and arrival rules still apply.
|
||||
</p>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user