mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Sort quest booster reward by name then color then rarity
This commit is contained in:
@@ -2,6 +2,7 @@ package forge.quest;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
@@ -562,6 +563,25 @@ public abstract class QuestWinLoseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cardsWon != null) {
|
if (cardsWon != null) {
|
||||||
|
//sort cards alphabetically so colors appear together and rares appear on top
|
||||||
|
Collections.sort(cardsWon, new Comparator<PaperCard>() {
|
||||||
|
@Override
|
||||||
|
public int compare(PaperCard c1, PaperCard c2) {
|
||||||
|
return c1.getName().compareTo(c2.getName());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Collections.sort(cardsWon, new Comparator<PaperCard>() {
|
||||||
|
@Override
|
||||||
|
public int compare(PaperCard c1, PaperCard c2) {
|
||||||
|
return c1.getRules().getColor().compareTo(c2.getRules().getColor());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Collections.sort(cardsWon, new Comparator<PaperCard>() {
|
||||||
|
@Override
|
||||||
|
public int compare(PaperCard c1, PaperCard c2) {
|
||||||
|
return c2.getRarity().compareTo(c1.getRarity());
|
||||||
|
}
|
||||||
|
});
|
||||||
showCards(title, cardsWon);
|
showCards(title, cardsWon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user