Added poison upgrade. Tweaked digging upgrade so it actually worked.
This commit is contained in:
parent
04f5b7a584
commit
fbaf5de9ab
|
@ -2,6 +2,8 @@
|
|||
Version 2.0.0-3
|
||||
------------------------------------------------------
|
||||
- Fixed client-side issue when shift-clicking lava crystals into a furnace while on a server.
|
||||
- Added poison upgrade to Living Armour
|
||||
- Fixed digging upgrade
|
||||
|
||||
|
||||
------------------------------------------------------
|
||||
|
|
|
@ -72,6 +72,8 @@ public class Constants
|
|||
|
||||
public static final String CHARGE_TIME = "chargeTime";
|
||||
public static final String HELD_DOWN = "heldDown";
|
||||
|
||||
public static final String UPGRADE_POISON_TIMER = "poisonTimer";
|
||||
}
|
||||
|
||||
public static class Mod
|
||||
|
|
|
@ -11,6 +11,8 @@ import com.google.common.collect.Multimap;
|
|||
|
||||
public abstract class LivingArmourUpgrade
|
||||
{
|
||||
public static String chatBase = "chat.BloodMagic.livingArmour.upgrade.";
|
||||
|
||||
/**
|
||||
* Upgrade level 0 is the first upgrade. Upgrade goes from 0 to getMaxTier()
|
||||
* - 1.
|
||||
|
|
|
@ -80,7 +80,7 @@ public class LivingArmour
|
|||
|
||||
public void notifyPlayerOfUpgrade(EntityPlayer user, LivingArmourUpgrade upgrade)
|
||||
{
|
||||
ChatUtil.sendNoSpam(user, TextHelper.localize(chatBase + "newUpgrade"));
|
||||
ChatUtil.sendChat(user, TextHelper.localize(chatBase + "newUpgrade"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
package WayofTime.bloodmagic.livingArmour;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.util.ChatUtil;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
|
||||
public class LivingArmourUpgradePoisonResist extends LivingArmourUpgrade
|
||||
{
|
||||
public static final int[] costs = new int[] { 2, 6, 14, 25, 40 };
|
||||
public static final int[] poisonCooldownTime = new int[] { 1200, 800, 600, 300, 100 };
|
||||
public static final int[] poisonMaxCure = new int[] { 0, 1, 2, 2, 3 };
|
||||
|
||||
public int poisonCooldown = 0;
|
||||
|
||||
public LivingArmourUpgradePoisonResist(int level)
|
||||
{
|
||||
super(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (player.isPotionActive(Potion.poison) && poisonCooldown <= 0)
|
||||
{
|
||||
PotionEffect eff = player.getActivePotionEffect(Potion.poison);
|
||||
if (eff.getAmplifier() <= poisonMaxCure[this.level])
|
||||
{
|
||||
player.removePotionEffect(Potion.poison.id);
|
||||
poisonCooldown = poisonCooldownTime[this.level];
|
||||
|
||||
ChatUtil.sendNoSpam(player, TextHelper.localize(chatBase + "poisonRemove"));
|
||||
}
|
||||
} else if (poisonCooldown > 0)
|
||||
{
|
||||
poisonCooldown--;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
return Constants.Mod.MODID + ".upgrade.poisonResist";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTier()
|
||||
{
|
||||
return 5; // Set to here until I can add more upgrades to it.
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCostOfUpgrade()
|
||||
{
|
||||
return costs[this.level];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
tag.setInteger(Constants.NBT.UPGRADE_POISON_TIMER, poisonCooldown);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
poisonCooldown = tag.getInteger(Constants.NBT.UPGRADE_POISON_TIMER);
|
||||
}
|
||||
}
|
|
@ -13,9 +13,10 @@ import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
|||
|
||||
public class StatTrackerDigging extends StatTracker
|
||||
{
|
||||
public double totalBlocksDug = 0;
|
||||
public int totalBlocksDug = 0;
|
||||
|
||||
public static HashMap<LivingArmour, Integer> changeMap = new HashMap<LivingArmour, Integer>();
|
||||
public static int[] blocksRequired = new int[] { 128, 512, 1024, 2048, 8192, 16000, 32000 };
|
||||
|
||||
public static void incrementCounter(LivingArmour armour)
|
||||
{
|
||||
|
@ -37,13 +38,13 @@ public class StatTrackerDigging extends StatTracker
|
|||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
totalBlocksDug = tag.getDouble(Constants.Mod.MODID + ".tracker.digging");
|
||||
totalBlocksDug = tag.getInteger(Constants.Mod.MODID + ".tracker.digging");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
tag.setDouble(Constants.Mod.MODID + ".tracker.digging", totalBlocksDug);
|
||||
tag.setInteger(Constants.Mod.MODID + ".tracker.digging", totalBlocksDug);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -73,17 +74,13 @@ public class StatTrackerDigging extends StatTracker
|
|||
// TODO Auto-generated method stub
|
||||
List<LivingArmourUpgrade> upgradeList = new ArrayList<LivingArmourUpgrade>();
|
||||
|
||||
if (totalBlocksDug >= 10)
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
upgradeList.add(new LivingArmourUpgradeDigging(0));
|
||||
if (totalBlocksDug < blocksRequired[i])
|
||||
{
|
||||
upgradeList.add(new LivingArmourUpgradeDigging(i));
|
||||
}
|
||||
}
|
||||
// for (int i = 0; i < 5; i++)
|
||||
// {
|
||||
// if (totalMovement > (i + 1) * (i + 1) * (i + 1) * 100)
|
||||
// {
|
||||
// upgradeList.add(new LivingArmourUpgradeSpeed(i));
|
||||
// }
|
||||
// }
|
||||
|
||||
return upgradeList;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
package WayofTime.bloodmagic.livingArmour;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
|
||||
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
|
||||
|
||||
public class StatTrackerPoison extends StatTracker
|
||||
{
|
||||
public int totalPoisonTicks = 0;
|
||||
|
||||
public static int[] poisonTicksRequired = new int[] { 60 * 20, 3 * 60 * 20, 10 * 60 * 20, 20 * 60 * 20, 25 * 60 * 20 };
|
||||
|
||||
@Override
|
||||
public String getUniqueIdentifier()
|
||||
{
|
||||
return Constants.Mod.MODID + ".tracker.poison";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetTracker()
|
||||
{
|
||||
this.totalPoisonTicks = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
totalPoisonTicks = tag.getInteger(Constants.Mod.MODID + ".tracker.poison");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
tag.setInteger(Constants.Mod.MODID + ".tracker.poison", totalPoisonTicks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour)
|
||||
{
|
||||
if (player.isPotionActive(Potion.poison))
|
||||
{
|
||||
totalPoisonTicks++;
|
||||
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 < 3; i++)
|
||||
{
|
||||
if (totalPoisonTicks < poisonTicksRequired[i])
|
||||
{
|
||||
upgradeList.add(new LivingArmourUpgradePoisonResist(i));
|
||||
}
|
||||
}
|
||||
|
||||
return upgradeList;
|
||||
}
|
||||
}
|
|
@ -2,9 +2,11 @@ package WayofTime.bloodmagic.registry;
|
|||
|
||||
import WayofTime.bloodmagic.api.livingArmour.LivingArmourHandler;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmourUpgradeDigging;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmourUpgradePoisonResist;
|
||||
import WayofTime.bloodmagic.livingArmour.LivingArmourUpgradeSpeed;
|
||||
import WayofTime.bloodmagic.livingArmour.StatTrackerDigging;
|
||||
import WayofTime.bloodmagic.livingArmour.StatTrackerMovement;
|
||||
import WayofTime.bloodmagic.livingArmour.StatTrackerPoison;
|
||||
|
||||
public class ModArmourTrackers
|
||||
{
|
||||
|
@ -12,8 +14,10 @@ public class ModArmourTrackers
|
|||
{
|
||||
LivingArmourHandler.registerStatTracker(StatTrackerMovement.class);
|
||||
LivingArmourHandler.registerStatTracker(StatTrackerDigging.class);
|
||||
LivingArmourHandler.registerStatTracker(StatTrackerPoison.class);
|
||||
|
||||
LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradeSpeed(1));
|
||||
LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradeDigging(0));
|
||||
LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradePoisonResist(0));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -244,6 +244,8 @@ chat.BloodMagic.ritual.prevent=The ritual is actively resisting you!
|
|||
chat.BloodMagic.ritual.activate=A rush of energy flows through the ritual!
|
||||
chat.BloodMagic.ritual.notValid=You feel that these runes are not configured correctly...
|
||||
|
||||
chat.BloodMagic.livingArmour.upgrade.poisonRemove=You are starting to feel better already!
|
||||
|
||||
# JustEnoughItems
|
||||
jei.BloodMagic.recipe.altar=Blood Altar
|
||||
jei.BloodMagic.recipe.binding=Binding Ritual
|
||||
|
|
Loading…
Reference in a new issue