Skip to content

Add Baldin toughness damage static - #3147

Merged
matthewevans merged 1 commit into
phase-rs:mainfrom
jason020818:codex/add-baldin-toughness-damage
Jun 13, 2026
Merged

Add Baldin toughness damage static#3147
matthewevans merged 1 commit into
phase-rs:mainfrom
jason020818:codex/add-baldin-toughness-damage

Conversation

@jason020818

Copy link
Copy Markdown
Contributor

Summary

Adds the missing turn-gated form for Doran-style toughness combat damage statics:

  • parses During your turn, each creature assigns combat damage equal to its toughness rather than its power.
  • reuses the existing parse_assigns_damage_from_toughness path and attaches StaticCondition::DuringYourTurn
  • covers Baldin, Century Herdmaster without adding a new runtime primitive or generated card data

Rules / implementation notes

  • CR 510.1c: combat damage assignment is the rule axis affected by the existing AssignDamageFromToughness modification.
  • CR 611.3a: the static ability's continuous effect applies while its condition is true.
  • This keeps the change scoped to the existing parser/condition composition instead of adding a separate Baldin-specific mode.

Validation

  • cargo fmt --all
  • ./scripts/check-parser-combinators.sh
  • cargo test -p engine static_assigns_damage_from_toughness_all_creatures_during_your_turn --lib
  • cargo test -p engine static_assigns_damage_from_toughness --lib
  • temp oracle-gen --filter 'Baldin, Century Herdmaster' export
  • temp coverage-report over that filtered export showed Baldin, Century Herdmaster as supported=true, gap_count=0

@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 static abilities that apply toughness-based combat damage specifically during the controller's turn, along with a corresponding unit test. The review feedback correctly points out that the implementation violates repository style guidelines by using fragile verbatim string matching instead of modular nom-based combinators, and by omitting mandatory Comprehensive Rules (CR) annotations.

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.

Comment on lines +695 to +702
if let Some(rest_tp) = nom_tag_tp(&tp, "during your turn, ") {
if let Some(def) = parse_assigns_damage_from_toughness(rest_tp.lower, rest_tp.original) {
return Some(
def.condition(StaticCondition::DuringYourTurn)
.description(text.to_string()),
);
}
}

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.

high

[HIGH] Missing mandatory CR annotation for new game-rule parser dispatch, and usage of fragile verbatim string matching for Oracle phrases.

Why it matters:

  1. Every rules-touching line of engine code must carry a verified CR <number>: <description> comment to ensure strict fidelity to the MTG Comprehensive Rules.
  2. Verbatim string equality (like matching "during your turn, " directly) bypasses the robust nom-based parser, creating fragile matches. Compound phrases should be decomposed into modular, reusable parsers.

Suggested fix: Add CR 510.1c and CR 611.3a annotations, and refactor the parser to use modular combinators instead of verbatim string matching.

    // CR 510.1c: Doran-class effects that cause creatures to use toughness for combat damage.
    // CR 611.3a: A continuous effect applies while its condition is true.
    if let Ok((rest, cond)) = parse_condition(&tp) {
        if let Some(def) = parse_assigns_damage_from_toughness(rest.lower, rest.original) {
            return Some(
                def.condition(cond)
                    .description(text.to_string()),
            );
        }
    }
References
  1. Rule R6: Every rules-touching line of engine code must carry a comment of the form CR <number>: <description>. (link)
  2. Avoid verbatim string equality for parsing Oracle phrases as it bypasses the robust nom-based parser and creates fragile matches. Instead, decompose compound phrases into modular, reusable parsers for constituent parts and compose them using idiomatic combinator aggregates.

@matthewevans matthewevans added the enhancement New feature or request label Jun 13, 2026
@matthewevans matthewevans self-assigned this Jun 13, 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.

Approved. This is the right seam for the Baldin wording: it reuses the existing Doran-class AssignDamageFromToughness static and composes the during-your-turn condition axis around that parser instead of adding a new runtime primitive. I verified CR 510.1c / CR 611.3a against docs/MagicCompRules.txt, checked the coverage-data wording, and ran the focused toughness-damage parser tests locally; GitHub CI is also green.

For future PRs, please sync with origin/main before opening/updating and use the /engine-implementer skill for non-trivial parser or engine work so the plan, implementation, and review all stay aligned with the project architecture.

@matthewevans
matthewevans added this pull request to the merge queue Jun 13, 2026
@matthewevans matthewevans removed their assignment Jun 13, 2026
@jason020818
jason020818 force-pushed the codex/add-baldin-toughness-damage branch from f81cfaf to 09b8025 Compare June 13, 2026 15:35
Merged via the queue into phase-rs:main with commit 1c14b91 Jun 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants