mirror of
https://github.com/correl/mage.git
synced 2024-11-16 03:00:12 +00:00
Cards of libraries for searches are shown ordered by name now to make it easier to find specific cards (#326).
This commit is contained in:
parent
2580b6b571
commit
8b67be6e65
1 changed files with 13 additions and 1 deletions
|
@ -28,7 +28,11 @@
|
||||||
|
|
||||||
package mage.target.common;
|
package mage.target.common;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.TreeSet;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -85,7 +89,7 @@ public class TargetCardInLibrary extends TargetCard<TargetCardInLibrary> {
|
||||||
int maxCards = Math.min(cardLimit.intValue(), targetPlayer.getLibrary().size());
|
int maxCards = Math.min(cardLimit.intValue(), targetPlayer.getLibrary().size());
|
||||||
cards = targetPlayer.getLibrary().getTopCards(game, maxCards);
|
cards = targetPlayer.getLibrary().getTopCards(game, maxCards);
|
||||||
}
|
}
|
||||||
|
Collections.sort(cards, new CardNameComparator());
|
||||||
while (!isChosen() && !doneChosing()) {
|
while (!isChosen() && !doneChosing()) {
|
||||||
chosen = targets.size() >= minNumberOfTargets;
|
chosen = targets.size() >= minNumberOfTargets;
|
||||||
if (!player.choose(outcome, new CardsImpl(Zone.LIBRARY, cards), this, game)) {
|
if (!player.choose(outcome, new CardsImpl(Zone.LIBRARY, cards), this, game)) {
|
||||||
|
@ -121,3 +125,11 @@ public class TargetCardInLibrary extends TargetCard<TargetCardInLibrary> {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class CardNameComparator implements Comparator<Card> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compare(Card o1, Card o2) {
|
||||||
|
return o1.getName().compareTo(o2.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue