Search in sources :

Example 1 with WarriorToken

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

the class MarduCharmCreateTokenEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
        CreateTokenEffect effect = new CreateTokenEffect(new WarriorToken(), 2);
        effect.apply(game, source);
        for (UUID tokenId : effect.getLastAddedTokenIds()) {
            Permanent token = game.getPermanent(tokenId);
            if (token != null) {
                ContinuousEffect continuousEffect = new GainAbilityTargetEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn);
                continuousEffect.setTargetPointer(new FixedTarget(tokenId));
                game.addEffect(continuousEffect, source);
            }
        }
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) Permanent(mage.game.permanent.Permanent) TargetCreaturePermanent(mage.target.common.TargetCreaturePermanent) WarriorToken(mage.game.permanent.token.WarriorToken) CreateTokenEffect(mage.abilities.effects.common.CreateTokenEffect) GainAbilityTargetEffect(mage.abilities.effects.common.continuous.GainAbilityTargetEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect) UUID(java.util.UUID)

Aggregations

UUID (java.util.UUID)1 ContinuousEffect (mage.abilities.effects.ContinuousEffect)1 CreateTokenEffect (mage.abilities.effects.common.CreateTokenEffect)1 GainAbilityTargetEffect (mage.abilities.effects.common.continuous.GainAbilityTargetEffect)1 Permanent (mage.game.permanent.Permanent)1 WarriorToken (mage.game.permanent.token.WarriorToken)1 Player (mage.players.Player)1 TargetCreaturePermanent (mage.target.common.TargetCreaturePermanent)1 FixedTarget (mage.target.targetpointer.FixedTarget)1