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

◆ AI_189_Volcano()

void Terraria.Projectile.AI_189_Volcano ( )
inlineprivate

Definition at line 34377 of file Projectile.cs.

34378 {
34379 if (soundDelay == 0)
34380 {
34381 soundDelay = -1;
34383 }
34384 alpha = (int)(255f * (1f - Utils.Remap(ai[0], 0f, 2f, 0f, 1f) * Utils.Remap(ai[0], 6f, 10f, 1f, 0f)));
34385 float num = width / 2;
34386 float num2 = height / 2;
34387 num = (num2 = 8f);
34388 scale = 1f + 1f * (ai[0] / 15f);
34389 if (++frameCounter >= 2)
34390 {
34391 frameCounter = 0;
34392 if (++frame >= 5)
34393 {
34394 Kill();
34395 return;
34396 }
34397 }
34398 ai[0] += 1f;
34399 if (ai[0] == 1f)
34400 {
34401 for (int i = 0; i < 20; i++)
34402 {
34403 int num3 = Utils.SelectRandom<int>(Main.rand, 6, 259, 158);
34404 Dust.NewDustPerfect(base.Center + Main.rand.NextVector2Circular(num, num2), num3, velocity.RotatedBy(Main.rand.NextFloatDirection() * ((float)Math.PI / 4f) * 0.6f) * (2f + 5f * Main.rand.NextFloat()), 200, default(Color), 1f + Main.rand.NextFloat()).customData = 0;
34405 }
34406 int num4 = Main.rand.Next(3, 7);
34407 for (int j = 0; j < num4 * 5; j++)
34408 {
34409 Dust dust = Dust.NewDustPerfect(base.Center + Main.rand.NextVector2Circular(num, num2), 31, velocity.RotatedBy(Main.rand.NextFloatDirection() * ((float)Math.PI / 4f) * 0.6f) * (2f + 5f * Main.rand.NextFloat()), 50, default(Color), 1f + Main.rand.NextFloat());
34410 dust.noGravity = true;
34411 dust.velocity *= 3f;
34412 }
34413 for (int k = 0; k < num4; k++)
34414 {
34415 Gore.NewGorePerfect(base.Center + Main.rand.NextVector2Circular(num, num2) - new Vector2(16f, 16f), velocity.RotatedBy(Main.rand.NextFloatDirection() * ((float)Math.PI / 4f) * 0.6f) * (0f + 4f * Main.rand.NextFloat()), 61 + Main.rand.Next(3));
34416 }
34417 }
34418 for (int l = 0; l < 2; l++)
34419 {
34420 if (Main.rand.Next(3) < 2)
34421 {
34422 Dust dust2 = Dust.NewDustPerfect(base.Center + Main.rand.NextVector2Circular(num, num2), 6, velocity.RotatedBy(Main.rand.NextFloatDirection() * ((float)Math.PI / 4f)) * (1.5f + 2f * Main.rand.NextFloat()), 90, default(Color), 2.5f);
34423 dust2.noGravity = true;
34424 dust2.fadeIn = 1f;
34425 if (Main.rand.Next(6) < 3)
34426 {
34427 dust2.noGravity = false;
34428 dust2.noLight = true;
34429 dust2.fadeIn = 0.4f;
34430 dust2.scale *= 0.3f;
34431 }
34432 else
34433 {
34434 dust2.velocity = DirectionFrom(dust2.position) * dust2.velocity.Length() * 0.25f;
34435 }
34436 dust2.customData = 0;
34437 }
34438 }
34439 for (int m = 0; m < 2; m++)
34440 {
34441 if (!(Main.rand.NextFloat() < 0.5f))
34442 {
34443 int num5 = Utils.SelectRandom<int>(Main.rand, 6, 259, 158);
34444 Dust dust3 = Dust.NewDustPerfect(base.Center + Main.rand.NextVector2Circular(num, num2), num5, velocity.RotatedBy(Main.rand.NextFloatDirection() * ((float)Math.PI / 4f) * 0.5f) * (1f + 2f * Main.rand.NextFloat()), 200, default(Color), 1f + Main.rand.NextFloat());
34445 dust3.velocity *= new Vector2(0.6f, 1.5f);
34446 dust3.customData = 0;
34447 }
34448 }
34449 }
const double PI
Definition Math.cs:16
static void PlaySound(int type, Vector2 position, int style=1)
Vector2 DirectionFrom(Vector2 Source)
Definition Entity.cs:202
Vector2 velocity
Definition Entity.cs:16
static readonly LegacySoundStyle DD2_ExplosiveTrapExplode
Definition SoundID.cs:790

References Terraria.ID.SoundID.DD2_ExplosiveTrapExplode, Terraria.Dust.NewDustPerfect(), Terraria.Gore.NewGorePerfect(), System.Math.PI, Terraria.Audio.SoundEngine.PlaySound(), Terraria.Main.rand, and Terraria.Utils.Remap().