diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 36e9e268fd..d6ec564486 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -4017,75 +4017,78 @@ namespace CalamityMod.CalPlayer public override void PostUpdateRunSpeeds() { - #region SpeedBoosts - float runAccMult = 1f + - (shadowSpeed ? 0.5f : 0f) + - (stressPills ? 0.05f : 0f) + - ((abyssalDivingSuit && player.IsUnderwater()) ? 0.05f : 0f) + - (sirenWaterBuff ? 0.15f : 0f) + - ((frostFlare && player.statLife < (int)(player.statLifeMax2 * 0.25)) ? 0.15f : 0f) + - (auricSet ? 0.1f : 0f) + - (dragonScales ? 0.1f : 0f) + - (kamiBoost ? KamiBuff.RunAccelerationBoost : 0f) + - (cTracers ? 0.1f : 0f) + - (silvaSet ? 0.05f : 0f) + - (eTracers ? 0.05f : 0f) + - (blueCandle ? 0.05f : 0f) + - (planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 0f) + - ((deepDiver && player.IsUnderwater()) ? 0.15f : 0f) + - (rogueStealthMax > 0f ? (rogueStealth >= rogueStealthMax ? rogueStealth * 0.05f : rogueStealth * 0.025f) : 0f); + #region SpeedBoosts + if (!player.mount.Active) + { + float runAccMult = 1f + + (shadowSpeed ? 0.5f : 0f) + + (stressPills ? 0.05f : 0f) + + ((abyssalDivingSuit && player.IsUnderwater()) ? 0.05f : 0f) + + (sirenWaterBuff ? 0.15f : 0f) + + ((frostFlare && player.statLife < (int)(player.statLifeMax2 * 0.25)) ? 0.15f : 0f) + + (auricSet ? 0.1f : 0f) + + (dragonScales ? 0.1f : 0f) + + (kamiBoost ? KamiBuff.RunAccelerationBoost : 0f) + + (cTracers ? 0.1f : 0f) + + (silvaSet ? 0.05f : 0f) + + (eTracers ? 0.05f : 0f) + + (blueCandle ? 0.05f : 0f) + + (planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 0f) + + ((deepDiver && player.IsUnderwater()) ? 0.15f : 0f) + + (rogueStealthMax > 0f ? (rogueStealth >= rogueStealthMax ? rogueStealth * 0.05f : rogueStealth * 0.025f) : 0f); - float runSpeedMult = 1f + - (shadowSpeed ? 0.5f : 0f) + - (stressPills ? 0.05f : 0f) + - ((abyssalDivingSuit && player.IsUnderwater()) ? 0.05f : 0f) + - (sirenWaterBuff ? 0.15f : 0f) + - ((frostFlare && player.statLife < (int)(player.statLifeMax2 * 0.25)) ? 0.15f : 0f) + - (auricSet ? 0.1f : 0f) + - (dragonScales ? 0.1f : 0f) + - (kamiBoost ? KamiBuff.RunSpeedBoost : 0f) + - (cTracers ? 0.1f : 0f) + - (silvaSet ? 0.05f : 0f) + - (eTracers ? 0.05f : 0f) + - (planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 0f) + - ((deepDiver && player.IsUnderwater()) ? 0.15f : 0f) + - (rogueStealthMax > 0f ? (rogueStealth >= rogueStealthMax ? rogueStealth * 0.05f : rogueStealth * 0.025f) : 0f); + float runSpeedMult = 1f + + (shadowSpeed ? 0.5f : 0f) + + (stressPills ? 0.05f : 0f) + + ((abyssalDivingSuit && player.IsUnderwater()) ? 0.05f : 0f) + + (sirenWaterBuff ? 0.15f : 0f) + + ((frostFlare && player.statLife < (int)(player.statLifeMax2 * 0.25)) ? 0.15f : 0f) + + (auricSet ? 0.1f : 0f) + + (dragonScales ? 0.1f : 0f) + + (kamiBoost ? KamiBuff.RunSpeedBoost : 0f) + + (cTracers ? 0.1f : 0f) + + (silvaSet ? 0.05f : 0f) + + (eTracers ? 0.05f : 0f) + + (planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 0f) + + ((deepDiver && player.IsUnderwater()) ? 0.15f : 0f) + + (rogueStealthMax > 0f ? (rogueStealth >= rogueStealthMax ? rogueStealth * 0.05f : rogueStealth * 0.025f) : 0f); - if (abyssalDivingSuit && !player.IsUnderwater()) - { - float multiplier = 0.4f + abyssalDivingSuitPlateHits * 0.2f; - runAccMult *= multiplier; - runSpeedMult *= multiplier; - } - if (fabledTortoise) - { - float multiplier = shellBoost ? 0.8f : 0.5f; - runAccMult *= multiplier; - runSpeedMult *= multiplier; - } - if (ursaSergeant) - { - runAccMult *= 0.65f; - runSpeedMult *= 0.65f; - } - if (elysianGuard) - { - runAccMult *= 0.5f; - runSpeedMult *= 0.5f; - } - if ((player.slippy || player.slippy2) && player.iceSkate) - { - runAccMult *= 0.6f; - } - if (CalamityWorld.death && deathModeBlizzardTime > 0) - { - float speedMult = (3600 - deathModeBlizzardTime) / 3600f; - runAccMult *= speedMult; - runSpeedMult *= speedMult; - } + if (abyssalDivingSuit && !player.IsUnderwater()) + { + float multiplier = 0.4f + abyssalDivingSuitPlateHits * 0.2f; + runAccMult *= multiplier; + runSpeedMult *= multiplier; + } + if (fabledTortoise) + { + float multiplier = shellBoost ? 0.8f : 0.5f; + runAccMult *= multiplier; + runSpeedMult *= multiplier; + } + if (ursaSergeant) + { + runAccMult *= 0.65f; + runSpeedMult *= 0.65f; + } + if (elysianGuard) + { + runAccMult *= 0.5f; + runSpeedMult *= 0.5f; + } + if ((player.slippy || player.slippy2) && player.iceSkate) + { + runAccMult *= 0.6f; + } + if (CalamityWorld.death && deathModeBlizzardTime > 0) + { + float speedMult = (3600 - deathModeBlizzardTime) / 3600f; + runAccMult *= speedMult; + runSpeedMult *= speedMult; + } - player.runAcceleration *= runAccMult; - player.maxRunSpeed *= runSpeedMult; + player.runAcceleration *= runAccMult; + player.maxRunSpeed *= runSpeedMult; + } #endregion #region DashEffects diff --git a/Items/Mounts/AlicornMount.cs b/Items/Mounts/AlicornMount.cs index 268e7f16e4..cf26698eb5 100644 --- a/Items/Mounts/AlicornMount.cs +++ b/Items/Mounts/AlicornMount.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Mounts mountData.blockExtraJumps = false; mountData.totalFrames = 15; mountData.constantJump = false; - int baseYOffset = 24; + int baseYOffset = 26; int[] array = new int[mountData.totalFrames]; for (int l = 0; l < array.Length; l++) { @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Mounts mountData.playerYOffsets = array; mountData.xOffset = -4; mountData.bodyFrame = 3; - mountData.yOffset = 7; //-8 + mountData.yOffset = 5; //-8 mountData.playerHeadOffset = 36; //30 mountData.standingFrameCount = 1; mountData.standingFrameDelay = 12; diff --git a/NPCs/ExoMechs/Ares/AresBody.cs b/NPCs/ExoMechs/Ares/AresBody.cs index c4104d2fb0..f44f7a19c8 100644 --- a/NPCs/ExoMechs/Ares/AresBody.cs +++ b/NPCs/ExoMechs/Ares/AresBody.cs @@ -9,8 +9,6 @@ using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.NPCs.ExoMechs.Apollo; -using CalamityMod.NPCs.ExoMechs.Artemis; using CalamityMod.NPCs.ExoMechs.Thanatos; using CalamityMod.Projectiles.Boss; using CalamityMod.Skies; diff --git a/NPCs/ExoMechs/Ares/AresLaserCannon.cs b/NPCs/ExoMechs/Ares/AresLaserCannon.cs index 6e75ae655d..b87f0bb056 100644 --- a/NPCs/ExoMechs/Ares/AresLaserCannon.cs +++ b/NPCs/ExoMechs/Ares/AresLaserCannon.cs @@ -246,7 +246,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } // 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 - 560f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y); + Vector2 destination = fireNormalLasers ? new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X - 540f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y - 540f) : new Vector2(Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.X - 560f, Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center.Y); // Velocity and acceleration values float baseVelocityMult = (berserk ? 0.25f : 0f) + (malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f); @@ -273,6 +273,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares else if (berserk) deathrayPhaseVelocity *= 1.1f; + // If Laser Cannon can fire normal lasers, cannot fire if too close to the target and in deathray spiral phase + bool canFire = Vector2.Distance(npc.Center, player.Center) > 320f || !fireNormalLasers; + // Variable to disable deathray firing bool doNotFire = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune || (calamityGlobalNPC_Body.newAI[2] >= AresBody.deathrayTelegraphDuration + AresBody.deathrayDuration - 1 && fireNormalLasers); if (doNotFire) @@ -320,6 +323,10 @@ namespace CalamityMod.NPCs.ExoMechs.Ares calamityGlobalNPC.newAI[2] += 1f; if (calamityGlobalNPC.newAI[2] < deathrayTelegraphDuration) { + // Play a charge up sound so that the player knows when it's about to fire the deathray + if (calamityGlobalNPC.newAI[2] == deathrayTelegraphDuration - 100f && !fireNormalLasers) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/CrystylCharge"), npc.Center); + // Inverse lerp returns the percentage of progress between A and B float lerpValue2 = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); @@ -376,7 +383,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares int numLasers = lastMechAlive ? 3 : 2; float divisor = deathrayDuration / numLasers; - if (calamityGlobalNPC.newAI[2] % divisor == 0f) + if (calamityGlobalNPC.newAI[2] % divisor == 0f && canFire) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -400,7 +407,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares desiredVelocity.Y = 0f; npc.SimpleFlyMovement(desiredVelocity, baseAcceleration); - npc.velocity = horizontalLaserSweep ? new Vector2(deathrayPhaseVelocity, npc.velocity.Y) : new Vector2(npc.velocity.X, deathrayPhaseVelocity); + npc.velocity = horizontalLaserSweep ? new Vector2(deathrayPhaseVelocity, npc.velocity.Y) : new Vector2(npc.velocity.X, deathrayPhaseVelocity * 0.75f); // Fire deathray if (calamityGlobalNPC.newAI[2] == deathrayTelegraphDuration) diff --git a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs index 349e955dd4..fdbca6205c 100644 --- a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs +++ b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs @@ -267,13 +267,18 @@ namespace CalamityMod.NPCs.ExoMechs.Ares float movementDistanceGateValue = 50f; // Gate values + // Make plasma bolts split less if in deathray spiral phase and not the last mech alive, but fire more if in deathray spiral phase bool fireMoreBolts = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays; + bool boltsSplitLess = fireMoreBolts && !lastMechAlive; float plasmaBoltPhaseGateValue = fireMoreBolts ? 120f : 270f; if (lastMechAlive) plasmaBoltPhaseGateValue *= 0.7f; else if (berserk) plasmaBoltPhaseGateValue *= 0.85f; + // If Plasma Cannon can fire projectiles, cannot fire if too close to the target and in deathray spiral phase + bool canFire = Vector2.Distance(npc.Center, player.Center) > 320f || calamityGlobalNPC_Body.newAI[0] != (float)AresBody.Phase.Deathrays; + // Variable to cancel plasma bolt firing bool doNotFire = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune || (calamityGlobalNPC_Body.newAI[2] >= AresBody.deathrayTelegraphDuration + AresBody.deathrayDuration - 1 && calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays); if (doNotFire) @@ -323,7 +328,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares int numPlasmaBolts = lastMechAlive ? 3 : 2; float divisor = plasmaBoltDuration / numPlasmaBolts; - if (calamityGlobalNPC.newAI[2] % divisor == 0f) + if (calamityGlobalNPC.newAI[2] % divisor == 0f && canFire) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -332,7 +337,11 @@ namespace CalamityMod.NPCs.ExoMechs.Ares int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); Vector2 offset = Vector2.Normalize(plasmaBoltVelocity) * 40f + Vector2.UnitY * 16f; - Projectile.NewProjectile(npc.Center + offset, plasmaBoltVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); + + if (boltsSplitLess) + Projectile.NewProjectile(npc.Center + offset, plasmaBoltVelocity, type, damage, 0f, Main.myPlayer, -2f); + else + Projectile.NewProjectile(npc.Center + offset, plasmaBoltVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); } } } diff --git a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs index 62aad8fdab..1456f94f32 100644 --- a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs +++ b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs @@ -184,6 +184,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares predictionAmt *= 0.5f; if (passivePhase) predictionAmt *= 0.5f; + if (lastMechAlive) + predictionAmt *= 1.5f; Vector2 predictionVector = player.velocity * predictionAmt; Vector2 rotationVector = player.Center + predictionVector - npc.Center; @@ -274,6 +276,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares else if (berserk) teslaOrbPhaseGateValue *= 0.85f; + // If Tesla Cannon can fire projectiles, cannot fire if too close to the target and in deathray spiral phase + bool canFire = Vector2.Distance(npc.Center, player.Center) > 320f || calamityGlobalNPC_Body.newAI[0] != (float)AresBody.Phase.Deathrays; + // Variable to cancel tesla orb firing bool doNotFire = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune || (calamityGlobalNPC_Body.newAI[2] >= AresBody.deathrayTelegraphDuration + AresBody.deathrayDuration - 1 && calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays); if (doNotFire) @@ -334,7 +339,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares int numTeslaOrbs = lastMechAlive ? 6 : berserk ? 5 : nerfedAttacks ? 3 : 4; float divisor = teslaOrbDuration / numTeslaOrbs; - if (calamityGlobalNPC.newAI[2] % divisor == 0f) + if (calamityGlobalNPC.newAI[2] % divisor == 0f && canFire) { if (Main.netMode != NetmodeID.MultiplayerClient) { diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs index bf559c7f49..eae2d63e46 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs @@ -1,5 +1,3 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; @@ -37,6 +35,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f); + // Timer to prevent Thanatos from dealing contact damage for a bit + private int noContactDamageTimer = 0; + private const float timeToOpenAndFireLasers = 36f; private const float segmentCloseTimerDecrement = 0.2f; @@ -94,6 +95,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { writer.Write(npc.chaseable); writer.Write(npc.dontTakeDamage); + writer.Write(noContactDamageTimer); writer.Write(vulnerable); writer.Write(npc.localAI[0]); writer.Write(npc.localAI[1]); @@ -106,6 +108,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { npc.chaseable = reader.ReadBoolean(); npc.dontTakeDamage = reader.ReadBoolean(); + noContactDamageTimer = reader.ReadInt32(); vulnerable = reader.ReadBoolean(); npc.localAI[0] = reader.ReadSingle(); npc.localAI[1] = reader.ReadSingle(); @@ -167,13 +170,24 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { if (Main.npc[(int)npc.ai[1]].Opacity > 0.5f) { + if (noContactDamageTimer > 0) + noContactDamageTimer--; + npc.Opacity += 0.2f; if (npc.Opacity > 1f) npc.Opacity = 1f; } + else + { + // Deal no contact damage for 3 seconds after becoming visible + noContactDamageTimer = 185; + } } else { + // Deal no contact damage for 3 seconds after becoming visible + noContactDamageTimer = 185; + npc.Opacity -= 0.05f; if (npc.Opacity < 0f) npc.Opacity = 0f; @@ -402,6 +416,10 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } } + // Do not deal contact damage for 5 seconds after spawning + if (npc.Calamity().newAI[2] == 0f) + noContactDamageTimer = 300; + if (npc.Calamity().newAI[2] < ThanatosHead.immunityTime) npc.Calamity().newAI[2] += 1f; @@ -508,7 +526,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (dist4 < minDist) minDist = dist4; - return minDist <= 50f && npc.Opacity == 1f; + return minDist <= 50f && npc.Opacity == 1f && noContactDamageTimer <= 0; } public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs index b824754f13..c198d5813d 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs @@ -1,5 +1,3 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; @@ -37,6 +35,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f); + // Timer to prevent Thanatos from dealing contact damage for a bit + private int noContactDamageTimer = 0; + private const float timeToOpenAndFireLasers = 36f; private const float segmentCloseTimerDecrement = 0.2f; @@ -94,6 +95,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { writer.Write(npc.chaseable); writer.Write(npc.dontTakeDamage); + writer.Write(noContactDamageTimer); writer.Write(vulnerable); writer.Write(npc.localAI[0]); writer.Write(npc.localAI[1]); @@ -106,6 +108,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { npc.chaseable = reader.ReadBoolean(); npc.dontTakeDamage = reader.ReadBoolean(); + noContactDamageTimer = reader.ReadInt32(); vulnerable = reader.ReadBoolean(); npc.localAI[0] = reader.ReadSingle(); npc.localAI[1] = reader.ReadSingle(); @@ -167,13 +170,24 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { if (Main.npc[(int)npc.ai[1]].Opacity > 0.5f) { + if (noContactDamageTimer > 0) + noContactDamageTimer--; + npc.Opacity += 0.2f; if (npc.Opacity > 1f) npc.Opacity = 1f; } + else + { + // Deal no contact damage for 3 seconds after becoming visible + noContactDamageTimer = 185; + } } else { + // Deal no contact damage for 3 seconds after becoming visible + noContactDamageTimer = 185; + npc.Opacity -= 0.05f; if (npc.Opacity < 0f) npc.Opacity = 0f; @@ -402,6 +416,10 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } } + // Do not deal contact damage for 5 seconds after spawning + if (npc.Calamity().newAI[2] == 0f) + noContactDamageTimer = 300; + if (npc.Calamity().newAI[2] < ThanatosHead.immunityTime) npc.Calamity().newAI[2] += 1f; @@ -509,7 +527,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (dist4 < minDist) minDist = dist4; - return minDist <= 50f && npc.Opacity == 1f; + return minDist <= 50f && npc.Opacity == 1f && noContactDamageTimer <= 0; } public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) diff --git a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs index 942553df20..258e69cab7 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs @@ -1,8 +1,6 @@ using CalamityMod.Events; using CalamityMod.Items.Potions; using CalamityMod.Items.TreasureBags; -using CalamityMod.NPCs.ExoMechs.Apollo; -using CalamityMod.NPCs.ExoMechs.Artemis; using CalamityMod.NPCs.ExoMechs.Ares; using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; @@ -64,6 +62,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f); + // Timer to prevent Thanatos from dealing contact damage for a bit + private int noContactDamageTimer = 0; + // Invincibility time for the first 10 seconds public const float immunityTime = 600f; @@ -158,6 +159,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { writer.Write(npc.chaseable); writer.Write(npc.dontTakeDamage); + writer.Write(noContactDamageTimer); writer.Write(chargeVelocityScalar); writer.Write(vulnerable); writer.Write(npc.localAI[0]); @@ -172,6 +174,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { npc.chaseable = reader.ReadBoolean(); npc.dontTakeDamage = reader.ReadBoolean(); + noContactDamageTimer = reader.ReadInt32(); chargeVelocityScalar = reader.ReadSingle(); vulnerable = reader.ReadBoolean(); npc.localAI[0] = reader.ReadSingle(); @@ -353,12 +356,18 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos npc.dontTakeDamage = invisiblePhase; if (!invisiblePhase) { + if (noContactDamageTimer > 0) + noContactDamageTimer--; + npc.Opacity += 0.2f; if (npc.Opacity > 1f) npc.Opacity = 1f; } else { + // Deal no contact damage for 3 seconds after becoming visible + noContactDamageTimer = 185; + npc.Opacity -= 0.05f; if (npc.Opacity < 0f) npc.Opacity = 0f; @@ -410,6 +419,14 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Default vector to fly to Vector2 destination = player.Center; + // Move destination to somewhere far below the target for the first 3 seconds so that Thanatos can fully uncoil quickly + bool speedUp = false; + if (npc.localAI[3] < 180f) + { + speedUp = true; + destination += new Vector2(0f, 2400f); + } + // Charge variables float turnDistance = baseTurnDistance; float chargeLocationDistance = turnDistance * 0.2f; @@ -422,12 +439,13 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Velocity and turn speed values float baseVelocityMult = (berserk ? 0.25f : 0f) + (malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f); float baseVelocity = 10f * baseVelocityMult; - float turnDegrees = baseVelocity * 0.11f * (berserk ? 1.25f : 1f); - // Increase top velocity if target is dead - if (targetDead) + // Increase top velocity if target is dead or if Thanatos is uncoiling + if (targetDead || speedUp) baseVelocity *= 4f; + float turnDegrees = baseVelocity * 0.11f * (berserk ? 1.25f : 1f); + float turnSpeed = MathHelper.ToRadians(turnDegrees); float chargeVelocityMult = MathHelper.Lerp(1f, 1.5f, chargeVelocityScalar); float chargeTurnSpeedMult = MathHelper.Lerp(1f, 1.5f, chargeVelocityScalar); @@ -448,7 +466,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos float laserBarrageVelocityScalarDecrement = 1f / velocityAdjustTime; // Distance from target - float distanceFromTarget = Vector2.Distance(npc.Center, player.Center); + float distanceFromTarget = Vector2.Distance(npc.Center, destination); // Passive and Immune phases switch ((int)SecondaryAIState) @@ -795,6 +813,10 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos break; } + // Do not deal contact damage for 5 seconds after spawning + if (npc.localAI[3] == 0f) + noContactDamageTimer = 300; + if (npc.localAI[3] < immunityTime) npc.localAI[3] += 1f; @@ -876,7 +898,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (dist4 < minDist) minDist = dist4; - return minDist <= 50f && npc.Opacity == 1f; + return minDist <= 50f && npc.Opacity == 1f && noContactDamageTimer <= 0; } public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) diff --git a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs index 93bc5603a2..39eaaf3dfb 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs @@ -1,4 +1,3 @@ -using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; @@ -36,6 +35,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public ThanatosSmokeParticleSet SmokeDrawer = new ThanatosSmokeParticleSet(-1, 3, 0f, 16f, 1.5f); + // Timer to prevent Thanatos from dealing contact damage for a bit + private int noContactDamageTimer = 0; + private const float timeToOpenAndFireLasers = 36f; private const float segmentCloseTimerDecrement = 0.2f; @@ -93,6 +95,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { writer.Write(npc.chaseable); writer.Write(npc.dontTakeDamage); + writer.Write(noContactDamageTimer); writer.Write(vulnerable); writer.Write(npc.localAI[0]); writer.Write(npc.localAI[1]); @@ -105,6 +108,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { npc.chaseable = reader.ReadBoolean(); npc.dontTakeDamage = reader.ReadBoolean(); + noContactDamageTimer = reader.ReadInt32(); vulnerable = reader.ReadBoolean(); npc.localAI[0] = reader.ReadSingle(); npc.localAI[1] = reader.ReadSingle(); @@ -166,13 +170,24 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { if (Main.npc[(int)npc.ai[1]].Opacity > 0.5f) { + if (noContactDamageTimer > 0) + noContactDamageTimer--; + npc.Opacity += 0.2f; if (npc.Opacity > 1f) npc.Opacity = 1f; } + else + { + // Deal no contact damage for 3 seconds after becoming visible + noContactDamageTimer = 185; + } } else { + // Deal no contact damage for 3 seconds after becoming visible + noContactDamageTimer = 185; + npc.Opacity -= 0.05f; if (npc.Opacity < 0f) npc.Opacity = 0f; @@ -401,6 +416,10 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } } + // Do not deal contact damage for 5 seconds after spawning + if (npc.Calamity().newAI[2] == 0f) + noContactDamageTimer = 300; + if (npc.Calamity().newAI[2] < ThanatosHead.immunityTime) npc.Calamity().newAI[2] += 1f; @@ -508,7 +527,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (dist4 < minDist) minDist = dist4; - return minDist <= 45f && npc.Opacity == 1f; + return minDist <= 45f && npc.Opacity == 1f && noContactDamageTimer <= 0; } public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) diff --git a/NPCs/TownNPCs/FAP.cs b/NPCs/TownNPCs/FAP.cs index 88c334dc00..ef660ac319 100644 --- a/NPCs/TownNPCs/FAP.cs +++ b/NPCs/TownNPCs/FAP.cs @@ -152,7 +152,7 @@ namespace CalamityMod.NPCs.TownNPCs } dialogue.Add("I HATE WALMART! ...anyway, what do you want this time?"); - dialogue.Add("Drink something that turns you into a magical flying unicorn so you can be like me."); + dialogue.Add("Drink something that turns you into a magical flying unicorn so you can be just like me."); dialogue.Add("Did anyone ever tell you that large assets cause back pain? Well, they were right."); dialogue.Add("Deals so good I'll [$$!$] myself! ...sorry, just had a minor stroke!"); @@ -177,9 +177,8 @@ namespace CalamityMod.NPCs.TownNPCs if (CalamityWorld.downedPolterghast) dialogue.Add("I saw a ghost down by the old train tracks back at my homeland once, flailing wildly at the lily pads...frightening times those were."); - // This one is good and will never be changed :) if (CalamityWorld.downedDoG) - dialogue.Add("I hear it's amazing when the famous purple-stuffed worm out in flap-jaw space, with the tuning fork, does a raw blink on Hara-kiri rock. I need scissors! 61!"); + dialogue.Add("I hear it's amazing when the famous Devourer of Gods out in flap-jaw space, with the tuning fork, does a raw blink on Hara-kiri rock. I need scissors! 61!"); int tavernKeep = NPC.FindFirstNPC(NPCID.DD2Bartender); if (tavernKeep != -1) @@ -193,7 +192,11 @@ namespace CalamityMod.NPCs.TownNPCs if (permadong != -1) dialogue.Add("I never realized how well-endowed " + Main.npc[permadong].GivenName + " was. It had to be the largest icicle I'd ever seen."); - if (Main.player[Main.myPlayer].Calamity().chibii) + int witch = NPC.FindFirstNPC(ModContent.NPCType()); + if (witch != -1) + dialogue.Add("The abuse " + Main.npc[witch].GivenName + " went through is something I can hardly comprehend. I'd offer her a drink, but I don't think she'd enjoy it."); + + if (Main.player[Main.myPlayer].Calamity().chibii) dialogue.Add("The hell is that? Looks like something I'd carry around if I was 5 years old."); if (Main.player[Main.myPlayer].Calamity().sirenBoobs && !Main.player[Main.myPlayer].Calamity().sirenBoobsHide) @@ -245,7 +248,7 @@ namespace CalamityMod.NPCs.TownNPCs else if (deaths > 250) text += " I admire your tenacity. Keep it up, your enemies are racking up quite the kill count!"; else if (deaths > 100) - text += " Consider lowering the difficulty. If you found that statement irritating, I like you."; + text += " Consider lowering the difficulty. If you found that statement irritating, good."; return text; } diff --git a/NPCs/TownNPCs/WITCH.cs b/NPCs/TownNPCs/WITCH.cs index 8a59100201..93d33d5fcf 100644 --- a/NPCs/TownNPCs/WITCH.cs +++ b/NPCs/TownNPCs/WITCH.cs @@ -111,6 +111,13 @@ namespace CalamityMod.NPCs.TownNPCs textSelector.Add("That frosty old man...even if you ignore our brands of magic and our old alliances, I doubt I'd ever" + " get along with him.", 1.45); } + + int fab = NPC.FindFirstNPC(NPCType()); + if (fab != -1) + { + textSelector.Add("I wonder if " + Main.npc[fab].GivenName + " ever feels cold given how revealing her dress is." + + " Perhaps she should cover up a bit more.", 1.45); + } } // Select a possibility from the RNG and choose it as the thing that should be said. diff --git a/Projectiles/Boss/AresGaussNukeProjectile.cs b/Projectiles/Boss/AresGaussNukeProjectile.cs index 33d9b3bb4d..f29c203c30 100644 --- a/Projectiles/Boss/AresGaussNukeProjectile.cs +++ b/Projectiles/Boss/AresGaussNukeProjectile.cs @@ -187,13 +187,13 @@ namespace CalamityMod.Projectiles.Boss if (Main.myPlayer == projectile.owner) { // Explosion waves - for (int i = 0; i < 5; i++) + for (int i = 0; i < 3; i++) { Projectile explosion = Projectile.NewProjectileDirect(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, 0f, Main.myPlayer); if (explosion.whoAmI.WithinBounds(Main.maxProjectiles)) { // Make the max explosion radius decrease over time, creating a ring effect. - explosion.ai[1] = 800f + i * 45f; + explosion.ai[1] = 800f + i * 90f; explosion.localAI[1] = 0.25f; explosion.Opacity = MathHelper.Lerp(0.18f, 0.6f, i / 7f) + Main.rand.NextFloat(-0.08f, 0.08f); explosion.netUpdate = true; diff --git a/Projectiles/Boss/AresPlasmaFireball.cs b/Projectiles/Boss/AresPlasmaFireball.cs index 6b062c20a5..e47e09bf62 100644 --- a/Projectiles/Boss/AresPlasmaFireball.cs +++ b/Projectiles/Boss/AresPlasmaFireball.cs @@ -48,16 +48,19 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - if (projectile.ai[0] != -1f) + if (projectile.ai[0] != -2f) { - Vector2 targetLocation = new Vector2(projectile.ai[0], projectile.ai[1]); - if (Vector2.Distance(targetLocation, projectile.Center) < 80f) - projectile.tileCollide = true; - } - else - { - if (projectile.timeLeft < timeLeft / 2) - projectile.Kill(); + if (projectile.ai[0] != -1f) + { + Vector2 targetLocation = new Vector2(projectile.ai[0], projectile.ai[1]); + if (Vector2.Distance(targetLocation, projectile.Center) < 80f) + projectile.tileCollide = true; + } + else + { + if (projectile.timeLeft < timeLeft / 2) + projectile.Kill(); + } } int fadeInTime = 3; @@ -166,8 +169,8 @@ namespace CalamityMod.Projectiles.Boss // Plasma bolts int totalProjectiles = CalamityWorld.malice ? 12 : 8; - // Reduce the total amount of projectiles by half if Apollo is shooting them - if (projectile.ai[0] == -1f) + // Reduce the total amount of projectiles by half if Apollo is shooting them or Ares Plasma Arm is shooting them and in deathray phase and not the last mech + if (projectile.ai[0] == -1f || projectile.ai[0] == -2f) totalProjectiles /= 2; float radians = MathHelper.TwoPi / totalProjectiles; diff --git a/Projectiles/Boss/AresTeslaOrb.cs b/Projectiles/Boss/AresTeslaOrb.cs index bb0d5beceb..e972a4a9a4 100644 --- a/Projectiles/Boss/AresTeslaOrb.cs +++ b/Projectiles/Boss/AresTeslaOrb.cs @@ -1,5 +1,7 @@ +using CalamityMod.Events; using CalamityMod.NPCs; using CalamityMod.NPCs.ExoMechs.Ares; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -145,13 +147,24 @@ namespace CalamityMod.Projectiles.Boss if (CalamityGlobalNPC.draedonExoMechPrime < 0 || !Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) return null; + // Difficulty modes + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + + float detachDistance = malice ? 1120f : death ? 960f : revenge ? 880f : expertMode ? 800f : 640f; for (int i = 0; i < Main.maxProjectiles; i++) { if (Main.projectile[i].type != projectile.type || Main.projectile[i].ai[0] != Identity + 1f || !Main.projectile[i].active || Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Calamity().newAI[0] == (float)AresBody.Phase.Deathrays) continue; + if (Vector2.Distance(projectile.Center, Main.projectile[i].Center) > detachDistance) + continue; + return Main.projectile[i]; } + return null; }