mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
Simplify ManaConvertion scripts
This commit is contained in:
@@ -138,23 +138,11 @@ public final class MagicColor {
|
||||
public static final ImmutableList<String> BASIC_LANDS = ImmutableList.of("Plains", "Island", "Swamp", "Mountain", "Forest");
|
||||
public static final ImmutableList<String> SNOW_LANDS = ImmutableList.of("Snow-Covered Plains", "Snow-Covered Island", "Snow-Covered Swamp", "Snow-Covered Mountain", "Snow-Covered Forest");
|
||||
public static final ImmutableMap<String, String> ANY_COLOR_CONVERSION = new ImmutableMap.Builder<String, String>()
|
||||
.put("ManaColorConversion", "Additive")
|
||||
.put("WhiteConversion", "Color")
|
||||
.put("BlueConversion", "Color")
|
||||
.put("BlackConversion", "Color")
|
||||
.put("RedConversion", "Color")
|
||||
.put("GreenConversion", "Color")
|
||||
.put("ColorlessConversion", "Color")
|
||||
.put("ManaConversion", "AnyType->AnyColor")
|
||||
.build();
|
||||
|
||||
public static final ImmutableMap<String, String> ANY_TYPE_CONVERSION = new ImmutableMap.Builder<String, String>()
|
||||
.put("ManaColorConversion", "Additive")
|
||||
.put("WhiteConversion", "Type")
|
||||
.put("BlueConversion", "Type")
|
||||
.put("BlackConversion", "Type")
|
||||
.put("RedConversion", "Type")
|
||||
.put("GreenConversion", "Type")
|
||||
.put("ColorlessConversion", "Type")
|
||||
.put("ManaConversion", "AnyType->AnyType")
|
||||
.build();
|
||||
/**
|
||||
* Private constructor to prevent instantiation.
|
||||
|
||||
@@ -59,6 +59,18 @@ public abstract class ManaAtom {
|
||||
return 0; // generic
|
||||
}
|
||||
|
||||
public static byte fromConversion(String s) {
|
||||
switch (s) {
|
||||
case "AnyColor": return ALL_MANA_COLORS;
|
||||
case "AnyType": return ALL_MANA_TYPES;
|
||||
}
|
||||
byte b = 0;
|
||||
for (char c : s.toCharArray()) {
|
||||
b |= fromName(c);
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
public static int getIndexOfFirstManaType(final byte color){
|
||||
for (int i = 0; i < MANATYPES.length; i++) {
|
||||
if ((color & MANATYPES[i]) != 0) {
|
||||
|
||||
Reference in New Issue
Block a user