use of mage.target.targetpointer.FixedTargets in project mage by magefree.
the class WaylayEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Token token = new WaylayToken();
token.putOntoBattlefield(3, game, source, source.getControllerId());
List<Permanent> toExile = new ArrayList<>();
for (UUID tokenId : token.getLastAddedTokenIds()) {
Permanent tokenPermanent = game.getPermanent(tokenId);
if (tokenPermanent != null) {
toExile.add(tokenPermanent);
}
}
Effect effect = new ExileTargetEffect();
effect.setTargetPointer(new FixedTargets(toExile, game));
game.addDelayedTriggeredAbility(new AtTheBeginOfNextCleanupDelayedTriggeredAbility(effect), source);
return true;
}
use of mage.target.targetpointer.FixedTargets in project mage by magefree.
the class CreateTokenCopyTargetEffect method removeTokensCreatedAtEndOf.
private void removeTokensCreatedAtEndOf(Game game, Ability source, PhaseStep phaseStepToExileCards, boolean exile) {
Effect effect;
if (exile) {
effect = new ExileTargetEffect(null, "", Zone.BATTLEFIELD).setText("exile the token copies");
} else {
effect = new SacrificeTargetEffect("sacrifice the token copies");
}
effect.setTargetPointer(new FixedTargets(addedTokenPermanents, game));
DelayedTriggeredAbility exileAbility;
switch(phaseStepToExileCards) {
case END_TURN:
exileAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect);
break;
case END_COMBAT:
exileAbility = new AtTheEndOfCombatDelayedTriggeredAbility(effect);
break;
default:
return;
}
game.addDelayedTriggeredAbility(exileAbility, source);
}
use of mage.target.targetpointer.FixedTargets in project mage by magefree.
the class BerserkersFrenzyEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
TargetPermanent target = new TargetCreaturePermanent(0, Integer.MAX_VALUE);
target.setNotTarget(true);
player.choose(outcome, target, source.getSourceId(), game);
game.addEffect(new BlocksIfAbleTargetEffect(Duration.EndOfTurn).setTargetPointer(new FixedTargets(new CardsImpl(target.getTargets()), game)), source);
return true;
}
use of mage.target.targetpointer.FixedTargets in project mage by magefree.
the class BurnDownTheHouseEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Token token = new DevilToken();
token.putOntoBattlefield(3, game, source, source.getControllerId());
game.addEffect(new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn).setTargetPointer(new FixedTargets(token, game)), source);
return true;
}
use of mage.target.targetpointer.FixedTargets in project mage by magefree.
the class DreamPillagerEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (controller != null && sourceObject != null) {
int amount = (Integer) getValue("damage");
if (amount > 0) {
Set<Card> cards = controller.getLibrary().getTopCards(game, amount);
if (!cards.isEmpty()) {
controller.moveCards(cards, Zone.EXILED, source, game);
Cards canBeCast = new CardsImpl();
for (Card card : cards) {
if (!card.isLand(game)) {
canBeCast.add(card);
}
}
ContinuousEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Zone.EXILED, Duration.EndOfTurn);
effect.setTargetPointer(new FixedTargets(canBeCast, game));
game.addEffect(effect, source);
}
return true;
}
return true;
}
return false;
}
Aggregations