-
-
Notifications
You must be signed in to change notification settings - Fork 113
fix(parser): close the sentence after an emblem's granted-ability quote (Nissa) #5465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
matthewevans
merged 3 commits into
phase-rs:main
from
dhgoal:fix/nissa-emblem-clause-split-5282
Jul 10, 2026
+110
−0
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
crates/engine/tests/integration/issue_5282_nissa_ultimate_emblem_search.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| //! Issue #5282 — Nissa, Who Shakes the World's [−8] ultimate must both create | ||
| //! an emblem AND let you search your library for Forest cards. | ||
| //! | ||
| //! The ultimate reads: | ||
| //! "You get an emblem with \"Lands you control have indestructible.\" Search | ||
| //! your library for any number of Forest cards, put them onto the battlefield | ||
| //! tapped, then shuffle." | ||
| //! | ||
| //! The emblem's granted static ends in a sentence-final close quote | ||
| //! (`indestructible."`). The clause splitter did not treat that close quote as a | ||
| //! sentence boundary, so the following "Search your library …" sentence was | ||
| //! glued onto the emblem clause and swallowed into the emblem's static text — | ||
| //! the ability never produced an `Effect::SearchLibrary`, so activating the | ||
| //! ultimate resolved without searching the library (the reported bug). | ||
| //! | ||
| //! This pins the fix: an emblem's sentence-ending close quote closes the | ||
| //! sentence, so the sibling search clause parses on its own and surfaces a | ||
| //! `SearchChoice` at resolution (CR 701.23). | ||
|
|
||
| use engine::game::scenario::{GameScenario, P0}; | ||
| use engine::types::card_type::CoreType; | ||
| use engine::types::counter::CounterType; | ||
| use engine::types::game_state::WaitingFor; | ||
| use engine::types::phase::Phase; | ||
|
|
||
| const NISSA_ORACLE: &str = "\ | ||
| Whenever you tap a Forest for mana, add an additional {G}.\n\ | ||
| [+1]: Put three +1/+1 counters on up to one target noncreature land you control. Untap it. It becomes a 0/0 Elemental creature with vigilance and haste that's still a land.\n\ | ||
| [−8]: You get an emblem with \"Lands you control have indestructible.\" Search your library for any number of Forest cards, put them onto the battlefield tapped, then shuffle."; | ||
|
|
||
| #[test] | ||
| fn nissa_who_shakes_the_world_ultimate_searches_library_for_forests() { | ||
| let mut scenario = GameScenario::new(); | ||
| scenario.at_phase(Phase::PreCombatMain); | ||
|
|
||
| let nissa = scenario | ||
| .add_creature(P0, "Nissa, Who Shakes the World", 0, 0) | ||
| .from_oracle_text(NISSA_ORACLE) | ||
| .id(); | ||
|
|
||
| // A Forest in the library gives the "any number of Forest cards" search a | ||
| // legal card to find. | ||
| let forest = scenario.add_card_to_library_top(P0, "Forest"); | ||
|
|
||
| let mut runner = scenario.build(); | ||
| { | ||
| let state = runner.state_mut(); | ||
| // CR 306.5b: a planeswalker's loyalty is its loyalty-counter count; seed | ||
| // 8 so the [−8] (CR 606.6: can't drop loyalty below 0) is legal. | ||
| let obj = state.objects.get_mut(&nissa).expect("nissa"); | ||
| obj.card_types.core_types = vec![CoreType::Planeswalker]; | ||
| obj.base_card_types = obj.card_types.clone(); | ||
| obj.loyalty = Some(8); | ||
| obj.counters.insert(CounterType::Loyalty, 8); | ||
|
|
||
| // Give the library card real Forest characteristics so the | ||
| // Typed[Land, Subtype(Forest)] search filter matches it. | ||
| let land = state.objects.get_mut(&forest).expect("forest"); | ||
| land.card_types.core_types = vec![CoreType::Land]; | ||
| land.card_types.subtypes = vec!["Forest".to_string()]; | ||
| land.base_card_types = land.card_types.clone(); | ||
| } | ||
|
|
||
| // Activate [−8]: ability index 1 ([+1] is index 0; the "Whenever you tap a | ||
| // Forest for mana" line is a triggered ability, not an activated one). | ||
| let outcome = runner.activate(nissa, 1).resolve(); | ||
|
|
||
| // CR 701.23: The ultimate's second sentence is a library search. Before the | ||
| // fix it was swallowed into the emblem's static text and no search ran, so | ||
| // the chain resolved straight to a priority window. With the fix the | ||
| // `Effect::SearchLibrary` resolves and the driver pauses on the interactive | ||
| // `SearchChoice` for the controller. | ||
| assert!( | ||
| matches!( | ||
| outcome.final_waiting_for(), | ||
| WaitingFor::SearchChoice { player, .. } if *player == P0 | ||
| ), | ||
| "Nissa's [−8] must search the library (surface SearchChoice); got {:?}", | ||
| outcome.final_waiting_for() | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.