Merge pull request #7451 from varaghar/adventure-cards-from-exile

Allow 'Gonti, Lord of Luxury', 'Nightveil Specter' and 'Thief of Sanity' to cast adventures from exile
This commit is contained in:
Daniel Bomar 2021-01-27 06:47:09 -06:00 committed by GitHub
commit eae954d0c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 1 deletions

View file

@ -147,6 +147,12 @@ class GontiLordOfLuxuryCastFromExileEffect extends AsThoughEffectImpl {
@Override
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
Card theCard = game.getCard(objectId);
if (theCard == null) {
return false;
}
objectId = theCard.getMainCard().getId(); // for split cards
UUID targetId = getTargetPointer().getFirst(game, source);
if (targetId == null) {
this.discard();
@ -194,7 +200,7 @@ class GontiLordOfLuxurySpendAnyManaEffect extends AsThoughEffectImpl implements
// if the card moved from exile to spell the zone change counter is increased by 1 (effect must applies before and on stack, use isCheckPlayableMode?)
return source.isControlledBy(affectedControllerId);
} else if (((FixedTarget) getTargetPointer()).getTarget().equals(objectId)) {
// object has moved zone so effect can be discarted
// object has moved zone so effect can be discarded
this.discard();
}
return false;

View file

@ -119,6 +119,12 @@ class NightveilSpecterEffect extends AsThoughEffectImpl {
@Override
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
Card theCard = game.getCard(objectId);
if (theCard == null) {
return false;
}
objectId = theCard.getMainCard().getId();// for split cards
if (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);

View file

@ -147,6 +147,12 @@ class ThiefOfSanityCastFromExileEffect extends AsThoughEffectImpl {
@Override
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
Card theCard = game.getCard(objectId);
if (theCard == null) {
return false;
}
objectId = theCard.getMainCard().getId();// for split cards
UUID cardId = getTargetPointer().getFirst(game, source);
if (cardId == null) {
this.discard(); // card is no longer in the origin zone, effect can be discarded