use of mage.target.targetpointer.FixedTargets in project mage by magefree.
the class ExileFromGraveCost method pay.
@Override
public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) {
Player controller = game.getPlayer(controllerId);
if (controller != null) {
if (targets.choose(Outcome.Exile, controllerId, source.getSourceId(), game)) {
for (UUID targetId : targets.get(0).getTargets()) {
Card card = game.getCard(targetId);
if (card == null || game.getState().getZone(targetId) != Zone.GRAVEYARD) {
return false;
}
exiledCards.add(card);
}
Cards cardsToExile = new CardsImpl();
cardsToExile.addAll(exiledCards);
controller.moveCardsToExile(cardsToExile.getCards(game), source, game, true, CardUtil.getExileZoneId(game, source), CardUtil.getSourceName(game, source));
if (setTargetPointer) {
source.getEffects().setTargetPointer(new FixedTargets(cardsToExile, game));
}
paid = true;
}
}
return paid;
}
use of mage.target.targetpointer.FixedTargets in project mage by magefree.
the class DorotheasRetributionEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Token token = new DorotheasRetributionSpiritToken();
token.putOntoBattlefield(1, game, source, source.getControllerId(), true, true);
game.addDelayedTriggeredAbility(new AtTheEndOfCombatDelayedTriggeredAbility(new SacrificeTargetEffect().setTargetPointer(new FixedTargets(token, game)).setText("sacrifce that token")), source);
return true;
}
use of mage.target.targetpointer.FixedTargets in project mage by magefree.
the class DollhouseOfHorrorsEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Card card = game.getCard(getTargetPointer().getFirst(game, source));
if (card == null) {
return false;
}
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(source.getControllerId(), CardType.ARTIFACT, false, 1, false, false, null, 0, 0, false);
effect.setSavedPermanent(new PermanentCard(card, source.getControllerId(), game));
effect.setAdditionalSubType(SubType.CONSTRUCT);
effect.addAdditionalAbilities(new SimpleStaticAbility(new BoostSourceEffect(ArtifactYouControlCount.instance, ArtifactYouControlCount.instance, Duration.WhileOnBattlefield).setText("This creature gets +1/+1 for each artifact you control")));
effect.apply(game, source);
game.addEffect(new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn).setTargetPointer(new FixedTargets(effect.getAddedPermanents(), game)), source);
return true;
}
use of mage.target.targetpointer.FixedTargets in project mage by magefree.
the class GisaGloriousResurrectorReturnEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Ability exiledWithSource = (Ability) game.getState().getValue("GisaGloriousResurrectorExile" + source.getSourceId().toString() + game.getState().getZoneChangeCounter(source.getSourceId()));
if (exiledWithSource == null) {
return false;
}
ExileZone exileZone = game.getExile().getExileZone(CardUtil.getExileZoneId(game, exiledWithSource));
if (player == null || exileZone == null || exileZone.isEmpty()) {
return false;
}
Cards cards = new CardsImpl(exileZone.getCards(StaticFilters.FILTER_CARD_CREATURE, game));
if (cards.isEmpty()) {
return false;
}
player.moveCards(cards, Zone.BATTLEFIELD, source, game);
cards.retainZone(Zone.BATTLEFIELD, game);
if (cards.isEmpty()) {
return false;
}
game.addEffect(new GainAbilityTargetEffect(new DecayedAbility(), Duration.Custom).setTargetPointer(new FixedTargets(cards, game)), source);
return true;
}
use of mage.target.targetpointer.FixedTargets in project mage by magefree.
the class TangleEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
List<Permanent> doNotUntapNextUntapStep = new ArrayList<>();
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
doNotUntapNextUntapStep.add(permanent);
}
if (!doNotUntapNextUntapStep.isEmpty()) {
ContinuousEffect effect = new DontUntapInControllersNextUntapStepTargetEffect("This creature");
effect.setTargetPointer(new FixedTargets(doNotUntapNextUntapStep, game));
game.addEffect(effect, source);
}
return true;
}
return false;
}
Aggregations