@Override public boolean apply(Game game, Ability source) { UUID targetId = source.getFirstTarget(); if (targetId != null) { StackObject stackObject = game.getStack().getStackObject(targetId); if (stackObject != null) { return stackObject.getStackAbility().getManaCostsToPay().getPayment().count() == 0; } } return false; } }
@Override public void watch(GameEvent event, Game game) { if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getZone() == Zone.HAND) { Spell spell = (Spell) game.getObject(event.getTargetId()); if (spell != null && this.getSourceId().equals(spell.getSourceId())) { payment = spell.getSpellAbility().getManaCostsToPay().getPayment(); } } if (event.getType() == GameEvent.EventType.ZONE_CHANGE && this.getSourceId().equals(event.getSourceId())) { if (((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD) { payment = null; } } }
@Override public boolean apply(Game game, Ability source) { if (source.getAbilityType() == AbilityType.SPELL) { return (source.getManaCostsToPay().getPayment().getColor(coloredManaSymbol) > 0); } ManaSpentToCastWatcher watcher = game.getState().getWatcher(ManaSpentToCastWatcher.class, source.getSourceId()); if (watcher != null) { Mana payment = watcher.getAndResetLastPayment(); if (payment != null) { return payment.getColor(coloredManaSymbol) > 0; } } return false; }
int amountBlack = source.getManaCostsToPay().getPayment().getBlack(); int amountRed = source.getManaCostsToPay().getPayment().getRed(); int amountWhite = source.getManaCostsToPay().getPayment().getWhite(); int amountGreen = source.getManaCostsToPay().getPayment().getGreen(); int amountBlue = source.getManaCostsToPay().getPayment().getBlue(); int amountColorless = source.getManaCostsToPay().getPayment().getColorless();
@Override public int calculate(Game game, Ability source, Effect effect) { int count = 0; if (!game.getStack().isEmpty()) { StackObject spell = game.getStack().getFirst(); if (spell instanceof Spell && ((Spell) spell).getSourceId().equals(source.getSourceId())) { Mana mana = ((Spell) spell).getSpellAbility().getManaCostsToPay().getPayment(); if (mana.getBlack() > 0) { count++; } if (mana.getBlue() > 0) { count++; } if (mana.getGreen() > 0) { count++; } if (mana.getRed() > 0) { count++; } if (mana.getWhite() > 0) { count++; } } } return count; }
@Override public boolean checkTrigger(GameEvent event, Game game) { if (game.getPlayer(this.getControllerId()).hasOpponent(event.getPlayerId(), game)) { Spell spell = game.getStack().getSpell(event.getTargetId()); if (spell != null && spell.getStackAbility().getManaCostsToPay().getPayment().count() == 0) { for (Effect effect : this.getEffects()) { effect.setTargetPointer(new FixedTarget(event.getTargetId())); } return true; } } return false; }