Primordial Mist - Fixed selection of face down targets (fixes #7045).

This commit is contained in:
LevelX2 2020-09-08 13:14:15 +02:00
parent ce4073d810
commit 8e465acb11
4 changed files with 61 additions and 22 deletions

View file

@ -39,7 +39,7 @@ public final class SerratedArrows extends CardImpl {
effect = new ConditionalOneShotEffect(new SacrificeSourceEffect(), new SourceHasCounterCondition(CounterType.ARROWHEAD, 0, 0),
"if there are no arrowhead counters on {this}, sacrifice it");
this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, effect, TargetController.YOU, false, false));
// {tap}, Remove an arrowhead counter from Serrated Arrows: Put a -1/-1 counter on target creature.
// {T}, Remove an arrowhead counter from Serrated Arrows: Put a -1/-1 counter on target creature.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new AddCountersTargetEffect(CounterType.M1M1.createInstance()),
new TapSourceCost());

View file

@ -0,0 +1,56 @@
package org.mage.test.cards.facedown;
import mage.constants.EmptyNames;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class PrimordialMistTest extends CardTestPlayerBase {
/**
* I have Brine Elemental played face down as a morph, an artifact which has
* been manifested and Kadena which has been turned face by Ixidron. I can't
* seem to activate Primordial Mist's second ability for any of these kinds
* of face down creatures:
*/
@Test
public void test_ExileAndCastMorphFaceDownCard() {
setStrictChooseMode(true);
// At the beginning of your end step, you may manifest the top card of your library.
// Exile a face-down permanent you control face-up: You may play that card this turn
addCard(Zone.BATTLEFIELD, playerA, "Primordial Mist");
// Morph {5}{U}{U}
// When Brine Elemental is turned face up, each opponent skips their next untap step.
addCard(Zone.HAND, playerA, "Brine Elemental"); // Creature {5}{U}{U} (5/4)
addCard(Zone.BATTLEFIELD, playerA, "Island", 9);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Brine Elemental");
setChoice(playerA, "Yes"); // cast it face down as 2/2 creature
waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN, playerA);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Exile a face-down permanent you control");
setChoice(playerA, EmptyNames.FACE_DOWN_CREATURE.toString());
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Brine Elemental");
setChoice(playerA, "No"); // cast it face down as 2/2 creature
setChoice(playerA, "Yes");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertAllCommandsUsed();
assertExileCount(playerA, 0);
assertPowerToughness(playerA, "Brine Elemental", 5, 4);
}
}

View file

@ -1,10 +1,8 @@
package mage.filter.predicate.other;
import mage.abilities.keyword.MorphAbility;
import mage.cards.Card;
import mage.filter.predicate.Predicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
* @author North
@ -14,15 +12,7 @@ public enum FaceDownPredicate implements Predicate<Card> {
@Override
public boolean apply(Card input, Game game) {
if (game.inCheckPlayableState()) {
// Check for cost reduction of possible face down spell to cast
if (input != null && !(input instanceof Permanent)) {
return input.getAbilities().containsClass(MorphAbility.class);
}
return false;
} else {
return input.isFaceDown(game);
}
return input.isFaceDown(game);
}
@Override

View file

@ -3100,15 +3100,6 @@ public abstract class PlayerImpl implements Player, Serializable {
}
}
// ALTERNATIVE COST from source card (AlternativeCostSourceAbility)
for (Ability objectAbility : sourceObject.getAbilities()) {
if (objectAbility instanceof AlternativeCostSourceAbility) {
if (objectAbility.getCosts().canPay(copy, copy.getSourceId(), playerId, game)) {
return true;
}
}
}
// ALTERNATIVE COST FROM dynamic effects
if (getCastSourceIdWithAlternateMana().contains(copy.getSourceId())) {
ManaCosts alternateCosts = getCastSourceIdManaCosts().get(copy.getSourceId());
@ -3128,7 +3119,9 @@ public abstract class PlayerImpl implements Player, Serializable {
}
// ALTERNATIVE COST from source card (any AlternativeSourceCosts)
return canPlayCardByAlternateCost(game.getCard(ability.getSourceId()), availableMana, copy, game);
if (AbilityType.SPELL.equals(ability.getAbilityType())) {
return canPlayCardByAlternateCost(game.getCard(ability.getSourceId()), availableMana, copy, game);
}
}
return false;
}