Added melee damage upgrade (Fierce strike)
This commit is contained in:
parent
65e0cea9af
commit
82ac4f5ae8
|
@ -1,9 +1,9 @@
|
||||||
------------------------------------------------------
|
------------------------------------------------------
|
||||||
Version 2.0.0-4
|
Version 2.0.0-4
|
||||||
------------------------------------------------------
|
------------------------------------------------------
|
||||||
- Added Physical resistance upgrade (Tough skin).
|
- Added Physical resistance upgrade (Tough skin)
|
||||||
- Added health boost upgrade (Healthy)
|
- Added health boost upgrade (Healthy)
|
||||||
|
- Added melee damage upgrade (Fierce strike)
|
||||||
|
|
||||||
------------------------------------------------------
|
------------------------------------------------------
|
||||||
Version 2.0.0-3
|
Version 2.0.0-3
|
||||||
|
|
|
@ -0,0 +1,78 @@
|
||||||
|
package WayofTime.bloodmagic.livingArmour;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import net.minecraft.entity.SharedMonsterAttributes;
|
||||||
|
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import WayofTime.bloodmagic.api.Constants;
|
||||||
|
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
|
||||||
|
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||||
|
|
||||||
|
import com.google.common.collect.HashMultimap;
|
||||||
|
import com.google.common.collect.Multimap;
|
||||||
|
|
||||||
|
public class LivingArmourUpgradeMeleeDamage extends LivingArmourUpgrade
|
||||||
|
{
|
||||||
|
public static final int[] costs = new int[] { 5, 12, 20, 35, 49, 78, 110, 160, 215, 320 };
|
||||||
|
public static final double[] meleeDamage = new double[] { 0.5, 1, 1.5, 2, 2.5, 3, 4, 5, 6, 7 };
|
||||||
|
|
||||||
|
public LivingArmourUpgradeMeleeDamage(int level)
|
||||||
|
{
|
||||||
|
super(level);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Multimap<String, AttributeModifier> getAttributeModifiers()
|
||||||
|
{
|
||||||
|
Multimap<String, AttributeModifier> modifierMap = HashMultimap.<String, AttributeModifier>create();
|
||||||
|
|
||||||
|
modifierMap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(9423688, 1), "damage modifier" + 1, meleeDamage[this.level], 0));
|
||||||
|
|
||||||
|
return modifierMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUniqueIdentifier()
|
||||||
|
{
|
||||||
|
return Constants.Mod.MODID + ".upgrade.meleeDamage";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxTier()
|
||||||
|
{
|
||||||
|
return 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCostOfUpgrade()
|
||||||
|
{
|
||||||
|
return costs[this.level];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNBT(NBTTagCompound tag)
|
||||||
|
{
|
||||||
|
// EMPTY
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readFromNBT(NBTTagCompound tag)
|
||||||
|
{
|
||||||
|
// EMPTY
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUnlocalizedName()
|
||||||
|
{
|
||||||
|
return tooltipBase + "meleeDamage";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,87 @@
|
||||||
|
package WayofTime.bloodmagic.livingArmour;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import WayofTime.bloodmagic.api.Constants;
|
||||||
|
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||||
|
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
||||||
|
|
||||||
|
public class StatTrackerMeleeDamage extends StatTracker
|
||||||
|
{
|
||||||
|
public double totalDamageDealt = 0;
|
||||||
|
|
||||||
|
public static HashMap<LivingArmour, Double> changeMap = new HashMap<LivingArmour, Double>();
|
||||||
|
public static int[] damageRequired = new int[] { 200, 800, 1300, 2500, 3800, 5000, 7000, 9200, 11500, 140000 };
|
||||||
|
|
||||||
|
public static void incrementCounter(LivingArmour armour, double damage)
|
||||||
|
{
|
||||||
|
changeMap.put(armour, changeMap.containsKey(armour) ? changeMap.get(armour) + damage : damage);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUniqueIdentifier()
|
||||||
|
{
|
||||||
|
return Constants.Mod.MODID + ".tracker.meleeDamage";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resetTracker()
|
||||||
|
{
|
||||||
|
this.totalDamageDealt = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readFromNBT(NBTTagCompound tag)
|
||||||
|
{
|
||||||
|
totalDamageDealt = tag.getDouble(Constants.Mod.MODID + ".tracker.meleeDamage");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNBT(NBTTagCompound tag)
|
||||||
|
{
|
||||||
|
tag.setDouble(Constants.Mod.MODID + ".tracker.meleeDamage", totalDamageDealt);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||||
|
{
|
||||||
|
if (changeMap.containsKey(livingArmour))
|
||||||
|
{
|
||||||
|
double change = Math.abs(changeMap.get(livingArmour));
|
||||||
|
if (change > 0)
|
||||||
|
{
|
||||||
|
totalDamageDealt += Math.abs(changeMap.get(livingArmour));
|
||||||
|
|
||||||
|
changeMap.put(livingArmour, 0d);
|
||||||
|
|
||||||
|
this.markDirty();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<LivingArmourUpgrade> getUpgrades()
|
||||||
|
{
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
List<LivingArmourUpgrade> upgradeList = new ArrayList<LivingArmourUpgrade>();
|
||||||
|
|
||||||
|
for (int i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
if (totalDamageDealt >= damageRequired[i])
|
||||||
|
{
|
||||||
|
upgradeList.add(new LivingArmourUpgradeMeleeDamage(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return upgradeList;
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,13 +4,17 @@ import WayofTime.bloodmagic.api.livingArmour.LivingArmourHandler;
|
||||||
import WayofTime.bloodmagic.livingArmour.LivingArmourUpgradeDigging;
|
import WayofTime.bloodmagic.livingArmour.LivingArmourUpgradeDigging;
|
||||||
import WayofTime.bloodmagic.livingArmour.LivingArmourUpgradeHealthboost;
|
import WayofTime.bloodmagic.livingArmour.LivingArmourUpgradeHealthboost;
|
||||||
import WayofTime.bloodmagic.livingArmour.LivingArmourUpgradeKnockbackResist;
|
import WayofTime.bloodmagic.livingArmour.LivingArmourUpgradeKnockbackResist;
|
||||||
|
import WayofTime.bloodmagic.livingArmour.LivingArmourUpgradeMeleeDamage;
|
||||||
|
import WayofTime.bloodmagic.livingArmour.LivingArmourUpgradePhysicalProtect;
|
||||||
import WayofTime.bloodmagic.livingArmour.LivingArmourUpgradePoisonResist;
|
import WayofTime.bloodmagic.livingArmour.LivingArmourUpgradePoisonResist;
|
||||||
import WayofTime.bloodmagic.livingArmour.LivingArmourUpgradeSelfSacrifice;
|
import WayofTime.bloodmagic.livingArmour.LivingArmourUpgradeSelfSacrifice;
|
||||||
import WayofTime.bloodmagic.livingArmour.LivingArmourUpgradeSpeed;
|
import WayofTime.bloodmagic.livingArmour.LivingArmourUpgradeSpeed;
|
||||||
import WayofTime.bloodmagic.livingArmour.StatTrackerDigging;
|
import WayofTime.bloodmagic.livingArmour.StatTrackerDigging;
|
||||||
import WayofTime.bloodmagic.livingArmour.StatTrackerFood;
|
import WayofTime.bloodmagic.livingArmour.StatTrackerFood;
|
||||||
import WayofTime.bloodmagic.livingArmour.StatTrackerHealthboost;
|
import WayofTime.bloodmagic.livingArmour.StatTrackerHealthboost;
|
||||||
|
import WayofTime.bloodmagic.livingArmour.StatTrackerMeleeDamage;
|
||||||
import WayofTime.bloodmagic.livingArmour.StatTrackerMovement;
|
import WayofTime.bloodmagic.livingArmour.StatTrackerMovement;
|
||||||
|
import WayofTime.bloodmagic.livingArmour.StatTrackerPhysicalProtect;
|
||||||
import WayofTime.bloodmagic.livingArmour.StatTrackerPoison;
|
import WayofTime.bloodmagic.livingArmour.StatTrackerPoison;
|
||||||
import WayofTime.bloodmagic.livingArmour.StatTrackerSelfSacrifice;
|
import WayofTime.bloodmagic.livingArmour.StatTrackerSelfSacrifice;
|
||||||
|
|
||||||
|
@ -23,13 +27,17 @@ public class ModArmourTrackers
|
||||||
LivingArmourHandler.registerStatTracker(StatTrackerPoison.class);
|
LivingArmourHandler.registerStatTracker(StatTrackerPoison.class);
|
||||||
LivingArmourHandler.registerStatTracker(StatTrackerSelfSacrifice.class);
|
LivingArmourHandler.registerStatTracker(StatTrackerSelfSacrifice.class);
|
||||||
LivingArmourHandler.registerStatTracker(StatTrackerFood.class);
|
LivingArmourHandler.registerStatTracker(StatTrackerFood.class);
|
||||||
|
LivingArmourHandler.registerStatTracker(StatTrackerPhysicalProtect.class);
|
||||||
LivingArmourHandler.registerStatTracker(StatTrackerHealthboost.class);
|
LivingArmourHandler.registerStatTracker(StatTrackerHealthboost.class);
|
||||||
|
LivingArmourHandler.registerStatTracker(StatTrackerMeleeDamage.class);
|
||||||
|
|
||||||
LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradeSpeed(0));
|
LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradeSpeed(0));
|
||||||
LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradeDigging(0));
|
LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradeDigging(0));
|
||||||
LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradePoisonResist(0));
|
LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradePoisonResist(0));
|
||||||
LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradeSelfSacrifice(0));
|
LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradeSelfSacrifice(0));
|
||||||
LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradeKnockbackResist(0));
|
LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradeKnockbackResist(0));
|
||||||
|
LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradePhysicalProtect(0));
|
||||||
LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradeHealthboost(0));
|
LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradeHealthboost(0));
|
||||||
|
LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradeMeleeDamage(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ import WayofTime.bloodmagic.livingArmour.LivingArmourUpgradeDigging;
|
||||||
import WayofTime.bloodmagic.livingArmour.LivingArmourUpgradeSelfSacrifice;
|
import WayofTime.bloodmagic.livingArmour.LivingArmourUpgradeSelfSacrifice;
|
||||||
import WayofTime.bloodmagic.livingArmour.StatTrackerDigging;
|
import WayofTime.bloodmagic.livingArmour.StatTrackerDigging;
|
||||||
import WayofTime.bloodmagic.livingArmour.StatTrackerHealthboost;
|
import WayofTime.bloodmagic.livingArmour.StatTrackerHealthboost;
|
||||||
|
import WayofTime.bloodmagic.livingArmour.StatTrackerMeleeDamage;
|
||||||
import WayofTime.bloodmagic.livingArmour.StatTrackerPhysicalProtect;
|
import WayofTime.bloodmagic.livingArmour.StatTrackerPhysicalProtect;
|
||||||
import WayofTime.bloodmagic.livingArmour.StatTrackerSelfSacrifice;
|
import WayofTime.bloodmagic.livingArmour.StatTrackerSelfSacrifice;
|
||||||
import WayofTime.bloodmagic.registry.ModBlocks;
|
import WayofTime.bloodmagic.registry.ModBlocks;
|
||||||
|
@ -234,7 +235,6 @@ public class EventHandler
|
||||||
|
|
||||||
if (hasFullSet)
|
if (hasFullSet)
|
||||||
{
|
{
|
||||||
System.out.println(amount);
|
|
||||||
ItemStack chestStack = attackedPlayer.getCurrentArmor(2);
|
ItemStack chestStack = attackedPlayer.getCurrentArmor(2);
|
||||||
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
|
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
|
||||||
if (armour != null)
|
if (armour != null)
|
||||||
|
@ -247,5 +247,36 @@ public class EventHandler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sourceEntity instanceof EntityPlayer)
|
||||||
|
{
|
||||||
|
EntityPlayer player = (EntityPlayer) sourceEntity;
|
||||||
|
|
||||||
|
boolean hasFullSet = true;
|
||||||
|
for (int i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
ItemStack stack = player.getCurrentArmor(i);
|
||||||
|
if (stack == null || !(stack.getItem() instanceof ItemLivingArmour))
|
||||||
|
{
|
||||||
|
hasFullSet = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
float amount = Math.min(Utils.getModifiedDamage(attackedEntity, event.source, event.ammount), attackedEntity.getHealth());
|
||||||
|
|
||||||
|
if (hasFullSet)
|
||||||
|
{
|
||||||
|
ItemStack chestStack = player.getCurrentArmor(2);
|
||||||
|
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
|
||||||
|
if (armour != null)
|
||||||
|
{
|
||||||
|
if (sourceEntity != null && !source.isProjectile())
|
||||||
|
{
|
||||||
|
StatTrackerMeleeDamage.incrementCounter(armour, amount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,6 +225,7 @@ tooltip.BloodMagic.livingArmour.upgrade.selfSacrifice=Tough Palms
|
||||||
tooltip.BloodMagic.livingArmour.upgrade.knockback=Body Builder
|
tooltip.BloodMagic.livingArmour.upgrade.knockback=Body Builder
|
||||||
tooltip.BloodMagic.livingArmour.upgrade.physicalProtect=Tough Skin
|
tooltip.BloodMagic.livingArmour.upgrade.physicalProtect=Tough Skin
|
||||||
tooltip.BloodMagic.livingArmour.upgrade.health=Healthy
|
tooltip.BloodMagic.livingArmour.upgrade.health=Healthy
|
||||||
|
tooltip.BloodMagic.livingArmour.upgrade.meleeDamage=Fierce Strike
|
||||||
tooltip.BloodMagic.livingArmour.upgrade.level=(Level %d)
|
tooltip.BloodMagic.livingArmour.upgrade.level=(Level %d)
|
||||||
|
|
||||||
# Ritual
|
# Ritual
|
||||||
|
|
Loading…
Reference in a new issue