public static String destroyAllStackDescription( final AbilityFactory af, SpellAbility sa, boolean noRegen) { // when getStackDesc is called, just build exactly what is happening StringBuilder sb = new StringBuilder(); String name = af.getHostCard().getName(); String conditionDesc = af.getMapParams().get("ConditionDescription"); if (conditionDesc != null) sb.append(conditionDesc).append(" "); ArrayList<Card> tgtCards; Target tgt = af.getAbTgt(); if (tgt != null) tgtCards = tgt.getTargetCards(); else { tgtCards = new ArrayList<Card>(); tgtCards.add(sa.getSourceCard()); } sb.append(name).append(" - Destroy permanents"); if (noRegen) sb.append(". They can't be regenerated"); Ability_Sub abSub = sa.getSubAbility(); if (abSub != null) { sb.append(abSub.getStackDescription()); } return sb.toString(); }
private static String destroyStackDescription(final AbilityFactory af, SpellAbility sa) { final boolean noRegen = af.getMapParams().containsKey("NoRegen"); StringBuilder sb = new StringBuilder(); Card host = af.getHostCard(); String conditionDesc = af.getMapParams().get("ConditionDescription"); if (conditionDesc != null) sb.append(conditionDesc).append(" "); ArrayList<Card> tgtCards; Target tgt = af.getAbTgt(); if (tgt != null) tgtCards = tgt.getTargetCards(); else { tgtCards = AbilityFactory.getDefinedCards(sa.getSourceCard(), af.getMapParams().get("Defined"), sa); } if (sa instanceof Ability_Sub) sb.append(" "); else sb.append(host).append(" - "); sb.append("Destroy "); Iterator<Card> it = tgtCards.iterator(); while (it.hasNext()) { Card tgtC = it.next(); if (tgtC.isFaceDown()) sb.append("Morph ").append("(").append(tgtC.getUniqueNumber()).append(")"); else sb.append(tgtC); if (it.hasNext()) sb.append(", "); } if (noRegen) { sb.append(". "); if (tgtCards.size() == 1) sb.append("It"); else sb.append("They"); sb.append(" can't be regenerated"); } sb.append("."); Ability_Sub abSub = sa.getSubAbility(); if (abSub != null) { sb.append(abSub.getStackDescription()); } return sb.toString(); }
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); } }