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! :)

This commit is contained in:
WayofTime 2015-04-12 10:59:41 -04:00
parent 19d768bbfb
commit efa5d89539
8 changed files with 192 additions and 42 deletions

View file

@ -5,6 +5,7 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Random;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
@ -67,6 +68,8 @@ public class AlchemicalWizardryEventHooks
public static Map<Integer, List<CoordAndRange>> respawnMap = new HashMap(); public static Map<Integer, List<CoordAndRange>> respawnMap = new HashMap();
public static Map<Integer, List<CoordAndRange>> forceSpawnMap = new HashMap(); public static Map<Integer, List<CoordAndRange>> forceSpawnMap = new HashMap();
public static Random rand = new Random();
@SubscribeEvent @SubscribeEvent
public void onEntityInteractEvent(EntityInteractEvent event) public void onEntityInteractEvent(EntityInteractEvent event)
@ -149,6 +152,14 @@ public class AlchemicalWizardryEventHooks
APISpellHelper.setCurrentAdditionalHP(player, Math.max(0, hp)); APISpellHelper.setCurrentAdditionalHP(player, Math.max(0, hp));
NewPacketHandler.INSTANCE.sendTo(NewPacketHandler.getAddedHPPacket(Math.max(0, hp), APISpellHelper.getCurrentAdditionalMaxHP(player)), (EntityPlayerMP)player); 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++;
}
}
} }
} }
} }

View file

@ -168,6 +168,21 @@ public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialA
return false; return false;
} }
public boolean isAffectedBySoulHarden()
{
return true;
}
public double getBaseArmourReduction()
{
return 0.9;
}
public double getArmourPenetrationReduction()
{
return 0.9;
}
@Override @Override
public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) 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; 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); damageAmount *= (armourReduction);
@ -224,7 +239,7 @@ public class BoundArmour extends ItemArmor implements IAlchemyGoggles, ISpecialA
{ {
if (source.isUnblockable()) if (source.isUnblockable())
{ {
return new ArmorProperties(-1, damageAmount * 0.9d, maxAbsorption); return new ArmorProperties(-1, damageAmount * getArmourPenetrationReduction(), maxAbsorption);
} }
return new ArmorProperties(-1, damageAmount, maxAbsorption); return new ArmorProperties(-1, damageAmount, maxAbsorption);

View file

@ -3,6 +3,7 @@ package WayofTime.alchemicalWizardry.common.items.armour;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
@ -38,6 +39,8 @@ public abstract class OmegaArmour extends BoundArmour
protected boolean storeYLevel = false; protected boolean storeYLevel = false;
protected boolean storeSeesSky = false; protected boolean storeSeesSky = false;
protected List<Enchantment> illegalEnchantmentList = new LinkedList();
public float reagentDrainPerDamage = 0.1f; public float reagentDrainPerDamage = 0.1f;
public OmegaArmour(int armorType) public OmegaArmour(int armorType)
@ -60,31 +63,52 @@ public abstract class OmegaArmour extends BoundArmour
this.reagent = reagent; this.reagent = reagent;
} }
@Override
public boolean isAffectedBySoulHarden()
{
return false;
}
@Override
public double getBaseArmourReduction()
{
return 0.9;
}
@Override
public double getArmourPenetrationReduction()
{
return 0.5;
}
@Override @Override
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack)
{ {
super.onArmorTick(world, player, itemStack); super.onArmorTick(world, player, itemStack);
if(this.storeBiomeID()) if(world.getWorldTime() % 50 == 0)
{ {
int xCoord = (int) Math.floor(player.posX); if(this.storeBiomeID())
int zCoord = (int) Math.floor(player.posZ);
BiomeGenBase biome = world.getBiomeGenForCoords(xCoord, zCoord);
if(biome != null)
{ {
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) 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(); List newEnchantList = new ArrayList();
for(Entry<Enchantment, Map<Integer, Integer>> entry : map.entrySet()) //Assume enchant # 0 is level 1 enchant for(Entry<Enchantment, Map<Integer, Integer>> entry : map.entrySet())
{ {
Enchantment ench = entry.getKey(); Enchantment ench = entry.getKey();
Map<Integer, Integer> numMap = entry.getValue(); Map<Integer, Integer> numMap = entry.getValue();

View file

@ -1,10 +1,19 @@
package WayofTime.alchemicalWizardry.common.items.armour; 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.model.ModelBiped;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.Entity; 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.item.ItemStack;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.biome.BiomeGenBase;
import WayofTime.alchemicalWizardry.ModItems; import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelOmegaFire; import WayofTime.alchemicalWizardry.common.renderer.model.ModelOmegaFire;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@ -20,7 +29,8 @@ public class OmegaArmourFire extends OmegaArmour
public OmegaArmourFire(int armorType) public OmegaArmourFire(int armorType)
{ {
super(armorType); super(armorType);
// this.storeYLevel = true; this.storeBiomeID = true;
this.illegalEnchantmentList.add(Enchantment.fireProtection);
} }
@Override @Override
@ -81,17 +91,21 @@ public class OmegaArmourFire extends OmegaArmour
return this.itemIcon; return this.itemIcon;
} }
// @Override @Override
// public Multimap getAttributeModifiers(ItemStack stack) public Multimap getAttributeModifiers(ItemStack stack)
// { {
// Multimap map = HashMultimap.create(); Multimap map = HashMultimap.create();
// int biomeID = this.getBiomeIDStored(stack);
//// map.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(85212 /** Random number **/, armorType), "Armor modifier" + armorType, getDefaultHealthBoost()*getHealthBoostModifierForLevel(yLevel), 0)); BiomeGenBase biome = BiomeGenBase.getBiome(biomeID);
// if(biome != null)
// return map; {
// } 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) switch(this.armorType)
{ {
@ -107,8 +121,47 @@ public class OmegaArmourFire extends OmegaArmour
return 0.25f; return 0.25f;
} }
// public float getHealthBoostModifierForLevel(int yLevel) public float getHealthBoostModifierForBiome(BiomeGenBase biome)
// { {
// return (float)Math.sqrt(((float)yLevel)/64f) * 1.5f - 1; 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;
}
} }

View file

@ -94,13 +94,13 @@ public class OmegaArmourWind extends OmegaArmour
{ {
Multimap map = HashMultimap.create(); Multimap map = HashMultimap.create();
int yLevel = this.getYLevelStored(stack); int yLevel = this.getYLevelStored(stack);
map.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(85212 /** Random number **/, armorType), "Health modifier" + armorType, getDefaultArmourBoost()*getHealthBoostModifierForLevel(yLevel), 1));
map.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(85212 /** Random number **/, armorType), "Armor modifier" + armorType, getDefaultHealthBoost()*getHealthBoostModifierForLevel(yLevel), 0)); map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(86212 /** Random number **/, armorType), "Damage modifier" + armorType, getDefaultArmourBoost()*getDamageModifierForLevel(yLevel), 2));
return map; return map;
} }
public float getDefaultHealthBoost() public float getDefaultArmourBoost()
{ {
switch(this.armorType) switch(this.armorType)
{ {
@ -118,6 +118,11 @@ public class OmegaArmourWind extends OmegaArmour
public float getHealthBoostModifierForLevel(int yLevel) 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);
} }
} }

View file

@ -1,8 +1,11 @@
package WayofTime.alchemicalWizardry.common.omega; package WayofTime.alchemicalWizardry.common.omega;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmour; import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmour;
@ -23,7 +26,31 @@ public class OmegaParadigmFire extends OmegaParadigm
@Override @Override
public void onUpdate(World world, EntityPlayer player, ItemStack stack) 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 @Override

View file

@ -3,6 +3,8 @@ package WayofTime.alchemicalWizardry.common.omega;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmour; 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) 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 @Override
@ -29,7 +31,12 @@ public class OmegaParadigmWind extends OmegaParadigm
@Override @Override
public void onUpdate(World world, EntityPlayer player, ItemStack stack) 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 @Override

Binary file not shown.

Before

Width:  |  Height:  |  Size: 513 B

After

Width:  |  Height:  |  Size: 737 B