- Added a potion effect called "(-) Immunity", which allows the training of Living Armour Downgrades. This potion is crafted using a Draft of Angelus with a potion flask. Check the uses of the flask!

- Added some more framework for the Living Armour Downgrades.
- Modified the Grim Reaper's Sprint so it is better at later levels.
This commit is contained in:
WayofTime 2016-10-02 15:03:31 -04:00
parent e5276fba6f
commit 6ea17510b7
12 changed files with 348 additions and 11 deletions

View file

@ -2,6 +2,9 @@
Version 2.1.0-66
------------------------------------------------------
- Made it so that when you acquire a Living Armour Upgrade from a Tome, it raises the corresponding Stat Tracker up to that upgrade level.
- Added a potion effect called "(-) Immunity", which allows the training of Living Armour Downgrades. This potion is crafted using a Draft of Angelus with a potion flask. Check the uses of the flask!
- Added some more framework for the Living Armour Downgrades.
- Modified the Grim Reaper's Sprint so it is better at later levels.
------------------------------------------------------
Version 2.1.0-65

View file

@ -73,4 +73,9 @@ public abstract class StatTracker
public abstract boolean providesUpgrade(String key);
public abstract void onArmourUpgradeAdded(LivingArmourUpgrade upgrade);
public boolean isTrackerDowngrade()
{
return false;
}
}

View file

@ -20,6 +20,7 @@ import WayofTime.bloodmagic.api.livingArmour.LivingArmourHandler;
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
import WayofTime.bloodmagic.item.armour.ItemLivingArmour;
import WayofTime.bloodmagic.registry.ModPotions;
import WayofTime.bloodmagic.util.ChatUtil;
import WayofTime.bloodmagic.util.helper.TextHelper;
@ -108,7 +109,7 @@ public class LivingArmour implements ILivingArmour
if (nextLevel > currentLevel)
{
int upgradePointDifference = upgrade.getCostOfUpgrade() - upgradeMap.get(key).getCostOfUpgrade();
if (upgradePointDifference >= 0 && totalUpgradePoints + upgradePointDifference <= maxUpgradePoints)
if (Math.abs(upgradePointDifference) >= 0 && totalUpgradePoints + upgradePointDifference <= maxUpgradePoints)
{
upgradeMap.put(key, upgrade);
totalUpgradePoints += upgradePointDifference;
@ -190,6 +191,8 @@ public class LivingArmour implements ILivingArmour
}
}
boolean allowOnlyDowngrades = player.isPotionActive(ModPotions.immuneSuppress);
for (Entry<String, StatTracker> entry : trackerMap.entrySet())
{
StatTracker tracker = entry.getValue();
@ -219,6 +222,12 @@ public class LivingArmour implements ILivingArmour
}
}
if ((allowOnlyDowngrades != tracker.isTrackerDowngrade()))
{
tracker.onDeactivatedTick(world, player, this);
continue;
}
if (tracker.onTick(world, player, this))
{
List<LivingArmourUpgrade> upgradeList = tracker.getUpgrades();

View file

@ -1,28 +1,43 @@
package WayofTime.bloodmagic.livingArmour.downgrade;
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.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 com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
public class LivingArmourUpgradeSlowness extends LivingArmourUpgrade
{
public static final int[] costs = new int[] { -50 };
public static final int[] slownessDuration = new int[] { 30 * 20 };
public static final int[] costs = new int[] { -10, -17, -23, -35, -48, -60, -80, -110, -160, -200 };
public static final double[] speedModifier = new double[] { -0.1, -0.2, -0.3, -0.4, -0.45, -0.5, -0.55, -0.6, -0.65, -0.7 };
public LivingArmourUpgradeSlowness(int level)
{
super(level);
}
@Override
public Multimap<String, AttributeModifier> getAttributeModifiers()
{
Multimap<String, AttributeModifier> modifierMap = HashMultimap.<String, AttributeModifier>create();
modifierMap.put(SharedMonsterAttributes.MOVEMENT_SPEED.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(85472, 8502), "speed modifier" + 2, speedModifier[this.level], 1));
return modifierMap;
}
@Override
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
{
player.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, 1, 0, true, false));
}
@Override
@ -34,7 +49,7 @@ public class LivingArmourUpgradeSlowness extends LivingArmourUpgrade
@Override
public int getMaxTier()
{
return 1;
return 10;
}
@Override

View file

@ -0,0 +1,130 @@
package WayofTime.bloodmagic.livingArmour.tracker.downgrade;
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;
import WayofTime.bloodmagic.livingArmour.LivingArmour;
import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeMeleeDecrease;
import WayofTime.bloodmagic.util.Utils;
public class StatTrackerMeleeDecrease extends StatTracker
{
public double totalDamageDealt = 0;
public static HashMap<LivingArmour, Double> changeMap = new HashMap<LivingArmour, Double>();
public static int[] damageRequired = new int[] { 40, 100, 200, 350, 650, 1000, 1500, 2000, 3500, 7500 };
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.meleeDecrease";
}
@Override
public void resetTracker()
{
this.totalDamageDealt = 0;
}
@Override
public void readFromNBT(NBTTagCompound tag)
{
totalDamageDealt = tag.getDouble(Constants.Mod.MODID + ".tracker.meleeDecrease");
}
@Override
public void writeToNBT(NBTTagCompound tag)
{
tag.setDouble(Constants.Mod.MODID + ".tracker.meleeDecrease", 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));
System.out.println(totalDamageDealt);
changeMap.put(livingArmour, 0d);
this.markDirty();
return true;
}
}
return false;
}
@Override
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour)
{
if (changeMap.containsKey(livingArmour))
{
changeMap.remove(livingArmour);
}
}
@Override
public List<LivingArmourUpgrade> getUpgrades()
{
List<LivingArmourUpgrade> upgradeList = new ArrayList<LivingArmourUpgrade>();
for (int i = 0; i < 10; i++)
{
if (totalDamageDealt >= damageRequired[i])
{
upgradeList.add(new LivingArmourUpgradeMeleeDecrease(i));
}
}
return upgradeList;
}
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalDamageDealt, damageRequired, currentLevel);
}
@Override
public boolean providesUpgrade(String key)
{
return key.equals(Constants.Mod.MODID + ".upgrade.meleeDecrease");
}
@Override
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade)
{
if (upgrade instanceof LivingArmourUpgradeMeleeDecrease)
{
int level = upgrade.getUpgradeLevel();
if (level < damageRequired.length)
{
totalDamageDealt = Math.max(totalDamageDealt, damageRequired[level]);
this.markDirty();
}
}
}
@Override
public boolean isTrackerDowngrade()
{
return true;
}
}

View file

@ -0,0 +1,141 @@
package WayofTime.bloodmagic.livingArmour.tracker.downgrade;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.MobEffects;
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;
import WayofTime.bloodmagic.livingArmour.LivingArmour;
import WayofTime.bloodmagic.livingArmour.downgrade.LivingArmourUpgradeSlowness;
import WayofTime.bloodmagic.util.Utils;
public class StatTrackerSlowness extends StatTracker
{
public static Map<EntityPlayer, Double> lastPosX = new HashMap<EntityPlayer, Double>();
public static Map<EntityPlayer, Double> lastPosZ = new HashMap<EntityPlayer, Double>();
public static int[] blocksRequired = new int[] { 200, 1000, 2000, 4000, 7000, 15000, 25000, 35000, 50000, 70000 };
public double totalMovement = 0;
@Override
public String getUniqueIdentifier()
{
return Constants.Mod.MODID + ".tracker.slowness";
}
@Override
public void resetTracker()
{
this.totalMovement = 0;
}
@Override
public void readFromNBT(NBTTagCompound tag)
{
totalMovement = tag.getDouble(Constants.Mod.MODID + ".tracker.slowness");
}
@Override
public void writeToNBT(NBTTagCompound tag)
{
tag.setDouble(Constants.Mod.MODID + ".tracker.slowness", totalMovement);
}
@Override
public boolean onTick(World world, EntityPlayer player, LivingArmour livingArmour)
{
if (!lastPosX.containsKey(player))
{
lastPosX.put(player, player.posX);
lastPosZ.put(player, player.posZ);
return false;
}
if (!player.onGround || !player.isPotionActive(MobEffects.SLOWNESS))
{
return false;
}
double distanceTravelled = Math.sqrt(Math.pow(lastPosX.get(player) - player.posX, 2) + Math.pow(lastPosZ.get(player) - player.posZ, 2));
if (distanceTravelled > 0.0001 && distanceTravelled < 2)
{
totalMovement += distanceTravelled;
lastPosX.put(player, player.posX);
lastPosZ.put(player, player.posZ);
markDirty();
return true;
}
lastPosX.put(player, player.posX);
lastPosZ.put(player, player.posZ);
return false;
}
@Override
public void onDeactivatedTick(World world, EntityPlayer player, LivingArmour livingArmour)
{
}
@Override
public List<LivingArmourUpgrade> getUpgrades()
{
List<LivingArmourUpgrade> upgradeList = new ArrayList<LivingArmourUpgrade>();
for (int i = 0; i < 10; i++)
{
if (totalMovement >= blocksRequired[i])
{
upgradeList.add(new LivingArmourUpgradeSlowness(i));
}
}
return upgradeList;
}
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalMovement, blocksRequired, currentLevel);
}
@Override
public boolean providesUpgrade(String key)
{
return key.equals(Constants.Mod.MODID + ".upgrade.slowness");
}
@Override
public void onArmourUpgradeAdded(LivingArmourUpgrade upgrade)
{
if (upgrade instanceof LivingArmourUpgradeSlowness)
{
int level = upgrade.getUpgradeLevel();
if (level < blocksRequired.length)
{
totalMovement = Math.max(totalMovement, blocksRequired[level]);
this.markDirty();
}
}
}
@Override
public boolean isTrackerDowngrade()
{
return true;
}
}

View file

@ -1,18 +1,25 @@
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.nbt.NBTTagCompound;
import net.minecraft.world.World;
public class LivingArmourUpgradeGrimReaperSprint extends LivingArmourUpgrade
{
public static final int[] costs = new int[] { 20, 50, 130, 270, 450, 580, 700, 800, 900, 1000 };
public static final int[] rebirthDelay = new int[] { 20 * 60 * 60, 20 * 60 * 50, 20 * 60 * 45, 20 * 60 * 40, 20 * 60 * 30, 20 * 60 * 25, 20 * 60 * 15, 20 * 60 * 10, 20 * 60 * 5, 20 * 60 };
public static final int[] strengthDuration = new int[] { 0, 0, 100, 100, 200, 200, 200, 300, 300, 400 };
public static final int[] strengthValue = new int[] { 0, 0, 0, 0, 0, 1, 1, 2, 2, 3 };
public static final int[] resistanceDuration = new int[] { 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 };
public static final int[] resistanceValue = new int[] { 0, 0, 0, 0, 0, 1, 1, 2, 2, 3 };
public static final float[] healthOnRevive = new float[] { 0.2f, 0.2f, 0.3f, 0.3f, 0.4f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f };
public int deathTimer = 0;
@ -68,7 +75,20 @@ public class LivingArmourUpgradeGrimReaperSprint extends LivingArmourUpgrade
public void applyEffectOnRebirth(EntityPlayer player)
{
player.setHealth(player.getMaxHealth());
player.setHealth(player.getMaxHealth() * healthOnRevive[this.level]);
int strDur = strengthDuration[this.level];
if (strDur > 0)
{
player.addPotionEffect(new PotionEffect(MobEffects.STRENGTH, strDur, strengthValue[this.level]));
}
int resDur = resistanceDuration[this.level];
if (resDur > 0)
{
player.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, resDur, resistanceValue[this.level]));
}
deathTimer = rebirthDelay[this.level];
ChatUtil.sendNoSpam(player, TextHelper.localizeEffect(chatBase + "grimReaper"));
}

View file

@ -28,6 +28,8 @@ import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerSelfSacrifice;
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerSolarPowered;
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerSprintAttack;
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerStepAssist;
import WayofTime.bloodmagic.livingArmour.tracker.downgrade.StatTrackerMeleeDecrease;
import WayofTime.bloodmagic.livingArmour.tracker.downgrade.StatTrackerSlowness;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeArrowShot;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeCriticalStrike;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeDigging;
@ -75,6 +77,9 @@ public class ModArmourTrackers
LivingArmourHandler.registerStatTracker(StatTrackerFireResist.class);
LivingArmourHandler.registerStatTracker(StatTrackerNightSight.class);
LivingArmourHandler.registerStatTracker(StatTrackerMeleeDecrease.class);
LivingArmourHandler.registerStatTracker(StatTrackerSlowness.class);
LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradeSpeed(0));
LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradeDigging(0));
LivingArmourHandler.registerArmourUpgrade(new LivingArmourUpgradePoisonResist(0));

View file

@ -21,6 +21,8 @@ public class ModPotions
public static Potion plantLeech;
public static Potion deafness;
public static Potion immuneSuppress;
public static void init()
{
new PotionEventHandlers();
@ -47,6 +49,7 @@ public class ModPotions
constrict = registerPotion("Constriction", new ResourceLocation("constrict"), true, 0x000000, 6, 0);
plantLeech = registerPotion("Plant Leech", new ResourceLocation("plantLeech"), true, 0x000000, 7, 0);
deafness = registerPotion("Deaf", new ResourceLocation("deafness"), true, 0x000000, 0, 1);
immuneSuppress = registerPotion("(-) Immunity", new ResourceLocation("immuneSuppress"), true, 0x000000, 1, 1);
// heavyHeart = new PotionBloodMagic("Heavy Heart", new
// ResourceLocation(resourceLocation +
// heavyHeart.getName().toLowerCase()), true, 0, 0, 0);

View file

@ -444,6 +444,8 @@ public class ModRecipes
addPotionRecipe(1000, 1, new ItemStack(ModItems.BLOOD_SHARD, 1, 0), new PotionEffect(MobEffects.HEALTH_BOOST, 2 * 60 * 20));
addPotionRecipe(1000, 1, new ItemStack(Items.BEETROOT), new PotionEffect(ModPotions.deafness, 450));
AlchemyTableRecipeRegistry.registerRecipe(new AlchemyTablePotionRecipe(5000, 100, 4, ItemLivingArmourPointsUpgrade.getStack(ItemLivingArmourPointsUpgrade.DRAFT_ANGELUS), new PotionEffect(ModPotions.immuneSuppress, 15 * 60 * 20)));
}
static ItemStack mundaneLengtheningStack = ItemComponent.getStack(ItemComponent.CATALYST_LENGTH_1);

View file

@ -34,6 +34,7 @@ import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerNightSight;
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerPhysicalProtect;
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerSolarPowered;
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerSprintAttack;
import WayofTime.bloodmagic.livingArmour.tracker.downgrade.StatTrackerMeleeDecrease;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeDigging;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeExperience;
import WayofTime.bloodmagic.util.Utils;
@ -162,6 +163,9 @@ public class StatTrackerHandler
{
StatTrackerMeleeDamage.incrementCounter(armour, amount);
if (player.isPotionActive(MobEffects.WEAKNESS))
StatTrackerMeleeDecrease.incrementCounter(armour, amount);
if (player.worldObj.getLight(player.getPosition()) <= 9)
StatTrackerNightSight.incrementCounter(armour, amount);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB