* Performance: memory usage optimization for deck editor (part 2 of removed bloated usage of ManaCosts -> ManaColor objects, see #7515);

This commit is contained in:
Oleg Agafonov 2021-02-12 22:12:18 +04:00
parent c1dea5b21e
commit 10e557b873
25 changed files with 164 additions and 113 deletions

View file

@ -317,10 +317,10 @@ public final class RateCard {
* @return
*/
private static int getManaCostScore(Card card, List<ColoredManaSymbol> allowedColors) {
int converted = card.getManaCost().convertedManaCost();
int converted = card.getConvertedManaCost();
if (allowedColors == null) {
int colorPenalty = 0;
for (String symbol : card.getManaCost().getSymbols()) {
for (String symbol : card.getManaCostSymbols()) {
if (isColoredMana(symbol)) {
colorPenalty++;
}
@ -329,7 +329,7 @@ public final class RateCard {
}
final Map<String, Integer> singleCount = new HashMap<>();
int maxSingleCount = 0;
for (String symbol : card.getManaCost().getSymbols()) {
for (String symbol : card.getManaCostSymbols()) {
int count = 0;
symbol = symbol.replace("{", "").replace("}", "");
if (isColoredMana(symbol)) {
@ -385,7 +385,7 @@ public final class RateCard {
*/
public static int getColorManaCount(Card card) {
int count = 0;
for (String symbol : card.getManaCost().getSymbols()) {
for (String symbol : card.getManaCostSymbols()) {
if (isColoredMana(symbol)) {
count++;
}
@ -401,7 +401,7 @@ public final class RateCard {
*/
public static int getDifferentColorManaCount(Card card) {
Set<String> symbols = new HashSet<>();
for (String symbol : card.getManaCost().getSymbols()) {
for (String symbol : card.getManaCostSymbols()) {
if (isColoredMana(symbol)) {
symbols.add(symbol);
}