From d161bead1a20232c2e17900711bc31da986cc004 Mon Sep 17 00:00:00 2001 From: mountaindrew10 Date: Wed, 11 May 2022 16:17:10 -0500 Subject: [PATCH] 1 - Respawn timer is 3 seconds if no bosses are alive and no events are active. Respawn timer is 6 seconds if no bosses are alive and an event is active. 2 - Edited several projectile spread calculations. 3 - Fixed an SCal dart spread attack. 4 - Gave SCal smoother movement. 5 - Queen Slime AI adjustments. 6 - Skeletron Prime movement adjustments. 7 - Ceaseless Void movement adjustments. 8 - Fairies now properly fly away if you take off the Fairy Boots while they're flying near you. --- CalPlayer/CalamityPlayer.cs | 10 +- Items/Weapons/Magic/ClothiersWrath.cs | 6 +- Items/Weapons/Melee/GaelsGreatsword.cs | 2 +- Items/Weapons/Ranged/BrimstoneFury.cs | 6 +- Items/Weapons/Rogue/DuneHopper.cs | 6 +- NPCs/CalamityAI.cs | 50 +- NPCs/CalamityGlobalNPC.cs | 6 +- NPCs/NormalNPCs/KingSlimeJewel.cs | 6 +- NPCs/SupremeCalamitas/SupremeCalamitas.cs | 676 +++++++----------- NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs | 6 +- .../Bosses/QueenSlimeAI.cs | 70 +- .../Bosses/SkeletronPrimeAI.cs | 139 ++-- Projectiles/CalamityGlobalProjectile.cs | 106 ++- Projectiles/Ranged/BrimstoneBolt.cs | 21 +- 14 files changed, 487 insertions(+), 623 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 27fbbe485d..bf7506d9bf 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -2582,12 +2582,12 @@ namespace CalamityMod.CalPlayer Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f); } - if (Player.respawnTimer > 300) + // Respawn the player faster if no bosses are alive + if (!areThereAnyDamnBosses) { - if (CalamityWorld.armageddon && !areThereAnyDamnBosses) - Player.respawnTimer -= 5; - else if (Main.expertMode) // 600 normal 900 expert - Player.respawnTimer--; + int respawnTimerSet = areThereAnyDamnEvents ? 360 : 180; + if (Player.respawnTimer > respawnTimerSet) + Player.respawnTimer = respawnTimerSet; } } #endregion diff --git a/Items/Weapons/Magic/ClothiersWrath.cs b/Items/Weapons/Magic/ClothiersWrath.cs index e8d0294b42..e1e77e9f46 100644 --- a/Items/Weapons/Magic/ClothiersWrath.cs +++ b/Items/Weapons/Magic/ClothiersWrath.cs @@ -38,11 +38,11 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int numProj = 2; + int numProj = 3; float rotation = MathHelper.ToRadians(2); - for (int i = 0; i < numProj + 1; i++) + for (int i = 0; i < numProj; i++) { - Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); int proj = Projectile.NewProjectile(source, position, perturbedSpeed, type, damage, knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().forceMagic = true; diff --git a/Items/Weapons/Melee/GaelsGreatsword.cs b/Items/Weapons/Melee/GaelsGreatsword.cs index 902c4a9a64..0f3425c255 100644 --- a/Items/Weapons/Melee/GaelsGreatsword.cs +++ b/Items/Weapons/Melee/GaelsGreatsword.cs @@ -132,7 +132,7 @@ namespace CalamityMod.Items.Weapons.Melee float rotation = MathHelper.ToRadians(10f); for (int i = 0; i < numProj; i++) { - Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); Projectile.NewProjectile(source, position, perturbedSpeed, type, damage, knockback, player.whoAmI); } break; diff --git a/Items/Weapons/Ranged/BrimstoneFury.cs b/Items/Weapons/Ranged/BrimstoneFury.cs index 44890baa12..8daf79dcbd 100644 --- a/Items/Weapons/Ranged/BrimstoneFury.cs +++ b/Items/Weapons/Ranged/BrimstoneFury.cs @@ -42,11 +42,11 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int numProj = 2; + int numProj = 3; float rotation = MathHelper.ToRadians(2); - for (int i = 0; i < numProj + 1; i++) + for (int i = 0; i < numProj; i++) { - Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); if (type == ProjectileID.WoodenArrowFriendly) Projectile.NewProjectile(source, position, perturbedSpeed, ModContent.ProjectileType(), damage, knockback, player.whoAmI); diff --git a/Items/Weapons/Rogue/DuneHopper.cs b/Items/Weapons/Rogue/DuneHopper.cs index 28ee1c1df3..c3d8bcec4a 100644 --- a/Items/Weapons/Rogue/DuneHopper.cs +++ b/Items/Weapons/Rogue/DuneHopper.cs @@ -45,11 +45,11 @@ Stealth strikes throw three high speed spears"); { if (player.Calamity().StealthStrikeAvailable()) { - int numProj = 2; + int numProj = 3; float rotation = MathHelper.ToRadians(3); - for (int i = 0; i < numProj + 1; i++) + for (int i = 0; i < numProj; i++) { - Vector2 perturbedSpeed = new Vector2(velocity.X - 3f, velocity.Y - 3f).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Vector2 perturbedSpeed = new Vector2(velocity.X - 3f, velocity.Y - 3f).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); int stealth = Projectile.NewProjectile(source, position, perturbedSpeed, ModContent.ProjectileType(), Math.Max(damage / 3, 1), knockback, player.whoAmI); if (stealth.WithinBounds(Main.maxProjectiles)) Main.projectile[stealth].Calamity().stealthStrike = true; diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index 3bc5d44b8a..9bebf63bea 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -4292,7 +4292,7 @@ namespace CalamityMod.NPCs acceleration *= 2f; } - Vector2 moveTo = new Vector2(player.Center.X - vector.X, player.Center.Y - vector.Y); + Vector2 destination = player.Center; // Move between 8 different positions around the player, in order float maxDistance = 320f; @@ -4343,38 +4343,28 @@ namespace CalamityMod.NPCs } } - moveTo += moveToOffset; + destination += moveToOffset; - float distance = (float)Math.Sqrt(moveTo.X * moveTo.X + moveTo.Y * moveTo.Y); + // How far Ceaseless Void is from where it's supposed to be + Vector2 distanceFromDestination = destination - npc.Center; - distance = velocity / distance; - moveTo.X *= distance; - moveTo.Y *= distance; + // Inverse lerp returns the percentage of progress between A and B + float lerpValue = Utils.GetLerpValue(0f, 2400f, distanceFromDestination.Length(), true); - if (npc.velocity.X < moveTo.X) - { - npc.velocity.X += acceleration; - if (npc.velocity.X < 0f && moveTo.X > 0f) - npc.velocity.X += acceleration; - } - else if (npc.velocity.X > moveTo.X) - { - npc.velocity.X -= acceleration; - if (npc.velocity.X > 0f && moveTo.X < 0f) - npc.velocity.X -= acceleration; - } - if (npc.velocity.Y < moveTo.Y) - { - npc.velocity.Y += acceleration; - if (npc.velocity.Y < 0f && moveTo.Y > 0f) - npc.velocity.Y += acceleration; - } - else if (npc.velocity.Y > moveTo.Y) - { - npc.velocity.Y -= acceleration; - if (npc.velocity.Y > 0f && moveTo.Y < 0f) - npc.velocity.Y -= acceleration; - } + // Min velocity + float minVelocity = distanceFromDestination.Length(); + float minVelocityCap = velocity; + if (minVelocity > minVelocityCap) + minVelocity = minVelocityCap; + + // Max velocity + Vector2 maxVelocity = distanceFromDestination / 24f; + float maxVelocityCap = minVelocityCap * 3f; + if (maxVelocity.Length() > maxVelocityCap) + maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; + + Vector2 desiredVelocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); + npc.SimpleFlyMovement(desiredVelocity, acceleration); } // Spawn more Dark Energies as the fight progresses diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index e282613434..e178833980 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3449,7 +3449,7 @@ namespace CalamityMod.NPCs } // Fairies don't run away and are immune to damage while wearing Fairy Boots. - if (npc.type >= NPCID.FairyCritterPink && npc.type <= NPCID.FairyCritterBlue && npc.ai[2] < 2f) + if (npc.type >= NPCID.FairyCritterPink && npc.type <= NPCID.FairyCritterBlue && (npc.ai[2] < 2f || npc.ai[2] == 7f)) { npc.TargetClosest(); if (Main.player[npc.target].Calamity().fairyBoots) @@ -3461,8 +3461,8 @@ namespace CalamityMod.NPCs return true; } - // Set this to 1 so that the CheckActive shit never runs and thus the faries don't randomly vanish. - npc.ai[2] = 1f; + // Set this to 7 so that they run away when the player takes off their Fairy Boots. + npc.ai[2] = 7f; npc.lavaImmune = true; npc.dontTakeDamage = true; diff --git a/NPCs/NormalNPCs/KingSlimeJewel.cs b/NPCs/NormalNPCs/KingSlimeJewel.cs index 32b38e2078..da41cb58ed 100644 --- a/NPCs/NormalNPCs/KingSlimeJewel.cs +++ b/NPCs/NormalNPCs/KingSlimeJewel.cs @@ -140,11 +140,11 @@ namespace CalamityMod.NPCs.NormalNPCs int damage = NPC.GetProjectileDamage(type); if (CalamityWorld.death || BossRushEvent.BossRushActive) { - int numProj = 2; + int numProj = 3; float rotation = MathHelper.ToRadians(9); - for (int i = 0; i < numProj + 1; i++) + for (int i = 0; i < numProj; i++) { - Vector2 perturbedSpeed = projVector.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Vector2 perturbedSpeed = projVector.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); Projectile.NewProjectile(NPC.GetSource_FromAI(), npcPos, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, 0f); } } diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 26f1656ad1..17f1acf6ad 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -373,6 +373,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + // Percent life remaining + float lifeRatio = NPC.life / (float)NPC.lifeMax; + // Projectile damage values int bulletHellblastDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()); int firstBulletHellblastDamage = (int)Math.Round(bulletHellblastDamage * 1.25); @@ -430,7 +433,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.ai[0] == 1f || NPC.ai[0] == 2f; // Make the shield and forcefield fade away in SCal's acceptance phase. - if (NPC.life <= NPC.lifeMax * 0.01) + if (lifeRatio <= 0.01f) { shieldOpacity = MathHelper.Lerp(shieldOpacity, 0f, 0.08f); forcefieldScale = MathHelper.Lerp(forcefieldScale, 0f, 0.08f); @@ -549,7 +552,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas #region Enrage and DR if ((spawnArena && !player.Hitbox.Intersects(safeBox)) || malice) { - float projectileVelocityMultCap = !player.Hitbox.Intersects(safeBox) && spawnArena ? 2f : 1.5f; + float projectileVelocityMultCap = (!player.Hitbox.Intersects(safeBox) && spawnArena) ? 2f : 1.5f; uDieLul = MathHelper.Clamp(uDieLul * 1.01f, 1f, projectileVelocityMultCap); protectionBoost = !malice; } @@ -787,7 +790,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas FrameType = FrameAnimationType.Casting; return; } - if (!startSecondAttack && (NPC.life <= NPC.lifeMax * 0.75)) + if (!startSecondAttack && lifeRatio <= 0.75f) { if (!BossRushEvent.BossRushActive) { @@ -848,7 +851,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas FrameType = FrameAnimationType.Casting; return; } - if (!startThirdAttack && (NPC.life <= NPC.lifeMax * 0.5)) + if (!startThirdAttack && lifeRatio <= 0.5f) { // Switch from the Grief section of Stained, Brutal Calamity to the Lament section. Music = CalamityMod.Instance.GetMusicFromMusicMod("SupremeCalamitas2") ?? MusicID.Boss3; @@ -921,7 +924,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas FrameType = FrameAnimationType.Casting; return; } - if (!startFourthAttack && (NPC.life <= NPC.lifeMax * 0.3)) + if (!startFourthAttack && lifeRatio <= 0.3f) { // Switch from the Lament section of Stained, Brutal Calamity to the Epiphany section. Music = CalamityMod.Instance.GetMusicFromMusicMod("SupremeCalamitas3") ?? MusicID.LunarBoss; @@ -994,7 +997,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas FrameType = FrameAnimationType.Casting; return; } - if (!startFifthAttack && (NPC.life <= NPC.lifeMax * 0.1)) + if (!startFifthAttack && lifeRatio <= 0.1f) { string key = "Mods.CalamityMod.SCalBH5Text"; @@ -1079,7 +1082,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.dontTakeDamage = true; return; } - if (!gettingTired5 && (NPC.life <= NPC.lifeMax * 0.01)) + if (!gettingTired5 && lifeRatio <= 0.01f) { for (int x = 0; x < Main.maxProjectiles; x++) { @@ -1101,7 +1104,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas gettingTired5 = true; return; } - else if (!gettingTired4 && (NPC.life <= NPC.lifeMax * 0.02)) + else if (!gettingTired4 && lifeRatio <= 0.02f) { if (!BossRushEvent.BossRushActive) { @@ -1113,7 +1116,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas gettingTired4 = true; return; } - else if (!gettingTired3 && (NPC.life <= NPC.lifeMax * 0.04)) + else if (!gettingTired3 && lifeRatio <= 0.04f) { if (!BossRushEvent.BossRushActive) { @@ -1125,7 +1128,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas gettingTired3 = true; return; } - else if (!gettingTired2 && (NPC.life <= NPC.lifeMax * 0.06)) + else if (!gettingTired2 && lifeRatio <= 0.06f) { if (!BossRushEvent.BossRushActive) { @@ -1137,7 +1140,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas gettingTired2 = true; return; } - else if (!gettingTired && (NPC.life <= NPC.lifeMax * 0.08)) + else if (!gettingTired && lifeRatio <= 0.08f) { attackCastDelay = sepulcherSpawnCastTime; for (int i = 0; i < 40; i++) @@ -1194,7 +1197,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } #endregion #region TransformSeekerandBrotherTriggers - if (!halfLife && (NPC.life <= NPC.lifeMax * 0.4)) + if (!halfLife && lifeRatio <= 0.4f) { if (!BossRushEvent.BossRushActive) { @@ -1206,7 +1209,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas halfLife = true; } - if (NPC.life <= NPC.lifeMax * 0.2) + if (lifeRatio <= 0.2f) { if (!secondStage) { @@ -1239,7 +1242,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } if (NPC.life > 0) { - if (NPC.life < NPC.lifeMax * 0.45f && !enteredBrothersPhase) + if (lifeRatio < 0.45f && !enteredBrothersPhase) { enteredBrothersPhase = true; attackCastDelay = brothersSpawnCastTime; @@ -1375,51 +1378,43 @@ namespace CalamityMod.NPCs.SupremeCalamitas { if (NPC.ai[1] == 0f) { - float num823 = 12f; - float num824 = 0.12f; + // How fast SCal moves to the destination + float velocity = 12f; + float acceleration = 0.12f; // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = player.inventory[player.selectedItem]; if (targetSelectedItem.DamageType == DamageClass.Melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) { - num824 *= 0.5f; + acceleration *= 0.5f; } - Vector2 vector82 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - float num825 = player.position.X + (player.width / 2) - vector82.X; - float num826 = player.position.Y + (player.height / 2) - 550f - vector82.Y; - float num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); + // This is where SCal should be + Vector2 destination = new Vector2(player.Center.X, player.Center.Y - 550f); - num827 = num823 / num827; - num825 *= num827; - num826 *= num827; + // How far SCal is from where she's supposed to be + Vector2 distanceFromDestination = destination - NPC.Center; + // Movement if (!canDespawn) { - if (NPC.velocity.X < num825) - { - NPC.velocity.X += num824; - if (NPC.velocity.X < 0f && num825 > 0f) - NPC.velocity.X += num824; - } - else if (NPC.velocity.X > num825) - { - NPC.velocity.X -= num824; - if (NPC.velocity.X > 0f && num825 < 0f) - NPC.velocity.X -= num824; - } - if (NPC.velocity.Y < num826) - { - NPC.velocity.Y += num824; - if (NPC.velocity.Y < 0f && num826 > 0f) - NPC.velocity.Y += num824; - } - else if (NPC.velocity.Y > num826) - { - NPC.velocity.Y -= num824; - if (NPC.velocity.Y > 0f && num826 < 0f) - NPC.velocity.Y -= num824; - } + // Inverse lerp returns the percentage of progress between A and B + float lerpValue = Utils.GetLerpValue(0f, 2400f, distanceFromDestination.Length(), true); + + // Min velocity + float minVelocity = distanceFromDestination.Length(); + float minVelocityCap = velocity; + if (minVelocity > minVelocityCap) + minVelocity = minVelocityCap; + + // Max velocity + Vector2 maxVelocity = distanceFromDestination / 24f; + float maxVelocityCap = minVelocityCap * 3f; + if (maxVelocity.Length() > maxVelocityCap) + maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; + + Vector2 desiredVelocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); + NPC.SimpleFlyMovement(desiredVelocity, acceleration); } NPC.ai[2] += 1f; @@ -1430,45 +1425,27 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.netUpdate = true; } - vector82 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - num825 = player.position.X + (player.width / 2) - vector82.X; - num826 = player.position.Y + (player.height / 2) - vector82.Y; + Vector2 projectileVelocity = player.Center - NPC.Center; + projectileVelocity.Normalize(); + Vector2 projectileSpawn = NPC.Center + projectileVelocity * 8f; + projectileVelocity *= 10f * uDieLul; NPC.localAI[1] += wormAlive ? 0.5f : 1f; if (NPC.localAI[1] > 90f) { NPC.localAI[1] = 0f; - float num828 = 10f * uDieLul; - Vector2 value9 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - float num180 = player.position.X + player.width * 0.5f - value9.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = player.position.Y + player.height * 0.5f - value9.Y - num181; - float num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); - - num183 = num828 / num183; - num180 *= num183; - num182 *= num183; - value9.X += num180; - value9.Y += num182; - int randomShot = Main.rand.Next(6); if (randomShot == 0 && canFireSplitingFireball) { canFireSplitingFireball = false; randomShot = ModContent.ProjectileType(); SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/SCalSounds/BrimstoneBigShoot"), NPC.Center); - num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); - num827 = num828 / num827; - num825 *= num827; - num826 *= num827; - vector82.X += num825 * 8f; - vector82.Y += num826 * 8f; for (int i = 0; i < 15; i++) { - Dust magic = Dust.NewDustPerfect(value9, 264); - magic.velocity = new Vector2(num180, num182).RotatedByRandom(0.36f) * Main.rand.NextFloat(0.9f, 1.1f); + Dust magic = Dust.NewDustPerfect(projectileSpawn, 264); + magic.velocity = projectileVelocity.RotatedByRandom(0.36f) * Main.rand.NextFloat(0.9f, 1.1f); magic.color = Color.OrangeRed; magic.scale = 1.2f; magic.fadeIn = 0.6f; @@ -1478,7 +1455,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.netMode != NetmodeID.MultiplayerClient) { - Projectile.NewProjectile(NPC.GetSource_FromAI(), vector82.X, vector82.Y, num825, num826, randomShot, fireblastDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, randomShot, fireblastDamage, 0f, Main.myPlayer); NPC.netUpdate = true; } } @@ -1487,17 +1464,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas canFireSplitingFireball = false; randomShot = ModContent.ProjectileType(); SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/SCalSounds/BrimstoneShoot"), NPC.Center); - num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); - num827 = num828 / num827; - num825 *= num827; - num826 *= num827; - vector82.X += num825 * 8f; - vector82.Y += num826 * 8f; for (int i = 0; i < 20; i++) { - Dust magic = Dust.NewDustPerfect(value9, (int)CalamityDusts.Brimstone); - magic.velocity = new Vector2(num180, num182).RotatedByRandom(0.36f) * Main.rand.NextFloat(0.9f, 1.1f) * 1.3f; + Dust magic = Dust.NewDustPerfect(projectileSpawn, (int)CalamityDusts.Brimstone); + magic.velocity = projectileVelocity.RotatedByRandom(0.36f) * Main.rand.NextFloat(0.9f, 1.1f) * 1.3f; magic.color = Color.Red; magic.scale = 1.425f; magic.fadeIn = 0.75f; @@ -1507,7 +1478,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.netMode != NetmodeID.MultiplayerClient) { - Projectile.NewProjectile(NPC.GetSource_FromAI(), vector82.X, vector82.Y, num825, num826, randomShot, gigablastDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, randomShot, gigablastDamage, 0f, Main.myPlayer); NPC.netUpdate = true; } } @@ -1516,22 +1487,16 @@ namespace CalamityMod.NPCs.SupremeCalamitas canFireSplitingFireball = true; randomShot = ModContent.ProjectileType(); SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/SCalSounds/BrimstoneBigShoot"), NPC.Center); - for (int num186 = 0; num186 < 8; num186++) + float rotation = MathHelper.ToRadians(20); + int numProj = 8; + for (int j = 0; j < numProj; j++) { - num180 = player.position.X + player.width * 0.5f - value9.X; - num182 = player.position.Y + player.height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); - float speedBoost = num186 > 3 ? -(num186 - 3) : num186; - num183 = (8f + speedBoost) / num183; - num180 *= num183; - num182 *= num183; - for (int i = 0; i < 7; i++) { - Vector2 magicDustVelocity = new Vector2(num180 + speedBoost, num182 + speedBoost); + Vector2 magicDustVelocity = projectileVelocity; magicDustVelocity *= MathHelper.Lerp(0.3f, 1f, i / 7f); - Dust magic = Dust.NewDustPerfect(value9, 264); + Dust magic = Dust.NewDustPerfect(projectileSpawn, 264); magic.velocity = magicDustVelocity; magic.color = Color.Red; magic.scale = MathHelper.Lerp(0.85f, 1.5f, i / 7f); @@ -1542,7 +1507,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.netMode != NetmodeID.MultiplayerClient) { - Projectile.NewProjectile(NPC.GetSource_FromAI(), value9.X, value9.Y, num180 + speedBoost, num182 + speedBoost, randomShot, barrageDamage, 0f, Main.myPlayer, 0f, 0f); + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, j / (float)(numProj - 1))); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, perturbedSpeed, randomShot, barrageDamage, 0f, Main.myPlayer); NPC.netUpdate = true; } } @@ -1553,28 +1519,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas } else if (NPC.ai[1] == 1f) { - float num383 = wormAlive ? 26f : 30f; - if (NPC.life < NPC.lifeMax * 0.95) - num383 += 1f; - if (NPC.life < NPC.lifeMax * 0.85) - num383 += 1f; - if (NPC.life < NPC.lifeMax * 0.7) - num383 += 1f; - if (NPC.life < NPC.lifeMax * 0.6) - num383 += 1f; - if (NPC.life < NPC.lifeMax * 0.5) - num383 += 1f; - - Vector2 vector37 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - float num384 = player.position.X + (player.width / 2) - vector37.X; - float num385 = player.position.Y + (player.height / 2) - vector37.Y; - float num386 = (float)Math.Sqrt(num384 * num384 + num385 * num385); - num386 = num383 / num386; + float chargeVelocity = (wormAlive ? 26f : 30f) + (1f - lifeRatio) * 8f; if (!canDespawn) { - NPC.velocity.X = num384 * num386; - NPC.velocity.Y = num385 * num386; + Vector2 vector = Vector2.Normalize(player.Center - NPC.Center); + NPC.velocity = vector * chargeVelocity; + shieldRotation = NPC.velocity.ToRotation(); NPC.netUpdate = true; @@ -1589,6 +1540,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Math.Abs(NPC.velocity.X) > 0.15f) NPC.spriteDirection = (NPC.velocity.X < 0f).ToDirectionInt(); + if (NPC.ai[2] >= 25f) { if (!canDespawn) @@ -1627,58 +1579,51 @@ namespace CalamityMod.NPCs.SupremeCalamitas } else if (NPC.ai[1] == 3f) { - float num412 = 32f; - float num413 = 1.2f; + // How fast SCal moves to the destination + float velocity = 32f; + float acceleration = 1.2f; // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = player.inventory[player.selectedItem]; if (targetSelectedItem.DamageType == DamageClass.Melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) { - num413 *= 0.5f; + acceleration *= 0.5f; } - int num414 = 1; + int posX = 1; if (NPC.position.X + (NPC.width / 2) < player.position.X + player.width) - num414 = -1; + posX = -1; - Vector2 handPosition = NPC.Center + new Vector2(NPC.spriteDirection * -18f, 2f); - Vector2 vector40 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - float num415 = player.position.X + (player.width / 2) + (num414 * 600) - vector40.X; - float num416 = player.position.Y + (player.height / 2) - vector40.Y; - float num417 = (float)Math.Sqrt(num415 * num415 + num416 * num416); + // This is where SCal should be + Vector2 destination = new Vector2(player.Center.X + posX * 600f, player.Center.Y); - num417 = num412 / num417; - num415 *= num417; - num416 *= num417; + // How far SCal is from where she's supposed to be + Vector2 distanceFromDestination = destination - NPC.Center; + // Movement if (!canDespawn) { - if (NPC.velocity.X < num415) - { - NPC.velocity.X += num413; - if (NPC.velocity.X < 0f && num415 > 0f) - NPC.velocity.X += num413; - } - else if (NPC.velocity.X > num415) - { - NPC.velocity.X -= num413; - if (NPC.velocity.X > 0f && num415 < 0f) - NPC.velocity.X -= num413; - } - if (NPC.velocity.Y < num416) - { - NPC.velocity.Y += num413; - if (NPC.velocity.Y < 0f && num416 > 0f) - NPC.velocity.Y += num413; - } - else if (NPC.velocity.Y > num416) - { - NPC.velocity.Y -= num413; - if (NPC.velocity.Y > 0f && num416 < 0f) - NPC.velocity.Y -= num413; - } + // Inverse lerp returns the percentage of progress between A and B + float lerpValue = Utils.GetLerpValue(0f, 2400f, distanceFromDestination.Length(), true); + + // Min velocity + float minVelocity = distanceFromDestination.Length(); + float minVelocityCap = velocity; + if (minVelocity > minVelocityCap) + minVelocity = minVelocityCap; + + // Max velocity + Vector2 maxVelocity = distanceFromDestination / 24f; + float maxVelocityCap = minVelocityCap * 3f; + if (maxVelocity.Length() > maxVelocityCap) + maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; + + Vector2 desiredVelocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); + NPC.SimpleFlyMovement(desiredVelocity, acceleration); } + Vector2 handPosition = NPC.Center + new Vector2(NPC.spriteDirection * -18f, 2f); + NPC.ai[2] += 1f; if (NPC.ai[2] >= 480f) { @@ -1694,9 +1639,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (NPC.ai[3] >= 20f) { NPC.ai[3] = 0f; - vector40 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - num415 = player.position.X + (player.width / 2) - vector40.X; - num416 = player.position.Y + (player.height / 2) - vector40.Y; SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/SCalSounds/BrimstoneHellblastSound"), NPC.Center); // Release a burst of magic dust along with a brimstone hellblast skull. @@ -1713,15 +1655,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.netMode != NetmodeID.MultiplayerClient) { - float num418 = 10f * uDieLul; - int num420 = ModContent.ProjectileType(); - num417 = (float)Math.Sqrt(num415 * num415 + num416 * num416); - num417 = num418 / num417; - num415 *= num417; - num416 *= num417; - vector40.X += num415 * 2f; - vector40.Y += num416 * 2f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), vector40.X, vector40.Y, num415, num416, num420, hellblastDamage, 0f, Main.myPlayer, 0f, 0f); + Vector2 projectileVelocity = player.Center - NPC.Center; + projectileVelocity.Normalize(); + Vector2 projectileSpawn = NPC.Center + projectileVelocity * 4f; + projectileVelocity *= 10f * uDieLul; + int projectileType = ModContent.ProjectileType(); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, hellblastDamage, 0f, Main.myPlayer); } } } @@ -1739,60 +1678,48 @@ namespace CalamityMod.NPCs.SupremeCalamitas } else if (NPC.ai[1] == 4f) { - int num831 = 1; - if (NPC.position.X + (NPC.width / 2) < player.position.X + player.width) - num831 = -1; - - float num832 = 32f; - float num833 = 1.2f; + // How fast SCal moves to the destination + float velocity = 32f; + float acceleration = 1.2f; // Reduce acceleration if target is holding a true melee weapon - Item targetSelectedItem = player.HeldItem; + Item targetSelectedItem = player.inventory[player.selectedItem]; if (targetSelectedItem.DamageType == DamageClass.Melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) { - num833 *= 0.5f; + acceleration *= 0.5f; } - Vector2 vector83 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - float num834 = player.position.X + (player.width / 2) + (num831 * 750) - vector83.X; //600 - float num835 = player.position.Y + (player.height / 2) - vector83.Y; - float num836 = (float)Math.Sqrt(num834 * num834 + num835 * num835); + int posX = 1; + if (NPC.position.X + (NPC.width / 2) < player.position.X + player.width) + posX = -1; - num836 = num832 / num836; - num834 *= num836; - num835 *= num836; + // This is where SCal should be + Vector2 destination = new Vector2(player.Center.X + posX * 750f, player.Center.Y); + // How far SCal is from where she's supposed to be + Vector2 distanceFromDestination = destination - NPC.Center; + + // Movement if (!canDespawn) { - if (NPC.velocity.X < num834) - { - NPC.velocity.X += num833; - if (NPC.velocity.X < 0f && num834 > 0f) - NPC.velocity.X += num833; - } - else if (NPC.velocity.X > num834) - { - NPC.velocity.X -= num833; - if (NPC.velocity.X > 0f && num834 < 0f) - NPC.velocity.X -= num833; - } - if (NPC.velocity.Y < num835) - { - NPC.velocity.Y += num833; - if (NPC.velocity.Y < 0f && num835 > 0f) - NPC.velocity.Y += num833; - } - else if (NPC.velocity.Y > num835) - { - NPC.velocity.Y -= num833; - if (NPC.velocity.Y > 0f && num835 < 0f) - NPC.velocity.Y -= num833; - } - } + // Inverse lerp returns the percentage of progress between A and B + float lerpValue = Utils.GetLerpValue(0f, 2400f, distanceFromDestination.Length(), true); - vector83 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - num834 = player.position.X + (player.width / 2) - vector83.X; - num835 = player.position.Y + (player.height / 2) - vector83.Y; + // Min velocity + float minVelocity = distanceFromDestination.Length(); + float minVelocityCap = velocity; + if (minVelocity > minVelocityCap) + minVelocity = minVelocityCap; + + // Max velocity + Vector2 maxVelocity = distanceFromDestination / 24f; + float maxVelocityCap = minVelocityCap * 3f; + if (maxVelocity.Length() > maxVelocityCap) + maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; + + Vector2 desiredVelocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); + NPC.SimpleFlyMovement(desiredVelocity, acceleration); + } int shootRate = wormAlive ? 280 : 140; NPC.localAI[1]++; @@ -1819,15 +1746,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.netMode != NetmodeID.MultiplayerClient) { SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/SCalSounds/BrimstoneBigShoot"), NPC.Center); - float num837 = 5f * uDieLul; - int num839 = ModContent.ProjectileType(); - num836 = (float)Math.Sqrt(num834 * num834 + num835 * num835); - num836 = num837 / num836; - num834 *= num836; - num835 *= num836; - vector83.X += num834 * 8f; - vector83.Y += num835 * 8f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), vector83.X, vector83.Y, num834, num835, num839, fireblastDamage, 0f, Main.myPlayer, 0f, 0f); + Vector2 projectileVelocity = player.Center - NPC.Center; + projectileVelocity.Normalize(); + Vector2 projectileSpawn = NPC.Center + projectileVelocity * 8f; + projectileVelocity *= 5f * uDieLul; + int projectileType = ModContent.ProjectileType(); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, fireblastDamage, 0f, Main.myPlayer); } } @@ -1841,7 +1765,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - if (NPC.life < NPC.lifeMax * 0.4) + if (lifeRatio < 0.4f) { NPC.ai[0] = 1f; NPC.ai[1] = 0f; @@ -2029,52 +1953,43 @@ namespace CalamityMod.NPCs.SupremeCalamitas { if (NPC.ai[1] == 0f) { - float num823 = 12f; - float num824 = 0.12f; + // How fast SCal moves to the destination + float velocity = 12f; + float acceleration = 0.12f; // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = player.inventory[player.selectedItem]; if (targetSelectedItem.DamageType == DamageClass.Melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) { - num824 *= 0.5f; + acceleration *= 0.5f; } - Vector2 vector82 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - float num825 = player.position.X + (player.width / 2) - vector82.X; - float num826 = player.position.Y + (player.height / 2) - 550f - vector82.Y; - float num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); + // This is where SCal should be + Vector2 destination = new Vector2(player.Center.X, player.Center.Y - 550f); - num827 = num823 / num827; - num825 *= num827; - num826 *= num827; + // How far SCal is from where she's supposed to be + Vector2 distanceFromDestination = destination - NPC.Center; + // Movement if (!canDespawn) { - if (NPC.velocity.X < num825) - { - NPC.velocity.X += num824; - if (NPC.velocity.X < 0f && num825 > 0f) - NPC.velocity.X += num824; - } - else if (NPC.velocity.X > num825) - { - NPC.velocity.X -= num824; - if (NPC.velocity.X > 0f && num825 < 0f) - NPC.velocity.X -= num824; - } + // Inverse lerp returns the percentage of progress between A and B + float lerpValue = Utils.GetLerpValue(0f, 2400f, distanceFromDestination.Length(), true); - if (NPC.velocity.Y < num826) - { - NPC.velocity.Y += num824; - if (NPC.velocity.Y < 0f && num826 > 0f) - NPC.velocity.Y += num824; - } - else if (NPC.velocity.Y > num826) - { - NPC.velocity.Y -= num824; - if (NPC.velocity.Y > 0f && num826 < 0f) - NPC.velocity.Y -= num824; - } + // Min velocity + float minVelocity = distanceFromDestination.Length(); + float minVelocityCap = velocity; + if (minVelocity > minVelocityCap) + minVelocity = minVelocityCap; + + // Max velocity + Vector2 maxVelocity = distanceFromDestination / 24f; + float maxVelocityCap = minVelocityCap * 3f; + if (maxVelocity.Length() > maxVelocityCap) + maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; + + Vector2 desiredVelocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); + NPC.SimpleFlyMovement(desiredVelocity, acceleration); } NPC.ai[2] += 1f; @@ -2085,45 +2000,27 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.netUpdate = true; } - vector82 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - num825 = player.position.X + (player.width / 2) - vector82.X; - num826 = player.position.Y + (player.height / 2) - vector82.Y; + Vector2 projectileVelocity = player.Center - NPC.Center; + projectileVelocity.Normalize(); + Vector2 projectileSpawn = NPC.Center + projectileVelocity * 8f; + projectileVelocity *= 10f * uDieLul; NPC.localAI[1] += wormAlive ? 0.5f : 1f; if (NPC.localAI[1] > 60f) { NPC.localAI[1] = 0f; - float num828 = 10f * uDieLul; - Vector2 value9 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - float num180 = player.position.X + player.width * 0.5f - value9.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = player.position.Y + player.height * 0.5f - value9.Y - num181; - float num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); - - num183 = num828 / num183; - num180 *= num183; - num182 *= num183; - value9.X += num180; - value9.Y += num182; - int randomShot = Main.rand.Next(6); if (randomShot == 0 && canFireSplitingFireball) { SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/SCalSounds/BrimstoneBigShoot"), NPC.Center); canFireSplitingFireball = false; randomShot = ModContent.ProjectileType(); - num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); - num827 = num828 / num827; - num825 *= num827; - num826 *= num827; - vector82.X += num825 * 8f; - vector82.Y += num826 * 8f; for (int i = 0; i < 16; i++) { - Dust magic = Dust.NewDustPerfect(value9, 264); - magic.velocity = new Vector2(num180, num182).RotatedByRandom(0.36f) * Main.rand.NextFloat(0.9f, 1.1f) * 1.2f; + Dust magic = Dust.NewDustPerfect(projectileSpawn, 264); + magic.velocity = projectileVelocity.RotatedByRandom(0.36f) * Main.rand.NextFloat(0.9f, 1.1f) * 1.2f; magic.color = Color.OrangeRed; magic.scale = 1.3f; magic.fadeIn = 0.6f; @@ -2133,7 +2030,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.netMode != NetmodeID.MultiplayerClient) { - Projectile.NewProjectile(NPC.GetSource_FromAI(), vector82.X, vector82.Y, num825, num826, randomShot, fireblastDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, randomShot, fireblastDamage, 0f, Main.myPlayer); NPC.netUpdate = true; } } @@ -2142,17 +2039,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/SCalSounds/BrimstoneShoot"), NPC.Center); canFireSplitingFireball = false; randomShot = ModContent.ProjectileType(); - num827 = (float)Math.Sqrt(num825 * num825 + num826 * num826); - num827 = num828 / num827; - num825 *= num827; - num826 *= num827; - vector82.X += num825 * 8f; - vector82.Y += num826 * 8f; for (int i = 0; i < 24; i++) { - Dust magic = Dust.NewDustPerfect(value9, (int)CalamityDusts.Brimstone); - magic.velocity = new Vector2(num180, num182).RotatedByRandom(0.36f) * Main.rand.NextFloat(0.9f, 1.1f) * 1.6f; + Dust magic = Dust.NewDustPerfect(projectileSpawn, (int)CalamityDusts.Brimstone); + magic.velocity = projectileVelocity.RotatedByRandom(0.36f) * Main.rand.NextFloat(0.9f, 1.1f) * 1.6f; magic.color = Color.Red; magic.scale = 1.5f; magic.fadeIn = 0.8f; @@ -2162,7 +2053,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.netMode != NetmodeID.MultiplayerClient) { - Projectile.NewProjectile(NPC.GetSource_FromAI(), vector82.X, vector82.Y, num825, num826, randomShot, gigablastDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, randomShot, gigablastDamage, 0f, Main.myPlayer); NPC.netUpdate = true; } } @@ -2171,33 +2062,28 @@ namespace CalamityMod.NPCs.SupremeCalamitas SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/SCalSounds/BrimstoneBigShoot"), NPC.Center); canFireSplitingFireball = true; randomShot = ModContent.ProjectileType(); - for (int num186 = 0; num186 < 8; num186++) + float rotation = MathHelper.ToRadians(20); + int numProj = 8; + for (int j = 0; j < numProj; j++) { - num180 = player.position.X + player.width * 0.5f - value9.X; - num182 = player.position.Y + player.height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt(num180 * num180 + num182 * num182); - float speedBoost = num186 > 3 ? -(num186 - 3) : num186; - num183 = (8f + speedBoost) / num183; - num180 *= num183; - num182 *= num183; - - for (int i = 0; i < 10; i++) + for (int i = 0; i < 7; i++) { - Vector2 magicDustVelocity = new Vector2(num180 + speedBoost, num182 + speedBoost); - magicDustVelocity *= MathHelper.Lerp(0.3f, 1f, i / 10f); + Vector2 magicDustVelocity = projectileVelocity; + magicDustVelocity *= MathHelper.Lerp(0.3f, 1f, i / 7f); - Dust magic = Dust.NewDustPerfect(value9, 264); + Dust magic = Dust.NewDustPerfect(projectileSpawn, 264); magic.velocity = magicDustVelocity; magic.color = Color.Red; - magic.scale = MathHelper.Lerp(0.975f, 1.7f, i / 10f); - magic.fadeIn = 0.9f; + magic.scale = MathHelper.Lerp(0.85f, 1.5f, i / 7f); + magic.fadeIn = 0.67f; magic.noLight = true; magic.noGravity = true; } if (Main.netMode != NetmodeID.MultiplayerClient) { - Projectile.NewProjectile(NPC.GetSource_FromAI(), value9.X, value9.Y, num180 + speedBoost, num182 + speedBoost, randomShot, barrageDamage, 0f, Main.myPlayer, 0f, 0f); + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, j / (float)(numProj - 1))); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, perturbedSpeed, randomShot, barrageDamage, 0f, Main.myPlayer); NPC.netUpdate = true; } } @@ -2206,24 +2092,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas } else if (NPC.ai[1] == 1f) { - float num383 = wormAlive ? 31f : 35f; - if (NPC.life < NPC.lifeMax * 0.3) - num383 += 1f; - if (NPC.life < NPC.lifeMax * 0.2) - num383 += 1f; - if (NPC.life < NPC.lifeMax * 0.1) - num383 += 1f; - - Vector2 vector37 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - float num384 = player.position.X + (player.width / 2) - vector37.X; - float num385 = player.position.Y + (player.height / 2) - vector37.Y; - float num386 = (float)Math.Sqrt(num384 * num384 + num385 * num385); - num386 = num383 / num386; + float chargeVelocity = (wormAlive ? 31f : 35f) + (0.4f - lifeRatio) * 3f; if (!canDespawn) { - NPC.velocity.X = num384 * num386; - NPC.velocity.Y = num385 * num386; + Vector2 vector = Vector2.Normalize(player.Center - NPC.Center); + NPC.velocity = vector * chargeVelocity; + shieldRotation = NPC.velocity.ToRotation(); NPC.netUpdate = true; @@ -2274,58 +2149,51 @@ namespace CalamityMod.NPCs.SupremeCalamitas } else if (NPC.ai[1] == 3f) { - float num412 = 32f; - float num413 = 1.2f; + // How fast SCal moves to the destination + float velocity = 32f; + float acceleration = 1.2f; // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = player.inventory[player.selectedItem]; if (targetSelectedItem.DamageType == DamageClass.Melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) { - num413 *= 0.5f; + acceleration *= 0.5f; } - int num414 = 1; + int posX = 1; if (NPC.position.X + (NPC.width / 2) < player.position.X + player.width) - num414 = -1; + posX = -1; - Vector2 handPosition = NPC.Center + new Vector2(NPC.spriteDirection * -18f, 2f); - Vector2 vector40 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - float num415 = player.position.X + (player.width / 2) + (num414 * 600) - vector40.X; - float num416 = player.position.Y + (player.height / 2) - vector40.Y; - float num417 = (float)Math.Sqrt(num415 * num415 + num416 * num416); + // This is where SCal should be + Vector2 destination = new Vector2(player.Center.X + posX * 600f, player.Center.Y); - num417 = num412 / num417; - num415 *= num417; - num416 *= num417; + // How far SCal is from where she's supposed to be + Vector2 distanceFromDestination = destination - NPC.Center; + // Movement if (!canDespawn) { - if (NPC.velocity.X < num415) - { - NPC.velocity.X += num413; - if (NPC.velocity.X < 0f && num415 > 0f) - NPC.velocity.X += num413; - } - else if (NPC.velocity.X > num415) - { - NPC.velocity.X -= num413; - if (NPC.velocity.X > 0f && num415 < 0f) - NPC.velocity.X -= num413; - } - if (NPC.velocity.Y < num416) - { - NPC.velocity.Y += num413; - if (NPC.velocity.Y < 0f && num416 > 0f) - NPC.velocity.Y += num413; - } - else if (NPC.velocity.Y > num416) - { - NPC.velocity.Y -= num413; - if (NPC.velocity.Y > 0f && num416 < 0f) - NPC.velocity.Y -= num413; - } + // Inverse lerp returns the percentage of progress between A and B + float lerpValue = Utils.GetLerpValue(0f, 2400f, distanceFromDestination.Length(), true); + + // Min velocity + float minVelocity = distanceFromDestination.Length(); + float minVelocityCap = velocity; + if (minVelocity > minVelocityCap) + minVelocity = minVelocityCap; + + // Max velocity + Vector2 maxVelocity = distanceFromDestination / 24f; + float maxVelocityCap = minVelocityCap * 3f; + if (maxVelocity.Length() > maxVelocityCap) + maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; + + Vector2 desiredVelocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); + NPC.SimpleFlyMovement(desiredVelocity, acceleration); } + Vector2 handPosition = NPC.Center + new Vector2(NPC.spriteDirection * -18f, 2f); + NPC.ai[2] += 1f; if (NPC.ai[2] >= 300f) { @@ -2341,9 +2209,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (NPC.ai[3] >= 24f) { NPC.ai[3] = 0f; - vector40 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - num415 = player.position.X + (player.width / 2) - vector40.X; - num416 = player.position.Y + (player.height / 2) - vector40.Y; SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/SCalSounds/BrimstoneHellblastSound"), NPC.Center); // Release a burst of magic dust along with a brimstone hellblast skull. @@ -2360,15 +2225,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.netMode != NetmodeID.MultiplayerClient) { - float num418 = 10f * uDieLul; - int num420 = ModContent.ProjectileType(); - num417 = (float)Math.Sqrt(num415 * num415 + num416 * num416); - num417 = num418 / num417; - num415 *= num417; - num416 *= num417; - vector40.X += num415 * 4f; - vector40.Y += num416 * 4f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), vector40.X, vector40.Y, num415, num416, num420, hellblastDamage, 0f, Main.myPlayer, 0f, 0f); + Vector2 projectileVelocity = player.Center - NPC.Center; + projectileVelocity.Normalize(); + Vector2 projectileSpawn = NPC.Center + projectileVelocity * 4f; + projectileVelocity *= 10f * uDieLul; + int projectileType = ModContent.ProjectileType(); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, hellblastDamage, 0f, Main.myPlayer); } } } @@ -2387,60 +2249,48 @@ namespace CalamityMod.NPCs.SupremeCalamitas } else if (NPC.ai[1] == 4f) { - int num831 = 1; - if (NPC.position.X + (NPC.width / 2) < player.position.X + player.width) - num831 = -1; - - float num832 = 32f; - float num833 = 1.2f; + // How fast SCal moves to the destination + float velocity = 32f; + float acceleration = 1.2f; // Reduce acceleration if target is holding a true melee weapon Item targetSelectedItem = player.inventory[player.selectedItem]; if (targetSelectedItem.DamageType == DamageClass.Melee && (targetSelectedItem.shoot == ProjectileID.None || targetSelectedItem.Calamity().trueMelee)) { - num833 *= 0.5f; + acceleration *= 0.5f; } - Vector2 vector83 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - float num834 = player.position.X + (player.width / 2) + (num831 * 750) - vector83.X; //600 - float num835 = player.position.Y + (player.height / 2) - vector83.Y; - float num836 = (float)Math.Sqrt(num834 * num834 + num835 * num835); + int posX = 1; + if (NPC.position.X + (NPC.width / 2) < player.position.X + player.width) + posX = -1; - num836 = num832 / num836; - num834 *= num836; - num835 *= num836; + // This is where SCal should be + Vector2 destination = new Vector2(player.Center.X + posX * 750f, player.Center.Y); + // How far SCal is from where she's supposed to be + Vector2 distanceFromDestination = destination - NPC.Center; + + // Movement if (!canDespawn) { - if (NPC.velocity.X < num834) - { - NPC.velocity.X += num833; - if (NPC.velocity.X < 0f && num834 > 0f) - NPC.velocity.X += num833; - } - else if (NPC.velocity.X > num834) - { - NPC.velocity.X -= num833; - if (NPC.velocity.X > 0f && num834 < 0f) - NPC.velocity.X -= num833; - } - if (NPC.velocity.Y < num835) - { - NPC.velocity.Y += num833; - if (NPC.velocity.Y < 0f && num835 > 0f) - NPC.velocity.Y += num833; - } - else if (NPC.velocity.Y > num835) - { - NPC.velocity.Y -= num833; - if (NPC.velocity.Y > 0f && num835 < 0f) - NPC.velocity.Y -= num833; - } - } + // Inverse lerp returns the percentage of progress between A and B + float lerpValue = Utils.GetLerpValue(0f, 2400f, distanceFromDestination.Length(), true); - vector83 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); - num834 = player.position.X + (player.width / 2) - vector83.X; - num835 = player.position.Y + (player.height / 2) - vector83.Y; + // Min velocity + float minVelocity = distanceFromDestination.Length(); + float minVelocityCap = velocity; + if (minVelocity > minVelocityCap) + minVelocity = minVelocityCap; + + // Max velocity + Vector2 maxVelocity = distanceFromDestination / 24f; + float maxVelocityCap = minVelocityCap * 3f; + if (maxVelocity.Length() > maxVelocityCap) + maxVelocity = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap; + + Vector2 desiredVelocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); + NPC.SimpleFlyMovement(desiredVelocity, acceleration); + } int shootRate = wormAlive ? 200 : 100; NPC.localAI[1]++; @@ -2470,16 +2320,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.netMode != NetmodeID.MultiplayerClient) { SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/SCalSounds/BrimstoneBigShoot"), NPC.Center); - NPC.localAI[1] = 0f; - float num837 = 5f * uDieLul; - int num839 = ModContent.ProjectileType(); - num836 = (float)Math.Sqrt(num834 * num834 + num835 * num835); - num836 = num837 / num836; - num834 *= num836; - num835 *= num836; - vector83.X += num834 * 8f; - vector83.Y += num835 * 8f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), vector83.X, vector83.Y, num834, num835, num839, fireblastDamage, 0f, Main.myPlayer, 0f, 0f); + Vector2 projectileVelocity = player.Center - NPC.Center; + projectileVelocity.Normalize(); + Vector2 projectileSpawn = NPC.Center + projectileVelocity * 8f; + projectileVelocity *= 5f * uDieLul; + int projectileType = ModContent.ProjectileType(); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, fireblastDamage, 0f, Main.myPlayer); } } diff --git a/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs b/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs index 76083a126f..51c2ee7f1c 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/PlanteraAI.cs @@ -495,18 +495,18 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses } else { - int numProj = 2; int spread = 3 + (int)Math.Round((0.5f - lifeRatio) * 10f); // 3 to 8, wider spread is harder to avoid if (nearbyActiveTiles < 300) spread = Main.rand.Next(3, 7) + (int)Math.Round((0.5f - lifeRatio) * 8f); + int numProj = spread / 2; int type = ProjectileID.PoisonSeedPlantera; int damage = npc.GetProjectileDamage(type); float rotation = MathHelper.ToRadians(spread); - for (int i = 0; i < numProj + 1; i++) + for (int i = 0; i < numProj; i++) { - Vector2 perturbedSpeed = new Vector2(num743, num744).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); + Vector2 perturbedSpeed = new Vector2(num743, num744).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); Projectile.NewProjectile(npc.GetSource_FromAI(), vector93, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, 0f); } diff --git a/NPCs/VanillaNPCOverrides/Bosses/QueenSlimeAI.cs b/NPCs/VanillaNPCOverrides/Bosses/QueenSlimeAI.cs index 3fd51972fb..22d48f42e4 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/QueenSlimeAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/QueenSlimeAI.cs @@ -210,7 +210,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (phase2) idleTime = malice ? 40 : death ? 60 : 80; if (phase4) - idleTime = 0; + idleTime /= 2; if (!(npc.ai[1] > idleTime)) break; @@ -379,7 +379,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.ai[2] == 3f) { npc.velocity.Y = -13f * speedMult; - npc.velocity.X += (malice ? 5.5f : death ? 5f : 4.5f) * npc.direction; + npc.velocity.X += (malice ? 7f : death ? 6f : 5.5f) * npc.direction; npc.ai[1] = 0f; npc.ai[2] = 0f; if (npc.timeLeft > 10) @@ -394,14 +394,14 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.ai[2] == 2f) { npc.velocity.Y = -(malice ? 10f : death ? 8f : 6f) * speedMult; - npc.velocity.X += (malice ? 6.5f : death ? 6f : 5.5f) * npc.direction; + npc.velocity.X += (malice ? 8.5f : death ? 7.5f : 7f) * npc.direction; npc.ai[1] = -40f; npc.ai[2] += 1f; } else { npc.velocity.Y = -(malice ? 12f : death ? 10f : 8f) * speedMult; - npc.velocity.X += (malice ? 6f : death ? 5.5f : 5f) * npc.direction; + npc.velocity.X += (malice ? 7.5f : death ? 6.5f : 6f) * npc.direction; npc.ai[1] = -40f; npc.ai[2] += 1f; } @@ -418,9 +418,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if ((npc.direction == 1 && npc.velocity.X < num19) || (npc.direction == -1 && npc.velocity.X > 0f - num19)) { if ((npc.direction == -1 && npc.velocity.X < 0.1) || (npc.direction == 1 && npc.velocity.X > -0.1)) - npc.velocity.X += 0.2f * npc.direction; + npc.velocity.X += (malice ? 0.5f : death ? 0.35f : 0.3f) * npc.direction; else - npc.velocity.X *= 0.93f; + npc.velocity.X *= malice ? 0.88f : death ? 0.9f : 0.91f; } } break; @@ -449,12 +449,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.velocity.Y == 0f) { - npc.Calamity().newAI[0] = npc.ai[0]; - npc.SyncExtraAI(); - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; SoundEngine.PlaySound(SoundID.Item167, npc.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -465,18 +459,18 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Eruption of crystals in phase 3 if (npc.ai[0] == 6f && phase3) { - float projectileVelocity = 24f; + float projectileVelocity = 12f; type = ProjectileID.QueenSlimeMinionBlueSpike; damage = npc.GetProjectileDamage(type); Vector2 destination = new Vector2(npc.Center.X, npc.Center.Y - 100f) - npc.Center; destination.Normalize(); destination *= projectileVelocity; - int numProj = 30; + int numProj = 18; float rotation = MathHelper.ToRadians(90); - for (int i = 0; i < numProj + 1; i++) + for (int i = 0; i < numProj; i++) { - Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, type, damage, 0f, Main.myPlayer); + Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, type, damage, 0f, Main.myPlayer, 0f, -2f); } } } @@ -488,6 +482,13 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses Main.dust[num21].velocity.Y = -5f + Main.rand.NextFloat() * -3f; Main.dust[num21].velocity.X *= 7f; } + + npc.Calamity().newAI[0] = npc.ai[0]; + npc.SyncExtraAI(); + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.netUpdate = true; } else if (npc.ai[1] >= num20) { @@ -537,8 +538,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.velocity.Y = num24; // Cascade of crystals in phase 3 or 4 while falling down - if (((npc.ai[0] == 4f && phase3) || phase4) && npc.ai[1] % 6f == 0f) + if (((npc.ai[0] == 4f && phase3) || phase4) && npc.ai[1] % 12f == 0f) { + SoundEngine.PlaySound(SoundID.Item154, npc.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { Vector2 fireFrom = npc.Center; @@ -552,7 +554,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses for (int j = 0; j < totalProjectiles; j++) { Vector2 projVelocity = npc.velocity.RotatedBy(radians * j + MathHelper.PiOver2); - Projectile.NewProjectile(npc.GetSource_FromAI(), fireFrom, projVelocity * 2f, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), fireFrom, projVelocity, type, damage, 0f, Main.myPlayer, 0f, -1f); } } } @@ -596,7 +598,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { npc.velocity = center - npc.Center; npc.velocity = npc.velocity.SafeNormalize(Vector2.Zero); - npc.velocity *= 20f; + npc.velocity *= malice ? 30f : death ? 26f : 24f; } else npc.velocity.Y *= 0.95f; @@ -629,13 +631,27 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float projectileVelocity = death ? 12f : 10.5f; int type = ProjectileID.QueenSlimeGelAttack; int damage = npc.GetProjectileDamage(type); - float ai1 = phase2 ? -2f : -1f; - for (int j = 0; j < numGelProjectiles; j++) + if (phase2) { - Vector2 spinningpoint = new Vector2(projectileVelocity, 0f); - spinningpoint = spinningpoint.RotatedBy((-j) * ((float)Math.PI * 2f) / numGelProjectiles, Vector2.Zero); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, spinningpoint.X, spinningpoint.Y, type, damage, 0f, Main.myPlayer, 0f, ai1); - Main.projectile[proj].timeLeft = 900; + Vector2 destination = new Vector2(npc.Center.X, npc.Center.Y + 100f) - npc.Center; + destination.Normalize(); + destination *= projectileVelocity; + float rotation = MathHelper.ToRadians(120); + for (int i = 0; i < numGelProjectiles; i++) + { + Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numGelProjectiles - 1))); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, type, damage, 0f, Main.myPlayer, 0f, -2f); + Main.projectile[proj].timeLeft = 900; + } + } + else + { + for (int j = 0; j < numGelProjectiles; j++) + { + Vector2 spinningpoint = new Vector2(projectileVelocity, 0f); + spinningpoint = spinningpoint.RotatedBy((-j) * ((float)Math.PI * 2f) / numGelProjectiles, Vector2.Zero); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, spinningpoint.X, spinningpoint.Y, type, damage, 0f, Main.myPlayer, 0f, -1f); + } } } @@ -724,7 +740,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.netUpdate = true; } - int num28 = (int)(npc.lifeMax * (phase2 ? 0.03f : 0.015f)); + int num28 = (int)(npc.lifeMax * 0.04f); if (!((npc.life + num28) < npc.localAI[0])) return false; diff --git a/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs b/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs index 957a7cf795..19c8f08810 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/SkeletronPrimeAI.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; using CalamityMod.World; @@ -244,25 +244,12 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses Vector2 value19 = Main.player[npc.target].Center - npc.Center; value19.Normalize(); value19 *= num502; - int numProj = 2; - float rotation = MathHelper.ToRadians(5); - if (malice) + int numProj = malice ? 5 : 3; + float rotation = MathHelper.ToRadians(malice ? 8 : 5); + for (int i = 0; i < numProj; i++) { - rotation = MathHelper.ToRadians(8); - for (int i = 0; i < numProj; i++) - { - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, value19.RotatedBy(-rotation * (i + 1)), type, damage, 0f, Main.myPlayer, 0f, 1f); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, value19.RotatedBy(+rotation * (i + 1)), type, damage, 0f, Main.myPlayer, 0f, 1f); - } - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, value19, type, damage, 0f, Main.myPlayer, 0f, 1f); - } - else - { - for (int i = 0; i < numProj + 1; i++) - { - Vector2 perturbedSpeed = value19.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, 1f); - } + Vector2 perturbedSpeed = value19.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, 1f); } } } @@ -309,20 +296,20 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses acceleration *= 0.5f; } - if (npc.position.Y > Main.player[npc.target].position.Y - 350f) + if (npc.position.Y > Main.player[npc.target].position.Y - 400f) { if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.98f; + npc.velocity.Y *= 0.9f; npc.velocity.Y -= acceleration; if (npc.velocity.Y > velocityY) npc.velocity.Y = velocityY; } - else if (npc.position.Y < Main.player[npc.target].position.Y - 500f) + else if (npc.position.Y < Main.player[npc.target].position.Y - 450f) { if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.98f; + npc.velocity.Y *= 0.9f; npc.velocity.Y += acceleration; @@ -330,20 +317,20 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.velocity.Y = -velocityY; } - if (npc.position.X + (npc.width / 2) > Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) + 150f) + if (npc.position.X + (npc.width / 2) > Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) + 400f) { if (npc.velocity.X > 0f) - npc.velocity.X *= 0.98f; + npc.velocity.X *= 0.9f; npc.velocity.X -= acceleration; if (npc.velocity.X > velocityX) npc.velocity.X = velocityX; } - if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - 150f) + if (npc.position.X + (npc.width / 2) < Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - 400f) { if (npc.velocity.X < 0f) - npc.velocity.X *= 0.98f; + npc.velocity.X *= 0.9f; npc.velocity.X += acceleration; @@ -488,9 +475,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { npc.velocity.Y += 0.1f; if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.95f; + npc.velocity.Y *= 0.9f; - npc.velocity.X *= 0.95f; + npc.velocity.X *= 0.9f; if (npc.timeLeft > 500) npc.timeLeft = 500; @@ -726,7 +713,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 100f) { if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.96f; + npc.velocity.Y *= 0.9f; npc.velocity.Y -= malice ? 0.3f : death ? 0.12f : 0.1f; @@ -736,7 +723,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 100f) { if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.96f; + npc.velocity.Y *= 0.9f; npc.velocity.Y += malice ? 0.3f : death ? 0.12f : 0.1f; @@ -747,7 +734,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 180f * npc.ai[0]) { if (npc.velocity.X > 0f) - npc.velocity.X *= 0.96f; + npc.velocity.X *= 0.9f; npc.velocity.X -= malice ? 0.3f : death ? 0.16f : 0.14f; @@ -757,7 +744,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 180f * npc.ai[0]) { if (npc.velocity.X < 0f) - npc.velocity.X *= 0.96f; + npc.velocity.X *= 0.9f; npc.velocity.X += malice ? 0.3f : death ? 0.16f : 0.14f; @@ -825,7 +812,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses Vector2 vector63 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num513 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - 320f - vector63.X; - float num514 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 160f - vector63.Y; + float num514 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 320f - vector63.Y; float num515 = (float)Math.Sqrt(num513 * num513 + num514 * num514); num515 = 9f / num515; num513 *= num515; @@ -1026,7 +1013,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 150f) { if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.96f; + npc.velocity.Y *= 0.9f; npc.velocity.Y -= malice ? 0.275f : death ? 0.1f : 0.08f; @@ -1036,7 +1023,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 150f) { if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.96f; + npc.velocity.Y *= 0.9f; npc.velocity.Y += malice ? 0.275f : death ? 0.1f : 0.08f; @@ -1047,7 +1034,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) + 200f) { if (npc.velocity.X > 0f) - npc.velocity.X *= 0.96f; + npc.velocity.X *= 0.9f; npc.velocity.X -= malice ? 0.275f : death ? 0.22f : 0.2f; @@ -1057,7 +1044,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) + 160f) { if (npc.velocity.X < 0f) - npc.velocity.X *= 0.96f; + npc.velocity.X *= 0.9f; npc.velocity.X += malice ? 0.275f : death ? 0.22f : 0.2f; @@ -1103,8 +1090,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses { Vector2 vector61 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); float num499 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector61.X; - float num500 = Main.npc[(int)npc.ai[1]].position.Y - vector61.Y; - num500 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 160f - vector61.Y; + float num500 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 320f - vector61.Y; float num501 = (float)Math.Sqrt(num499 * num499 + num500 * num500); num501 = 9f / num501; num499 *= num501; @@ -1161,25 +1147,12 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses Vector2 value19 = Main.player[npc.target].Center - npc.Center; value19.Normalize(); value19 *= num502; - int numProj = 2; - float rotation = MathHelper.ToRadians(5); - if (malice) + int numProj = malice ? 5 : 3; + float rotation = MathHelper.ToRadians(malice ? 8 : 5); + for (int i = 0; i < numProj; i++) { - rotation = MathHelper.ToRadians(8); - for (int i = 0; i < numProj; i++) - { - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, value19.RotatedBy(-rotation * (i + 1)), type, damage, 0f, Main.myPlayer, 0f, 1f); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, value19.RotatedBy(+rotation * (i + 1)), type, damage, 0f, Main.myPlayer, 0f, 1f); - } - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, value19, type, damage, 0f, Main.myPlayer, 0f, 1f); - } - else - { - for (int i = 0; i < numProj + 1; i++) - { - Vector2 perturbedSpeed = value19.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, type, damage, 0f, Main.myPlayer, 0f, 1f); - } + Vector2 perturbedSpeed = value19.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, 1f); } } } @@ -1271,7 +1244,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y) { if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.96f; + npc.velocity.Y *= 0.9f; npc.velocity.Y -= malice ? 0.3f : death ? 0.12f : 0.1f; @@ -1281,7 +1254,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y) { if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.96f; + npc.velocity.Y *= 0.9f; npc.velocity.Y += malice ? 0.3f : death ? 0.12f : 0.1f; @@ -1292,7 +1265,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2)) { if (npc.velocity.X > 0f) - npc.velocity.X *= 0.96f; + npc.velocity.X *= 0.9f; npc.velocity.X -= malice ? 1f : death ? 0.55f : 0.5f; @@ -1302,7 +1275,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2)) { if (npc.velocity.X < 0f) - npc.velocity.X *= 0.96f; + npc.velocity.X *= 0.9f; npc.velocity.X += malice ? 1f : death ? 0.55f : 0.5f; @@ -1345,7 +1318,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 300f) { if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.96f; + npc.velocity.Y *= 0.9f; npc.velocity.Y -= malice ? 0.3f : death ? 0.12f : 0.1f; @@ -1355,7 +1328,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 230f) { if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.96f; + npc.velocity.Y *= 0.9f; npc.velocity.Y += malice ? 0.3f : death ? 0.12f : 0.1f; @@ -1366,7 +1339,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) + 250f) { if (npc.velocity.X > 0f) - npc.velocity.X *= 0.94f; + npc.velocity.X *= 0.9f; npc.velocity.X -= malice ? 0.8f : death ? 0.33f : 0.3f; @@ -1376,7 +1349,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2)) { if (npc.velocity.X < 0f) - npc.velocity.X *= 0.94f; + npc.velocity.X *= 0.9f; npc.velocity.X += malice ? 0.8f : death ? 0.22f : 0.2f; @@ -1406,8 +1379,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.velocity.X += 0.5f; npc.velocity.Y -= 0.5f; - if (npc.velocity.Y < -9f) - npc.velocity.Y = -9f; + if (npc.velocity.Y < -12f) + npc.velocity.Y = -12f; if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 280f) { @@ -1602,7 +1575,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y) { if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.96f; + npc.velocity.Y *= 0.9f; npc.velocity.Y -= malice ? 0.3f : death ? 0.12f : 0.1f; @@ -1612,7 +1585,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y) { if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.96f; + npc.velocity.Y *= 0.9f; npc.velocity.Y += malice ? 0.3f : death ? 0.12f : 0.1f; @@ -1623,7 +1596,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2)) { if (npc.velocity.X > 0f) - npc.velocity.X *= 0.96f; + npc.velocity.X *= 0.9f; npc.velocity.X -= malice ? 1.2f : death ? 0.55f : 0.5f; @@ -1633,7 +1606,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2)) { if (npc.velocity.X < 0f) - npc.velocity.X *= 0.96f; + npc.velocity.X *= 0.9f; npc.velocity.X += malice ? 1.2f : death ? 0.55f : 0.5f; @@ -1671,7 +1644,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 320f) { if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.96f; + npc.velocity.Y *= 0.9f; npc.velocity.Y -= malice ? 0.15f : death ? 0.05f : 0.04f; @@ -1681,7 +1654,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 260f) { if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.96f; + npc.velocity.Y *= 0.9f; npc.velocity.Y += malice ? 0.15f : death ? 0.05f : 0.04f; @@ -1692,7 +1665,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2)) { if (npc.velocity.X > 0f) - npc.velocity.X *= 0.96f; + npc.velocity.X *= 0.9f; npc.velocity.X -= malice ? 0.8f : death ? 0.33f : 0.3f; @@ -1702,7 +1675,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 250f) { if (npc.velocity.X < 0f) - npc.velocity.X *= 0.96f; + npc.velocity.X *= 0.9f; npc.velocity.X += malice ? 0.8f : death ? 0.33f : 0.3f; @@ -1725,9 +1698,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses npc.rotation = (float)Math.Atan2(num472, num471) + MathHelper.PiOver2; npc.velocity.X *= 0.95f; - npc.velocity.Y -= 0.3f; - if (npc.velocity.Y < -8f) - npc.velocity.Y = -8f; + npc.velocity.Y -= 0.5f; + if (npc.velocity.Y < -12f) + npc.velocity.Y = -12f; if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 200f) { @@ -1782,25 +1755,25 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (npc.velocity.X > num474) { if (npc.velocity.X > 0f) - npc.velocity.X *= 0.97f; + npc.velocity.X *= 0.9f; npc.velocity.X -= acceleration; } if (npc.velocity.X < num474) { if (npc.velocity.X < 0f) - npc.velocity.X *= 0.97f; + npc.velocity.X *= 0.9f; npc.velocity.X += acceleration; } if (npc.velocity.Y > num475) { if (npc.velocity.Y > 0f) - npc.velocity.Y *= 0.97f; + npc.velocity.Y *= 0.9f; npc.velocity.Y -= acceleration; } if (npc.velocity.Y < num475) { if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.97f; + npc.velocity.Y *= 0.9f; npc.velocity.Y += acceleration; } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index d115447e2d..396f5ada46 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -317,13 +317,9 @@ namespace CalamityMod.Projectiles break; case ProjectileID.QueenSlimeGelAttack: - affectedByMaliceModeVelocityMultiplier = true; - projectile.penetrate = projectile.maxPenetrate = 1; - break; - case ProjectileID.QueenSlimeMinionPinkBall: affectedByMaliceModeVelocityMultiplier = true; - projectile.penetrate = projectile.maxPenetrate = 2; + projectile.penetrate = projectile.maxPenetrate = 1; break; case ProjectileID.MonkStaffT2: @@ -697,36 +693,6 @@ namespace CalamityMod.Projectiles return false; } - else if (projectile.type == ProjectileID.QueenSlimeGelAttack) - { - // Phase 1 and 2 projectiles do not bounce and phase 2 projectiles do not have gravity. - if (projectile.ai[1] == -2f) - { - if (projectile.alpha == 0 && Main.rand.Next(3) == 0) - { - int num70 = 4; - Color newColor = NPC.AI_121_QueenSlime_GetDustColor(); - newColor.A = 150; - float num71 = 1.2f; - int num72 = 8; - bool noGravity = Main.rand.NextBool(); - - int num73 = Dust.NewDust(projectile.position - new Vector2(num72, num72) + projectile.velocity, projectile.width + num72 * 2, projectile.height + num72 * 2, num70, 0f, 0f, 50, newColor, num71); - Main.dust[num73].velocity *= 0.3f; - Main.dust[num73].velocity += projectile.velocity * 0.3f; - Main.dust[num73].noGravity = noGravity; - } - - projectile.alpha -= 50; - if (projectile.alpha < 0) - projectile.alpha = 0; - - projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.05f; - - return false; - } - } - else if (projectile.type == ProjectileID.Starfury) { if (projectile.timeLeft > 45) @@ -1185,6 +1151,74 @@ namespace CalamityMod.Projectiles return false; } + else if (projectile.type == ProjectileID.QueenSlimeGelAttack) + { + // Phase 1 and 2 projectiles do not bounce and phase 2 projectiles do not have gravity. + if (projectile.ai[1] == -2f) + { + if (projectile.alpha == 0 && Main.rand.Next(3) == 0) + { + Color newColor = NPC.AI_121_QueenSlime_GetDustColor(); + newColor.A = 150; + int num72 = 8; + bool noGravity = Main.rand.NextBool(); + int num73 = Dust.NewDust(projectile.position - new Vector2(num72, num72) + projectile.velocity, projectile.width + num72 * 2, projectile.height + num72 * 2, 4, 0f, 0f, 50, newColor, 1.2f); + Main.dust[num73].velocity *= 0.3f; + Main.dust[num73].velocity += projectile.velocity * 0.3f; + Main.dust[num73].noGravity = noGravity; + } + + projectile.alpha -= 50; + if (projectile.alpha < 0) + projectile.alpha = 0; + + projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.05f; + + return false; + } + } + + else if (projectile.type == ProjectileID.QueenSlimeMinionBlueSpike) + { + // When Queen Slime fires these they aren't as affected by gravity. + if (projectile.ai[1] < 0f) + { + if (projectile.frameCounter == 0) + { + projectile.frameCounter = 1; + projectile.frame = Main.rand.Next(3); + } + + if (projectile.alpha == 0 && Main.rand.Next(3) == 0) + { + Color newColor = new Color(78, 136, 255, 150); + int num73 = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 4, 0f, 0f, 50, newColor, 1.2f); + Main.dust[num73].velocity *= 0.3f; + Main.dust[num73].velocity += projectile.velocity * 0.3f; + Main.dust[num73].noGravity = true; + } + + projectile.alpha -= 50; + if (projectile.alpha < 0) + projectile.alpha = 0; + + if (projectile.ai[1] == -1f) + { + if (projectile.ai[0] >= 5f) + projectile.velocity.Y += 0.05f; + else + projectile.ai[0] += 1f; + + if (projectile.velocity.Y > 16f) + projectile.velocity.Y = 16f; + } + + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + + return false; + } + } + else if (projectile.type == ProjectileID.DeathLaser && projectile.ai[0] == 1f) { if (defDamage == 0) @@ -1958,7 +1992,7 @@ namespace CalamityMod.Projectiles if (projectile.hostile) { // These projectiles are way too fucking fast so they need to be slower - if (projectile.type == ProjectileID.QueenSlimeMinionBlueSpike || projectile.type == ProjectileID.QueenSlimeMinionPinkBall) + if ((projectile.type == ProjectileID.QueenSlimeMinionBlueSpike && projectile.ai[1] >= 0f) || projectile.type == ProjectileID.QueenSlimeMinionPinkBall) projectile.velocity *= 0.5f; if (CalamityPlayer.areThereAnyDamnBosses && affectedByMaliceModeVelocityMultiplier && (CalamityWorld.malice || BossRushEvent.BossRushActive)) diff --git a/Projectiles/Ranged/BrimstoneBolt.cs b/Projectiles/Ranged/BrimstoneBolt.cs index e808b3821a..fd53eee2f3 100644 --- a/Projectiles/Ranged/BrimstoneBolt.cs +++ b/Projectiles/Ranged/BrimstoneBolt.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; @@ -47,15 +47,20 @@ namespace CalamityMod.Projectiles.Ranged Projectile.alpha = 0; } Lighting.AddLight(Projectile.Center, 0.7f, 0f, 0f); - for (int num121 = 0; num121 < 5; num121++) + if (Projectile.localAI[0] > 2f) { - Dust dust4 = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f)]; - dust4.velocity = Vector2.Zero; - dust4.position -= Projectile.velocity / 5f * (float)num121; - dust4.noGravity = true; - dust4.scale = 0.8f; - dust4.noLight = true; + for (int num121 = 0; num121 < 5; num121++) + { + Dust dust4 = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.Brimstone, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f)]; + dust4.velocity = Vector2.Zero; + dust4.position -= Projectile.velocity / 5f * (float)num121; + dust4.noGravity = true; + dust4.scale = 0.8f; + dust4.noLight = true; + } } + else + Projectile.localAI[0] += 1f; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)