2019-01-22 17:39:30 +01:00
|
|
|
package com.minelittlepony.unicopia.spell;
|
|
|
|
|
|
|
|
import net.minecraft.util.text.TextFormatting;
|
|
|
|
|
|
|
|
public enum SpellAffinity {
|
|
|
|
GOOD(TextFormatting.BLUE, -1),
|
|
|
|
NEUTRAL(TextFormatting.WHITE, 0),
|
|
|
|
BAD(TextFormatting.RED, 1);
|
|
|
|
|
|
|
|
private final TextFormatting color;
|
|
|
|
|
|
|
|
private final int corruption;
|
|
|
|
|
2019-02-04 19:29:37 +01:00
|
|
|
private SpellAffinity[] implications;
|
|
|
|
|
2019-01-22 17:39:30 +01:00
|
|
|
SpellAffinity(TextFormatting color, int corruption) {
|
|
|
|
this.color = color;
|
|
|
|
this.corruption = corruption;
|
|
|
|
}
|
|
|
|
|
|
|
|
public TextFormatting getColourCode() {
|
|
|
|
return color;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getTranslationKey() {
|
|
|
|
return this == BAD ? "curse" : "spell";
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getCorruption() {
|
|
|
|
return corruption;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isNeutral() {
|
|
|
|
return this == NEUTRAL;
|
|
|
|
}
|
2019-02-04 19:29:37 +01:00
|
|
|
|
|
|
|
public SpellAffinity[] getImplicators() {
|
|
|
|
if (implications != null) {
|
|
|
|
return implications;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this == NEUTRAL) {
|
|
|
|
implications = values();
|
|
|
|
} else {
|
|
|
|
implications = new SpellAffinity[] { this };
|
|
|
|
}
|
|
|
|
|
|
|
|
return implications;
|
|
|
|
}
|
2019-02-08 16:56:28 +01:00
|
|
|
|
|
|
|
public static SpellAffinity of(String s) {
|
|
|
|
try {
|
|
|
|
if (s != null)
|
|
|
|
return valueOf(s.toUpperCase());
|
|
|
|
} catch (Throwable e) {}
|
|
|
|
|
|
|
|
return SpellAffinity.NEUTRAL;
|
|
|
|
}
|
2019-01-22 17:39:30 +01:00
|
|
|
}
|