Added the Living Armour Upgrade, Nocturnal Prowess, which gives night vision in dark areas and increases damage while the area is dark

This commit is contained in:
WayofTime 2016-09-03 11:17:36 -04:00
parent 0a2074c110
commit 0bc3824814
10 changed files with 255 additions and 7 deletions

View file

@ -39,7 +39,7 @@ public class LivingArmourUpgradeGrimReaperSprint extends LivingArmourUpgrade
@Override
public int getMaxTier()
{
return 1;
return 10;
}
@Override

View file

@ -0,0 +1,90 @@
package WayofTime.bloodmagic.livingArmour.upgrade;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.MobEffects;
import net.minecraft.item.ItemStack;
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;
public class LivingArmourUpgradeNightSight extends LivingArmourUpgrade
{
public static final int[] costs = new int[] { 5, 8, 15, 20, 34, 45, 70, 100, 150, 200 };
public static final double[] meleeDamage = new double[] { 0, 0.5, 1, 1.5, 2, 2.5, 3, 4, 5, 6 };
public boolean isActive = false;
public LivingArmourUpgradeNightSight(int level)
{
super(level);
}
@Override
public double getAdditionalDamageOnHit(double damage, EntityPlayer wearer, EntityLivingBase hitEntity, ItemStack weapon)
{
return isActive ? meleeDamage[this.level] : 0;
}
@Override
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour)
{
if (world.getLight(player.getPosition()) <= 9)
{
isActive = true;
if (player.isPotionActive(MobEffects.NIGHT_VISION))
{
int dur = player.getActivePotionEffect(MobEffects.NIGHT_VISION).getDuration();
if (dur > 100 && dur < 20 * 60 * 20)
{
//Don't override the potion effect if the other potion effect is sufficiently long.
return;
}
}
player.addPotionEffect(new PotionEffect(MobEffects.NIGHT_VISION, Constants.Misc.NIGHT_VISION_CONSTANT_BEGIN, 0, false, false));
} else
{
isActive = false;
}
}
@Override
public String getUniqueIdentifier()
{
return Constants.Mod.MODID + ".upgrade.nightSight";
}
@Override
public int getMaxTier()
{
return 10; // 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)
{
}
@Override
public void readFromNBT(NBTTagCompound tag)
{
}
@Override
public String getUnlocalizedName()
{
return tooltipBase + "nightSight";
}
}

View file

@ -1,16 +1,15 @@
package WayofTime.bloodmagic.livingArmour.upgrade;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
import net.minecraft.entity.EntityLivingBase;
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.util.DamageSource;
import net.minecraft.world.World;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.livingArmour.ILivingArmour;
import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
public class LivingArmourUpgradeSolarPowered extends LivingArmourUpgrade
{