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

Rework more Prevention Effects involving counters. Add [PIP] Bloatfly Swarm #12205

Merged
merged 7 commits into from
May 23, 2024

Conversation

Susucre
Copy link
Contributor

@Susucre Susucre commented Apr 30, 2024

So this PR started simply on implementing [PIP] Bloatfly Swarm

But I did realize quickly the previous work on Phantom creatures needed to be combined with some others replacement effect. So here is the rework, with the card on top.

@Susucre
Copy link
Contributor Author

Susucre commented May 1, 2024

Apart for the line break, everything has been addressed.

@xenohedron
Copy link
Contributor

Perhaps @JayDi85 has a better idea for [[Magma Pummeler]]? Everything else in this PR looks good.

Copy link

github-actions bot commented May 4, 2024

Magma Pummeler - (Gatherer) (Scryfall) (EDHREC)

{X}{R}{R}
Creature — Elemental
0/0
Magma Pummeler enters the battlefield with X +1/+1 counters on it.
If damage would be dealt to Magma Pummeler while it has a +1/+1 counter on it, prevent that damage and remove that many +1/+1 counters from it. When one or more counters are removed from Magma Pummeler this way, it deals that much damage to any target.

Copy link
Member

@JayDi85 JayDi85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, forget to publish review. See detailed comment about SubAbilities - it can’t be used such way and must be reworked to game state values.

@Susucre
Copy link
Contributor Author

Susucre commented May 20, 2024

I gave Magma Pummeler another look, using a ReflectiveTriggeredAbility this time (but there still need some ad hoc workaround as we need 1 trigger result of multiple prevention occuring at the same time).
If that is still not clean enough, I'll make it as broken as the current master way by copying some of the old and bugged code, in order to merge all the other improvements this PR adds. Magma Pummeler is the only weird card among the involved ones.

Copy link
Contributor

@xenohedron xenohedron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the new technique for Magma Pummeler.

this.fireEvent(GameEvent.getEvent(GameEvent.EventType.OPTION_USED, source.getOriginalId(), source, source.getControllerId()));
GameEvent event = GameEvent.getEvent(GameEvent.EventType.OPTION_USED, source.getOriginalId(), source, source.getControllerId());
if (fireAsSimultaneousEvent) {
this.getState().addSimultaneousEvent(event, this);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smells bed. Reflexive trigger fires immediately due rules. Why you need to change it to simulate normal trigger?

Copy link
Member

@JayDi85 JayDi85 May 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

603.12a Normally, if the trigger event or events occur multiple times during the resolution of the spell or ability that created it, the reflexive triggered ability will trigger once for each of those times. However, if a resolving spell or ability includes a choice to pay a cost “any number of times” and creates a triggered ability that triggers “when [a player] pays [that cost] one or more times,” paying that cost one or more times causes the reflexive triggered ability to trigger only once.

OPTION_USED need to execute it immediately.

If your use case generates multiple reflexive triggers then must execute only once (see rules above). So that’s looks like a game engine bug and simultaneous event must be used in all reflexive triggers.

Copy link
Member

@JayDi85 JayDi85 May 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Must be a workable test (it’s not covered by swarm tests):

If an amount of damage would be dealt to Magma Pummeler greater than the number of +1/+1 counters on it, all of that damage is prevented, and all of those counters are removed. In most cases, this will result in Magma Pummeler having 0 toughness, so it will be put into its owner's graveyard. Its reflexive triggered ability still triggers and it will still deal that much damage to any target.
(2021-11-19)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smells bed. Reflexive trigger fires immediately due rules. Why you need to change it to simulate normal trigger?

It's still a reflexive trigger and it is fired at the appropriate time. Simultaneous event used for batching. There is no batch for replacement events, so this is necessary for Magma Pummeler to function correctly (it must only fire after all simultaneous replacements have been processed).

(Whether all reflexive triggers should fire as simultaneous events is a separate question but a larger scope than this PR)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anyway magma die use case must be covered by test (see above)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, added 2 tests, dealing more than the amount of removed counters was never the issue there.

And xeno's answer is on point, the reflexive is created with first replacement effect, but there might be more simultaneous ones waiting, and we can't fire the event triggering the reflexive effect until all are done. Using the simultaneousEvent queue does delay the firing trigger until after all replacement are done.

A full rework of prevention effect could in theory wait for them all before firing resulting reflexive trigger, but that's huge amount of work, and probably not worth it for the single Pummeler card. The ad hoc solution here works.

@Susucre Susucre merged commit bcff245 into magefree:master May 23, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants