public static int NewProjectile(float X, float Y, float SpeedX, float SpeedY, int Type, int Damage, float KnockBack, int Owner = 255, float ai0 = 0.0f, float ai1 = 0.0f)
{
int number = 1000;
for (int index = 0; index < 1000; ++index)
{
if (!Main.projectile[index].active)
{
number = index;
break;
}
}
if (number == 1000)
return number;
Projectile projectile = Main.projectile[number];
projectile.SetDefaults(Type);
projectile.position.X = X - projectile.width * 0.5f;
projectile.position.Y = Y - projectile.height * 0.5f;
projectile.owner = Owner;
projectile.velocity.X = SpeedX;
projectile.velocity.Y = SpeedY;
projectile.damage = Damage;
projectile.knockBack = KnockBack;
projectile.identity = number;
projectile.gfxOffY = 0.0f;
projectile.stepSpeed = 1f;
projectile.wet = Collision.WetCollision(projectile.position, projectile.width, projectile.height);
if (projectile.ignoreWater)
projectile.wet = false;
projectile.honeyWet = Collision.honey;
if (projectile.aiStyle == 1)
{
while (projectile.velocity.X >= 16.0 || projectile.velocity.X <= -16.0 || (projectile.velocity.Y >= 16.0 || projectile.velocity.Y < -16.0))
{
projectile.velocity.X *= 0.97f;
projectile.velocity.Y *= 0.97f;
}
}
if (Owner == Main.myPlayer)
{
if (Type == 206)
{
projectile.ai[0] = Main.rand.Next(-100, 101) * 0.0005f;
projectile.ai[1] = Main.rand.Next(-100, 101) * 0.0005f;
}
else if (Type == 335)
projectile.ai[1] = Main.rand.Next(4);
else if (Type == 358)
projectile.ai[1] = Main.rand.Next(10, 31) * 0.1f;
else if (Type == 406)
{
projectile.ai[1] = Main.rand.Next(10, 21) * 0.1f;
}
else
{
projectile.ai[0] = ai0;
projectile.ai[1] = ai1;
}
}
if (Type == 434)
{
projectile.ai[0] = projectile.position.X;
projectile.ai[1] = projectile.position.Y;
}
if (Main.netMode != 0 && Owner == Main.myPlayer)
NetMessage.SendData(27, -1, -1, "", number, 0.0f, 0.0f, 0.0f, 0, 0, 0);
if (Owner == Main.myPlayer)
{
if (Type == 28)
projectile.timeLeft = 180;
if (Type == 516)
projectile.timeLeft = 180;
if (Type == 519)
projectile.timeLeft = 180;
if (Type == 29)
projectile.timeLeft = 300;
if (Type == 470)
projectile.timeLeft = 300;
if (Type == 637)
projectile.timeLeft = 300;
if (Type == 30)
projectile.timeLeft = 180;
if (Type == 517)
projectile.timeLeft = 180;
if (Type == 37)
projectile.timeLeft = 180;
if (Type == 75)
projectile.timeLeft = 180;
if (Type == 133)
projectile.timeLeft = 180;
if (Type == 136)
projectile.timeLeft = 180;
if (Type == 139)
projectile.timeLeft = 180;
if (Type == 142)
projectile.timeLeft = 180;
if (Type == 397)
projectile.timeLeft = 180;
if (Type == 419)
projectile.timeLeft = 600;
if (Type == 420)
projectile.timeLeft = 600;
if (Type == 421)
projectile.timeLeft = 600;
if (Type == 422)
projectile.timeLeft = 600;
if (Type == 588)
projectile.timeLeft = 180;
if (Type == 443)
projectile.timeLeft = 300;
}
if (Type == 249)
projectile.frame = Main.rand.Next(5);
return number;
}