2011-06-23 21:08:53 -07:00
|
|
|
package magic.model;
|
|
|
|
|
2016-03-30 06:24:57 -07:00
|
|
|
import java.util.EnumSet;
|
2020-01-15 12:02:42 -08:00
|
|
|
|
2016-10-26 01:46:59 -07:00
|
|
|
import magic.translate.MText;
|
2016-03-30 06:24:57 -07:00
|
|
|
|
2011-06-23 21:08:53 -07:00
|
|
|
public enum MagicRarity {
|
2016-06-17 19:12:34 -07:00
|
|
|
|
2016-03-30 06:24:57 -07:00
|
|
|
Basic(MagicRarityStr._SBasic, 'B'),
|
|
|
|
Common(MagicRarityStr._SCommon, 'C'),
|
|
|
|
Uncommon(MagicRarityStr._SUncommon, 'U'),
|
|
|
|
Rare(MagicRarityStr._SRare, 'R'),
|
|
|
|
Mythic_Rare(MagicRarityStr._SMythicRare, 'M');
|
2011-06-23 21:08:53 -07:00
|
|
|
|
2011-06-23 21:49:05 -07:00
|
|
|
public static final int length = values().length;
|
2013-06-23 18:33:35 -07:00
|
|
|
|
2011-09-11 06:57:19 -07:00
|
|
|
private final char c;
|
2016-03-30 06:24:57 -07:00
|
|
|
private final String displayName;
|
2011-06-23 21:08:53 -07:00
|
|
|
|
2016-03-30 06:24:57 -07:00
|
|
|
private MagicRarity(final String aName, final char c) {
|
2016-10-26 01:46:59 -07:00
|
|
|
this.displayName = MText.get(aName);
|
2011-06-23 21:08:53 -07:00
|
|
|
this.c = c;
|
|
|
|
}
|
|
|
|
|
|
|
|
public char getChar() {
|
|
|
|
return c;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getName() {
|
2016-03-30 06:24:57 -07:00
|
|
|
return displayName;
|
2011-06-23 21:08:53 -07:00
|
|
|
}
|
2013-06-23 18:33:35 -07:00
|
|
|
|
2012-06-16 07:55:26 -07:00
|
|
|
public static MagicRarity getRarity(final char c) {
|
|
|
|
for (final MagicRarity type : values()) {
|
|
|
|
if (type.c == c) {
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
}
|
2014-07-28 07:26:01 -07:00
|
|
|
throw new RuntimeException("unknown rarity \"" + c + "\"");
|
2012-06-16 07:55:26 -07:00
|
|
|
}
|
2016-03-30 06:24:57 -07:00
|
|
|
|
|
|
|
public static String[] getDisplayNames() {
|
|
|
|
return EnumSet.allOf(MagicRarity.class)
|
|
|
|
.stream()
|
|
|
|
.map(MagicRarity::getName)
|
|
|
|
.toArray(String[]::new);
|
|
|
|
}
|
2016-06-17 19:12:34 -07:00
|
|
|
|
2011-06-23 21:08:53 -07:00
|
|
|
}
|
|
|
|
|