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

◆ AI_152_SuperStarSlash()

void Terraria.Projectile.AI_152_SuperStarSlash ( )
inlineprivate

Definition at line 18610 of file Projectile.cs.

18611 {
18612 float num = (float)Math.PI / 2f;
18613 bool flag = true;
18614 if (type == 976)
18615 {
18616 flag = false;
18617 }
18618 if (flag)
18619 {
18620 alpha -= 10;
18621 int num2 = 100;
18622 if (alpha < num2)
18623 {
18624 alpha = num2;
18625 }
18626 }
18627 if (soundDelay == 0)
18628 {
18629 if (type == 977)
18630 {
18631 soundDelay = -1;
18633 }
18634 else if (type == 976)
18635 {
18636 soundDelay = -1;
18637 }
18638 else
18639 {
18640 soundDelay = 20 + Main.rand.Next(40);
18642 }
18643 }
18644 if (ai[0] != 0f)
18645 {
18646 if (type == 976)
18647 {
18648 velocity = velocity.RotatedBy(ai[0]);
18649 }
18650 else
18651 {
18652 int num3 = 10 * MaxUpdates;
18653 velocity = velocity.RotatedBy(ai[0] / (float)num3);
18654 }
18655 }
18656 if (type == 977)
18657 {
18658 velocity *= 0.96f;
18659 if (Main.rand.Next(8) == 0)
18660 {
18661 Dust dust = Dust.NewDustDirect(base.Center, 0, 0, 172, velocity.X * 0.1f, velocity.Y * 0.1f, 100, default(Color), 0.9f);
18662 dust.noGravity = true;
18663 dust.position = base.Center;
18664 dust.velocity = Main.rand.NextVector2Circular(1f, 1f) + velocity * 0.5f;
18665 }
18666 }
18667 if (type == 976)
18668 {
18669 if (Collision.LavaCollision(position, width, height))
18670 {
18671 Kill();
18672 return;
18673 }
18674 if (++frameCounter >= 2)
18675 {
18676 frameCounter = 0;
18677 if (++frame >= 7)
18678 {
18679 frame = 0;
18680 }
18681 }
18682 float fromValue = 60 - timeLeft;
18683 float fromMax = ai[1] + 20f;
18684 float num4 = Utils.Remap(fromValue, ai[1], fromMax, 0f, 1f) * Utils.Remap(fromValue, ai[1], ai[1] + 60f, 1f, 0f);
18685 velocity = velocity.SafeNormalize(Vector2.UnitY) * (4f + 12f * (1f - num4));
18686 Opacity = Utils.Remap(fromValue, 0f, 10f, 0f, 1f) * Utils.Remap(fromValue, 30f, 60f, 1f, 0f);
18687 num = 0f;
18688 if (Main.rand.Next(3) == 0)
18689 {
18690 Dust dust2 = Dust.NewDustDirect(position, width, height, 40, 0f, 0f, 0, default(Color), 1.2f);
18691 dust2.noGravity = true;
18692 dust2.velocity = velocity * 0.5f;
18693 }
18694 if (localAI[1] == 0f)
18695 {
18696 localAI[1] = 1f;
18697 for (int i = 0; i < 10; i++)
18698 {
18699 Dust.NewDustDirect(position, width, height, 40, 0f, 0f, 0, default(Color), 0.7f).velocity = velocity.SafeNormalize(Vector2.UnitY).RotatedBy(Main.rand.NextFloat() * ((float)Math.PI * 2f) * 0.25f) * (Main.rand.NextFloat() * 3f);
18700 }
18701 }
18702 }
18703 rotation = velocity.ToRotation() + num;
18704 tileCollide = false;
18705 }
const double PI
Definition Math.cs:16
static void PlaySound(int type, Vector2 position, int style=1)
Vector2 velocity
Definition Entity.cs:16
Vector2 position
Definition Entity.cs:14
static readonly LegacySoundStyle Item1
Definition SoundID.cs:416
static readonly LegacySoundStyle Item9
Definition SoundID.cs:432

References Terraria.Projectile.ai, Terraria.Projectile.alpha, Terraria.Projectile.frame, Terraria.Projectile.frameCounter, Terraria.Entity.height, Terraria.ID.SoundID.Item1, Terraria.ID.SoundID.Item9, Terraria.Projectile.Kill(), Terraria.Collision.LavaCollision(), Terraria.Projectile.localAI, Terraria.Projectile.MaxUpdates, Terraria.Dust.NewDustDirect(), Terraria.Projectile.Opacity, System.Math.PI, Terraria.Audio.SoundEngine.PlaySound(), Terraria.Entity.position, Terraria.Main.rand, Terraria.Utils.Remap(), Terraria.Projectile.rotation, Terraria.Projectile.soundDelay, Terraria.Projectile.tileCollide, Terraria.Projectile.timeLeft, Terraria.Projectile.type, Microsoft.Xna.Framework.Vector2.UnitY, Terraria.Entity.velocity, Terraria.Entity.width, Microsoft.Xna.Framework.Vector2.X, and Microsoft.Xna.Framework.Vector2.Y.