From 9ab323a89c937c8d51f59b9696727eccfb302ec4 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Mon, 21 Sep 2015 08:11:58 +0200 Subject: [PATCH] Deck editor - renamed sort type "Color Detailed" to "Color Identity" and compare for the sort also with mana symbols in casting cost and rules. --- .../util/CardViewColorIdentityComparator.java | 16 +++------------- .../mage/cards/repository/CardRepository.java | 2 +- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/Mage.Client/src/main/java/mage/client/util/CardViewColorIdentityComparator.java b/Mage.Client/src/main/java/mage/client/util/CardViewColorIdentityComparator.java index 3c205f9bb6..36be3025d1 100644 --- a/Mage.Client/src/main/java/mage/client/util/CardViewColorIdentityComparator.java +++ b/Mage.Client/src/main/java/mage/client/util/CardViewColorIdentityComparator.java @@ -28,8 +28,7 @@ package mage.client.util; import java.util.Comparator; -import java.util.List; -import mage.ObjectColor; +import mage.utils.CardUtil; import mage.view.CardView; /** @@ -40,16 +39,7 @@ public class CardViewColorIdentityComparator implements Comparator { @Override public int compare(CardView o1, CardView o2) { - return sortValue(o1.getManaCost(), o1.getColor()) - sortValue(o2.getManaCost(), o2.getColor()); - } - - static public int sortValue(List manaCost, ObjectColor color) { - int hash = 3; - hash = 23 * hash + (color.isWhite() || manaCost.contains("{W}") ? 1 : 0); - hash = 23 * hash + (color.isBlue() || manaCost.contains("{U}") ? 1 : 0); - hash = 23 * hash + (color.isBlack() || manaCost.contains("{B}") ? 1 : 0); - hash = 23 * hash + (color.isRed() || manaCost.contains("{R}") ? 1 : 0); - hash = 23 * hash + (color.isGreen() || manaCost.contains("{G}") ? 1 : 0); - return hash; + return CardUtil.getColorIdentitySortValue(o1.getManaCost(), o1.getColor(), o1.getRules()) + - CardUtil.getColorIdentitySortValue(o2.getManaCost(), o2.getColor(), o2.getRules()); } } diff --git a/Mage/src/mage/cards/repository/CardRepository.java b/Mage/src/mage/cards/repository/CardRepository.java index 4691eaa4f6..bb94926761 100644 --- a/Mage/src/mage/cards/repository/CardRepository.java +++ b/Mage/src/mage/cards/repository/CardRepository.java @@ -63,7 +63,7 @@ public enum CardRepository { // raise this if db structure was changed private static final long CARD_DB_VERSION = 41; // raise this if new cards were added to the server - private static final long CARD_CONTENT_VERSION = 37; + private static final long CARD_CONTENT_VERSION = 38; private final Random random = new Random(); private Dao cardDao;