mirror of
https://github.com/correl/mage.git
synced 2024-11-28 19:19:55 +00:00
[DMC] Fix Historian's Boon. Remove unused and incorrectly-implemented EventType.ABILITY_TRIGGERED
This commit is contained in:
parent
59d99e5ba2
commit
a9cf4154e5
3 changed files with 6 additions and 12 deletions
|
@ -1,6 +1,5 @@
|
||||||
package mage.cards.h;
|
package mage.cards.h;
|
||||||
|
|
||||||
import mage.abilities.Ability;
|
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
|
||||||
import mage.abilities.common.SagaAbility;
|
import mage.abilities.common.SagaAbility;
|
||||||
|
@ -19,6 +18,7 @@ import mage.game.events.GameEvent;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.game.permanent.token.AngelVigilanceToken;
|
import mage.game.permanent.token.AngelVigilanceToken;
|
||||||
import mage.game.permanent.token.SoldierToken;
|
import mage.game.permanent.token.SoldierToken;
|
||||||
|
import mage.game.stack.StackObject;
|
||||||
import mage.util.CardUtil;
|
import mage.util.CardUtil;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -74,13 +74,15 @@ class HistoriansBoonTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkEventType(GameEvent event, Game game) {
|
public boolean checkEventType(GameEvent event, Game game) {
|
||||||
return event.getType() == GameEvent.EventType.ABILITY_TRIGGERED;
|
return event.getType() == GameEvent.EventType.TRIGGERED_ABILITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
|
StackObject stackObject = game.getStack().getStackObject(event.getTargetId());
|
||||||
Permanent permanent = game.getPermanent(event.getSourceId());
|
Permanent permanent = game.getPermanent(event.getSourceId());
|
||||||
if (permanent == null
|
if (stackObject == null
|
||||||
|
|| permanent == null
|
||||||
|| !permanent.isControlledBy(getControllerId())
|
|| !permanent.isControlledBy(getControllerId())
|
||||||
|| !permanent.hasSubtype(SubType.SAGA, game)) {
|
|| !permanent.hasSubtype(SubType.SAGA, game)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -90,8 +92,7 @@ class HistoriansBoonTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
.map(SagaAbility::getMaxChapter)
|
.map(SagaAbility::getMaxChapter)
|
||||||
.mapToInt(SagaChapter::getNumber)
|
.mapToInt(SagaChapter::getNumber)
|
||||||
.sum();
|
.sum();
|
||||||
Ability ability = game.getAbility(event.getTargetId(), event.getSourceId()).orElse(null);
|
return SagaAbility.isFinalAbility(stackObject.getStackAbility(), maxChapter);
|
||||||
return SagaAbility.isFinalAbility(ability, maxChapter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -201,7 +201,6 @@ public class GameEvent implements Serializable {
|
||||||
playerId player that tries to use this ability
|
playerId player that tries to use this ability
|
||||||
*/
|
*/
|
||||||
TRIGGERED_ABILITY,
|
TRIGGERED_ABILITY,
|
||||||
ABILITY_TRIGGERED,
|
|
||||||
RESOLVING_ABILITY,
|
RESOLVING_ABILITY,
|
||||||
/* COPY_STACKOBJECT
|
/* COPY_STACKOBJECT
|
||||||
targetId id of the spell/ability to copy
|
targetId id of the spell/ability to copy
|
||||||
|
|
|
@ -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)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue