summaryrefslogtreecommitdiff
path: root/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicCleverness.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicCleverness.java')
-rw-r--r--src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicCleverness.java45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicCleverness.java b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicCleverness.java
new file mode 100644
index 0000000..4088d99
--- /dev/null
+++ b/src/main/java/jp/plusplus/fbs/alchemy/characteristic/CharacteristicCleverness.java
@@ -0,0 +1,45 @@
+package jp.plusplus.fbs.alchemy.characteristic;
+
+import com.mojang.realmsclient.gui.ChatFormatting;
+import jp.plusplus.fbs.Registry;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.world.World;
+
+/**
+ * Created by plusplus_F on 2015/09/20.
+ */
+public class CharacteristicCleverness extends CharacteristicBase {
+ protected boolean reverse;
+ public CharacteristicCleverness(boolean minus){
+ reverse=minus;
+ setUnlocalizedName("fbs.cleverness."+(reverse?"lose":"gain"));
+ }
+
+ @Override
+ public Type getType() {
+ return Type.LENGTH;
+ }
+
+ @Override
+ public void affectEntity(World world, EntityLivingBase entity){
+ int lv=getType().getCorrectedValue(value);
+ int d=60+60*lv;
+
+ if(reverse) entity.removePotionEffect(Potion.poison.getId());
+ else entity.addPotionEffect(new PotionEffect(Registry.potionCleverness.getId(), 20*d, lv+1));
+ }
+
+ @Override
+ public ChatFormatting getNameColor(){
+ return reverse?ChatFormatting.RED:ChatFormatting.DARK_GREEN;
+ }
+
+ public static class Gain extends CharacteristicCleverness {
+ public Gain(){ super(false); }
+ }
+ public static class Lose extends CharacteristicCleverness {
+ public Lose(){ super(true); }
+ }
+}