Added a way to view the progress towards the next upgrade level

Override `getProgress()` and return a value between 0.0 (0%) and 1.0 (100%)
This commit is contained in:
Nicholas Ignoffo 2016-07-29 21:10:22 -07:00
parent 3ad0969644
commit 7516f9c5d3
24 changed files with 187 additions and 1 deletions

View file

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
@ -95,6 +96,12 @@ public class StatTrackerArrowProtect extends StatTracker
return upgradeList;
}
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalDamage, damageRequired, currentLevel);
}
@Override
public boolean providesUpgrade(String key)
{

View file

@ -5,6 +5,7 @@ import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
import WayofTime.bloodmagic.livingArmour.LivingArmour;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeArrowShot;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
@ -95,6 +96,12 @@ public class StatTrackerArrowShot extends StatTracker
return upgradeList;
}
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalShots, shotsRequired, currentLevel);
}
@Override
public boolean providesUpgrade(String key)
{

View file

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
@ -95,6 +96,12 @@ public class StatTrackerCriticalStrike extends StatTracker
return upgradeList;
}
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalDamageDealt, damageRequired, currentLevel);
}
@Override
public boolean providesUpgrade(String key)
{

View file

@ -5,6 +5,7 @@ import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
import WayofTime.bloodmagic.livingArmour.LivingArmour;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeDigging;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
@ -95,6 +96,12 @@ public class StatTrackerDigging extends StatTracker
return upgradeList;
}
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalBlocksDug, blocksRequired, currentLevel);
}
@Override
public boolean providesUpgrade(String key)
{

View file

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
@ -95,6 +96,12 @@ public class StatTrackerExperience extends StatTracker
return upgradeList;
}
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalExperienceGained, experienceRequired, currentLevel);
}
@Override
public boolean providesUpgrade(String key)
{

View file

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
@ -95,6 +96,12 @@ public class StatTrackerFallProtect extends StatTracker
return upgradeList;
}
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalDamage, damageRequired, currentLevel);
}
@Override
public boolean providesUpgrade(String key)
{

View file

@ -3,6 +3,7 @@ package WayofTime.bloodmagic.livingArmour.tracker;
import java.util.ArrayList;
import java.util.List;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
@ -77,6 +78,12 @@ public class StatTrackerFireResist extends StatTracker
return upgradeList;
}
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalFireTicks, fireTicksRequired, currentLevel);
}
@Override
public boolean providesUpgrade(String key)
{

View file

@ -5,6 +5,7 @@ import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
import WayofTime.bloodmagic.livingArmour.LivingArmour;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeKnockbackResist;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
@ -97,6 +98,12 @@ public class StatTrackerFood extends StatTracker
return upgradeList;
}
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(foodEaten, foodRequired, currentLevel);
}
@Override
public boolean providesUpgrade(String key)
{

View file

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
@ -95,6 +96,12 @@ public class StatTrackerGraveDigger extends StatTracker
return upgradeList;
}
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalDamageDealt, damageRequired, currentLevel);
}
@Override
public boolean providesUpgrade(String key)
{

View file

@ -5,6 +5,7 @@ import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
import WayofTime.bloodmagic.livingArmour.LivingArmour;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeGrimReaperSprint;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
@ -102,6 +103,12 @@ public class StatTrackerGrimReaperSprint extends StatTracker
return upgradeList;
}
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalDeaths, deathsRequired, currentLevel);
}
@Override
public boolean providesUpgrade(String key)
{

View file

@ -5,6 +5,7 @@ import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
import WayofTime.bloodmagic.livingArmour.LivingArmour;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeHealthboost;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
@ -95,6 +96,12 @@ public class StatTrackerHealthboost extends StatTracker
return upgradeList;
}
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalHealthGenned, healthedRequired, currentLevel);
}
@Override
public boolean providesUpgrade(String key)
{

View file

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
@ -96,6 +97,12 @@ public class StatTrackerJump extends StatTracker
return upgradeList;
}
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalJumps, jumpsRequired, currentLevel);
}
@Override
public boolean providesUpgrade(String key)
{

View file

@ -5,6 +5,7 @@ import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
import WayofTime.bloodmagic.livingArmour.LivingArmour;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeMeleeDamage;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
@ -95,6 +96,12 @@ public class StatTrackerMeleeDamage extends StatTracker
return upgradeList;
}
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalDamageDealt, damageRequired, currentLevel);
}
@Override
public boolean providesUpgrade(String key)
{

View file

@ -5,6 +5,7 @@ import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
import WayofTime.bloodmagic.livingArmour.LivingArmour;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeSpeed;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
@ -105,6 +106,12 @@ public class StatTrackerMovement extends StatTracker
return upgradeList;
}
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalMovement, blocksRequired, currentLevel);
}
@Override
public boolean providesUpgrade(String key)
{

View file

@ -5,6 +5,7 @@ import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
import WayofTime.bloodmagic.livingArmour.LivingArmour;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradePhysicalProtect;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
@ -95,6 +96,12 @@ public class StatTrackerPhysicalProtect extends StatTracker
return upgradeList;
}
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalDamage, damageRequired, currentLevel);
}
@Override
public boolean providesUpgrade(String key)
{

View file

@ -3,6 +3,7 @@ package WayofTime.bloodmagic.livingArmour.tracker;
import java.util.ArrayList;
import java.util.List;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.MobEffects;
import net.minecraft.nbt.NBTTagCompound;
@ -78,6 +79,12 @@ public class StatTrackerPoison extends StatTracker
return upgradeList;
}
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalPoisonTicks, poisonTicksRequired, currentLevel);
}
@Override
public boolean providesUpgrade(String key)
{

View file

@ -5,6 +5,7 @@ import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
import WayofTime.bloodmagic.livingArmour.LivingArmour;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeSelfSacrifice;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
@ -96,6 +97,12 @@ public class StatTrackerSelfSacrifice extends StatTracker
return upgradeList;
}
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalSacrifices, sacrificesRequired, currentLevel);
}
@Override
public boolean providesUpgrade(String key)
{

View file

@ -5,6 +5,7 @@ import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
import WayofTime.bloodmagic.api.livingArmour.StatTracker;
import WayofTime.bloodmagic.livingArmour.LivingArmour;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeSolarPowered;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
@ -95,6 +96,12 @@ public class StatTrackerSolarPowered extends StatTracker
return upgradeList;
}
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalHealthGenned, healthedRequired, currentLevel);
}
@Override
public boolean providesUpgrade(String key)
{

View file

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
@ -95,6 +96,12 @@ public class StatTrackerSprintAttack extends StatTracker
return upgradeList;
}
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
return Utils.calculateStandardProgress(totalDamageDealt, damageRequired, currentLevel);
}
@Override
public boolean providesUpgrade(String key)
{

View file

@ -103,6 +103,15 @@ public class StatTrackerStepAssist extends StatTracker
return upgradeList;
}
@Override
public double getProgress(LivingArmour livingArmour, int currentLevel)
{
if (currentLevel == 1)
return 1.0D;
return totalMovement / (double) blocksRequired;
}
@Override
public boolean providesUpgrade(String key)
{