Search in sources :

Example 1 with TargetCreatureOrPlaneswalker

use of mage.target.common.TargetCreatureOrPlaneswalker in project mage by magefree.

the class DeadlyVanityEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller == null) {
        return false;
    }
    TargetPermanent target = new TargetCreatureOrPlaneswalker();
    target.setNotTarget(true);
    controller.choose(outcome, target, source.getId(), game);
    FilterPermanent filter = new FilterCreatureOrPlaneswalkerPermanent();
    UUID targetId = target.getFirstTarget();
    if (targetId != null) {
        filter.add(Predicates.not(new PermanentIdPredicate(targetId)));
    }
    return new DestroyAllEffect(filter).apply(game, source);
}
Also used : PermanentIdPredicate(mage.filter.predicate.permanent.PermanentIdPredicate) Player(mage.players.Player) FilterPermanent(mage.filter.FilterPermanent) TargetCreatureOrPlaneswalker(mage.target.common.TargetCreatureOrPlaneswalker) TargetPermanent(mage.target.TargetPermanent) UUID(java.util.UUID) FilterCreatureOrPlaneswalkerPermanent(mage.filter.common.FilterCreatureOrPlaneswalkerPermanent) DestroyAllEffect(mage.abilities.effects.common.DestroyAllEffect)

Example 2 with TargetCreatureOrPlaneswalker

use of mage.target.common.TargetCreatureOrPlaneswalker in project mage by magefree.

the class FieryEncoreEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    if (player == null) {
        return false;
    }
    Card card = player.discardOne(false, false, source, game);
    player.drawCards(1, source, game);
    if (card == null || card.isLand(game)) {
        return true;
    }
    ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(new DamageTargetEffect(card.getManaValue()), false, "when you discard a nonland " + "card this way, {this} deals damage equal to that card's mana value to target creature or planeswalker");
    ability.addTarget(new TargetCreatureOrPlaneswalker());
    game.fireReflexiveTriggeredAbility(ability, source);
    return true;
}
Also used : Player(mage.players.Player) TargetCreatureOrPlaneswalker(mage.target.common.TargetCreatureOrPlaneswalker) ReflexiveTriggeredAbility(mage.abilities.common.delayed.ReflexiveTriggeredAbility) DamageTargetEffect(mage.abilities.effects.common.DamageTargetEffect) Card(mage.cards.Card)

Aggregations

Player (mage.players.Player)2 TargetCreatureOrPlaneswalker (mage.target.common.TargetCreatureOrPlaneswalker)2 UUID (java.util.UUID)1 ReflexiveTriggeredAbility (mage.abilities.common.delayed.ReflexiveTriggeredAbility)1 DamageTargetEffect (mage.abilities.effects.common.DamageTargetEffect)1 DestroyAllEffect (mage.abilities.effects.common.DestroyAllEffect)1 Card (mage.cards.Card)1 FilterPermanent (mage.filter.FilterPermanent)1 FilterCreatureOrPlaneswalkerPermanent (mage.filter.common.FilterCreatureOrPlaneswalkerPermanent)1 PermanentIdPredicate (mage.filter.predicate.permanent.PermanentIdPredicate)1 TargetPermanent (mage.target.TargetPermanent)1