This should work?

This commit is contained in:
Seravy
2018-02-16 00:04:25 +01:00
parent f271c7a74e
commit 602f761552

View File

@@ -32,28 +32,6 @@ public class DestroyAi extends SpellAbilityAi {
final String logic = sa.getParam("AILogic"); final String logic = sa.getParam("AILogic");
boolean hasXCost = false; 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; CardCollection list;
if (abCost != null) { if (abCost != null) {
@@ -93,6 +71,28 @@ public class DestroyAi extends SpellAbilityAi {
return false; 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 // Targeting
if (abTgt != null) { if (abTgt != null) {
sa.resetTargets(); sa.resetTargets();