Allow morph lands to be cast face down at instant speed (#7169)

This commit is contained in:
Daniel Bomar 2021-01-01 11:42:54 -06:00 committed by GitHub
parent 1862b16d04
commit 923cf1e3ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 2 deletions

View file

@ -5,8 +5,10 @@ package mage.abilities.effects.common.continuous;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.AsThoughEffectImpl;
import mage.abilities.keyword.MorphAbility;
import mage.cards.Card;
import mage.constants.AsThoughEffectType;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.filter.FilterCard;
@ -53,7 +55,25 @@ public class CastAsThoughItHadFlashAllEffect extends AsThoughEffectImpl {
public boolean applies(UUID affectedSpellId, Ability source, UUID affectedControllerId, Game game) {
if (anyPlayer || source.isControlledBy(affectedControllerId)) {
Card card = game.getCard(affectedSpellId);
return card != null && filter.match(card, game);
if (card != null) {
//Allow lands with morph to be played at instant speed
if (card.isLand()) {
boolean morphAbility = false;
for (Ability checkAbility : card.getAbilities()) {
if (checkAbility instanceof MorphAbility) {
morphAbility = true;
break;
}
}
if (morphAbility) {
Card cardCopy = card.copy();
cardCopy.getCardType().clear();
cardCopy.addCardType(CardType.CREATURE);
return filter.match(cardCopy, game);
}
}
return filter.match(card, game);
}
}
return false;
}

View file

@ -3387,7 +3387,8 @@ public abstract class PlayerImpl implements Player, Serializable {
// Even mana cost can't be checked here without lookahead
// So make it available all the time
boolean canUse;
if (ability instanceof MorphAbility && object instanceof Card && game.canPlaySorcery(getId())) {
if (ability instanceof MorphAbility && object instanceof Card && (game.canPlaySorcery(getId()) ||
(null != game.getContinuousEffects().asThough(object.getId(), AsThoughEffectType.CAST_AS_INSTANT, playAbility, this.getId(), game)))) {
canUse = canPlayCardByAlternateCost((Card) object, availableMana, playAbility, game);
} else {
canUse = canPlay(playAbility, availableMana, object, game); // canPlay already checks alternative source costs and all conditions