From efa5d89539f0eab41228975b9f4b9ccf17dde583 Mon Sep 17 00:00:00 2001 From: WayofTime Date: Sun, 12 Apr 2015 10:59:41 -0400 Subject: [PATCH] Added several environmental-based abilities to the Wind and Fire armours. Tweaked the base armour penetration protection on the Omega armour to be a bit more balanced. Made the extra HP bar more fancy! :) --- .../common/AlchemicalWizardryEventHooks.java | 11 +++ .../common/items/armour/BoundArmour.java | 19 +++- .../common/items/armour/OmegaArmour.java | 68 ++++++++++---- .../common/items/armour/OmegaArmourFire.java | 83 ++++++++++++++---- .../common/items/armour/OmegaArmourWind.java | 13 ++- .../common/omega/OmegaParadigmFire.java | 29 +++++- .../common/omega/OmegaParadigmWind.java | 11 ++- .../textures/gui/HPBar1.png | Bin 513 -> 737 bytes 8 files changed, 192 insertions(+), 42 deletions(-) diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/AlchemicalWizardryEventHooks.java b/src/main/java/WayofTime/alchemicalWizardry/common/AlchemicalWizardryEventHooks.java index c66afeb2..9361c7e2 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/AlchemicalWizardryEventHooks.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/AlchemicalWizardryEventHooks.java @@ -5,6 +5,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.entity.Entity; @@ -67,6 +68,8 @@ public class AlchemicalWizardryEventHooks public static Map> respawnMap = new HashMap(); public static Map> forceSpawnMap = new HashMap(); + + public static Random rand = new Random(); @SubscribeEvent public void onEntityInteractEvent(EntityInteractEvent event) @@ -149,6 +152,14 @@ public class AlchemicalWizardryEventHooks APISpellHelper.setCurrentAdditionalHP(player, Math.max(0, hp)); NewPacketHandler.INSTANCE.sendTo(NewPacketHandler.getAddedHPPacket(Math.max(0, hp), APISpellHelper.getCurrentAdditionalMaxHP(player)), (EntityPlayerMP)player); + + if(event.ammount <= 0.3) + { + if(rand.nextInt(10) == 0) + { + event.ammount++; + } + } } } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/BoundArmour.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/BoundArmour.java index ff3adbec..7b0ec6b0 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/BoundArmour.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/BoundArmour.java @@ -168,6 +168,21 @@ public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialA return false; } + public boolean isAffectedBySoulHarden() + { + return true; + } + + public double getBaseArmourReduction() + { + return 0.9; + } + + public double getArmourPenetrationReduction() + { + return 0.9; + } + @Override public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { @@ -188,7 +203,7 @@ public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialA h = player.getActivePotionEffect(AlchemicalWizardry.customPotionSoulHarden).getAmplifier() + 1; } - armourReduction = 1 - 0.1 * Math.pow(1.0/3.0, Math.max(0, h - f)) - 0.1 * Math.max(0, f-h); + armourReduction = isAffectedBySoulHarden() ? 1 - (1 - this.getBaseArmourReduction()) * Math.pow(1.0/3.0, Math.max(0, h - f)) - 0.1 * Math.max(0, f-h) : getBaseArmourReduction(); damageAmount *= (armourReduction); @@ -224,7 +239,7 @@ public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialA { if (source.isUnblockable()) { - return new ArmorProperties(-1, damageAmount * 0.9d, maxAbsorption); + return new ArmorProperties(-1, damageAmount * getArmourPenetrationReduction(), maxAbsorption); } return new ArmorProperties(-1, damageAmount, maxAbsorption); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/OmegaArmour.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/OmegaArmour.java index ca6020ee..ca77e14b 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/OmegaArmour.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/OmegaArmour.java @@ -3,6 +3,7 @@ package WayofTime.alchemicalWizardry.common.items.armour; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -38,6 +39,8 @@ public abstract class OmegaArmour extends BoundArmour protected boolean storeYLevel = false; protected boolean storeSeesSky = false; + protected List illegalEnchantmentList = new LinkedList(); + public float reagentDrainPerDamage = 0.1f; public OmegaArmour(int armorType) @@ -60,31 +63,52 @@ public abstract class OmegaArmour extends BoundArmour this.reagent = reagent; } + @Override + public boolean isAffectedBySoulHarden() + { + return false; + } + + @Override + public double getBaseArmourReduction() + { + return 0.9; + } + + @Override + public double getArmourPenetrationReduction() + { + return 0.5; + } + @Override public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { super.onArmorTick(world, player, itemStack); - if(this.storeBiomeID()) + if(world.getWorldTime() % 50 == 0) { - int xCoord = (int) Math.floor(player.posX); - int zCoord = (int) Math.floor(player.posZ); - - BiomeGenBase biome = world.getBiomeGenForCoords(xCoord, zCoord); - if(biome != null) + if(this.storeBiomeID()) { - this.setBiomeIDStored(itemStack, biome.biomeID); + int xCoord = (int) Math.floor(player.posX); + int zCoord = (int) Math.floor(player.posZ); + + BiomeGenBase biome = world.getBiomeGenForCoords(xCoord, zCoord); + if(biome != null) + { + this.setBiomeIDStored(itemStack, biome.biomeID); + } + } + + if(this.storeDimensionID()) + { + this.setDimensionIDStored(itemStack, world.provider.dimensionId); + } + + if(this.storeYLevel()) + { + this.setYLevelStored(itemStack, (int) Math.floor(player.posY)); } - } - - if(this.storeDimensionID()) - { - this.setDimensionIDStored(itemStack, world.provider.dimensionId); - } - - if(this.storeYLevel()) - { - this.setYLevelStored(itemStack, (int) Math.floor(player.posY)); } if(this.armorType == 1) @@ -172,9 +196,17 @@ public abstract class OmegaArmour extends BoundArmour } } + for(Enchantment ench : this.illegalEnchantmentList) + { + if(map.containsKey(ench)) + { + map.remove(ench); + } + } + List newEnchantList = new ArrayList(); - for(Entry> entry : map.entrySet()) //Assume enchant # 0 is level 1 enchant + for(Entry> entry : map.entrySet()) { Enchantment ench = entry.getKey(); Map numMap = entry.getValue(); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/OmegaArmourFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/OmegaArmourFire.java index 644ca704..0d060d57 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/OmegaArmourFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/OmegaArmourFire.java @@ -1,10 +1,19 @@ package WayofTime.alchemicalWizardry.common.items.armour; +import java.util.UUID; + +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; + import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.enchantment.Enchantment; import net.minecraft.entity.Entity; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; +import net.minecraft.world.biome.BiomeGenBase; import WayofTime.alchemicalWizardry.ModItems; import WayofTime.alchemicalWizardry.common.renderer.model.ModelOmegaFire; import cpw.mods.fml.relauncher.Side; @@ -20,7 +29,8 @@ public class OmegaArmourFire extends OmegaArmour public OmegaArmourFire(int armorType) { super(armorType); -// this.storeYLevel = true; + this.storeBiomeID = true; + this.illegalEnchantmentList.add(Enchantment.fireProtection); } @Override @@ -81,17 +91,21 @@ public class OmegaArmourFire extends OmegaArmour return this.itemIcon; } -// @Override -// public Multimap getAttributeModifiers(ItemStack stack) -// { -// Multimap map = HashMultimap.create(); -// -//// map.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(85212 /** Random number **/, armorType), "Armor modifier" + armorType, getDefaultHealthBoost()*getHealthBoostModifierForLevel(yLevel), 0)); -// -// return map; -// } + @Override + public Multimap getAttributeModifiers(ItemStack stack) + { + Multimap map = HashMultimap.create(); + int biomeID = this.getBiomeIDStored(stack); + BiomeGenBase biome = BiomeGenBase.getBiome(biomeID); + if(biome != null) + { + map.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(895132 /** Random number **/, armorType), "Health modifier" + armorType, getDefaultArmourBoost()*getHealthBoostModifierForBiome(biome), 1)); + map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(196312 /** Random number **/, armorType), "Damage modifier" + armorType, getDefaultArmourBoost()*getDamageModifierForBiome(biome), 1)); + } + return map; + } - public float getDefaultHealthBoost() + public float getDefaultArmourBoost() { switch(this.armorType) { @@ -107,8 +121,47 @@ public class OmegaArmourFire extends OmegaArmour return 0.25f; } -// public float getHealthBoostModifierForLevel(int yLevel) -// { -// return (float)Math.sqrt(((float)yLevel)/64f) * 1.5f - 1; -// } + public float getHealthBoostModifierForBiome(BiomeGenBase biome) + { + float modifier = 0.05f; + + if(biome.isEqualTo(BiomeGenBase.hell)) + { + return modifier * 2.0f; + } + + if(biome.isEqualTo(BiomeGenBase.ocean)) + { + return modifier * -0.5f; + } + + if(biome.temperature >= 1) + { + return modifier * 1.5f; + } + + return modifier * 0.5f; + } + + public float getDamageModifierForBiome(BiomeGenBase biome) + { + float modifier = 0.03f; + + if(biome.isEqualTo(BiomeGenBase.hell)) + { + return modifier * 2.0f; + } + + if(biome.isEqualTo(BiomeGenBase.ocean)) + { + return modifier * -0.5f; + } + + if(biome.temperature >= 1) + { + return modifier * 1.5f; + } + + return modifier * 0.5f; + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/OmegaArmourWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/OmegaArmourWind.java index ad504314..40f090de 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/OmegaArmourWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/items/armour/OmegaArmourWind.java @@ -94,13 +94,13 @@ public class OmegaArmourWind extends OmegaArmour { Multimap map = HashMultimap.create(); int yLevel = this.getYLevelStored(stack); - - map.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(85212 /** Random number **/, armorType), "Armor modifier" + armorType, getDefaultHealthBoost()*getHealthBoostModifierForLevel(yLevel), 0)); + map.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(85212 /** Random number **/, armorType), "Health modifier" + armorType, getDefaultArmourBoost()*getHealthBoostModifierForLevel(yLevel), 1)); + map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(86212 /** Random number **/, armorType), "Damage modifier" + armorType, getDefaultArmourBoost()*getDamageModifierForLevel(yLevel), 2)); return map; } - public float getDefaultHealthBoost() + public float getDefaultArmourBoost() { switch(this.armorType) { @@ -118,6 +118,11 @@ public class OmegaArmourWind extends OmegaArmour public float getHealthBoostModifierForLevel(int yLevel) { - return (float)Math.sqrt(((float)yLevel)/64f) * 1.5f - 1; + return 0.05f * ((((float)yLevel)/64f) * 1.5f - 1); + } + + public float getDamageModifierForLevel(int yLevel) + { + return 0.02f * ((((float)yLevel)/64f) * 1.5f - 1); } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaParadigmFire.java b/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaParadigmFire.java index b1efe91d..70477d72 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaParadigmFire.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaParadigmFire.java @@ -1,8 +1,11 @@ package WayofTime.alchemicalWizardry.common.omega; +import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmour; @@ -23,7 +26,31 @@ public class OmegaParadigmFire extends OmegaParadigm @Override public void onUpdate(World world, EntityPlayer player, ItemStack stack) { - + if(world.getWorldTime() % 100 == 0 && !world.isRemote) + { + boolean isInLava = player.isInsideOfMaterial(Material.lava); + if(player.isBurning() && player.getHealth() < player.getMaxHealth()) + { + player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 200, isInLava ? 1 : 0, true)); + } + + if(player.isBurning()) + { + player.addPotionEffect(new PotionEffect(Potion.damageBoost.id, isInLava ? 400 : 200, isInLava ? 1 : 0, true)); + } + + if(player.isInWater()) + { + player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 200, 2, true)); + player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 200, 2, true)); + player.addPotionEffect(new PotionEffect(Potion.weakness.id, 200, 1, true)); + } + } + + if(player.isBurning()) + { + player.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 200, 0, true)); + } } @Override diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaParadigmWind.java b/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaParadigmWind.java index f994b549..1276863c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaParadigmWind.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/omega/OmegaParadigmWind.java @@ -3,6 +3,8 @@ package WayofTime.alchemicalWizardry.common.omega; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmour; @@ -11,7 +13,7 @@ public class OmegaParadigmWind extends OmegaParadigm { public OmegaParadigmWind(OmegaArmour helmet, OmegaArmour chestPiece, OmegaArmour leggings, OmegaArmour boots) { - super(ReagentRegistry.aetherReagent, helmet, chestPiece, leggings, boots, new ReagentRegenConfiguration(50, 10, 100)); + super(ReagentRegistry.aetherReagent, helmet, chestPiece, leggings, boots, new ReagentRegenConfiguration(50, 1, 10)); } @Override @@ -29,7 +31,12 @@ public class OmegaParadigmWind extends OmegaParadigm @Override public void onUpdate(World world, EntityPlayer player, ItemStack stack) { - + if(world.getWorldTime() % 100 == 0 && !world.isRemote && player.posY > 128 && player.getHealth() < player.getMaxHealth()) + { + player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 200, player.posY > 128 + 64 ? 1 : 0, true)); + } + + player.fallDistance = 0; } @Override diff --git a/src/main/resources/assets/alchemicalwizardry/textures/gui/HPBar1.png b/src/main/resources/assets/alchemicalwizardry/textures/gui/HPBar1.png index ac9881c1de85b2bf825eb8c75605071c1e0abe21..e26194011dc65e4f7d7f53fe39ceaff0ca5e8d30 100644 GIT binary patch delta 667 zcmV;M0%ZMx1mOjcDlrrQ4FHcB{D7Aq&l?6O;tTPuG8MM*?KR9M69md|SwQ4q&JlW4oXYNb+)AjN|xbC5>rp#`DG z+KX5JnjZEa@UIX&s$kZhTJ&Z@>jqq*M+;&>{D~oIldp&DE}QMvCLs2*0}qxr^JYHt z-kW)Ak~mGNaLQ5wlmI2bsRNvu#CY2bfXkpmpcXj*KGeGmfUkdG0IL%;H_Lazj#)Z! zQ?h*U8t4G*M&!g&tZc*Ede;C^0I_4HLHxax@i}q??ZD`msTMhE&QXip2uvcsflHu+ zdKcQm;CuBhaquIuYo@D_W5GEVB1hXy?Z8HNpePW)uO_y1S4Vc|6PO;tln2x2V0I4P zFOx#7X0mJt2J3&LZ~}hBb{58qp7{QW=XGymgT%Ji>*0Cci2hEje>sM)+p#SnND`9p zeLwxqj$}Rr7xLU2!@AuP-)tcZEnk072^cgtJ74v+q3}43$UZ0WFJOJZ0}bw@YuBA-XPovH zQ4-t(OS)es!2UW~i5x4=u^c(3y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G` z2j2k-6f_fA+H?z%TPuG7Wl2OqR9M69md{GVKoEz&O)8WYQ4zt57f;Elmp+5gK9tCU zK8hfC5X3Eb@y|su1usf_^cn1-5lp6snAX-LCiT#RyRb0q%>MFiW@lI>BCK*ataw-e z3t#~(zz=|aPnB+sg9jyVFXiL2v{l-QQ>WL3p-G(Wj;K7bn^S)!8#_>M!1^}qdHJzL z+O;$w8YGUPfzg7_0^Zto$%3TeV7=5 zK|}-*L2Es=zt6n&z#vaoNZI(s^}rx=097}SK*aN8QKPI*CO}z%z#y+A5P?Ce{ynX= zOaYeJoI?CHg-d;3!Z?oUwvT9T!o}S&Q4}q836+S