Reworked damage-modifying upgrades

This commit is contained in:
WayofTime 2016-04-07 14:22:45 -04:00
parent aa6d7bcfaa
commit bd36e95fc9
5 changed files with 53 additions and 30 deletions

View file

@ -1,5 +1,19 @@
package WayofTime.bloodmagic.livingArmour;
import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.world.World;
import WayofTime.bloodmagic.api.iface.IUpgradeTrainer;
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
import WayofTime.bloodmagic.api.livingArmour.LivingArmourHandler;
@ -12,20 +26,6 @@ import WayofTime.bloodmagic.util.helper.TextHelper;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.world.World;
import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
public class LivingArmour implements ILivingArmour
{
public static String chatBase = "chat.BloodMagic.livingArmour.";
@ -46,6 +46,17 @@ public class LivingArmour implements ILivingArmour
}
}
public double getAdditionalDamageOnHit(double damage, EntityPlayer wearer, EntityLivingBase hitEntity, ItemStack weapon)
{
double total = 0;
for (Entry<String, LivingArmourUpgrade> entry : upgradeMap.entrySet())
{
total += entry.getValue().getAdditionalDamageOnHit(damage, wearer, hitEntity, weapon);
}
return total;
}
@Override
public Multimap<String, AttributeModifier> getAttributeModifiers()
{

View file

@ -1,5 +1,9 @@
package WayofTime.bloodmagic.livingArmour.upgrade;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
@ -14,6 +18,17 @@ public class LivingArmourUpgradeGraveDigger extends LivingArmourUpgrade
super(level);
}
@Override
public double getAdditionalDamageOnHit(double damage, EntityPlayer wearer, EntityLivingBase hitEntity, ItemStack weapon)
{
if (weapon != null && weapon.getItem() instanceof ItemSpade)
{
return getDamageModifier();
}
return 0;
}
public double getDamageModifier()
{
return damageBoost[this.level];

View file

@ -1,16 +1,15 @@
package WayofTime.bloodmagic.livingArmour.upgrade;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.MobEffects;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
import WayofTime.bloodmagic.util.ChatUtil;
import WayofTime.bloodmagic.util.helper.TextHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.MobEffects;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
public class LivingArmourUpgradePoisonResist extends LivingArmourUpgrade
{