-
Notifications
You must be signed in to change notification settings - Fork 808
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
Fix Wrathful Raptor's ability trigger #11961
Fix Wrathful Raptor's ability trigger #11961
Conversation
I agree that it would be cleaner to just use Also, rather than
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was thinking of adding a getTargetId()
Do not add it in batches, only single override here (event type). Old methods raise errors by design, so devs will see wrong usage on copy-pasted or typed code (batch contains multiple events, so it must be processed as a list).
} | ||
|
||
@Override | ||
public boolean checkTrigger(GameEvent event, Game game) { | ||
Permanent dinosaur = game.getPermanent(event.getTargetId()); | ||
Permanent dinosaur = game.getPermanent((UUID) CardUtil.getEventTargets(event).toArray()[0]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use stream.first.orelse(null), not arrays.
@xenohedron this probably got buried in your notifications but it looks like your review is the blocker on this issue currently. Wouldn't normally ping for this, but you just responded to my other new PR today |
Yeah, I manage quick turnarounds often, but sometimes I don't have time to get through everything until later. If it's been less than a week I most likely haven't forgotten. Anyway, I haven't had time to plan out how to improve the structure the batch event hierarchy yet. So I'm fine to approve this one, but rather than make similar changes by PR yet, can you first make an issue summarizing the scope of work? I'd prefer to tidy things up first so that the changes can be streamlined. |
Continuation of work done in #11841
This fixes wrathful raptor's custom ability so that it only triggers once when dealt damage simultaneously by multiple sources at the same time.
I intend to use the changes approved here as a template for fixing any cards or abilities that use DAMAGED_PERMANENT as a trigger when they should be using DAMAGED_BATCH_FOR_ONE_PERMANENT, like Arcbond and
DealtDamageAttachedTriggeredAbility
.Regarding fetching the target ID of the batch damage event: right now my usage of
(UUID) CardUtil.getEventTargets(event).toArray()[0]
feels a little spaghetti. I was thinking of adding agetTargetId()
getter forDamagedBatchForOnePermanentEvent
that would just call the former (or something equivalent) under the hood, since we can safely assume that the target ID list for this event should always be exactly one. It also has the added benefit of allowing people to just call the same getter as a single damage event since that makes sense intuitively to me. Thoughts?