mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
added a method: magic color form char
This commit is contained in:
@@ -42,6 +42,17 @@ public class MagicColor {
|
|||||||
return 0; // colorless
|
return 0; // colorless
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static byte fromName(char c) {
|
||||||
|
switch(Character.toLowerCase(c)) {
|
||||||
|
case 'w': return MagicColor.WHITE;
|
||||||
|
case 'u': return MagicColor.BLUE;
|
||||||
|
case 'b': return MagicColor.BLACK;
|
||||||
|
case 'r': return MagicColor.RED;
|
||||||
|
case 'g': return MagicColor.GREEN;
|
||||||
|
}
|
||||||
|
return 0; // unknown means 'colorless'
|
||||||
|
}
|
||||||
|
|
||||||
public static String toShortString(String color) {
|
public static String toShortString(String color) {
|
||||||
if (color.equalsIgnoreCase(Constant.SNOW)) return "S"; // compatibility
|
if (color.equalsIgnoreCase(Constant.SNOW)) return "S"; // compatibility
|
||||||
return toShortString(fromName(color));
|
return toShortString(fromName(color));
|
||||||
|
|||||||
Reference in New Issue
Block a user