use of mage.game.permanent.token.SpiritWhiteToken in project mage by magefree.
the class MarchOfSoulsEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Map<UUID, Integer> playersWithCreatures = new HashMap<>();
for (Permanent p : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURES, source.getControllerId(), source.getSourceId(), game)) {
UUID controllerId = p.getControllerId();
if (p.destroy(source, game, true)) {
playersWithCreatures.put(controllerId, playersWithCreatures.getOrDefault(controllerId, 0) + 1);
}
}
SpiritWhiteToken token = new SpiritWhiteToken();
for (Map.Entry<UUID, Integer> destroyedCreaturePerPlayer : playersWithCreatures.entrySet()) {
token.putOntoBattlefield(destroyedCreaturePerPlayer.getValue(), game, source, destroyedCreaturePerPlayer.getKey());
}
return true;
}
use of mage.game.permanent.token.SpiritWhiteToken in project mage by magefree.
the class KayaGeistHunterEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Cards cards = new CardsImpl();
game.getState().getPlayersInRange(source.getControllerId(), game).stream().map(game::getPlayer).filter(Objects::nonNull).map(Player::getGraveyard).map(g -> g.getCards(game)).flatMap(Collection::stream).forEach(cards::add);
player.moveCards(cards, Zone.EXILED, source, game);
cards.retainZone(Zone.EXILED, game);
if (cards.isEmpty()) {
return true;
}
new SpiritWhiteToken().putOntoBattlefield(cards.size(), game, source);
return true;
}
use of mage.game.permanent.token.SpiritWhiteToken in project mage by magefree.
the class OccultEpiphanyEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
int xValue = source.getManaCostsToPay().getX();
if (player == null || xValue < 1) {
return false;
}
player.drawCards(xValue, source, game);
int cardTypes = player.discard(xValue, false, false, source, game).getCards(game).stream().map(card -> card.getCardType(game)).flatMap(Collection::stream).distinct().mapToInt(x -> 1).sum();
if (cardTypes > 0) {
new SpiritWhiteToken().putOntoBattlefield(cardTypes, game, source);
}
return true;
}
use of mage.game.permanent.token.SpiritWhiteToken in project mage by magefree.
the class FuneralPyreEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Card exiledCard = game.getCard(source.getFirstTarget());
if (player == null || exiledCard == null) {
return false;
}
Player owner = game.getPlayer(exiledCard.getOwnerId());
player.moveCards(exiledCard, Zone.EXILED, source, game);
if (owner != null) {
new SpiritWhiteToken().putOntoBattlefield(1, game, source, owner.getId());
}
return true;
}
use of mage.game.permanent.token.SpiritWhiteToken in project mage by magefree.
the class NotForgottenEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Card targetCard = game.getCard(source.getFirstTarget());
if (controller != null && targetCard != null) {
boolean onTop = controller.chooseUse(outcome, "Put " + targetCard.getName() + " on top of it's owners library (otherwise on bottom)?", source, game);
boolean moved = controller.moveCardToLibraryWithInfo(targetCard, source, game, Zone.GRAVEYARD, onTop, true);
if (moved) {
Token token = new SpiritWhiteToken();
token.putOntoBattlefield(1, game, source, source.getControllerId(), false, false);
return true;
}
}
return false;
}
Aggregations