Search in sources :

Example 1 with PreventAllDamageByAllPermanentsEffect

use of mage.abilities.effects.common.PreventAllDamageByAllPermanentsEffect in project mage by magefree.

the class InquisitorsSnareEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent targetCreature = game.getPermanent(source.getFirstTarget());
    if (targetCreature != null) {
        FilterCreaturePermanent filter = new FilterCreaturePermanent();
        filter.add(new PermanentIdPredicate(targetCreature.getId()));
        game.addEffect(new PreventAllDamageByAllPermanentsEffect(filter, Duration.EndOfTurn, false), source);
        if (targetCreature.getColor(game).isBlack() || targetCreature.getColor(game).isRed()) {
            return targetCreature.destroy(source, game, false);
        }
    }
    return false;
}
Also used : PermanentIdPredicate(mage.filter.predicate.permanent.PermanentIdPredicate) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) Permanent(mage.game.permanent.Permanent) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) PreventAllDamageByAllPermanentsEffect(mage.abilities.effects.common.PreventAllDamageByAllPermanentsEffect)

Aggregations

PreventAllDamageByAllPermanentsEffect (mage.abilities.effects.common.PreventAllDamageByAllPermanentsEffect)1 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)1 PermanentIdPredicate (mage.filter.predicate.permanent.PermanentIdPredicate)1 Permanent (mage.game.permanent.Permanent)1