use of mage.game.permanent.token.EmptyToken in project mage by magefree.
the class SpittingImageEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (permanent == null) {
permanent = (Permanent) game.getLastKnownInformation(source.getFirstTarget(), Zone.BATTLEFIELD);
}
if (permanent != null) {
EmptyToken token = new EmptyToken();
CardUtil.copyTo(token).from(permanent, game);
token.putOntoBattlefield(1, game, source, source.getControllerId());
return true;
}
return false;
}
use of mage.game.permanent.token.EmptyToken in project mage by magefree.
the class GodPharaohsGiftEffect 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) {
return false;
}
TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(0, 1, StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD, true);
controller.choose(Outcome.PutCreatureInPlay, target, source.getSourceId(), game);
Card cardChosen = game.getCard(target.getFirstTarget());
if (cardChosen == null || !controller.moveCards(cardChosen, Zone.EXILED, source, game)) {
return false;
}
// create token and modify all attributes permanently (without game usage)
EmptyToken token = new EmptyToken();
CardUtil.copyTo(token).from(cardChosen, game);
token.removePTCDA();
token.getPower().modifyBaseValue(4);
token.getToughness().modifyBaseValue(4);
token.getColor().setColor(ObjectColor.BLACK);
token.removeAllCreatureTypes();
token.addSubType(SubType.ZOMBIE);
token.putOntoBattlefield(1, game, source, source.getControllerId());
List<Permanent> permanents = token.getLastAddedTokenIds().stream().map(game::getPermanent).filter(Objects::nonNull).collect(Collectors.toList());
if (!permanents.isEmpty()) {
game.addEffect(new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn).setTargetPointer(new FixedTargets(permanents, game)), source);
}
return true;
}
use of mage.game.permanent.token.EmptyToken in project mage by magefree.
the class PhantomSteedEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
ExileZone exileZone = game.getState().getExile().getExileZone(CardUtil.getExileZoneId(game, source));
if (exileZone == null || exileZone.isEmpty()) {
return false;
}
for (Card card : exileZone.getCards(game)) {
EmptyToken token = new EmptyToken();
CardUtil.copyTo(token).from(card, game);
token.addSubType(SubType.ILLUSION);
token.putOntoBattlefield(1, game, source, source.getControllerId(), true, true);
List<Permanent> permanents = token.getLastAddedTokenIds().stream().map(game::getPermanent).filter(Objects::nonNull).collect(Collectors.toList());
game.addDelayedTriggeredAbility(new AtTheEndOfCombatDelayedTriggeredAbility(new ExileTargetEffect("Sacrifice that token at end of combat").setTargetPointer(new FixedTargets(permanents, game))), source);
}
return true;
}
Aggregations