Search in sources :

Example 1 with UntapTargetEffect

use of mage.abilities.effects.common.UntapTargetEffect in project mage by magefree.

the class BesmirchEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    if (game.getPermanent(source.getFirstTarget()) != null) {
        TargetPointer target = new FixedTarget(source.getFirstTarget(), game);
        // gain control
        game.addEffect(new GainControlTargetEffect(Duration.EndOfTurn).setTargetPointer(target), source);
        // haste
        game.addEffect(new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn).setTargetPointer(target), source);
        // goad
        game.addEffect(new GoadTargetEffect().setTargetPointer(target), source);
        // untap
        new UntapTargetEffect().setTargetPointer(target).apply(game, source);
        return true;
    }
    return false;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) GainAbilityTargetEffect(mage.abilities.effects.common.continuous.GainAbilityTargetEffect) UntapTargetEffect(mage.abilities.effects.common.UntapTargetEffect) TargetPointer(mage.target.targetpointer.TargetPointer) GainControlTargetEffect(mage.abilities.effects.common.continuous.GainControlTargetEffect) GoadTargetEffect(mage.abilities.effects.common.combat.GoadTargetEffect)

Example 2 with UntapTargetEffect

use of mage.abilities.effects.common.UntapTargetEffect in project mage by magefree.

the class DomineeringWillEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
    if (targetPlayer != null) {
        ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfTurn, targetPlayer.getId());
        effect.setTargetPointer(new SecondTargetPointer());
        effect.setText("Target player gains control of up to three target nonattacking creatures until end of turn");
        game.addEffect(effect, source);
        Effect effect2 = new UntapTargetEffect();
        effect2.setTargetPointer(new SecondTargetPointer());
        effect2.setText("Untap those creatures");
        effect2.apply(game, source);
        RequirementEffect effect3 = new BlocksIfAbleTargetEffect(Duration.EndOfTurn);
        effect3.setTargetPointer(new SecondTargetPointer());
        effect3.setText("They block this turn if able");
        game.addEffect(effect3, source);
        return true;
    }
    return false;
}
Also used : SecondTargetPointer(mage.target.targetpointer.SecondTargetPointer) RequirementEffect(mage.abilities.effects.RequirementEffect) TargetPlayer(mage.target.TargetPlayer) Player(mage.players.Player) BlocksIfAbleTargetEffect(mage.abilities.effects.common.combat.BlocksIfAbleTargetEffect) GainControlTargetEffect(mage.abilities.effects.common.continuous.GainControlTargetEffect) RequirementEffect(mage.abilities.effects.RequirementEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect) UntapTargetEffect(mage.abilities.effects.common.UntapTargetEffect) Effect(mage.abilities.effects.Effect) BlocksIfAbleTargetEffect(mage.abilities.effects.common.combat.BlocksIfAbleTargetEffect) ContinuousEffect(mage.abilities.effects.ContinuousEffect) UntapTargetEffect(mage.abilities.effects.common.UntapTargetEffect) GainControlTargetEffect(mage.abilities.effects.common.continuous.GainControlTargetEffect)

Example 3 with UntapTargetEffect

use of mage.abilities.effects.common.UntapTargetEffect in project mage by magefree.

the class HuntingWildsToken method apply.

@Override
public boolean apply(Game game, Ability source) {
    for (Effect sourceEffect : source.getEffects()) {
        if (sourceEffect instanceof SearchLibraryPutInPlayEffect) {
            Cards foundCards = new CardsImpl(((SearchLibraryPutInPlayEffect) sourceEffect).getTargets());
            if (!foundCards.isEmpty()) {
                FixedTargets fixedTargets = new FixedTargets(foundCards, game);
                UntapTargetEffect untapEffect = new UntapTargetEffect();
                untapEffect.setTargetPointer(fixedTargets);
                untapEffect.apply(game, source);
                BecomesCreatureTargetEffect becomesCreatureEffect = new BecomesCreatureTargetEffect(new HuntingWildsToken(), false, true, Duration.Custom);
                becomesCreatureEffect.setTargetPointer(fixedTargets);
                game.addEffect(becomesCreatureEffect, source);
            }
            return true;
        }
    }
    return false;
}
Also used : FixedTargets(mage.target.targetpointer.FixedTargets) BecomesCreatureTargetEffect(mage.abilities.effects.common.continuous.BecomesCreatureTargetEffect) ConditionalOneShotEffect(mage.abilities.decorator.ConditionalOneShotEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) BecomesCreatureTargetEffect(mage.abilities.effects.common.continuous.BecomesCreatureTargetEffect) UntapTargetEffect(mage.abilities.effects.common.UntapTargetEffect) SearchLibraryPutInPlayEffect(mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect) Effect(mage.abilities.effects.Effect) UntapTargetEffect(mage.abilities.effects.common.UntapTargetEffect) Cards(mage.cards.Cards) CardsImpl(mage.cards.CardsImpl) SearchLibraryPutInPlayEffect(mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect)

Example 4 with UntapTargetEffect

use of mage.abilities.effects.common.UntapTargetEffect in project mage by magefree.

the class FrenziedFugueTriggeredAbility method checkTrigger.

@Override
public boolean checkTrigger(GameEvent event, Game game) {
    this.getEffects().clear();
    boolean result;
    if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
        result = event.getTargetId().equals(this.getSourceId());
    } else {
        result = event.getPlayerId().equals(this.getControllerId());
    }
    if (result) {
        Permanent enchantment = game.getPermanentOrLKIBattlefield(getSourceId());
        if (enchantment != null && enchantment.getAttachedTo() != null) {
            Effect effect = new GainControlTargetEffect(Duration.EndOfTurn, true);
            effect.setTargetPointer(new FixedTarget(enchantment.getAttachedTo(), game));
            this.getEffects().add(effect);
            effect = new UntapTargetEffect();
            effect.setTargetPointer(new FixedTarget(enchantment.getAttachedTo(), game));
            this.getEffects().add(effect);
            effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn);
            effect.setTargetPointer(new FixedTarget(enchantment.getAttachedTo(), game));
            this.getEffects().add(effect);
        } else {
            result = false;
        }
    }
    return result;
}
Also used : FixedTarget(mage.target.targetpointer.FixedTarget) Permanent(mage.game.permanent.Permanent) TargetPermanent(mage.target.TargetPermanent) GainAbilityTargetEffect(mage.abilities.effects.common.continuous.GainAbilityTargetEffect) GainControlTargetEffect(mage.abilities.effects.common.continuous.GainControlTargetEffect) UntapTargetEffect(mage.abilities.effects.common.UntapTargetEffect) Effect(mage.abilities.effects.Effect) AttachEffect(mage.abilities.effects.common.AttachEffect) GainAbilityTargetEffect(mage.abilities.effects.common.continuous.GainAbilityTargetEffect) UntapTargetEffect(mage.abilities.effects.common.UntapTargetEffect) GainControlTargetEffect(mage.abilities.effects.common.continuous.GainControlTargetEffect)

Aggregations

UntapTargetEffect (mage.abilities.effects.common.UntapTargetEffect)4 Effect (mage.abilities.effects.Effect)3 GainControlTargetEffect (mage.abilities.effects.common.continuous.GainControlTargetEffect)3 OneShotEffect (mage.abilities.effects.OneShotEffect)2 GainAbilityTargetEffect (mage.abilities.effects.common.continuous.GainAbilityTargetEffect)2 FixedTarget (mage.target.targetpointer.FixedTarget)2 ConditionalOneShotEffect (mage.abilities.decorator.ConditionalOneShotEffect)1 ContinuousEffect (mage.abilities.effects.ContinuousEffect)1 RequirementEffect (mage.abilities.effects.RequirementEffect)1 AttachEffect (mage.abilities.effects.common.AttachEffect)1 BlocksIfAbleTargetEffect (mage.abilities.effects.common.combat.BlocksIfAbleTargetEffect)1 GoadTargetEffect (mage.abilities.effects.common.combat.GoadTargetEffect)1 BecomesCreatureTargetEffect (mage.abilities.effects.common.continuous.BecomesCreatureTargetEffect)1 SearchLibraryPutInPlayEffect (mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect)1 Cards (mage.cards.Cards)1 CardsImpl (mage.cards.CardsImpl)1 Permanent (mage.game.permanent.Permanent)1 Player (mage.players.Player)1 TargetPermanent (mage.target.TargetPermanent)1 TargetPlayer (mage.target.TargetPlayer)1