Search in sources :

Example 1 with DealsDamageToACreatureTriggeredAbility

use of mage.abilities.common.DealsDamageToACreatureTriggeredAbility in project mage by magefree.

the class CruelDeceiverEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    MageObject sourceObject = source.getSourceObject(game);
    if (controller != null && sourceObject != null) {
        Cards cards = new CardsImpl();
        Card card = controller.getLibrary().getFromTop(game);
        if (card != null) {
            cards.add(card);
            controller.revealCards(sourceObject.getIdName(), cards, game);
            if (card.isLand(game)) {
                game.addEffect(new GainAbilitySourceEffect(new DealsDamageToACreatureTriggeredAbility(new DestroyTargetEffect(true), false, false, true), Duration.EndOfTurn), source);
            }
        }
        return true;
    }
    return false;
}
Also used : Player(mage.players.Player) DealsDamageToACreatureTriggeredAbility(mage.abilities.common.DealsDamageToACreatureTriggeredAbility) GainAbilitySourceEffect(mage.abilities.effects.common.continuous.GainAbilitySourceEffect) DestroyTargetEffect(mage.abilities.effects.common.DestroyTargetEffect) MageObject(mage.MageObject)

Aggregations

MageObject (mage.MageObject)1 DealsDamageToACreatureTriggeredAbility (mage.abilities.common.DealsDamageToACreatureTriggeredAbility)1 DestroyTargetEffect (mage.abilities.effects.common.DestroyTargetEffect)1 GainAbilitySourceEffect (mage.abilities.effects.common.continuous.GainAbilitySourceEffect)1 Player (mage.players.Player)1