public void Counterweight(Vector2 hitPos, int dmg, float kb)
{
if (!this.yoyoGlove && this.counterWeight <= 0)
return;
int index1 = -1;
int num1 = 0;
int num2 = 0;
for (int index2 = 0; index2 < 1000; ++index2)
{
if (Main.projectile[index2].active && Main.projectile[index2].owner == this.whoAmI)
{
if (Main.projectile[index2].counterweight)
++num2;
else if (Main.projectile[index2].aiStyle == 99)
{
++num1;
index1 = index2;
}
}
}
if (this.yoyoGlove && num1 < 2)
{
if (index1 < 0)
return;
Vector2 vector2_1 = hitPos - this.Center;
vector2_1.Normalize();
Vector2 vector2_2 = vector2_1 * 16f;
Projectile.NewProjectile(this.Center.X, this.Center.Y, vector2_2.X, vector2_2.Y, Main.projectile[index1].type, Main.projectile[index1].damage, Main.projectile[index1].knockBack, this.whoAmI, 1f, 0.0f);
}
else
{
if (num2 >= num1)
return;
Vector2 vector2_1 = hitPos - this.Center;
vector2_1.Normalize();
Vector2 vector2_2 = vector2_1 * 16f;
float KnockBack = (float)(((double)kb + 6.0) / 2.0);
if (num2 > 0)
Projectile.NewProjectile(this.Center.X, this.Center.Y, vector2_2.X, vector2_2.Y, this.counterWeight, (int)((double)dmg * 0.8), KnockBack, this.whoAmI, 1f, 0.0f);
else
Projectile.NewProjectile(this.Center.X, this.Center.Y, vector2_2.X, vector2_2.Y, this.counterWeight, (int)((double)dmg * 0.8), KnockBack, this.whoAmI, 0.0f, 0.0f);
}
}