CastAsThoughItHadFlashAllEffect support characteristics

This commit is contained in:
Steven Knipe 2023-09-18 06:06:52 -07:00
parent 485bd53ea8
commit f379319162
2 changed files with 26 additions and 16 deletions

View file

@ -1,11 +1,10 @@
package mage.abilities.effects.common.continuous;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
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;
@ -50,25 +49,19 @@ public class CastAsThoughItHadFlashAllEffect extends AsThoughEffectImpl {
}
@Override
public boolean applies(UUID affectedSpellId, Ability source, UUID affectedControllerId, Game game) {
if (anyPlayer || source.isControlledBy(affectedControllerId)) {
Card card = game.getCard(affectedSpellId);
public boolean applies(UUID objectId, Ability affectedAbility, Ability source, Game game, UUID playerId) {
if (affectedAbility instanceof SpellAbility && (anyPlayer||source.isControlledBy(playerId))) {
Card card = ((SpellAbility) affectedAbility).getCharacteristics(game);
if (card != null) {
//Allow lands with morph to be played at instant speed
if (card.isLand(game)) {
boolean morphAbility = card.getAbilities().stream().anyMatch(MorphAbility.class::isInstance);
if (morphAbility) {
Card cardCopy = card.copy();
cardCopy.removeAllCardTypes(game);
cardCopy.addCardType(game, CardType.CREATURE);
return filter.match(cardCopy, affectedControllerId, source, game);
}
}
return filter.match(card, affectedControllerId, source, game);
return filter.match(card, playerId, source, game);
}
}
return false;
}
@Override
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
return false;
}
private String setText() {
StringBuilder sb = new StringBuilder(anyPlayer ? "any player" : "you");