use of mage.abilities.effects.common.CounterUnlessPaysEffect in project mage by magefree.
the class InvokePrejudiceEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
boolean result = true;
Spell spell = game.getStack().getSpell(getTargetPointer().getFirst(game, source));
if (spell != null) {
CounterUnlessPaysEffect effect = new CounterUnlessPaysEffect(new GenericManaCost(spell.getManaValue()));
effect.setTargetPointer(getTargetPointer());
result = effect.apply(game, source);
}
return result;
}
use of mage.abilities.effects.common.CounterUnlessPaysEffect in project mage by magefree.
the class RitesOfRefusalEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
int count = controller.discard(0, Integer.MAX_VALUE, false, source, game).size();
return new CounterUnlessPaysEffect(new GenericManaCost(3 * count)).apply(game, source);
}
use of mage.abilities.effects.common.CounterUnlessPaysEffect in project mage by magefree.
the class UnsettledMarinerTriggeredAbility method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (!game.getOpponents(getControllerId()).contains(event.getPlayerId())) {
return false;
}
Permanent permanent = game.getPermanent(event.getTargetId());
if ((permanent == null || !permanent.getControllerId().equals(getControllerId())) && !event.getTargetId().equals(getControllerId())) {
return false;
}
Effect effect = new CounterUnlessPaysEffect(new GenericManaCost(1));
effect.setTargetPointer(new FixedTarget(event.getSourceId(), game));
this.getEffects().clear();
this.addEffect(effect);
return true;
}
Aggregations