Need to remove triggers from game state when removing an ability from a permanent
- Dominant language
- Java
- Stars
- 2.4k
- Forks
- 940
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 160
Description
Existing TODO originally noted in #6585
When adding an ability to a permanent, if it's a triggered ability, it also gets added directly to the game state. This is necessary for triggering correctly when leaving the battlefield. However, the code that removes abilities from permanents doesn't account for this, but needs to. I noticed this very clearly with my initial mutate implementation in #14900, though after some simplification it turned out not to be needed. While the workaround in that circumstance was very simple, it's probably better to fix the underlying discrepancy if possible.
https://github.com/magefree/mage/blob/e3e948e33d660673b534717a6892c47315b3459f/Mage/src/main/java/mage/game/permanent/PermanentImpl.java#L464-L469
https://github.com/magefree/mage/blob/e3e948e33d660673b534717a6892c47315b3459f/Mage/src/main/java/mage/game/permanent/PermanentImpl.java#L479-L483
https://github.com/magefree/mage/blob/e3e948e33d660673b534717a6892c47315b3459f/Mage/src/main/java/mage/game/permanent/PermanentImpl.java#L499-L500
TriggeredAbilities has a method for removing all abilities from a particular source. But not currently a way to remove an arbitrary ability.
https://github.com/magefree/mage/blob/e3e948e33d660673b534717a6892c47315b3459f/Mage/src/main/java/mage/abilities/TriggeredAbilities.java#L320-L322
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.