diff --git a/Mage.Sets/src/mage/cards/h/HistoriansBoon.java b/Mage.Sets/src/mage/cards/h/HistoriansBoon.java index 6237f6d37c..26030bff42 100644 --- a/Mage.Sets/src/mage/cards/h/HistoriansBoon.java +++ b/Mage.Sets/src/mage/cards/h/HistoriansBoon.java @@ -1,6 +1,5 @@ package mage.cards.h; -import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility; import mage.abilities.common.SagaAbility; @@ -19,6 +18,7 @@ import mage.game.events.GameEvent; import mage.game.permanent.Permanent; import mage.game.permanent.token.AngelVigilanceToken; import mage.game.permanent.token.SoldierToken; +import mage.game.stack.StackObject; import mage.util.CardUtil; import java.util.UUID; @@ -74,13 +74,15 @@ class HistoriansBoonTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.ABILITY_TRIGGERED; + return event.getType() == GameEvent.EventType.TRIGGERED_ABILITY; } @Override public boolean checkTrigger(GameEvent event, Game game) { + StackObject stackObject = game.getStack().getStackObject(event.getTargetId()); Permanent permanent = game.getPermanent(event.getSourceId()); - if (permanent == null + if (stackObject == null + || permanent == null || !permanent.isControlledBy(getControllerId()) || !permanent.hasSubtype(SubType.SAGA, game)) { return false; @@ -90,8 +92,7 @@ class HistoriansBoonTriggeredAbility extends TriggeredAbilityImpl { .map(SagaAbility::getMaxChapter) .mapToInt(SagaChapter::getNumber) .sum(); - Ability ability = game.getAbility(event.getTargetId(), event.getSourceId()).orElse(null); - return SagaAbility.isFinalAbility(ability, maxChapter); + return SagaAbility.isFinalAbility(stackObject.getStackAbility(), maxChapter); } @Override diff --git a/Mage/src/main/java/mage/game/events/GameEvent.java b/Mage/src/main/java/mage/game/events/GameEvent.java index 0c56fbb1ea..c1352ef2f2 100644 --- a/Mage/src/main/java/mage/game/events/GameEvent.java +++ b/Mage/src/main/java/mage/game/events/GameEvent.java @@ -201,7 +201,6 @@ public class GameEvent implements Serializable { playerId player that tries to use this ability */ TRIGGERED_ABILITY, - ABILITY_TRIGGERED, RESOLVING_ABILITY, /* COPY_STACKOBJECT targetId id of the spell/ability to copy diff --git a/Mage/src/main/java/mage/players/PlayerImpl.java b/Mage/src/main/java/mage/players/PlayerImpl.java index d0065d1530..2587d1cd24 100644 --- a/Mage/src/main/java/mage/players/PlayerImpl.java +++ b/Mage/src/main/java/mage/players/PlayerImpl.java @@ -1524,12 +1524,6 @@ public abstract class PlayerImpl implements Player, Serializable { } } restoreState(bookmark, triggeredAbility.getRule(), game); // why restore is needed here? (to remove the triggered ability from the stack because of no possible targets) - GameEvent event = new GameEvent( - GameEvent.EventType.ABILITY_TRIGGERED, - ability.getId(), ability, ability.getControllerId() - ); - game.getState().setValue(event.getId().toString(), ability.getTriggerEvent()); - game.fireEvent(event); return false; }