Merge branch 'schnautzr-master-patch-51486' into 'master'

Collector Number Sort update for RNA

See merge request core-developers/forge!1297
This commit is contained in:
Michael Kamensky
2019-01-21 05:06:20 +00:00

View File

@@ -567,16 +567,24 @@ public enum ColumnDef {
private static String toLandsLast(final InventoryItem i) {
//nonland?
return !(((IPaperCard) i).getRules().getType().isLand()) ?
"0" + toColorlessArtifactsLast(i)
"0" + toArtifactsWithColorlessCostsLast(i)
//land
: "1";
}
/**Returns 1 for colorless artifacts, otherwise 0 and continues sorting.
/**Returns 1 for artifacts without color shards in their mana cost, otherwise 0 and continues sorting.
As of 2019, colored artifacts appear here if there are no colored shards in their casting cost.
@param i A paper card.
@return Part of a sortable numeric string.*/
private static String toColorlessArtifactsLast(final InventoryItem i) {
return !(((IPaperCard) i).getRules().getType().isArtifact() && toColor(i).isColorless())
private static String toArtifactsWithColorlessCostsLast(final InventoryItem i) {
forge.card.mana.ManaCost manaCost = ((IPaperCard) i).getRules().getManaCost();
return !(((IPaperCard) i).getRules().getType().isArtifact() && (toColor(i).isColorless() ||
//If it isn't colorless, see if it can be paid with only white, only blue, only black.
//No need to check others since three-color hybrid shards don't exist.
manaCost.canBePaidWithAvaliable(MagicColor.WHITE) &&
manaCost.canBePaidWithAvaliable(MagicColor.BLUE) &&
manaCost.canBePaidWithAvaliable(MagicColor.BLACK)))
? "0" + toSplitLast(i): "1";
}