Skip to content

Add 'the Ring tempts you' trigger parser (CR 701.52a) - #981

Merged
matthewevans merged 3 commits into
phase-rs:mainfrom
Whovencroft:card/ring-tempts-you
May 24, 2026
Merged

Add 'the Ring tempts you' trigger parser (CR 701.52a)#981
matthewevans merged 3 commits into
phase-rs:mainfrom
Whovencroft:card/ring-tempts-you

Conversation

@Whovencroft

Copy link
Copy Markdown
Contributor

Summary

Wire 'whenever/when the Ring tempts you' in try_parse_named_trigger_mode using matches! (CR 701.52a). Same pattern as ChaosEnsues, SetInMotion, and CrankContraption.

Sets TriggerMode::RingTemptsYou — the matcher (match_ring_tempts_you) already exists and checks that the event player_id matches the source controller.

Unlocks Sméagol, Helpful Guide, Gandalf, Friend of the Shire, Ringwraiths, Galadriel of Lothlórien, Faramir, Field Commander, and Sauron, the Dark Lord (all gap_count=1).

Files changed

File Change
crates/engine/src/parser/oracle_trigger.rs Added matches! arm for `"whenever the ring tempts you"

Comprehensive Rules references

  • CR 701.52a — The Ring tempts you (Ring-temptation event)

Track

Non-developer (parser-only)

LLM

Claude (Anthropic) — medium thinking

Verification

  • cargo fmt --all — clean
  • bash scripts/check-parser-combinators.sh — pass
  • cargo check -p engine --tests — pass (0 errors)

Scope Expansion

None

Validation Failures

None

CI Failures

None (pre-push)

@github-actions github-actions Bot added ai-contribution PR opened via docs/AI-CONTRIBUTOR.md flow needs-maintainer AI-contribution PR requires human triage (Non-dev track or unresolved gaps) labels May 24, 2026

@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 support for parsing 'The Ring tempts you' triggers in the Oracle parser and includes unit tests for both 'When' and 'Whenever' variants. The review feedback correctly identifies a violation of architectural rule R1, which prohibits verbatim string matching for Oracle phrases. The reviewer recommends refactoring the parser to use modular nom combinators to maintain consistency and improve maintainability.

Comment on lines +5199 to +5204
// CR 701.52a: "Whenever the Ring tempts you" / "When the Ring tempts you" —
// the Ring temptation event fires once per temptation resolution.
if matches!(
lower,
"whenever the ring tempts you" | "when the ring tempts you"
) {

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.

medium

[MEDIUM] Verbatim string equality for Oracle phrase parsing. Rule R1 prohibits verbatim string matches (including matches! on full phrases) as they bypass the robust nom-based parser. Instead of matching the full phrase, decompose it into modular, reusable parsers for constituent parts (e.g., conjunctions and subjects) and compose them using combinators like alt and tuple to prevent combinatorial explosion and improve maintainability.

    // CR 701.52a: Decomposed parser for "Whenever/When the Ring tempts you"
    if all_consuming(tuple((
        alt((tag("whenever "), tag("when "))),
        tag("the ring tempts you"),
    )))
    .parse(lower).is_ok()
References
  1. Rule R1 prohibits verbatim string equality on full Oracle phrases for parsing dispatch, requiring decomposition into modular nom combinators. (link)

Wire 'whenever/when the Ring tempts you' in try_parse_named_trigger_mode
using matches! (same pattern as ChaosEnsues, SetInMotion, CrankContraption).

Sets TriggerMode::RingTemptsYou — the matcher (match_ring_tempts_you)
already exists and checks that the event player_id matches the source
controller.

Unlocks Sméagol Helpful Guide, Gandalf Friend of the Shire, Ringwraiths,
Galadriel of Lothlórien, Faramir Field Commander, and Sauron the Dark Lord
(all gap_count=1).

Unit tests: trigger_ring_tempts_you_whenever, trigger_ring_tempts_you_when.
@Whovencroft
Whovencroft force-pushed the card/ring-tempts-you branch from 77504d5 to 3394245 Compare May 24, 2026 07:21
@matthewevans matthewevans added status:ready-to-merge Maintainer-reviewed and ready to merge and removed needs-maintainer AI-contribution PR requires human triage (Non-dev track or unresolved gaps) labels May 24, 2026
@matthewevans
matthewevans merged commit 442c5f6 into phase-rs:main May 24, 2026
9 checks passed
@Whovencroft
Whovencroft deleted the card/ring-tempts-you branch May 25, 2026 03:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-contribution PR opened via docs/AI-CONTRIBUTOR.md flow status:ready-to-merge Maintainer-reviewed and ready to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants