private void AI_099_1()
{
timeLeft = 6;
bool flag1 = true;
float num1 = 250f;
float num2 = 0.1f;
float num3 = 15f;
float num4 = 12f;
float num5 = num1 * 0.5f;
float num6 = num3 * 0.8f;
float num7 = num4 * 1.5f;
if (owner == Main.myPlayer)
{
bool flag2 = false;
for (int index = 0; index < 1000; ++index)
{
if (Main.projectile[index].active && Main.projectile[index].owner == owner && Main.projectile[index].aiStyle == 99 && (Main.projectile[index].type < 556 || Main.projectile[index].type > 561))
flag2 = true;
}
if (!flag2)
{
ai[0] = -1f;
netUpdate = true;
}
}
if (Main.player[owner].yoyoString)
num5 += (float)(num5 * 0.25 + 10.0);
rotation += 0.5f;
if (Main.player[owner].dead)
{
Kill();
}
else
{
if (!flag1)
{
Main.player[owner].heldProj = whoAmI;
Main.player[owner].itemAnimation = 2;
Main.player[owner].itemTime = 2;
if (position.X + (width / 2) > Main.player[owner].position.X + (Main.player[owner].width / 2))
{
Main.player[owner].ChangeDir(1);
direction = 1;
}
else
{
Main.player[owner].ChangeDir(-1);
direction = -1;
}
}
if (ai[0] == 0.0 || ai[0] == 1.0)
{
if (ai[0] == 1.0)
num5 *= 0.75f;
float num8 = num7 * 0.5f;
bool flag2 = false;
Vector2 vector2_1 = Main.player[owner].Center - Center;
if ((double)vector2_1.Length() > num5 * 0.9)
flag2 = true;
if ((double)vector2_1.Length() > num5)
{
float num9 = vector2_1.Length() - num5;
Vector2 vector2_2;
vector2_2.X = vector2_1.Y;
vector2_2.Y = vector2_1.X;
vector2_1.Normalize();
vector2_1 *= num5;
position = Main.player[owner].Center - vector2_1;
position.X -= (width / 2);
position.Y -= (height / 2);
float num10 = velocity.Length();
velocity.Normalize();
if (num9 > num10 - 1.0)
num9 = num10 - 1f;
Projectile projectile = this;
Vector2 vector2_3 = projectile.velocity * (num10 - num9);
projectile.velocity = vector2_3;
velocity.Length();
Vector2 vector2_4 = new Vector2(Center.X, Center.Y);
Vector2 vector2_5 = new Vector2(Main.player[owner].Center.X, Main.player[owner].Center.Y);
if (vector2_4.Y < vector2_5.Y)
vector2_2.Y = Math.Abs(vector2_2.Y);
else if (vector2_4.Y > vector2_5.Y)
vector2_2.Y = -Math.Abs(vector2_2.Y);
if (vector2_4.X < vector2_5.X)
vector2_2.X = Math.Abs(vector2_2.X);
else if (vector2_4.X > vector2_5.X)
vector2_2.X = -Math.Abs(vector2_2.X);
vector2_2.Normalize();
Vector2 vector2_6 = vector2_2 * velocity.Length();
Vector2 vector2_7 = new Vector2(vector2_6.X, vector2_6.Y);
if (Math.Abs(velocity.X) > Math.Abs(velocity.Y))
{
Vector2 vector2_8 = velocity;
vector2_8.Y += vector2_6.Y;
vector2_8.Normalize();
vector2_8 *= velocity.Length();
if (Math.Abs(vector2_6.X) < 0.1 || Math.Abs(vector2_6.Y) < 0.1)
velocity = vector2_8;
else
velocity = (vector2_8 + velocity * 2f) / 3f;
}
else
{
Vector2 vector2_8 = velocity;
vector2_8.X += vector2_6.X;
vector2_8.Normalize();
vector2_8 *= velocity.Length();
if (Math.Abs(vector2_6.X) < 0.2 || Math.Abs(vector2_6.Y) < 0.2)
velocity = vector2_8;
else
velocity = (vector2_8 + velocity * 2f) / 3f;
}
}
if (Main.myPlayer == owner)
{
if (Main.player[owner].channel)
{
Vector2 vector2_2 = new Vector2((Main.mouseX - Main.lastMouseX), (Main.mouseY - Main.lastMouseY));
if (velocity.X != 0.0 || velocity.Y != 0.0)
{
if (flag1)
vector2_2 *= -1f;
if (flag2)
{
if (Center.X < Main.player[owner].Center.X && vector2_2.X < 0.0)
vector2_2.X = 0.0f;
if (Center.X > Main.player[owner].Center.X && vector2_2.X > 0.0)
vector2_2.X = 0.0f;
if (Center.Y < Main.player[owner].Center.Y && vector2_2.Y < 0.0)
vector2_2.Y = 0.0f;
if (Center.Y > Main.player[owner].Center.Y && vector2_2.Y > 0.0)
vector2_2.Y = 0.0f;
}
Projectile projectile = this;
Vector2 vector2_3 = projectile.velocity + vector2_2 * num2;
projectile.velocity = vector2_3;
netUpdate = true;
}
}
else
{
ai[0] = 10f;
netUpdate = true;
}
}
if (flag1 || type == 562 || (type == 547 || type == 555) || (type == 564 || type == 552 || (type == 563 || type == 549)) || (type == 550 || type == 554 || (type == 553 || type == 603)))
{
float num9 = 800f;
Vector2 vector2_2 = new Vector2();
bool flag3 = false;
if (type == 549)
num9 = 200f;
if (type == 554)
num9 = 400f;
if (type == 553)
num9 = 250f;
if (type == 603)
num9 = 320f;
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].CanBeChasedBy(this, false))
{
float num10 = Main.npc[index].position.X + (Main.npc[index].width / 2);
float num11 = Main.npc[index].position.Y + (Main.npc[index].height / 2);
float num12 = Math.Abs(position.X + (width / 2) - num10) + Math.Abs(position.Y + (height / 2) - num11);
if (num12 < num9 && (type != 563 || num12 >= 200.0) && Collision.CanHit(position, width, height, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height) && (Main.npc[index].Center - Main.player[owner].Center).Length() < num5 * 0.9)
{
num9 = num12;
vector2_2.X = num10;
vector2_2.Y = num11;
flag3 = true;
}
}
}
if (flag3)
{
vector2_2 -= Center;
vector2_2.Normalize();
if (type == 563)
{
vector2_2 *= 4f;
velocity = (velocity * 14f + vector2_2) / 15f;
}
else if (type == 553)
{
vector2_2 *= 5f;
velocity = (velocity * 12f + vector2_2) / 13f;
}
else if (type == 603)
{
vector2_2 *= 16f;
velocity = (velocity * 9f + vector2_2) / 10f;
}
else if (type == 554)
{
vector2_2 *= 8f;
velocity = (velocity * 6f + vector2_2) / 7f;
}
else
{
vector2_2 *= 6f;
velocity = (velocity * 7f + vector2_2) / 8f;
}
}
}
if (velocity.Length() > num6)
{
velocity.Normalize();
Projectile projectile = this;
Vector2 vector2_2 = projectile.velocity * num6;
projectile.velocity = vector2_2;
}
if (velocity.Length() >= num8)
return;
velocity.Normalize();
Projectile projectile1 = this;
Vector2 vector2_9 = projectile1.velocity * num8;
projectile1.velocity = vector2_9;
}
else
{
tileCollide = false;
Vector2 vec = Main.player[owner].Center - Center;
if (vec.Length() < 40.0 || Utils.HasNaNs(vec))
{
Kill();
}
else
{
float num8 = num6 * 1.5f;
if (type == 546)
num8 *= 1.5f;
if (type == 554)
num8 *= 1.25f;
if (type == 555)
num8 *= 1.35f;
if (type == 562)
num8 *= 1.25f;
float num9 = 12f;
vec.Normalize();
vec *= num8;
velocity = (velocity * (num9 - 1f) + vec) / num9;
}
}
}
}