Search in sources :

Example 1 with ElfWarriorToken

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

the class ReturnUponTheTideEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player player = game.getPlayer(source.getControllerId());
    Card card = game.getCard(source.getFirstTarget());
    if (player == null || card == null) {
        return false;
    }
    player.moveCards(card, Zone.BATTLEFIELD, source, game);
    Permanent permanent = game.getPermanent(card.getId());
    if (permanent == null) {
        return false;
    }
    if (permanent.hasSubtype(SubType.ELF, game)) {
        new ElfWarriorToken().putOntoBattlefield(2, game, source, player.getId());
    }
    return true;
}
Also used : Player(mage.players.Player) Permanent(mage.game.permanent.Permanent) Card(mage.cards.Card) ElfWarriorToken(mage.game.permanent.token.ElfWarriorToken)

Example 2 with ElfWarriorToken

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

the class GiltLeafAmbushCreateTokenEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
        CreateTokenEffect effect = new CreateTokenEffect(new ElfWarriorToken(), 2);
        effect.apply(game, source);
        if (ClashEffect.getInstance().apply(game, source)) {
            for (UUID tokenId : effect.getLastAddedTokenIds()) {
                Permanent token = game.getPermanent(tokenId);
                if (token != null) {
                    ContinuousEffect continuousEffect = new GainAbilityTargetEffect(DeathtouchAbility.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) CreateTokenEffect(mage.abilities.effects.common.CreateTokenEffect) GainAbilityTargetEffect(mage.abilities.effects.common.continuous.GainAbilityTargetEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect) UUID(java.util.UUID) ElfWarriorToken(mage.game.permanent.token.ElfWarriorToken)

Example 3 with ElfWarriorToken

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

the class NadierAgentOfTheDuskenelEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Object obj = getValue("permanentLeftBattlefield");
    if (!(obj instanceof Permanent)) {
        return false;
    }
    Permanent permanent = (Permanent) obj;
    if (!permanent.isCreature(game) || permanent.getPower().getValue() < 1) {
        return false;
    }
    return new ElfWarriorToken().putOntoBattlefield(permanent.getPower().getValue(), game, source, source.getControllerId());
}
Also used : FilterPermanent(mage.filter.FilterPermanent) FilterControlledPermanent(mage.filter.common.FilterControlledPermanent) Permanent(mage.game.permanent.Permanent) ElfWarriorToken(mage.game.permanent.token.ElfWarriorToken)

Example 4 with ElfWarriorToken

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

the class SylvanOfferingEffect2 method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller != null) {
        Target target = new TargetOpponent(true);
        target.choose(Outcome.Sacrifice, source.getControllerId(), source.getSourceId(), game);
        Player opponent = game.getPlayer(target.getFirstTarget());
        if (opponent != null) {
            int xValue = source.getManaCostsToPay().getX();
            Effect effect = new CreateTokenTargetEffect(new ElfWarriorToken(), xValue);
            effect.setTargetPointer(new FixedTarget(controller.getId()));
            effect.apply(game, source);
            effect.setTargetPointer(new FixedTarget(opponent.getId()));
            effect.apply(game, source);
            return true;
        }
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Player(mage.players.Player) Target(mage.target.Target) FixedTarget(mage.target.targetpointer.FixedTarget) TargetOpponent(mage.target.common.TargetOpponent) CreateTokenTargetEffect(mage.abilities.effects.common.CreateTokenTargetEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) CreateTokenTargetEffect(mage.abilities.effects.common.CreateTokenTargetEffect) Effect(mage.abilities.effects.Effect) ElfWarriorToken(mage.game.permanent.token.ElfWarriorToken)

Aggregations

ElfWarriorToken (mage.game.permanent.token.ElfWarriorToken)4 Permanent (mage.game.permanent.Permanent)3 Player (mage.players.Player)3 FixedTarget (mage.target.targetpointer.FixedTarget)2 UUID (java.util.UUID)1 ContinuousEffect (mage.abilities.effects.ContinuousEffect)1 Effect (mage.abilities.effects.Effect)1 OneShotEffect (mage.abilities.effects.OneShotEffect)1 CreateTokenEffect (mage.abilities.effects.common.CreateTokenEffect)1 CreateTokenTargetEffect (mage.abilities.effects.common.CreateTokenTargetEffect)1 GainAbilityTargetEffect (mage.abilities.effects.common.continuous.GainAbilityTargetEffect)1 Card (mage.cards.Card)1 FilterPermanent (mage.filter.FilterPermanent)1 FilterControlledPermanent (mage.filter.common.FilterControlledPermanent)1 Target (mage.target.Target)1 TargetOpponent (mage.target.common.TargetOpponent)1