mage icon indicating copy to clipboard operation
mage copied to clipboard

Stalwart Successor trigger bug

Open xenohedron opened this issue 6 months ago • 11 comments

Stalwart Successor is bugged. It doesn't trigger when a non-token creature enters with counters

Originally posted by @padfoothelix in https://github.com/magefree/mage/pull/13473#discussion_r2063935290

xenohedron avatar May 29 '25 04:05 xenohedron

[[Stalwart Successor]]

xenohedron avatar May 29 '25 04:05 xenohedron

Stalwart Successor - (Gatherer) (Scryfall) (EDHREC)

{1}{B}{G} Creature — Human Warrior 3/2 Menace (This creature can't be blocked except by two or more creatures.) Whenever one or more counters are put on a creature you control, if it's the first time counters have been put on that creature this turn, put a +1/+1 counter on that creature.

github-actions[bot] avatar May 29 '25 04:05 github-actions[bot]

After a bit of manual testing, I believe this is due to the fact that when a nontoken creature enters with counters, that permanent is null when the COUNTERS_ADDED event occurs. The checkTrigger method therefore returns false and the effect doesn't apply.

padfoothelix avatar May 29 '25 15:05 padfoothelix

you must use game.getPermanentEntering(event.getTargetId()) to find entering permanent

JayDi85 avatar May 29 '25 15:05 JayDi85

There are many used of == GameEvent.EventType.COUNTERS_ADDED -- so it can be affected by entering token bug too.

Please report the buggy token/ability that cause buggy enter with counter (miss event). Default createToken code is fine and it add counters to existing permanent only, not entering:

Image

JayDi85 avatar May 29 '25 15:05 JayDi85

not actual below

well, I see potential problem due CreateTokenEffect rework in #12704 by @Grath -- now it contains multiple tokens list, but some code still use single token like apply method from above.

Not sure is it related or not, but must be research anyway.

Potentially buggy tokens that use withAdditionalTokens (if it enters with counters than can miss counter and add counter event too):

Image

JayDi85 avatar May 29 '25 15:05 JayDi85

Except the bug here is in NONtoken permanents entering the battlefield?

Grath avatar May 29 '25 15:05 Grath

Also withAdditionalTokens adds the tokens to lastAddedTokenIds so you're wrong that the apply code you found is bugged with my rework - it uses the same mechanisms for creating varied tokens as Chatterfang et al, which effects needed to be updated to support; it was just that there was no way for a CreateTokenEffect to specify that it was one instance of creating multiple different tokens.

Grath avatar May 29 '25 15:05 Grath

Ok, I see the reason -- it's by design. All permanents that come with used game.setEnterWithCounters will add counters on entering permanents, not real: Image

Image

So there are potentially ~30 places that must be checked, search by == GameEvent.EventType.COUNTERS_ADDED -- that code must use both getPermanent and getPermanentEntering search.

JayDi85 avatar May 29 '25 15:05 JayDi85

Good usage example: Image

JayDi85 avatar May 29 '25 15:05 JayDi85

Yes, that makes sense. The event is fired correctly, it's the abilities that check it need to account for entering permanents.

xenohedron avatar May 30 '25 01:05 xenohedron