Search in sources :

Example 1 with CopyTokenEffect

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

the class HomurasEssence2 method apply.

@Override
public boolean apply(Game game, Ability source) {
    Card sourceCard = game.getCard(source.getSourceId());
    Player controller = game.getPlayer(source.getControllerId());
    if (sourceCard != null && controller != null && game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD) {
        ContinuousEffect effect = new ConditionalContinuousEffect(new CopyTokenEffect(flipToken), FlippedCondition.instance, "");
        game.addEffect(effect, source);
        controller.moveCards(sourceCard, Zone.BATTLEFIELD, source, game);
        Permanent permanent = game.getPermanent(source.getSourceId());
        if (permanent != null) {
            // not complete correct because it should enter the battlefield flipped
            permanent.flip(game);
        }
        return true;
    }
    return false;
}
Also used : Player(mage.players.Player) FilterCreaturePermanent(mage.filter.common.FilterCreaturePermanent) Permanent(mage.game.permanent.Permanent) ContinuousEffect(mage.abilities.effects.ContinuousEffect) ConditionalContinuousEffect(mage.abilities.decorator.ConditionalContinuousEffect) CopyTokenEffect(mage.abilities.effects.common.CopyTokenEffect) ConditionalContinuousEffect(mage.abilities.decorator.ConditionalContinuousEffect) Card(mage.cards.Card)

Aggregations

ConditionalContinuousEffect (mage.abilities.decorator.ConditionalContinuousEffect)1 ContinuousEffect (mage.abilities.effects.ContinuousEffect)1 CopyTokenEffect (mage.abilities.effects.common.CopyTokenEffect)1 Card (mage.cards.Card)1 FilterCreaturePermanent (mage.filter.common.FilterCreaturePermanent)1 Permanent (mage.game.permanent.Permanent)1 Player (mage.players.Player)1