Skip to content

fix/urzas saga phase two nested quote#147

Merged
matthewevans merged 5 commits into
mainfrom
fix/urzas-saga-phase-two-nested-quote
May 3, 2026
Merged

fix/urzas saga phase two nested quote#147
matthewevans merged 5 commits into
mainfrom
fix/urzas-saga-phase-two-nested-quote

Conversation

@colin-riddell

@colin-riddell colin-riddell commented May 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix Urza's Saga chapter II creating a 0/0 Construct that immediately died to SBAs. Two cooperating bugs:

Parser (parser/oracle_effect/token.rs): extract_token_static_abilities only matched double-quoted spans. Chapter II's Oracle text nests the create-token
clause inside a double-quoted activated ability (This Saga gains "...with 'This token gets +1/+1...'"), so the inner ability uses single quotes — silently dropped,
leaving the Token effect's static_abilities field empty.

Added a structurally-anchored single-quote pass: open ' must follow with /and /or /, , close ' is the last ' in the text. That pairing rule keeps
internal apostrophes (can't, creature's) safe as content, never delimiter. Generalises to the whole class of nested grant-create-token-with-ability cards.

Engine (game/effects/token.rs): apply_create_token_after_replacement only wrote the spec's static abilities to live static_definitions, not
base_static_definitions. The layers reset at layers.rs:519 (obj.static_definitions = Arc::clone(&obj.base_static_definitions)) wiped the boost on every pass
before layer 7c could read it. The 0/0 Construct then died to CR 704.5f.

Mirrored the spec's static abilities onto base_static_definitions so the layers reset preserves them — same pattern already used for Role token statics at
token.rs:1326.

Test plan

  • Parser unit tests: extract_static_single_quoted_ability_with_apostrophe_content, extract_static_single_quoted_boost_by_count
  • Engine unit test: apply_create_token_mirrors_static_abilities_to_base
  • End-to-end integration test: chapter_two_construct_survives_sba_via_self_count_boost — activates the granted {2}, {T} ability, resolves it, asserts the
    Construct enters the battlefield as a 1/1 (counting itself) and survives SBAs
  • cargo test -p engine (6016 tests pass), cargo clippy -p engine --all-targets -- -D warnings, cargo fmt --all -- --check
  • Manual: load Urza's Saga, advance to chapter II, pay {2}{T}, confirm Construct token appears on the battlefield

@colin-riddell
colin-riddell marked this pull request as draft May 2, 2026 16:36
@colin-riddell
colin-riddell marked this pull request as ready for review May 3, 2026 09:33
@matthewevans
matthewevans merged commit f037ed3 into main May 3, 2026
3 checks passed
@matthewevans
matthewevans deleted the fix/urzas-saga-phase-two-nested-quote branch May 3, 2026 22:44
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