From 2f0fb957934621d472bdbbd79339ac2e2dbb74eb Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Wed, 3 Nov 2021 13:31:11 -0500 Subject: [PATCH] Made True Melee Ataraxia shots more sharply home --- Projectiles/Melee/AtaraxiaHoming.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Projectiles/Melee/AtaraxiaHoming.cs b/Projectiles/Melee/AtaraxiaHoming.cs index fc6928c060..3395c4efe4 100644 --- a/Projectiles/Melee/AtaraxiaHoming.cs +++ b/Projectiles/Melee/AtaraxiaHoming.cs @@ -1,8 +1,11 @@ +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Melee { + // TODO - Abstract away most of the direct vector math away in here into things like SafeDirectionTo calls. public class AtaraxiaHoming : ModProjectile { private static int NumAnimationFrames = 5; @@ -106,11 +109,14 @@ namespace CalamityMod.Projectiles.Melee dx *= homingFactor; dy *= homingFactor; - // The projectile loses 1/6th of its current velocity and replaces it with homing power. - float homingStrength = 6f; + // The projectile loses 1/5th of its current velocity and replaces it with homing power. + float homingStrength = 5f; projectile.velocity.X = (projectile.velocity.X * (homingStrength - 1f) + dx) / homingStrength; projectile.velocity.Y = (projectile.velocity.Y * (homingStrength - 1f) + dy) / homingStrength; + // And then approaches the homing velocity by an increment of 0.3. + projectile.velocity = projectile.velocity.MoveTowards(new Vector2(dx, dy), 0.3f); + // Re-scale resulting velocity to the projectile's set maximum speed projectile.velocity.Normalize(); projectile.velocity *= speed;