improved lag on verium bullets, astral rounds, amidias' trident, and regulus riot
This commit is contained in:
1 parent
10dc62fa98
commit
86f3ea3e02
5 files changed
+30
-167
No files matched your search
@@ -2043,6 +2043,11 @@ namespace CalamityMod.Projectiles
|
||||
}
|
||||
}
|
||||
|
||||
if (!projectile.friendly)
|
||||
{
|
||||
homeIn = false;
|
||||
}
|
||||
|
||||
if (homeIn)
|
||||
{
|
||||
Vector2 homeInVector = projectile.DirectionTo(center);
|
||||
|
||||
@@ -86,6 +86,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
vector145 = center13;
|
||||
flag59 = true;
|
||||
num1016 = num1017;
|
||||
break;
|
||||
}
|
||||
}
|
||||
num3 = num1017;
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class AstralRound : ModProjectile
|
||||
{
|
||||
private float speed = 0f;
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Astral Round");
|
||||
@@ -50,95 +51,20 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
projectile.spriteDirection = projectile.direction;
|
||||
if (Main.rand.NextBool(2))
|
||||
{
|
||||
int randomDust = Main.rand.Next(2);
|
||||
if (randomDust == 0)
|
||||
{
|
||||
randomDust = ModContent.DustType<AstralOrange>();
|
||||
}
|
||||
else
|
||||
{
|
||||
randomDust = ModContent.DustType<AstralBlue>();
|
||||
}
|
||||
int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, randomDust, 0f, 0f, 0, default, 0.5f);
|
||||
Main.dust[num137].alpha = projectile.alpha;
|
||||
Main.dust[num137].velocity *= 0f;
|
||||
Main.dust[num137].noGravity = true;
|
||||
}
|
||||
float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y));
|
||||
float num139 = projectile.localAI[0];
|
||||
if (num139 == 0f)
|
||||
{
|
||||
projectile.localAI[0] = num138;
|
||||
num139 = num138;
|
||||
}
|
||||
float num140 = projectile.position.X;
|
||||
float num141 = projectile.position.Y;
|
||||
float num142 = 200f;
|
||||
bool flag4 = false;
|
||||
int num143 = 0;
|
||||
if (projectile.ai[1] == 0f)
|
||||
{
|
||||
for (int num144 = 0; num144 < 200; num144++)
|
||||
{
|
||||
if (Main.npc[num144].CanBeChasedBy(projectile, false) && (projectile.ai[1] == 0f || projectile.ai[1] == (float)(num144 + 1)))
|
||||
{
|
||||
float num145 = Main.npc[num144].position.X + (float)(Main.npc[num144].width / 2);
|
||||
float num146 = Main.npc[num144].position.Y + (float)(Main.npc[num144].height / 2);
|
||||
float num147 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num145) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num146);
|
||||
if (num147 < num142 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num144].position, Main.npc[num144].width, Main.npc[num144].height))
|
||||
{
|
||||
num142 = num147;
|
||||
num140 = num145;
|
||||
num141 = num146;
|
||||
flag4 = true;
|
||||
num143 = num144;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (flag4)
|
||||
{
|
||||
projectile.ai[1] = (float)(num143 + 1);
|
||||
}
|
||||
flag4 = false;
|
||||
}
|
||||
if (projectile.ai[1] > 0f)
|
||||
{
|
||||
int num148 = (int)(projectile.ai[1] - 1f);
|
||||
if (Main.npc[num148].active && Main.npc[num148].CanBeChasedBy(projectile, true) && !Main.npc[num148].dontTakeDamage)
|
||||
{
|
||||
float num149 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2);
|
||||
float num150 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2);
|
||||
float num151 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num149) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num150);
|
||||
if (num151 < 1000f)
|
||||
{
|
||||
flag4 = true;
|
||||
num140 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2);
|
||||
num141 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.ai[1] = 0f;
|
||||
}
|
||||
}
|
||||
if (!projectile.friendly)
|
||||
{
|
||||
flag4 = false;
|
||||
}
|
||||
if (flag4)
|
||||
{
|
||||
float num152 = num139;
|
||||
Vector2 vector13 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
|
||||
float num153 = num140 - vector13.X;
|
||||
float num154 = num141 - vector13.Y;
|
||||
float num155 = (float)Math.Sqrt((double)(num153 * num153 + num154 * num154));
|
||||
num155 = num152 / num155;
|
||||
num153 *= num155;
|
||||
num154 *= num155;
|
||||
int num156 = 12;
|
||||
projectile.velocity.X = (projectile.velocity.X * (float)(num156 - 1) + num153) / (float)num156;
|
||||
projectile.velocity.Y = (projectile.velocity.Y * (float)(num156 - 1) + num154) / (float)num156;
|
||||
int randomDust = Utils.SelectRandom(Main.rand, new int[]
|
||||
{
|
||||
ModContent.DustType<AstralOrange>(),
|
||||
ModContent.DustType<AstralBlue>()
|
||||
});
|
||||
int astral = Dust.NewDust(projectile.position, 1, 1, randomDust, 0f, 0f, 0, default, 0.5f);
|
||||
Main.dust[astral].alpha = projectile.alpha;
|
||||
Main.dust[astral].velocity *= 0f;
|
||||
Main.dust[astral].noGravity = true;
|
||||
}
|
||||
|
||||
if (speed == 0f)
|
||||
speed = projectile.velocity.Length();
|
||||
CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 200f, speed, 12f);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class VeriumBulletProj : ModProjectile
|
||||
{
|
||||
private float speed = 0f;
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Bullet");
|
||||
@@ -41,86 +42,15 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
projectile.spriteDirection = projectile.direction;
|
||||
if (Main.rand.NextBool(2))
|
||||
{
|
||||
int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 70, 0f, 0f, 0, default, 0.5f);
|
||||
Main.dust[num137].alpha = projectile.alpha;
|
||||
Main.dust[num137].velocity *= 0f;
|
||||
Main.dust[num137].noGravity = true;
|
||||
}
|
||||
float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y));
|
||||
float num139 = projectile.localAI[0];
|
||||
if (num139 == 0f)
|
||||
{
|
||||
projectile.localAI[0] = num138;
|
||||
num139 = num138;
|
||||
}
|
||||
float num140 = projectile.position.X;
|
||||
float num141 = projectile.position.Y;
|
||||
float num142 = 300f;
|
||||
bool flag4 = false;
|
||||
int num143 = 0;
|
||||
if (projectile.ai[1] == 0f)
|
||||
{
|
||||
for (int num144 = 0; num144 < 200; num144++)
|
||||
{
|
||||
if (Main.npc[num144].CanBeChasedBy(projectile, false) && (projectile.ai[1] == 0f || projectile.ai[1] == (float)(num144 + 1)))
|
||||
{
|
||||
float num145 = Main.npc[num144].position.X + (float)(Main.npc[num144].width / 2);
|
||||
float num146 = Main.npc[num144].position.Y + (float)(Main.npc[num144].height / 2);
|
||||
float num147 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num145) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num146);
|
||||
if (num147 < num142 && Collision.CanHit(new Vector2(projectile.position.X + (float)(projectile.width / 2), projectile.position.Y + (float)(projectile.height / 2)), 1, 1, Main.npc[num144].position, Main.npc[num144].width, Main.npc[num144].height))
|
||||
{
|
||||
num142 = num147;
|
||||
num140 = num145;
|
||||
num141 = num146;
|
||||
flag4 = true;
|
||||
num143 = num144;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (flag4)
|
||||
{
|
||||
projectile.ai[1] = (float)(num143 + 1);
|
||||
}
|
||||
flag4 = false;
|
||||
}
|
||||
if (projectile.ai[1] > 0f)
|
||||
{
|
||||
int num148 = (int)(projectile.ai[1] - 1f);
|
||||
if (Main.npc[num148].active && Main.npc[num148].CanBeChasedBy(projectile, true) && !Main.npc[num148].dontTakeDamage)
|
||||
{
|
||||
float num149 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2);
|
||||
float num150 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2);
|
||||
float num151 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num149) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num150);
|
||||
if (num151 < 1000f)
|
||||
{
|
||||
flag4 = true;
|
||||
num140 = Main.npc[num148].position.X + (float)(Main.npc[num148].width / 2);
|
||||
num141 = Main.npc[num148].position.Y + (float)(Main.npc[num148].height / 2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.ai[1] = 0f;
|
||||
}
|
||||
}
|
||||
if (!projectile.friendly)
|
||||
{
|
||||
flag4 = false;
|
||||
}
|
||||
if (flag4)
|
||||
{
|
||||
float num152 = num139;
|
||||
Vector2 vector13 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
|
||||
float num153 = num140 - vector13.X;
|
||||
float num154 = num141 - vector13.Y;
|
||||
float num155 = (float)Math.Sqrt((double)(num153 * num153 + num154 * num154));
|
||||
num155 = num152 / num155;
|
||||
num153 *= num155;
|
||||
num154 *= num155;
|
||||
int num156 = 12;
|
||||
projectile.velocity.X = (projectile.velocity.X * (float)(num156 - 1) + num153) / (float)num156;
|
||||
projectile.velocity.Y = (projectile.velocity.Y * (float)(num156 - 1) + num154) / (float)num156;
|
||||
int purple = Dust.NewDust(projectile.position, 1, 1, 70, 0f, 0f, 0, default, 0.5f);
|
||||
Main.dust[purple].alpha = projectile.alpha;
|
||||
Main.dust[purple].velocity *= 0f;
|
||||
Main.dust[purple].noGravity = true;
|
||||
}
|
||||
|
||||
if (speed == 0f)
|
||||
speed = projectile.velocity.Length();
|
||||
CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 300f, speed, 12f);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,6 +96,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
targetCenter = npcCenter;
|
||||
homeIn = true;
|
||||
targetIndex = npcIndex;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user