The chronicle names creatures, not their ids
"The creature-1 takes 2 damage" — the creature events carried only internal ids, so the log printed them. creatureAttacked, Touched, and Damaged now carry the creature's kind, and the lines read like a table: "The Wraith strikes!", "The Troll swings (rolled 3)!", "The Skeleton takes 2 damage." Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
0ebae03b1c
commit
f00ef75fbd
@@ -495,9 +495,9 @@ export type GameEvent =
|
||||
| { type: "sectorRelocated"; caster: PlayerId; sectorIndex: number; from: Cell; to: Cell }
|
||||
| { type: "creatureCreated"; creatureId: string; kind: CreatureState["kind"]; controller: PlayerId; at: Cell }
|
||||
| { type: "creatureMoved"; creatureId: string; from: Cell; to: Cell; direction: Side; by: PlayerId }
|
||||
| { type: "creatureAttacked"; creatureId: string; target: PlayerId | string; dieRoll: number | null }
|
||||
| { type: "creatureTouched"; creatureId: string; player: PlayerId }
|
||||
| { type: "creatureDamaged"; creatureId: string; amount: number; source: string; damageTotal: number }
|
||||
| { type: "creatureAttacked"; creatureId: string; kind: CreatureState["kind"]; target: PlayerId | string; dieRoll: number | null }
|
||||
| { type: "creatureTouched"; creatureId: string; kind: CreatureState["kind"]; player: PlayerId }
|
||||
| { type: "creatureDamaged"; creatureId: string; kind: CreatureState["kind"]; amount: number; source: string; damageTotal: number }
|
||||
| { type: "creatureDestroyed"; creatureId: string; kind: CreatureState["kind"]; by: string }
|
||||
| { type: "trollRegenerated"; creatureId: string }
|
||||
| { type: "shadowUpkeep"; player: PlayerId; lifeAfter: number }
|
||||
@@ -2462,7 +2462,7 @@ function damageCreature(
|
||||
source: string,
|
||||
): void {
|
||||
creature.damage += amount;
|
||||
events.push({ type: "creatureDamaged", creatureId: creature.id, amount, source, damageTotal: creature.damage });
|
||||
events.push({ type: "creatureDamaged", creatureId: creature.id, kind: creature.kind, amount, source, damageTotal: creature.damage });
|
||||
if (creature.damage >= creature.maxDamage) {
|
||||
destroyCreature(state, events, creature, source);
|
||||
}
|
||||
@@ -2538,7 +2538,7 @@ function doMoveCreature(prev: GameState, creatureId: string, direction: Side): C
|
||||
if (p.id === creature.controllerId && creature.kind !== "democratic-monster") continue; // won't hurt creator
|
||||
if (creature.kind === "wraith" && !creature.attackUsed) {
|
||||
creature.attackUsed = true;
|
||||
events.push({ type: "creatureTouched", creatureId: creature.id, player: p.id });
|
||||
events.push({ type: "creatureTouched", creatureId: creature.id, kind: creature.kind, player: p.id });
|
||||
if (rev4) {
|
||||
// The victim may counteract ("REFLECTIONs used on the wraith's touch
|
||||
// will damage the wraith" — the card assumes exactly this window).
|
||||
@@ -2557,7 +2557,7 @@ function doMoveCreature(prev: GameState, creatureId: string, direction: Side): C
|
||||
}
|
||||
if (creature.kind === "democratic-monster" && !creature.attackUsed) {
|
||||
creature.attackUsed = true; // "may attack only one player per round of turns"
|
||||
events.push({ type: "creatureTouched", creatureId: creature.id, player: p.id });
|
||||
events.push({ type: "creatureTouched", creatureId: creature.id, kind: creature.kind, player: p.id });
|
||||
if (rev4) {
|
||||
openCreatureStack(state, creature, p, 2, "claw");
|
||||
return { ok: true, state, events };
|
||||
@@ -2632,7 +2632,7 @@ function doCreatureAttack(prev: GameState, creatureId: string, targetId: string)
|
||||
} else {
|
||||
amount = 1; // shadow punches like a wizard
|
||||
}
|
||||
events.push({ type: "creatureAttacked", creatureId: creature.id, target: targetId, dieRoll: roll });
|
||||
events.push({ type: "creatureAttacked", creatureId: creature.id, kind: creature.kind, target: targetId, dieRoll: roll });
|
||||
if (targetPlayer) {
|
||||
if ((state.config.deckRev ?? 1) >= 4) {
|
||||
openCreatureStack(state, creature, targetPlayer, amount);
|
||||
@@ -3999,7 +3999,7 @@ function doCast(prev: GameState, cmd: Extract<Command, { type: "cast" }>): Comma
|
||||
}
|
||||
const dmg = effect.baseDamage(mods.magnitude.numberValue, cmd.params ?? null) * (2 ** mods.amplifies.length);
|
||||
if (creature.kind === "fire-imp") {
|
||||
events.push({ type: "creatureDamaged", creatureId: creature.id, amount: 0, source: inHand.cardId, damageTotal: creature.damage });
|
||||
events.push({ type: "creatureDamaged", creatureId: creature.id, kind: creature.kind, amount: 0, source: inHand.cardId, damageTotal: creature.damage });
|
||||
} else if (dmg > 0) {
|
||||
damageCreature(state, events, creature, dmg, inHand.cardId);
|
||||
}
|
||||
|
||||
@@ -88,9 +88,9 @@ export function humanize(e: GameEvent): string | null {
|
||||
case "sectorRelocated": return `The maze SHUDDERS — an entire sector slides away!`;
|
||||
case "creatureCreated": return `${e.controller} summons a ${e.kind.replace(/-/g, " ")}!`;
|
||||
case "creatureMoved": return null;
|
||||
case "creatureAttacked": return e.dieRoll != null ? `The troll swings (rolled ${e.dieRoll})!` : `The creature strikes!`;
|
||||
case "creatureTouched": return `The creature falls upon ${e.player}!`;
|
||||
case "creatureDamaged": return e.amount > 0 ? `The ${e.creatureId} takes ${e.amount} damage.` : `The attack has no effect on it.`;
|
||||
case "creatureAttacked": return e.dieRoll != null ? `The ${spellName(e.kind)} swings (rolled ${e.dieRoll})!` : `The ${spellName(e.kind)} strikes!`;
|
||||
case "creatureTouched": return `The ${spellName(e.kind)} falls upon ${e.player}!`;
|
||||
case "creatureDamaged": return e.amount > 0 ? `The ${spellName(e.kind)} takes ${e.amount} damage.` : `The attack has no effect on the ${spellName(e.kind)}.`;
|
||||
case "creatureDestroyed": return `The ${e.kind.replace(/-/g, " ")} is destroyed (${e.by})!`;
|
||||
case "trollRegenerated": return `The troll's stony hide knits itself back together.`;
|
||||
case "shadowUpkeep": return `The shadow drains its master (${e.lifeAfter} life left).`;
|
||||
|
||||
Reference in New Issue
Block a user