private boolean hasTapCost(Ability ability) { for (Cost cost : ability.getCosts()) { if (cost instanceof TapSourceCost) { return true; } } return false; }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { for (Cost cost : sourceAbility.getCosts()) { if (cost instanceof RevealTargetFromHandCost) { return ((RevealTargetFromHandCost) cost).getNumberRevealedCards(); } } return 0; }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { for (Cost cost : sourceAbility.getCosts()) { if (cost instanceof RemoveVariableCountersSourceCost) { return ((RemoveVariableCountersSourceCost) cost).getAmount(); } } return 0; }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { for (Cost cost : sourceAbility.getCosts()) { if (cost instanceof PayVariableLoyaltyCost) { return ((PayVariableLoyaltyCost) cost).getAmount(); } } return 0; }
@Override public int calculate(Game game, Ability source, Effect effect) { int count = 0; for (Cost cost : source.getCosts()) { if (cost instanceof VishKalBloodArbiterCost) { count += ((VishKalBloodArbiterCost) cost).getAmount(); } } return count; }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { for (Cost cost : sourceAbility.getCosts()) { if (cost instanceof PayVariableLoyaltyCost) { return ((PayVariableLoyaltyCost) cost).getAmount(); } } return 0; }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { for (Cost cost : sourceAbility.getCosts()) { if (cost instanceof SacrificeTargetCost) { SacrificeTargetCost sacrificeCost = (SacrificeTargetCost) cost; return sacrificeCost.getPermanents() .stream().mapToInt(p -> p.getPower().getValue()).sum(); } } return 0; }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { for (Cost cost : sourceAbility.getCosts()) { if (cost instanceof SacrificeTargetCost) { SacrificeTargetCost sacrificeCost = (SacrificeTargetCost) cost; return sacrificeCost.getPermanents().stream().mapToInt(p -> p.getToughness().getValue()).sum(); } } return 0; }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { int amount = 0; for (VariableCost cost : sourceAbility.getCosts().getVariableCosts()) { amount += cost.getAmount(); } return amount; }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { int amount = 0; for (VariableCost cost : sourceAbility.getCosts().getVariableCosts()) { amount += cost.getAmount(); } return 2 * amount; }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { int xValue = sourceAbility.getManaCostsToPay().getX(); for (Cost cost : sourceAbility.getCosts()) { if (cost instanceof DiscardXTargetCost) { xValue = ((DiscardXTargetCost) cost).getAmount(); } } return xValue; }
@Override public void adjustCosts(Ability ability, Game game) { int numTargets = ability.getTargets().get(0).getTargets().size(); if (numTargets > 0) { ability.getCosts().add(new PayLifeCost(numTargets * 3)); } } }
@Override public boolean apply(Game game, Ability source) { RevealTargetFromHandCost cost = (RevealTargetFromHandCost) source.getCosts().get(0); if (cost != null) { Player player = game.getPlayer(source.getControllerId()); int CMC = cost.convertedManaCosts; if (player != null) { player.gainLife(CMC, game, source); } } return true; }
@Override public boolean apply(Game game, Ability source) { for (Cost cost : source.getCosts()) { if (cost instanceof SacrificeTargetCost) { UUID targetId = cost.getTargets().getFirstTarget(); Permanent permanent = game.getPermanentOrLKIBattlefield(targetId); if (filter.match(permanent, game)) { return true; } } } return false; }
@Override public void adjustTargets(Ability ability, Game game) { Target target = new TargetPermanent(ability.getCosts().getVariableCosts().get(0).getAmount(), new FilterAttackingCreature()); ability.addTarget(target); } }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { Card sourceCard = game.getCard(sourceAbility.getSourceId()); if (sourceCard != null) { for (Object cost : sourceAbility.getCosts()) { if (cost instanceof SacrificeTargetCost) { Permanent p = (Permanent) game.getLastKnownInformation(((SacrificeTargetCost) cost).getPermanents().get(0).getId(), Zone.BATTLEFIELD); return -1 * p.getPower().getValue(); } } } return 0; }
@Override public boolean apply(Game game, Ability source) { NecromancersStockpileDiscardTargetCost cost = (NecromancersStockpileDiscardTargetCost) source.getCosts().get(0); if (cost != null && cost.isZombieCard()) { new CreateTokenEffect(new ZombieToken(), 1, true, false).apply(game, source); } return true; }
@Override public boolean apply(Game game, Ability source, Ability abilityToModify) { for (Cost cost : abilityToModify.getCosts()) { if (cost instanceof SacrificeTargetCost) { SacrificeTargetCost sacrificeCost = (SacrificeTargetCost) cost; Filter filter = sacrificeCost.getTargets().get(0).getFilter(); filter.add(Predicates.not(new CardTypePredicate(CardType.CREATURE))); } } return true; }
@Override public void adjustTargets(Ability ability, Game game) { int amount = 0; for (Cost cost : ability.getCosts()) { if (cost instanceof RevealVariableBlackCardsFromHandCost) { amount = ((VariableCost) cost).getAmount(); } } ability.getTargets().clear(); ability.addTarget(new TargetCardInASingleGraveyard(0, amount, new FilterCard())); } }
@Override public void adjustTargets(Ability ability, Game game) { int value = 0; for (VariableCost cost : ability.getCosts().getVariableCosts()) { value = cost.getAmount(); } FilterCreaturePermanent filterCreaturePermanent = new FilterCreaturePermanent("creature with power " + value + " or less"); filterCreaturePermanent.add(new PowerPredicate(ComparisonType.FEWER_THAN, value + 1)); ability.getTargets().clear(); ability.addTarget(new TargetCreaturePermanent(filterCreaturePermanent)); } }