Definition at line 40930 of file NPC.cs.
40931 {
40932 if (
localAI[0] == 0f && Main.netMode != 1)
40933 {
40938 velocity = (Main.rand.NextVector2Circular(5f, 3f) + Main.rand.NextVector2CircularEdge(5f, 3f)) * 0.4f;
40942 }
40943 switch ((
int)
ai[0])
40944 {
40945 case 0:
40947 if (Main.netMode != 1 && (
ai[1] += 1f) >= (float)(60 + Main.rand.Next(60)))
40948 {
40951 {
40953 }
40955 {
40957 }
40958 else
40959 {
40960 velocity = (Main.rand.NextVector2Circular(5f, 3f) + Main.rand.NextVector2CircularEdge(5f, 3f)) * 0.4f;
40961 }
40965 }
40966 break;
40967 case 1:
40968 {
40969 int num = 4;
40972 {
40973 num = 200;
40974 }
40975 if ((
ai[1] += 1f) >= (
float)num)
40976 {
40980 }
40981 int num2 = (int)
base.Center.X / 16;
40982 int num3 = (int)
base.Center.Y / 16;
40985 {
40986 if (Main.tile[
num2, i] !=
null && ((Main.tile[
num2, i].nactive() && Main.tileSolid[Main.tile[
num2, i].type]) || Main.tile[
num2, i].liquid > 0))
40987 {
40989 {
40990 velocity.Y *= 0.9f;
40991 }
40992 velocity.Y -= 0.2f;
40993 }
40994 }
40996 {
40997 break;
40998 }
41000 bool flag = false;
41002 {
41003 if (Main.tile[
num2,
j] !=
null && Main.tile[
num2,
j].nactive() && Main.tileSolid[Main.tile[
num2,
j].type])
41004 {
41005 flag = true;
41006 break;
41007 }
41008 }
41010 {
41011 velocity.Y *= 0.9f;
41012 }
41013 break;
41014 }
41015 }
41017 {
41018 direction = ((velocity.X > 0f) ? 1 : (-1));
41019 }
41021 {
41022 velocity.Y = -3f;
41023 }
41025 {
41027 return;
41028 }
41032 for (
int k = 0;
k < 200;
k++)
41033 {
41035 if (
nPC.active &&
nPC.damage > 0 && !
nPC.friendly &&
nPC.Hitbox.Distance(
base.Center) <= 100f)
41036 {
41039 }
41040 }
41041 for (
int l = 0;
l < 255;
l++)
41042 {
41043 Player player = Main.player[
l];
41044 if (player.active && player.Hitbox.Distance(
base.Center) <= 150f)
41045 {
41048 }
41049 }
41051 {
41057 {
41059 }
41066 }
41067 else
41068 {
41069 if (Main.netMode == 1 || !((
new Vector2(
ai[2],
ai[3]) -
base.Center).Length() < 16f))
41070 {
41071 return;
41072 }
41074 if (Main.tile[(
int)
ai[2] / 16, (
int)
ai[3] / 16].type != 519)
41075 {
41077 }
41078 if (Main.rand.Next(
maxValue) != 0)
41079 {
41080 return;
41081 }
41085 {
41089 return;
41090 }
41091 int num8 = (int)(
base.Center.X / 16f);
41093 for (
m = (
int)(base.Center.Y / 16f); !
WorldGen.SolidTile(
num8,
m) && (double)
m < Main.worldSurface;
m++)
41094 {
41095 }
41096 m -= Main.rand.Next(3, 6);
41100 }
41101 }
Vector2 DirectionFrom(Vector2 Source)
float Distance(Vector2 Other)
Vector2 DirectionTo(Vector2 Destination)
static bool FindCattailTop(int landX, int landY, out int cattailX, out int cattailY)
References Terraria.Entity.active, Terraria.NPC.ai, Terraria.Entity.Center, Terraria.Entity.direction, Terraria.Entity.DirectionFrom(), Terraria.Entity.DirectionTo(), Terraria.Entity.Distance(), Terraria.NPC.FindCattailTop(), Terraria.Entity.Hitbox, Microsoft.Xna.Framework.Vector2.Length(), Terraria.NPC.localAI, Terraria.Main.netMode, Terraria.NPC.netUpdate, Terraria.Main.npc, System.other, Terraria.Main.player, Terraria.Main.rand, Terraria.WorldGen.SolidTile(), Terraria.Main.tile, Terraria.Main.tileSolid, Microsoft.Xna.Framework.Graphics.Vector2, Terraria.Entity.velocity, Terraria.Entity.wet, Terraria.Main.worldSurface, Microsoft.Xna.Framework.Vector2.X, Microsoft.Xna.Framework.Vector2.Y, and Microsoft.Xna.Framework.Vector2.Zero.
Referenced by Terraria.NPC.AI().