use of mage.game.ExileZone in project mage by magefree.
the class TroveWardenEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent permanent = (Permanent) getValue("permanentLeftBattlefield");
if (controller == null || permanent == null) {
return false;
}
ExileZone exileZone = game.getExile().getExileZone(CardUtil.getExileZoneId(game, permanent.getId(), permanent.getZoneChangeCounter(game)));
if (exileZone == null) {
return true;
}
return controller.moveCards(exileZone.getCards(game), Zone.BATTLEFIELD, source, game, false, false, true, null);
}
use of mage.game.ExileZone in project mage by magefree.
the class AdventureCardSpellAbility method canActivate.
@Override
public ActivationStatus canActivate(UUID playerId, Game game) {
ExileZone adventureExileZone = game.getExile().getExileZone(ExileAdventureSpellEffect.adventureExileId(playerId, game));
Card spellCard = game.getCard(this.getSourceId());
if (spellCard instanceof AdventureCardSpell) {
Card card = ((AdventureCardSpell) spellCard).getParentCard();
if (adventureExileZone != null && adventureExileZone.contains(card.getId())) {
return ActivationStatus.getFalse();
}
}
return super.canActivate(playerId, game);
}
use of mage.game.ExileZone in project mage by magefree.
the class TibaltCosmicImpostorPlayFromExileEffect method applies.
@Override
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
Emblem tibaltEmblem = (Emblem) game.getEmblem(source.getSourceId());
if (tibaltEmblem == null) {
return false;
}
// the exile zone of the Tibalt, Cosmic Impostor that spawned the emblem only
UUID exileId = CardUtil.getExileZoneId(tibaltEmblem.getSourceObject().getId().toString(), game);
if (exileId == null) {
return false;
}
ExileZone exile = game.getState().getExile().getExileZone(exileId);
if (exile == null) {
return false;
}
if (exile.isEmpty()) {
return false;
}
Card cardInExile = game.getCard(objectId);
if (cardInExile == null) {
return false;
}
UUID mainCardId = cardInExile.getMainCard().getId();
if (exile.contains(mainCardId) && affectedControllerId.equals(source.getControllerId()) && game.getState().getZone(mainCardId).equals(Zone.EXILED)) {
CardUtil.makeCardPlayable(game, source, cardInExile, Duration.Custom, true);
return true;
}
return false;
}
use of mage.game.ExileZone in project mage by magefree.
the class EndlessSandsEffect 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));
return player != null && exileZone != null && player.moveCards(exileZone.getCards(game), Zone.BATTLEFIELD, source, game, false, false, true, null);
}
use of mage.game.ExileZone in project mage by magefree.
the class TargetCardInMuseVesselExile method canTarget.
@Override
public boolean canTarget(UUID id, Ability source, Game game) {
Card card = game.getCard(id);
if (card != null && game.getState().getZone(card.getId()) == Zone.EXILED) {
ExileZone exile = null;
Card sourceCard = game.getCard(source.getSourceId());
if (sourceCard != null) {
UUID exileId = CardUtil.getCardExileZoneId(game, source);
exile = game.getExile().getExileZone(exileId);
}
if (exile != null && exile.contains(id)) {
return filter.match(card, source.getControllerId(), game);
}
}
return false;
}
Aggregations