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

◆ AI_136_BetsyBreath()

void Terraria.Projectile.AI_136_BetsyBreath ( )
inlineprivate

Definition at line 58053 of file Projectile.cs.

58054 {
58055 if (ai[1] < 0f || ai[1] > 200f)
58056 {
58057 Kill();
58058 return;
58059 }
58060 NPC nPC = Main.npc[(int)ai[1]];
58061 float num = -8f;
58062 Vector2 center = nPC.Center + new Vector2((110f + num) * (float)nPC.spriteDirection, 30f).RotatedBy(nPC.rotation);
58063 base.Center = center;
58064 rotation = nPC.DirectionTo(base.Center).ToRotation();
58065 DelegateMethods.v3_1 = new Vector3(1.2f, 1f, 0.3f);
58066 float num2 = ai[0] / 40f;
58067 if (num2 > 1f)
58068 {
58069 num2 = 1f;
58070 }
58071 float num3 = (ai[0] - 38f) / 40f;
58072 if (num3 < 0f)
58073 {
58074 num3 = 0f;
58075 }
58076 Utils.PlotTileLine(base.Center + rotation.ToRotationVector2() * 400f * num3, base.Center + rotation.ToRotationVector2() * 400f * num2, 16f, DelegateMethods.CastLight);
58077 Utils.PlotTileLine(base.Center + rotation.ToRotationVector2().RotatedBy(0.19634954631328583) * 400f * num3, base.Center + rotation.ToRotationVector2().RotatedBy(0.19634954631328583) * 400f * num2, 16f, DelegateMethods.CastLight);
58078 Utils.PlotTileLine(base.Center + rotation.ToRotationVector2().RotatedBy(-0.19634954631328583) * 400f * num3, base.Center + rotation.ToRotationVector2().RotatedBy(-0.19634954631328583) * 400f * num2, 16f, DelegateMethods.CastLight);
58079 if (num3 == 0f && num2 > 0.1f)
58080 {
58081 for (int i = 0; i < 3; i++)
58082 {
58083 Dust dust = Dust.NewDustDirect(position, width, height, 6);
58084 dust.fadeIn = 1.5f;
58085 dust.velocity = rotation.ToRotationVector2().RotatedBy(Main.rand.NextFloatDirection() * ((float)Math.PI / 12f)) * (0.5f + Main.rand.NextFloat() * 2.5f) * 15f;
58086 dust.velocity += nPC.velocity * 2f;
58087 dust.noLight = true;
58088 dust.noGravity = true;
58089 dust.alpha = 200;
58090 }
58091 }
58092 if (Main.rand.Next(5) == 0 && ai[0] >= 15f)
58093 {
58094 Gore gore = Gore.NewGoreDirect(base.Center + rotation.ToRotationVector2() * 300f - Utils.RandomVector2(Main.rand, -20f, 20f), Vector2.Zero, 61 + Main.rand.Next(3), 0.5f);
58095 gore.velocity *= 0.3f;
58096 gore.velocity += rotation.ToRotationVector2() * 4f;
58097 }
58098 for (int j = 0; j < 1; j++)
58099 {
58100 Dust dust2 = Dust.NewDustDirect(position, width, height, 31);
58101 dust2.fadeIn = 1.5f;
58102 dust2.scale = 0.4f;
58103 dust2.velocity = rotation.ToRotationVector2().RotatedBy(Main.rand.NextFloatDirection() * ((float)Math.PI / 12f)) * (0.5f + Main.rand.NextFloat() * 2.5f) * 15f;
58104 dust2.velocity += nPC.velocity * 2f;
58105 dust2.velocity *= 0.3f;
58106 dust2.noLight = true;
58107 dust2.noGravity = true;
58108 float num4 = Main.rand.NextFloat();
58109 dust2.position = Vector2.Lerp(base.Center + rotation.ToRotationVector2() * 400f * num3, base.Center + rotation.ToRotationVector2() * 400f * num2, num4);
58110 dust2.position += rotation.ToRotationVector2().RotatedBy(1.5707963705062866) * (20f + 100f * (num4 - 0.5f));
58111 }
58112 frameCounter++;
58113 ai[0] += 1f;
58114 if (ai[0] >= 78f)
58115 {
58116 Kill();
58117 }
58118 }
const double PI
Definition Math.cs:16
Vector2 position
Definition Entity.cs:14
static Vector2 Lerp(Vector2 value1, Vector2 value2, float amount)
Definition Vector2.cs:227

References Terraria.DelegateMethods.CastLight(), Microsoft.Xna.Framework.Vector2.Lerp(), Terraria.Dust.NewDustDirect(), Terraria.Gore.NewGoreDirect(), Terraria.Main.npc, System.Math.PI, Terraria.Utils.PlotTileLine(), Terraria.Main.rand, Terraria.Utils.RandomVector2(), and Microsoft.Xna.Framework.Vector2.Zero.