Credibility pass: the illusion tests roll both ways, and the seams from the last batch are sanded
Scope: 66b5c06..HEAD. - The rev-27 illusion tests search seeds for a believed and a doubted roll and assert fixed life totals; seed 42 alone never believed, so the BLUNT pricing went unchecked. - Three docblocks stranded above newly inserted functions are back on their own (openCreatureStack, resolvedBlow, castTrace). - POWER ATTACK's life trade is one helper instead of three copies; the goat's charge distance is one helper for its validator, its ram and its pricing. - The family list loads once into a shared store; the lobby and gallery share one talk filter; Board uses the engine's neighbor(). - A creature's blow shows the card that summoned it by the creature's kind, not by matching the blow's display name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jm2auWk6RP71CjaAb4FMoG
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
e97deb8d6f
commit
3a6b0ff43e
+26
-20
@@ -2433,17 +2433,14 @@ const CARD_EFFECTS: Record<string, AttackEffect | NeutralEffect | CounterEffect>
|
||||
// Earlier revisions rammed at any range; their ledgers keep it.
|
||||
validate: (state, _cmd, _caster, target) => {
|
||||
if ((state.config.deckRev ?? 1) < 10 || !target) return null;
|
||||
const caster = activePlayer(state);
|
||||
const legs = state.turn.movementAllowance - state.turn.movementUsed;
|
||||
const d = walkingDistance(state, caster.position, target.position, chargeReach(state, legs));
|
||||
const { d, legs } = charge(state, activePlayer(state), target);
|
||||
if (d > legs) return "the goat charges on legs, not wings — you cannot walk that far this turn";
|
||||
return null;
|
||||
},
|
||||
onResolved: (ctx) => {
|
||||
if (ctx.fullyStopped || !ctx.defender.alive || !ctx.attacker.alive) return;
|
||||
if ((ctx.state.config.deckRev ?? 1) >= 10) {
|
||||
const legs = ctx.state.turn.movementAllowance - ctx.state.turn.movementUsed;
|
||||
const d = walkingDistance(ctx.state, ctx.attacker.position, ctx.defender.position, chargeReach(ctx.state, legs));
|
||||
const { d, legs } = charge(ctx.state, ctx.attacker, ctx.defender);
|
||||
if (d === 0) return;
|
||||
if (d > legs) {
|
||||
// The target slipped beyond the charge (a counter-teleport, say):
|
||||
@@ -2454,9 +2451,9 @@ const CARD_EFFECTS: Record<string, AttackEffect | NeutralEffect | CounterEffect>
|
||||
ctx.state.turn.movementUsed += d;
|
||||
ctx.attacker.position = { ...ctx.defender.position };
|
||||
ctx.events.push({ type: "rammed", attacker: ctx.attacker.id, target: ctx.defender.id, distance: d });
|
||||
// Rev 26: the ram was priced into the blow itself (ramDistance),
|
||||
// so STRENGTH, AMPLIFY, and the counters have already weighed it.
|
||||
// Older games dealt the bare distance here, past all of them.
|
||||
// From rev 26 the ram is priced into the blow itself (ramDistance),
|
||||
// so STRENGTH, AMPLIFY, and the counters have already weighed it;
|
||||
// earlier revs deal the bare distance here, past all of them.
|
||||
if ((ctx.state.config.deckRev ?? 1) < 26) resolvedBlow(ctx, d, "goat ram", "physical");
|
||||
return;
|
||||
}
|
||||
@@ -3357,7 +3354,6 @@ function springSlimeTrap(state: GameState, events: GameEvent[], victim: PlayerSt
|
||||
};
|
||||
}
|
||||
|
||||
/** A creature's blow opens a counteraction window like any attack. */
|
||||
/** What a creature's blow is called on the stack and in the chronicle:
|
||||
* the counteraction is played against this, and the damage is dealt as it. */
|
||||
function creatureBlowName(kind: CreatureState["kind"]): string {
|
||||
@@ -3369,6 +3365,7 @@ function creatureBlowName(kind: CreatureState["kind"]): string {
|
||||
}
|
||||
}
|
||||
|
||||
/** A creature's blow opens a counteraction window like any attack. */
|
||||
function openCreatureStack(
|
||||
state: GameState,
|
||||
creature: CreatureState,
|
||||
@@ -5584,8 +5581,7 @@ function doCast(prev: GameState, cmd: Extract<Command, { type: "cast" }>): Comma
|
||||
if (werr) return err(werr);
|
||||
}
|
||||
if (likeAWall && mods.powerAttackPoints > 0) {
|
||||
caster.life -= mods.powerAttackPoints;
|
||||
wandEvents.push({ type: "lifeTraded", player: caster.id, points: mods.powerAttackPoints, newAllowance: state.turn.movementAllowance });
|
||||
payPowerAttack(state, caster, mods.powerAttackPoints, wandEvents);
|
||||
}
|
||||
consumeCast(state, caster, inHand, mods, effect.keepInHand ?? false);
|
||||
if (state.turn.attackUsed) state.turn.secondAttackUsed = true;
|
||||
@@ -5681,8 +5677,7 @@ function doCast(prev: GameState, cmd: Extract<Command, { type: "cast" }>): Comma
|
||||
if (werr) return err(werr);
|
||||
}
|
||||
if (mods.powerAttackPoints > 0) {
|
||||
caster.life -= mods.powerAttackPoints;
|
||||
wandEvents.push({ type: "lifeTraded", player: caster.id, points: mods.powerAttackPoints, newAllowance: state.turn.movementAllowance });
|
||||
payPowerAttack(state, caster, mods.powerAttackPoints, wandEvents);
|
||||
}
|
||||
consumeCast(state, caster, inHand, mods, effect.keepInHand ?? false);
|
||||
if (state.turn.attackUsed) state.turn.secondAttackUsed = true;
|
||||
@@ -5773,8 +5768,7 @@ function doCast(prev: GameState, cmd: Extract<Command, { type: "cast" }>): Comma
|
||||
if (werr) return err(werr);
|
||||
}
|
||||
if (mods.powerAttackPoints > 0) {
|
||||
caster.life -= mods.powerAttackPoints;
|
||||
wandEvents.push({ type: "lifeTraded", player: caster.id, points: mods.powerAttackPoints, newAllowance: state.turn.movementAllowance });
|
||||
payPowerAttack(state, caster, mods.powerAttackPoints, wandEvents);
|
||||
}
|
||||
|
||||
// BLIND: casts at others fly in a rolled direction. "Misdirected spells
|
||||
@@ -6051,17 +6045,23 @@ function checkAmbushes(
|
||||
}
|
||||
}
|
||||
|
||||
/** Damage dealt inside an attack's own resolution hook still honors
|
||||
* EMPATHY — "Any attack done in ANY form against you acts against both you
|
||||
* and the caster". */
|
||||
/** The goat's charge: the corridor distance to its mark, and the legs
|
||||
* this turn has left to cover it. */
|
||||
function charge(state: GameState, attacker: PlayerState, defender: PlayerState): { d: number; legs: number } {
|
||||
const legs = state.turn.movementAllowance - state.turn.movementUsed;
|
||||
return { d: walkingDistance(state, attacker.position, defender.position, chargeReach(state, legs)), legs };
|
||||
}
|
||||
|
||||
/** How far the goat charges: the corridor distance to its mark within
|
||||
* this turn's legs, or zero when the mark is underfoot or out of reach. */
|
||||
function ramDistance(state: GameState, attacker: PlayerState, defender: PlayerState): number {
|
||||
const legs = state.turn.movementAllowance - state.turn.movementUsed;
|
||||
const d = walkingDistance(state, attacker.position, defender.position, chargeReach(state, legs));
|
||||
const { d, legs } = charge(state, attacker, defender);
|
||||
return d > legs ? 0 : d;
|
||||
}
|
||||
|
||||
/** Damage dealt inside an attack's own resolution hook still honors
|
||||
* EMPATHY — "Any attack done in ANY form against you acts against both you
|
||||
* and the caster". */
|
||||
function resolvedBlow(
|
||||
ctx: ResolutionContext, dmg: number, source: string, kind?: "physical",
|
||||
): void {
|
||||
@@ -6072,6 +6072,12 @@ function resolvedBlow(
|
||||
}
|
||||
}
|
||||
|
||||
/** POWER ATTACK: the caster pays in life for the extra points. */
|
||||
function payPowerAttack(state: GameState, caster: PlayerState, points: number, events: GameEvent[]): void {
|
||||
caster.life -= points;
|
||||
events.push({ type: "lifeTraded", player: caster.id, points, newAllowance: state.turn.movementAllowance });
|
||||
}
|
||||
|
||||
/** A NUMBER card riding a counteraction sets the raised spell's duration. */
|
||||
function counterDuration(state: GameState, player: PlayerState, numberInstanceIds?: string[]): number {
|
||||
const num = (numberInstanceIds ?? [])
|
||||
|
||||
Reference in New Issue
Block a user