* Use for automatic mana payment of generic mana costs first abilities without additional costs (fixes
package mage.util;
+import java.util.*;
import mage.MageObject;
import mage.Mana;
import mage.ManaSymbol;
import mage.abilities.Ability;
import mage.abilities.costs.Cost;
+import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.*;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
@@ -17,8 +19,6 @@ import mage.filter.FilterMana;
import mage.game.Game;
import mage.players.Player;
-import java.util.*;
-
/**
* @author noxx
*/
@@ -373,7 +373,12 @@ public final class ManaUtil {
if (countColorfull == 0) { // seems there is no colorful mana we can use
// try to pay {1}
if (mana.getGeneric() > 0) {
- // use any (lets choose first)
+ // choose first without addional costs if all have addional costs take the first
+ for (ActivatedManaAbilityImpl manaAbility : useableAbilities.values()) {
+ if (manaAbility.getCosts().size() == 1 && manaAbility.getCosts().get(0).getClass().equals(TapSourceCost.class)) {
+ return replace(useableAbilities, manaAbility);
+ }
+ }
return replace(useableAbilities, useableAbilities.values().iterator().next());
}
@@ -499,7 +504,8 @@ public final class ManaUtil {
}
/**
- * all ability/effect code with "= new GenericManaCost" must be replaced by createManaCost call
+ * all ability/effect code with "= new GenericManaCost" must be replaced by
+ * createManaCost call
*/
public static ManaCost createManaCost(int genericManaCount, boolean payAsX) {
if (payAsX) {
