Search in sources :

Example 41 with FixedTargets

use of mage.target.targetpointer.FixedTargets in project mage by magefree.

the class ForceOfRageEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Token token = new AkoumStonewakerElementalToken();
    token.putOntoBattlefield(2, game, source, source.getControllerId());
    List<Permanent> permanentList = new ArrayList();
    for (UUID permId : token.getLastAddedTokenIds()) {
        permanentList.add(game.getPermanent(permId));
    }
    Effect effect = new SacrificeTargetEffect("sacrifice those tokens");
    effect.setTargetPointer(new FixedTargets(permanentList, game));
    game.addDelayedTriggeredAbility(new AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility(effect), source);
    return true;
}
Also used : Permanent(mage.game.permanent.Permanent) FixedTargets(mage.target.targetpointer.FixedTargets) AkoumStonewakerElementalToken(mage.game.permanent.token.AkoumStonewakerElementalToken) ArrayList(java.util.ArrayList) AkoumStonewakerElementalToken(mage.game.permanent.token.AkoumStonewakerElementalToken) Token(mage.game.permanent.token.Token) SacrificeTargetEffect(mage.abilities.effects.common.SacrificeTargetEffect) OneShotEffect(mage.abilities.effects.OneShotEffect) Effect(mage.abilities.effects.Effect) AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility) SacrificeTargetEffect(mage.abilities.effects.common.SacrificeTargetEffect) UUID(java.util.UUID)

Example 42 with FixedTargets

use of mage.target.targetpointer.FixedTargets in project mage by magefree.

the class GrimoireOfTheDeadEffect2 method apply.

@Override
public boolean apply(Game game, Ability source) {
    Player controller = game.getPlayer(source.getControllerId());
    if (controller == null) {
        return false;
    }
    Set<Card> creatureCards = new LinkedHashSet<>();
    for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
        Player player = game.getPlayer(playerId);
        if (player == null) {
            continue;
        }
        creatureCards.addAll(player.getGraveyard().getCards(StaticFilters.FILTER_CARD_CREATURE, game));
    }
    controller.moveCards(creatureCards, Zone.BATTLEFIELD, source, game);
    game.addEffect(new GrimoireOfTheDeadEffect2().setTargetPointer(new FixedTargets(creatureCards, game)), source);
    return true;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) Player(mage.players.Player) FixedTargets(mage.target.targetpointer.FixedTargets) UUID(java.util.UUID) Card(mage.cards.Card)

Example 43 with FixedTargets

use of mage.target.targetpointer.FixedTargets 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 44 with FixedTargets

use of mage.target.targetpointer.FixedTargets in project mage by magefree.

the class HungryForMoreEffect method apply.

@Override
public boolean apply(Game game, Ability source) {
    Token token = new HungryForMoreVampireToken();
    token.putOntoBattlefield(1, game, source, source.getControllerId());
    game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new SacrificeTargetEffect().setTargetPointer(new FixedTargets(token.getLastAddedTokenIds().stream().map(game::getPermanent).collect(Collectors.toList()), game)).setText("sacrifice that token")), source);
    return true;
}
Also used : AtTheBeginOfNextEndStepDelayedTriggeredAbility(mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility) FixedTargets(mage.target.targetpointer.FixedTargets) HungryForMoreVampireToken(mage.game.permanent.token.HungryForMoreVampireToken) Token(mage.game.permanent.token.Token) HungryForMoreVampireToken(mage.game.permanent.token.HungryForMoreVampireToken) SacrificeTargetEffect(mage.abilities.effects.common.SacrificeTargetEffect)

Example 45 with FixedTargets

use of mage.target.targetpointer.FixedTargets in project mage by magefree.

the class NightcreepCreatureEffect method init.

@Override
public void init(Ability source, Game game) {
    super.init(source, game);
    List<Permanent> targets = new ArrayList<>(game.getBattlefield().getActivePermanents(StaticFilters.FILTER_LAND, source.getControllerId(), source.getSourceId(), game));
    this.setTargetPointer(new FixedTargets(targets, game));
}
Also used : Permanent(mage.game.permanent.Permanent) FixedTargets(mage.target.targetpointer.FixedTargets) ArrayList(java.util.ArrayList)

Aggregations

FixedTargets (mage.target.targetpointer.FixedTargets)58 Player (mage.players.Player)36 Permanent (mage.game.permanent.Permanent)28 ArrayList (java.util.ArrayList)19 UUID (java.util.UUID)19 OneShotEffect (mage.abilities.effects.OneShotEffect)15 CardsImpl (mage.cards.CardsImpl)15 AtTheBeginOfNextEndStepDelayedTriggeredAbility (mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility)14 ContinuousEffect (mage.abilities.effects.ContinuousEffect)14 Effect (mage.abilities.effects.Effect)14 Card (mage.cards.Card)14 GainAbilityTargetEffect (mage.abilities.effects.common.continuous.GainAbilityTargetEffect)13 ExileTargetEffect (mage.abilities.effects.common.ExileTargetEffect)10 Cards (mage.cards.Cards)10 Token (mage.game.permanent.token.Token)9 TargetPermanent (mage.target.TargetPermanent)8 HashSet (java.util.HashSet)7 MageObject (mage.MageObject)7 DontUntapInControllersNextUntapStepTargetEffect (mage.abilities.effects.common.DontUntapInControllersNextUntapStepTargetEffect)7 CreateTokenCopyTargetEffect (mage.abilities.effects.common.CreateTokenCopyTargetEffect)6