mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
* Use for automatic mana payment of generic mana costs first abilities without additional costs (fixes #6408).
This commit is contained in:
parent
aaf1f7da7b
commit
033f80c6ed
1 changed files with 11 additions and 5 deletions
|
@ -1,10 +1,12 @@
|
|||
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
|
||||
*/
|
||||
|
@ -46,7 +46,7 @@ public final class ManaUtil {
|
|||
* In case we can't auto choose we'll simply return the useableAbilities map
|
||||
* back to caller without any modification.
|
||||
*
|
||||
* @param unpaid Mana we need to pay. Can be null (it is for X costs now).
|
||||
* @param unpaid Mana we need to pay. Can be null (it is for X costs now).
|
||||
* @param useableAbilities List of mana abilities permanent may produce
|
||||
* @return List of mana abilities permanent may produce and are reasonable
|
||||
* for unpaid mana
|
||||
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue