minor changes/refactoring
This commit is contained in:
1 parent
9d3ae3e755
commit
03ae864035
4 files changed
+11
-74
No files matched your search
@@ -46,39 +46,8 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 9);
|
||||
}
|
||||
}
|
||||
float num472 = projectile.Center.X;
|
||||
float num473 = projectile.Center.Y;
|
||||
float num474 = 460f;
|
||||
bool flag17 = false;
|
||||
for (int num475 = 0; num475 < 200; num475++)
|
||||
{
|
||||
if (Main.npc[num475].CanBeChasedBy(projectile, false))
|
||||
{
|
||||
float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2);
|
||||
float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2);
|
||||
float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477);
|
||||
if (num478 < num474)
|
||||
{
|
||||
num474 = num478;
|
||||
num472 = num476;
|
||||
num473 = num477;
|
||||
flag17 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (flag17)
|
||||
{
|
||||
float num483 = 15f;
|
||||
Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
|
||||
float num484 = num472 - vector35.X;
|
||||
float num485 = num473 - vector35.Y;
|
||||
float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485));
|
||||
num486 = num483 / num486;
|
||||
num484 *= num486;
|
||||
num485 *= num486;
|
||||
projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f;
|
||||
projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f;
|
||||
}
|
||||
|
||||
CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 460f, 15f, 20f);
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
|
||||
@@ -59,16 +59,16 @@ namespace CalamityMod.Projectiles.Pets
|
||||
projectile.tileCollide = false;
|
||||
int num17 = 100;
|
||||
Vector2 vector3 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
|
||||
float num18 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector3.X;
|
||||
float num19 = Main.player[projectile.owner].position.Y + (float)(Main.player[projectile.owner].height / 2) - vector3.Y;
|
||||
float num18 = player.position.X + (float)(player.width / 2) - vector3.X;
|
||||
float num19 = player.position.Y + (float)(player.height / 2) - vector3.Y;
|
||||
num19 += (float)Main.rand.Next(-10, 21);
|
||||
num18 += (float)Main.rand.Next(-10, 21);
|
||||
num18 += (float)(60 * -(float)Main.player[projectile.owner].direction);
|
||||
num18 += (float)(60 * -(float)player.direction);
|
||||
num19 -= 60f;
|
||||
float num20 = (float)Math.Sqrt((double)(num18 * num18 + num19 * num19));
|
||||
float num21 = 18f;
|
||||
if (num20 < (float)num17 && Main.player[projectile.owner].velocity.Y == 0f &&
|
||||
projectile.position.Y + (float)projectile.height <= Main.player[projectile.owner].position.Y + (float)Main.player[projectile.owner].height &&
|
||||
projectile.position.Y + (float)projectile.height <= player.position.Y + (float)player.height &&
|
||||
!Collision.SolidCollision(projectile.position, projectile.width, projectile.height))
|
||||
{
|
||||
projectile.ai[0] = 0f;
|
||||
@@ -79,8 +79,8 @@ namespace CalamityMod.Projectiles.Pets
|
||||
}
|
||||
if (num20 > 2000f)
|
||||
{
|
||||
projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2);
|
||||
projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2);
|
||||
projectile.position.X = player.Center.X - (float)(projectile.width / 2);
|
||||
projectile.position.Y = player.Center.Y - (float)(projectile.height / 2);
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
if (num20 < 50f)
|
||||
|
||||
@@ -44,40 +44,8 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
Main.dust[num469].noGravity = true;
|
||||
Main.dust[num469].velocity = dspeed;
|
||||
}
|
||||
|
||||
float num472 = projectile.Center.X;
|
||||
float num473 = projectile.Center.Y;
|
||||
float num474 = 200f;
|
||||
bool flag17 = false;
|
||||
for (int num475 = 0; num475 < 200; num475++)
|
||||
{
|
||||
if (Main.npc[num475].CanBeChasedBy(projectile, false) && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num475].Center, 1, 1))
|
||||
{
|
||||
float num476 = Main.npc[num475].position.X + (float)(Main.npc[num475].width / 2);
|
||||
float num477 = Main.npc[num475].position.Y + (float)(Main.npc[num475].height / 2);
|
||||
float num478 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num476) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num477);
|
||||
if (num478 < num474)
|
||||
{
|
||||
num474 = num478;
|
||||
num472 = num476;
|
||||
num473 = num477;
|
||||
flag17 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (flag17)
|
||||
{
|
||||
float num483 = 18f;
|
||||
Vector2 vector35 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
|
||||
float num484 = num472 - vector35.X;
|
||||
float num485 = num473 - vector35.Y;
|
||||
float num486 = (float)Math.Sqrt((double)(num484 * num484 + num485 * num485));
|
||||
num486 = num483 / num486;
|
||||
num484 *= num486;
|
||||
num485 *= num486;
|
||||
projectile.velocity.X = (projectile.velocity.X * 20f + num484) / 21f;
|
||||
projectile.velocity.Y = (projectile.velocity.Y * 20f + num485) / 21f;
|
||||
}
|
||||
|
||||
CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 200f, 18f, 20f);
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (Main.rand.Next(8) == 0)
|
||||
if (Main.rand.NextBool(8))
|
||||
{
|
||||
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, Main.rand.Next(2) == 1 ? 107 : 89, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user