@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { for (Effect sourceEffect : sourceAbility.getEffects()) { if (sourceEffect instanceof DoIfCostPaid) { Cost doCosts = ((DoIfCostPaid) sourceEffect).getCost(); if (doCosts instanceof Costs) { Costs costs = (Costs) doCosts; for (Object cost : costs) { if (cost instanceof DiscardCardCost) { DiscardCardCost discardCost = (DiscardCardCost) cost; int cmc = 0; for (Card card : discardCost.getCards()) { cmc += card.getConvertedManaCost(); } return cmc; } } } } } return 0; }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { DiscardCardCost cost = (DiscardCardCost) source.getCosts().get(0); if (cost != null) { List<Card> cards = cost.getCards(); if (cards.size() == 1 && cards.get(0).isLand()) { Effect effect = new DamageTargetEffect(2); effect.setTargetPointer(getTargetPointer()); effect.apply(game, source); } } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { int damageToDeal = 2; outerloop: for (Cost cost : source.getCosts()) { if (cost instanceof DiscardCardCost) { for (Card card : ((DiscardCardCost) cost).getCards()) { if (card.getColor(game).isMulticolored()) { damageToDeal = 4; break outerloop; } } } } return new DamageTargetEffect(damageToDeal).apply(game, source); } }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { DiscardCardCost cost = (DiscardCardCost) source.getCosts().get(0); if (cost != null) { List<Card> cards = cost.getCards(); if (cards.size() == 1 && cards.get(0).isLand()) { Effect effect = new AddCountersTargetEffect(CounterType.BOUNTY.createInstance()); effect.setTargetPointer(getTargetPointer()); effect.apply(game, source); } else { player.drawCards(2, game); } } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent == null && source.getAbilityType() == AbilityType.STATIC) { permanent = game.getPermanentEntering(source.getSourceId()); } if (controller != null && permanent != null) { SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY); if (spellAbility != null && spellAbility.getSourceId().equals(source.getSourceId()) && permanent.getZoneChangeCounter(game) == spellAbility.getSourceObjectZoneChangeCounter()) { int cmc = 0; for (Cost cost : spellAbility.getCosts()) { if (cost instanceof DiscardCardCost && !((DiscardCardCost) cost).getCards().isEmpty()) { cmc = ((DiscardCardCost) cost).getCards().get(0).getConvertedManaCost(); } if (cmc > 0) { return new AddCountersSourceEffect(CounterType.P1P1.createInstance(cmc), true).apply(game, source); } } } return true; } return false; } }