@Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanentEntering(source.getSourceId()); if (permanent != null) { SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY); if (spellAbility != null && spellAbility.getSourceId().equals(source.getSourceId()) && permanent.getZoneChangeCounter(game) == spellAbility.getSourceObjectZoneChangeCounter()) { // TODO: No perfect solution because there could be other effects that allow to cast the card for this mana cost if (spellAbility.getManaCosts().getText().equals("{W}{U}{B}{R}{G}")) { permanent.addCounters(CounterType.P1P1.createInstance(2), source, game); } } } return true; }
@Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanentEntering(source.getSourceId()); if (permanent == null) { return false; } SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY); if (spellAbility == null || !spellAbility.getSourceId().equals(source.getSourceId()) || permanent.getZoneChangeCounter(game) != spellAbility.getSourceObjectZoneChangeCounter()) { return false; } int amount = spellAbility.getManaCostsToPay().getX(); if (amount > 0) { if (amount < 5) { permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game); } else { permanent.addCounters(CounterType.P1P1.createInstance(amount * 2), source, game); } } return true; }
@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; } }
@Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanentEntering(source.getSourceId()); Player controller = game.getPlayer(source.getControllerId()); if (permanent != null && controller != null) { SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY); if (spellAbility != null && spellAbility.getSourceId().equals(source.getSourceId()) && permanent.getZoneChangeCounter(game) == spellAbility.getSourceObjectZoneChangeCounter()) { int amount = spellAbility.getManaCostsToPay().getX(); if (amount > 0) { int total = 0; for (int roll = 0; roll < amount; roll++) { int thisRoll = controller.rollDice(game, 6); total += thisRoll; } permanent.addCounters(CounterType.P1P1.createInstance(total), source, game); } } return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent == null) { if (source.getAbilityType() == AbilityType.STATIC) { permanent = game.getPermanentEntering(source.getSourceId()); } } if (permanent != null) { SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY); if (spellAbility != null && spellAbility.getSourceId().equals(source.getSourceId()) && permanent.getZoneChangeCounter(game) == spellAbility.getSourceObjectZoneChangeCounter()) { if (spellAbility.getSourceId().equals(source.getSourceId())) { // put into play by normal cast int amount = spellAbility.getManaCostsToPay().getX(); if (amount > 0) { Counter counterToAdd = counter.copy(); counterToAdd.add(amount - counter.getCount()); List<UUID> appliedEffects = (ArrayList<UUID>) this.getValue("appliedEffects"); permanent.addCounters(counterToAdd, source, game, appliedEffects); } } } } return true; }