Made True Melee Ataraxia shots more sharply home

This commit is contained in:
DominicKarma committed 2021-11-03 13:31:11 -05:00
1 parent 1f8dea38cd
commit 2f0fb95793
1 file changed
+8 -2
+8 -2
View File
@@ -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;