A creature sharing your square can be punched, as the FAQ allows for the wraith

"Yes, he can be attacked physically, with a DAGGER, punch, etc.": the punch
command now takes a creature's id as well as a wizard's. Same square, one
point, your attack for the turn, the blind swing's die roll as against a
wizard, and no counteraction window since a creature holds no cards. A
creature you control is safe from you, the democratic monster excepted,
since it claws its creator like anyone. On the board and in first person,
tapping an enemy creature in your square with no card selected throws the
punch, as tapping a wizard there does; the chronicle names the creature.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0141G6xqLeNRYEtviLWSB5Up
This commit is contained in:
Eric WagonerandClaude Fable 5.1 committed 2026-11-23 23:43:00 -05:00
1 parent 8c415836db
commit 88174799e8
4 files changed
+122 -21

No files matched your search

+60 -20
View File
@@ -667,7 +667,8 @@ export type GameEvent =
| { type: "extraTurnStarted"; player: PlayerId }
| { type: "moved"; player: PlayerId; from: Cell; to: Cell; direction: Side; via: "step" | "warp" | "passWall" }
| { type: "numberPlayedForMovement"; player: PlayerId; card: CardInstance; value: number; newAllowance: number }
| { type: "punched"; attacker: PlayerId; target: PlayerId; at: Cell }
/** `kind` is set when the target is a creature, which the chronicle names by it. */
| { type: "punched"; attacker: PlayerId; target: PlayerId | string; at: Cell; kind?: CreatureState["kind"] }
| { type: "spellCast"; caster: PlayerId; card: CardInstance; cardId: string; numberCards: CardInstance[]; numberValue: number | null; from: Cell; target: PlayerId | null; targetCell: Cell | null;
/** AMPLIFY cards attached (each doubles). */ amplifies?: number }
| { type: "counteractionPlayed"; player: PlayerId; card: CardInstance; cardId: string; against: string }
@@ -847,7 +848,8 @@ export type Command =
* ahead is closed — the ledge runs around the whole rim (rev 14). */
| { type: "move"; direction: Side; over?: boolean; exit?: Side }
| { type: "playNumberForMovement"; instanceId: string; addInstanceId?: string }
| { type: "punch"; targetId: PlayerId }
/** A wizard, or a creature, sharing your square. */
| { type: "punch"; targetId: PlayerId | string }
| { type: "tearTreasure"; targetId: PlayerId }
| { type: "punchWall"; cell: Cell; side: Side }
| { type: "testIllusion"; cell: Cell; side: Side }
@@ -5184,7 +5186,11 @@ function doPunchWall(prev: GameState, cell: Cell, side: Side): CommandResult {
return { ok: true, state, events };
}
function doPunch(prev: GameState, targetId: PlayerId): CommandResult {
/** "When all else fails, you may PUNCH your opponent": one point, bare-handed,
* in the same square, and your attack for the turn. The FAQ has a wraith
* "attacked physically, with a DAGGER, punch, etc.", so a creature sharing the
* square takes the punch as a wizard would, with no hand to counter it. */
function doPunch(prev: GameState, targetId: PlayerId | string): CommandResult {
const pre = attackPreconditions(prev) ?? idiotBlocked(prev, activePlayer(prev).id);
if (pre) return err(pre);
@@ -5192,7 +5198,10 @@ function doPunch(prev: GameState, targetId: PlayerId): CommandResult {
const attacker = activePlayer(state);
if (targetId === attacker.id) return err("you cannot attack yourself");
const target = state.players.find((p) => p.id === targetId);
if (!target || !target.alive) return err("no such living player");
if (!target || !target.alive) {
const creature = creatureById(state, targetId);
return creature ? punchCreature(state, attacker, creature) : err("no such living player");
}
if (cellKey(target.position) !== cellKey(attacker.position)) {
return err("you must be in the same square to punch");
}
@@ -5202,23 +5211,9 @@ function doPunch(prev: GameState, targetId: PlayerId): CommandResult {
(s) => !(s.cardId === "buddy" && s.casterId === attacker.id && s.targetId === target.id),
);
// BLIND: "...engage in combat..." — a blinded brawler flails on a die
// roll; the swing connects only on a 1 (same convention as INVISIBLE).
const preRoll: GameEvent[] = [];
if (isBlinded(state, attacker)) {
const roll = rollD4(state, preRoll, attacker.id, "a blind swing — only a 1 connects");
if (roll !== 1) {
state.turn.attackUsed = true;
return {
ok: true,
state,
events: [...preRoll, {
type: "attackMisdirected", attacker: attacker.id, intended: target.id,
rolledDirection: SIDES[roll - 1]!, newTarget: null,
}],
};
}
}
const missed = blindSwing(state, attacker, target.id, preRoll);
if (missed) return missed;
if (state.turn.attackUsed) state.turn.secondAttackUsed = true;
state.turn.attackUsed = true;
@@ -5242,6 +5237,51 @@ function doPunch(prev: GameState, targetId: PlayerId): CommandResult {
};
}
function punchCreature(state: GameState, attacker: PlayerState, creature: CreatureState): CommandResult {
if (cellKey(creature.position) !== cellKey(attacker.position)) {
return err("you must be in the same square to punch");
}
// "Players may not attack a creature that they control." The democratic
// monster is everyone's to move and claws its creator like anyone else.
if (creature.controllerId === attacker.id && creature.kind !== "democratic-monster") {
return err("you cannot attack a creature you control");
}
if (inThornbush(state, attacker)) return err("you cannot attack from inside a thornbush");
if (isMisted(state, attacker.id)) return err("as mist, you may not attack");
if (isMisted(state, creature.id)) return err("your target is mist and cannot be attacked");
const preRoll: GameEvent[] = [];
const missed = blindSwing(state, attacker, creature.id, preRoll);
if (missed) return missed;
if (state.turn.attackUsed) state.turn.secondAttackUsed = true;
state.turn.attackUsed = true;
const events: GameEvent[] = [
...preRoll,
{ type: "punched", attacker: attacker.id, target: creature.id, at: attacker.position, kind: creature.kind },
];
damageCreature(state, events, creature, 1, `punch from ${attacker.id}`);
return { ok: true, state, events };
}
/** BLIND: "...engage in combat..." — a blinded brawler flails on a die roll;
* the swing connects only on a 1 (same convention as INVISIBLE). A miss
* spends the attack and is returned whole; null means the swing lands. */
function blindSwing(state: GameState, attacker: PlayerState, intended: PlayerId | string, preRoll: GameEvent[]): CommandResult | null {
if (!isBlinded(state, attacker)) return null;
const roll = rollD4(state, preRoll, attacker.id, "a blind swing — only a 1 connects");
if (roll === 1) return null;
state.turn.attackUsed = true;
return {
ok: true,
state,
events: [...preRoll, {
type: "attackMisdirected", attacker: attacker.id, intended,
rolledDirection: SIDES[roll - 1]!, newTarget: null,
}],
};
}
interface CastConsumables {
numbers: CardInstance[];
amplifies: CardInstance[];
+52
View File
@@ -1105,3 +1105,55 @@ describe("creatures cannot strike the mist (rev 28)", () => {
expect(r.ok).toBe(true);
});
});
describe("punching a creature", () => {
/** A wraith of `controller`'s standing on `puncher`'s square, `damage` points along. */
function wraithUnderfoot(state: GameState, controller: PlayerId, puncher: PlayerId, damage = 0) {
const me = state.players.find((p) => p.id === puncher)!;
state.creatures.push({
id: "w1", kind: "wraith", controllerId: controller, position: { ...me.position },
damage, maxDamage: 4, movesPerTurn: 3, movementUsed: 0,
wallPassesPerTurn: 1, wallPassUsed: 0, attackUsed: false, justCreated: false, scorchedThisTurn: [],
});
}
function rig(damage = 0) {
const state = toRound2(newGame().state);
const me = activePlayer(state).id;
const other = state.players.find((p) => p.id !== me)!.id;
wraithUnderfoot(state, other, me, damage);
return { state, me, other };
}
it("a wraith in your square takes one point from a punch, which is your attack and opens no window", () => {
const { state, me } = rig();
const r = applyCommand(state, me, { type: "punch", targetId: "w1" });
expect(r.ok).toBe(true);
if (!r.ok) return;
expect(r.state.creatures[0]!.damage).toBe(1);
expect(r.state.turn.attackUsed).toBe(true);
expect(r.state.stack).toBeFalsy();
expect(r.events.some((e) => e.type === "punched" && e.target === "w1" && e.kind === "wraith")).toBe(true);
expect(applyCommand(r.state, me, { type: "punch", targetId: "w1" }).ok).toBe(false);
});
it("the fourth point destroys it", () => {
const { state, me } = rig(3);
const r = applyCommand(state, me, { type: "punch", targetId: "w1" });
expect(r.ok).toBe(true);
if (!r.ok) return;
expect(r.state.creatures).toHaveLength(0);
expect(r.events.some((e) => e.type === "creatureDestroyed" && e.creatureId === "w1")).toBe(true);
});
it("your own creature is safe from your fists, and one in another square is out of reach", () => {
const { state, me } = rig();
state.creatures[0]!.controllerId = me;
const own = applyCommand(state, me, { type: "punch", targetId: "w1" });
expect(own.ok).toBe(false);
if (!own.ok) expect(own.error).toMatch(/control/);
const { state: far, me: puncher } = rig();
far.creatures[0]!.position = emptyNeighborCell(far, far.players.find((p) => p.id === puncher)!.position).cell;
expect(applyCommand(far, puncher, { type: "punch", targetId: "w1" }).ok).toBe(false);
expect(applyCommand(far, puncher, { type: "punch", targetId: "nobody" }).ok).toBe(false);
});
});