diff options
| author | OnyxDarkKnight <sor1n.iliutza16@gmail.com> | 2015-03-23 14:51:06 +0000 |
|---|---|---|
| committer | OnyxDarkKnight <sor1n.iliutza16@gmail.com> | 2015-03-23 14:51:06 +0000 |
| commit | 6312636fd9a4d0f56dc7c9ff474a99d879bcb4e9 (patch) | |
| tree | e3279753210bfb169a00cd3f146a80baf624150e /src/main/java/darkknight/jewelrycraft/curses | |
| parent | e86949a1ad3269ec66c9de65e2c92f5e66251411 (diff) | |
Reworked the whole repo.
Diffstat (limited to 'src/main/java/darkknight/jewelrycraft/curses')
7 files changed, 285 insertions, 0 deletions
diff --git a/src/main/java/darkknight/jewelrycraft/curses/Curse.java b/src/main/java/darkknight/jewelrycraft/curses/Curse.java new file mode 100644 index 0000000..f833542 --- /dev/null +++ b/src/main/java/darkknight/jewelrycraft/curses/Curse.java @@ -0,0 +1,116 @@ +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; + +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>(); + + /** + * @param id the ID of the curse + * @param name the name of the curse + * @param texturepack the ID of the pack the texture is located in + */ + protected Curse(int id, String name, int texturepack) + { + this.id = id; + this.name = name; + this.texturepack = texturepack; + curses.add(this); + availableCurses.add(this); + } + + /** + * @return the name of the curse + */ + public String getName() + { + return name; + } + + /** + * @return the description of the curse + */ + public String getDescription() + { + return description; + } + + public Curse setDescription(String desc) + { + description = desc; + return this; + } + + /** + * @return the curse ID + */ + public int getID() + { + return id; + } + + /** + * @return the texture pack ID + */ + public int getTexturePack() + { + return texturepack; + } + + /** + * @param world + * @param player + */ + 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() + { + return false; + } + + /** + * @return + */ + public static ArrayList<Curse> getCurseList() + { + return curses; + } +} diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseBlind.java b/src/main/java/darkknight/jewelrycraft/curses/CurseBlind.java new file mode 100644 index 0000000..62483cd --- /dev/null +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseBlind.java @@ -0,0 +1,25 @@ +package darkknight.jewelrycraft.curses; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.world.World; + +public class CurseBlind extends Curse +{ + public CurseBlind(int id, String name, int text) + { + super(id, name, text); + } + + @Override + public void action(World world, EntityPlayer player) + { + if (!player.isPotionActive(Potion.blindness) || player.getActivePotionEffect(Potion.blindness).getDuration() < 30) player.addPotionEffect(new PotionEffect(Potion.blindness.id, 60)); + } + + public String getDescription() + { + return "You see the light slowly fading in front of you"; + } +} diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseFlamingSoul.java b/src/main/java/darkknight/jewelrycraft/curses/CurseFlamingSoul.java new file mode 100644 index 0000000..8718524 --- /dev/null +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseFlamingSoul.java @@ -0,0 +1,23 @@ +package darkknight.jewelrycraft.curses; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.world.World; + +public class CurseFlamingSoul extends Curse +{ + public CurseFlamingSoul(int id, String name, int text) + { + super(id, name, text); + } + + @Override + public void action(World world, EntityPlayer player) + { + if (!player.isBurning() && rand.nextInt(20) == 0) player.setFire(5); + } + + public String getDescription() + { + return "Is it me or is it getting hot in here?"; + } +} diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseGreed.java b/src/main/java/darkknight/jewelrycraft/curses/CurseGreed.java new file mode 100644 index 0000000..1626925 --- /dev/null +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseGreed.java @@ -0,0 +1,30 @@ +package darkknight.jewelrycraft.curses; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.world.World; + +public class CurseGreed extends Curse +{ + public CurseGreed(int id, String name, int text) + { + super(id, name, text); + } + + @Override + public void action(World world, EntityPlayer player) + { + } + + @Override + public boolean itemToss() + { + return true; + } + + public String getDescription() + { + return "You might need that later"; + } +} diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseInfamy.java b/src/main/java/darkknight/jewelrycraft/curses/CurseInfamy.java new file mode 100644 index 0000000..aa815f7 --- /dev/null +++ b/src/main/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/src/main/java/darkknight/jewelrycraft/curses/CurseList.java b/src/main/java/darkknight/jewelrycraft/curses/CurseList.java new file mode 100644 index 0000000..4e796ff --- /dev/null +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseList.java @@ -0,0 +1,25 @@ +package darkknight.jewelrycraft.curses; + +import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import darkknight.jewelrycraft.lib.Reference; + +public class CurseList +{ + private static Curse rotten, flaming, blind, greed, infamy; + private static boolean isInitialized = false; + + /** + * @param e + */ + public static void preInit(FMLPreInitializationEvent e) + { + if (!isInitialized){ + rotten = new CurseRottenHeart(0, Reference.MODNAME + ":" + "Rotten Heart", 0); + 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; + } + } +} diff --git a/src/main/java/darkknight/jewelrycraft/curses/CurseRottenHeart.java b/src/main/java/darkknight/jewelrycraft/curses/CurseRottenHeart.java new file mode 100644 index 0000000..f7fcfae --- /dev/null +++ b/src/main/java/darkknight/jewelrycraft/curses/CurseRottenHeart.java @@ -0,0 +1,25 @@ +package darkknight.jewelrycraft.curses; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.world.World; + +public class CurseRottenHeart extends Curse +{ + public CurseRottenHeart(int id, String name, int text) + { + super(id, name, text); + } + + @Override + public void action(World world, EntityPlayer player) + { + if (!player.isPotionActive(Potion.poison) || player.getActivePotionEffect(Potion.poison).getDuration() < 30) player.addPotionEffect(new PotionEffect(Potion.poison.id, 80)); + } + + public String getDescription() + { + return "Your heart slowly rots inside"; + } +} |
