private void AI_001()
{
if (type == 469 && wet && !honeyWet)
Kill();
if (type == 601)
{
Color portalColor = PortalHelper.GetPortalColor(owner, (int)ai[0]);
Lighting.AddLight(Center + velocity * 3f, portalColor.ToVector3() * 0.5f);
if (alpha > 0 && alpha <= 15)
{
Color color = portalColor;
color.A = byte.MaxValue;
for (int index = 0; index < 4; ++index)
{
Vector2 vector2 = Utils.RotatedByRandom(Vector2.UnitY, 6.28318548202515) * (3f * Utils.NextFloat(Main.rand));
Dust dust = Main.dust[Dust.NewDust(Center, 0, 0, 264, 0.0f, 0.0f, 0, new Color(), 1f)];
dust.position = Center;
dust.velocity = velocity * 2f + Utils.RandomVector2(Main.rand, -1f, 1f);
dust.color = color;
dust.scale = 1.2f;
dust.noLight = true;
dust.noGravity = true;
dust.customData = Main.player[owner];
}
}
alpha -= 15;
if (alpha < 0)
alpha = 0;
if (++frameCounter >= 4)
{
frameCounter = 0;
if (++frame >= Main.projFrames[type])
frame = 0;
}
if (alpha == 0)
{
Color color = portalColor;
color.A = byte.MaxValue;
Dust dust = Main.dust[Dust.NewDust(Center, 0, 0, 263, 0.0f, 0.0f, 0, new Color(), 1f)];
dust.position = Center;
dust.velocity = velocity / 4f;
dust.color = color;
dust.noGravity = true;
dust.scale = 0.6f;
}
}
if (type == 472)
{
int index1 = Dust.NewDust(position, width, height, 30, 0.0f, 0.0f, 0, new Color(), 1f);
Main.dust[index1].noGravity = true;
Main.dust[index1].velocity *= 0.25f;
Main.dust[index1].velocity += velocity * 0.75f;
if (localAI[0] == 0.0)
{
localAI[0] = 1f;
Main.PlaySound(2, (int)position.X, (int)position.Y, 17);
for (int index2 = 0; index2 < 20; ++index2)
{
int index3 = Dust.NewDust(position, width, height, 30, 0.0f, 0.0f, 0, new Color(), 1f);
Main.dust[index3].noGravity = true;
Main.dust[index3].velocity *= 0.25f;
Main.dust[index3].velocity += velocity;
Main.dust[index3].velocity.X *= (float)(1.0 + Main.rand.Next(-50, 51) * 0.00999999977648258);
Main.dust[index3].velocity.Y *= (float)(1.0 + Main.rand.Next(-50, 51) * 0.00999999977648258);
}
}
}
if (type == 323)
{
alpha -= 50;
if (alpha < 0)
alpha = 0;
}
if (type == 436)
{
if (ai[1] == 0.0)
{
ai[1] = 1f;
Main.PlaySound(2, (int)position.X, (int)position.Y, 12);
}
alpha -= 40;
if (alpha < 0)
alpha = 0;
spriteDirection = direction;
++frameCounter;
if (frameCounter >= 3)
{
++frame;
frameCounter = 0;
if (frame >= 4)
frame = 0;
}
Lighting.AddLight((int)Center.X / 16, (int)Center.Y / 16, 0.3f, 1.1f, 0.5f);
}
if (type == 467)
{
if (ai[1] == 0.0)
{
ai[1] = 1f;
Main.PlaySound(2, (int)position.X, (int)position.Y, 34);
}
else if (ai[1] == 1.0 && Main.netMode != 1)
{
int num1 = -1;
float num2 = 2000f;
for (int index = 0; index < 255; ++index)
{
if (Main.player[index].active && !Main.player[index].dead)
{
Vector2 center = Main.player[index].Center;
float num3 = Vector2.Distance(center, Center);
if ((num3 < num2 || num1 == -1) && Collision.CanHit(Center, 1, 1, center, 1, 1))
{
num2 = num3;
num1 = index;
}
}
}
if (num2 < 20.0)
{
Kill();
return;
}
if (num1 != -1)
{
ai[1] = 21f;
ai[0] = num1;
netUpdate = true;
}
}
else if (ai[1] > 20.0 && ai[1] < 200.0)
{
++ai[1];
int index = (int)ai[0];
if (!Main.player[index].active || Main.player[index].dead)
{
ai[1] = 1f;
ai[0] = 0.0f;
netUpdate = true;
}
else
{
float curAngle = Utils.ToRotation(velocity);
Vector2 v = Main.player[index].Center - Center;
if (v.Length() < 20.0)
{
Kill();
return;
}
float targetAngle = Utils.ToRotation(v);
if (v == Vector2.Zero)
targetAngle = curAngle;
velocity = Utils.RotatedBy(new Vector2(velocity.Length(), 0.0f), Utils.AngleLerp(curAngle, targetAngle, 0.008f), new Vector2());
}
}
if (ai[1] >= 1.0 && ai[1] < 20.0)
{
++ai[1];
if (ai[1] == 20.0)
ai[1] = 1f;
}
alpha -= 40;
if (alpha < 0)
alpha = 0;
spriteDirection = direction;
++frameCounter;
if (frameCounter >= 3)
{
++frame;
frameCounter = 0;
if (frame >= 4)
frame = 0;
}
Lighting.AddLight(Center, 1.1f, 0.9f, 0.4f);
++localAI[0];
if (localAI[0] == 12.0)
{
localAI[0] = 0.0f;
for (int index1 = 0; index1 < 12; ++index1)
{
Vector2 vector2 = Utils.RotatedBy(Vector2.UnitX * (float)-width / 2f + -Utils.RotatedBy(Vector2.UnitY, (double)index1 * 3.14159274101257 / 6.0, new Vector2()) * new Vector2(8f, 16f), rotation - 1.57079637050629, new Vector2());
int index2 = Dust.NewDust(Center, 0, 0, 6, 0.0f, 0.0f, 160, new Color(), 1f);
Main.dust[index2].scale = 1.1f;
Main.dust[index2].noGravity = true;
Main.dust[index2].position = Center + vector2;
Main.dust[index2].velocity = velocity * 0.1f;
Main.dust[index2].velocity = Vector2.Normalize(Center - velocity * 3f - Main.dust[index2].position) * 1.25f;
}
}
if (Main.rand.Next(4) == 0)
{
for (int index1 = 0; index1 < 1; ++index1)
{
Vector2 vector2 = -Utils.RotatedBy(Utils.RotatedByRandom(Vector2.UnitX, 0.196349546313286), Utils.ToRotation(velocity), new Vector2());
int index2 = Dust.NewDust(position, width, height, 31, 0.0f, 0.0f, 100, new Color(), 1f);
Main.dust[index2].velocity *= 0.1f;
Main.dust[index2].position = Center + vector2 * width / 2f;
Main.dust[index2].fadeIn = 0.9f;
}
}
if (Main.rand.Next(32) == 0)
{
for (int index1 = 0; index1 < 1; ++index1)
{
Vector2 vector2 = -Utils.RotatedBy(Utils.RotatedByRandom(Vector2.UnitX, 0.392699092626572), Utils.ToRotation(velocity), new Vector2());
int index2 = Dust.NewDust(position, width, height, 31, 0.0f, 0.0f, 155, new Color(), 0.8f);
Main.dust[index2].velocity *= 0.3f;
Main.dust[index2].position = Center + vector2 * width / 2f;
if (Main.rand.Next(2) == 0)
Main.dust[index2].fadeIn = 1.4f;
}
}
if (Main.rand.Next(2) == 0)
{
for (int index1 = 0; index1 < 2; ++index1)
{
Vector2 vector2 = -Utils.RotatedBy(Utils.RotatedByRandom(Vector2.UnitX, 0.785398185253143), Utils.ToRotation(velocity), new Vector2());
int index2 = Dust.NewDust(position, width, height, 6, 0.0f, 0.0f, 0, new Color(), 1.2f);
Main.dust[index2].velocity *= 0.3f;
Main.dust[index2].noGravity = true;
Main.dust[index2].position = Center + vector2 * width / 2f;
if (Main.rand.Next(2) == 0)
Main.dust[index2].fadeIn = 1.4f;
}
}
}
if (type == 468)
{
if (ai[1] == 0.0)
{
ai[1] = 1f;
Main.PlaySound(2, (int)position.X, (int)position.Y, 34);
}
else if (ai[1] == 1.0 && Main.netMode != 1)
{
int num1 = -1;
float num2 = 2000f;
for (int index = 0; index < 255; ++index)
{
if (Main.player[index].active && !Main.player[index].dead)
{
Vector2 center = Main.player[index].Center;
float num3 = Vector2.Distance(center, Center);
if ((num3 < num2 || num1 == -1) && Collision.CanHit(Center, 1, 1, center, 1, 1))
{
num2 = num3;
num1 = index;
}
}
}
if (num2 < 20.0)
{
Kill();
return;
}
if (num1 != -1)
{
ai[1] = 21f;
ai[0] = num1;
netUpdate = true;
}
}
else if (ai[1] > 20.0 && ai[1] < 200.0)
{
++ai[1];
int index = (int)ai[0];
if (!Main.player[index].active || Main.player[index].dead)
{
ai[1] = 1f;
ai[0] = 0.0f;
netUpdate = true;
}
else
{
float curAngle = Utils.ToRotation(velocity);
Vector2 v = Main.player[index].Center - Center;
if ((double)v.Length() < 20.0)
{
Kill();
return;
}
float targetAngle = Utils.ToRotation(v);
if (v == Vector2.Zero)
targetAngle = curAngle;
velocity = Utils.RotatedBy(new Vector2(velocity.Length(), 0.0f), Utils.AngleLerp(curAngle, targetAngle, 0.01f), new Vector2());
}
}
if (ai[1] >= 1.0 && ai[1] < 20.0)
{
++ai[1];
if (ai[1] == 20.0)
ai[1] = 1f;
}
alpha -= 40;
if (alpha < 0)
alpha = 0;
spriteDirection = direction;
++frameCounter;
if (frameCounter >= 3)
{
++frame;
frameCounter = 0;
if (frame >= 4)
frame = 0;
}
Lighting.AddLight(Center, 0.2f, 0.1f, 0.6f);
++localAI[0];
if (localAI[0] == 12.0)
{
localAI[0] = 0.0f;
for (int index1 = 0; index1 < 12; ++index1)
{
Vector2 vector2 = Utils.RotatedBy(Vector2.UnitX * -width / 2f + -Utils.RotatedBy(Vector2.UnitY, index1 * 3.14159274101257 / 6.0, new Vector2()) * new Vector2(8f, 16f), rotation - 1.57079637050629, new Vector2());
int index2 = Dust.NewDust(Center, 0, 0, 27, 0.0f, 0.0f, 160, new Color(), 1f);
Main.dust[index2].scale = 1.1f;
Main.dust[index2].noGravity = true;
Main.dust[index2].position = Center + vector2;
Main.dust[index2].velocity = velocity * 0.1f;
Main.dust[index2].velocity = Vector2.Normalize(Center - velocity * 3f - Main.dust[index2].position) * 1.25f;
}
}
if (Main.rand.Next(4) == 0)
{
for (int index1 = 0; index1 < 1; ++index1)
{
Vector2 vector2 = -Utils.RotatedBy(Utils.RotatedByRandom(Vector2.UnitX, 0.196349546313286), Utils.ToRotation(velocity), new Vector2());
int index2 = Dust.NewDust(position, width, height, 31, 0.0f, 0.0f, 100, new Color(), 1f);
Main.dust[index2].velocity *= 0.1f;
Main.dust[index2].position = Center + vector2 * width / 2f;
Main.dust[index2].fadeIn = 0.9f;
}
}
if (Main.rand.Next(32) == 0)
{
for (int index1 = 0; index1 < 1; ++index1)
{
Vector2 vector2 = -Utils.RotatedBy(Utils.RotatedByRandom(Vector2.UnitX, 0.392699092626572), Utils.ToRotation(velocity), new Vector2());
int index2 = Dust.NewDust(position, width, height, 31, 0.0f, 0.0f, 155, new Color(), 0.8f);
Main.dust[index2].velocity *= 0.3f;
Main.dust[index2].position = Center + vector2 * width / 2f;
if (Main.rand.Next(2) == 0)
Main.dust[index2].fadeIn = 1.4f;
}
}
if (Main.rand.Next(2) == 0)
{
for (int index1 = 0; index1 < 2; ++index1)
{
Vector2 vector2 = -Utils.RotatedBy(Utils.RotatedByRandom(Vector2.UnitX, 0.785398185253143), Utils.ToRotation(velocity), new Vector2());
int index2 = Dust.NewDust(position, width, height, 27, 0.0f, 0.0f, 0, new Color(), 1.2f);
Main.dust[index2].velocity *= 0.3f;
Main.dust[index2].noGravity = true;
Main.dust[index2].position = Center + vector2 * width / 2f;
if (Main.rand.Next(2) == 0)
Main.dust[index2].fadeIn = 1.4f;
}
}
}
if (type == 634 || type == 635)
{
float num1 = 5f;
float num2 = 250f;
float num3 = 6f;
Vector2 vector2_1 = new Vector2(8f, 10f);
float num4 = 1.2f;
Vector3 rgb = new Vector3(0.7f, 0.1f, 0.5f);
int num5 = 4 * MaxUpdates;
int Type1 = Utils.SelectRandom(Main.rand, 242, 73, 72, 71, 255);
int Type2 = 255;
if (type == 635)
{
vector2_1 = new Vector2(10f, 20f);
num4 = 1f;
num2 = 500f;
Type2 = 88;
num5 = 3 * MaxUpdates;
rgb = new Vector3(0.4f, 0.6f, 0.9f);
Type1 = Utils.SelectRandom(Main.rand, 242, 59, 88);
}
if (ai[1] == 0.0)
{
ai[1] = 1f;
localAI[0] = -Main.rand.Next(48);
Main.PlaySound(2, (int)position.X, (int)position.Y, 34);
}
else if (ai[1] == 1.0 && owner == Main.myPlayer)
{
int num6 = -1;
float num7 = num2;
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && Main.npc[index].CanBeChasedBy(this, false))
{
Vector2 center = Main.npc[index].Center;
float num8 = Vector2.Distance(center, Center);
if (num8 < num7 && num6 == -1 && Collision.CanHitLine(Center, 1, 1, center, 1, 1))
{
num7 = num8;
num6 = index;
}
}
}
if (num7 < 20.0)
{
Kill();
return;
}
if (num6 != -1)
{
ai[1] = num1 + 1f;
ai[0] = num6;
netUpdate = true;
}
}
else if (ai[1] > num1)
{
++ai[1];
int index = (int)ai[0];
if (!Main.npc[index].active || !Main.npc[index].CanBeChasedBy(this, false))
{
ai[1] = 1f;
ai[0] = 0.0f;
netUpdate = true;
}
else
{
double num6 = Utils.ToRotation(velocity);
Vector2 vector2_2 = Main.npc[index].Center - Center;
if (vector2_2.Length() < 20.0)
{
Kill();
return;
}
if (vector2_2 != Vector2.Zero)
{
vector2_2.Normalize();
vector2_2 *= num3;
}
float num7 = 30f;
velocity = (velocity * (num7 - 1f) + vector2_2) / num7;
}
}
if (ai[1] >= 1.0 && ai[1] < num1)
{
++ai[1];
if (ai[1] == num1)
ai[1] = 1f;
}
alpha -= 40;
if (alpha < 0)
alpha = 0;
spriteDirection = direction;
++frameCounter;
if (frameCounter >= num5)
{
++frame;
frameCounter = 0;
if (frame >= 4)
frame = 0;
}
Lighting.AddLight(Center, rgb);
rotation = Utils.ToRotation(velocity);
++localAI[0];
if (localAI[0] == 48.0)
localAI[0] = 0.0f;
else if (alpha == 0)
{
for (int index1 = 0; index1 < 2; ++index1)
{
Vector2 vector2_2 = Vector2.UnitX * -30f;
Vector2 vector2_3 = -Utils.RotatedBy(Vector2.UnitY, localAI[0] * 0.130899697542191 + index1 * 3.14159274101257, new Vector2()) * vector2_1 - Utils.ToRotationVector2(rotation) * 10f;
int index2 = Dust.NewDust(Center, 0, 0, Type2, 0.0f, 0.0f, 160, new Color(), 1f);
Main.dust[index2].scale = num4;
Main.dust[index2].noGravity = true;
Main.dust[index2].position = Center + vector2_3 + velocity * 2f;
Main.dust[index2].velocity = Vector2.Normalize(Center + velocity * 2f * 8f - Main.dust[index2].position) * 2f + velocity * 2f;
}
}
if (Main.rand.Next(12) == 0)
{
for (int index1 = 0; index1 < 1; ++index1)
{
Vector2 vector2_2 = -Utils.RotatedBy(Utils.RotatedByRandom(Vector2.UnitX, 0.196349546313286), Utils.ToRotation(velocity), new Vector2());
int index2 = Dust.NewDust(position, width, height, 31, 0.0f, 0.0f, 100, new Color(), 1f);
Main.dust[index2].velocity *= 0.1f;
Main.dust[index2].position = Center + vector2_2 * width / 2f + velocity * 2f;
Main.dust[index2].fadeIn = 0.9f;
}
}
if (Main.rand.Next(64) == 0)
{
for (int index1 = 0; index1 < 1; ++index1)
{
Vector2 vector2_2 = -Utils.RotatedBy(Utils.RotatedByRandom(Vector2.UnitX, 0.392699092626572), Utils.ToRotation(velocity), new Vector2());
int index2 = Dust.NewDust(position, width, height, 31, 0.0f, 0.0f, 155, new Color(), 0.8f);
Main.dust[index2].velocity *= 0.3f;
Main.dust[index2].position = Center + vector2_2 * width / 2f;
if (Main.rand.Next(2) == 0)
Main.dust[index2].fadeIn = 1.4f;
}
}
if (Main.rand.Next(4) == 0)
{
for (int index1 = 0; index1 < 2; ++index1)
{
Vector2 vector2_2 = -Utils.RotatedBy(Utils.RotatedByRandom(Vector2.UnitX, 0.785398185253143), Utils.ToRotation(velocity), new Vector2());
int index2 = Dust.NewDust(position, width, height, Type1, 0.0f, 0.0f, 0, new Color(), 1.2f);
Main.dust[index2].velocity *= 0.3f;
Main.dust[index2].noGravity = true;
Main.dust[index2].position = Center + vector2_2 * width / 2f;
if (Main.rand.Next(2) == 0)
Main.dust[index2].fadeIn = 1.4f;
}
}
if (Main.rand.Next(12) == 0 && type == 634)
{
Vector2 vector2_2 = -Utils.RotatedBy(Utils.RotatedByRandom(Vector2.UnitX, 0.196349546313286), Utils.ToRotation(velocity), new Vector2());
int index = Dust.NewDust(position, width, height, Type2, 0.0f, 0.0f, 100, new Color(), 1f);
Main.dust[index].velocity *= 0.3f;
Main.dust[index].position = Center + vector2_2 * width / 2f;
Main.dust[index].fadeIn = 0.9f;
Main.dust[index].noGravity = true;
}
if (Main.rand.Next(3) == 0 && type == 635)
{
Vector2 vector2_2 = -Utils.RotatedBy(Utils.RotatedByRandom(Vector2.UnitX, 0.196349546313286), Utils.ToRotation(velocity), new Vector2());
int index = Dust.NewDust(position, width, height, Type2, 0.0f, 0.0f, 100, new Color(), 1f);
Main.dust[index].velocity *= 0.3f;
Main.dust[index].position = Center + vector2_2 * width / 2f;
Main.dust[index].fadeIn = 1.2f;
Main.dust[index].scale = 1.5f;
Main.dust[index].noGravity = true;
}
}
if (type == 459)
{
alpha -= 30;
if (alpha < 0)
alpha = 0;
spriteDirection = direction;
++frameCounter;
if (frameCounter >= 3)
{
++frame;
frameCounter = 0;
if (frame >= 3)
frame = 0;
}
position = Center;
scale = ai[1];
width = height = (int)(22.0 * scale);
Center = position;
Lighting.AddLight((int)Center.X / 16, (int)Center.Y / 16, 0.4f, 0.85f, 0.9f);
int num;
if (scale < 0.85)
{
num = Main.rand.Next(3) == 0 ? 1 : 0;
}
else
{
num = 1;
penetrate = -1;
maxPenetrate = -1;
}
for (int index1 = 0; index1 < num; ++index1)
{
int index2 = Dust.NewDust(position, width, height, 226, velocity.X, 0.0f, 0, new Color(), 1f);
Main.dust[index2].position -= Vector2.One * 3f;
Main.dust[index2].scale = 0.5f;
Main.dust[index2].noGravity = true;
Main.dust[index2].velocity = velocity / 3f;
Main.dust[index2].alpha = 255 - (int)(255 * scale);
}
}
if (type == 442)
{
frame = 0;
if (alpha != 0)
{
++localAI[0];
if (localAI[0] >= 4.0)
{
alpha -= 90;
if (alpha < 0)
{
alpha = 0;
localAI[0] = 2f;
}
}
}
if (Vector2.Distance(Center, new Vector2(ai[0], ai[1]) * 16f + Vector2.One * 8f) <= 16.0)
{
Kill();
return;
}
if (alpha == 0)
{
++localAI[1];
if (localAI[1] >= 120.0)
{
Kill();
return;
}
Lighting.AddLight((int)Center.X / 16, (int)Center.Y / 16, 0.3f, 0.45f, 0.8f);
++localAI[0];
if (localAI[0] == 3.0)
{
localAI[0] = 0.0f;
for (int index1 = 0; index1 < 8; ++index1)
{
Vector2 vector2 = Utils.RotatedBy(Vector2.UnitX * -8f + -Utils.RotatedBy(Vector2.UnitY, (double)index1 * 3.14159274101257 / 4.0, new Vector2()) * new Vector2(2f, 4f), rotation - 1.57079637050629, new Vector2());
int index2 = Dust.NewDust(Center, 0, 0, 135, 0.0f, 0.0f, 0, new Color(), 1f);
Main.dust[index2].scale = 1.5f;
Main.dust[index2].noGravity = true;
Main.dust[index2].position = Center + vector2;
Main.dust[index2].velocity = velocity * 0.66f;
}
}
}
}
if (type == 440 || type == 449 || type == 606)
{
if (alpha > 0)
alpha -= 25;
if (alpha < 0)
alpha = 0;
if (type == 440)
Lighting.AddLight((int)Center.X / 16, (int)Center.Y / 16, 0.25f, 0.4f, 0.7f);
if (type == 449)
Lighting.AddLight((int)Center.X / 16, (int)Center.Y / 16, 0.7f, 0.65f, 0.3f);
if (type == 606)
Lighting.AddLight(Center, 0.7f, 0.3f, 0.3f);
float num1 = 100f;
float num2 = 3f;
if (type == 606)
{
num1 = 150f;
num2 = 5f;
}
if (ai[1] == 0.0)
{
localAI[0] += num2;
if (localAI[0] == num2 * 1.0 && type == 606)
{
for (int index1 = 0; index1 < 4; ++index1)
{
int index2 = Dust.NewDust(Center - velocity / 2f, 0, 0, 182, 0.0f, 0.0f, 100, new Color(), 1.4f);
Main.dust[index2].velocity *= 0.2f;
Main.dust[index2].velocity += velocity / 10f;
Main.dust[index2].noGravity = true;
}
}
if (localAI[0] > num1)
localAI[0] = num1;
}
else
{
localAI[0] -= num2;
if (localAI[0] <= 0.0)
{
Kill();
return;
}
}
}
if (type == 438)
Lighting.AddLight((int)Center.X / 16, (int)Center.Y / 16, 0.4f, 0.1f, 0.2f);
if (type == 593)
{
Lighting.AddLight((int)Center.X / 16, (int)Center.Y / 16, 0.4f, 0.1f, 0.3f);
if (++frameCounter >= 12)
{
if (++frame >= Main.projFrames[type])
frame = 0;
frameCounter = 0;
}
if (Main.rand.Next(2) == 0)
{
Vector2 spinningpoint = Utils.RotatedByRandom(Vector2.UnitY, 6.28318548202515);
Dust dust = Main.dust[Dust.NewDust(Center - spinningpoint * 8f, 0, 0, 240, 0.0f, 0.0f, 0, new Color(), 1f)];
dust.noGravity = true;
dust.position = Center - spinningpoint * 8f * scale;
dust.velocity = Utils.RotatedBy(spinningpoint, -1.57079637050629, new Vector2()) * 2f;
dust.velocity = Vector2.Zero;
dust.scale = 0.5f + Utils.NextFloat(Main.rand);
dust.fadeIn = 0.5f;
}
}
if (type == 592)
Lighting.AddLight((int)Center.X / 16, (int)Center.Y / 16, 0.15f, 0.15f, 0.4f);
if (type == 462)
{
int index = Dust.NewDust(Center, 0, 0, 229, 0.0f, 0.0f, 100, new Color(), 1f);
Main.dust[index].noLight = true;
Main.dust[index].noGravity = true;
Main.dust[index].velocity = velocity;
Main.dust[index].position -= Vector2.One * 4f;
Main.dust[index].scale = 0.8f;
if (++frameCounter >= 9)
{
frameCounter = 0;
if (++frame >= 5)
frame = 0;
}
}
if (type == 437)
{
if (ai[1] == 0.0)
{
ai[1] = 1f;
Main.PlaySound(2, (int)position.X, (int)position.Y, 12);
}
if (localAI[0] == 0.0)
{
localAI[0] = 1f;
for (int index1 = 0; index1 < 4; ++index1)
{
int index2 = Dust.NewDust(position, width, height, 226, velocity.X, 0.0f, 0, new Color(), 1f);
Main.dust[index2].position = Vector2.Lerp(Main.dust[index2].position, Center, 0.25f);
Main.dust[index2].scale = 0.5f;
Main.dust[index2].noGravity = true;
Main.dust[index2].velocity /= 2f;
Main.dust[index2].velocity += velocity * 0.66f;
}
}
if (ai[0] < 16.0)
{
for (int index1 = 0; index1 < 2; ++index1)
{
int index2 = Dust.NewDust(position, width, height, 226, velocity.X, 0.0f, 0, new Color(), 1f);
Main.dust[index2].position = position + new Vector2(((direction == 1 ? 1 : 0) * width), (2 + (height - 4) * index1));
Main.dust[index2].scale = 0.3f;
Main.dust[index2].noGravity = true;
Main.dust[index2].velocity = Vector2.Zero;
}
}
}
if (type == 435)
{
if (ai[1] == 0.0)
{
ai[1] = 1f;
Main.PlaySound(2, (int)position.X, (int)position.Y, 12);
}
alpha -= 40;
if (alpha < 0)
alpha = 0;
spriteDirection = direction;
++frameCounter;
if (frameCounter >= 3)
{
++frame;
frameCounter = 0;
if (frame >= 4)
frame = 0;
}
Lighting.AddLight((int)Center.X / 16, (int)Center.Y / 16, 0.3f, 0.8f, 1.1f);
}
if (type == 408)
{
alpha -= 40;
if (alpha < 0)
alpha = 0;
spriteDirection = direction;
}
if (type == 282)
{
int index = Dust.NewDust(position, width, height, 171, 0.0f, 0.0f, 100, new Color(), 1f);
Main.dust[index].scale = Main.rand.Next(1, 10) * 0.1f;
Main.dust[index].noGravity = true;
Main.dust[index].fadeIn = 1.5f;
Main.dust[index].velocity *= 0.25f;
Main.dust[index].velocity += velocity * 0.25f;
}
if (type == 275 || type == 276)
{
++frameCounter;
if (frameCounter > 1)
{
frameCounter = 0;
++frame;
if (frame > 1)
frame = 0;
}
}
if (type == 225)
{
int index = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 40, 0.0f, 0.0f, 0, new Color(), 1f);
Main.dust[index].noGravity = true;
Main.dust[index].scale = 1.3f;
Main.dust[index].velocity *= 0.5f;
}
if (type == 174)
{
if (alpha == 0)
{
int index = Dust.NewDust(oldPosition - velocity * 3f, width, height, 76, 0.0f, 0.0f, 50, new Color(), 1f);
Main.dust[index].noGravity = true;
Main.dust[index].noLight = true;
Main.dust[index].velocity *= 0.5f;
}
alpha -= 50;
if (alpha < 0)
alpha = 0;
if (ai[1] == 0.0)
{
ai[1] = 1f;
Main.PlaySound(2, (int)position.X, (int)position.Y, 17);
}
}
else if (type == 605)
{
if (alpha == 0 && Main.rand.Next(3) == 0)
{
int index = Dust.NewDust(position - velocity * 3f, width, height, 4, 0.0f, 0.0f, 50, new Color(78, 136, 255, 150), 1.2f);
Main.dust[index].velocity *= 0.3f;
Main.dust[index].velocity += velocity * 0.3f;
Main.dust[index].noGravity = true;
}
alpha -= 50;
if (alpha < 0)
alpha = 0;
if (ai[1] == 0.0)
{
ai[1] = 1f;
Main.PlaySound(2, (int)position.X, (int)position.Y, 17);
}
}
else if (type == 176)
{
if (alpha == 0)
{
int index = Dust.NewDust(oldPosition, width, height, 22, 0.0f, 0.0f, 100, new Color(), 0.5f);
Main.dust[index].noGravity = true;
Main.dust[index].noLight = true;
Main.dust[index].velocity *= 0.15f;
Main.dust[index].fadeIn = 0.8f;
}
alpha -= 50;
if (alpha < 0)
alpha = 0;
if (ai[1] == 0.0)
{
ai[1] = 1f;
Main.PlaySound(2, (int)position.X, (int)position.Y, 17);
}
}
if (type == 350)
{
alpha -= 100;
if (alpha < 0)
alpha = 0;
Lighting.AddLight((int)Center.X / 16, (int)Center.Y / 16, 0.9f, 0.6f, 0.2f);
if (alpha == 0)
{
int num = 2;
if (Main.rand.Next(2) == 0)
{
int index = Dust.NewDust(new Vector2(Center.X - num, (float)(Center.Y - num - 2.0)) - velocity * 0.5f, num * 2, num * 2, 6, 0.0f, 0.0f, 100, new Color(), 1f);
Main.dust[index].scale *= (float)(1.79999995231628 + Main.rand.Next(10) * 0.100000001490116);
Main.dust[index].velocity *= 0.2f;
Main.dust[index].noGravity = true;
}
if (Main.rand.Next(4) == 0)
{
int index = Dust.NewDust(new Vector2(Center.X - num, (float)(Center.Y - num - 2.0)) - velocity * 0.5f, num * 2, num * 2, 31, 0.0f, 0.0f, 100, new Color(), 0.5f);
Main.dust[index].fadeIn = (float)(1.0 + Main.rand.Next(5) * 0.100000001490116);
Main.dust[index].velocity *= 0.05f;
}
}
if (ai[1] == 0.0)
{
ai[1] = 1f;
Main.PlaySound(2, (int)position.X, (int)position.Y, 42);
}
}
if (type == 325)
{
alpha -= 100;
if (alpha < 0)
alpha = 0;
Lighting.AddLight((int)Center.X / 16, (int)Center.Y / 16, 0.9f, 0.6f, 0.2f);
if (alpha == 0)
{
int num = 2;
if (Main.rand.Next(2) == 0)
{
int index = Dust.NewDust(new Vector2(Center.X - num, (float)(Center.Y - num - 2.0)) - velocity * 0.5f, num * 2, num * 2, 6, 0.0f, 0.0f, 100, new Color(), 1f);
Main.dust[index].scale *= (float)(1.79999995231628 + Main.rand.Next(10) * 0.100000001490116);
Main.dust[index].velocity *= 0.2f;
Main.dust[index].noGravity = true;
}
if (Main.rand.Next(4) == 0)
{
int index = Dust.NewDust(new Vector2(Center.X - num, (float)(Center.Y - num - 2.0)) - velocity * 0.5f, num * 2, num * 2, 31, 0.0f, 0.0f, 100, new Color(), 0.5f);
Main.dust[index].fadeIn = (float)(1.0 + Main.rand.Next(5) * 0.100000001490116);
Main.dust[index].velocity *= 0.05f;
}
}
if (ai[1] == 0.0)
{
ai[1] = 1f;
Main.PlaySound(2, (int)position.X, (int)position.Y, 42);
}
}
if (type == 469)
{
++localAI[1];
if (localAI[1] > 2.0)
{
alpha -= 50;
if (alpha < 0)
alpha = 0;
}
}
else if (type == 83 && ai[1] == 0.0)
{
ai[1] = 1f;
Main.PlaySound(2, (int)position.X, (int)position.Y, 33);
}
else if (type == 408 && ai[1] == 0.0)
{
ai[1] = 1f;
Main.PlaySound(4, (int)position.X, (int)position.Y, 19);
}
else if (type == 259 && ai[1] == 0.0)
{
ai[1] = 1f;
Main.PlaySound(2, (int)position.X, (int)position.Y, 33);
}
else if (type == 110 && ai[1] == 0.0)
{
ai[1] = 1f;
Main.PlaySound(2, (int)position.X, (int)position.Y, 11);
}
else if (type == 302 && ai[1] == 0.0)
{
ai[1] = 1f;
Main.PlaySound(2, (int)position.X, (int)position.Y, 11);
}
else if (type == 438 && ai[1] == 0.0)
{
ai[1] = 1f;
Main.PlaySound(2, (int)position.X, (int)position.Y, 12);
}
else if (type == 593 && ai[1] == 0.0)
{
ai[1] = 1f;
Main.PlaySound(2, (int)position.X, (int)position.Y, 11);
}
else if (type == 592 && ai[1] == 0.0)
{
ai[1] = 1f;
Main.PlaySound(2, (int)position.X, (int)position.Y, 12);
}
else if (type == 462 && ai[1] == 0.0)
{
ai[1] = 1f;
Main.PlaySound(2, (int)position.X, (int)position.Y, Main.rand.Next(124, 126));
Vector2 vector2 = Vector2.Normalize(velocity);
int num = Main.rand.Next(5, 10);
for (int index1 = 0; index1 < num; ++index1)
{
int index2 = Dust.NewDust(Center, 0, 0, 229, 0.0f, 0.0f, 100, new Color(), 1f);
--Main.dust[index2].velocity.Y;
Main.dust[index2].velocity += vector2 * 2f;
Main.dust[index2].position -= Vector2.One * 4f;
Main.dust[index2].noGravity = true;
}
}
else if (type == 84 && ai[1] == 0.0)
{
ai[1] = 1f;
Main.PlaySound(2, (int)position.X, (int)position.Y, 12);
}
else if (type == 389 && ai[1] == 0.0)
{
ai[1] = 1f;
Main.PlaySound(2, (int)position.X, (int)position.Y, 12);
}
else if (type == 257 && ai[1] == 0.0)
{
ai[1] = 1f;
Main.PlaySound(2, (int)position.X, (int)position.Y, 12);
}
else if (type == 100 && ai[1] == 0.0)
{
ai[1] = 1f;
Main.PlaySound(2, (int)position.X, (int)position.Y, 33);
}
else if (type == 98 && ai[1] == 0.0)
{
ai[1] = 1f;
Main.PlaySound(2, (int)position.X, (int)position.Y, 17);
}
else if (type == 184 && ai[1] == 0.0)
{
ai[1] = 1f;
Main.PlaySound(2, (int)position.X, (int)position.Y, 17);
}
else if (type == 195 && ai[1] == 0.0)
{
ai[1] = 1f;
Main.PlaySound(2, (int)position.X, (int)position.Y, 17);
}
else if (type == 275 && ai[1] == 0.0)
{
ai[1] = 1f;
Main.PlaySound(2, (int)position.X, (int)position.Y, 17);
}
else if (type == 276 && ai[1] == 0.0)
{
ai[1] = 1f;
Main.PlaySound(2, (int)position.X, (int)position.Y, 17);
}
else if ((type == 81 || type == 82) && ai[1] == 0.0)
{
Main.PlaySound(2, (int)position.X, (int)position.Y, 5);
ai[1] = 1f;
}
else if (type == 180 && ai[1] == 0.0)
{
Main.PlaySound(2, (int)position.X, (int)position.Y, 11);
ai[1] = 1f;
}
else if (type == 248 && ai[1] == 0.0)
{
Main.PlaySound(2, (int)position.X, (int)position.Y, 17);
ai[1] = 1f;
}
else if (type == 576 && ai[1] == 0.0)
{
ai[1] = 1f;
Main.PlaySound(2, (int)position.X, (int)position.Y, 12);
}
else if (type == 577 && ai[1] == 0.0)
{
ai[1] = 1f;
Main.PlaySound(2, (int)position.X, (int)position.Y, 36);
}
else if (type == 639)
{
if (localAI[0] == 0.0 && localAI[1] == 0.0)
{
localAI[0] = Center.X;
localAI[1] = Center.Y;
ai[0] = velocity.X;
ai[1] = velocity.Y;
}
alpha -= 25;
if (alpha < 0)
alpha = 0;
}
else if (type == 640)
{
alpha -= 25;
if (alpha < 0)
alpha = 0;
if (velocity == Vector2.Zero)
{
ai[0] = 0.0f;
bool flag = true;
for (int index = 1; index < oldPos.Length; ++index)
{
if (oldPos[index] != oldPos[0])
flag = false;
}
if (flag)
{
Kill();
return;
}
if (Main.rand.Next(extraUpdates) == 0 && (velocity != Vector2.Zero || Main.rand.Next(localAI[1] == 2.0 ? 2 : 6) == 0))
{
for (int index1 = 0; index1 < 2; ++index1)
{
float num1 = rotation + (float)((Main.rand.Next(2) == 1 ? -1.0 : 1.0) * 1.57079637050629);
float num2 = (float)(Main.rand.NextDouble() * 0.800000011920929 + 1.0);
Vector2 vector2 = new Vector2((float)Math.Cos(num1) * num2, (float)Math.Sin(num1) * num2);
int index2 = Dust.NewDust(Center, 0, 0, 229, vector2.X, vector2.Y, 0, new Color(), 1f);
Main.dust[index2].noGravity = true;
Main.dust[index2].scale = 1.2f;
}
if (Main.rand.Next(10) == 0)
{
int index = Dust.NewDust(Center + Utils.RotatedBy(velocity, 1.57079637050629, new Vector2()) * ((float)Main.rand.NextDouble() - 0.5f) * width - Vector2.One * 4f, 8, 8, 31, 0.0f, 0.0f, 100, new Color(), 1.5f);
Main.dust[index].velocity *= 0.5f;
Main.dust[index].velocity.Y = -Math.Abs(Main.dust[index].velocity.Y);
}
}
}
else if (numUpdates == 1)
{
float num1 = (float)(rotation + 1.57079637050629 + (Main.rand.Next(2) == 1 ? -1.0 : 1.0) * 1.57079637050629);
float num2 = (float)(Main.rand.NextDouble() * 0.25 + 0.25);
Vector2 vector2 = new Vector2((float)Math.Cos(num1) * num2, (float)Math.Sin(num1) * num2);
int index = Dust.NewDust(position, 0, 0, 229, vector2.X, vector2.Y, 0, new Color(), 1f);
Main.dust[index].noGravity = true;
Main.dust[index].scale = 1.2f;
}
}
if (type == 41)
{
int index1 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0.0f, 0.0f, 100, new Color(), 1.6f);
Main.dust[index1].noGravity = true;
int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 100, new Color(), 2f);
Main.dust[index2].noGravity = true;
}
else if (type == 55)
{
int index = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 18, 0.0f, 0.0f, 0, new Color(), 0.9f);
Main.dust[index].noGravity = true;
}
else if (type == 374)
{
if (localAI[0] == 0.0)
{
Main.PlaySound(2, (int)position.X, (int)position.Y, 17);
localAI[0] = 1f;
}
if (Main.rand.Next(2) == 0)
{
int index = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 18, 0.0f, 0.0f, 0, new Color(), 0.9f);
Main.dust[index].noGravity = true;
Main.dust[index].velocity *= 0.5f;
}
}
else if (type == 376)
{
if (localAI[0] == 0.0)
Main.PlaySound(2, (int)position.X, (int)position.Y, 20);
++localAI[0];
if (localAI[0] > 3.0)
{
int num = 1;
if (localAI[0] > 5.0)
num = 2;
for (int index1 = 0; index1 < num; ++index1)
{
int index2 = Dust.NewDust(new Vector2(position.X, position.Y + 2f), width, height, 6, velocity.X * 0.2f, velocity.Y * 0.2f, 100, new Color(), 2f);
Main.dust[index2].noGravity = true;
Main.dust[index2].velocity.X *= 0.3f;
Main.dust[index2].velocity.Y *= 0.3f;
Main.dust[index2].noLight = true;
}
if (wet && !lavaWet)
{
Kill();
return;
}
}
}
else if (type == 91 && Main.rand.Next(2) == 0)
{
int index = Dust.NewDust(position, width, height, Main.rand.Next(2) != 0 ? 58 : 15, velocity.X * 0.25f, velocity.Y * 0.25f, 150, new Color(), 0.9f);
Main.dust[index].velocity *= 0.25f;
}
if (type == 163 || type == 310)
{
if (alpha > 0)
alpha -= 25;
if (alpha < 0)
alpha = 0;
}
switch (type)
{
case 389:
case 180:
case 279:
case 283:
case 284:
case 285:
case 286:
case 287:
case 104:
case 110:
case 158:
case 159:
case 160:
case 161:
case 83:
case 84:
case 89:
case 100:
case 14:
case 20:
case 36:
if (alpha > 0)
alpha -= 15;
if (alpha < 0)
{
alpha = 0;
break;
}
break;
case 576:
case 577:
++localAI[1];
if (localAI[1] > 2.0)
{
if (alpha > 0)
alpha -= 15;
if (alpha < 0)
{
alpha = 0;
break;
}
break;
}
break;
}
if (type == 484)
{
int index = Dust.NewDust(position, width, height, 78, 0.0f, 0.0f, 0, new Color(), 1f);
Main.dust[index].noGravity = true;
Main.dust[index].velocity *= 0.1f;
Main.dust[index].scale = 0.75f;
Main.dust[index].position = (Main.dust[index].position + Center) / 2f;
Main.dust[index].position += velocity * Main.rand.Next(0, 101) * 0.01f;
}
if (type == 242 || type == 302 || (type == 438 || type == 462) || type == 592)
{
float num = (float)Math.Sqrt(velocity.X * velocity.X + velocity.Y * velocity.Y);
if (alpha > 0)
alpha -= (byte)(num * 0.9);
if (alpha < 0)
alpha = 0;
}
if (type == 638)
{
float num1 = velocity.Length();
if (alpha > 0)
alpha -= (byte)(num1 * 0.3);
if (alpha < 0)
alpha = 0;
Rectangle hitbox = Hitbox;
hitbox.Offset((int)velocity.X, (int)velocity.Y);
bool flag = false;
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].active && !Main.npc[index].dontTakeDamage && (Main.npc[index].immune[owner] == 0 && npcImmune[index] == 0) && Main.npc[index].Hitbox.Intersects(hitbox))
{
flag = true;
break;
}
}
if (flag)
{
int num2 = Main.rand.Next(15, 31);
for (int index1 = 0; index1 < num2; ++index1)
{
int index2 = Dust.NewDust(Center, 0, 0, 229, 0.0f, 0.0f, 100, new Color(), 0.8f);
Main.dust[index2].velocity *= 1.6f;
--Main.dust[index2].velocity.Y;
Main.dust[index2].velocity += velocity;
Main.dust[index2].noGravity = true;
}
}
}
if (type == 257 || type == 593)
{
if (alpha > 0)
alpha -= 10;
if (alpha < 0)
alpha = 0;
}
if (type == 88)
{
if (alpha > 0)
alpha -= 10;
if (alpha < 0)
alpha = 0;
}
if (type == 532)
++ai[0];
bool flag1 = true;
switch (type)
{
case 606:
case 616:
case 634:
case 635:
case 638:
case 639:
case 592:
case 593:
case 601:
case 498:
case 576:
case 577:
case 585:
case 467:
case 468:
case 469:
case 472:
case 483:
case 484:
case 485:
case 449:
case 459:
case 462:
case 389:
case 435:
case 436:
case 438:
case 440:
case 442:
case 348:
case 349:
case 350:
case 355:
case 374:
case 376:
case 302:
case 323:
case 325:
case 270:
case 279:
case 283:
case 284:
case 285:
case 286:
case 287:
case 299:
case 257:
case 259:
case 265:
case 184:
case 242:
case 248:
case 158:
case 159:
case 160:
case 161:
case 180:
case 98:
case 100:
case 104:
case 110:
case 55:
case 83:
case 84:
case 88:
case 89:
case 20:
case 36:
case 38:
case 5:
case 14:
flag1 = false;
break;
}
if (flag1)
++ai[0];
if (type == 270)
{
int index1 = (int)Player.FindClosest(Center, 1, 1);
++ai[1];
if (ai[1] < 110.0 && ai[1] > 30.0)
{
float num = velocity.Length();
Vector2 vector2_1 = Main.player[index1].Center - Center;
vector2_1.Normalize();
velocity = (velocity * 24f + vector2_1 * num) / 25f;
velocity.Normalize();
Projectile projectile = this;
Vector2 vector2_2 = projectile.velocity * num;
projectile.velocity = vector2_2;
}
if (ai[0] < 0.0)
{
if (velocity.Length() < 18.0)
{
Projectile projectile = this;
Vector2 vector2 = projectile.velocity * 1.02f;
projectile.velocity = vector2;
}
if (localAI[0] == 0.0)
{
localAI[0] = 1f;
Main.PlaySound(2, (int)position.X, (int)position.Y, 8);
for (int index2 = 0; index2 < 10; ++index2)
{
int index3 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 5, velocity.X, velocity.Y, 0, new Color(), 2f);
Main.dust[index3].noGravity = true;
Main.dust[index3].velocity = Center - Main.dust[index3].position;
Main.dust[index3].velocity.Normalize();
Main.dust[index3].velocity *= -5f;
Main.dust[index3].velocity += velocity / 2f;
}
}
friendly = false;
hostile = true;
}
}
if (type == 585)
{
if (localAI[0] == 0.0)
{
localAI[0] = 1f;
Main.PlaySound(2, (int)position.X, (int)position.Y, 8);
for (int index1 = 0; index1 < 3; ++index1)
{
int index2 = Dust.NewDust(position, width, height, 27, velocity.X, velocity.Y, 0, new Color(), 2f);
Main.dust[index2].noGravity = true;
Main.dust[index2].velocity = Center - Main.dust[index2].position;
Main.dust[index2].velocity.Normalize();
Main.dust[index2].velocity *= -5f;
Main.dust[index2].velocity += velocity / 2f;
Main.dust[index2].noLight = true;
}
}
if (alpha > 0)
alpha -= 50;
if (alpha < 0)
alpha = 0;
++frameCounter;
if (frameCounter >= 12)
frameCounter = 0;
frame = frameCounter / 2;
if (frame > 3)
frame = 6 - frame;
Vector3 vector3 = NPCID.Sets.MagicAuraColor[54].ToVector3();
Lighting.AddLight(Center, vector3.X, vector3.Y, vector3.Z);
if (Main.rand.Next(3) == 0)
{
int index = Dust.NewDust(new Vector2(position.X + 4f, position.Y + 4f), width - 8, height - 8, 27, velocity.X * 0.2f, velocity.Y * 0.2f, 100, new Color(), 2f);
Main.dust[index].position -= velocity * 2f;
Main.dust[index].noLight = true;
Main.dust[index].noGravity = true;
Main.dust[index].velocity.X *= 0.3f;
Main.dust[index].velocity.Y *= 0.3f;
}
}
if (type == 594)
{
int num = (int)(43.0 - ai[1]) / 13;
if (num < 1)
num = 1;
int Type = ai[1] < 20.0 ? 6 : 31;
for (int index1 = 0; index1 < num; ++index1)
{
int index2 = Dust.NewDust(new Vector2(position.X + 4f, position.Y + 4f), width - 8, height - 8, Type, velocity.X * 0.2f, velocity.Y * 0.2f, 0, new Color(), 2f);
Main.dust[index2].position -= velocity * 2f;
Main.dust[index2].noLight = true;
Main.dust[index2].noGravity = true;
Main.dust[index2].velocity.X *= 0.3f;
Main.dust[index2].velocity.Y *= 0.3f;
if (Type == 6)
Main.dust[index2].fadeIn = Utils.NextFloat(Main.rand) * 2f;
}
++ai[1];
if (ai[1] > (double)(43 * MaxUpdates))
{
Kill();
return;
}
}
if (type == 622)
{
int Type = 229;
if (Main.rand.Next(3) != 0)
{
int index = Dust.NewDust(new Vector2(position.X + 4f, position.Y + 4f), width - 8, height - 8, Type, velocity.X * 0.2f, velocity.Y * 0.2f, 0, new Color(), 1.2f);
Main.dust[index].position -= velocity * 2f;
Main.dust[index].noLight = true;
Main.dust[index].noGravity = true;
Main.dust[index].velocity.X *= 0.3f;
Main.dust[index].velocity.Y *= 0.3f;
}
++ai[1];
if (ai[1] > (double)(23 * MaxUpdates))
{
Kill();
return;
}
}
if (type == 587)
{
Color newColor = Main.hslToRgb(ai[1], 1f, 0.5f);
newColor.A = 200;
++localAI[0];
if (localAI[0] >= 2.0)
{
if (localAI[0] == 2.0)
{
Main.PlaySound(2, (int)position.X, (int)position.Y, 5);
for (int index1 = 0; index1 < 4; ++index1)
{
int index2 = Dust.NewDust(position, width, height, 76, velocity.X, velocity.Y, 0, newColor, 1.1f);
Main.dust[index2].noGravity = true;
Main.dust[index2].velocity = Center - Main.dust[index2].position;
Main.dust[index2].velocity.Normalize();
Main.dust[index2].velocity *= -3f;
Main.dust[index2].velocity += velocity / 2f;
}
}
else
{
++frame;
if (frame > 2)
frame = 0;
for (int index1 = 0; index1 < 1; ++index1)
{
int index2 = Dust.NewDust(new Vector2(position.X + 4f, position.Y + 4f), width - 8, height - 8, 76, velocity.X * 0.2f, velocity.Y * 0.2f, 0, newColor, 0.9f);
Main.dust[index2].position = Center;
Main.dust[index2].noGravity = true;
Main.dust[index2].velocity = velocity * 0.5f;
}
}
}
}
if (type == 349)
{
frame = (int)ai[0];
velocity.Y += 0.2f;
if (localAI[0] == 0.0 || localAI[0] == 2.0)
{
scale += 0.01f;
alpha -= 50;
if (alpha <= 0)
{
localAI[0] = 1f;
alpha = 0;
}
}
else if (localAI[0] == 1.0)
{
scale -= 0.01f;
alpha += 50;
if (alpha >= 255)
{
localAI[0] = 2f;
alpha = 255;
}
}
}
if (type == 348)
{
if (localAI[1] == 0.0)
{
localAI[1] = 1f;
Main.PlaySound(2, (int)position.X, (int)position.Y, 8);
}
if (ai[0] == 0.0 || ai[0] == 2.0)
{
scale += 0.01f;
alpha -= 50;
if (alpha <= 0)
{
ai[0] = 1f;
alpha = 0;
}
}
else if (ai[0] == 1.0)
{
scale -= 0.01f;
alpha += 50;
if (alpha >= 255)
{
ai[0] = 2f;
alpha = 255;
}
}
}
if (type == 572)
{
if (localAI[0] == 0.0)
{
localAI[0] = 1f;
Main.PlaySound(2, (int)position.X, (int)position.Y, 17);
}
for (int index1 = 0; index1 < 2; ++index1)
{
int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 40, velocity.X, velocity.Y, 100, new Color(), 1f);
Main.dust[index2].velocity *= 0.5f;
Main.dust[index2].velocity += velocity;
Main.dust[index2].velocity *= 0.5f;
Main.dust[index2].noGravity = true;
Main.dust[index2].scale = 1.2f;
Main.dust[index2].position = (Center + position) / 2f;
}
}
if (type == 577)
Lighting.AddLight(Center, 0.1f, 0.3f, 0.4f);
else if (type == 576)
{
Lighting.AddLight(Center, 0.4f, 0.2f, 0.4f);
for (int index = 0; index < 5; ++index)
{
Dust dust = Main.dust[Dust.NewDust(position, width, height, 242, velocity.X, velocity.Y, 100, new Color(), 1f)];
dust.velocity = Vector2.Zero;
dust.position -= velocity / 5f * index;
dust.noGravity = true;
dust.scale = 0.8f;
dust.noLight = true;
}
}
else if (type == 581)
{
if (localAI[0] == 0.0)
{
localAI[0] = 1f;
Main.PlaySound(2, (int)Center.X, (int)Center.Y, 17);
}
for (int index = 0; index < 2; ++index)
{
int Type = Utils.SelectRandom<int>(Main.rand, 229, 161, 161);
Dust dust = Main.dust[Dust.NewDust(position, width, height, Type, velocity.X, velocity.Y, 100, new Color(), 1f)];
dust.velocity = dust.velocity / 4f + velocity / 2f;
dust.noGravity = true;
dust.scale = 1.2f;
dust.position = Center;
dust.noLight = true;
}
}
if (type == 299)
{
if (localAI[0] == 6.0)
{
Main.PlaySound(2, (int)position.X, (int)position.Y, 8);
for (int index1 = 0; index1 < 40; ++index1)
{
int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 181, 0.0f, 0.0f, 100, new Color(), 1f);
Main.dust[index2].velocity *= 3f;
Main.dust[index2].velocity += velocity * 0.75f;
Main.dust[index2].scale *= 1.2f;
Main.dust[index2].noGravity = true;
}
}
++localAI[0];
if (localAI[0] > 6.0)
{
for (int index1 = 0; index1 < 3; ++index1)
{
int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 181, velocity.X * 0.2f, velocity.Y * 0.2f, 100, new Color(), 1f);
Main.dust[index2].velocity *= 0.6f;
Main.dust[index2].scale *= 1.4f;
Main.dust[index2].noGravity = true;
}
}
}
else if (type == 270)
{
if (ai[0] < 0.0)
alpha = 0;
if (alpha > 0)
alpha -= 50;
if (alpha < 0)
alpha = 0;
++frame;
if (frame > 2)
frame = 0;
if (ai[0] < 0.0)
{
for (int index1 = 0; index1 < 2; ++index1)
{
int index2 = Dust.NewDust(new Vector2(position.X + 4f, position.Y + 4f), width - 8, height - 8, 5, velocity.X * 0.2f, velocity.Y * 0.2f, 100, new Color(), 1.5f);
Main.dust[index2].position -= velocity;
Main.dust[index2].noGravity = true;
Main.dust[index2].velocity.X *= 0.3f;
Main.dust[index2].velocity.Y *= 0.3f;
}
}
else
{
for (int index1 = 0; index1 < 2; ++index1)
{
int index2 = Dust.NewDust(new Vector2(position.X + 4f, position.Y + 4f), width - 8, height - 8, 6, velocity.X * 0.2f, velocity.Y * 0.2f, 100, new Color(), 2f);
Main.dust[index2].position -= velocity * 2f;
Main.dust[index2].noGravity = true;
Main.dust[index2].velocity.X *= 0.3f;
Main.dust[index2].velocity.Y *= 0.3f;
}
}
}
if (type == 259)
{
if (alpha > 0)
alpha -= 10;
if (alpha < 0)
alpha = 0;
}
if (type == 265)
{
if (alpha > 0)
alpha -= 50;
if (alpha < 0)
alpha = 0;
if (alpha == 0)
{
int index = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 163, velocity.X, velocity.Y, 100, new Color(), 1.2f);
Main.dust[index].noGravity = true;
Main.dust[index].velocity *= 0.3f;
Main.dust[index].velocity -= velocity * 0.4f;
}
}
if (type == 355)
{
if (alpha > 0)
alpha -= 50;
if (alpha < 0)
alpha = 0;
if (alpha == 0)
{
int index = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 205, velocity.X, velocity.Y, 100, new Color(), 1.2f);
Main.dust[index].noGravity = true;
Main.dust[index].velocity *= 0.3f;
Main.dust[index].velocity -= velocity * 0.4f;
}
}
if (type == 357)
{
if (alpha < 170)
{
for (int index1 = 0; index1 < 10; ++index1)
{
float x = position.X - velocity.X / 10f * index1;
float y = position.Y - velocity.Y / 10f * index1;
int index2 = Dust.NewDust(new Vector2(x, y), 1, 1, 206, 0.0f, 0.0f, 0, new Color(), 1f);
Main.dust[index2].alpha = alpha;
Main.dust[index2].position.X = x;
Main.dust[index2].position.Y = y;
Main.dust[index2].velocity *= 0.0f;
Main.dust[index2].noGravity = true;
}
}
if (alpha > 0)
alpha -= 25;
if (alpha < 0)
alpha = 0;
}
else if (type == 207)
{
if (alpha < 170)
{
for (int index1 = 0; index1 < 10; ++index1)
{
float x = position.X - velocity.X / 10f * index1;
float y = position.Y - velocity.Y / 10f * index1;
int index2 = Dust.NewDust(new Vector2(x, y), 1, 1, 75, 0.0f, 0.0f, 0, new Color(), 1f);
Main.dust[index2].alpha = alpha;
Main.dust[index2].position.X = x;
Main.dust[index2].position.Y = y;
Main.dust[index2].velocity *= 0.0f;
Main.dust[index2].noGravity = true;
}
}
float num1 = (float)Math.Sqrt(velocity.X * velocity.X + velocity.Y * velocity.Y);
float num2 = localAI[0];
if (num2 == 0.0)
{
localAI[0] = num1;
num2 = num1;
}
if (alpha > 0)
alpha -= 25;
if (alpha < 0)
alpha = 0;
float num3 = position.X;
float num4 = position.Y;
float num5 = 300f;
bool flag2 = false;
int num6 = 0;
if (ai[1] == 0.0)
{
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].CanBeChasedBy(this, false) && (ai[1] == 0.0 || ai[1] == (double)(index + 1)))
{
float num7 = Main.npc[index].position.X + (float)(Main.npc[index].width / 2);
float num8 = Main.npc[index].position.Y + (float)(Main.npc[index].height / 2);
float num9 = Math.Abs(position.X + (width / 2) - num7) + Math.Abs(position.Y + (height / 2) - num8);
if (num9 < num5 && Collision.CanHit(new Vector2(position.X + (width / 2), position.Y + (height / 2)), 1, 1, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height))
{
num5 = num9;
num3 = num7;
num4 = num8;
flag2 = true;
num6 = index;
}
}
}
if (flag2)
ai[1] = (float)(num6 + 1);
flag2 = false;
}
if (ai[1] > 0.0)
{
int index = (int)(ai[1] - 1.0);
if (Main.npc[index].active && Main.npc[index].CanBeChasedBy(this, true) && !Main.npc[index].dontTakeDamage)
{
if ((double)(Math.Abs(position.X + (width / 2) - (Main.npc[index].position.X + (float)(Main.npc[index].width / 2))) + Math.Abs(position.Y + (height / 2) - (Main.npc[index].position.Y + (float)(Main.npc[index].height / 2)))) < 1000.0)
{
flag2 = true;
num3 = Main.npc[index].position.X + (float)(Main.npc[index].width / 2);
num4 = Main.npc[index].position.Y + (float)(Main.npc[index].height / 2);
}
}
else
ai[1] = 0.0f;
}
if (!friendly)
flag2 = false;
if (flag2)
{
float num7 = num2;
Vector2 vector2 = new Vector2(position.X + width * 0.5f, position.Y + height * 0.5f);
float num8 = num3 - vector2.X;
float num9 = num4 - vector2.Y;
float num10 = (float)Math.Sqrt(num8 * num8 + num9 * num9);
float num11 = num7 / num10;
float num12 = num8 * num11;
float num13 = num9 * num11;
int num14 = 8;
velocity.X = (velocity.X * (float)(num14 - 1) + num12) / num14;
velocity.Y = (velocity.Y * (float)(num14 - 1) + num13) / num14;
}
}
else if (type == 81 || type == 91)
{
if (ai[0] >= 20.0)
{
ai[0] = 20f;
velocity.Y += 0.07f;
}
}
else if (type == 174 || type == 605)
{
if (ai[0] >= 5.0)
{
ai[0] = 5f;
velocity.Y += 0.15f;
}
}
else if (type == 337)
{
if (position.Y > Main.player[owner].position.Y - 300.0)
tileCollide = true;
if (position.Y < Main.worldSurface * 16.0)
tileCollide = true;
frame = (int)ai[1];
if (Main.rand.Next(2) == 0)
{
int index = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 197, 0.0f, 0.0f, 0, new Color(), 1f);
Main.dust[index].velocity *= 0.5f;
Main.dust[index].noGravity = true;
}
}
else if (type == 645)
{
if (ai[1] != -1.0 && position.Y > ai[1])
tileCollide = true;
if (Utils.HasNaNs(position))
{
Kill();
return;
}
bool flag2 = WorldGen.SolidTile(Framing.GetTileSafely((int)position.X / 16, (int)position.Y / 16));
Dust dust = Main.dust[Dust.NewDust(new Vector2(position.X, position.Y), width, height, 229, 0.0f, 0.0f, 0, new Color(), 1f)];
dust.position = Center;
dust.velocity = Vector2.Zero;
dust.noGravity = true;
if (flag2)
dust.noLight = true;
if (ai[1] == -1.0)
{
++ai[0];
velocity = Vector2.Zero;
tileCollide = false;
penetrate = -1;
position = Center;
width = height = 140;
Center = position;
alpha -= 10;
if (alpha < 0)
alpha = 0;
if (++frameCounter >= MaxUpdates * 3)
{
frameCounter = 0;
++frame;
}
if (ai[0] < (double)(Main.projFrames[type] * MaxUpdates * 3))
return;
Kill();
return;
}
alpha = 255;
if (numUpdates == 0)
{
int num1 = -1;
float num2 = 60f;
for (int index = 0; index < 200; ++index)
{
NPC npc = Main.npc[index];
if (npc.CanBeChasedBy(this, false))
{
float num3 = Distance(npc.Center);
if (num3 < num2 && Collision.CanHitLine(Center, 0, 0, npc.Center, 0, 0))
{
num2 = num3;
num1 = index;
}
}
}
if (num1 != -1)
{
ai[0] = 0.0f;
ai[1] = -1f;
netUpdate = true;
return;
}
}
}
else if (type >= 424 && type <= 426)
{
if (position.Y > Main.player[owner].position.Y - 300.0)
tileCollide = true;
if (position.Y < Main.worldSurface * 16.0)
tileCollide = true;
scale = ai[1];
rotation += velocity.X * 2f;
Vector2 vector2 = Center + Vector2.Normalize(velocity) * 10f;
Dust dust1 = Main.dust[Dust.NewDust(position, width, height, 6, 0.0f, 0.0f, 0, new Color(), 1f)];
dust1.position = vector2;
dust1.velocity = Utils.RotatedBy(velocity, 1.57079637050629, new Vector2()) * 0.33f + velocity / 4f;
dust1.position += Utils.RotatedBy(velocity, 1.57079637050629, new Vector2());
dust1.fadeIn = 0.5f;
dust1.noGravity = true;
Dust dust2 = Main.dust[Dust.NewDust(position, width, height, 6, 0.0f, 0.0f, 0, new Color(), 1f)];
dust2.position = vector2;
dust2.velocity = Utils.RotatedBy(velocity, -1.57079637050629, new Vector2()) * 0.33f + velocity / 4f;
dust2.position += Utils.RotatedBy(velocity, -1.57079637050629, new Vector2());
dust2.fadeIn = 0.5f;
dust2.noGravity = true;
for (int index1 = 0; index1 < 1; ++index1)
{
int index2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0.0f, 0.0f, 0, new Color(), 1f);
Main.dust[index2].velocity *= 0.5f;
Main.dust[index2].scale *= 1.3f;
Main.dust[index2].fadeIn = 1f;
Main.dust[index2].noGravity = true;
}
}
else if (type == 344)
{
++localAI[1];
if (localAI[1] > 5.0)
{
alpha -= 50;
if (alpha < 0)
alpha = 0;
}
frame = (int)ai[1];
if (localAI[1] > 20.0)
{
localAI[1] = 20f;
velocity.Y += 0.15f;
}
rotation += Main.windSpeed * 0.2f;
velocity.X += Main.windSpeed * 0.1f;
}
else if (type == 336 || type == 345)
{
if (type == 345 && localAI[0] == 0.0)
{
localAI[0] = 1f;
Main.PlaySound(2, (int)position.X, (int)position.Y, 1);
}
if (ai[0] >= 50.0)
{
ai[0] = 50f;
velocity.Y += 0.5f;
}
}
else if (type == 246)
{
alpha -= 20;
if (alpha < 0)
alpha = 0;
if (ai[0] >= 60.0)
{
ai[0] = 60f;
velocity.Y += 0.15f;
}
}
else if (type == 311)
{
if (alpha > 0)
alpha -= 50;
if (alpha < 0)
alpha = 0;
if (ai[0] >= 30.0)
{
ai[0] = 30f;
if (ai[1] == 0.0)
ai[1] = 1f;
velocity.Y += 0.5f;
}
}
else if (type == 312)
{
if (ai[0] >= 5.0)
alpha = 0;
if (ai[0] >= 20.0)
{
ai[0] = 30f;
velocity.Y += 0.5f;
}
}
else if (type != 239 && type != 264)
{
if (type == 176)
{
if (ai[0] >= 15.0)
{
ai[0] = 15f;
velocity.Y += 0.05f;
}
}
else if (type == 275 || type == 276)
{
if (alpha > 0)
alpha -= 30;
if (alpha < 0)
alpha = 0;
if (ai[0] >= 35.0)
{
ai[0] = 35f;
velocity.Y += 0.025f;
}
if (Main.expertMode)
{
float num1 = 18f;
int index = (int)Player.FindClosest(Center, 1, 1);
Vector2 vector2_1 = Main.player[index].Center - Center;
vector2_1.Normalize();
vector2_1 *= num1;
int num2 = 70;
velocity = (velocity * (float)(num2 - 1) + vector2_1) / num2;
if (velocity.Length() < 14.0)
{
velocity.Normalize();
Projectile projectile = this;
Vector2 vector2_2 = projectile.velocity * 14f;
projectile.velocity = vector2_2;
}
tileCollide = false;
if (timeLeft > 180)
timeLeft = 180;
}
}
else if (type == 172)
{
if (ai[0] >= 17.0)
{
ai[0] = 17f;
velocity.Y += 0.085f;
}
}
else if (type == 117)
{
if (ai[0] >= 35.0)
{
ai[0] = 35f;
velocity.Y += 0.06f;
}
}
else if (type == 120)
{
int index = Dust.NewDust(new Vector2(position.X - velocity.X, position.Y - velocity.Y), width, height, 67, velocity.X, velocity.Y, 100, new Color(), 1.2f);
Main.dust[index].noGravity = true;
Main.dust[index].velocity *= 0.3f;
if (ai[0] >= 30.0)
{
ai[0] = 30f;
velocity.Y += 0.05f;
}
}
else if (type == 195)
{
if (ai[0] >= 20.0)
{
ai[0] = 20f;
velocity.Y += 0.075f;
tileCollide = true;
}
else
tileCollide = false;
}
else if (type == 267 || type == 477 || (type == 478 || type == 479))
{
++localAI[0];
if (localAI[0] > 3.0)
alpha = 0;
if (ai[0] >= 20.0)
{
ai[0] = 20f;
if (type != 477)
velocity.Y += 0.075f;
}
if (type == 479 && Main.myPlayer == owner)
{
if (ai[1] >= 0.0)
penetrate = -1;
else if (penetrate < 0)
penetrate = 1;
if (ai[1] >= 0.0)
++ai[1];
if (ai[1] > Main.rand.Next(5, 30))
{
ai[1] = -1000f;
float num1 = velocity.Length();
Vector2 vector2_1 = velocity;
vector2_1.Normalize();
int num2 = Main.rand.Next(2, 4);
if (Main.rand.Next(4) == 0)
++num2;
for (int index = 0; index < num2; ++index)
{
Vector2 vector2_2 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
vector2_2.Normalize();
Vector2 vector2_3 = vector2_2 + vector2_1 * 2f;
vector2_3.Normalize();
vector2_2 = vector2_3 * num1;
NewProjectile(Center.X, Center.Y, vector2_2.X, vector2_2.Y, type, damage, knockBack, owner, 0.0f, -1000f);
}
}
}
if (type == 478 && Main.myPlayer == owner)
{
++ai[1];
if (ai[1] > Main.rand.Next(5, 20))
{
if (timeLeft > 40)
timeLeft -= 20;
ai[1] = 0.0f;
NewProjectile(Center.X, Center.Y, 0.0f, 0.0f, 480, (int)(damage * 0.8), knockBack * 0.5f, owner, 0.0f, 0.0f);
}
}
}
else if (type == 408)
{
if (ai[0] >= 45.0)
{
ai[0] = 45f;
velocity.Y += 0.05f;
}
}
else if (type == 616)
{
if (alpha < 170)
{
float num = 3f;
for (int index1 = 0; (double)index1 < num; ++index1)
{
int index2 = Dust.NewDust(position, 1, 1, 229, 0.0f, 0.0f, 0, new Color(), 1f);
Main.dust[index2].position = Center - velocity / num * index1;
Main.dust[index2].velocity *= 0.0f;
Main.dust[index2].noGravity = true;
Main.dust[index2].alpha = 200;
Main.dust[index2].scale = 0.5f;
}
}
float num1 = (float)Math.Sqrt(velocity.X * velocity.X + velocity.Y * velocity.Y);
float num2 = localAI[0];
if (num2 == 0.0)
{
localAI[0] = num1;
num2 = num1;
}
if (alpha > 0)
alpha -= 25;
if (alpha < 0)
alpha = 0;
float num3 = position.X;
float num4 = position.Y;
float num5 = 800f;
bool flag2 = false;
int num6 = 0;
++ai[0];
if (ai[0] > 20.0)
{
--ai[0];
if (ai[1] == 0.0)
{
for (int index = 0; index < 200; ++index)
{
if (Main.npc[index].CanBeChasedBy(this, false) && (ai[1] == 0.0 || ai[1] == (double)(index + 1)))
{
float num7 = Main.npc[index].position.X + (float)(Main.npc[index].width / 2);
float num8 = Main.npc[index].position.Y + (float)(Main.npc[index].height / 2);
float num9 = Math.Abs(position.X + (width / 2) - num7) + Math.Abs(position.Y + (height / 2) - num8);
if (num9 < num5 && Collision.CanHit(new Vector2(position.X + (width / 2), position.Y + (height / 2)), 1, 1, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height))
{
num5 = num9;
num3 = num7;
num4 = num8;
flag2 = true;
num6 = index;
}
}
}
if (flag2)
ai[1] = (float)(num6 + 1);
flag2 = false;
}
if (ai[1] != 0.0)
{
int index = (int)(ai[1] - 1.0);
if (Main.npc[index].active && Main.npc[index].CanBeChasedBy(this, true) && (double)(Math.Abs(position.X + (width / 2) - (Main.npc[index].position.X + (float)(Main.npc[index].width / 2))) + Math.Abs(position.Y + (height / 2) - (Main.npc[index].position.Y + (float)(Main.npc[index].height / 2)))) < 1000.0)
{
flag2 = true;
num3 = Main.npc[index].position.X + (float)(Main.npc[index].width / 2);
num4 = Main.npc[index].position.Y + (float)(Main.npc[index].height / 2);
}
}
if (!friendly)
flag2 = false;
if (flag2)
{
float num7 = num2;
Vector2 vector2 = new Vector2(position.X + width * 0.5f, position.Y + height * 0.5f);
float num8 = num3 - vector2.X;
float num9 = num4 - vector2.Y;
float num10 = (float)Math.Sqrt(num8 * num8 + num9 * num9);
float num11 = num7 / num10;
float num12 = num8 * num11;
float num13 = num9 * num11;
int num14 = 8;
velocity.X = (velocity.X * (float)(num14 - 1) + num12) / num14;
velocity.Y = (velocity.Y * (float)(num14 - 1) + num13) / num14;
}
}
}
else if (type == 507 || type == 508)
{
if (ai[0] > 45.0)
{
velocity.X *= 0.98f;
velocity.Y += 0.3f;
}
}
else if (type == 495)
{
int index = Dust.NewDust(new Vector2(position.X - velocity.X, position.Y - velocity.Y), width, height, 27, velocity.X, velocity.Y, 100, new Color(), 1.2f);
Main.dust[index].noGravity = true;
Main.dust[index].velocity *= 0.3f;
if (ai[0] >= 30.0)
{
ai[0] = 30f;
velocity.Y += 0.04f;
}
}
else if (type == 498)
{
if (localAI[0] == 0.0)
{
++localAI[0];
Main.PlaySound(2, (int)position.X, (int)position.Y, 17);
}
++ai[0];
if (ai[0] >= 50.0)
{
velocity.X *= 0.98f;
velocity.Y += 0.15f;
rotation += direction * 0.5f;
}
else
rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
}
else if (type == 437)
{
if (ai[0] >= 12.0)
{
if (ai[0] >= 20.0)
Kill();
alpha += 30;
}
}
else if (type != 442 && type != 634 && type != 635)
{
if (type == 639)
{
if (timeLeft <= MaxUpdates * 45 - 14)
velocity.Y += 0.1f;
}
else if (ai[0] >= 15.0)
{
ai[0] = 15f;
velocity.Y += 0.1f;
}
}
}
if (type == 248)
{
if (velocity.X < 0.0)
rotation -= (float)((Math.Abs(velocity.X) + Math.Abs(velocity.Y)) * 0.0500000007450581);
else
rotation += (float)((Math.Abs(velocity.X) + Math.Abs(velocity.Y)) * 0.0500000007450581);
}
else if (type == 270 || type == 585 || type == 601)
{
spriteDirection = direction;
rotation = direction >= 0 ? (float)Math.Atan2(velocity.Y, velocity.X) : (float)Math.Atan2(-velocity.Y, -velocity.X);
}
else if (type == 311)
{
if (ai[1] != 0.0)
rotation += (float)(velocity.X * 0.100000001490116 + Main.rand.Next(-10, 11) * 0.025000000372529);
else
rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
}
else if (type == 312)
rotation += velocity.X * 0.02f;
else if (type == 408)
{
rotation = Utils.ToRotation(velocity);
if (direction == -1)
rotation += 3.141593f;
}
else if (type == 435 || type == 459)
{
rotation = Utils.ToRotation(velocity);
if (direction == -1)
rotation += 3.141593f;
}
else if (type == 436)
{
rotation = Utils.ToRotation(velocity);
rotation += 3.141593f;
if (direction == -1)
rotation += 3.141593f;
}
else if (type == 469)
{
if (velocity.X > 0.0)
{
spriteDirection = -1;
rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
}
else
{
spriteDirection = 1;
rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
}
}
else if (type == 477)
{
if (localAI[1] < 5.0)
{
rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
++localAI[1];
}
else
rotation = (float)((rotation * 2.0 + Math.Atan2(velocity.Y, velocity.X) + 1.57000005245209) / 3.0);
}
else if (type == 532)
rotation += (float)(0.200000002980232 + Math.Abs(velocity.X) * 0.100000001490116);
else if (type == 483)
rotation += velocity.X * 0.05f;
else if (type == 485)
{
velocity = (velocity * 39f + new Vector2(ai[0], ai[1])) / 40f;
int index = Dust.NewDust(position, width, height, 6, 0.0f, 0.0f, 0, new Color(), 1f);
Main.dust[index].noGravity = true;
Main.dust[index].velocity *= 0.2f;
Main.dust[index].position = (Main.dust[index].position + Center) / 2f;
++frameCounter;
if (frameCounter >= 2)
{
frameCounter = 0;
++frame;
if (frame >= 5)
frame = 0;
}
if (velocity.X < 0.0)
{
spriteDirection = -1;
rotation = (float)Math.Atan2(-velocity.Y, -velocity.X);
}
else
{
spriteDirection = 1;
rotation = (float)Math.Atan2(velocity.Y, velocity.X);
}
}
else if (type == 640)
{
if (velocity != Vector2.Zero)
rotation = Utils.ToRotation(velocity) + 1.570796f;
}
else if (type != 344 && type != 498)
rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
if (velocity.Y <= 16.0)
return;
velocity.Y = 16f;
}