Skip to content

fix(parser): controller-scoped "you lost life this turn" intervening-if condition#4643

Merged
matthewevans merged 2 commits into
phase-rs:mainfrom
minion1227:minion_book_of_vile_darkness
Jun 30, 2026
Merged

fix(parser): controller-scoped "you lost life this turn" intervening-if condition#4643
matthewevans merged 2 commits into
phase-rs:mainfrom
minion1227:minion_book_of_vile_darkness

Conversation

@minion1227

Copy link
Copy Markdown
Contributor

Problem

The gained/lost-life intervening-if condition matrix was missing exactly one subject: the controller-scoped "you lost [N or more] life this turn". Opponent (parse_opponent_lost_life_this_turn) and any-player (parse_player_lost_life_this_turn) "lost life" parsed, and the controller gained sibling parsed too — but "you lost ..." silently dropped its condition (left None).

As a result, phase-trigger intervening-ifs such as The Book of Vile Darkness lost both the gate and their effect:

At the beginning of your end step, if you lost 2 or more life this turn, create a 2/2 black Zombie creature token.

Fix

Add parse_you_lost_life_this_turn as the exact mirror of parse_you_gained_life_this_turn, wired into parse_life_history_condition. It resolves via the existing QuantityRef::LifeLostThisTurn { player: Controller }no new variants. Handles both "you lost N or more life this turn" (≥ N) and the bare "you lost life this turn" (≥ 1) forms, plus the "you've lost ..." contraction.

CR 119.3 (life-total changes) + CR 603.4 (intervening-if).

Tests

Two inline parser regressions in oracle_trigger.rs:

  • trigger_if_you_lost_2_or_more_life — The Book of Vile Darkness; asserts condition LifeLostThisTurn{Controller} ≥ 2 and execute.is_some() (the dropped effect).
  • trigger_if_you_lost_life_this_turn_no_minimum — bare form → ≥ 1.

Both pass; engine compiles clean.

🤖 Generated with Claude Code

…if condition

The gained/lost x you/opponent/player condition matrix was missing exactly
one subject: the controller-scoped "you lost [N or more] life this turn".
Opponent and any-player "lost life" parsed, and controller "gained life"
parsed, but "you lost ..." silently dropped its condition (left None), so
phase-trigger intervening-ifs such as The Book of Vile Darkness ("if you lost
2 or more life this turn, create a 2/2 black Zombie") lost both the gate and
their effect.

Add parse_you_lost_life_this_turn as the mirror of
parse_you_gained_life_this_turn, wired into parse_life_history_condition.
Resolves via the existing QuantityRef::LifeLostThisTurn { Controller } — no
new variants.

CR 119.3 + CR 603.4.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@minion1227 minion1227 requested a review from matthewevans as a code owner June 30, 2026 11:53

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds the parse_you_lost_life_this_turn parser to crates/engine/src/parser/oracle_nom/condition.rs to handle conditions like 'you lost N or more life this turn' and 'you've lost life this turn'. This completes the controller-scoped mirror of the life-gained conditions, mapping to the existing LifeLostThisTurn quantity reference with PlayerScope::Controller. No review comments were provided, and the implementation conforms to the repository's architectural rules, so there is no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@matthewevans matthewevans self-assigned this Jun 30, 2026

@matthewevans matthewevans left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the updated head after the base-branch merge. The change is parser-only, at the existing life-history condition seam, reuses LifeLostThisTurn { Controller }, and covers both threshold and non-threshold intervening-if trigger forms. CI is pending; auto-merge will wait for required checks.

@matthewevans matthewevans added the bug Bug fix label Jun 30, 2026
@matthewevans matthewevans enabled auto-merge June 30, 2026 11:59
@matthewevans matthewevans removed their assignment Jun 30, 2026
@matthewevans matthewevans added this pull request to the merge queue Jun 30, 2026
@github-actions

Copy link
Copy Markdown

Parse changes introduced by this PR · 1 card(s), 1 signature(s) (baseline: main f071230fb970)

1 card(s) · trigger/Phase · field condition: life lost this turn (you) ≥ 2

Examples: The Book of Vile Darkness

2 card(s) had Oracle-text changes (errata/reprint) — excluded as non-parser.

Merged via the queue into phase-rs:main with commit 32577d5 Jun 30, 2026
11 checks passed
@minion1227 minion1227 deleted the minion_book_of_vile_darkness branch July 2, 2026 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants