summaryrefslogtreecommitdiff
path: root/src/main/java/darkknight/jewelrycraft/curses/CurseMoneyEqualsPower.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/darkknight/jewelrycraft/curses/CurseMoneyEqualsPower.java')
-rwxr-xr-xsrc/main/java/darkknight/jewelrycraft/curses/CurseMoneyEqualsPower.java108
1 files changed, 108 insertions, 0 deletions
diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseMoneyEqualsPower.java b/src/main/java/darkknight/jewelrycraft/curses/CurseMoneyEqualsPower.java
new file mode 100755
index 0000000..741a857
--- /dev/null
+++ b/src/main/java/darkknight/jewelrycraft/curses/CurseMoneyEqualsPower.java
@@ -0,0 +1,108 @@
+package darkknight.jewelrycraft.curses;
+
+import java.util.ArrayList;
+
+import darkknight.jewelrycraft.api.Curse;
+import darkknight.jewelrycraft.config.ConfigHandler;
+import darkknight.jewelrycraft.util.Variables;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.StatCollector;
+
+public class CurseMoneyEqualsPower extends Curse {
+ public CurseMoneyEqualsPower(String name, int txtID,
+ String texturepack) {
+ super(name, txtID, texturepack);
+ }
+
+ @Override
+ public void entityDropItems(EntityPlayer player, Entity target,
+ ArrayList<EntityItem> drops) {
+ int dropsTaken = 0;
+
+ for (EntityItem item : drops) {
+ if (rand.nextBoolean()) {
+ int stackSize = item
+ .getEntityItem().stackSize;
+ int takenItems = rand.nextInt(stackSize);
+ item.getEntityItem().stackSize -= takenItems;
+
+ if (item.getEntityItem().stackSize <= 0) {
+ item.setDead();
+ }
+
+ dropsTaken += takenItems;
+ }
+ }
+
+ if (dropsTaken > 0) {
+ if (dropsTaken > 3) {
+ player.addPotionEffect(new PotionEffect(
+ Potion.digSpeed.id,
+ dropsTaken * 30, 1));
+ player.addPotionEffect(new PotionEffect(
+ Potion.moveSpeed.id,
+ dropsTaken * 30, 1));
+
+ player.addChatComponentMessage(
+ new ChatComponentText(
+ StatCollector.translateToLocal(
+ EnumChatFormatting.RED
+ + "curse.jewlrycraft2.moneyEqualsPower.bless1")));
+ }
+
+ if (dropsTaken > 6) {
+ player.addPotionEffect(new PotionEffect(
+ Potion.resistance.id,
+ dropsTaken * 20, 1));
+ player.addPotionEffect(new PotionEffect(
+ Potion.damageBoost.id,
+ dropsTaken * 20, 1));
+
+ player.addChatComponentMessage(
+ new ChatComponentText(
+ StatCollector.translateToLocal(
+ EnumChatFormatting.RED
+ + "curse.jewlrycraft2.moneyEqualsPower.bless2")));
+ }
+
+ if (dropsTaken > 9) {
+ player.addPotionEffect(new PotionEffect(
+ Potion.regeneration.id,
+ dropsTaken * 10, 1));
+ player.addPotionEffect(new PotionEffect(
+ Potion.heal.id,
+ dropsTaken * 10, 1));
+
+ player.addChatComponentMessage(
+ new ChatComponentText(
+ StatCollector.translateToLocal(
+ EnumChatFormatting.RED
+ + "curse.jewlrycraft2.moneyEqualsPower.bless3")));
+ }
+ }
+ }
+
+ @Override
+ public boolean canCurseBeActivated() {
+ return ConfigHandler.CURSE_MONEY_EQUALS_POWER;
+ }
+
+ @Override
+ public String getDescription() {
+ return StatCollector.translateToLocal("curse."
+ + Variables.MODID
+ + ".moneyEqualsPower.description");
+ }
+
+ @Override
+ public String getDisplayName() {
+ return StatCollector.translateToLocal("curse."
+ + Variables.MODID + ".moneyEqualsPower");
+ }
+}