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

◆ AI_115_LadyBugs()

void Terraria.NPC.AI_115_LadyBugs ( )
inlineprivate

Definition at line 49645 of file NPC.cs.

49646 {
49647 //IL_01ef: Unknown result type (might be due to invalid IL or missing references)
49648 //IL_01f9: Unknown result type (might be due to invalid IL or missing references)
49649 //IL_01fe: Unknown result type (might be due to invalid IL or missing references)
49650 //IL_0217: Unknown result type (might be due to invalid IL or missing references)
49651 //IL_021c: Unknown result type (might be due to invalid IL or missing references)
49652 //IL_0222: Unknown result type (might be due to invalid IL or missing references)
49653 //IL_0227: Unknown result type (might be due to invalid IL or missing references)
49654 //IL_047c: Unknown result type (might be due to invalid IL or missing references)
49655 //IL_0494: Unknown result type (might be due to invalid IL or missing references)
49656 //IL_0244: Unknown result type (might be due to invalid IL or missing references)
49657 //IL_0254: Unknown result type (might be due to invalid IL or missing references)
49658 //IL_05dd: Unknown result type (might be due to invalid IL or missing references)
49659 //IL_05e2: Unknown result type (might be due to invalid IL or missing references)
49660 //IL_05ee: Unknown result type (might be due to invalid IL or missing references)
49661 //IL_05f8: Unknown result type (might be due to invalid IL or missing references)
49662 //IL_05fd: Unknown result type (might be due to invalid IL or missing references)
49663 //IL_0340: Unknown result type (might be due to invalid IL or missing references)
49664 //IL_0351: Unknown result type (might be due to invalid IL or missing references)
49665 //IL_017f: Unknown result type (might be due to invalid IL or missing references)
49666 //IL_01a4: Unknown result type (might be due to invalid IL or missing references)
49667 //IL_010b: Unknown result type (might be due to invalid IL or missing references)
49668 //IL_0533: Unknown result type (might be due to invalid IL or missing references)
49669 //IL_0130: Unknown result type (might be due to invalid IL or missing references)
49670 //IL_0558: Unknown result type (might be due to invalid IL or missing references)
49671 if (Main.netMode != 1)
49672 {
49673 if (ai[1] == 0f)
49674 {
49675 ai[1] = Main.rand.NextFloat() * 0.2f + 0.7f;
49676 netUpdate = true;
49677 }
49678 if ((localAI[0] -= 1f) <= 0f)
49679 {
49680 localAI[0] = Main.rand.Next(60, 181);
49681 if (Main.rand.Next(5) == 0)
49682 {
49683 if (ai[2] == 0f)
49684 {
49685 ai[2] = 1f;
49686 ai[0] = 0f;
49687 netUpdate = true;
49688 }
49689 else if (ai[2] == 1f)
49690 {
49691 TargetClosest();
49692 ai[2] = 0f;
49693 ai[0] = Main.rand.NextFloat() * ((float)Math.PI * 2f);
49694 if (Distance(Main.player[target].Center) > 700f)
49695 {
49696 ai[0] = AngleTo(Main.player[target].Center) + Main.rand.NextFloatDirection() * 0.3f;
49697 }
49698 netUpdate = true;
49699 }
49700 }
49701 TargetClosest();
49702 ai[0] = Main.rand.NextFloat() * ((float)Math.PI * 2f);
49703 if (Distance(Main.player[target].Center) > 700f)
49704 {
49705 ai[0] = AngleTo(Main.player[target].Center) + Main.rand.NextFloatDirection() * 0.3f;
49706 }
49707 netUpdate = true;
49708 }
49709 }
49710 scale = ai[1];
49711 if (ai[2] == 0f)
49712 {
49713 Vector2 value = ai[0].ToRotationVector2() * 1f;
49714 value.X += Main.windSpeedTarget * 0.8f;
49715 velocity = Vector2.Lerp(velocity, value, 0.0125f);
49716 if (velocity.Y > 0f)
49717 {
49718 int num = 4;
49719 int num2 = (int)base.Center.X / 16;
49720 int num3 = (int)base.Center.Y / 16;
49721 for (int i = num3; i < num3 + num; i++)
49722 {
49723 if (Main.tile[num2, i] != null && ((Main.tile[num2, i].nactive() && Main.tileSolid[Main.tile[num2, i].type]) || Main.tile[num2, i].liquid > 0))
49724 {
49725 ai[0] = 0f - ai[0];
49726 if (velocity.Y > 0f)
49727 {
49728 velocity.Y *= 0.9f;
49729 }
49730 }
49731 }
49732 }
49733 if (velocity.Y < 0f)
49734 {
49735 int num4 = 30;
49736 bool flag = false;
49737 int num5 = (int)base.Center.X / 16;
49738 int num6 = (int)base.Center.Y / 16;
49739 for (int j = num6; j < num6 + num4; j++)
49740 {
49741 if (Main.tile[num5, j] != null && ((Main.tile[num5, j].nactive() && Main.tileSolid[Main.tile[num5, j].type]) || Main.tile[num5, j].liquid > 0))
49742 {
49743 flag = true;
49744 }
49745 }
49746 if (!flag)
49747 {
49748 ai[0] = 0f - ai[0];
49749 if (velocity.Y < 0f)
49750 {
49751 velocity.Y *= 0.9f;
49752 }
49753 }
49754 }
49755 if (collideX)
49756 {
49757 ai[0] = 0f - ai[0] + (float)Math.PI;
49758 velocity.X *= -0.2f;
49759 }
49760 }
49761 else
49762 {
49763 if (velocity.Y > 0f)
49764 {
49765 int num7 = 4;
49766 int num8 = (int)base.Center.X / 16 + direction;
49767 int num9 = (int)base.Center.Y / 16;
49768 for (int k = num9; k < num9 + num7; k++)
49769 {
49770 if (Main.tile[num8, k] != null && Main.tile[num8, k].liquid > 0)
49771 {
49772 TargetClosest();
49773 velocity.Y = -1f;
49774 ai[2] = 0f;
49775 ai[0] = Main.rand.NextFloat() * ((float)Math.PI / 4f) - (float)Math.PI / 2f;
49776 if (Distance(Main.player[target].Center) > 700f)
49777 {
49778 ai[0] = AngleTo(Main.player[target].Center) + Main.rand.NextFloatDirection() * 0.3f;
49779 }
49780 netUpdate = true;
49781 return;
49782 }
49783 }
49784 }
49785 if (velocity.Y != 0f)
49786 {
49787 velocity.X *= 0.98f;
49788 velocity.Y = MathHelper.Lerp(velocity.Y, 2f, 0.005f);
49789 }
49790 else
49791 {
49792 velocity = Vector2.Lerp(velocity, Vector2.UnitX * (float)direction, 0.05f);
49793 velocity.Y += 0.2f;
49794 if (collideX)
49795 {
49796 direction *= -1;
49797 velocity.X *= -0.2f;
49798 netUpdate = true;
49799 }
49800 }
49801 }
49802 direction = ((velocity.X > 0f) ? 1 : (-1));
49803 }
float AngleTo(Vector2 Destination)
Definition Entity.cs:257
Vector2 velocity
The velocity of this Entity in world coordinates per tick.
Definition Entity.cs:33
float Distance(Vector2 Other)
Definition Entity.cs:275
float[] localAI
Acts like F:Terraria.NPC.ai, but does not sync to the server. Many vanilla T:Terraria....
Definition NPC.cs:1003
void TargetClosest(bool faceTarget=true)
Definition NPC.cs:83247
float[] ai
An array with 4 slots used for any sort of data storage, which is occasionally synced from the server...
Definition NPC.cs:997
float value
How many copper coins the NPC will drop when killed (100 copper coins = 1 silver coin etc....
Definition NPC.cs:1156
float scale
Makes the NPC bigger or smaller. Bigger than 1f is bigger. Defaults to 1f.
Definition NPC.cs:1104
bool collideX
Definition NPC.cs:1134
bool netUpdate
Definition NPC.cs:1130
int target
Definition NPC.cs:1019

References Terraria.NPC.ai, Terraria.Entity.AngleTo(), Terraria.NPC.collideX, Terraria.Entity.direction, Terraria.Entity.Distance(), Terraria.NPC.localAI, Terraria.Main.netMode, Terraria.NPC.netUpdate, Terraria.Main.player, Terraria.Main.rand, Terraria.NPC.scale, Terraria.NPC.target, Terraria.NPC.TargetClosest(), Terraria.Main.tile, Terraria.Main.tileSolid, Terraria.NPC.value, and Terraria.Entity.velocity.

Referenced by Terraria.NPC.VanillaAI_Inner().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: