-
Notifications
You must be signed in to change notification settings - Fork 748
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
Add life lost event and batch event to implement Ob Nixilis, Captive Kingpin #11974
Add life lost event and batch event to implement Ob Nixilis, Captive Kingpin #11974
Conversation
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.
Looks reasonable enough, definitely should have some unit tests to confirm functionality though
Writing the tests. Intended tests i plan to hit (Let me know if there should be more):
|
.sum(); | ||
} | ||
|
||
public int getAmount(UUID targetID) { |
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.
Raname to getLifeLoseByPlayer
@@ -808,6 +808,25 @@ public boolean hasSimultaneousEvents() { | |||
return !simultaneousEvents.isEmpty(); | |||
} | |||
|
|||
public void addSimultaneousLifeLoss(LifeLostEvent lifeLossEvent, Game game) { |
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.
Current naming logic of all batch methods is wrong - it does not add real events to sim queue, only batches. So it must be renamed to addSimultaneousXxxEventToBatches - damaged, loseLife, tapped, etc.
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.
Going to rename just this function in this PR for now, unless youre good with renaming the rest in here.
} | ||
|
||
public boolean isCombatDamage() { | ||
return events.stream().anyMatch(LifeLostEvent::isCombatDamage); |
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.
Can be wrong usage. Related card must use events list or use method like getLifeLoseByCombatDamage(isCombatDamage::Boolaean) > 0, not isCombatDamage.
|
||
attack(2, playerD, "Memnite", playerA); | ||
|
||
setStopAt(2, PhaseStep.END_TURN); |
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.
Miss setStrictChooseMode before setstop/execute. It allows to check commands order and missing commands. Must be used all the time.
|
||
public class ObNixilisCaptiveKingpinTest extends CardTestCommander4Players { | ||
|
||
@Test |
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.
// - 1 opponent loses 2 life -> No trigger | ||
// - 2 opponents lose 1 life each -> Ob Nixilis triggers | ||
// - 2 opponents lose 2 life each -> No trigger | ||
// - controller loses 1 life -> No trigger |
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.
These are a good starting point. I'd like to see a couple more tests:
- opponent loses 1 life and another opponent simultaneously loses 2 life
- opponent loses 1 life and controller simultaneously loses 2 life
playerId, source, playerId, amount, atCombat); | ||
} | ||
|
||
public boolean isCombatDamage() { |
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.
this should be renamed same as the batch event for clarity
(also... is there existing card that cares about it? if not, maybe better to just remove entirely.)
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.
No, currently no card uses this, but its a short road to walk.
nice work though, this is great functionality to have in the engine, hopefully we can use it to fix some other longstanding bugs |
#10020
In order to get this card to work properly, i implemented a
LifeLostEvent
that gets batched intoLifeLostBatchEvent
, similar toDamagedBatchEvent
andDamagedEvent
. It looks like batching theLOST_LIFE
event is the only thing necessary to ensure this card sees all the triggers it should, since any form of damage, life paying costs, as well as "lose life" effects all fire theLOST_LIFE
event.So far i have playtested all of these with one and two opponents losing 1 and 2 or more life due to
The card seems to work as intended.