public static void destroyAllResolve( final AbilityFactory af, final SpellAbility sa, final boolean noRegen) { HashMap<String, String> params = af.getMapParams(); String DrawBack = params.get("SubAbility"); Card card = sa.getSourceCard(); if (!AbilityFactory.checkConditional(params, sa)) { AbilityFactory.resolveSubAbility(sa); return; } String Valid = ""; if (params.containsKey("ValidCards")) Valid = params.get("ValidCards"); // Ugh. If calculateAmount needs to be called with DestroyAll it _needs_ to use the X variable // We really need a better solution to this if (Valid.contains("X")) Valid = Valid.replace("X", Integer.toString(AbilityFactory.calculateAmount(card, "X", sa))); CardList list = AllZoneUtil.getCardsInPlay(); list = list.getValidCards(Valid.split(","), card.getController(), card); boolean remDestroyed = params.containsKey("RememberDestroyed"); if (remDestroyed) card.clearRemembered(); if (noRegen) { for (int i = 0; i < list.size(); i++) if (AllZone.GameAction.destroyNoRegeneration(list.get(i)) && remDestroyed) card.addRemembered(list.get(i)); } else { for (int i = 0; i < list.size(); i++) if (AllZone.GameAction.destroy(list.get(i)) && remDestroyed) card.addRemembered(list.get(i)); } if (af.hasSubAbility()) { Ability_Sub abSub = sa.getSubAbility(); if (abSub != null) { abSub.resolve(); } else CardFactoryUtil.doDrawBack( DrawBack, 0, card.getController(), card.getController().getOpponent(), card.getController(), card, null, sa); } }
public static void destroyResolve(final AbilityFactory af, final SpellAbility sa) { HashMap<String, String> params = af.getMapParams(); String DrawBack = params.get("SubAbility"); final boolean noRegen = params.containsKey("NoRegen"); Card card = sa.getSourceCard(); if (!AbilityFactory.checkConditional(params, sa)) { AbilityFactory.resolveSubAbility(sa); return; } ArrayList<Card> tgtCards; Target tgt = af.getAbTgt(); if (tgt != null) tgtCards = tgt.getTargetCards(); else { tgtCards = AbilityFactory.getDefinedCards(sa.getSourceCard(), af.getMapParams().get("Defined"), sa); } for (Card tgtC : tgtCards) { if (AllZoneUtil.isCardInPlay(tgtC) && (tgt == null || CardFactoryUtil.canTarget(card, tgtC))) { if (noRegen) AllZone.GameAction.destroyNoRegeneration(tgtC); else AllZone.GameAction.destroy(tgtC); } } if (af.hasSubAbility()) { Ability_Sub abSub = sa.getSubAbility(); if (abSub != null) { abSub.resolve(); } else CardFactoryUtil.doDrawBack( DrawBack, 0, card.getController(), card.getController().getOpponent(), card.getController(), card, tgtCards.get(0), sa); } }