Skip to content
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

Refactor: usage of getSourceObjectZoneChangeCounter must be removed from triggers #13137

Open
2 tasks
JayDi85 opened this issue Dec 14, 2024 · 0 comments
Open
2 tasks
Labels
bug Bugs and errors refactoring Developers topics about code and programming

Comments

@JayDi85
Copy link
Member

JayDi85 commented Dec 14, 2024

From #12180 (comment):

Ability::getSourceObjectZoneChangeCounter doesn't work inside checkTrigger cause trigger's zcc sync later in the code -- after checkTrigger call. It must be replaced by CardUtil.getActualSourceObjectZoneChangeCounter(game, source). Fix example: a970dc4

TODO:

  • main: check ~190 usages of getSourceObjectZoneChangeCounter and replace it in triggers (one short effects are fine);
  • optional: check same usages in continues/replacement effects -- maybe it's also affected and must be replaced;

Useful info, copied from #12180 (comment):

Object zcc and ability zcc are little different things:

  • Objects use dynamic zcc. Objects moves between zones and increments own zcc (it allow to simulate new object due mtg rules, but keep all settings and related data for work);
  • Abilities use static zcc. Abilities do not “move” with object and have own lifecycle:
    • activated abilities “creates” on real usage (on activate);
    • static abilities “creates” on game start (or new continues effect creates);

So ability zcc allow you to find out a moment of real ability’s usage (activating). And it actual for activated abilities only (use case example: trigger on etb, but source object left battlefield before resolve).

If you use ability zcc from continues effect like your use case - it can contains wrong data (continues effect exists all time until discarded).

@JayDi85 JayDi85 added bug Bugs and errors refactoring Developers topics about code and programming labels Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bugs and errors refactoring Developers topics about code and programming
Projects
None yet
Development

No branches or pull requests

1 participant