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

◆ AI_130_FlameBurstTower()

void Terraria.Projectile.AI_130_FlameBurstTower ( )
inlineprivate

Definition at line 57422 of file Projectile.cs.

57423 {
57424 float num = 900f;
57425 float angleRatioMax = 1f;
57426 Vector2 vector = base.Center;
57427 int num2 = 664;
57428 int num3 = 12;
57429 float num4 = 12f;
57430 int num5 = 1;
57431 int num6 = 6;
57432 int num7 = 4;
57433 int num8 = 80;
57434 switch (type)
57435 {
57436 case 663:
57437 {
57438 Lighting.AddLight(base.Center, new Vector3(0.4f, 0.2f, 0.1f));
57439 Lighting.AddLight(base.Bottom + new Vector2(0f, -10f), new Vector3(0.4f, 0.2f, 0.1f));
57440 vector = base.Bottom + new Vector2(direction * 6, -40f);
57441 if ((localAI[0] += 1f) >= 300f)
57442 {
57443 localAI[0] = 0f;
57444 }
57445 Rectangle r3 = new Rectangle((int)position.X + width / 4, (int)position.Y + height - 16, width / 4 * 3, 6);
57446 if (direction == 1)
57447 {
57448 r3.X -= width / 4;
57449 }
57450 for (int m = 0; m < 1; m++)
57451 {
57452 if (Main.rand.Next(2) == 0)
57453 {
57454 Dust dust5 = Dust.NewDustDirect(r3.TopLeft() + new Vector2(-2f, -2f), r3.Width + 4, r3.Height + 4, 270, -direction * 2, -2f, 200, new Color(255, 255, 255, 0));
57455 dust5.fadeIn = 0.6f + Main.rand.NextFloat() * 0.6f;
57456 dust5.scale = 0.4f;
57457 dust5.noGravity = true;
57458 dust5.noLight = true;
57459 dust5.velocity = Vector2.Zero;
57460 dust5.velocity.X = (float)(-direction) * Main.rand.NextFloat() * dust5.fadeIn;
57461 }
57462 }
57463 r3 = new Rectangle((int)base.Center.X, (int)base.Bottom.Y, width / 4, 10);
57464 if (direction == -1)
57465 {
57466 r3.X -= r3.Width;
57467 }
57468 r3.X += direction * 4;
57469 r3.Y -= height - 10;
57470 for (int n = 0; n < 1; n++)
57471 {
57472 if (Main.rand.Next(5) == 0)
57473 {
57474 Dust dust6 = Dust.NewDustDirect(r3.TopLeft(), r3.Width, r3.Height, 6);
57475 dust6.fadeIn = 1f;
57476 dust6.scale = 1f;
57477 dust6.noGravity = true;
57478 dust6.noLight = true;
57479 dust6.velocity *= 2f;
57480 }
57481 }
57482 break;
57483 }
57484 case 665:
57485 {
57486 Lighting.AddLight(base.Center, new Vector3(0.4f, 0.2f, 0.1f) * 1.2f);
57487 Lighting.AddLight(base.Bottom + new Vector2(0f, -10f), new Vector3(0.4f, 0.2f, 0.1f) * 1.2f);
57488 num8 = 70;
57489 num4 += 3f;
57490 num6 = 8;
57491 num2 = 666;
57492 vector = base.Bottom + new Vector2(direction * 6, -44f);
57493 if ((localAI[0] += 1f) >= 300f)
57494 {
57495 localAI[0] = 0f;
57496 }
57497 Rectangle r2 = new Rectangle((int)position.X + width / 4, (int)position.Y + height - 16, width / 4 * 2, 6);
57498 if (direction == 1)
57499 {
57500 r2.X -= width / 4;
57501 }
57502 for (int k = 0; k < 1; k++)
57503 {
57504 if (Main.rand.Next(2) == 0)
57505 {
57506 Dust dust3 = Dust.NewDustDirect(r2.TopLeft() + new Vector2(-2f, -2f), r2.Width + 4, r2.Height + 4, 270, -direction * 2, -2f, 200, new Color(255, 255, 255, 0));
57507 dust3.fadeIn = 0.6f + Main.rand.NextFloat() * 0.6f;
57508 dust3.scale = 0.4f;
57509 dust3.noGravity = true;
57510 dust3.noLight = true;
57511 dust3.velocity = Vector2.Zero;
57512 dust3.velocity.X = (float)(-direction) * Main.rand.NextFloat() * dust3.fadeIn;
57513 }
57514 }
57515 r2 = new Rectangle((int)base.Center.X, (int)base.Bottom.Y, width / 4, 10);
57516 if (direction == -1)
57517 {
57518 r2.X -= r2.Width;
57519 }
57520 r2.X += direction * 4;
57521 r2.Y -= height - 10;
57522 for (int l = 0; l < 2; l++)
57523 {
57524 if (Main.rand.Next(5) == 0)
57525 {
57526 Dust dust4 = Dust.NewDustDirect(r2.TopLeft(), r2.Width, r2.Height, 6);
57527 dust4.fadeIn = 1f;
57528 dust4.scale = 1f;
57529 dust4.noGravity = true;
57530 dust4.noLight = true;
57531 dust4.velocity *= 2f;
57532 }
57533 }
57534 break;
57535 }
57536 case 667:
57537 {
57538 Lighting.AddLight(base.Center, new Vector3(0.4f, 0.2f, 0.1f) * 1.5f);
57539 Lighting.AddLight(base.Bottom + new Vector2(0f, -10f), new Vector3(0.4f, 0.2f, 0.1f) * 1.5f);
57540 num8 = 60;
57541 num4 += 6f;
57542 num6 = 8;
57543 num2 = 668;
57544 vector = base.Bottom + new Vector2(direction * 6, -46f);
57545 if ((localAI[0] += 1f) >= 300f)
57546 {
57547 localAI[0] = 0f;
57548 }
57549 Rectangle r = new Rectangle((int)position.X + width / 4, (int)position.Y + height - 16, width / 4 * 2, 6);
57550 if (direction == 1)
57551 {
57552 r.X -= width / 4;
57553 }
57554 for (int i = 0; i < 1; i++)
57555 {
57556 if (Main.rand.Next(2) == 0)
57557 {
57558 Dust dust = Dust.NewDustDirect(r.TopLeft() + new Vector2(-2f, -2f), r.Width + 4, r.Height + 4, 270, -direction * 2, -2f, 200, new Color(255, 255, 255, 0));
57559 dust.fadeIn = 0.6f + Main.rand.NextFloat() * 0.6f;
57560 dust.scale = 0.4f;
57561 dust.noGravity = true;
57562 dust.noLight = true;
57563 dust.velocity = Vector2.Zero;
57564 dust.velocity.X = (float)(-direction) * Main.rand.NextFloat() * dust.fadeIn;
57565 }
57566 }
57567 r = new Rectangle((int)base.Center.X, (int)base.Bottom.Y, width / 4, 10);
57568 if (direction == -1)
57569 {
57570 r.X -= r.Width;
57571 }
57572 r.X += direction * 4;
57573 r.Y -= height - 10;
57574 for (int j = 0; j < 3; j++)
57575 {
57576 if (Main.rand.Next(5) == 0)
57577 {
57578 Dust dust2 = Dust.NewDustDirect(r.TopLeft(), r.Width, r.Height, 6);
57579 dust2.fadeIn = 1.1f;
57580 dust2.scale = 1f;
57581 dust2.noGravity = true;
57582 dust2.noLight = true;
57583 dust2.velocity *= 2.4f;
57584 }
57585 }
57586 break;
57587 }
57588 }
57589 if (Main.player[owner].setApprenticeT2)
57590 {
57591 angleRatioMax = 0.1f;
57592 num *= 1.5f;
57593 num4 *= 1.4f;
57594 }
57595 if (ai[0] == 0f)
57596 {
57597 direction = (spriteDirection = Main.player[owner].direction);
57598 ai[0] = 1f;
57599 ai[1] = 0f;
57600 netUpdate = true;
57601 }
57602 if (ai[0] == 1f)
57603 {
57604 frame = 0;
57605 bool flag = false;
57606 if (ai[1] > 0f)
57607 {
57608 ai[1] -= 1f;
57609 }
57610 else
57611 {
57612 flag = true;
57613 }
57614 if (flag && owner == Main.myPlayer)
57615 {
57617 if (num9 != -1)
57618 {
57619 direction = Math.Sign(DirectionTo(Main.npc[num9].Center).X);
57620 ai[0] = 2f;
57621 ai[1] = 0f;
57622 netUpdate = true;
57623 }
57624 }
57625 }
57626 else if (ai[0] == 2f)
57627 {
57628 frame = num5 + (int)(ai[1] / (float)num7);
57629 if (ai[1] == (float)num3)
57630 {
57631 Vector2 vector2 = new Vector2(direction, 0f);
57633 if (num10 != -1)
57634 {
57635 vector2 = (Main.npc[num10].Center - vector).SafeNormalize(Vector2.UnitX * direction);
57636 }
57638 if (owner == Main.myPlayer)
57639 {
57641 }
57642 }
57643 if ((ai[1] += 1f) >= (float)(num6 * num7))
57644 {
57645 ai[0] = 1f;
57646 ai[1] = num8;
57647 }
57648 }
57650 tileCollide = true;
57651 velocity.Y += 0.2f;
57652 }
static int Sign(decimal value)
Definition Math.cs:1202
Vector2 position
Definition Entity.cs:14
Vector2 DirectionTo(Vector2 Destination)
Definition Entity.cs:197
int AI_130_FlameBurstTower_FindTarget(float shot_range, float angleRatioMax, Vector2 shootingSpot, bool canChangeDirection=true)
IEntitySource GetProjectileSource_FromThis()
static int NewProjectile(IEntitySource spawnSource, Vector2 position, Vector2 velocity, int Type, int Damage, float KnockBack, int Owner=-1, float ai0=0f, float ai1=0f, float ai2=0f)

References Terraria.Lighting.AddLight(), Terraria.Dust.fadeIn, Terraria.Main.myPlayer, Terraria.Dust.NewDustDirect(), Terraria.Main.npc, Terraria.Main.player, Terraria.Main.rand, System.Math.Sign(), System.type, Microsoft.Xna.Framework.Vector2.UnitX, Microsoft.Xna.Framework.Vector2.X, Microsoft.Xna.Framework.Vector2.Y, and Microsoft.Xna.Framework.Vector2.Zero.