Astral Blade crash fix.

This commit is contained in:
mountaindrew10 committed 2023-07-10 03:37:56 -05:00
1 parent 8cfd1735fa
commit afc62fa447
1 file changed
+5 -1
+5 -1
View File
@@ -57,7 +57,11 @@ namespace CalamityMod.Items.Weapons.Melee
public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers)
{
float lifeRatio = target.life / (float)target.lifeMax;
// Avoid dividing by 0 at all costs.
if (target.lifeMax <= 0)
return;
float lifeRatio = MathHelper.Clamp(target.life / (float)target.lifeMax, 0f, 1f);
float multiplier = MathHelper.Lerp(1f, 2f, lifeRatio);
modifiers.SourceDamage *= multiplier;