[MAT] implemented Ob Nixilis, Captive Kingpin, refactored life lose and batches events (#11974)

This commit is contained in:
jimga150 2024-03-21 11:53:45 -04:00 committed by GitHub
parent 0987e01f92
commit 50c75f05bd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 424 additions and 2 deletions

View file

@ -808,6 +808,25 @@ public class GameState implements Serializable, Copyable<GameState> {
return !simultaneousEvents.isEmpty();
}
public void addSimultaneousLifeLossEventToBatches(LifeLostEvent lifeLossEvent, Game game) {
// Combine multiple life loss events in the single event (batch)
// see GameEvent.LOST_LIFE_BATCH
// existing batch
boolean isLifeLostBatchUsed = false;
for (GameEvent event : simultaneousEvents) {
if (event instanceof LifeLostBatchEvent) {
((LifeLostBatchEvent) event).addEvent(lifeLossEvent);
isLifeLostBatchUsed = true;
}
}
// new batch
if (!isLifeLostBatchUsed) {
addSimultaneousEvent(new LifeLostBatchEvent(lifeLossEvent), game);
}
}
public void addSimultaneousDamage(DamagedEvent damagedEvent, Game game) {
// Combine multiple damage events in the single event (batch)
// * per damage type (see GameEvent.DAMAGED_BATCH_FOR_PERMANENTS, GameEvent.DAMAGED_BATCH_FOR_PLAYERS)