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

◆ AI_182_FinalFractal()

void Terraria.Projectile.AI_182_FinalFractal ( )
inlineprivate

Definition at line 35177 of file Projectile.cs.

35178 {
35179 if (type == 933 && localAI[1] == 0f)
35180 {
35181 localAI[1] = 1f;
35183 }
35184 Player player = Main.player[owner];
35185 Vector2 mountedCenter = player.MountedCenter;
35186 float lerpValue = Utils.GetLerpValue(900f, 0f, velocity.Length() * 2f, clamped: true);
35187 float num = MathHelper.Lerp(0.7f, 2f, lerpValue);
35188 localAI[0] += num;
35189 if (localAI[0] >= 120f)
35190 {
35191 Kill();
35192 return;
35193 }
35194 float lerpValue2 = Utils.GetLerpValue(0f, 1f, localAI[0] / 60f, clamped: true);
35195 float num2 = localAI[0] / 60f;
35196 float num3 = ai[0];
35197 float num4 = velocity.ToRotation();
35198 float num5 = (float)Math.PI;
35199 float num6 = ((velocity.X > 0f) ? 1 : (-1));
35200 float num7 = num5 + num6 * lerpValue2 * ((float)Math.PI * 2f);
35201 float num8 = velocity.Length() + Utils.GetLerpValue(0.5f, 1f, lerpValue2, clamped: true) * 40f;
35202 float num9 = 60f;
35203 if (num8 < num9)
35204 {
35205 num8 = num9;
35206 }
35208 Vector2 spinningpoint = new Vector2(1f, 0f).RotatedBy(num7) * new Vector2(num8, num3 * MathHelper.Lerp(2f, 1f, lerpValue));
35209 Vector2 vector2 = vector + spinningpoint.RotatedBy(num4);
35210 Vector2 vector3 = (1f - Utils.GetLerpValue(0f, 0.5f, lerpValue2, clamped: true)) * new Vector2((float)((velocity.X > 0f) ? 1 : (-1)) * (0f - num8) * 0.1f, (0f - ai[0]) * 0.3f);
35211 float num10 = num7 + num4;
35212 rotation = num10 + (float)Math.PI / 2f;
35213 base.Center = vector2 + vector3;
35214 spriteDirection = (direction = ((velocity.X > 0f) ? 1 : (-1)));
35215 if (num3 < 0f)
35216 {
35217 rotation = num5 + num6 * lerpValue2 * ((float)Math.PI * -2f) + num4;
35218 rotation += (float)Math.PI / 2f;
35219 spriteDirection = (direction = ((!(velocity.X > 0f)) ? 1 : (-1)));
35220 }
35221 if (num2 < 1f)
35222 {
35224 Vector2 vector4 = (rotation - (float)Math.PI / 2f).ToRotationVector2();
35225 Vector2 center = base.Center;
35226 int num11 = 1 + (int)(velocity.Length() / 100f);
35227 num11 = (int)((float)num11 * Utils.GetLerpValue(0f, 0.5f, lerpValue2, clamped: true) * Utils.GetLerpValue(1f, 0.5f, lerpValue2, clamped: true));
35228 if (num11 < 1)
35229 {
35230 num11 = 1;
35231 }
35232 for (int i = 0; i < num11; i++)
35233 {
35234 finalFractalProfile.dustMethod(center + vector4 * finalFractalProfile.trailWidth * MathHelper.Lerp(0.5f, 1f, Main.rand.NextFloat()), rotation - (float)Math.PI / 2f + (float)Math.PI / 2f * (float)spriteDirection, player.velocity);
35235 }
35236 Vector3 vector5 = finalFractalProfile.trailColor.ToVector3();
35238 Lighting.AddLight(base.Center, vector5 * 0.5f * Opacity);
35239 Lighting.AddLight(mountedCenter, vector6 * Opacity * 0.15f);
35240 }
35241 Opacity = Utils.GetLerpValue(0f, 5f, localAI[0], clamped: true) * Utils.GetLerpValue(120f, 115f, localAI[0], clamped: true);
35242 }
static float Lerp(float value1, float value2, float amount)
Definition MathHelper.cs:53
const double PI
Definition Math.cs:16
static void PlaySound(int type, Vector2 position, int style=1)
Vector2 velocity
Definition Entity.cs:16
static readonly LegacySoundStyle Item169
Definition SoundID.cs:752
static Vector3 Lerp(Vector3 value1, Vector3 value2, float amount)
Definition Vector3.cs:307
static FinalFractalProfile GetFinalFractalProfile(int usedSwordId)

References Terraria.Lighting.AddLight(), Terraria.Graphics.FinalFractalHelper.GetFinalFractalProfile(), Terraria.Utils.GetLerpValue(), Terraria.ID.SoundID.Item169, Microsoft.Xna.Framework.MathHelper.Lerp(), Microsoft.Xna.Framework.Vector3.Lerp(), Terraria.Player.MountedCenter, Microsoft.Xna.Framework.Vector3.One, System.Math.PI, Terraria.Main.player, Terraria.Audio.SoundEngine.PlaySound(), Terraria.Main.rand, System.type, and Terraria.Entity.velocity.