Merge fix

This commit is contained in:
Oleg Agafonov 2023-12-14 22:25:45 +04:00
parent 10641f8d63
commit 0dbd86fb58
2 changed files with 11 additions and 11 deletions

View file

@ -84,27 +84,27 @@ public class MulliganCardSorterTest extends CardTestPlayerBase {
// creatures by mana
assertHandSort(Arrays.asList(
"Grizzly Bears", // 2
"Yellow Scarves Troops", // 2
"Aspiring Champion", // 4
"Marchesa's Infiltrator", // 3
"Aspiring Champion" // 4
"Grizzly Bears", // 2
"Yellow Scarves Troops" // 2
));
// other by mana
assertHandSort(Arrays.asList(
"Lightning Bolt", // 1
"Samite Blessing", // 1
"From Beyond", // 4
"Druid's Call", // 2
"From Beyond" // 4
"Lightning Bolt", // 1
"Samite Blessing" // 1
));
// lands > others > creatures
assertHandSort(Arrays.asList(
"Forest", // land
"Island", // land
"Druid's Call", // other, 2
"Lightning Bolt", // other, 1
"Samite Blessing", // other, 1
"Druid's Call", // other, 2
"Grizzly Bears", // creature, 2
"Yellow Scarves Troops" // creature, 2
));

View file

@ -16,17 +16,17 @@ public class MulliganDefaultHandSorter implements Comparator<Card> {
// groups: lands > other > creatures
// inside group: by mana value, by name
// lands
// lands (lands first)
if (c1.isLand() != c2.isLand()) {
return Boolean.compare(c2.isLand(), c1.isLand());
}
// creatures
// creatures (others first, then creatures)
if (c1.isCreature() != c2.isCreature()) {
return Boolean.compare(c1.isCreature(), c2.isCreature());
}
// by mana
// by mana (from big to low)
if (c1.getManaValue() != c2.getManaValue()) {
return Integer.compare(c1.getManaValue(), c2.getManaValue());
return Integer.compare(c2.getManaValue(), c1.getManaValue());
}
// by name
return c1.getName().compareTo(c2.getName());