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.*;
|
||||
|
||||
/**
|
||||
* TODO: Write javadoc for this type.
|
||||
*
|
||||
*/
|
||||
|
||||
public class ComputerUtilMana {
|
||||
private final static boolean DEBUG_MANA_PAYMENT = false;
|
||||
|
||||
@@ -84,7 +81,6 @@ public class ComputerUtilMana {
|
||||
private int manaCount;
|
||||
|
||||
public ManaProducingCard(final SpellAbility ability) {
|
||||
|
||||
Card hostCard = ability.getHostCard();
|
||||
|
||||
for (SpellAbility spellAbility : hostCard.getSpellAbilities()) {
|
||||
@@ -95,18 +91,19 @@ public class ComputerUtilMana {
|
||||
|
||||
if (hostCard.isCreature()) {
|
||||
cardType = CoreType.Creature;
|
||||
} else if (hostCard.isArtifact()) {
|
||||
}
|
||||
else if (hostCard.isArtifact()) {
|
||||
cardType = CoreType.Artifact;
|
||||
} else if (hostCard.isEnchantment()) {
|
||||
}
|
||||
else if (hostCard.isEnchantment()) {
|
||||
cardType = CoreType.Enchantment;
|
||||
} else {
|
||||
}
|
||||
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;
|
||||
@@ -116,16 +113,14 @@ public class ComputerUtilMana {
|
||||
|
||||
if (!mana.equals("Any")) {
|
||||
manaCount += mana.length();
|
||||
} else {
|
||||
}
|
||||
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<>();
|
||||
|
||||
@@ -138,21 +133,16 @@ public class ComputerUtilMana {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -1201,7 +1191,8 @@ public class ComputerUtilMana {
|
||||
if (!res.contains(a)) {
|
||||
if (cost.isReusuableResource()) {
|
||||
res.add(0, a);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
res.add(res.size(), a);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user