mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
* Howlpack Avenger - fixed game error on usage (#9781)
This commit is contained in:
parent
b632d89caa
commit
a648268c4c
6 changed files with 23 additions and 4 deletions
|
@ -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()
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -812,16 +812,19 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,4 +32,8 @@ public abstract class DamagedEvent extends GameEvent {
|
|||
public int getExcess() {
|
||||
return excess;
|
||||
}
|
||||
|
||||
public UUID getAttackerId() {
|
||||
return getSourceId();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue