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 ac9881c1..e2619401 100644 Binary files a/src/main/resources/assets/alchemicalwizardry/textures/gui/HPBar1.png and b/src/main/resources/assets/alchemicalwizardry/textures/gui/HPBar1.png differ