Skip to content

Resolve slow cantrip draws through a persisted upkeep trigger - #329

Merged
valzargaming merged 2 commits into
mainfrom
improve/delayed-upkeep-draw
Oct 20, 2026
Merged

valzargaming merged 2 commits into
mainfrom
improve/delayed-upkeep-draw

Conversation

@valzargaming

@valzargaming valzargaming commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Interpret exactly “Draw a card at the beginning of the next turn's upkeep” as a delayed one-shot draw, not an immediate draw or the draw step.
  • Schedule only during effect resolution; at the next turn's upkeep, promote it through the normal pending-trigger/stack system with its original controller. Copies schedule independently; countered/fizzled spells do not.
  • Persist scheduled draws with state format 3. Legacy v1/v2 states migrate with an empty queue; old builds reject v3 rather than silently dropping pending draws. No deployment is included.

Validation

  • Focused delayed behavior: 21 tests / 203 assertions passed on PHP8.4.24.
  • Exact final full suite with the local corpus: 694 tests / 102,667 assertions, zero skips, including 50 official-deck simulations.
  • Independent source and final-test review found no blocking findings.
  • Exact-head public CI passed PHP 8.3, 8.4, and 8.5: https://github.com/Valgorithms/DiscordPHP-MTGPocket/actions/runs/39399779264
  • Full Pint and whitespace checks passed.
  • Tests use only injected/local data. No live bot, Discord, or network tests.

The suite covers real Flare/Heal/Ray of Erasure/Pyknite/Carrier Pigeons, timing and response windows, APNAP recipients, source removal/recast/sacrifice, extra turns, skipped normal draws, counter/fizzle exclusions, saved pending schedules/stack triggers, no repeats, and malformed/legacy/future saved-state handling.

Corpus recognition (not full gameplay support)

Same hashed MTGJSON 5.3.0+20261019 corpus as #328:

  • All imported pools: 11,257 → 11,278 / 28,729 (39.3%), +21.
  • Modern: 9,517 → 9,520 / 22,399 (42.5%), +3.

This exact mandatory fixed-controller one-card clause composes only through otherwise supported effects. Optional draws, other recipients, multiple cards, “your next upkeep,” recurring draws, and unrestricted delayed effects remain unsupported. See docs/delayed-upkeep-draw.md for scope, persistence compatibility, and provenance. Overall coverage remains incomplete.

@valzargaming
valzargaming merged commit 710a47c into main Oct 20, 2026
4 checks 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.

1 participant