Search in sources :

Example 1 with GolemToken

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

the class CavalierOfDawnEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Permanent permanent = game.getPermanent(source.getFirstTarget());
    if (permanent == null) {
        return false;
    }
    Player player = game.getPlayer(permanent.getControllerId());
    permanent.destroy(source, game, false);
    if (player == null) {
        return false;
    }
    Effect effect = new CreateTokenTargetEffect(new GolemToken());
    effect.setTargetPointer(new FixedTarget(player.getId(), game));
    return effect.apply(game, source);
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) Permanent(mage.game.permanent.Permanent) TargetNonlandPermanent(mage.target.common.TargetNonlandPermanent) CreateTokenTargetEffect(mage.abilities.effects.common.CreateTokenTargetEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) ReturnFromGraveyardToHandTargetEffect(mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect) CreateTokenTargetEffect(mage.abilities.effects.common.CreateTokenTargetEffect) Effect(mage.abilities.effects.Effect) GolemToken(mage.game.permanent.token.GolemToken)

Aggregations

Effect (mage.abilities.effects.Effect)1 OneShotEffect (mage.abilities.effects.OneShotEffect)1 CreateTokenTargetEffect (mage.abilities.effects.common.CreateTokenTargetEffect)1 ReturnFromGraveyardToHandTargetEffect (mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect)1 Permanent (mage.game.permanent.Permanent)1 GolemToken (mage.game.permanent.token.GolemToken)1 Player (mage.players.Player)1 TargetNonlandPermanent (mage.target.common.TargetNonlandPermanent)1 FixedTarget (mage.target.targetpointer.FixedTarget)1