[codex] Implement Galarian Cursola Perish Body#248
Closed
RogerAngell99 wants to merge 1 commit intobcollazo:mainfrom
Closed
[codex] Implement Galarian Cursola Perish Body#248RogerAngell99 wants to merge 1 commit intobcollazo:mainfrom
RogerAngell99 wants to merge 1 commit intobcollazo:mainfrom
Conversation
Owner
|
Hey! I like the id-tracking. You are right, right now those switch to bench attacks dont take counterattacks apropriately. I have to think more about the Perish solution. I'd like if possible to have a simpler solution (one with less code). If you have ideas on how to make the solution need less code changes let me know! 🙌 Thanks for the tests also! |
Implement Galarian Cursola's Perish Body as a passive KO trigger driven by the damage/KO pipeline. This keeps the internal play ID tracking from the previous PR because it solves the counterattack identity bug the maintainer called out. The engine now assigns an internal ID to each Pokemon in play, preserves that ID through switches, retreats, and evolution, and clears it when the Pokemon leaves play. That lets effects target the original attacking Pokemon even after movement effects, for example Jumpluff ex using Breeze-By Attack to move to the Bench before Perish Body resolves. The Perish implementation is now smaller than the previous PR: instead of forecasting Perish Body branches in apply_action.rs, attack damage records a pending Perish trigger only when it actually makes an Active Galarian Cursola KO. The common mutation wrapper resolves that pending trigger with RNG after normal KO handling, finds the attacker by play ID, and KOs that exact instance if it is still in play. Add attack-sourced delayed/reactive damage metadata for the edge cases from the report. Mismagius's Cursed Prose and Alolan Sandslash's Spike Armor can now count as attack damage for Perish Body, while ordinary Tool damage, Ability damage, Poison/Burn checkup damage, and bench KOs do not trigger it. Will remains player-owned. The normal defensive Perish Body flip on the opponent's turn is not forced by Will from the previous turn, but same-turn attack-damage edge cases such as Spike Armor and Cursed Prose can consume the Cursola owner's pending Will and force heads. Perish Body stays passive: it is mapped as an AbilityMechanic, never generates UseAbility, and panics if called directly through the active ability path. Covered cases include direct lethal attack damage, bench non-trigger, non-attack damage bypasses, Rocky Helmet bypass, previous-turn Will bypass, Spike Armor, Cursed Prose, Cursed Prose target leaving Active, Jumpluff ex hit-and-run targeting, and Scizor/Gale Thrust-style extra attack damage.
6782495 to
1b5d1ce
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Implements
Galarian Cursola [A4a 035]Perish Body as a passive KO trigger based on attack-damage source tracking rather than only the current Active slot.This needed core engine support because Perish Body depends on the identity of the Pokemon that produced the attack damage, not just its current board position. For example, Jumpluff ex can deal lethal damage with Breeze-By Attack and then move to the Bench before KO resolution; on heads, Perish Body should KO that Jumpluff instance on the Bench, not the newly promoted Active Pokemon. The same identity tracking is needed for delayed or reactive attack damage such as Mismagius's Cursed Prose and Alolan Sandslash's Spike Armor.
What changed
AbilityMechanic::PerishBodymapping and kept it out ofUseAbilitygeneration.Validation
cargo +stable-x86_64-pc-windows-gnu test --features test-utils --test pokemon galarian_cursola_perish_bodycargo +stable-x86_64-pc-windows-gnu test --features test-utilscargo +stable-x86_64-pc-windows-gnu clippy --lib --features test-utils -- -D warningsBenchmarks were checked separately before this commit;
play random gameshowed no relevant regression versusorigin/main.