use of mage.game.ExileZone in project mage by magefree.
the class ParallelThoughtsReplacementEffect method replaceEvent.
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player controller = game.getPlayer(source.getControllerId());
ExileZone exileZone = game.getExile().getExileZone(CardUtil.getCardExileZoneId(game, source));
Set<Card> cards = exileZone != null ? exileZone.getCards(game) : null;
if (controller != null && cards != null && !cards.isEmpty()) {
if (controller.chooseUse(outcome, "Draw a card from the pile you exiled instead drawing from your library?", source, game)) {
Card card = cards.iterator().next();
if (card != null) {
controller.moveCards(card, Zone.HAND, source, game);
}
return true;
}
}
return false;
}
use of mage.game.ExileZone 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;
}
use of mage.game.ExileZone in project mage by magefree.
the class TheaterOfHorrorsCastEffect method applies.
@Override
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
Card theCard = game.getCard(objectId);
if (theCard == null) {
return false;
}
// for split cards and mdfc
objectId = theCard.getMainCard().getId();
PlayerLostLifeWatcher watcher = game.getState().getWatcher(PlayerLostLifeWatcher.class);
if (watcher != null && game.isActivePlayer(source.getControllerId()) && watcher.getAllOppLifeLost(source.getControllerId(), game) > 0 && affectedControllerId.equals(source.getControllerId()) && game.getState().getZone(objectId) == Zone.EXILED) {
ExileZone zone = game.getExile().getExileZone(CardUtil.getCardExileZoneId(game, source));
return zone != null && zone.contains(objectId);
}
return false;
}
use of mage.game.ExileZone in project mage by magefree.
the class WallOfMourningReturnEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
ExileZone exileZone = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source));
if (exileZone == null || exileZone.isEmpty()) {
return false;
}
return player.moveCards(exileZone.getRandom(game), Zone.HAND, source, game);
}
use of mage.game.ExileZone in project mage by magefree.
the class BaneAlleyBrokerLookAtCardEffect method applies.
@Override
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
if (!source.isControlledBy(affectedControllerId)) {
return false;
}
Card card = game.getCard(objectId);
ExileZone exile = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source));
return card != null && exile != null && exile.getCards(game).contains(card);
}
Aggregations