use of mage.game.ExileZone in project mage by magefree.
the class ColfenorsUrnCondition method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent permanent = (Permanent) source.getSourceObjectIfItStillExists(game);
if (controller != null && permanent != null) {
UUID exileId = CardUtil.getCardExileZoneId(game, source);
ExileZone exile = game.getExile().getExileZone(exileId);
if (permanent.sacrifice(source, game)) {
controller.moveCards(exile.getCards(game), Zone.BATTLEFIELD, source, game);
}
return true;
}
return false;
}
use of mage.game.ExileZone in project mage by magefree.
the class ColfenorsPlansLookAtCardEffect method applies.
@Override
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
if (affectedControllerId.equals(source.getControllerId())) {
Card card = game.getCard(objectId);
if (card != null) {
MageObject sourceObject = game.getObject(source.getSourceId());
if (sourceObject == null) {
return false;
}
UUID exileId = CardUtil.getCardExileZoneId(game, source);
ExileZone exile = game.getExile().getExileZone(exileId);
return exile != null && exile.contains(objectId);
}
}
return false;
}
use of mage.game.ExileZone in project mage by magefree.
the class ColfenorsPlansLookAtCardEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Cards toExile = new CardsImpl(controller.getLibrary().getTopCards(game, 7));
UUID exileId = CardUtil.getCardExileZoneId(game, source);
controller.moveCardsToExile(toExile.getCards(game), source, game, false, exileId, CardUtil.createObjectRealtedWindowTitle(source, game, null));
ExileZone exileZone = game.getExile().getExileZone(exileId);
if (exileZone != null) {
for (Card card : exileZone.getCards(game)) {
if (card != null) {
card.setFaceDown(true, game);
}
}
}
return true;
}
return false;
}
use of mage.game.ExileZone 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.game.ExileZone in project mage by magefree.
the class GrinningTotemPutIntoGraveyardEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
ExileZone zone = game.getExile().getExileZone(exileZoneId);
if (controller != null && zone != null) {
return controller.moveCards(zone, Zone.GRAVEYARD, source, game);
}
return false;
}
Aggregations