diff --git a/Mage.Sets/src/mage/cards/h/HowlpackAvenger.java b/Mage.Sets/src/mage/cards/h/HowlpackAvenger.java index a7d28e4c4f..aae450a80c 100644 --- a/Mage.Sets/src/mage/cards/h/HowlpackAvenger.java +++ b/Mage.Sets/src/mage/cards/h/HowlpackAvenger.java @@ -15,6 +15,7 @@ import mage.constants.Duration; import mage.constants.SubType; import mage.constants.Zone; import mage.game.Game; +import mage.game.events.DamagedBatchEvent; import mage.game.events.DamagedPermanentBatchEvent; import mage.game.events.GameEvent; import mage.target.common.TargetAnyTarget; @@ -76,12 +77,12 @@ class HowlpackAvengerTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT; + return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT_BATCH; } @Override public boolean checkTrigger(GameEvent event, Game game) { - DamagedPermanentBatchEvent dEvent = (DamagedPermanentBatchEvent) event; + DamagedBatchEvent dEvent = (DamagedBatchEvent) event; int damage = dEvent .getEvents() .stream() diff --git a/Mage.Sets/src/mage/cards/o/OliviasAttendants.java b/Mage.Sets/src/mage/cards/o/OliviasAttendants.java index 52aa890a53..dd184f8825 100644 --- a/Mage.Sets/src/mage/cards/o/OliviasAttendants.java +++ b/Mage.Sets/src/mage/cards/o/OliviasAttendants.java @@ -81,7 +81,7 @@ class OliviasAttendantsTriggeredAbility extends TriggeredAbilityImpl { int amount = ((DamagedBatchEvent) event) .getEvents() .stream() - .filter(e -> e.getSourceId().equals(getSourceId())) + .filter(e -> e.getAttackerId().equals(this.getSourceId())) .mapToInt(GameEvent::getAmount) .sum(); if (amount < 1) { diff --git a/Mage/src/main/java/mage/abilities/common/DealsCombatDamageEquippedTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/DealsCombatDamageEquippedTriggeredAbility.java index aadf4e593d..db1c70de3d 100644 --- a/Mage/src/main/java/mage/abilities/common/DealsCombatDamageEquippedTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/DealsCombatDamageEquippedTriggeredAbility.java @@ -48,7 +48,7 @@ public class DealsCombatDamageEquippedTriggeredAbility extends TriggeredAbilityI .getEvents() .stream() .filter(DamagedEvent::isCombatDamage) - .filter(e -> e.getSourceId().equals(sourcePermanent.getAttachedTo())) + .filter(e -> e.getAttackerId().equals(sourcePermanent.getAttachedTo())) .mapToInt(GameEvent::getAmount) .sum(); if (amount < 1) { diff --git a/Mage/src/main/java/mage/game/GameState.java b/Mage/src/main/java/mage/game/GameState.java index 6f7c733bba..ef85216894 100644 --- a/Mage/src/main/java/mage/game/GameState.java +++ b/Mage/src/main/java/mage/game/GameState.java @@ -812,16 +812,19 @@ public class GameState implements Serializable, Copyable { } public void addSimultaneousDamage(DamagedEvent damagedEvent, Game game) { + // combine damages per type (player or permanent) boolean flag = false; for (GameEvent event : simultaneousEvents) { if ((event instanceof DamagedBatchEvent) && ((DamagedBatchEvent) event).getDamageClazz().isInstance(damagedEvent)) { + // old batch ((DamagedBatchEvent) event).addEvent(damagedEvent); flag = true; break; } } if (!flag) { + // new batch addSimultaneousEvent(DamagedBatchEvent.makeEvent(damagedEvent), game); } } diff --git a/Mage/src/main/java/mage/game/events/DamagedEvent.java b/Mage/src/main/java/mage/game/events/DamagedEvent.java index 36098c9610..40778542b7 100644 --- a/Mage/src/main/java/mage/game/events/DamagedEvent.java +++ b/Mage/src/main/java/mage/game/events/DamagedEvent.java @@ -32,4 +32,8 @@ public abstract class DamagedEvent extends GameEvent { public int getExcess() { return excess; } + + public UUID getAttackerId() { + return getSourceId(); + } } diff --git a/Mage/src/main/java/mage/game/events/GameEvent.java b/Mage/src/main/java/mage/game/events/GameEvent.java index 495a837a62..fba41fedf6 100644 --- a/Mage/src/main/java/mage/game/events/GameEvent.java +++ b/Mage/src/main/java/mage/game/events/GameEvent.java @@ -112,7 +112,12 @@ public class GameEvent implements Serializable { flag true = comabat damage - other damage = false */ DAMAGED_PLAYER, + + /* DAMAGED_PLAYER_BATCH + combines all player damaged events in one single event + */ DAMAGED_PLAYER_BATCH, + /* DAMAGE_CAUSES_LIFE_LOSS, targetId the id of the damaged player sourceId sourceId of the ability which caused the damage, can be null for default events like combat @@ -387,9 +392,15 @@ public class GameEvent implements Serializable { flag not used for this event */ OPTION_USED, + DAMAGE_PERMANENT, DAMAGED_PERMANENT, + + /* DAMAGED_PERMANENT_BATCH + combine all permanent damage events to single event + */ DAMAGED_PERMANENT_BATCH, + DESTROY_PERMANENT, /* DESTROY_PERMANENT_BY_LEGENDARY_RULE targetId id of the permanent to destroy