From e9b7ac0ebfc6d98209a80ea8af3a025f1096fac7 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Wed, 4 Aug 2021 01:36:19 -0500 Subject: [PATCH] 1 - Adult Eidolon Wyrm crack cocaine on higher difficulties. 2 - Ares body and arms moved down a bit, proper arm rotation and movement implemented. 3 - Young Wyrms and Eidolists no longer drop loot if the Adult Wyrm is alive. 4 - T Hanos no longer fires a hellstorm of lasers in deathray phase. 5 - Verium Bullets no longer hurt friendly NPCs. --- NPCs/Abyss/EidolonWyrmBodyAltHuge.cs | 15 ++++-- NPCs/Abyss/EidolonWyrmBodyHuge.cs | 15 ++++-- NPCs/Abyss/EidolonWyrmHead.cs | 14 +++++- NPCs/Abyss/EidolonWyrmHeadHuge.cs | 49 ++++++++++-------- NPCs/Abyss/EidolonWyrmTailHuge.cs | 13 +++-- NPCs/CalamityAI.cs | 1 - NPCs/ExoMechs/Ares/AresBody.cs | 2 +- NPCs/ExoMechs/Ares/AresGaussNuke.cs | 53 +++++++++++++++++--- NPCs/ExoMechs/Ares/AresLaserCannon.cs | 40 +++++++++++++-- NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs | 52 ++++++++++++++++--- NPCs/ExoMechs/Ares/AresTeslaCannon.cs | 52 ++++++++++++++++--- NPCs/ExoMechs/Thanatos/ThanatosBody1.cs | 9 +++- NPCs/ExoMechs/Thanatos/ThanatosBody2.cs | 9 +++- NPCs/ExoMechs/Thanatos/ThanatosTail.cs | 9 +++- NPCs/NormalNPCs/Eidolist.cs | 14 +++++- NPCs/Perforator/PerforatorHeadLarge.cs | 1 + Projectiles/Ranged/VeriumBulletProj.cs | 2 +- 17 files changed, 285 insertions(+), 65 deletions(-) diff --git a/NPCs/Abyss/EidolonWyrmBodyAltHuge.cs b/NPCs/Abyss/EidolonWyrmBodyAltHuge.cs index 1b9d7ad58f..b74faf0e5f 100644 --- a/NPCs/Abyss/EidolonWyrmBodyAltHuge.cs +++ b/NPCs/Abyss/EidolonWyrmBodyAltHuge.cs @@ -1,3 +1,4 @@ +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -55,7 +56,13 @@ namespace CalamityMod.NPCs.Abyss { npc.damage = 0; - if (npc.ai[2] > 0f) + // Difficulty modes + bool malice = CalamityWorld.malice; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + + if (npc.ai[2] > 0f) npc.realLife = (int)npc.ai[2]; // Check if other segments are still alive, if not, die @@ -82,8 +89,8 @@ namespace CalamityMod.NPCs.Abyss CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)npc.ai[2]].Calamity(); - float chargePhaseGateValue = 300f; - float lightningChargePhaseGateValue = 180f; + float chargePhaseGateValue = malice ? 120f : death ? 180f : revenge ? 210f : expertMode ? 240f : 300f; + float lightningChargePhaseGateValue = malice ? 90f : death ? 120f : revenge ? 135f : expertMode ? 150f : 180f; bool invisiblePartOfChargePhase = calamityGlobalNPC_Head.newAI[2] >= chargePhaseGateValue && calamityGlobalNPC_Head.newAI[2] <= chargePhaseGateValue + 1f && (calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.ChargeOne || calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.ChargeTwo || calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.FastCharge); bool invisiblePartOfLightningChargePhase = calamityGlobalNPC_Head.newAI[2] >= lightningChargePhaseGateValue && calamityGlobalNPC_Head.newAI[2] <= lightningChargePhaseGateValue + 1f && calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.LightningCharge; @@ -111,7 +118,7 @@ namespace CalamityMod.NPCs.Abyss if (Vector2.Distance(npc.Center, Main.player[Main.npc[(int)npc.ai[2]].target].Center) > 160f) { npc.localAI[0] += 1f; - float shootShadowFireballGateValue = 90f; + float shootShadowFireballGateValue = malice ? 60f : death ? 70f : revenge ? 75f : expertMode ? 80f : 90f; float divisor = 2f; if (npc.ai[3] % divisor == 0f && npc.localAI[0] >= shootShadowFireballGateValue) { diff --git a/NPCs/Abyss/EidolonWyrmBodyHuge.cs b/NPCs/Abyss/EidolonWyrmBodyHuge.cs index 8d975e6f76..59a6a68acf 100644 --- a/NPCs/Abyss/EidolonWyrmBodyHuge.cs +++ b/NPCs/Abyss/EidolonWyrmBodyHuge.cs @@ -1,3 +1,4 @@ +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -55,7 +56,13 @@ namespace CalamityMod.NPCs.Abyss { npc.damage = 0; - if (npc.ai[2] > 0f) + // Difficulty modes + bool malice = CalamityWorld.malice; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + + if (npc.ai[2] > 0f) npc.realLife = (int)npc.ai[2]; // Check if other segments are still alive, if not, die @@ -82,8 +89,8 @@ namespace CalamityMod.NPCs.Abyss CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)npc.ai[2]].Calamity(); - float chargePhaseGateValue = 300f; - float lightningChargePhaseGateValue = 180f; + float chargePhaseGateValue = malice ? 120f : death ? 180f : revenge ? 210f : expertMode ? 240f : 300f; + float lightningChargePhaseGateValue = malice ? 90f : death ? 120f : revenge ? 135f : expertMode ? 150f : 180f; bool invisiblePartOfChargePhase = calamityGlobalNPC_Head.newAI[2] >= chargePhaseGateValue && calamityGlobalNPC_Head.newAI[2] <= chargePhaseGateValue + 1f && (calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.ChargeOne || calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.ChargeTwo || calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.FastCharge); bool invisiblePartOfLightningChargePhase = calamityGlobalNPC_Head.newAI[2] >= lightningChargePhaseGateValue && calamityGlobalNPC_Head.newAI[2] <= lightningChargePhaseGateValue + 1f && calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.LightningCharge; @@ -111,7 +118,7 @@ namespace CalamityMod.NPCs.Abyss if (Vector2.Distance(npc.Center, Main.player[Main.npc[(int)npc.ai[2]].target].Center) > 160f) { npc.localAI[0] += 1f; - float spawnAncientLightGateValue = 120f; + float spawnAncientLightGateValue = malice ? 90f : death ? 100f : revenge ? 105f : expertMode ? 110f : 120f; float divisor = 4f; if (npc.ai[3] % divisor == 0f && npc.localAI[0] >= spawnAncientLightGateValue) { diff --git a/NPCs/Abyss/EidolonWyrmHead.cs b/NPCs/Abyss/EidolonWyrmHead.cs index ad12776944..c824e17976 100644 --- a/NPCs/Abyss/EidolonWyrmHead.cs +++ b/NPCs/Abyss/EidolonWyrmHead.cs @@ -451,7 +451,19 @@ namespace CalamityMod.NPCs.Abyss return 0f; } - public override void NPCLoot() + public override bool PreNPCLoot() + { + bool adultWyrmAlive = false; + if (CalamityGlobalNPC.adultEidolonWyrmHead != -1) + { + if (Main.npc[CalamityGlobalNPC.adultEidolonWyrmHead].active) + adultWyrmAlive = true; + } + + return !adultWyrmAlive; + } + + public override void NPCLoot() { DropHelper.DropItem(npc, ModContent.ItemType(), 30, 40); if (Main.rand.NextBool(10)) diff --git a/NPCs/Abyss/EidolonWyrmHeadHuge.cs b/NPCs/Abyss/EidolonWyrmHeadHuge.cs index 6ff518cf75..44127460ec 100644 --- a/NPCs/Abyss/EidolonWyrmHeadHuge.cs +++ b/NPCs/Abyss/EidolonWyrmHeadHuge.cs @@ -276,14 +276,14 @@ namespace CalamityMod.NPCs.Abyss // Phase gate values float velocityAdjustTime = 20f; - float chargePhaseGateValue = 300f; - float lightningRainDuration = 180f; - float eidolonWyrmPhaseDuration = 180f; - float iceMistDuration = 180f; - float spinPhaseDuration = 300f; + float chargePhaseGateValue = malice ? 120f : death ? 180f : revenge ? 210f : expertMode ? 240f : 300f; + float lightningRainDuration = malice ? 150f : 180f; + float eidolonWyrmPhaseDuration = malice ? 90f : death ? 120f : revenge ? 135f : expertMode ? 150f : 180f; + float iceMistDuration = malice ? 150f : 180f; + float spinPhaseDuration = malice ? 210f : death ? 240f : revenge ? 255f : expertMode ? 270f : 300f; float ancientDoomPhaseGateValue = 30f; - float ancientDoomGateValue = 120f; - float lightningChargePhaseGateValue = 180f; + float ancientDoomGateValue = malice ? 80f : death ? 95f : revenge ? 100f : expertMode ? 105f : 120f; + float lightningChargePhaseGateValue = malice ? 90f : death ? 120f : revenge ? 135f : expertMode ? 150f : 180f; // Adjust slowing debuff immunity bool immuneToSlowingDebuffs = AIState == (float)Phase.FinalPhase || AIState == (float)Phase.ShadowFireballSpin; @@ -365,7 +365,7 @@ namespace CalamityMod.NPCs.Abyss } Vector2 chargeLocation = destination + chargeVector; Vector2 chargeVectorFlipped = chargeVector * -1f; - float chargePredictionAmt = 60f; + float chargePredictionAmt = malice ? 60f : death ? 50f : revenge ? 40f : expertMode ? 30f : 20f; // Lightning Rain variables Vector2 lightningRainLocation = new Vector2(0f, -baseDistance); @@ -374,7 +374,8 @@ namespace CalamityMod.NPCs.Abyss // Wyrm and Eidolist variables Vector2 eidolonWyrmPhaseLocation = new Vector2(0f, baseDistance); float eidolonWyrmPhaseLocationDistance = turnDistance * 0.5f; - int maxEidolists = targetDownDeep ? 3 : 5; + int eidolistScale = malice ? 4 : death ? 3 : revenge ? 2 : expertMode ? 1 : 0; + int maxEidolists = (targetDownDeep ? 3 : 5) + eidolistScale; // Ice Mist variables Vector2 iceMistLocation = new Vector2(0f, baseDistance); @@ -388,8 +389,9 @@ namespace CalamityMod.NPCs.Abyss // Ancient Doom variables Vector2 ancientDoomLocation = new Vector2(0f, -baseDistance); float ancientDoomLocationDistance = turnDistance * 0.2f; - int ancientDoomLimit = targetDownDeep ? 5 : 8; - int ancientDoomDistance = 550; + int ancientDoomScale = malice ? 4 : death ? 3 : revenge ? 2 : expertMode ? 1 : 0; + int ancientDoomLimit = (targetDownDeep ? 4 : 6) + ancientDoomScale; + int ancientDoomDistance = malice ? 480 : death ? 520 : revenge ? 535 : expertMode ? 550 : 600; float maxAncientDoomRings = 3f; // Lightning charge variables @@ -399,12 +401,13 @@ namespace CalamityMod.NPCs.Abyss Vector2 lightningChargeVectorFlipped = lightningChargeVector * -1f; float lightningSpawnY = 540f; Vector2 lightningSpawnLocation = new Vector2(npc.Center.X, npc.Center.Y - lightningSpawnY); - int numLightningBolts = 8; + int numLightningBolts = malice ? 12 : death ? 10 : revenge ? 8 : expertMode ? 6 : 4; float distanceBetweenBolts = lightningSpawnY * 2f / numLightningBolts; // Velocity and turn speed values + float velocityScale = malice ? 4f : death ? 2.5f : revenge ? 2f : expertMode ? 1.5f : 0f; float baseVelocity = targetDownDeep ? 12f : 18f; - float turnSpeed = targetDownDeep ? MathHelper.ToRadians(1.5f) : MathHelper.ToRadians(2.25f); + float turnSpeed = baseVelocity * 0.125f; float normalChargeVelocityMult = MathHelper.Lerp(1f, 2f, chargeVelocityScalar); float normalChargeTurnSpeedMult = MathHelper.Lerp(1f, 8f, chargeVelocityScalar); float invisiblePhaseVelocityMult = MathHelper.Lerp(1f, 1.5f, chargeVelocityScalar); @@ -548,7 +551,8 @@ namespace CalamityMod.NPCs.Abyss } float predictionAmt = targetDownDeep ? 45f : 60f; - float lightningVelocity = (targetDownDeep && !targetOnMount) ? 6f : 8f; + float lightningVelocityScale = malice ? 3f : death ? 2f : revenge ? 1.5f : expertMode ? 1f : 0f; + float lightningVelocity = ((targetDownDeep && !targetOnMount) ? 6f : 8f) + lightningVelocityScale; for (int i = 0; i < numProjectiles; i++) { // Predictive bolt @@ -864,7 +868,8 @@ namespace CalamityMod.NPCs.Abyss } float predictionAmt = targetDownDeep ? 90f : 120f; - float iceMistVelocity = targetDownDeep ? 12f : 16f; + float iceMistVelocityScale = malice ? 3f : death ? 2f : revenge ? 1.5f : expertMode ? 1f : 0f; + float iceMistVelocity = (targetDownDeep ? 12f : 16f) + iceMistVelocityScale; for (int i = 0; i < numProjectiles; i++) { // Predictive mist @@ -1015,9 +1020,9 @@ namespace CalamityMod.NPCs.Abyss if (aiGateValue % ancientDoomGateValue == 0f) { // Spawn 3 (or more) circles of Ancient Dooms around the target - int ancientDoomScale = (int)(aiGateValue / ancientDoomGateValue); - ancientDoomLimit += ancientDoomScale; - ancientDoomDistance += ancientDoomScale * 45; + int ancientDoomScale2 = (int)(aiGateValue / ancientDoomGateValue); + ancientDoomLimit += ancientDoomScale2; + ancientDoomDistance += ancientDoomScale2 * 45; int ancientDoomDegrees = 360 / ancientDoomLimit; for (int i = 0; i < ancientDoomLimit; i++) { @@ -1099,7 +1104,7 @@ namespace CalamityMod.NPCs.Abyss { Vector2 projectileDestination = player.Center - lightningSpawnLocation; float ai = Main.rand.Next(100); - int proj = Projectile.NewProjectile(lightningSpawnLocation, npc.velocity, type, damage, 0f, Main.myPlayer, projectileDestination.ToRotation(), ai); + int proj = Projectile.NewProjectile(lightningSpawnLocation, npc.velocity * 0.5f, type, damage, 0f, Main.myPlayer, projectileDestination.ToRotation(), ai); Main.projectile[proj].tileCollide = false; lightningSpawnLocation.Y += distanceBetweenBolts; if (i == numLightningBolts / 2) @@ -1213,9 +1218,9 @@ namespace CalamityMod.NPCs.Abyss if (aiGateValue % ancientDoomGateValue == 0f) { // Spawn 3 (or more) circles of Ancient Dooms around the target - int ancientDoomScale = (int)(aiGateValue / ancientDoomGateValue); - ancientDoomLimit += ancientDoomScale; - ancientDoomDistance += ancientDoomScale * 45; + int ancientDoomScale2 = (int)(aiGateValue / ancientDoomGateValue); + ancientDoomLimit += ancientDoomScale2; + ancientDoomDistance += ancientDoomScale2 * 45; int ancientDoomDegrees = 360 / ancientDoomLimit; for (int i = 0; i < ancientDoomLimit; i++) { diff --git a/NPCs/Abyss/EidolonWyrmTailHuge.cs b/NPCs/Abyss/EidolonWyrmTailHuge.cs index f4884a0383..4feebde6d5 100644 --- a/NPCs/Abyss/EidolonWyrmTailHuge.cs +++ b/NPCs/Abyss/EidolonWyrmTailHuge.cs @@ -1,3 +1,4 @@ +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -44,7 +45,13 @@ namespace CalamityMod.NPCs.Abyss { npc.damage = 0; - if (npc.ai[2] > 0f) + // Difficulty modes + bool malice = CalamityWorld.malice; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + + if (npc.ai[2] > 0f) npc.realLife = (int)npc.ai[2]; // Check if other segments are still alive, if not, die @@ -71,8 +78,8 @@ namespace CalamityMod.NPCs.Abyss CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)npc.ai[2]].Calamity(); - float chargePhaseGateValue = 300f; - float lightningChargePhaseGateValue = 180f; + float chargePhaseGateValue = malice ? 120f : death ? 180f : revenge ? 210f : expertMode ? 240f : 300f; + float lightningChargePhaseGateValue = malice ? 90f : death ? 120f : revenge ? 135f : expertMode ? 150f : 180f; bool invisiblePartOfChargePhase = calamityGlobalNPC_Head.newAI[2] >= chargePhaseGateValue && calamityGlobalNPC_Head.newAI[2] <= chargePhaseGateValue + 1f && (calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.ChargeOne || calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.ChargeTwo || calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.FastCharge); bool invisiblePartOfLightningChargePhase = calamityGlobalNPC_Head.newAI[2] >= lightningChargePhaseGateValue && calamityGlobalNPC_Head.newAI[2] <= lightningChargePhaseGateValue + 1f && calamityGlobalNPC_Head.newAI[0] == (float)EidolonWyrmHeadHuge.Phase.LightningCharge; diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index c7eecb2474..0a4ffe66ec 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -5554,7 +5554,6 @@ namespace CalamityMod.NPCs } // Rotation - // Phase switch float rateOfRotation = 0.04f; if (npc.ai[0] == 1f || npc.ai[0] == 6f || npc.ai[0] == 7f || npc.ai[0] == 14f) rateOfRotation = 0f; diff --git a/NPCs/ExoMechs/Ares/AresBody.cs b/NPCs/ExoMechs/Ares/AresBody.cs index 6fbda5b4cb..ef7c4c3cf9 100644 --- a/NPCs/ExoMechs/Ares/AresBody.cs +++ b/NPCs/ExoMechs/Ares/AresBody.cs @@ -320,7 +320,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares npc.rotation = npc.velocity.X * 0.003f; // 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 - 500f) : player.Center; + 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; // Velocity and acceleration values float baseVelocityMult = malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f; diff --git a/NPCs/ExoMechs/Ares/AresGaussNuke.cs b/NPCs/ExoMechs/Ares/AresGaussNuke.cs index 75b8e5cfa8..56379fc89b 100644 --- a/NPCs/ExoMechs/Ares/AresGaussNuke.cs +++ b/NPCs/ExoMechs/Ares/AresGaussNuke.cs @@ -224,8 +224,45 @@ namespace CalamityMod.NPCs.ExoMechs.Ares npc.Opacity = 0f; } - // Rotate the cannon to look at the target - // npc.rotation = npc.velocity.X * 0.003f; + // Predictiveness + float predictionAmt = malice ? 30f : death ? 25f : revenge ? 20f : expertMode ? 15f : 5f; + Vector2 predictionVector = player.velocity * predictionAmt; + Vector2 rotationVector = player.Center + predictionVector - npc.Center; + + float rateOfRotation = AIState == (int)Phase.GaussNuke ? 0.08f : 0.04f; + Vector2 lookAt = player.Center + Vector2.Normalize(rotationVector); + + float rotation = (float)Math.Atan2(lookAt.Y - npc.Center.Y, lookAt.X - npc.Center.X); + if (npc.spriteDirection == 1) + rotation += MathHelper.Pi; + if (rotation < 0f) + rotation += MathHelper.TwoPi; + 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; + } + + 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; // Default vector to fly to Vector2 destination = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays ? new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X + 540f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y + 540f) : new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X + 750f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y); @@ -259,12 +296,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Attacking phases switch ((int)AIState) { - // Do nothing, rotate to aim at the target and fly in place + // Do nothing and fly in place case (int)Phase.Nothing: - if (!targetDead) - npc.SimpleFlyMovement(desiredVelocity, baseAcceleration); - calamityGlobalNPC.newAI[1] += 1f; if (calamityGlobalNPC.newAI[1] >= gaussNukePhaseGateValue) { @@ -295,8 +329,11 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (exactFrame == 41 && calamityGlobalNPC.newAI[1] == 0f) { calamityGlobalNPC.newAI[1] = 1f; + if (Main.netMode != NetmodeID.MultiplayerClient) { + float projectileVelocity = 12f; + Vector2 gaussNukeVelocity = Vector2.Normalize(rotationVector) * projectileVelocity; /*int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type);*/ } @@ -330,6 +367,10 @@ namespace CalamityMod.NPCs.ExoMechs.Ares break; } + + // Movement + if (!targetDead) + npc.SimpleFlyMovement(desiredVelocity, baseAcceleration); } public override bool CanHitPlayer(Player target, ref int cooldownSlot) => false; diff --git a/NPCs/ExoMechs/Ares/AresLaserCannon.cs b/NPCs/ExoMechs/Ares/AresLaserCannon.cs index 91d5f9ae02..384f921c83 100644 --- a/NPCs/ExoMechs/Ares/AresLaserCannon.cs +++ b/NPCs/ExoMechs/Ares/AresLaserCannon.cs @@ -55,7 +55,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares private const float deathrayTelegraphDuration = 240f; // Total duration of the deathray - private const float deathrayDuration = 180f; + private const float deathrayDuration = 60f; public override void SetStaticDefaults() { @@ -224,7 +224,41 @@ 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 - // npc.rotation = npc.velocity.X * 0.003f; + // Rotation + 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; + + float rotation = (float)Math.Atan2(lookAt.Y - npc.Center.Y, lookAt.X - npc.Center.X); + if (npc.spriteDirection == 1) + rotation += MathHelper.Pi; + if (rotation < 0f) + rotation += MathHelper.TwoPi; + 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; + } + + 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; // Default vector to fly to Vector2 destination = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays ? new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X - 540f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y - 540f) : new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X - 750f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y); @@ -247,7 +281,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares float deathrayPhaseGateValue = 420f; float deathrayPhaseVelocityMult = 0.95f; float deathrayDecelerationTime = 15f; - float deathrayPhaseVelocity = 5f; + float deathrayPhaseVelocity = 15f; // Variable to disable deathray firing bool doNotFire = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays || calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune; diff --git a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs index c0b77e8258..5437e49966 100644 --- a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs +++ b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs @@ -222,8 +222,45 @@ namespace CalamityMod.NPCs.ExoMechs.Ares npc.Opacity = 0f; } - // Rotate the cannon to look at the target - // npc.rotation = npc.velocity.X * 0.003f; + // Predictiveness + float predictionAmt = malice ? 30f : death ? 25f : revenge ? 20f : expertMode ? 15f : 5f; + Vector2 predictionVector = player.velocity * predictionAmt; + Vector2 rotationVector = player.Center + predictionVector - npc.Center; + + float rateOfRotation = AIState == (int)Phase.PlasmaBolts ? 0.08f : 0.04f; + Vector2 lookAt = player.Center + Vector2.Normalize(rotationVector); + + float rotation = (float)Math.Atan2(lookAt.Y - npc.Center.Y, lookAt.X - npc.Center.X); + if (npc.spriteDirection == 1) + rotation += MathHelper.Pi; + if (rotation < 0f) + rotation += MathHelper.TwoPi; + 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; + } + + 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; // Default vector to fly to Vector2 destination = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays ? new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X + 540f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y - 540f) : new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X + 375f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y + 160f); @@ -258,12 +295,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Attacking phases switch ((int)AIState) { - // Do nothing, rotate to aim at the target and fly in place + // Do nothing and fly in place case (int)Phase.Nothing: - if (!targetDead) - npc.SimpleFlyMovement(desiredVelocity, baseAcceleration); - calamityGlobalNPC.newAI[1] += 1f; if (calamityGlobalNPC.newAI[1] >= plasmaBoltPhaseGateValue) { @@ -300,6 +334,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { if (Main.netMode != NetmodeID.MultiplayerClient) { + float projectileVelocity = 12f; + Vector2 plasmaBoltVelocity = Vector2.Normalize(rotationVector) * projectileVelocity; /*int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type);*/ } @@ -316,6 +352,10 @@ namespace CalamityMod.NPCs.ExoMechs.Ares break; } + + // Movement + if (!targetDead) + npc.SimpleFlyMovement(desiredVelocity, baseAcceleration); } public override bool CanHitPlayer(Player target, ref int cooldownSlot) => false; diff --git a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs index 8ed4abbb2f..e462ef5071 100644 --- a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs +++ b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs @@ -222,8 +222,45 @@ namespace CalamityMod.NPCs.ExoMechs.Ares npc.Opacity = 0f; } - // Rotate the cannon to look at the target - // npc.rotation = npc.velocity.X * 0.003f; + // Predictiveness + float predictionAmt = malice ? 30f : death ? 25f : revenge ? 20f : expertMode ? 15f : 5f; + Vector2 predictionVector = player.velocity * predictionAmt; + Vector2 rotationVector = player.Center + predictionVector - npc.Center; + + float rateOfRotation = AIState == (int)Phase.TeslaOrbs ? 0.08f : 0.04f; + Vector2 lookAt = player.Center + Vector2.Normalize(rotationVector); + + float rotation = (float)Math.Atan2(lookAt.Y - npc.Center.Y, lookAt.X - npc.Center.X); + if (npc.spriteDirection == 1) + rotation += MathHelper.Pi; + if (rotation < 0f) + rotation += MathHelper.TwoPi; + 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; + } + + 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; // Default vector to fly to Vector2 destination = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays ? new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X - 540f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y + 540f) : new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X - 375f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y + 160f); @@ -258,12 +295,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Attacking phases switch ((int)AIState) { - // Do nothing, rotate to aim at the target and fly in place + // Do nothing and fly in place case (int)Phase.Nothing: - if (!targetDead) - npc.SimpleFlyMovement(desiredVelocity, baseAcceleration); - calamityGlobalNPC.newAI[1] += 1f; if (calamityGlobalNPC.newAI[1] >= teslaOrbPhaseGateValue) { @@ -300,6 +334,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares { if (Main.netMode != NetmodeID.MultiplayerClient) { + float projectileVelocity = 12f; + Vector2 teslaOrbVelocity = Vector2.Normalize(rotationVector) * projectileVelocity; /*int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type);*/ } @@ -316,6 +352,10 @@ namespace CalamityMod.NPCs.ExoMechs.Ares break; } + + // Movement + if (!targetDead) + npc.SimpleFlyMovement(desiredVelocity, baseAcceleration); } public override bool CanHitPlayer(Player target, ref int cooldownSlot) => false; diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs index 0ee9252421..06f319bf86 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs @@ -220,11 +220,16 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } else { + // This is only used in deathray phase to prevent laser spam + int numSegments = ThanatosHead.minLength; + double numSegmentsAbleToFire = 5D; + float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire); + npc.ai[3] += 1f; float shootProjectile = 120f; float timer = npc.ai[0] + 15f; float divisor = timer + shootProjectile; - if (npc.ai[3] % divisor == 0f || npc.Calamity().newAI[0] > 0f) + if ((npc.ai[3] % divisor == 0f && (npc.localAI[2] % segmentDivisor == 0f || !berserk)) || npc.Calamity().newAI[0] > 0f) { // Body is vulnerable while firing lasers vulnerable = true; @@ -261,7 +266,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } } - float predictionAmt = malice ? 40f : death ? 25f : revenge ? 20f : expertMode ? 15f : 5f; + float predictionAmt = malice ? 30f : death ? 25f : revenge ? 20f : expertMode ? 15f : 5f; int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs index 62674fd8e9..cf6a069fb2 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs @@ -220,11 +220,16 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } else { + // This is only used in deathray phase to prevent laser spam + int numSegments = ThanatosHead.minLength; + double numSegmentsAbleToFire = 5D; + float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire); + npc.ai[3] += 1f; float shootProjectile = 120f; float timer = npc.ai[0] + 15f; float divisor = timer + shootProjectile; - if (npc.ai[3] % divisor == 0f || npc.Calamity().newAI[0] > 0f) + if ((npc.ai[3] % divisor == 0f && (npc.localAI[2] % segmentDivisor == 0f || !berserk)) || npc.Calamity().newAI[0] > 0f) { // Body is vulnerable while firing lasers vulnerable = true; @@ -261,7 +266,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } } - float predictionAmt = malice ? 40f : death ? 25f : revenge ? 20f : expertMode ? 15f : 5f; + float predictionAmt = malice ? 30f : death ? 25f : revenge ? 20f : expertMode ? 15f : 5f; int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); diff --git a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs index 47e3eff1e0..689b569659 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs @@ -219,11 +219,16 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } else { + // This is only used in deathray phase to prevent laser spam + int numSegments = ThanatosHead.minLength; + double numSegmentsAbleToFire = 5D; + float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire); + npc.ai[3] += 1f; float shootProjectile = 120f; float timer = npc.ai[0] + 15f; float divisor = timer + shootProjectile; - if (npc.ai[3] % divisor == 0f || npc.Calamity().newAI[0] > 0f) + if ((npc.ai[3] % divisor == 0f && (npc.localAI[2] % segmentDivisor == 0f || !berserk)) || npc.Calamity().newAI[0] > 0f) { // Body is vulnerable while firing lasers vulnerable = true; @@ -260,7 +265,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } } - float predictionAmt = malice ? 40f : death ? 25f : revenge ? 20f : expertMode ? 15f : 5f; + float predictionAmt = malice ? 30f : death ? 25f : revenge ? 20f : expertMode ? 15f : 5f; int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); diff --git a/NPCs/NormalNPCs/Eidolist.cs b/NPCs/NormalNPCs/Eidolist.cs index 922081c5e2..d34ac6c102 100644 --- a/NPCs/NormalNPCs/Eidolist.cs +++ b/NPCs/NormalNPCs/Eidolist.cs @@ -311,7 +311,19 @@ namespace CalamityMod.NPCs.NormalNPCs } } - public override void NPCLoot() + public override bool PreNPCLoot() + { + bool adultWyrmAlive = false; + if (CalamityGlobalNPC.adultEidolonWyrmHead != -1) + { + if (Main.npc[CalamityGlobalNPC.adultEidolonWyrmHead].active) + adultWyrmAlive = true; + } + + return !adultWyrmAlive; + } + + public override void NPCLoot() { if (Main.rand.NextBool(10)) { diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index 510f12ec94..923e8d918a 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -262,6 +262,7 @@ namespace CalamityMod.NPCs.Perforator } } } + float num188 = speed; float num189 = turnSpeed; float burrowDistance = malice ? 500f : 750f; diff --git a/Projectiles/Ranged/VeriumBulletProj.cs b/Projectiles/Ranged/VeriumBulletProj.cs index 27f22dda0a..8a2b121bb2 100644 --- a/Projectiles/Ranged/VeriumBulletProj.cs +++ b/Projectiles/Ranged/VeriumBulletProj.cs @@ -121,7 +121,7 @@ namespace CalamityMod.Projectiles.Ranged return true; } - public override bool? CanHitNPC(NPC target) => projectile.ai[0] <= 0f; + public override bool? CanHitNPC(NPC target) => projectile.ai[0] <= 0f && target.CanBeChasedBy(projectile); public override bool CanHitPvp(Player target) => projectile.ai[0] <= 0f;