diff --git a/forge-ai/src/main/java/forge/ai/ability/DestroyAi.java b/forge-ai/src/main/java/forge/ai/ability/DestroyAi.java index 4051d3bd339..ae0c36e2c7d 100644 --- a/forge-ai/src/main/java/forge/ai/ability/DestroyAi.java +++ b/forge-ai/src/main/java/forge/ai/ability/DestroyAi.java @@ -32,28 +32,6 @@ public class DestroyAi extends SpellAbilityAi { final String logic = sa.getParam("AILogic"); boolean hasXCost = false; - // Ability that's intended to destroy own useless token to trigger Grave Pacts - // should be fired at end of turn or when under attack after blocking to make opponent sac something - boolean havepact = false; - for (Card cardInPlay : ai.getGame().getCardsIn(ZoneType.Battlefield)) { - if ((cardInPlay.getController().equals(ai)) - && ("Grave Pact".equals(cardInPlay.getName()))) { - havepact = true; - } - } - if (("Pactivator".equals(logic)) && (havepact)) { - if ( - (!ai.getGame().getPhaseHandler().isPlayerTurn(ai)) && - ((ai.getGame().getPhaseHandler().is(PhaseType.END_OF_TURN)) - || (ai.getGame().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS))) - && - (ai.getOpponents().get(0).getCreaturesInPlay().size() > 0) - ) { - sa.getTargetRestrictions().setMandatory(true); - return true; //ai.getController().chooseTargetsFor(sa); - } - } - CardCollection list; if (abCost != null) { @@ -93,6 +71,28 @@ public class DestroyAi extends SpellAbilityAi { return false; } + // Ability that's intended to destroy own useless token to trigger Grave Pacts + // should be fired at end of turn or when under attack after blocking to make opponent sac something + boolean havepact = false; + for (Card cardInPlay : ai.getGame().getCardsIn(ZoneType.Battlefield)) { + if ((cardInPlay.getController().equals(ai)) + && ("Grave Pact".equals(cardInPlay.getName()))) { + havepact = true; + } + } + if (("Pactivator".equals(logic)) && (havepact)) { + if ( + (!ai.getGame().getPhaseHandler().isPlayerTurn(ai)) && + ((ai.getGame().getPhaseHandler().is(PhaseType.END_OF_TURN)) + || (ai.getGame().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS))) + && + (ai.getOpponents().get(0).getCreaturesInPlay().size() > 0) + ) { + ai.getController().chooseTargetsFor(sa); + return true; + } + } + // Targeting if (abTgt != null) { sa.resetTargets();