summaryrefslogtreecommitdiff
path: root/java/darkknight/jewelrycraft/curses
diff options
context:
space:
mode:
authorOnyxDarkKnight <sor1n.iliutza16@gmail.com>2015-03-23 14:25:27 +0000
committerOnyxDarkKnight <sor1n.iliutza16@gmail.com>2015-03-23 14:25:27 +0000
commite86949a1ad3269ec66c9de65e2c92f5e66251411 (patch)
treeabe7a3b14d7a5f7bb27a916a991f8911de94c1d2 /java/darkknight/jewelrycraft/curses
parent12cb40ba14e76b999a381b1f122bfce73223fd38 (diff)
More stuff. I don't even know by this point....
Diffstat (limited to 'java/darkknight/jewelrycraft/curses')
-rw-r--r--java/darkknight/jewelrycraft/curses/Curse.java31
-rw-r--r--java/darkknight/jewelrycraft/curses/CurseFlamingSoul.java2
-rw-r--r--java/darkknight/jewelrycraft/curses/CurseInfamy.java41
-rw-r--r--java/darkknight/jewelrycraft/curses/CurseList.java3
4 files changed, 75 insertions, 2 deletions
diff --git a/java/darkknight/jewelrycraft/curses/Curse.java b/java/darkknight/jewelrycraft/curses/Curse.java
index 08421ef..f833542 100644
--- a/java/darkknight/jewelrycraft/curses/Curse.java
+++ b/java/darkknight/jewelrycraft/curses/Curse.java
@@ -1,6 +1,8 @@
package darkknight.jewelrycraft.curses;
import java.util.ArrayList;
+import java.util.Random;
+import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
@@ -8,6 +10,7 @@ public class Curse
{
protected int id, texturepack;
protected String name, description;
+ protected Random rand = new Random();
private static ArrayList<Curse> curses = new ArrayList<Curse>();
public static ArrayList<Curse> availableCurses = new ArrayList<Curse>();
@@ -69,6 +72,34 @@ public class Curse
*/
public void action(World world, EntityPlayer player)
{}
+
+ /**
+ * @param world
+ * @param player
+ */
+ public void deathAction(World world, EntityPlayer player)
+ {}
+
+ /**
+ * @param world
+ * @param player
+ */
+ public void respawnAction(World world, EntityPlayer player)
+ {}
+
+ /**
+ * @param world
+ * @param player
+ */
+ public void attackedAction(World world, EntityPlayer player)
+ {}
+
+ /**
+ * @param world
+ * @param player
+ */
+ public void attackedByPlayerAction(World world, EntityPlayer player, Entity target)
+ {}
public boolean itemToss()
{
diff --git a/java/darkknight/jewelrycraft/curses/CurseFlamingSoul.java b/java/darkknight/jewelrycraft/curses/CurseFlamingSoul.java
index 7c1104c..8718524 100644
--- a/java/darkknight/jewelrycraft/curses/CurseFlamingSoul.java
+++ b/java/darkknight/jewelrycraft/curses/CurseFlamingSoul.java
@@ -13,7 +13,7 @@ public class CurseFlamingSoul extends Curse
@Override
public void action(World world, EntityPlayer player)
{
- if (!player.isBurning()) player.setFire(60);
+ if (!player.isBurning() && rand.nextInt(20) == 0) player.setFire(5);
}
public String getDescription()
diff --git a/java/darkknight/jewelrycraft/curses/CurseInfamy.java b/java/darkknight/jewelrycraft/curses/CurseInfamy.java
new file mode 100644
index 0000000..aa815f7
--- /dev/null
+++ b/java/darkknight/jewelrycraft/curses/CurseInfamy.java
@@ -0,0 +1,41 @@
+package darkknight.jewelrycraft.curses;
+
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLiving;
+import net.minecraft.entity.SharedMonsterAttributes;
+import net.minecraft.entity.monster.EntityMob;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.World;
+import darkknight.jewelrycraft.damage.DamageSourceList;
+import darkknight.jewelrycraft.entities.EntityHalfHeart;
+import darkknight.jewelrycraft.entities.EntityHeart;
+import darkknight.jewelrycraft.util.JewelrycraftUtil;
+import darkknight.jewelrycraft.util.PlayerUtils;
+
+public class CurseInfamy extends Curse
+{
+ public CurseInfamy(int id, String name, int text)
+ {
+ super(id, name, text);
+ }
+
+ @Override
+ public void attackedByPlayerAction(World world, EntityPlayer player, Entity target)
+ {
+ if (rand.nextInt(5) == 0 && !world.isRemote && !(target instanceof EntityMob) && target instanceof EntityLiving && !(target instanceof EntityHeart) && !(target instanceof EntityHalfHeart) && target.canAttackWithItem()){
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft");
+ if (playerInfo.getFloat("BlackHeart") < 20F) playerInfo.setFloat("BlackHeart", playerInfo.getFloat("BlackHeart") + 1.0F);
+ if (player.getMaxHealth() >= 3F){
+ player.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(player.getMaxHealth() - 1.0F);
+ player.setHealth(player.getHealth() - 1.0F);
+ }
+ JewelrycraftUtil.addCursePoints(player, 10);
+ }
+ }
+
+ public String getDescription()
+ {
+ return "What have you done?!";
+ }
+}
diff --git a/java/darkknight/jewelrycraft/curses/CurseList.java b/java/darkknight/jewelrycraft/curses/CurseList.java
index 4a46232..4e796ff 100644
--- a/java/darkknight/jewelrycraft/curses/CurseList.java
+++ b/java/darkknight/jewelrycraft/curses/CurseList.java
@@ -5,7 +5,7 @@ import darkknight.jewelrycraft.lib.Reference;
public class CurseList
{
- private static Curse rotten, flaming, blind, greed;
+ private static Curse rotten, flaming, blind, greed, infamy;
private static boolean isInitialized = false;
/**
@@ -18,6 +18,7 @@ public class CurseList
flaming = new CurseFlamingSoul(1, Reference.MODNAME + ":" + "Flaming Soul", 0);
greed = new CurseGreed(2, Reference.MODNAME + ":" + "Greed", 0);
blind = new CurseBlind(3, Reference.MODNAME + ":" + "Blind", 0);
+ infamy = new CurseInfamy(4, Reference.MODNAME + ":" + "Infamy", 0);
isInitialized = true;
}
}