* Fixed a problem that the playable check for some alternate costs (e.g. Devastating Master) was not done with the correct mana cost and wrongly shown as playable without enough avalable mana.
package mage.players;
import com.google.common.collect.ImmutableMap;
+import java.io.Serializable;
+import java.util.*;
+import java.util.Map.Entry;
+import java.util.stream.Collectors;
import mage.*;
import mage.abilities.*;
import mage.abilities.ActivatedAbility.ActivationStatus;
@@ -8,6 +12,7 @@ import mage.abilities.common.PassAbility;
import mage.abilities.common.PlayLandAsCommanderAbility;
import mage.abilities.common.WhileSearchingPlayFromLibraryAbility;
import mage.abilities.common.delayed.AtTheEndOfTurnStepPostDelayedTriggeredAbility;
+import mage.abilities.costs.AlternativeCost2;
import mage.abilities.costs.AlternativeSourceCosts;
import mage.abilities.costs.Cost;
import mage.abilities.costs.Costs;
@@ -65,11 +70,6 @@ import mage.util.GameLog;
import mage.util.RandomUtil;
import org.apache.log4j.Logger;
-import java.io.Serializable;
-import java.util.*;
-import java.util.Map.Entry;
-import java.util.stream.Collectors;
-
public abstract class PlayerImpl implements Player, Serializable {
private static final Logger logger = Logger.getLogger(PlayerImpl.class);
@@ -3290,10 +3290,16 @@ public abstract class PlayerImpl implements Player, Serializable {
if (alternateSourceCostsAbility.getCosts().canPay(ability, ability, playerId, game)) {
ManaCostsImpl manaCosts = new ManaCostsImpl();
for (Cost cost : alternateSourceCostsAbility.getCosts()) {
+ if (cost instanceof AlternativeCost2) {
+ if(((AlternativeCost2) cost).getCost() instanceof ManaCost) {
+ manaCosts.add((ManaCost) ((AlternativeCost2) cost).getCost());
+ }
+ } else {
if (cost instanceof ManaCost) {
manaCosts.add((ManaCost) cost);
}
}
+ }
if (manaCosts.isEmpty()) {
return true;
