1 - Reverted my normalize changes from a while ago.
This commit is contained in:
1 parent
70cdca7e81
commit
f50cf013e7
8 files changed
+32
-32
No files matched your search
@@ -144,7 +144,7 @@ namespace CalamityMod.NPCs.Abyss
|
||||
if (npc.ai[0] == 0f)
|
||||
{
|
||||
npc.localAI[0] = 0f;
|
||||
value29.SafeNormalize(Vector2.Zero);
|
||||
value29.Normalize();
|
||||
value29 *= 0.5f;
|
||||
npc.velocity += value29;
|
||||
npc.ai[0] = 4f;
|
||||
@@ -158,10 +158,10 @@ namespace CalamityMod.NPCs.Abyss
|
||||
npc.rotation += (float)npc.direction * 0.1f;
|
||||
Vector2 value30 = Main.player[npc.target].Top - npc.Center;
|
||||
float num1311 = value30.Length();
|
||||
float num1312 = 5.5f;
|
||||
float num1312 = 5f;
|
||||
num1312 += num1311 / 100f;
|
||||
int num1313 = 50;
|
||||
value30.SafeNormalize(Vector2.Zero);
|
||||
value30.Normalize();
|
||||
value30 *= num1312;
|
||||
npc.velocity = (npc.velocity * (float)(num1313 - 1) + value30) / (float)num1313;
|
||||
if (!Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1))
|
||||
@@ -186,7 +186,7 @@ namespace CalamityMod.NPCs.Abyss
|
||||
float num1315 = value31.Length();
|
||||
float scaleFactor11 = 3f;
|
||||
int num1316 = 3;
|
||||
value31.SafeNormalize(Vector2.Zero);
|
||||
value31.Normalize();
|
||||
value31 *= scaleFactor11;
|
||||
npc.velocity = (npc.velocity * (float)(num1316 - 1) + value31) / (float)num1316;
|
||||
if (num1315 < 600f && !Collision.SolidCollision(npc.position, npc.width, npc.height))
|
||||
@@ -202,7 +202,7 @@ namespace CalamityMod.NPCs.Abyss
|
||||
float num1317 = value33.Length();
|
||||
float num1318 = 2f;
|
||||
float num1319 = 3f;
|
||||
value33.SafeNormalize(Vector2.Zero);
|
||||
value33.Normalize();
|
||||
value33 *= num1318;
|
||||
npc.velocity = (npc.velocity * (num1319 - 1f) + value33) / num1319;
|
||||
if (npc.collideX || npc.collideY)
|
||||
@@ -231,13 +231,13 @@ namespace CalamityMod.NPCs.Abyss
|
||||
{
|
||||
value34 = Main.player[npc.target].Center - npc.Center;
|
||||
value34.Y -= (float)(Main.player[npc.target].height / 4);
|
||||
value34.SafeNormalize(Vector2.Zero);
|
||||
value34.Normalize();
|
||||
npc.velocity = value34 * 0.1f;
|
||||
}
|
||||
float scaleFactor12 = 2f;
|
||||
float num1320 = 20f;
|
||||
value34 = npc.velocity;
|
||||
value34.SafeNormalize(Vector2.Zero);
|
||||
value34.Normalize();
|
||||
value34 *= scaleFactor12;
|
||||
npc.velocity = (npc.velocity * (num1320 - 1f) + value34) / num1320;
|
||||
npc.ai[1] += 1f;
|
||||
|
||||
@@ -294,12 +294,12 @@ namespace CalamityMod.NPCs.Abyss
|
||||
{
|
||||
if (num50 > num48)
|
||||
{
|
||||
npc.velocity.SafeNormalize(Vector2.UnitX * npc.direction);
|
||||
npc.velocity.Normalize();
|
||||
npc.velocity *= num48;
|
||||
}
|
||||
else if (num50 < num49)
|
||||
{
|
||||
npc.velocity.SafeNormalize(Vector2.UnitX * npc.direction);
|
||||
npc.velocity.Normalize();
|
||||
npc.velocity *= num49;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,12 +180,12 @@ namespace CalamityMod.NPCs.Abyss
|
||||
{
|
||||
if (num50 > num48)
|
||||
{
|
||||
npc.velocity.SafeNormalize(Vector2.UnitX * npc.direction);
|
||||
npc.velocity.Normalize();
|
||||
npc.velocity *= num48;
|
||||
}
|
||||
else if (num50 < num49)
|
||||
{
|
||||
npc.velocity.SafeNormalize(Vector2.UnitX * npc.direction);
|
||||
npc.velocity.Normalize();
|
||||
npc.velocity *= num49;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,12 +157,12 @@ namespace CalamityMod.NPCs.Abyss
|
||||
{
|
||||
if (num50 > num48)
|
||||
{
|
||||
npc.velocity.SafeNormalize(Vector2.UnitX * npc.direction);
|
||||
npc.velocity.Normalize();
|
||||
npc.velocity *= num48;
|
||||
}
|
||||
else if (num50 < num49)
|
||||
{
|
||||
npc.velocity.SafeNormalize(Vector2.UnitX * npc.direction);
|
||||
npc.velocity.Normalize();
|
||||
npc.velocity *= num49;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -487,12 +487,12 @@ namespace CalamityMod.NPCs.Abyss
|
||||
int num20 = 36;
|
||||
for (int i = 0; i < num20; i++)
|
||||
{
|
||||
Vector2 expr_80F = (npc.velocity.SafeNormalize(Vector2.Zero) * new Vector2((float)npc.width / 2f, (float)npc.height) * 0.75f * 0.5f).RotatedBy((double)((float)(i - (num20 / 2 - 1)) * 6.28318548f / (float)num20), default) + npc.Center;
|
||||
Vector2 expr_80F = (Vector2.Normalize(npc.velocity) * new Vector2((float)npc.width / 2f, (float)npc.height) * 0.75f * 0.5f).RotatedBy((double)((float)(i - (num20 / 2 - 1)) * 6.28318548f / (float)num20), default) + npc.Center;
|
||||
Vector2 vector2 = expr_80F - npc.Center;
|
||||
int num21 = Dust.NewDust(expr_80F + vector2, 0, 0, 172, vector2.X * 2f, vector2.Y * 2f, 100, default, 1.4f);
|
||||
Main.dust[num21].noGravity = true;
|
||||
Main.dust[num21].noLight = true;
|
||||
Main.dust[num21].velocity = vector2.SafeNormalize(Vector2.Zero) * 3f;
|
||||
Main.dust[num21].velocity = Vector2.Normalize(vector2) * 3f;
|
||||
}
|
||||
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ReaperEnragedRoar"), (int)npc.position.X, (int)npc.position.Y);
|
||||
}
|
||||
@@ -514,7 +514,7 @@ namespace CalamityMod.NPCs.Abyss
|
||||
{
|
||||
npc.ai[1] = (float)(300 * Math.Sign((vector - player.Center).X));
|
||||
}
|
||||
Vector2 vector3 = (player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity).SafeNormalize(Vector2.Zero) * scaleFactor;
|
||||
Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - vector - npc.velocity) * scaleFactor;
|
||||
if (npc.velocity.X < vector3.X)
|
||||
{
|
||||
npc.velocity.X = npc.velocity.X + num3;
|
||||
@@ -567,7 +567,7 @@ namespace CalamityMod.NPCs.Abyss
|
||||
npc.ai[0] = 1f;
|
||||
npc.ai[1] = 0f;
|
||||
npc.ai[2] = 0f;
|
||||
npc.velocity = (player.Center - vector).SafeNormalize(Vector2.UnitX * npc.direction) * num5;
|
||||
npc.velocity = Vector2.Normalize(player.Center - vector) * num5;
|
||||
npc.rotation = (float)Math.Atan2((double)npc.velocity.Y, (double)npc.velocity.X);
|
||||
if (num22 != 0)
|
||||
{
|
||||
@@ -587,7 +587,7 @@ namespace CalamityMod.NPCs.Abyss
|
||||
int num24 = 7;
|
||||
for (int j = 0; j < num24; j++)
|
||||
{
|
||||
Vector2 arg_E1C_0 = (npc.velocity.SafeNormalize(Vector2.Zero) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f).RotatedBy((double)(j - (num24 / 2 - 1)) * 3.1415926535897931 / (double)(float)num24, default) + vector;
|
||||
Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, (float)npc.height) * 0.75f).RotatedBy((double)(j - (num24 / 2 - 1)) * 3.1415926535897931 / (double)(float)num24, default) + vector;
|
||||
Vector2 vector4 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - 1.57079637f).ToRotationVector2() * (float)Main.rand.Next(3, 8);
|
||||
int num25 = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, 172, vector4.X * 2f, vector4.Y * 2f, 100, default, 1.4f);
|
||||
Main.dust[num25].noGravity = true;
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm
|
||||
float distanceVelocityBoost = MathHelper.Clamp((Vector2.Distance(Main.npc[(int)npc.ai[2]].Center, Main.player[Main.npc[(int)npc.ai[2]].target].Center) - 1600f) * 0.025f, 0f, 16f);
|
||||
float fireballVelocity = (Main.player[Main.npc[(int)npc.ai[2]].target].Calamity().ZoneAbyssLayer4 ? 6f : 8f) + distanceVelocityBoost;
|
||||
Vector2 destination = Main.player[Main.npc[(int)npc.ai[2]].target].Center - npc.Center;
|
||||
Vector2 velocity = destination.SafeNormalize(Vector2.UnitX * npc.spriteDirection) * fireballVelocity;
|
||||
Vector2 velocity = Vector2.Normalize(destination) * fireballVelocity;
|
||||
int type = ProjectileID.CultistBossFireBallClone;
|
||||
int damage = npc.GetProjectileDamage(type);
|
||||
int proj = Projectile.NewProjectile(npc.Center, velocity, type, damage, 0f, Main.myPlayer);
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm
|
||||
float distanceVelocityBoost = MathHelper.Clamp((Vector2.Distance(Main.npc[(int)npc.ai[2]].Center, Main.player[Main.npc[(int)npc.ai[2]].target].Center) - 1600f) * 0.025f, 0f, 16f);
|
||||
float lightVelocity = (Main.player[Main.npc[(int)npc.ai[2]].target].Calamity().ZoneAbyssLayer4 ? 6f : 8f) + distanceVelocityBoost;
|
||||
Vector2 destination = Main.player[Main.npc[(int)npc.ai[2]].target].Center - npc.Center;
|
||||
Vector2 velocity = destination.SafeNormalize(Vector2.UnitX * npc.spriteDirection) * lightVelocity;
|
||||
Vector2 velocity = Vector2.Normalize(destination) * lightVelocity;
|
||||
int type = NPCID.AncientLight;
|
||||
float ai = (Main.rand.NextFloat() - 0.5f) * 0.3f * MathHelper.TwoPi / 60f;
|
||||
int light = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, type, 0, 0f, ai, velocity.X, velocity.Y, 255);
|
||||
|
||||
@@ -483,7 +483,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm
|
||||
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose"), Main.player[Main.myPlayer].Center);
|
||||
|
||||
chargeDestination = destination + chargeVectorFlipped + player.velocity * chargePredictionAmt;
|
||||
npc.velocity = (chargeDestination - npc.Center).SafeNormalize(Vector2.Zero) * baseVelocity;
|
||||
npc.velocity = Vector2.Normalize(chargeDestination - npc.Center) * baseVelocity;
|
||||
npc.netUpdate = true;
|
||||
npc.netSpam -= 5;
|
||||
}
|
||||
@@ -583,7 +583,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm
|
||||
// Predictive bolt
|
||||
Vector2 projectileDestination = targetCenterArray[i] + Main.player[whoAmIArray[i]].velocity * predictionAmt - npc.Center;
|
||||
float ai = Main.rand.Next(100);
|
||||
Vector2 projectileVelocity = projectileDestination.RotatedByRandom(MathHelper.PiOver4).SafeNormalize(Vector2.UnitX * npc.spriteDirection) * lightningVelocity;
|
||||
Vector2 projectileVelocity = Vector2.Normalize(projectileDestination.RotatedByRandom(MathHelper.PiOver4)) * lightningVelocity;
|
||||
int type = ProjectileID.CultistBossLightningOrbArc;
|
||||
int damage = npc.GetProjectileDamage(type);
|
||||
int proj = Projectile.NewProjectile(npc.Center, projectileVelocity, type, damage, 0f, Main.myPlayer, projectileDestination.ToRotation(), ai);
|
||||
@@ -592,14 +592,14 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm
|
||||
// Opposite bolt
|
||||
projectileDestination = targetCenterArray[i] - Main.player[whoAmIArray[i]].velocity * predictionAmt - npc.Center;
|
||||
ai = Main.rand.Next(100);
|
||||
projectileVelocity = projectileDestination.RotatedByRandom(MathHelper.PiOver4).SafeNormalize(Vector2.UnitX * npc.spriteDirection) * lightningVelocity;
|
||||
projectileVelocity = Vector2.Normalize(projectileDestination.RotatedByRandom(MathHelper.PiOver4)) * lightningVelocity;
|
||||
proj = Projectile.NewProjectile(npc.Center, projectileVelocity, type, damage, 0f, Main.myPlayer, projectileDestination.ToRotation(), ai);
|
||||
Main.projectile[proj].tileCollide = false;
|
||||
|
||||
// Normal bolt
|
||||
projectileDestination = targetCenterArray[i] - npc.Center;
|
||||
ai = Main.rand.Next(100);
|
||||
projectileVelocity = projectileDestination.RotatedByRandom(MathHelper.PiOver4).SafeNormalize(Vector2.UnitX * npc.spriteDirection) * lightningVelocity;
|
||||
projectileVelocity = Vector2.Normalize(projectileDestination.RotatedByRandom(MathHelper.PiOver4)) * lightningVelocity;
|
||||
proj = Projectile.NewProjectile(npc.Center, projectileVelocity, type, damage, 0f, Main.myPlayer, projectileDestination.ToRotation(), ai);
|
||||
Main.projectile[proj].tileCollide = false;
|
||||
}
|
||||
@@ -614,7 +614,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm
|
||||
Vector2 dustPosition = new Vector2(-npc.width * 0.2f * npc.scale, 0f).RotatedBy(rotation * ((float)Math.PI * 2f)).RotatedBy(npc.velocity.ToRotation());
|
||||
int dust = Dust.NewDust(npc.Center - Vector2.One * 5f, 10, 10, 226, (0f - npc.velocity.X) / 3f, (0f - npc.velocity.Y) / 3f, 150, Color.Transparent, 0.7f);
|
||||
Main.dust[dust].position = npc.Center + dustPosition;
|
||||
Main.dust[dust].velocity = (Main.dust[dust].position - npc.Center).SafeNormalize(Vector2.Zero) * 2f;
|
||||
Main.dust[dust].velocity = Vector2.Normalize(Main.dust[dust].position - npc.Center) * 2f;
|
||||
Main.dust[dust].noGravity = true;
|
||||
|
||||
rotation = MathHelper.Clamp((float)Main.rand.NextDouble() * 1f - 0.5f, -0.5f, 0.5f);
|
||||
@@ -662,7 +662,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm
|
||||
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose"), Main.player[Main.myPlayer].Center);
|
||||
|
||||
chargeDestination = destination + chargeVectorFlipped + player.velocity * chargePredictionAmt;
|
||||
npc.velocity = (chargeDestination - npc.Center).SafeNormalize(Vector2.Zero) * baseVelocity;
|
||||
npc.velocity = Vector2.Normalize(chargeDestination - npc.Center) * baseVelocity;
|
||||
npc.netUpdate = true;
|
||||
npc.netSpam -= 5;
|
||||
}
|
||||
@@ -770,7 +770,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm
|
||||
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose"), Main.player[Main.myPlayer].Center);
|
||||
|
||||
chargeDestination = destination + chargeVectorFlipped + player.velocity * chargePredictionAmt;
|
||||
npc.velocity = (chargeDestination - npc.Center).SafeNormalize(Vector2.Zero) * baseVelocity;
|
||||
npc.velocity = Vector2.Normalize(chargeDestination - npc.Center) * baseVelocity;
|
||||
npc.netUpdate = true;
|
||||
npc.netSpam -= 5;
|
||||
}
|
||||
@@ -864,19 +864,19 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm
|
||||
{
|
||||
// Predictive mist
|
||||
Vector2 projectileDestination = targetCenterArray[i] + Main.player[whoAmIArray[i]].velocity * predictionAmt - npc.Center;
|
||||
Vector2 projectileVelocity = projectileDestination.SafeNormalize(Vector2.UnitX * npc.spriteDirection) * iceMistVelocity;
|
||||
Vector2 projectileVelocity = Vector2.Normalize(projectileDestination) * iceMistVelocity;
|
||||
int type = ProjectileID.CultistBossIceMist;
|
||||
int damage = npc.GetProjectileDamage(type);
|
||||
Projectile.NewProjectile(npc.Center, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 1f);
|
||||
|
||||
// Opposite mist
|
||||
projectileDestination = targetCenterArray[i] - Main.player[whoAmIArray[i]].velocity * predictionAmt - npc.Center;
|
||||
projectileVelocity = projectileDestination.SafeNormalize(Vector2.UnitX * npc.spriteDirection) * iceMistVelocity;
|
||||
projectileVelocity = Vector2.Normalize(projectileDestination) * iceMistVelocity;
|
||||
Projectile.NewProjectile(npc.Center, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 1f);
|
||||
|
||||
// Normal bolt
|
||||
projectileDestination = targetCenterArray[i] - npc.Center;
|
||||
projectileVelocity = projectileDestination.SafeNormalize(Vector2.UnitX * npc.spriteDirection) * iceMistVelocity;
|
||||
projectileVelocity = Vector2.Normalize(projectileDestination) * iceMistVelocity;
|
||||
Projectile.NewProjectile(npc.Center, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 1f);
|
||||
}
|
||||
}
|
||||
@@ -889,7 +889,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm
|
||||
Vector2 dustPosition = new Vector2(-npc.width * 0.2f * npc.scale, 0f).RotatedBy(rotation * ((float)Math.PI * 2f)).RotatedBy(npc.velocity.ToRotation());
|
||||
int dust = Dust.NewDust(npc.Center - Vector2.One * 5f, 10, 10, 197, 0f, 0f, 100, Color.Transparent);
|
||||
Main.dust[dust].position = npc.Center + dustPosition;
|
||||
Main.dust[dust].velocity = (Main.dust[dust].position - npc.Center).SafeNormalize(Vector2.Zero) * 2f;
|
||||
Main.dust[dust].velocity = Vector2.Normalize(Main.dust[dust].position - npc.Center) * 2f;
|
||||
Main.dust[dust].noGravity = true;
|
||||
|
||||
rotation = MathHelper.Clamp((float)Main.rand.NextDouble() * 1f - 0.5f, -0.5f, 0.5f);
|
||||
@@ -1044,7 +1044,7 @@ namespace CalamityMod.NPCs.AdultEidolonWyrm
|
||||
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/EidolonWyrmRoarClose"), Main.player[Main.myPlayer].Center);
|
||||
|
||||
chargeDestination = destination + lightningChargeVectorFlipped + player.velocity * chargePredictionAmt;
|
||||
npc.velocity = (chargeDestination - npc.Center).SafeNormalize(Vector2.Zero) * baseVelocity;
|
||||
npc.velocity = Vector2.Normalize(chargeDestination - npc.Center) * baseVelocity;
|
||||
npc.netUpdate = true;
|
||||
npc.netSpam -= 5;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user