Search in sources :

Example 11 with ZombieToken

use of mage.game.permanent.token.ZombieToken in project mage by magefree.

the class CellarDoorEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getFirstTarget());
    if (player != null && player.getLibrary().hasCards()) {
        Card card = player.getLibrary().removeFromBottom(game);
        if (card != null) {
            player.moveCards(card, Zone.GRAVEYARD, source, game);
            if (card.isCreature(game)) {
                ZombieToken token = new ZombieToken();
                token.putOntoBattlefield(1, game, source, source.getControllerId());
            }
        }
        return true;
    }
    return false;
}
Also used : TargetPlayer(mage.target.TargetPlayer) Player(mage.players.Player) ZombieToken(mage.game.permanent.token.ZombieToken) Card(mage.cards.Card)

Aggregations

ZombieToken (mage.game.permanent.token.ZombieToken)11 Player (mage.players.Player)11 UUID (java.util.UUID)5 Permanent (mage.game.permanent.Permanent)5 TargetPlayer (mage.target.TargetPlayer)4 Effect (mage.abilities.effects.Effect)3 OneShotEffect (mage.abilities.effects.OneShotEffect)3 TargetControlledCreaturePermanent (mage.target.common.TargetControlledCreaturePermanent)3 HashSet (java.util.HashSet)2 AttachEffect (mage.abilities.effects.common.AttachEffect)2 CreateTokenEffect (mage.abilities.effects.common.CreateTokenEffect)2 CreateTokenTargetEffect (mage.abilities.effects.common.CreateTokenTargetEffect)2 Card (mage.cards.Card)2 Cards (mage.cards.Cards)2 CardsImpl (mage.cards.CardsImpl)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 AddCountersSourceEffect (mage.abilities.effects.common.counter.AddCountersSourceEffect)1 FilterCard (mage.filter.FilterCard)1 FilterControlledCreaturePermanent (mage.filter.common.FilterControlledCreaturePermanent)1