Search in sources :

Example 6 with SpiritWhiteToken

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

the class GallowsAtWillowHillEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent permanent = game.getPermanent(this.getTargetPointer().getFirst(game, source));
    if (permanent != null) {
        Player controller = game.getPlayer(permanent.getControllerId());
        permanent.destroy(source, game, false);
        if (controller != null) {
            CreateTokenTargetEffect effect = new CreateTokenTargetEffect(new SpiritWhiteToken());
            effect.setTargetPointer(new FixedTarget(controller.getId()));
            effect.apply(game, source);
        }
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) FilterControlledPermanent(mage.filter.common.FilterControlledPermanent) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) TargetControlledPermanent(mage.target.common.TargetControlledPermanent) SpiritWhiteToken(mage.game.permanent.token.SpiritWhiteToken) CreateTokenTargetEffect(mage.abilities.effects.common.CreateTokenTargetEffect)

Example 7 with SpiritWhiteToken

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

the class KayaTheInexorableEffect method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
    if (zEvent.getTargetId().equals(this.getSourceId())) {
        this.getEffects().clear();
        this.addEffect(new KayaTheInexorableEffect(new MageObjectReference(zEvent.getTarget(), game)));
        this.addEffect(new CreateTokenEffect(new SpiritWhiteToken()));
        return true;
    }
    return false;
}
Also used : ZoneChangeEvent(mage.game.events.ZoneChangeEvent) SpiritWhiteToken(mage.game.permanent.token.SpiritWhiteToken) CreateTokenEffect(mage.abilities.effects.common.CreateTokenEffect) MageObjectReference(mage.MageObjectReference)

Example 8 with SpiritWhiteToken

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

the class AfterlifeEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent permanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
    if (permanent != null) {
        SpiritWhiteToken token = new SpiritWhiteToken();
        token.putOntoBattlefield(1, game, source, permanent.getControllerId());
    }
    return true;
}
Also used : Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) SpiritWhiteToken(mage.game.permanent.token.SpiritWhiteToken)

Aggregations

SpiritWhiteToken (mage.game.permanent.token.SpiritWhiteToken)8 Player (mage.players.Player)5 Permanent (mage.game.permanent.Permanent)3 UUID (java.util.UUID)2 Card (mage.cards.Card)2 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)2 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Objects (java.util.Objects)1 MageObjectReference (mage.MageObjectReference)1 Ability (mage.abilities.Ability)1 OneShotEffect (mage.abilities.effects.OneShotEffect)1 CreateTokenEffect (mage.abilities.effects.common.CreateTokenEffect)1 CreateTokenTargetEffect (mage.abilities.effects.common.CreateTokenTargetEffect)1 CardImpl (mage.cards.CardImpl)1 CardSetInfo (mage.cards.CardSetInfo)1 Cards (mage.cards.Cards)1 CardsImpl (mage.cards.CardsImpl)1 CardType (mage.constants.CardType)1