use of mage.abilities.keyword.MorphAbility in project mage by magefree.
the class BecomesFaceDownCreatureAllEffect method init.
@Override
public void init(Ability source, Game game) {
super.init(source, game);
for (Permanent perm : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
if (!perm.isFaceDown(game) && !perm.isTransformable()) {
affectedObjectList.add(new MageObjectReference(perm, game));
perm.setFaceDown(true, game);
// check for Morph
Card card = game.getCard(perm.getId());
if (card != null) {
for (Ability ability : card.getAbilities(game)) {
if (ability instanceof MorphAbility) {
this.turnFaceUpAbilityMap.put(card.getId(), new TurnFaceUpAbility(((MorphAbility) ability).getMorphCosts()));
}
}
}
}
}
}
use of mage.abilities.keyword.MorphAbility in project mage by magefree.
the class CastAsThoughItHadFlashAllEffect method applies.
@Override
public boolean applies(UUID affectedSpellId, Ability source, UUID affectedControllerId, Game game) {
if (anyPlayer || source.isControlledBy(affectedControllerId)) {
Card card = game.getCard(affectedSpellId);
if (card != null) {
// Allow lands with morph to be played at instant speed
if (card.isLand(game)) {
boolean morphAbility = card.getAbilities().stream().anyMatch(ability -> ability instanceof MorphAbility);
if (morphAbility) {
Card cardCopy = card.copy();
cardCopy.removeAllCardTypes(game);
cardCopy.addCardType(game, CardType.CREATURE);
return filter.match(cardCopy, source.getSourceId(), affectedControllerId, game);
}
}
return filter.match(card, source.getSourceId(), affectedControllerId, game);
}
}
return false;
}
Aggregations