mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Code cleanup
This commit is contained in:
@@ -34,10 +34,7 @@ import org.apache.commons.lang3.tuple.Pair;
|
|||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO: Write javadoc for this type.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class ComputerUtilMana {
|
public class ComputerUtilMana {
|
||||||
private final static boolean DEBUG_MANA_PAYMENT = false;
|
private final static boolean DEBUG_MANA_PAYMENT = false;
|
||||||
|
|
||||||
@@ -78,161 +75,154 @@ public class ComputerUtilMana {
|
|||||||
ManaCostBeingPaid cost = ComputerUtilMana.calculateManaCost(sa, test, extraMana);
|
ManaCostBeingPaid cost = ComputerUtilMana.calculateManaCost(sa, test, extraMana);
|
||||||
return payManaCost(cost, sa, ai, test, checkPlayable);
|
return payManaCost(cost, sa, ai, test, checkPlayable);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class ManaProducingCard {
|
|
||||||
private CoreType cardType;
|
|
||||||
private int manaCount;
|
|
||||||
|
|
||||||
public ManaProducingCard(final SpellAbility ability) {
|
|
||||||
|
|
||||||
Card hostCard = ability.getHostCard();
|
|
||||||
|
|
||||||
for (SpellAbility spellAbility : hostCard.getSpellAbilities()) {
|
|
||||||
if (spellAbility.isManaAbility()) {
|
|
||||||
addAbility(spellAbility);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hostCard.isCreature()) {
|
|
||||||
cardType = CoreType.Creature;
|
|
||||||
} else if (hostCard.isArtifact()) {
|
|
||||||
cardType = CoreType.Artifact;
|
|
||||||
} else if (hostCard.isEnchantment()) {
|
|
||||||
cardType = CoreType.Enchantment;
|
|
||||||
} else {
|
|
||||||
cardType = CoreType.Land;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addAbility(final SpellAbility ability) {
|
|
||||||
|
|
||||||
if (ability.getManaPart() == null) {
|
private static class ManaProducingCard {
|
||||||
manaCount += 1; //Assume a mana ability can generate at least 1 mana if the amount of mana can't be determined now.
|
private CoreType cardType;
|
||||||
return;
|
private int manaCount;
|
||||||
}
|
|
||||||
|
|
||||||
String mana = ability.getManaPart().mana();
|
|
||||||
|
|
||||||
if (!mana.equals("Any")) {
|
|
||||||
manaCount += mana.length();
|
|
||||||
} else {
|
|
||||||
manaCount += 6;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void sortManaAbilities(final ArrayListMultimap<ManaCostShard, SpellAbility> manaAbilityMap) {
|
|
||||||
|
|
||||||
final Map<Card, ManaProducingCard> manaCardMap = new HashMap<>();
|
public ManaProducingCard(final SpellAbility ability) {
|
||||||
final List<Card> orderedCards = new ArrayList<>();
|
Card hostCard = ability.getHostCard();
|
||||||
|
|
||||||
for (final ManaCostShard shard : manaAbilityMap.keySet()) {
|
|
||||||
for (SpellAbility ability : manaAbilityMap.get(shard)) {
|
|
||||||
if (!manaCardMap.containsKey(ability.getHostCard())) {
|
|
||||||
ManaProducingCard manaProducingCard = new ManaProducingCard(ability);
|
|
||||||
manaCardMap.put(ability.getHostCard(), manaProducingCard);
|
|
||||||
orderedCards.add(ability.getHostCard());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Collections.sort(orderedCards, new Comparator<Card>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compare(final Card card1, final Card card2) {
|
|
||||||
|
|
||||||
int card1Score = scoreCard(manaCardMap.get(card1));
|
|
||||||
int card2Score = scoreCard(manaCardMap.get(card2));
|
|
||||||
|
|
||||||
return card1Score - card2Score;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private int scoreCard(final ManaProducingCard card) {
|
|
||||||
|
|
||||||
int score = 0;
|
|
||||||
|
|
||||||
score += card.manaCount * 2;
|
|
||||||
|
|
||||||
switch (card.cardType) {
|
|
||||||
case Artifact:
|
|
||||||
case Enchantment:
|
|
||||||
score += 1;
|
|
||||||
break;
|
|
||||||
case Land:
|
|
||||||
score += 2;
|
|
||||||
break;
|
|
||||||
case Creature:
|
|
||||||
score += 3;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
score += 4;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return score;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
if (DEBUG_MANA_PAYMENT) {
|
for (SpellAbility spellAbility : hostCard.getSpellAbilities()) {
|
||||||
System.out.print("Ordered Cards: " + orderedCards.size());
|
if (spellAbility.isManaAbility()) {
|
||||||
for (Card card : orderedCards) {
|
addAbility(spellAbility);
|
||||||
System.out.print(card.getName() + ", ");
|
}
|
||||||
}
|
}
|
||||||
System.out.println();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (final ManaCostShard shard : manaAbilityMap.keySet()) {
|
|
||||||
|
|
||||||
final List<SpellAbility> abilities = manaAbilityMap.get(shard);
|
|
||||||
final List<SpellAbility> newAbilities = new ArrayList<>(abilities);
|
|
||||||
|
|
||||||
if (DEBUG_MANA_PAYMENT) {
|
|
||||||
System.out.println("Unsorted Abilities: " + newAbilities);
|
|
||||||
}
|
|
||||||
|
|
||||||
Collections.sort(newAbilities, new Comparator<SpellAbility>() {
|
|
||||||
@Override
|
|
||||||
public int compare(final SpellAbility ability1, final SpellAbility ability2) {
|
|
||||||
|
|
||||||
int preOrder = orderedCards.indexOf(ability1.getHostCard()) - orderedCards.indexOf(ability2.getHostCard());
|
|
||||||
|
|
||||||
if (preOrder == 0) {
|
|
||||||
|
|
||||||
String shardMana = shard.toString().replaceAll("\\{", "").replaceAll("\\}", "");
|
if (hostCard.isCreature()) {
|
||||||
|
cardType = CoreType.Creature;
|
||||||
|
}
|
||||||
|
else if (hostCard.isArtifact()) {
|
||||||
|
cardType = CoreType.Artifact;
|
||||||
|
}
|
||||||
|
else if (hostCard.isEnchantment()) {
|
||||||
|
cardType = CoreType.Enchantment;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cardType = CoreType.Land;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addAbility(final SpellAbility ability) {
|
||||||
|
if (ability.getManaPart() == null) {
|
||||||
|
manaCount += 1; //Assume a mana ability can generate at least 1 mana if the amount of mana can't be determined now.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String mana = ability.getManaPart().mana();
|
||||||
|
|
||||||
|
if (!mana.equals("Any")) {
|
||||||
|
manaCount += mana.length();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
manaCount += 6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void sortManaAbilities(final ArrayListMultimap<ManaCostShard, SpellAbility> manaAbilityMap) {
|
||||||
|
final Map<Card, ManaProducingCard> manaCardMap = new HashMap<>();
|
||||||
|
final List<Card> orderedCards = new ArrayList<>();
|
||||||
|
|
||||||
|
for (final ManaCostShard shard : manaAbilityMap.keySet()) {
|
||||||
|
for (SpellAbility ability : manaAbilityMap.get(shard)) {
|
||||||
|
if (!manaCardMap.containsKey(ability.getHostCard())) {
|
||||||
|
ManaProducingCard manaProducingCard = new ManaProducingCard(ability);
|
||||||
|
manaCardMap.put(ability.getHostCard(), manaProducingCard);
|
||||||
|
orderedCards.add(ability.getHostCard());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Collections.sort(orderedCards, new Comparator<Card>() {
|
||||||
|
@Override
|
||||||
|
public int compare(final Card card1, final Card card2) {
|
||||||
|
int card1Score = scoreCard(manaCardMap.get(card1));
|
||||||
|
int card2Score = scoreCard(manaCardMap.get(card2));
|
||||||
|
|
||||||
|
return card1Score - card2Score;
|
||||||
|
}
|
||||||
|
|
||||||
if (ability1.getManaPart().mana().contains(shardMana)
|
private int scoreCard(final ManaProducingCard card) {
|
||||||
&& !ability2.getManaPart().mana().contains(shardMana)) {
|
int score = 0;
|
||||||
return -1;
|
|
||||||
} else if (ability2.getManaPart().mana().contains(shardMana)
|
score += card.manaCount * 2;
|
||||||
&& !ability1.getManaPart().mana().contains(shardMana)) {
|
|
||||||
return 1;
|
switch (card.cardType) {
|
||||||
}
|
case Artifact:
|
||||||
|
case Enchantment:
|
||||||
return 0;
|
score += 1;
|
||||||
|
break;
|
||||||
} else {
|
case Land:
|
||||||
return preOrder;
|
score += 2;
|
||||||
}
|
break;
|
||||||
|
case Creature:
|
||||||
}
|
score += 3;
|
||||||
|
break;
|
||||||
});
|
default:
|
||||||
|
score += 4;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return score;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
if (DEBUG_MANA_PAYMENT) {
|
if (DEBUG_MANA_PAYMENT) {
|
||||||
System.out.println("Sorted Abilities: " + newAbilities);
|
System.out.print("Ordered Cards: " + orderedCards.size());
|
||||||
}
|
for (Card card : orderedCards) {
|
||||||
|
System.out.print(card.getName() + ", ");
|
||||||
manaAbilityMap.replaceValues(shard, newAbilities);
|
}
|
||||||
|
System.out.println();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
for (final ManaCostShard shard : manaAbilityMap.keySet()) {
|
||||||
|
|
||||||
|
final List<SpellAbility> abilities = manaAbilityMap.get(shard);
|
||||||
|
final List<SpellAbility> newAbilities = new ArrayList<>(abilities);
|
||||||
|
|
||||||
|
if (DEBUG_MANA_PAYMENT) {
|
||||||
|
System.out.println("Unsorted Abilities: " + newAbilities);
|
||||||
|
}
|
||||||
|
|
||||||
|
Collections.sort(newAbilities, new Comparator<SpellAbility>() {
|
||||||
|
@Override
|
||||||
|
public int compare(final SpellAbility ability1, final SpellAbility ability2) {
|
||||||
|
|
||||||
|
int preOrder = orderedCards.indexOf(ability1.getHostCard()) - orderedCards.indexOf(ability2.getHostCard());
|
||||||
|
|
||||||
|
if (preOrder == 0) {
|
||||||
|
|
||||||
|
String shardMana = shard.toString().replaceAll("\\{", "").replaceAll("\\}", "");
|
||||||
|
|
||||||
|
if (ability1.getManaPart().mana().contains(shardMana)
|
||||||
|
&& !ability2.getManaPart().mana().contains(shardMana)) {
|
||||||
|
return -1;
|
||||||
|
} else if (ability2.getManaPart().mana().contains(shardMana)
|
||||||
|
&& !ability1.getManaPart().mana().contains(shardMana)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return preOrder;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
if (DEBUG_MANA_PAYMENT) {
|
||||||
|
System.out.println("Sorted Abilities: " + newAbilities);
|
||||||
|
}
|
||||||
|
|
||||||
|
manaAbilityMap.replaceValues(shard, newAbilities);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static ArrayList<Card> getManaSourcesToPayCost(final ManaCostBeingPaid cost, final SpellAbility sa, final Player ai) {
|
public static ArrayList<Card> getManaSourcesToPayCost(final ManaCostBeingPaid cost, final SpellAbility sa, final Player ai) {
|
||||||
ArrayList<Card> manaSources = new ArrayList<>();
|
ArrayList<Card> manaSources = new ArrayList<>();
|
||||||
@@ -251,9 +241,9 @@ public class ComputerUtilMana {
|
|||||||
// get a mana of this type from floating, bail if none available
|
// get a mana of this type from floating, bail if none available
|
||||||
final Mana mana = getMana(ai, part, sa, cost.getSourceRestriction());
|
final Mana mana = getMana(ai, part, sa, cost.getSourceRestriction());
|
||||||
if (mana != null) {
|
if (mana != null) {
|
||||||
if (ai.getManaPool().tryPayCostWithMana(sa, cost, mana)) {
|
if (ai.getManaPool().tryPayCostWithMana(sa, cost, mana)) {
|
||||||
manaSpentToPay.add(0, mana);
|
manaSpentToPay.add(0, mana);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -305,7 +295,7 @@ public class ComputerUtilMana {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (saPayment == null) {
|
if (saPayment == null) {
|
||||||
@@ -357,9 +347,9 @@ public class ComputerUtilMana {
|
|||||||
// get a mana of this type from floating, bail if none available
|
// get a mana of this type from floating, bail if none available
|
||||||
final Mana mana = getMana(ai, part, sa, cost.getSourceRestriction());
|
final Mana mana = getMana(ai, part, sa, cost.getSourceRestriction());
|
||||||
if (mana != null) {
|
if (mana != null) {
|
||||||
if (ai.getManaPool().tryPayCostWithMana(sa, cost, mana)) {
|
if (ai.getManaPool().tryPayCostWithMana(sa, cost, mana)) {
|
||||||
manaSpentToPay.add(0, mana);
|
manaSpentToPay.add(0, mana);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -389,10 +379,10 @@ public class ComputerUtilMana {
|
|||||||
// select which abilities may be used for each shard
|
// select which abilities may be used for each shard
|
||||||
ArrayListMultimap<ManaCostShard, SpellAbility> sourcesForShards = ComputerUtilMana.groupAndOrderToPayShards(ai, manaAbilityMap, cost);
|
ArrayListMultimap<ManaCostShard, SpellAbility> sourcesForShards = ComputerUtilMana.groupAndOrderToPayShards(ai, manaAbilityMap, cost);
|
||||||
|
|
||||||
sortManaAbilities(sourcesForShards);
|
sortManaAbilities(sourcesForShards);
|
||||||
|
|
||||||
if (DEBUG_MANA_PAYMENT) {
|
if (DEBUG_MANA_PAYMENT) {
|
||||||
System.out.println("DEBUG_MANA_PAYMENT: sourcesForShards = " + sourcesForShards);
|
System.out.println("DEBUG_MANA_PAYMENT: sourcesForShards = " + sourcesForShards);
|
||||||
}
|
}
|
||||||
|
|
||||||
ManaCostShard toPay = null;
|
ManaCostShard toPay = null;
|
||||||
@@ -420,7 +410,7 @@ public class ComputerUtilMana {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (saPayment == null) {
|
if (saPayment == null) {
|
||||||
@@ -456,7 +446,7 @@ public class ComputerUtilMana {
|
|||||||
if (saPayment.getPayCosts() != null) {
|
if (saPayment.getPayCosts() != null) {
|
||||||
final CostPayment pay = new CostPayment(saPayment.getPayCosts(), saPayment);
|
final CostPayment pay = new CostPayment(saPayment.getPayCosts(), saPayment);
|
||||||
if (!pay.payComputerCosts(new AiCostDecision(ai, saPayment))) {
|
if (!pay.payComputerCosts(new AiCostDecision(ai, saPayment))) {
|
||||||
saList.remove(saPayment);
|
saList.remove(saPayment);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -717,10 +707,10 @@ public class ComputerUtilMana {
|
|||||||
// * pay hybrids
|
// * pay hybrids
|
||||||
// * pay phyrexian, keep mana for colorless
|
// * pay phyrexian, keep mana for colorless
|
||||||
// * pay colorless
|
// * pay colorless
|
||||||
Iterator<ManaCostShard> shards = cost.getDistinctShards().iterator();
|
Iterator<ManaCostShard> shards = cost.getDistinctShards().iterator();
|
||||||
if (shards.hasNext()) {
|
if (shards.hasNext()) {
|
||||||
return shards.next();
|
return shards.next();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -852,8 +842,8 @@ public class ComputerUtilMana {
|
|||||||
*/
|
*/
|
||||||
private static ArrayListMultimap<ManaCostShard, SpellAbility> groupAndOrderToPayShards(final Player ai, final ArrayListMultimap<Integer, SpellAbility> manaAbilityMap,
|
private static ArrayListMultimap<ManaCostShard, SpellAbility> groupAndOrderToPayShards(final Player ai, final ArrayListMultimap<Integer, SpellAbility> manaAbilityMap,
|
||||||
final ManaCostBeingPaid cost) {
|
final ManaCostBeingPaid cost) {
|
||||||
ArrayListMultimap<ManaCostShard, SpellAbility> res = ArrayListMultimap.create();
|
ArrayListMultimap<ManaCostShard, SpellAbility> res = ArrayListMultimap.create();
|
||||||
|
|
||||||
if (cost.getColorlessManaAmount() > 0 && manaAbilityMap.containsKey(ManaAtom.COLORLESS)) {
|
if (cost.getColorlessManaAmount() > 0 && manaAbilityMap.containsKey(ManaAtom.COLORLESS)) {
|
||||||
res.putAll(ManaCostShard.COLORLESS, manaAbilityMap.get(ManaAtom.COLORLESS));
|
res.putAll(ManaCostShard.COLORLESS, manaAbilityMap.get(ManaAtom.COLORLESS));
|
||||||
}
|
}
|
||||||
@@ -861,7 +851,7 @@ public class ComputerUtilMana {
|
|||||||
// loop over cost parts
|
// loop over cost parts
|
||||||
for (ManaCostShard shard : cost.getDistinctShards()) {
|
for (ManaCostShard shard : cost.getDistinctShards()) {
|
||||||
if (DEBUG_MANA_PAYMENT) {
|
if (DEBUG_MANA_PAYMENT) {
|
||||||
System.out.println("DEBUG_MANA_PAYMENT: shard = " + shard);
|
System.out.println("DEBUG_MANA_PAYMENT: shard = " + shard);
|
||||||
}
|
}
|
||||||
if (shard == ManaCostShard.S) {
|
if (shard == ManaCostShard.S) {
|
||||||
res.putAll(shard, manaAbilityMap.get(ManaAtom.IS_SNOW));
|
res.putAll(shard, manaAbilityMap.get(ManaAtom.IS_SNOW));
|
||||||
@@ -878,17 +868,17 @@ public class ComputerUtilMana {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (shard == ManaCostShard.COLORLESS) {
|
if (shard == ManaCostShard.COLORLESS) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Integer colorint : manaAbilityMap.keySet()) {
|
for (Integer colorint : manaAbilityMap.keySet()) {
|
||||||
// apply mana color change matrix here
|
// apply mana color change matrix here
|
||||||
if (ai.getManaPool().canPayForShardWithColor(shard, colorint.byteValue())) {
|
if (ai.getManaPool().canPayForShardWithColor(shard, colorint.byteValue())) {
|
||||||
for (SpellAbility sa : manaAbilityMap.get(colorint)) {
|
for (SpellAbility sa : manaAbilityMap.get(colorint)) {
|
||||||
if (!res.get(shard).contains(sa)) {
|
if (!res.get(shard).contains(sa)) {
|
||||||
res.get(shard).add(res.get(shard).size(), sa);
|
res.get(shard).add(res.get(shard).size(), sa);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1129,26 +1119,26 @@ public class ComputerUtilMana {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<String> reflectedColors = CardUtil.getReflectableManaColors(m);
|
Set<String> reflectedColors = CardUtil.getReflectableManaColors(m);
|
||||||
// find possible colors
|
// find possible colors
|
||||||
if (mp.canProduce("W", m) || reflectedColors.contains(MagicColor.Constant.WHITE)) {
|
if (mp.canProduce("W", m) || reflectedColors.contains(MagicColor.Constant.WHITE)) {
|
||||||
manaMap.get(ManaAtom.WHITE).add(manaMap.get(ManaAtom.WHITE).size(), m);
|
manaMap.get(ManaAtom.WHITE).add(manaMap.get(ManaAtom.WHITE).size(), m);
|
||||||
}
|
}
|
||||||
if (mp.canProduce("U", m) || reflectedColors.contains(MagicColor.Constant.BLUE)) {
|
if (mp.canProduce("U", m) || reflectedColors.contains(MagicColor.Constant.BLUE)) {
|
||||||
manaMap.get(ManaAtom.BLUE).add(manaMap.get(ManaAtom.BLUE).size(), m);
|
manaMap.get(ManaAtom.BLUE).add(manaMap.get(ManaAtom.BLUE).size(), m);
|
||||||
}
|
}
|
||||||
if (mp.canProduce("B", m) || reflectedColors.contains(MagicColor.Constant.BLACK)) {
|
if (mp.canProduce("B", m) || reflectedColors.contains(MagicColor.Constant.BLACK)) {
|
||||||
manaMap.get(ManaAtom.BLACK).add(manaMap.get(ManaAtom.BLACK).size(), m);
|
manaMap.get(ManaAtom.BLACK).add(manaMap.get(ManaAtom.BLACK).size(), m);
|
||||||
}
|
}
|
||||||
if (mp.canProduce("R", m) || reflectedColors.contains(MagicColor.Constant.RED)) {
|
if (mp.canProduce("R", m) || reflectedColors.contains(MagicColor.Constant.RED)) {
|
||||||
manaMap.get(ManaAtom.RED).add(manaMap.get(ManaAtom.RED).size(), m);
|
manaMap.get(ManaAtom.RED).add(manaMap.get(ManaAtom.RED).size(), m);
|
||||||
}
|
}
|
||||||
if (mp.canProduce("G", m) || reflectedColors.contains(MagicColor.Constant.GREEN)) {
|
if (mp.canProduce("G", m) || reflectedColors.contains(MagicColor.Constant.GREEN)) {
|
||||||
manaMap.get(ManaAtom.GREEN).add(manaMap.get(ManaAtom.GREEN).size(), m);
|
manaMap.get(ManaAtom.GREEN).add(manaMap.get(ManaAtom.GREEN).size(), m);
|
||||||
}
|
}
|
||||||
if (mp.isSnow()) {
|
if (mp.isSnow()) {
|
||||||
manaMap.get(ManaAtom.IS_SNOW).add(manaMap.get(ManaAtom.IS_SNOW).size(), m);
|
manaMap.get(ManaAtom.IS_SNOW).add(manaMap.get(ManaAtom.IS_SNOW).size(), m);
|
||||||
}
|
}
|
||||||
if (DEBUG_MANA_PAYMENT) {
|
if (DEBUG_MANA_PAYMENT) {
|
||||||
System.out.println("DEBUG_MANA_PAYMENT: groupSourcesByManaColor manaMap = " + manaMap);
|
System.out.println("DEBUG_MANA_PAYMENT: groupSourcesByManaColor manaMap = " + manaMap);
|
||||||
@@ -1199,11 +1189,12 @@ public class ComputerUtilMana {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!res.contains(a)) {
|
if (!res.contains(a)) {
|
||||||
if (cost.isReusuableResource()) {
|
if (cost.isReusuableResource()) {
|
||||||
res.add(0, a);
|
res.add(0, a);
|
||||||
} else {
|
}
|
||||||
res.add(res.size(), a);
|
else {
|
||||||
}
|
res.add(res.size(), a);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
|||||||
Reference in New Issue
Block a user