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

[OTC] Implement Felix Five-Boots #12074

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

PurpleCrowbar
Copy link
Member

No description provided.

@github-actions github-actions bot added the cards label Apr 5, 2024
@PurpleCrowbar
Copy link
Member Author

[[Felix Five-Boots]]

Copy link

github-actions bot commented Apr 5, 2024

Felix Five-Boots - (Gatherer) (Scryfall) (EDHREC)

{2}{B}{G}{U}
Legendary Creature — Ooze Rogue
5/4
Menace, ward {2}
If a creature you control dealing combat damage to a player causes a triggered ability of a permanent you control to trigger, that ability triggers an additional time.

@Susucre
Copy link
Contributor

Susucre commented Apr 6, 2024

Since this is to my knowledge the first card looking specifically at damage to player triggers, it could use a couple unit tests.

Aside from that (and the LKI comment, correct me if I'm wrong on that), seems good!


GameEvent sourceEvent = numberOfTriggersEvent.getSourceEvent();
if (sourceEvent == null
|| sourceEvent.getType() != GameEvent.EventType.DAMAGED_PLAYER
Copy link
Member

Choose a reason for hiding this comment

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

That’s wrong. There are other event types like batches.

See WaytaTrainerProdigy with same ability:

IMG_0148

Copy link
Member

Choose a reason for hiding this comment

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

Must use all player related events:

IMG_0149

Copy link
Member Author

Choose a reason for hiding this comment

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

@JayDi85 Are the changes made in 9d32bb0 what you had in mind?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, but it must process batches as BatchEvent. That's code will fail:

shot_240407_040807

Copy link
Member Author

Choose a reason for hiding this comment

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

Alright, my most recent commit doesn't fix the issue of the isCombatDamage check, because I'm not sure how to go about doing that. I do think it handles batch events in the sense that it goes through each creature involved in the batch until it reaches a valid one (tests pass and works fine in-game, so presumably fine?). I don't fully understand the necessity of using batches, as this card, unlike Umezawa's Jitte, has a pretty cut and dry condition ("deal combat damage to a player", as opposed to "deal combat damage", which raises multiple events). As a result, I can't think of how to write a test to ensure that this is actually working as intended, hence my lack of understanding as to its necessity. I also don't, as mentioned, know how to check that the damage dealt is combat damage.

@github-actions github-actions bot added the tests label Apr 7, 2024
@Susucre
Copy link
Contributor

Susucre commented Apr 7, 2024

Here is a version working with batches (I also set all tests to strict and fixed the choices):
master...Susucre:mage:felix-five-boots

I introduced a method to check a single DamagedEvent:
image

Then for batch events, look at all events inside, and any DamagedEvent is checked, if matching the condition, then the whole batch event matches the condition.
image

There is no longer need to filter on the batch event type. To be more abstract like that should be better if we ever add more types of batch damage events. Any Batch event containing at least one DamagedEvent matching the check will be affected by Felix's effect.

I didn't want to push directly on your work branch, but if that's good enough, you can cherry-pick the last commit of my branch above on top of your PR.

Edit: on second thought, there might still be a bugged behavior in my code:
If batch event contains events A B C and D;
If A & B match Felix condition, but the trigger ignores those and triggers due to C & D being there, Felix will falsely affect the trigger.
We might need some bigger change somewhere for triggers on batch events to expose exactly which subevent are relevant for them.

@PurpleCrowbar
Copy link
Member Author

Edit: on second thought, there might still be a bugged behavior in my code:
If batch event contains events A B C and D;
If A & B match Felix condition, but the trigger ignores those and triggers due to C & D being there, Felix will falsely affect the trigger.
We might need some bigger change somewhere for triggers on batch events to expose exactly which subevent are relevant for them.

Your current implementation still passes the batch event test you wrote at least, which I checked doesn't pass on my original implementation without batch handling, so definitely an improvement. I'd personally be happy to cherrypick that commit and get this merged unless you're unhappy with the possibility of broken edge-cases. I don't like the odds of me being able to figure out how to fix the problem you described and add it to this PR given my inexperience with batch events in general. This currently seems to work in the vast majority of cases

@Susucre
Copy link
Contributor

Susucre commented Apr 7, 2024

That would cause a bunch of weird bugs where Felix would double triggers it shouldn't affect.
Haven't yet thought how to handle those situations gracefully.
Ideally triggers on batch events should describe which part of the batch made them trigger.

Susucre
Susucre previously approved these changes Apr 9, 2024
Copy link
Contributor

@Susucre Susucre left a comment

Choose a reason for hiding this comment

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

Alright, I just can't come up with a case where the logic would fail with the current card pool (notably because you can't have different controller for creatures dealing combat damage to players in the same event)

So this might become an issue with batching in the future, just not here.

Unless someone else has a strong opinion on the subject, I think this one is good to merge.

Copy link
Contributor

@Susucre Susucre left a comment

Choose a reason for hiding this comment

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

Oh nevermind, just thought about this:

image

I have an idea of a refactor of batched triggers to solve this exposing which part of the batch event made it trigger.

@Susucre Susucre dismissed their stale review April 9, 2024 09:07

found a bugged case

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.

Failed test must be ignored in PR before merge - that’s use case is part of batch events improve from #12095. All other must be fine.

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

4 participants