Skip to content

Enrich events with context available at creation time - #530

Merged
radar merged 2 commits into
masterfrom
pr10-enrich-event-context
Apr 23, 2026
Merged

Enrich events with context available at creation time#530
radar merged 2 commits into
masterfrom
pr10-enrich-event-context

Conversation

@radar

@radar radar commented Apr 23, 2026

Copy link
Copy Markdown
Owner

Summary

Several events were created with only the minimum data needed at the time, forcing ability handlers to query live game state after the fact. This PR adds fields that were already in scope at each event's creation site.

  • Events::CardDraw gains card — the Card object drawn from the library
  • Events::SpellCast gains x_value, flashback?, and targets
  • Events::EnteredTheBattlefield gains kicked?

Events::DamageDealt is left unchanged — enriching it with post-prevention damage requires a damage-prevention tracking system that doesn't exist yet.

All new fields have safe defaults so no existing call sites break. The changes are purely additive; no existing handler reads the new fields yet.

Test plan

  • All 534 existing tests pass unchanged

🤖 Generated with Claude Code

radar and others added 2 commits April 23, 2026 10:23
player.draw! already calls move_to_hand! internally. The library size
increase (7→14) is sufficient to prevent lose! firing during the draw step.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
CardDraw gains card, SpellCast gains x_value/flashback/targets, and
EnteredTheBattlefield gains kicked. All fields were already in scope at
their respective creation sites; adding them removes the need for handlers
to query live game state after the event fires.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@radar
radar merged commit 4b23016 into master Apr 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants