diff --git a/Items/Weapons/Magic/HellwingStaff.cs b/Items/Weapons/Magic/HellwingStaff.cs index 21f8be77f1..693f1d4143 100644 --- a/Items/Weapons/Magic/HellwingStaff.cs +++ b/Items/Weapons/Magic/HellwingStaff.cs @@ -73,19 +73,7 @@ namespace CalamityMod.Items.Weapons.Magic num80 = num72 / num80; } - int num130 = 7; - if (Main.rand.NextBool(6)) - { - num130++; - } - if (Main.rand.NextBool(7)) - { - num130++; - } - if (Main.rand.NextBool(8)) - { - num130++; - } + int num130 = 4; for (int num131 = 0; num131 < num130; num131++) { vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y); diff --git a/Items/Weapons/Summon/AngryChickenStaff.cs b/Items/Weapons/Summon/AngryChickenStaff.cs index 66804946d5..7502e45db7 100644 --- a/Items/Weapons/Summon/AngryChickenStaff.cs +++ b/Items/Weapons/Summon/AngryChickenStaff.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.mana = 50; + item.mana = 10; item.damage = Damage; item.useStyle = ItemUseStyleID.SwingThrow; item.width = 32; diff --git a/Items/Weapons/Summon/BelladonnaSpiritStaff.cs b/Items/Weapons/Summon/BelladonnaSpiritStaff.cs index 946baeb363..717ff7121d 100644 --- a/Items/Weapons/Summon/BelladonnaSpiritStaff.cs +++ b/Items/Weapons/Summon/BelladonnaSpiritStaff.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { item.damage = 5; - item.mana = 9; + item.mana = 10; item.width = 40; item.height = 40; item.useTime = item.useAnimation = 35; diff --git a/Items/Weapons/Summon/BorealisBomber.cs b/Items/Weapons/Summon/BorealisBomber.cs index 986c237ba8..6c7bcb1c84 100644 --- a/Items/Weapons/Summon/BorealisBomber.cs +++ b/Items/Weapons/Summon/BorealisBomber.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { item.damage = 35; - item.mana = 15; + item.mana = 10; item.width = 48; item.height = 56; item.useTime = item.useAnimation = 20; diff --git a/Items/Weapons/Summon/CadaverousCarrion.cs b/Items/Weapons/Summon/CadaverousCarrion.cs index 6e87d89ebe..051591a096 100644 --- a/Items/Weapons/Summon/CadaverousCarrion.cs +++ b/Items/Weapons/Summon/CadaverousCarrion.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { item.damage = 384; - item.mana = 32; + item.mana = 10; item.summon = true; item.sentry = true; item.width = 54; diff --git a/Items/Weapons/Summon/ColdDivinity.cs b/Items/Weapons/Summon/ColdDivinity.cs index b2044f44a3..510acea3d0 100644 --- a/Items/Weapons/Summon/ColdDivinity.cs +++ b/Items/Weapons/Summon/ColdDivinity.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { item.damage = 60; - item.mana = 20; + item.mana = 10; item.width = 52; item.height = 50; item.useTime = item.useAnimation = 25; diff --git a/Items/Weapons/Summon/CorvidHarbringerStaff.cs b/Items/Weapons/Summon/CorvidHarbringerStaff.cs index 2959295f06..5c9550ae63 100644 --- a/Items/Weapons/Summon/CorvidHarbringerStaff.cs +++ b/Items/Weapons/Summon/CorvidHarbringerStaff.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.UseSound = SoundID.DD2_BetsyFlyingCircleAttack; item.summon = true; - item.mana = 11; + item.mana = 10; item.damage = 97; item.knockBack = 2f; item.autoReuse = true; diff --git a/Items/Weapons/Summon/CosmicImmaterializer.cs b/Items/Weapons/Summon/CosmicImmaterializer.cs index ba6848556c..275ed972c3 100644 --- a/Items/Weapons/Summon/CosmicImmaterializer.cs +++ b/Items/Weapons/Summon/CosmicImmaterializer.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.mana = 100; + item.mana = 10; item.damage = 560; item.useStyle = ItemUseStyleID.SwingThrow; item.width = 74; diff --git a/Items/Weapons/Summon/DaedalusGolemStaff.cs b/Items/Weapons/Summon/DaedalusGolemStaff.cs index 8486a97ddf..3cad138015 100644 --- a/Items/Weapons/Summon/DaedalusGolemStaff.cs +++ b/Items/Weapons/Summon/DaedalusGolemStaff.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { item.damage = 70; - item.mana = 12; + item.mana = 10; item.width = item.height = 32; item.useTime = item.useAnimation = 25; item.useStyle = ItemUseStyleID.SwingThrow; diff --git a/Items/Weapons/Summon/DazzlingStabberStaff.cs b/Items/Weapons/Summon/DazzlingStabberStaff.cs index 8d98d10338..e0b3b8f0ff 100644 --- a/Items/Weapons/Summon/DazzlingStabberStaff.cs +++ b/Items/Weapons/Summon/DazzlingStabberStaff.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.UseSound = SoundID.DD2_DarkMageHealImpact; item.summon = true; - item.mana = 12; + item.mana = 10; item.damage = 56; item.knockBack = 2f; item.autoReuse = true; diff --git a/Items/Weapons/Summon/DormantBrimseeker.cs b/Items/Weapons/Summon/DormantBrimseeker.cs index 5b4fd62cc8..54d423f24c 100644 --- a/Items/Weapons/Summon/DormantBrimseeker.cs +++ b/Items/Weapons/Summon/DormantBrimseeker.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { item.damage = 42; - item.mana = 12; + item.mana = 10; item.width = item.height = 32; item.useTime = item.useAnimation = 25; item.useStyle = ItemUseStyleID.SwingThrow; diff --git a/Items/Weapons/Summon/DragonbloodDisgorger.cs b/Items/Weapons/Summon/DragonbloodDisgorger.cs index b05cd7cc08..d81b6f5988 100644 --- a/Items/Weapons/Summon/DragonbloodDisgorger.cs +++ b/Items/Weapons/Summon/DragonbloodDisgorger.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { item.damage = 160; - item.mana = 30; + item.mana = 10; item.width = 64; item.height = 62; item.useTime = item.useAnimation = 15; diff --git a/Items/Weapons/Summon/EnergyStaff.cs b/Items/Weapons/Summon/EnergyStaff.cs index 6116d7de2a..259d852c49 100644 --- a/Items/Weapons/Summon/EnergyStaff.cs +++ b/Items/Weapons/Summon/EnergyStaff.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Summon item.damage = 128; item.summon = true; item.sentry = true; - item.mana = 25; + item.mana = 10; item.width = 66; item.height = 68; item.useTime = item.useAnimation = 15; diff --git a/Items/Weapons/Summon/ExhumedVigilance.cs b/Items/Weapons/Summon/ExhumedVigilance.cs index 185a2ccd9d..c7ba200da7 100644 --- a/Items/Weapons/Summon/ExhumedVigilance.cs +++ b/Items/Weapons/Summon/ExhumedVigilance.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - item.mana = 100; + item.mana = 10; item.damage = 1666; item.useStyle = ItemUseStyleID.SwingThrow; item.width = 58; diff --git a/Items/Weapons/Summon/ForgottenApexWand.cs b/Items/Weapons/Summon/ForgottenApexWand.cs index 85a4110158..404194e337 100644 --- a/Items/Weapons/Summon/ForgottenApexWand.cs +++ b/Items/Weapons/Summon/ForgottenApexWand.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Summon item.autoReuse = true; item.knockBack = 4f; - item.mana = 15; + item.mana = 10; item.damage = 28; item.useTime = item.useAnimation = 25; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/GammaHeart.cs b/Items/Weapons/Summon/GammaHeart.cs index e98a584151..4fe40746e6 100644 --- a/Items/Weapons/Summon/GammaHeart.cs +++ b/Items/Weapons/Summon/GammaHeart.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Summon item.noMelee = true; item.UseSound = SoundID.Item42; item.summon = true; - item.mana = 16; + item.mana = 10; item.damage = 173; item.knockBack = 3f; item.autoReuse = true; diff --git a/Items/Weapons/Summon/IgneousExaltation.cs b/Items/Weapons/Summon/IgneousExaltation.cs index 27055d77f1..3fef682e1c 100644 --- a/Items/Weapons/Summon/IgneousExaltation.cs +++ b/Items/Weapons/Summon/IgneousExaltation.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { item.damage = 34; - item.mana = 19; + item.mana = 10; item.width = 52; item.height = 50; item.useTime = item.useAnimation = 25; diff --git a/Items/Weapons/Summon/MidnightSunBeacon.cs b/Items/Weapons/Summon/MidnightSunBeacon.cs index 0b832294e5..aa6fda68b0 100644 --- a/Items/Weapons/Summon/MidnightSunBeacon.cs +++ b/Items/Weapons/Summon/MidnightSunBeacon.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { item.damage = 91; - item.mana = 12; + item.mana = 10; item.width = item.height = 32; item.useTime = item.useAnimation = 10; item.useStyle = ItemUseStyleID.SwingThrow; diff --git a/Items/Weapons/Summon/Perdition.cs b/Items/Weapons/Summon/Perdition.cs index 7bc6ada075..cb774babb9 100644 --- a/Items/Weapons/Summon/Perdition.cs +++ b/Items/Weapons/Summon/Perdition.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { item.damage = 444; - item.mana = 25; + item.mana = 10; item.width = item.height = 56; item.useTime = item.useAnimation = 42; item.useStyle = ItemUseStyleID.SwingThrow; diff --git a/Items/Weapons/Summon/SarosPossession.cs b/Items/Weapons/Summon/SarosPossession.cs index 1a19d8ed1a..3794d0f2f1 100644 --- a/Items/Weapons/Summon/SarosPossession.cs +++ b/Items/Weapons/Summon/SarosPossession.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Summon item.UseSound = SoundID.DD2_BetsyFlameBreath; item.summon = true; - item.mana = 100; + item.mana = 10; item.damage = 145; item.knockBack = 4f; item.useTime = item.useAnimation = 10; diff --git a/Items/Weapons/Summon/Sirius.cs b/Items/Weapons/Summon/Sirius.cs index 37be79ae6d..a515e42b6a 100644 --- a/Items/Weapons/Summon/Sirius.cs +++ b/Items/Weapons/Summon/Sirius.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Summon item.UseSound = SoundID.Item44; item.summon = true; - item.mana = 60; + item.mana = 10; item.damage = 160; item.knockBack = 3f; item.useTime = item.useAnimation = 10; diff --git a/Items/Weapons/Summon/SlimePuppetStaff.cs b/Items/Weapons/Summon/SlimePuppetStaff.cs index 93bea9288a..fbabc6c6be 100644 --- a/Items/Weapons/Summon/SlimePuppetStaff.cs +++ b/Items/Weapons/Summon/SlimePuppetStaff.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { item.damage = 26; - item.mana = 13; + item.mana = 10; item.width = 48; item.height = 56; item.useTime = item.useAnimation = 24; diff --git a/Items/Weapons/Summon/StaffoftheMechworm.cs b/Items/Weapons/Summon/StaffoftheMechworm.cs index 2f5d64f4fd..01d1650b6b 100644 --- a/Items/Weapons/Summon/StaffoftheMechworm.cs +++ b/Items/Weapons/Summon/StaffoftheMechworm.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { item.damage = BaseDamage; - item.mana = 15; + item.mana = 10; item.width = 58; item.height = 58; item.useTime = 12; diff --git a/Items/Weapons/Summon/StaffoftheMechworm2.cs b/Items/Weapons/Summon/StaffoftheMechworm2.cs index 54a05bfb70..40d5d25904 100644 --- a/Items/Weapons/Summon/StaffoftheMechworm2.cs +++ b/Items/Weapons/Summon/StaffoftheMechworm2.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { item.damage = 666; - item.mana = 15; + item.mana = 10; item.width = 58; item.height = 58; item.useTime = item.useAnimation = 12; diff --git a/Items/Weapons/Summon/Vigilance.cs b/Items/Weapons/Summon/Vigilance.cs index 23b51e01f7..250df5d6c7 100644 --- a/Items/Weapons/Summon/Vigilance.cs +++ b/Items/Weapons/Summon/Vigilance.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { item.damage = 333; - item.mana = 12; + item.mana = 10; item.width = item.height = 32; item.useTime = item.useAnimation = 10; item.useStyle = ItemUseStyleID.SwingThrow; diff --git a/Items/Weapons/Summon/ViridVanguard.cs b/Items/Weapons/Summon/ViridVanguard.cs index 1eb96eccdb..83f8740fd0 100644 --- a/Items/Weapons/Summon/ViridVanguard.cs +++ b/Items/Weapons/Summon/ViridVanguard.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Summon item.damage = 156; item.summon = true; item.sentry = true; - item.mana = 25; + item.mana = 10; item.width = 26; item.height = 36; item.useTime = item.useAnimation = 15; diff --git a/Items/Weapons/Summon/VoidConcentrationStaff.cs b/Items/Weapons/Summon/VoidConcentrationStaff.cs index f7fc78b653..7059d4f4db 100644 --- a/Items/Weapons/Summon/VoidConcentrationStaff.cs +++ b/Items/Weapons/Summon/VoidConcentrationStaff.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Summon item.UseSound = SoundID.DD2_EtherianPortalOpen; item.summon = true; - item.mana = 100; + item.mana = 10; item.damage = 150; item.knockBack = 4f; item.useTime = item.useAnimation = 10; diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index 249b824f90..22b8982089 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -5568,17 +5568,16 @@ namespace CalamityMod.NPCs if (npc.ai[0] == 8f || npc.ai[0] == 13f) rateOfRotation = 0.05f; - Vector2 playerCenter = player.Center; + Vector2 rotationVector = player.Center - vector; if (calamityGlobalNPC.newAI[1] != 1f && !player.dead) { // Rotate to show direction of predictive charge - Vector2 distanceVector = player.Center + player.velocity * 20f - vector; if (npc.ai[0] == 0f && !phase2) { if (npc.ai[3] < 6f) { rateOfRotation = 0.1f; - playerCenter += Vector2.Normalize(distanceVector) * chargeVelocity; + rotationVector = Vector2.Normalize(player.Center + player.velocity * 20f - vector) * chargeVelocity; } } else if (npc.ai[0] == 5f && !phase3) @@ -5586,7 +5585,7 @@ namespace CalamityMod.NPCs if (npc.ai[3] < 4f) { rateOfRotation = 0.1f; - playerCenter += Vector2.Normalize(distanceVector) * chargeVelocity; + rotationVector = Vector2.Normalize(player.Center + player.velocity * 20f - vector) * chargeVelocity; } } else if (npc.ai[0] == 10f) @@ -5594,12 +5593,12 @@ namespace CalamityMod.NPCs if (npc.ai[3] < 8f && npc.ai[3] != 1f && npc.ai[3] != 4f) { rateOfRotation = 0.1f; - playerCenter += Vector2.Normalize(distanceVector) * chargeVelocity; + rotationVector = Vector2.Normalize(player.Center + player.velocity * 20f - vector) * chargeVelocity; } } } - float num17 = (float)Math.Atan2(playerCenter.Y - vector.Y, playerCenter.X - vector.X); + float num17 = (float)Math.Atan2(rotationVector.Y, rotationVector.X); if (npc.spriteDirection == 1) num17 += pie; if (num17 < 0f) diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index f73847646f..70113b37ac 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -1100,7 +1100,7 @@ namespace CalamityMod.NPCs npc.buffImmune[BuffType()] = false; // Sets certain vanilla NPCs and all town NPCs to be immune to most debuffs. - if (DestroyerIDs.Contains(npc.type) || npc.type == NPCID.SkeletronHead || (EaterofWorldsIDs.Contains(npc.type) && BossRushEvent.BossRushActive) || npc.type == NPCID.DD2EterniaCrystal || npc.townNPC || npc.type == NPCID.SpikeBall || npc.type == NPCID.BlazingWheel) + if (DestroyerIDs.Contains(npc.type) || npc.type == NPCID.SkeletronHead || (EaterofWorldsIDs.Contains(npc.type) && (BossRushEvent.BossRushActive || CalamityWorld.malice)) || npc.type == NPCID.DD2EterniaCrystal || npc.townNPC || npc.type == NPCID.SpikeBall || npc.type == NPCID.BlazingWheel) { for (int k = 0; k < npc.buffImmune.Length; k++) { diff --git a/NPCs/ExoMechs/Ares/AresBody.cs b/NPCs/ExoMechs/Ares/AresBody.cs index 3dd1b8f8de..d85050eeb1 100644 --- a/NPCs/ExoMechs/Ares/AresBody.cs +++ b/NPCs/ExoMechs/Ares/AresBody.cs @@ -1,14 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; using CalamityMod.Items.Potions; using CalamityMod.NPCs.ExoMechs.Thanatos; -using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using System.IO; using Terraria; using Terraria.ID; @@ -52,9 +48,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares private int frameX = 0; private int frameY = 0; - // The exact frame the animation is currently on - private int exactFrame = 0; - // Frame limit per animation, these are the specific frames where each animation ends private const int normalFrameLimit = 11; private const int firstStageDeathrayChargeFrameLimit = 23; @@ -330,7 +323,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares npc.rotation = npc.velocity.X * 0.003f; // Light - Lighting.AddLight(npc.Center, Main.DiscoR / 255f, Main.DiscoG / 255f, Main.DiscoB / 255f); + float lightScale = 765f; + Lighting.AddLight(npc.Center, Main.DiscoR / lightScale, Main.DiscoG / lightScale, Main.DiscoB / lightScale); // Default vector to fly to Vector2 destination = SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune ? new Vector2(player.Center.X, player.Center.Y - 800f) : AIState != (float)Phase.Deathrays ? new Vector2(player.Center.X, player.Center.Y - 450f) : player.Center; @@ -349,6 +343,10 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Distance from target float distanceFromTarget = Vector2.Distance(npc.Center, player.Center); + // Whether Ares should move to its spot or not + float movementDistanceGateValue = 32f; + bool moveToLocation = Vector2.Distance(npc.Center, destination) > movementDistanceGateValue; + // Gate values float deathrayPhaseGateValue = 900f; float deathrayDistanceGateValue = 480f; @@ -454,7 +452,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Fly above the target case (int)Phase.Normal: - if (!targetDead) + if (!targetDead && moveToLocation) npc.SimpleFlyMovement(desiredVelocity, baseAcceleration); if (berserk) @@ -495,11 +493,15 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Fire deathray telegraph beams if (calamityGlobalNPC.newAI[2] == 1f) { - // Set frames to deathray charge up frames + // Set frames to deathray charge up frames, which begin on frame 12 + // Reset the frame counter npc.frameCounter = 0D; + + // X = 1 sets to frame 8 frameX = 1; - frameY = 5; - exactFrame = 12; + + // Y = 4 sets to frame 12 + frameY = 4; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -562,36 +564,44 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { if (npc.frameCounter >= 10D) { + // Reset frame counter npc.frameCounter = 0D; + + // Increment the Y frame frameY++; - exactFrame++; + + // Reset the Y frame if greater than 8 if (frameY == maxFramesY) { frameX++; frameY = 0; } - if (exactFrame > normalFrameLimit) - frameX = frameY = exactFrame = 0; + + // Reset the frames to frame 0 + if ((frameX * maxFramesY) + frameY > normalFrameLimit) + frameX = frameY = 0; } } else { if (npc.frameCounter >= 10D) { + // Reset frame counter npc.frameCounter = 0D; + + // Increment the Y frame frameY++; - exactFrame++; + + // Reset the Y frame if greater than 8 if (frameY == maxFramesY) { frameX++; frameY = 0; } - if (exactFrame > finalStageDeathrayChargeFrameLimit) - { - frameX = 4; - frameY = 5; - exactFrame = secondStageDeathrayChargeFrameLimit + 1; - } + + // Reset the frames to frame 36, the start of the deathray firing animation loop + if ((frameX * maxFramesY) + frameY > finalStageDeathrayChargeFrameLimit) + frameX = frameY = 4; } } } diff --git a/NPCs/ExoMechs/Ares/AresGaussNuke.cs b/NPCs/ExoMechs/Ares/AresGaussNuke.cs index bb5b3fe55c..84b0dc4ea9 100644 --- a/NPCs/ExoMechs/Ares/AresGaussNuke.cs +++ b/NPCs/ExoMechs/Ares/AresGaussNuke.cs @@ -1,9 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; -using CalamityMod.Items.Potions; -using CalamityMod.NPCs.ExoMechs.Thanatos; -using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -40,9 +35,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares private int frameX = 0; private int frameY = 0; - // The exact frame the animation is currently on - private int exactFrame = 0; - // Frame limit per animation, these are the specific frames where each animation ends private const int normalFrameLimit = 11; private const int firstStageGaussNukeChargeFrameLimit = 23; @@ -232,10 +224,11 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Vector2 predictionVector = player.velocity * predictionAmt; Vector2 rotationVector = player.Center + predictionVector - npc.Center; + float projectileVelocity = 12f; float rateOfRotation = AIState == (int)Phase.GaussNuke ? 0.08f : 0.04f; - Vector2 lookAt = player.Center + Vector2.Normalize(rotationVector); + Vector2 lookAt = Vector2.Normalize(rotationVector) * projectileVelocity; - float rotation = (float)Math.Atan2(lookAt.Y - npc.Center.Y, lookAt.X - npc.Center.X); + float rotation = (float)Math.Atan2(lookAt.Y, lookAt.X); if (npc.spriteDirection == 1) rotation += MathHelper.Pi; if (rotation < 0f) @@ -243,29 +236,22 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (rotation > MathHelper.TwoPi) rotation -= MathHelper.TwoPi; - if (npc.rotation < rotation) - { - if (rotation - npc.rotation > MathHelper.Pi) - npc.rotation -= rateOfRotation; - else - npc.rotation += rateOfRotation; - } - if (npc.rotation > rotation) - { - if (npc.rotation - rotation > MathHelper.Pi) - npc.rotation += rateOfRotation; - else - npc.rotation -= rateOfRotation; - } + npc.rotation = npc.rotation.AngleTowards(rotation, rateOfRotation); - if (npc.rotation > rotation - rateOfRotation && npc.rotation < rotation + rateOfRotation) - npc.rotation = rotation; - if (npc.rotation < 0f) - npc.rotation += MathHelper.TwoPi; - if (npc.rotation > MathHelper.TwoPi) - npc.rotation -= MathHelper.TwoPi; - if (npc.rotation > rotation - rateOfRotation && npc.rotation < rotation + rateOfRotation) - npc.rotation = rotation; + // Direction + int direction = Math.Sign(player.Center.X - npc.Center.X); + if (direction != 0) + { + if (calamityGlobalNPC.newAI[1] == 0f && calamityGlobalNPC.newAI[2] == 0f && direction != npc.direction) + npc.rotation += MathHelper.Pi; + + npc.direction = direction; + + if (npc.spriteDirection != -npc.direction) + npc.rotation += MathHelper.Pi; + + npc.spriteDirection = -npc.direction; + } // Light Lighting.AddLight(npc.Center, 0.2f, 0.25f, 0.05f); @@ -284,8 +270,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } Vector2 desiredVelocity = Vector2.Normalize(destination - npc.Center) * baseVelocity; - // Distance from target - float distanceFromTarget = Vector2.Distance(npc.Center, player.Center); + // Whether Ares Nuke Arm should move to its spot or not + float movementDistanceGateValue = 32f; + bool moveToLocation = Vector2.Distance(npc.Center, destination) > movementDistanceGateValue; // Gate values float gaussNukePhaseGateValue = 600f; @@ -322,29 +309,32 @@ namespace CalamityMod.NPCs.ExoMechs.Ares calamityGlobalNPC.newAI[2] += 1f; if (calamityGlobalNPC.newAI[2] < gaussNukeTelegraphDuration) { + // Set frames to gauss nuke charge up frames, which begin on frame 12 if (calamityGlobalNPC.newAI[2] == 1f) { - // Set frames to gauss nuke charge up frames + // Reset the frame counter npc.frameCounter = 0D; + + // X = 1 sets to frame 12 frameX = 1; + + // Y = 0 sets to frame 12 frameY = 0; - exactFrame = 12; } // Fire gauss nuke on frame 41 - if (exactFrame == 41 && calamityGlobalNPC.newAI[1] == 0f) + if ((frameX * maxFramesY) + frameY == 41 && calamityGlobalNPC.newAI[1] == 0f) { calamityGlobalNPC.newAI[1] = 1f; if (Main.netMode != NetmodeID.MultiplayerClient) { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire"), npc.Center); - float projectileVelocity = 12f; Vector2 gaussNukeVelocity = Vector2.Normalize(rotationVector) * projectileVelocity; int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); float offset = 40f; - Projectile.NewProjectile(npc.Center + Vector2.Normalize(gaussNukeVelocity) * offset, gaussNukeVelocity, type, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.Center + Vector2.Normalize(gaussNukeVelocity) * offset, gaussNukeVelocity, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); // Recoil npc.velocity -= gaussNukeVelocity; @@ -353,15 +343,19 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } else { + // Set frames to gauss nuke reload frames, which begin on frame 48 AIState = (float)Phase.Reload; calamityGlobalNPC.newAI[1] = 0f; calamityGlobalNPC.newAI[2] = 0f; - // Set frames to gauss nuke reload frames + // Reset the frame counter npc.frameCounter = 0D; + + // X = 1 sets to frame 48 frameX = 4; + + // Y = 0 sets to frame 48 frameY = 0; - exactFrame = 48; } } @@ -381,7 +375,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } // Movement - if (!targetDead) + if (!targetDead && moveToLocation) npc.SimpleFlyMovement(desiredVelocity, baseAcceleration); } @@ -397,32 +391,44 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { if (npc.frameCounter >= 10D) { + // Reset frame counter npc.frameCounter = 0D; + + // Increment the Y frame frameY++; - exactFrame++; + + // Reset the Y frame if greater than 12 if (frameY == maxFramesY) { frameX++; frameY = 0; } - if (exactFrame > normalFrameLimit) - frameX = frameY = exactFrame = 0; + + // Reset the frames + if ((frameX * maxFramesY) + frameY > normalFrameLimit) + frameX = frameY = 0; } } else { if (npc.frameCounter >= 10D) { + // Reset frame counter npc.frameCounter = 0D; + + // Increment the Y frame frameY++; - exactFrame++; + + // Reset the Y frame if greater than 12 if (frameY == maxFramesY) { frameX++; frameY = 0; } - if (exactFrame > reloadFrameLimit) - frameX = frameY = exactFrame = 0; + + // Reset the frames to frame 0 + if ((frameX * maxFramesY) + frameY > reloadFrameLimit) + frameX = frameY = 0; } } } diff --git a/NPCs/ExoMechs/Ares/AresLaserCannon.cs b/NPCs/ExoMechs/Ares/AresLaserCannon.cs index 2338b33b54..cb94fa8666 100644 --- a/NPCs/ExoMechs/Ares/AresLaserCannon.cs +++ b/NPCs/ExoMechs/Ares/AresLaserCannon.cs @@ -1,9 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; -using CalamityMod.Items.Potions; -using CalamityMod.NPCs.ExoMechs.Thanatos; -using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -39,9 +34,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares private int frameX = 0; private int frameY = 0; - // The exact frame the animation is currently on - private int exactFrame = 0; - // Frame limit per animation, these are the specific frames where each animation ends private const int normalFrameLimit = 11; private const int firstStageDeathrayChargeFrameLimit = 23; @@ -228,8 +220,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Rotate the cannon to look at the target while not firing the beam // Rotate the cannon to look in the direction it will fire only while it's charging or while it's firing // Rotation + bool horizontalLaserSweep = calamityGlobalNPC.newAI[3] == 0f; float rateOfRotation = AIState == (int)Phase.Deathray ? 0.08f : 0.04f; - Vector2 lookAt = AIState == (int)Phase.Deathray ? (calamityGlobalNPC.newAI[3] == 0f ? new Vector2(0f, npc.Center.Y + 1000f) : new Vector2(npc.Center.X + 1000f, 0f)) : player.Center; + Vector2 lookAt = AIState == (int)Phase.Deathray ? (horizontalLaserSweep ? new Vector2(npc.Center.X, npc.Center.Y + 1000f) : new Vector2(npc.Center.X + 1000f, npc.Center.Y)) : player.Center; float rotation = (float)Math.Atan2(lookAt.Y - npc.Center.Y, lookAt.X - npc.Center.X); if (npc.spriteDirection == 1) @@ -239,29 +232,22 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (rotation > MathHelper.TwoPi) rotation -= MathHelper.TwoPi; - if (npc.rotation < rotation) - { - if (rotation - npc.rotation > MathHelper.Pi) - npc.rotation -= rateOfRotation; - else - npc.rotation += rateOfRotation; - } - if (npc.rotation > rotation) - { - if (npc.rotation - rotation > MathHelper.Pi) - npc.rotation += rateOfRotation; - else - npc.rotation -= rateOfRotation; - } + npc.rotation = npc.rotation.AngleTowards(rotation, rateOfRotation); - if (npc.rotation > rotation - rateOfRotation && npc.rotation < rotation + rateOfRotation) - npc.rotation = rotation; - if (npc.rotation < 0f) - npc.rotation += MathHelper.TwoPi; - if (npc.rotation > MathHelper.TwoPi) - npc.rotation -= MathHelper.TwoPi; - if (npc.rotation > rotation - rateOfRotation && npc.rotation < rotation + rateOfRotation) - npc.rotation = rotation; + // Direction + int direction = Math.Sign(player.Center.X - npc.Center.X); + if (direction != 0) + { + if (calamityGlobalNPC.newAI[1] == 0f && calamityGlobalNPC.newAI[2] == 0f && direction != npc.direction) + npc.rotation += MathHelper.Pi; + + npc.direction = direction; + + if (npc.spriteDirection != -npc.direction) + npc.rotation += MathHelper.Pi; + + npc.spriteDirection = -npc.direction; + } // Light Lighting.AddLight(npc.Center, 0.25f, 0.1f, 0.1f); @@ -280,13 +266,12 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } Vector2 desiredVelocity = Vector2.Normalize(destination - npc.Center) * baseVelocity; - // Distance from target - float distanceFromTarget = Vector2.Distance(npc.Center, player.Center); + // Whether Ares Laser Arm should move to its spot or not + float movementDistanceGateValue = 32f; + bool moveToLocation = Vector2.Distance(npc.Center, destination) > movementDistanceGateValue; // Gate values float deathrayPhaseGateValue = 420f; - float deathrayPhaseVelocityMult = 0.95f; - float deathrayDecelerationTime = 15f; float deathrayPhaseVelocity = 15f; // Variable to disable deathray firing @@ -304,7 +289,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Do nothing, rotate to aim at the target and fly in place case (int)Phase.Nothing: - if (!targetDead) + if (!targetDead && moveToLocation) npc.SimpleFlyMovement(desiredVelocity, baseAcceleration); calamityGlobalNPC.newAI[1] += 1f; @@ -324,31 +309,39 @@ namespace CalamityMod.NPCs.ExoMechs.Ares calamityGlobalNPC.newAI[2] += 1f; if (calamityGlobalNPC.newAI[2] < deathrayTelegraphDuration) { - // Reduce velocity for 15 frames once charging is nearly complete - if (calamityGlobalNPC.newAI[2] >= deathrayTelegraphDuration - deathrayDecelerationTime) - npc.velocity *= deathrayPhaseVelocityMult; + // Fly in place + if (moveToLocation) + npc.SimpleFlyMovement(desiredVelocity, baseAcceleration); + // Set frames to deathray charge up frames, which begin on frame 12 if (calamityGlobalNPC.newAI[2] == 1f) { - // Set frames to deathray charge up frames + // Reset the frame counter npc.frameCounter = 0D; + + // X = 1 sets to frame 8 frameX = 1; - frameY = 5; - exactFrame = 12; + + // Y = 4 sets to frame 12 + frameY = 4; } } else { + // Two possible variants: 1 - Horizontal, 2 - Vertical + + // Movement while firing deathray + if (horizontalLaserSweep) + desiredVelocity.X = 0f; + else + desiredVelocity.Y = 0f; + + npc.SimpleFlyMovement(desiredVelocity, baseAcceleration); + npc.velocity = horizontalLaserSweep ? new Vector2(deathrayPhaseVelocity, npc.velocity.Y) : new Vector2(npc.velocity.X, deathrayPhaseVelocity); + // Fire deathray if (calamityGlobalNPC.newAI[2] == deathrayTelegraphDuration) { - // Two possible variants: 1 - Left to right, 2 - Top to bottom - npc.velocity = calamityGlobalNPC.newAI[3] == 0f ? new Vector2(deathrayPhaseVelocity, 0f) : new Vector2(0f, deathrayPhaseVelocity); - - calamityGlobalNPC.newAI[3] += 1f; - if (calamityGlobalNPC.newAI[3] > 1f) - calamityGlobalNPC.newAI[3] = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); @@ -367,8 +360,15 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (calamityGlobalNPC.newAI[2] >= deathrayTelegraphDuration + deathrayDuration) { + // Reset AIState = (float)Phase.Nothing; calamityGlobalNPC.newAI[2] = 0f; + + // Change deathray sweep type for next deathray phase + calamityGlobalNPC.newAI[3] += 1f; + if (calamityGlobalNPC.newAI[3] > 1f) + calamityGlobalNPC.newAI[3] = 0f; + npc.TargetClosest(); } } @@ -389,36 +389,44 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { if (npc.frameCounter >= 10D) { + // Reset frame counter npc.frameCounter = 0D; + + // Increment the Y frame frameY++; - exactFrame++; + + // Reset the Y frame if greater than 8 if (frameY == maxFramesY) { frameX++; frameY = 0; } - if (exactFrame > normalFrameLimit) - frameX = frameY = exactFrame = 0; + + // Reset the frames + if ((frameX * maxFramesY) + frameY > normalFrameLimit) + frameX = frameY = 0; } } else { if (npc.frameCounter >= 10D) { + // Reset frame counter npc.frameCounter = 0D; + + // Increment the Y frame frameY++; - exactFrame++; + + // Reset the Y frame if greater than 8 if (frameY == maxFramesY) { frameX++; frameY = 0; } - if (exactFrame > finalStageDeathrayChargeFrameLimit) - { - frameX = 4; - frameY = 5; - exactFrame = secondStageDeathrayChargeFrameLimit + 1; - } + + // Reset the frames to frame 36, the start of the deathray firing animation loop + if ((frameX * maxFramesY) + frameY > finalStageDeathrayChargeFrameLimit) + frameX = frameY = 4; } } } diff --git a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs index f2d96146aa..d9e0b31495 100644 --- a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs +++ b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs @@ -1,9 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; -using CalamityMod.Items.Potions; -using CalamityMod.NPCs.ExoMechs.Thanatos; -using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -39,9 +34,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares private int frameX = 0; private int frameY = 0; - // The exact frame the animation is currently on - private int exactFrame = 0; - // Frame limit per animation, these are the specific frames where each animation ends private const int normalFrameLimit = 11; private const int firstStagePlasmaBoltChargeFrameLimit = 23; @@ -230,10 +222,11 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Vector2 predictionVector = player.velocity * predictionAmt; Vector2 rotationVector = player.Center + predictionVector - npc.Center; + float projectileVelocity = 12f; float rateOfRotation = AIState == (int)Phase.PlasmaBolts ? 0.08f : 0.04f; - Vector2 lookAt = player.Center + Vector2.Normalize(rotationVector); + Vector2 lookAt = Vector2.Normalize(rotationVector) * projectileVelocity; - float rotation = (float)Math.Atan2(lookAt.Y - npc.Center.Y, lookAt.X - npc.Center.X); + float rotation = (float)Math.Atan2(lookAt.Y, lookAt.X); if (npc.spriteDirection == 1) rotation += MathHelper.Pi; if (rotation < 0f) @@ -241,29 +234,22 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (rotation > MathHelper.TwoPi) rotation -= MathHelper.TwoPi; - if (npc.rotation < rotation) - { - if (rotation - npc.rotation > MathHelper.Pi) - npc.rotation -= rateOfRotation; - else - npc.rotation += rateOfRotation; - } - if (npc.rotation > rotation) - { - if (npc.rotation - rotation > MathHelper.Pi) - npc.rotation += rateOfRotation; - else - npc.rotation -= rateOfRotation; - } + npc.rotation = npc.rotation.AngleTowards(rotation, rateOfRotation); - if (npc.rotation > rotation - rateOfRotation && npc.rotation < rotation + rateOfRotation) - npc.rotation = rotation; - if (npc.rotation < 0f) - npc.rotation += MathHelper.TwoPi; - if (npc.rotation > MathHelper.TwoPi) - npc.rotation -= MathHelper.TwoPi; - if (npc.rotation > rotation - rateOfRotation && npc.rotation < rotation + rateOfRotation) - npc.rotation = rotation; + // Direction + int direction = Math.Sign(player.Center.X - npc.Center.X); + if (direction != 0) + { + if (calamityGlobalNPC.newAI[1] == 0f && calamityGlobalNPC.newAI[2] == 0f && direction != npc.direction) + npc.rotation += MathHelper.Pi; + + npc.direction = direction; + + if (npc.spriteDirection != -npc.direction) + npc.rotation += MathHelper.Pi; + + npc.spriteDirection = -npc.direction; + } // Light Lighting.AddLight(npc.Center, 0.1f, 0.25f, 0.05f); @@ -282,8 +268,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } Vector2 desiredVelocity = Vector2.Normalize(destination - npc.Center) * baseVelocity; - // Distance from target - float distanceFromTarget = Vector2.Distance(npc.Center, player.Center); + // Whether Ares Plasma Arm should move to its spot or not + float movementDistanceGateValue = 32f; + bool moveToLocation = Vector2.Distance(npc.Center, destination) > movementDistanceGateValue; // Gate values bool fireMoreBolts = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays; @@ -321,13 +308,17 @@ namespace CalamityMod.NPCs.ExoMechs.Ares calamityGlobalNPC.newAI[2] += 1f; if (calamityGlobalNPC.newAI[2] < plasmaBoltTelegraphDuration) { + // Set frames to plasma orb charge up frames, which begin on frame 12 if (calamityGlobalNPC.newAI[2] == 1f) { - // Set frames to plasma bolt charge up frames + // Reset the frame counter npc.frameCounter = 0D; + + // X = 1 sets to frame 8 frameX = 1; - frameY = 5; - exactFrame = 12; + + // Y = 4 sets to frame 12 + frameY = 4; } } else @@ -341,7 +332,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (Main.netMode != NetmodeID.MultiplayerClient) { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaCasterFire"), npc.Center); - float projectileVelocity = 12f; Vector2 plasmaBoltVelocity = Vector2.Normalize(rotationVector) * projectileVelocity; int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); @@ -363,7 +353,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } // Movement - if (!targetDead) + if (!targetDead && moveToLocation) npc.SimpleFlyMovement(desiredVelocity, baseAcceleration); } @@ -379,36 +369,44 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { if (npc.frameCounter >= 10D) { + // Reset frame counter npc.frameCounter = 0D; + + // Increment the Y frame frameY++; - exactFrame++; + + // Reset the Y frame if greater than 8 if (frameY == maxFramesY) { frameX++; frameY = 0; } - if (exactFrame > normalFrameLimit) - frameX = frameY = exactFrame = 0; + + // Reset the frames + if ((frameX * maxFramesY) + frameY > normalFrameLimit) + frameX = frameY = 0; } } else { if (npc.frameCounter >= 10D) { + // Reset frame counter npc.frameCounter = 0D; + + // Increment the Y frame frameY++; - exactFrame++; + + // Reset the Y frame if greater than 8 if (frameY == maxFramesY) { frameX++; frameY = 0; } - if (exactFrame > finalStagePlasmaBoltChargeFrameLimit) - { - frameX = 4; - frameY = 5; - exactFrame = secondStagePlasmaBoltChargeFrameLimit + 1; - } + + // Reset the frames to frame 36, the start of the plasma bolt firing animation loop + if ((frameX * maxFramesY) + frameY > finalStagePlasmaBoltChargeFrameLimit) + frameX = frameY = 4; } } } diff --git a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs index 9464136406..a2e0359667 100644 --- a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs +++ b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs @@ -1,9 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; -using CalamityMod.Items.Potions; -using CalamityMod.NPCs.ExoMechs.Thanatos; -using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -39,9 +34,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares private int frameX = 0; private int frameY = 0; - // The exact frame the animation is currently on - private int exactFrame = 0; - // Frame limit per animation, these are the specific frames where each animation ends private const int normalFrameLimit = 11; private const int firstStageTeslaOrbChargeFrameLimit = 23; @@ -226,14 +218,15 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } // Predictiveness - float predictionAmt = malice ? 30f : death ? 25f : revenge ? 20f : expertMode ? 15f : 5f; + float predictionAmt = malice ? 60f : death ? 50f : revenge ? 40f : expertMode ? 30f : 15f; Vector2 predictionVector = player.velocity * predictionAmt; Vector2 rotationVector = player.Center + predictionVector - npc.Center; + float projectileVelocity = 6f; float rateOfRotation = AIState == (int)Phase.TeslaOrbs ? 0.08f : 0.04f; - Vector2 lookAt = player.Center + Vector2.Normalize(rotationVector); + Vector2 lookAt = Vector2.Normalize(rotationVector) * projectileVelocity; - float rotation = (float)Math.Atan2(lookAt.Y - npc.Center.Y, lookAt.X - npc.Center.X); + float rotation = (float)Math.Atan2(lookAt.Y, lookAt.X); if (npc.spriteDirection == 1) rotation += MathHelper.Pi; if (rotation < 0f) @@ -241,29 +234,22 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (rotation > MathHelper.TwoPi) rotation -= MathHelper.TwoPi; - if (npc.rotation < rotation) - { - if (rotation - npc.rotation > MathHelper.Pi) - npc.rotation -= rateOfRotation; - else - npc.rotation += rateOfRotation; - } - if (npc.rotation > rotation) - { - if (npc.rotation - rotation > MathHelper.Pi) - npc.rotation += rateOfRotation; - else - npc.rotation -= rateOfRotation; - } + npc.rotation = npc.rotation.AngleTowards(rotation, rateOfRotation); - if (npc.rotation > rotation - rateOfRotation && npc.rotation < rotation + rateOfRotation) - npc.rotation = rotation; - if (npc.rotation < 0f) - npc.rotation += MathHelper.TwoPi; - if (npc.rotation > MathHelper.TwoPi) - npc.rotation -= MathHelper.TwoPi; - if (npc.rotation > rotation - rateOfRotation && npc.rotation < rotation + rateOfRotation) - npc.rotation = rotation; + // Direction + int direction = Math.Sign(player.Center.X - npc.Center.X); + if (direction != 0) + { + if (calamityGlobalNPC.newAI[1] == 0f && calamityGlobalNPC.newAI[2] == 0f && direction != npc.direction) + npc.rotation += MathHelper.Pi; + + npc.direction = direction; + + if (npc.spriteDirection != -npc.direction) + npc.rotation += MathHelper.Pi; + + npc.spriteDirection = -npc.direction; + } // Light Lighting.AddLight(npc.Center, 0.1f, 0.25f, 0.25f); @@ -282,8 +268,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } Vector2 desiredVelocity = Vector2.Normalize(destination - npc.Center) * baseVelocity; - // Distance from target - float distanceFromTarget = Vector2.Distance(npc.Center, player.Center); + // Whether Ares Tesla Arm should move to its spot or not + float movementDistanceGateValue = 32f; + bool moveToLocation = Vector2.Distance(npc.Center, destination) > movementDistanceGateValue; // Gate values bool fireMoreOrbs = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays; @@ -321,13 +308,17 @@ namespace CalamityMod.NPCs.ExoMechs.Ares calamityGlobalNPC.newAI[2] += 1f; if (calamityGlobalNPC.newAI[2] < teslaOrbTelegraphDuration) { + // Set frames to tesla orb charge up frames, which begin on frame 12 if (calamityGlobalNPC.newAI[2] == 1f) { - // Set frames to tesla orb charge up frames + // Reset the frame counter npc.frameCounter = 0D; + + // X = 1 sets to frame 8 frameX = 1; - frameY = 5; - exactFrame = 12; + + // Y = 4 sets to frame 12 + frameY = 4; } } else @@ -340,10 +331,12 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { if (Main.netMode != NetmodeID.MultiplayerClient) { - float projectileVelocity = 12f; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaBolt"), npc.Center); Vector2 teslaOrbVelocity = Vector2.Normalize(rotationVector) * projectileVelocity; - /*int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type);*/ + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + float offset = 40f; + Projectile.NewProjectile(npc.Center + Vector2.Normalize(teslaOrbVelocity) * offset, teslaOrbVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); } } } @@ -360,7 +353,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } // Movement - if (!targetDead) + if (!targetDead && moveToLocation) npc.SimpleFlyMovement(desiredVelocity, baseAcceleration); } @@ -376,36 +369,44 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { if (npc.frameCounter >= 10D) { + // Reset frame counter npc.frameCounter = 0D; + + // Increment the Y frame frameY++; - exactFrame++; + + // Reset the Y frame if greater than 8 if (frameY == maxFramesY) { frameX++; frameY = 0; } - if (exactFrame > normalFrameLimit) - frameX = frameY = exactFrame = 0; + + // Reset the frames + if ((frameX * maxFramesY) + frameY > normalFrameLimit) + frameX = frameY = 0; } } else { if (npc.frameCounter >= 10D) { + // Reset frame counter npc.frameCounter = 0D; + + // Increment the Y frame frameY++; - exactFrame++; + + // Reset the Y frame if greater than 8 if (frameY == maxFramesY) { frameX++; frameY = 0; } - if (exactFrame > finalStageTeslaOrbChargeFrameLimit) - { - frameX = 4; - frameY = 5; - exactFrame = secondStageTeslaOrbChargeFrameLimit + 1; - } + + // Reset the frames to frame 36, the start of the tesla orb firing animation loop + if ((frameX * maxFramesY) + frameY > finalStageTeslaOrbChargeFrameLimit) + frameX = frameY = 4; } } } diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index fa566074a0..07a2bd0f20 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -256,7 +256,7 @@ namespace CalamityMod.NPCs.Perforator if (blobVelocity.Y < 2f) blobVelocity.Y = 2f + sporeVelocityYAdd; - Projectile.NewProjectile(npc.Center, blobVelocity, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.Center, blobVelocity, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); } } @@ -322,7 +322,7 @@ namespace CalamityMod.NPCs.Perforator Vector2 velocity = destination + Vector2.UnitY * -maxVelocity; for (int i = 0; i < totalProjectiles + 1; i++) { - Projectile.NewProjectile(start, velocity, type, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(start, velocity, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); velocity.X += velocityAdjustment * npc.direction; } } diff --git a/Projectiles/Boss/AresGaussNukeProjectile.cs b/Projectiles/Boss/AresGaussNukeProjectile.cs index 2bdddb33df..f4e162d2bb 100644 --- a/Projectiles/Boss/AresGaussNukeProjectile.cs +++ b/Projectiles/Boss/AresGaussNukeProjectile.cs @@ -2,6 +2,7 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -28,14 +29,27 @@ namespace CalamityMod.Projectiles.Boss projectile.tileCollide = false; projectile.penetrate = -1; cooldownSlot = 1; - projectile.timeLeft = 480; + projectile.timeLeft = 180; projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } - public override void AI() + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() { + if (projectile.position.Y > projectile.ai[1]) + projectile.tileCollide = true; + // Animation - projectile.frameCounter++; + projectile.frameCounter++; if (projectile.frameCounter >= 10) { projectile.frame++; @@ -47,11 +61,10 @@ namespace CalamityMod.Projectiles.Boss // Rotation projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) - MathHelper.PiOver2; - Vector2 dustOffset = Vector2.One * 50f; - - if (projectile.ai[1] == 0f) + // Spawn effects + if (projectile.localAI[0] == 0f) { - projectile.ai[1] = 1f; + projectile.localAI[0] = 1f; for (int i = 0; i < 25; i++) { // Choose a random speed and angle @@ -65,18 +78,26 @@ namespace CalamityMod.Projectiles.Boss float scale = Main.rand.NextFloat(0.5f, 1.6f); // Spawn dust - Dust dust = Dust.NewDustPerfect(projectile.Center + dustOffset, 107, -dustVel, 0, default, scale); + Dust dust = Dust.NewDustPerfect(projectile.Center, 107, -dustVel, 0, default, scale); dust.noGravity = true; } - } - else - { - // Generate dust behind the nuke - for (int i = 0; i < 2; i++) + + // Gauss sparks + if (Main.myPlayer == projectile.owner) { - Dust dust = Dust.NewDustPerfect(projectile.Center + dustOffset, 107); - dust.velocity = -projectile.velocity * 0.5f; - dust.noGravity = true; + int totalProjectiles = CalamityWorld.malice ? 18 : 12; + float radians = MathHelper.TwoPi / totalProjectiles; + int type = ModContent.ProjectileType(); + float velocity = 12f; + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX2 = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity) : new Vector2(-velocityX2, -velocity); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(projectile.Center, velocity2 + Vector2.Normalize(projectile.velocity) * -6f, type, (int)(projectile.damage * 0.6), 0f, Main.myPlayer); + } } } @@ -115,9 +136,7 @@ namespace CalamityMod.Projectiles.Boss Rectangle frame = new Rectangle(0, projectile.frame * Main.projectileTexture[projectile.type].Height, Main.projectileTexture[projectile.type].Width, Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]); - Color color = Color.Lerp(Color.White, Color.GreenYellow, 0.5f); - - spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Boss/AresGaussNukeProjectileGlow"), projectile.Center - Main.screenPosition, frame, color, projectile.rotation, projectile.Size / 2, 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Boss/AresGaussNukeProjectileGlow"), projectile.Center - Main.screenPosition, frame, Color.White, projectile.rotation, projectile.Size / 2, 1f, SpriteEffects.None, 0f); return false; } @@ -153,21 +172,6 @@ namespace CalamityMod.Projectiles.Boss if (Main.myPlayer == projectile.owner) { - // Gauss sparks - int totalProjectiles = CalamityWorld.malice ? 18 : 12; - float radians = MathHelper.TwoPi / totalProjectiles; - int type = ModContent.ProjectileType(); - float velocity = 12f; - double angleA = radians * 0.5; - double angleB = MathHelper.ToRadians(90f) - angleA; - float velocityX2 = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); - Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity) : new Vector2(-velocityX2, -velocity); - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(projectile.Center, velocity2, type, (int)(projectile.damage * 0.6), 0f, Main.myPlayer); - } - // Explosion waves for (int i = 0; i < 7; i++) { diff --git a/Projectiles/Boss/AresGaussNukeProjectileSpark.cs b/Projectiles/Boss/AresGaussNukeProjectileSpark.cs index 22321dded1..5ca060c407 100644 --- a/Projectiles/Boss/AresGaussNukeProjectileSpark.cs +++ b/Projectiles/Boss/AresGaussNukeProjectileSpark.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -31,12 +32,32 @@ namespace CalamityMod.Projectiles.Boss projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } - public override void AI() + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 15f) + { + projectile.localAI[0] = 15f; + projectile.velocity.Y += 0.1f; + } + + if (projectile.velocity.Y > 16f) + projectile.velocity.Y = 16f; + if (projectile.timeLeft < 15) projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 15f, 0f, 1f); else - projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 595) / 5f), 0f, 1f); + projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 597) / 3f), 0f, 1f); Lighting.AddLight(projectile.Center, 0.1f * projectile.Opacity, 0.125f * projectile.Opacity, 0.025f * projectile.Opacity); @@ -64,7 +85,7 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return new Color(255 * projectile.Opacity, 255 * projectile.Opacity, 255 * projectile.Opacity, projectile.alpha); + return new Color(255 * projectile.Opacity, 255 * projectile.Opacity, 255 * projectile.Opacity); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Boss/AresPlasmaBolt.cs b/Projectiles/Boss/AresPlasmaBolt.cs index 758503b2f8..2d9cdde79b 100644 --- a/Projectiles/Boss/AresPlasmaBolt.cs +++ b/Projectiles/Boss/AresPlasmaBolt.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Boss if (projectile.timeLeft < 15) projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 15f, 0f, 1f); else - projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 595) / 5f), 0f, 1f); + projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 597) / 3f), 0f, 1f); Lighting.AddLight(projectile.Center, 0f, 0.4f * projectile.Opacity, 0f); @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return new Color(255 * projectile.Opacity, 255 * projectile.Opacity, 255 * projectile.Opacity, projectile.alpha); + return new Color(255 * projectile.Opacity, 255 * projectile.Opacity, 255 * projectile.Opacity); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Boss/AresPlasmaFireball.cs b/Projectiles/Boss/AresPlasmaFireball.cs index 89bad0aa02..26792a2262 100644 --- a/Projectiles/Boss/AresPlasmaFireball.cs +++ b/Projectiles/Boss/AresPlasmaFireball.cs @@ -2,6 +2,7 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -29,17 +30,27 @@ namespace CalamityMod.Projectiles.Boss projectile.penetrate = -1; projectile.Opacity = 0f; cooldownSlot = 1; - projectile.timeLeft = 480; + projectile.timeLeft = 240; projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } - public override void AI() + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() { Vector2 targetLocation = new Vector2(projectile.ai[0], projectile.ai[1]); if (Vector2.Distance(targetLocation, projectile.Center) < 80f) projectile.tileCollide = true; - projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 475) / 5f), 0f, 1f); + projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 237) / 3f), 0f, 1f); Lighting.AddLight(projectile.Center, 0f, 0.6f * projectile.Opacity, 0f); @@ -122,7 +133,7 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return new Color(255 * projectile.Opacity, 255 * projectile.Opacity, 255 * projectile.Opacity, projectile.alpha); + return new Color(255 * projectile.Opacity, 255 * projectile.Opacity, 255 * projectile.Opacity); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Boss/AresTeslaOrb.cs b/Projectiles/Boss/AresTeslaOrb.cs new file mode 100644 index 0000000000..aab8c1cf35 --- /dev/null +++ b/Projectiles/Boss/AresTeslaOrb.cs @@ -0,0 +1,156 @@ +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class AresTeslaOrb : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tesla Orb"); + Main.projFrames[projectile.type] = 4; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.Opacity = 0f; + cooldownSlot = 1; + projectile.timeLeft = 480; + projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + if (projectile.timeLeft < 15) + projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 15f, 0f, 1f); + else + projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 477) / 3f), 0f, 1f); + + Lighting.AddLight(projectile.Center, 0.1f * projectile.Opacity, 0.25f * projectile.Opacity, 0.25f * projectile.Opacity); + + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frame++; + projectile.frameCounter = 0; + } + if (projectile.frame > 3) + projectile.frame = 0; + + if (projectile.localAI[0] == 0f) + { + projectile.localAI[0] = 1f; + + float speed1 = 1.8f; + float speed2 = 2.8f; + float angleRandom = 0.35f; + + for (int num53 = 0; num53 < 40; num53++) + { + float dustSpeed = Main.rand.NextFloat(speed1, speed2); + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(projectile.velocity.ToRotation()); + dustVel = dustVel.RotatedBy(-angleRandom); + dustVel = dustVel.RotatedByRandom(2f * angleRandom); + int randomDustType = Main.rand.Next(2) == 0 ? 206 : 229; + float scale = randomDustType == 206 ? 1.5f : 1f; + + int num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 200, default, 2.5f * scale); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; + Main.dust[num54].noGravity = true; + + Dust dust = Main.dust[num54]; + dust.velocity *= 3f; + dust = Main.dust[num54]; + + num54 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 100, default, 1.5f * scale); + Main.dust[num54].position = projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * projectile.width / 2f; + + dust = Main.dust[num54]; + dust.velocity *= 2f; + + Main.dust[num54].noGravity = true; + Main.dust[num54].fadeIn = 1f; + Main.dust[num54].color = Color.Cyan * 0.5f; + + dust = Main.dust[num54]; + } + for (int num55 = 0; num55 < 20; num55++) + { + float dustSpeed = Main.rand.NextFloat(speed1, speed2); + Vector2 dustVel = new Vector2(dustSpeed, 0f).RotatedBy(projectile.velocity.ToRotation()); + dustVel = dustVel.RotatedBy(-angleRandom); + dustVel = dustVel.RotatedByRandom(2f * angleRandom); + int randomDustType = Main.rand.Next(2) == 0 ? 206 : 229; + float scale = randomDustType == 206 ? 1.5f : 1f; + + int num56 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDustType, dustVel.X, dustVel.Y, 0, default, 3f * scale); + Main.dust[num56].position = projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(projectile.velocity.ToRotation()) * projectile.width / 3f; + Main.dust[num56].noGravity = true; + + Dust dust = Main.dust[num56]; + dust.velocity *= 0.5f; + dust = Main.dust[num56]; + } + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.velocity = oldVelocity; + + if (projectile.timeLeft > 15) + projectile.timeLeft = 15; + + return false; + } + + public override bool CanHitPlayer(Player target) => projectile.Opacity == 1f; + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + if (projectile.Opacity != 1f) + return; + + target.AddBuff(BuffID.Electrified, 240); + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(255 * projectile.Opacity, 255 * projectile.Opacity, 255 * projectile.Opacity); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1); + return false; + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { + target.Calamity().lastProjectileHit = projectile; + } + } +} diff --git a/Projectiles/Boss/BloodGeyser.cs b/Projectiles/Boss/BloodGeyser.cs index 7ac2d5dd6a..dbd9aad4a7 100644 --- a/Projectiles/Boss/BloodGeyser.cs +++ b/Projectiles/Boss/BloodGeyser.cs @@ -25,10 +25,10 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - if (projectile.timeLeft < 300) - projectile.tileCollide = true; + if (projectile.position.Y > projectile.ai[1]) + projectile.tileCollide = true; - projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, DustID.Blood, 0f, 0f, 100, default, 0.5f); Main.dust[num469].noGravity = true; diff --git a/Projectiles/Boss/BrimstoneBarrage.cs b/Projectiles/Boss/BrimstoneBarrage.cs index 53edf79ac2..a9a1b47f3e 100644 --- a/Projectiles/Boss/BrimstoneBarrage.cs +++ b/Projectiles/Boss/BrimstoneBarrage.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs.Calamitas; using CalamityMod.NPCs.SupremeCalamitas; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -64,7 +65,7 @@ namespace CalamityMod.Projectiles.Boss projectile.localAI[0] = 1f; if (projectile.ai[0] == 0f) - projectile.damage = projectile.GetProjectileDamage(ModContent.NPCType()); + projectile.damage = NPC.AnyNPCs(ModContent.NPCType()) ? projectile.GetProjectileDamage(ModContent.NPCType()) : projectile.GetProjectileDamage(ModContent.NPCType()); } Lighting.AddLight(projectile.Center, 0.75f * projectile.Opacity, 0f, 0f); diff --git a/Projectiles/Boss/BrimstoneHellblast2.cs b/Projectiles/Boss/BrimstoneHellblast2.cs index 78e97521ed..370d878206 100644 --- a/Projectiles/Boss/BrimstoneHellblast2.cs +++ b/Projectiles/Boss/BrimstoneHellblast2.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Boss if (projectile.ai[0] == 2f && Main.expertMode && projectile.timeLeft < 1260) { if (projectile.velocity.Length() < (CalamityWorld.malice ? 10f : 8f)) - projectile.velocity *= 1.02f; + projectile.velocity *= 1.01f; } projectile.frameCounter++; diff --git a/Projectiles/Boss/BrimstoneHellfireball.cs b/Projectiles/Boss/BrimstoneHellfireball.cs index cfa0eeaa1a..859d149824 100644 --- a/Projectiles/Boss/BrimstoneHellfireball.cs +++ b/Projectiles/Boss/BrimstoneHellfireball.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - //Animation + // Animation projectile.frameCounter++; if (projectile.frameCounter > 9) { @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Boss if (projectile.frame >= 6) projectile.frame = 0; - //Fade in + // Fade in if (projectile.alpha > 5) projectile.alpha -= 15; if (projectile.alpha < 5) @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Boss projectile.Kill(); } - //Rotation + // Rotation projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) - MathHelper.ToRadians(90f) * projectile.direction; diff --git a/Projectiles/Boss/DoGFire.cs b/Projectiles/Boss/DoGFire.cs index 62abfb3a55..c43e1b561c 100644 --- a/Projectiles/Boss/DoGFire.cs +++ b/Projectiles/Boss/DoGFire.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 30; - projectile.height = 30; + projectile.width = 34; + projectile.height = 34; projectile.hostile = true; projectile.ignoreWater = true; projectile.tileCollide = false; diff --git a/Projectiles/Boss/HiveBombGoliath.cs b/Projectiles/Boss/HiveBombGoliath.cs index fc4c722210..6cd57878ad 100644 --- a/Projectiles/Boss/HiveBombGoliath.cs +++ b/Projectiles/Boss/HiveBombGoliath.cs @@ -20,10 +20,11 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 14; - projectile.height = 14; + projectile.width = 22; + projectile.height = 22; projectile.hostile = true; projectile.tileCollide = false; + projectile.ignoreWater = true; projectile.penetrate = 1; projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } diff --git a/Projectiles/Boss/IchorBlob.cs b/Projectiles/Boss/IchorBlob.cs index 6df530e4c4..2ea08d80eb 100644 --- a/Projectiles/Boss/IchorBlob.cs +++ b/Projectiles/Boss/IchorBlob.cs @@ -24,6 +24,7 @@ namespace CalamityMod.Projectiles.Boss projectile.height = 56; projectile.hostile = true; projectile.ignoreWater = true; + projectile.tileCollide = false; projectile.penetrate = -1; projectile.Calamity().affectedByMaliceModeVelocityMultiplier = true; } @@ -31,18 +32,23 @@ namespace CalamityMod.Projectiles.Boss public override void SendExtraAI(BinaryWriter writer) { writer.Write(projectile.localAI[0]); - } + writer.Write(projectile.localAI[1]); + } public override void ReceiveExtraAI(BinaryReader reader) { projectile.localAI[0] = reader.ReadSingle(); - } + projectile.localAI[1] = reader.ReadSingle(); + } public override void AI() { + if (projectile.position.Y > projectile.ai[1] - 32f) + projectile.tileCollide = true; + // Deal no damage and increment the variable used to kill the projectile after 15 seconds - projectile.ai[1] += 1f; - if (projectile.ai[1] > 900f) + projectile.localAI[1] += 1f; + if (projectile.localAI[1] > 900f) { projectile.localAI[0] += 10f; projectile.damage = 0; @@ -183,14 +189,14 @@ namespace CalamityMod.Projectiles.Boss if (dist4 < minDist) minDist = dist4; - return minDist <= 16f && projectile.ai[1] <= 900f && projectile.ai[1] > 120f; + return minDist <= 16f && projectile.localAI[1] <= 900f && projectile.localAI[1] > 120f; } public override Color? GetAlpha(Color lightColor) { - if (projectile.ai[1] > 900f) + if (projectile.localAI[1] > 900f) { - byte b2 = (byte)((26f - (projectile.ai[1] - 900f)) * 10f); + byte b2 = (byte)((26f - (projectile.localAI[1] - 900f)) * 10f); byte a2 = (byte)(projectile.alpha * (b2 / 255f)); return new Color(b2, b2, b2, a2); } @@ -205,7 +211,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - if (projectile.ai[1] <= 900f && projectile.ai[1] > 120f) + if (projectile.localAI[1] <= 900f && projectile.localAI[1] > 120f) target.AddBuff(BuffID.Ichor, 240); } } diff --git a/Projectiles/Boss/IchorShot.cs b/Projectiles/Boss/IchorShot.cs index dd784dc028..0fef693982 100644 --- a/Projectiles/Boss/IchorShot.cs +++ b/Projectiles/Boss/IchorShot.cs @@ -26,19 +26,17 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - if (projectile.timeLeft < 300) - projectile.tileCollide = true; + if (projectile.position.Y > projectile.ai[1]) + projectile.tileCollide = true; - projectile.frameCounter++; + projectile.frameCounter++; if (projectile.frameCounter > 4) { projectile.frame++; projectile.frameCounter = 0; } if (projectile.frame > 5) - { projectile.frame = 0; - } projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; diff --git a/Projectiles/Boss/ProfanedSpear.cs b/Projectiles/Boss/ProfanedSpear.cs index 2bb342cb8b..0788cf133c 100644 --- a/Projectiles/Boss/ProfanedSpear.cs +++ b/Projectiles/Boss/ProfanedSpear.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 38; - projectile.height = 38; + projectile.width = 32; + projectile.height = 32; projectile.hostile = true; projectile.tileCollide = false; projectile.penetrate = -1; @@ -93,7 +93,7 @@ namespace CalamityMod.Projectiles.Boss { target.AddBuff(ModContent.BuffType(), 180); } - + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) { target.Calamity().lastProjectileHit = projectile; diff --git a/Projectiles/Boss/ProfanedSpear.png b/Projectiles/Boss/ProfanedSpear.png index da7ba8cfd4..9597288aff 100644 Binary files a/Projectiles/Boss/ProfanedSpear.png and b/Projectiles/Boss/ProfanedSpear.png differ diff --git a/Projectiles/Boss/ProvidenceCrystalShard.cs b/Projectiles/Boss/ProvidenceCrystalShard.cs index a61aaaef7d..357096060b 100644 --- a/Projectiles/Boss/ProvidenceCrystalShard.cs +++ b/Projectiles/Boss/ProvidenceCrystalShard.cs @@ -24,6 +24,7 @@ namespace CalamityMod.Projectiles.Boss projectile.alpha = 255; projectile.penetrate = 1; projectile.tileCollide = false; + projectile.ignoreWater = true; projectile.timeLeft = 600; cooldownSlot = 1; } diff --git a/Projectiles/Boss/ScavengerLaser.cs b/Projectiles/Boss/ScavengerLaser.cs index 4382b285d8..197b1928a2 100644 --- a/Projectiles/Boss/ScavengerLaser.cs +++ b/Projectiles/Boss/ScavengerLaser.cs @@ -21,8 +21,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; + projectile.width = 16; + projectile.height = 16; projectile.hostile = true; projectile.tileCollide = false; projectile.penetrate = -1; diff --git a/Projectiles/Boss/YharonFireball.cs b/Projectiles/Boss/YharonFireball.cs index d92250c5a8..0fc17a5f0e 100644 --- a/Projectiles/Boss/YharonFireball.cs +++ b/Projectiles/Boss/YharonFireball.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 30; - projectile.height = 30; + projectile.width = 34; + projectile.height = 34; projectile.hostile = true; projectile.alpha = 255; projectile.penetrate = -1; diff --git a/Projectiles/Boss/YharonFireball2.cs b/Projectiles/Boss/YharonFireball2.cs index bc73c9c7e8..7ba7cd8a79 100644 --- a/Projectiles/Boss/YharonFireball2.cs +++ b/Projectiles/Boss/YharonFireball2.cs @@ -23,8 +23,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 30; - projectile.height = 30; + projectile.width = 34; + projectile.height = 34; projectile.hostile = true; projectile.alpha = 255; projectile.penetrate = -1; @@ -36,13 +36,11 @@ namespace CalamityMod.Projectiles.Boss public override void SendExtraAI(BinaryWriter writer) { writer.Write(projectile.localAI[0]); - writer.Write(projectile.localAI[1]); } public override void ReceiveExtraAI(BinaryReader reader) { projectile.localAI[0] = reader.ReadSingle(); - projectile.localAI[1] = reader.ReadSingle(); } public override void AI() @@ -54,41 +52,38 @@ namespace CalamityMod.Projectiles.Boss projectile.frameCounter = 0; } if (projectile.frame >= Main.projFrames[projectile.type]) - { projectile.frame = 0; - } - if (projectile.velocity.Y < 0f) + + if (projectile.velocity.Y < -1f) { + // 129 frames to get from -50 to -1 projectile.velocity.Y *= 0.97f; } else { - projectile.velocity.Y *= 1.03f; - if (projectile.velocity.Y > 16f) - { + // 85 frames to get from -1 to 16 + projectile.velocity.Y += 0.2f; + if (projectile.velocity.Y > 16f) projectile.velocity.Y = 16f; - } - } - if (projectile.velocity.Y > -1f && projectile.localAI[1] == 0f) - { - projectile.localAI[1] = 1f; - projectile.velocity.Y = 1f; } + projectile.velocity.X *= 0.995f; + projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; + if (projectile.localAI[0] == 0f) { projectile.localAI[0] = 1f; Main.PlayTrackedSound(SoundID.DD2_BetsyFireballShot, projectile.Center); } + if (projectile.ai[0] >= 2f) { projectile.alpha -= 25; if (projectile.alpha < 0) - { projectile.alpha = 0; - } } + if (Main.rand.NextBool(16)) { Dust dust = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, 55, 0f, 0f, 200, default, 1f); diff --git a/Sounds/Custom/THanosLaser.ogg b/Sounds/Custom/THanosLaser.ogg index 46efb4dc75..7988df49f1 100644 Binary files a/Sounds/Custom/THanosLaser.ogg and b/Sounds/Custom/THanosLaser.ogg differ diff --git a/Utilities/NPCStats.cs b/Utilities/NPCStats.cs index d6f2f6f6f8..33f8bd4795 100644 --- a/Utilities/NPCStats.cs +++ b/Utilities/NPCStats.cs @@ -660,6 +660,7 @@ namespace CalamityMod { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 84, 136, 156, 168, 234 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 84, 136, 156, 168, 234 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 84, 136, 156, 168, 234 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 112, 128, 140, 192 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 76, 120, 140, 152, 210 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 72, 116, 136, 144, 204 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 60, 100, 108, 116, 162 } }, @@ -814,7 +815,7 @@ namespace CalamityMod //{ new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 500, 752, 788, 808, 1182 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 450, 676, 712, 732, 1068 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 400, 600, 632, 648, 948 } }, - //{ new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 500, 752, 788, 808, 1182 } }, { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossIceMist), new int[] { 400, 600, 632, 648, 948 } },