Introduce new batch event for life lost for a specific player (#13071)

* Introduce new batch event for life lost for a specific player

closes #12202, fix #10805

* implement [DSC] Valgavoth, Harrower of Souls

* text fixes
This commit is contained in:
xenohedron 2024-11-19 23:41:34 -05:00 committed by GitHub
parent 95e986dee7
commit d6cf207a8b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 693 additions and 707 deletions

View file

@ -975,12 +975,17 @@ public class GameState implements Serializable, Copyable<GameState> {
// Combine multiple life loss events in the single event (batch)
// see GameEvent.LOST_LIFE_BATCH
// existing batch
// existing batchs
boolean isLifeLostBatchUsed = false;
boolean isSingleBatchUsed = false;
for (GameEvent event : simultaneousEvents) {
if (event instanceof LifeLostBatchEvent) {
((LifeLostBatchEvent) event).addEvent(lifeLossEvent);
isLifeLostBatchUsed = true;
} else if (event instanceof LifeLostBatchForOnePlayerEvent
&& event.getTargetId().equals(lifeLossEvent.getTargetId())) {
((LifeLostBatchForOnePlayerEvent) event).addEvent(lifeLossEvent);
isSingleBatchUsed = true;
}
}
@ -988,6 +993,9 @@ public class GameState implements Serializable, Copyable<GameState> {
if (!isLifeLostBatchUsed) {
addSimultaneousEvent(new LifeLostBatchEvent(lifeLossEvent), game);
}
if (!isSingleBatchUsed) {
addSimultaneousEvent(new LifeLostBatchForOnePlayerEvent(lifeLossEvent), game);
}
}
public void addSimultaneousTappedToBatch(TappedEvent tappedEvent, Game game) {