Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ CalculateShotStrength() [2/2]

static ShotStrength Terraria.GameContent.Golf.GolfHelper.CalculateShotStrength ( Vector2 shotVector,
ClubProperties clubProperties )
inlinestatic

Definition at line 310 of file GolfHelper.cs.

311 {
312 Vector2.Normalize(shotVector);
313 float value = shotVector.Length();
314 float num = FindVectorOnOval(shotVector, clubProperties.MaximumStrength).Length();
315 float num2 = FindVectorOnOval(shotVector, clubProperties.MinimumStrength).Length();
316 float num3 = MathHelper.Clamp(value, num2, num);
317 float relativeStrength = Math.Max((num3 - num2) / (num - num2), 0.001f);
318 return new ShotStrength(num3 * 32f, relativeStrength, clubProperties.RoughLandResistance);
319 }
static float Clamp(float value, float min, float max)
Definition MathHelper.cs:46
static byte Max(byte val1, byte val2)
Definition Math.cs:738
static Vector2 FindVectorOnOval(Vector2 vector, Vector2 radius)

References Microsoft.Xna.Framework.MathHelper.Clamp(), Terraria.GameContent.Golf.GolfHelper.FindVectorOnOval(), Microsoft.Xna.Framework.Vector2.Length(), System.Math.Max(), Terraria.GameContent.Golf.GolfHelper.ClubProperties.MaximumStrength, Terraria.GameContent.Golf.GolfHelper.ClubProperties.MinimumStrength, Microsoft.Xna.Framework.Vector2.Normalize(), Terraria.GameContent.Golf.GolfHelper.ClubProperties.RoughLandResistance, and System.value.

Referenced by Terraria.Projectile.AI_150_GolfClubHelper(), Terraria.GameContent.Golf.GolfHelper.CalculateShotStrength(), Terraria.Main.DrawInterface_Resources_GolfPower(), and Terraria.Main.DrawProjDirect().