magefree / mage

Magic Another Game Engine
http://xmage.today
MIT License
1.87k stars 767 forks source link

"Do A all X. Do Y for each thing A'ed this way" effects do not trigger in correct order #9273

Closed Alex-Vasile closed 1 year ago

Alex-Vasile commented 2 years ago

The draw effect is supposed to resolve after the destroy effect has. However many cards (see below) implement the two effects as a single one.

This means that cards destroyed by the first part will still be around and trigger off of the second part of the effect.

Originally reported for [[Decree of Pain]] destroying a [[Xyris, the Writhing Storm]] but Xyris still triggering off the draw and creating snakes. Confirmed with test.

Affected Cards https://scryfall.com/search?q=o%3A%22for+each+creature%22+o%3A%22this+way%22&unique=cards&as=grid&order=name

Original bug report: "Decree of pain not triggering properly. Effects of creatures are registering improperly- in, going off when no longer on the battlefield. Decree of Pain has two steps> kills creatures, then draws cards on how many creatures were killed. Example: xyris, the writhing storm is on the battlefield when decree is cast. 10 creatures died and 10 snakes were created- this should not occur, as xyris is already dead."

Alex-Vasile commented 2 years ago

Added test in e50e17efe7ccd823b49bb4c1631c89fe9f4e94d4.

xenohedron commented 1 year ago

Can fix by adding game.getState().processAction(game); where applicable