Tainted slasher draw issue fixes

This commit is contained in:
Dominic authored and Cameron Ewell committed 2021-06-30 23:41:58 -04:00
1 parent 946818b1d4
commit 77298336bd
1 file changed
+13 -1
+13 -1
View File
@@ -16,7 +16,16 @@ namespace CalamityMod.Projectiles.Melee
public ref float SwordItemID => ref projectile.ai[1];
public ref float VerticalOffset => ref projectile.localAI[0];
public ref float Time => ref projectile.localAI[1];
public float AttackCompletionRatio => 1f - Owner.itemAnimation / (float)Owner.itemAnimationMax;
public float AttackCompletionRatio
{
get
{
float completionRatio = 1f - Owner.itemAnimation / (float)Owner.itemAnimationMax;
if (float.IsNaN(completionRatio) || float.IsInfinity(completionRatio))
completionRatio = 0f;
return completionRatio;
}
}
public Player Owner => Main.player[projectile.owner];
public int Variant => (int)projectile.ai[0] % 2;
@@ -124,6 +133,9 @@ namespace CalamityMod.Projectiles.Melee
return;
}
if (Owner.itemAnimationMax == 0)
Owner.itemAnimationMax = (int)(Owner.ActiveItem().useAnimation * Owner.meleeSpeed);
float swingOffsetAngle = MathHelper.SmoothStep(-1.87f, 3.79f, AttackCompletionRatio);
// Offset a little bit angularly if the secondary variant to prevent complete overlap.