diff --git a/ILEditing/ILChanges.cs b/ILEditing/ILChanges.cs index bfa33c76c5..c0da6ef1db 100644 --- a/ILEditing/ILChanges.cs +++ b/ILEditing/ILChanges.cs @@ -125,6 +125,9 @@ namespace CalamityMod.ILEditing IL.Terraria.Player.ItemCheck += ApplyManaBurnIfNeeded; IL.Terraria.Player.AddBuff += AllowBuffTimeStackingForManaBurn; + // Ravager platform fall fix + + // Damage and health balance IL.Terraria.Main.DamageVar += AdjustDamageVariance; IL.Terraria.NPC.scaleStats += RemoveExpertHardmodeScaling; diff --git a/NPCs/ExoMechs/Apollo/Apollo.cs b/NPCs/ExoMechs/Apollo/Apollo.cs index 3afaf4f50b..64db2186fa 100644 --- a/NPCs/ExoMechs/Apollo/Apollo.cs +++ b/NPCs/ExoMechs/Apollo/Apollo.cs @@ -131,10 +131,12 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo music = /*CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ??*/ MusicID.Boss3; bossBag = ModContent.ItemType(); } - + public override void BossHeadSlot(ref int index) { - if (npc.life / (float)npc.lifeMax < 0.6f) + if (SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune) + index = -1; + else if (npc.life / (float)npc.lifeMax < 0.6f) index = phase2IconIndex; else index = phase1IconIndex; @@ -333,33 +335,31 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Distance where Apollo stops moving float movementDistanceGateValue = 100f; + float chargeLocationDistanceGateValue = 20f; // Velocity and acceleration values - float baseVelocityMult = malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f; - float baseVelocity = 14f * baseVelocityMult; - float baseAcceleration = 1f; - if (berserk) - { - baseVelocity *= 1.5f; - baseAcceleration *= 1.5f; - } + float baseVelocityMult = (berserk ? 0.5f : 0f) + (malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f); + float baseVelocity = 18f * baseVelocityMult; // Charge variables float chargeVelocity = malice ? 90f : death ? 80f : revenge ? 75f : expertMode ? 70f : 60f; - float chargeDistance = 1500f; - float chargeDuration = chargeDistance / chargeVelocity; bool lineUpAttack = calamityGlobalNPC.newAI[3] >= attackPhaseGateValue + 2f; bool doBigAttack = calamityGlobalNPC.newAI[3] >= attackPhaseGateValue + 2f + timeToLineUpAttack; // Rocket phase variables float rocketPhaseDuration = lastMechAlive ? 60f : 90f; + // Default vector to fly to + float chargeComboXOffset = -500f; + float chargeComboYOffset = npc.ai[2] == 0f ? 400f : -400f; + Vector2 destination = SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune ? new Vector2(player.Center.X + 1200f, player.Center.Y) : AIState == (float)Phase.LineUpChargeCombo ? new Vector2(player.Center.X + 750f, player.Center.Y + chargeComboYOffset) : new Vector2(player.Center.X + 750f, player.Center.Y); + // Rotation Vector2 predictionVector = player.velocity * predictionAmt; Vector2 aimedVector = player.Center + predictionVector - npc.Center; float rateOfRotation = 0.1f; Vector2 rotateTowards = player.Center - npc.Center; - bool stopRotatingAndSlowDown = AIState == (float)Phase.LineUpChargeCombo && calamityGlobalNPC.newAI[2] >= timeToLineUpAttack; + bool stopRotatingAndSlowDown = AIState == (float)Phase.LineUpChargeCombo && (Vector2.Distance(npc.Center, destination) <= chargeLocationDistanceGateValue || calamityGlobalNPC.newAI[2] > 0f); if (!stopRotatingAndSlowDown) { if (AIState == (int)Phase.ChargeCombo) @@ -401,11 +401,14 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo npc.localAI[2] = 0f; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; + for (int i = 0; i < maxCharges; i++) + chargeLocations[i] = default; + npc.dontTakeDamage = true; - npc.velocity.Y -= 2f; + npc.velocity.Y -= 1f; if ((double)npc.position.Y < Main.topWorld + 16f) - npc.velocity.Y -= 2f; + npc.velocity.Y -= 1f; if ((double)npc.position.Y < Main.topWorld + 16f) { @@ -433,10 +436,6 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo npc.netUpdate = true; } - // Default vector to fly to - float chargeComboYOffeset = npc.ai[2] == 0f ? 400f : -400f; - Vector2 destination = SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune ? new Vector2(player.Center.X + 1200f, player.Center.Y) : AIState == (float)Phase.LineUpChargeCombo ? new Vector2(player.Center.X + 750f, player.Center.Y + chargeComboYOffeset) : new Vector2(player.Center.X + 750f, player.Center.Y); - // Add a bit of randomness to the destination, but only in specific phases where it's necessary if (AIState == (float)Phase.Normal || AIState == (float)Phase.RocketBarrage || AIState == (float)Phase.PhaseTransition) { @@ -480,6 +479,14 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Reset everything npc.ai[3] = 1f; SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; + npc.localAI[0] = 0f; + npc.localAI[1] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + for (int i = 0; i < maxCharges; i++) + chargeLocations[i] = default; + npc.TargetClosest(); if (Main.netMode != NetmodeID.MultiplayerClient) @@ -499,6 +506,14 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo { // Tells Apollo to return to the battle in passive state and reset everything SecondaryAIState = (float)SecondaryPhase.Passive; + npc.localAI[0] = 0f; + npc.localAI[1] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + for (int i = 0; i < maxCharges; i++) + chargeLocations[i] = default; + npc.TargetClosest(); } @@ -508,6 +523,14 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo { // Reset everything SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; + npc.localAI[0] = 0f; + npc.localAI[1] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + for (int i = 0; i < maxCharges; i++) + chargeLocations[i] = default; + npc.TargetClosest(); } } @@ -517,11 +540,22 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Fire projectiles less often case (int)SecondaryPhase.Passive: + // Fire plasma while passive + AIState = (float)Phase.Normal; + // Enter passive and invincible phase if one of the other exo mechs is berserk if (otherMechIsBerserk) { // Reset everything SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; + npc.localAI[0] = 0f; + npc.localAI[1] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + for (int i = 0; i < maxCharges; i++) + chargeLocations[i] = default; + npc.TargetClosest(); } @@ -529,6 +563,14 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo if (berserk) { // Reset everything + npc.localAI[0] = 0f; + npc.localAI[1] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + for (int i = 0; i < maxCharges; i++) + chargeLocations[i] = default; + npc.TargetClosest(); // Never be passive if berserk @@ -540,18 +582,37 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Fly above target and become immune case (int)SecondaryPhase.PassiveAndImmune: + // Do nothing while immune + AIState = (float)Phase.Normal; + // Enter the fight again if any of the other exo mechs is below 70% and the other mechs aren't berserk if ((exoWormLifeRatio < 0.7f || exoPrimeLifeRatio < 0.7f) && !otherMechIsBerserk) { // Tells Artemis and Apollo to return to the battle in passive state and reset everything // Return to normal phases if one or more mechs have been downed SecondaryAIState = totalOtherExoMechLifeRatio > 5f ? (float)SecondaryPhase.Nothing : (float)SecondaryPhase.Passive; + npc.localAI[0] = 0f; + npc.localAI[1] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + for (int i = 0; i < maxCharges; i++) + chargeLocations[i] = default; + npc.TargetClosest(); } if (berserk) { // Reset everything + npc.localAI[0] = 0f; + npc.localAI[1] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + for (int i = 0; i < maxCharges; i++) + chargeLocations[i] = default; + npc.TargetClosest(); // Never be passive if berserk @@ -561,14 +622,118 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo break; } - // Needs edits // Attacking phases - /*switch ((int)AIState) + switch ((int)AIState) { - // Fly above the target + // Fly to the right of the target case (int)Phase.Normal: - if (!targetDead) + // Inverse lerp returns the percentage of progress between A and B + float lerpValue2 = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); + + // Min velocity + float minVelocity2 = distanceFromDestination.Length(); + float minVelocityCap2 = baseVelocity; + if (minVelocity2 > minVelocityCap2) + minVelocity2 = minVelocityCap2; + + // Max velocity + Vector2 maxVelocity2 = distanceFromDestination / 24f; + float maxVelocityCap2 = minVelocityCap2 * 3f; + if (maxVelocity2.Length() > maxVelocityCap2) + maxVelocity2 = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap2; + + npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity2, maxVelocity2, lerpValue2); + + // Default animation for 60 frames and then go to telegraph animation + // newAI[3] tells Apollo what animation state it's currently in + bool attacking = calamityGlobalNPC.newAI[3] >= 2f; + bool firingPlasma = attacking && calamityGlobalNPC.newAI[3] + 2f < attackPhaseGateValue; + + // Only increase attack timer if not in immune phase + if (SecondaryAIState != (float)SecondaryPhase.PassiveAndImmune) + calamityGlobalNPC.newAI[2] += 1f; + + if (calamityGlobalNPC.newAI[2] >= defaultAnimationDuration || attacking) + { + if (firingPlasma) + { + // Fire plasma + int numPlasmaOrbs = lastMechAlive ? 15 : 12; + float divisor = attackPhaseGateValue / numPlasmaOrbs; + float plasmaTimer = calamityGlobalNPC.newAI[3] - 2f; + if (plasmaTimer % divisor == 0f) + { + pickNewLocation = true; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PlasmaCasterFire"), npc.Center); + Vector2 plasmaVelocity = Vector2.Normalize(aimedVector); + Vector2 offset = plasmaVelocity * 70f; + Projectile.NewProjectile(npc.Center + offset, plasmaVelocity, type, damage, 0f, Main.myPlayer, -1f); + } + } + } + else + calamityGlobalNPC.newAI[2] = 0f; + + // Enter rocket phase after a certain time has passed + // Enter charge phase if in phase 2 and the localAI[2] variable is set to do so + calamityGlobalNPC.newAI[3] += 1f; + if (lineUpAttack) + { + // Return to normal plasma phase if in passive state + if (SecondaryAIState == (float)SecondaryPhase.Passive) + { + pickNewLocation = true; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + for (int i = 0; i < maxCharges; i++) + chargeLocations[i] = default; + + npc.TargetClosest(); + } + else if (doBigAttack) + { + pickNewLocation = npc.localAI[2] == 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + + if (phase2) + AIState = npc.localAI[2] == 1f ? (float)Phase.LineUpChargeCombo : (float)Phase.RocketBarrage; + else + AIState = (float)Phase.RocketBarrage; + } + } + } + + break; + + // Charge + case (int)Phase.RocketBarrage: + + // Reset phase and variables + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] >= rocketPhaseDuration) + { + // Go back to normal phase + pickNewLocation = true; + AIState = (float)Phase.Normal; + npc.localAI[2] = berserk ? 1f : 0f; + calamityGlobalNPC.newAI[2] = 0f; + npc.TargetClosest(); + } + + break; + + // Get in position for the charge combo, don't do anything else until in position + // Fill up the charge location array with the positions Apollo will charge from + // Create telegraph beams between the charge location array positions + case (int)Phase.LineUpChargeCombo: + + if (!stopRotatingAndSlowDown) { // Inverse lerp returns the percentage of progress between A and B float lerpValue = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); @@ -587,107 +752,113 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity, maxVelocity, lerpValue); } - - if (berserk) + else { + // Save the charge locations + for (int i = 0; i < maxCharges; i++) + { + if (chargeLocations[i] == default) + { + switch (i) + { + case 0: + chargeLocations[i] = npc.Center; + break; + case 1: + chargeLocations[i] = chargeLocations[0] + new Vector2(chargeComboXOffset, -chargeComboYOffset * 2f); + break; + case 2: + chargeLocations[i] = chargeLocations[1] + new Vector2(chargeComboXOffset, chargeComboYOffset * 2f); + break; + case 3: + chargeLocations[i] = chargeLocations[2] + new Vector2(chargeComboXOffset, -chargeComboYOffset * 2f); + break; + default: + break; + } + } + } + + // Don't move + npc.velocity = Vector2.Zero; + + // Go to charge phase and reset calamityGlobalNPC.newAI[2] += 1f; - if (calamityGlobalNPC.newAI[2] > deathrayPhaseGateValue) + if (calamityGlobalNPC.newAI[2] >= timeToLineUpAttack) { + AIState = (float)Phase.ChargeCombo; calamityGlobalNPC.newAI[2] = 0f; - AIState = (float)Phase.Deathrays; } } break; - // Move close to target, reduce velocity when close enough, create telegraph beams, fire deathrays - case (int)Phase.Deathrays: + // Charge to several locations almost instantly (Apollo doesn't teleport here, he's just moving very fast :D) + case (int)Phase.ChargeCombo: - if (!targetDead) + // Charge combo attack here + // Increase newAI[2] whenever a charge occurs + + // Reset phase and variables + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] >= maxCharges) { - if (distanceFromTarget > deathrayDistanceGateValue && calamityGlobalNPC.newAI[3] == 0f) - { - Vector2 desiredVelocity2 = Vector2.Normalize(distanceFromDestination) * baseVelocity; - npc.SimpleFlyMovement(desiredVelocity2, baseAcceleration); - } - else - { - calamityGlobalNPC.newAI[3] = 1f; - npc.velocity *= decelerationVelocityMult; + pickNewLocation = true; + AIState = (float)Phase.Normal; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + for (int i = 0; i < maxCharges; i++) + chargeLocations[i] = default; - int totalProjectiles = malice ? 12 : expertMode ? 10 : 8; - float radians = MathHelper.TwoPi / totalProjectiles; - Vector2 laserSpawnPoint = new Vector2(npc.Center.X, npc.Center.Y); - bool normalLaserRotation = npc.localAI[0] % 2f == 0f; - float velocity = 6f; - double angleA = radians * 0.5; - double angleB = MathHelper.ToRadians(90f) - angleA; - float velocityX2 = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); - Vector2 spinningPoint = normalLaserRotation ? new Vector2(0f, -velocity) : new Vector2(-velocityX2, -velocity); - spinningPoint.Normalize(); - - calamityGlobalNPC.newAI[2] += 1f; - if (calamityGlobalNPC.newAI[2] < deathrayTelegraphDuration) - { - // Fire deathray telegraph beams - if (calamityGlobalNPC.newAI[2] == 1f) - { - // 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; - - // Y = 4 sets to frame 12 - frameY = 4; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); - int type = ModContent.ProjectileType(); - Vector2 spawnPoint = npc.Center + new Vector2(-1f, 23f); - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 laserVelocity = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(spawnPoint + Vector2.Normalize(laserVelocity) * 17f, laserVelocity, type, 0, 0f, Main.myPlayer, 0f, npc.whoAmI); - } - } - } - } - else - { - // Fire deathrays - if (calamityGlobalNPC.newAI[2] == deathrayTelegraphDuration) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/TeslaCannonFire"), npc.Center); - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Vector2 spawnPoint = npc.Center + new Vector2(-1f, 23f); - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 laserVelocity = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(spawnPoint + Vector2.Normalize(laserVelocity) * 35f, laserVelocity, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); - } - } - } - } - - if (calamityGlobalNPC.newAI[2] >= deathrayTelegraphDuration + deathrayDuration) - { - AIState = (float)Phase.Normal; - calamityGlobalNPC.newAI[2] = 0f; - calamityGlobalNPC.newAI[3] = 0f; - npc.localAI[0] += 1f; - npc.TargetClosest(); - } - } + npc.TargetClosest(); } break; - }*/ + + // Phase transition animation, that's all this exists for + case (int)Phase.PhaseTransition: + + // Inverse lerp returns the percentage of progress between A and B + float lerpValue4 = Utils.InverseLerp(movementDistanceGateValue, 2400f, distanceFromDestination.Length(), true); + + // Min velocity + float minVelocity4 = distanceFromDestination.Length(); + float minVelocityCap4 = baseVelocity; + if (minVelocity4 > minVelocityCap4) + minVelocity4 = minVelocityCap4; + + // Max velocity + Vector2 maxVelocity4 = distanceFromDestination / 24f; + float maxVelocityCap4 = minVelocityCap4 * 3f; + if (maxVelocity4.Length() > maxVelocityCap4) + maxVelocity4 = distanceFromDestination.SafeNormalize(Vector2.Zero) * maxVelocityCap4; + + npc.velocity = Vector2.Lerp(distanceFromDestination.SafeNormalize(Vector2.Zero) * minVelocity4, maxVelocity4, lerpValue4); + + // Shoot lens gore at the target at the proper time + if (calamityGlobalNPC.newAI[2] == lensPopTime) + { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire"), npc.Center); + Vector2 goreVelocity = Vector2.Normalize(aimedVector); + Vector2 offset = goreVelocity * 70f; + Gore.NewGore(npc.Center + offset, goreVelocity * 24f, mod.GetGoreSlot("Gores/Apollo/ApolloTransitionGore"), 1f); + } + + // Reset phase and variables + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] >= phaseTransitionDuration) + { + pickNewLocation = true; + AIState = (float)Phase.Normal; + npc.localAI[0] = 0f; + npc.localAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + npc.TargetClosest(); + } + + break; + } } public override bool CanHitPlayer(Player target, ref int cooldownSlot) @@ -709,7 +880,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo if (dist4 < minDist) minDist = dist4; - return minDist <= 100f && npc.Opacity == 1f; + return minDist <= 100f && npc.Opacity == 1f && AIState == (float)Phase.ChargeCombo; } public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) => !CalamityUtils.AntiButcher(npc, ref damage, 0.5f); @@ -720,14 +891,14 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo return null; } - // Needs edits - /*public override void FindFrame(int frameHeight) + public override void FindFrame(int frameHeight) { - // Use telegraph frames when using deathrays + // Use telegraph frames before each attack + bool phase2 = npc.life / (float)npc.lifeMax < 0.6f; npc.frameCounter += 1D; - if (AIState == (float)Phase.Normal || npc.Calamity().newAI[3] == 0f) + if (AIState == (float)Phase.PhaseTransition) { - if (npc.frameCounter >= 10D) + if (npc.frameCounter >= 6D) { // Reset frame counter npc.frameCounter = 0D; @@ -735,41 +906,68 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Increment the Y frame frameY++; - // Reset the Y frame if greater than 8 + // Reset the Y frame if greater than 9 if (frameY == maxFramesY) { frameX++; frameY = 0; } - - // Reset the frames to frame 0 - if ((frameX * maxFramesY) + frameY > normalFrameLimit) - frameX = frameY = 0; } } else { - if (npc.frameCounter >= 10D) + if (AIState == (float)Phase.Normal) { - // Reset frame counter - npc.frameCounter = 0D; + int frameLimit = phase2 ? (npc.Calamity().newAI[3] == 0f ? normalFrameLimit_Phase2 : npc.Calamity().newAI[3] == 1f ? chargeUpFrameLimit_Phase2 : attackFrameLimit_Phase2) : + (npc.Calamity().newAI[3] == 0f ? normalFrameLimit_Phase1 : npc.Calamity().newAI[3] == 1f ? chargeUpFrameLimit_Phase1 : attackFrameLimit_Phase1); - // Increment the Y frame - frameY++; - - // Reset the Y frame if greater than 8 - if (frameY == maxFramesY) + if (npc.frameCounter >= 6D) { - frameX++; - frameY = 0; - } + // Reset frame counter + npc.frameCounter = 0D; - // Reset the frames to frame 36, the start of the deathray firing animation loop - if ((frameX * maxFramesY) + frameY > finalStageDeathrayChargeFrameLimit) - frameX = frameY = 4; + // Increment the Y frame + frameY++; + + // Reset the Y frame if greater than 9 + if (frameY == maxFramesY) + { + frameX++; + frameY = 0; + } + + // Reset the frames + int currentFrame = (frameX * maxFramesY) + frameY; + if (currentFrame > frameLimit) + frameX = frameY = phase2 ? (npc.Calamity().newAI[3] == 0f ? 6 : npc.Calamity().newAI[3] == 1f ? 7 : 8) : (npc.Calamity().newAI[3] == 0f ? 0 : npc.Calamity().newAI[3] == 1f ? 1 : 2); + } + } + else if (AIState == (float)Phase.RocketBarrage || AIState == (float)Phase.LineUpChargeCombo || AIState == (float)Phase.ChargeCombo) + { + int frameLimit = phase2 ? attackFrameLimit_Phase2 : attackFrameLimit_Phase1; + if (npc.frameCounter >= 6D) + { + // Reset frame counter + npc.frameCounter = 0D; + + // Increment the Y frame + frameY++; + + // Reset the Y frame if greater than 9 + if (frameY == maxFramesY) + { + frameX++; + frameY = 0; + } + + // Reset the frames + int currentFrame = (frameX * maxFramesY) + frameY; + if (currentFrame > frameLimit) + frameX = frameY = phase2 ? 8 : 2; + } } } - }*/ + } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { diff --git a/NPCs/ExoMechs/Ares/AresBody.cs b/NPCs/ExoMechs/Ares/AresBody.cs index a472205002..e464187143 100644 --- a/NPCs/ExoMechs/Ares/AresBody.cs +++ b/NPCs/ExoMechs/Ares/AresBody.cs @@ -105,7 +105,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares bossBag = ModContent.ItemType(); } - public override void SendExtraAI(BinaryWriter writer) + public override void BossHeadSlot(ref int index) + { + if (SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune) + index = -1; + } + + public override void SendExtraAI(BinaryWriter writer) { writer.Write(frameX); writer.Write(frameY); @@ -323,9 +329,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares calamityGlobalNPC.newAI[3] = 0f; npc.dontTakeDamage = true; - npc.velocity.Y -= 2f; + npc.velocity.Y -= 1f; if ((double)npc.position.Y < Main.topWorld + 16f) - npc.velocity.Y -= 2f; + npc.velocity.Y -= 1f; if ((double)npc.position.Y < Main.topWorld + 16f) { @@ -348,15 +354,10 @@ namespace CalamityMod.NPCs.ExoMechs.Ares 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 - 425f) : player.Center; // Velocity and acceleration values - float baseVelocityMult = malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f; - float baseVelocity = 14f * baseVelocityMult; - float baseAcceleration = 1f; + float baseVelocityMult = (berserk ? 0.5f : 0f) + (malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f); + float baseVelocity = 18f * baseVelocityMult; + float baseAcceleration = berserk ? 1.5f : 1f; float decelerationVelocityMult = 0.85f; - if (berserk) - { - baseVelocity *= 1.5f; - baseAcceleration *= 1.5f; - } Vector2 distanceFromDestination = destination - npc.Center; Vector2 desiredVelocity = Vector2.Normalize(distanceFromDestination) * baseVelocity; diff --git a/NPCs/ExoMechs/Ares/AresGaussNuke.cs b/NPCs/ExoMechs/Ares/AresGaussNuke.cs index b9c34def79..47315a41d7 100644 --- a/NPCs/ExoMechs/Ares/AresGaussNuke.cs +++ b/NPCs/ExoMechs/Ares/AresGaussNuke.cs @@ -222,9 +222,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares calamityGlobalNPC.newAI[2] = 0f; npc.dontTakeDamage = true; - npc.velocity.Y -= 2f; + npc.velocity.Y -= 1f; if ((double)npc.position.Y < Main.topWorld + 16f) - npc.velocity.Y -= 2f; + npc.velocity.Y -= 1f; if ((double)npc.position.Y < Main.topWorld + 16f) { @@ -247,10 +247,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares 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); // Velocity and acceleration values - float baseVelocityMult = malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f; - float baseVelocity = 16f * baseVelocityMult; - if (berserk) - baseVelocity *= 1.5f; + float baseVelocityMult = (berserk ? 0.5f : 0f) + (malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f); + float baseVelocity = 22f * baseVelocityMult; Vector2 distanceFromDestination = destination - npc.Center; diff --git a/NPCs/ExoMechs/Ares/AresLaserCannon.cs b/NPCs/ExoMechs/Ares/AresLaserCannon.cs index 89aff1c04a..b1282330a8 100644 --- a/NPCs/ExoMechs/Ares/AresLaserCannon.cs +++ b/NPCs/ExoMechs/Ares/AresLaserCannon.cs @@ -213,9 +213,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares calamityGlobalNPC.newAI[2] = 0f; npc.dontTakeDamage = true; - npc.velocity.Y -= 2f; + npc.velocity.Y -= 1f; if ((double)npc.position.Y < Main.topWorld + 16f) - npc.velocity.Y -= 2f; + npc.velocity.Y -= 1f; if ((double)npc.position.Y < Main.topWorld + 16f) { @@ -238,14 +238,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares 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); // Velocity and acceleration values - float baseVelocityMult = malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f; - float baseVelocity = 16f * baseVelocityMult; - float baseAcceleration = 1f; - if (berserk) - { - baseVelocity *= 1.5f; - baseAcceleration *= 1.5f; - } + float baseVelocityMult = (berserk ? 0.5f : 0f) + (malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f); + float baseVelocity = 22f * baseVelocityMult; + float baseAcceleration = berserk ? 1.5f : 1f; Vector2 distanceFromDestination = destination - npc.Center; Vector2 desiredVelocity = Vector2.Normalize(distanceFromDestination) * baseVelocity; diff --git a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs index 5eb5958a3b..d4be78fa6a 100644 --- a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs +++ b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs @@ -220,9 +220,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares calamityGlobalNPC.newAI[2] = 0f; npc.dontTakeDamage = true; - npc.velocity.Y -= 2f; + npc.velocity.Y -= 1f; if ((double)npc.position.Y < Main.topWorld + 16f) - npc.velocity.Y -= 2f; + npc.velocity.Y -= 1f; if ((double)npc.position.Y < Main.topWorld + 16f) { @@ -245,10 +245,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares 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); // Velocity and acceleration values - float baseVelocityMult = malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f; - float baseVelocity = 16f * baseVelocityMult; - if (berserk) - baseVelocity *= 1.5f; + float baseVelocityMult = (berserk ? 0.5f : 0f) + (malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f); + float baseVelocity = 22f * baseVelocityMult; Vector2 distanceFromDestination = destination - npc.Center; diff --git a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs index 0212975f6b..623442070a 100644 --- a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs +++ b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs @@ -220,9 +220,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares calamityGlobalNPC.newAI[2] = 0f; npc.dontTakeDamage = true; - npc.velocity.Y -= 2f; + npc.velocity.Y -= 1f; if ((double)npc.position.Y < Main.topWorld + 16f) - npc.velocity.Y -= 2f; + npc.velocity.Y -= 1f; if ((double)npc.position.Y < Main.topWorld + 16f) { @@ -245,10 +245,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares 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); // Velocity and acceleration values - float baseVelocityMult = malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f; - float baseVelocity = 16f * baseVelocityMult; - if (berserk) - baseVelocity *= 1.5f; + float baseVelocityMult = (berserk ? 0.5f : 0f) + (malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f); + float baseVelocity = 22f * baseVelocityMult; Vector2 distanceFromDestination = destination - npc.Center; diff --git a/NPCs/ExoMechs/Artemis/Artemis.cs b/NPCs/ExoMechs/Artemis/Artemis.cs index 45e68697b1..e25a1d1faa 100644 --- a/NPCs/ExoMechs/Artemis/Artemis.cs +++ b/NPCs/ExoMechs/Artemis/Artemis.cs @@ -142,7 +142,9 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis public override void BossHeadSlot(ref int index) { - if (npc.life / (float)npc.lifeMax < 0.6f) + if (SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune) + index = -1; + else if (npc.life / (float)npc.lifeMax < 0.6f) index = phase2IconIndex; else index = phase1IconIndex; @@ -350,19 +352,13 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis float movementDistanceGateValue = 100f; // Velocity and acceleration values - float baseVelocityMult = malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f; - float baseVelocity = 14f * baseVelocityMult; - float baseAcceleration = 1f; + float baseVelocityMult = (berserk ? 0.5f : 0f) + (malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f); + float baseVelocity = 18f * baseVelocityMult; float decelerationVelocityMult = 0.85f; - if (berserk) - { - baseVelocity *= 1.5f; - baseAcceleration *= 1.5f; - } // Charge variables float chargeVelocity = malice ? 60f : death ? 50f : revenge ? 45f : expertMode ? 40f : 30f; - float chargeDistance = 1800f; + float chargeDistance = 2000f; float chargeDuration = chargeDistance / chargeVelocity; bool lineUpAttack = calamityGlobalNPC.newAI[3] >= attackPhaseGateValue + 2f; bool doBigAttack = calamityGlobalNPC.newAI[3] >= attackPhaseGateValue + 2f + timeToLineUpAttack; @@ -421,9 +417,9 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis rotationDirection = 0; npc.dontTakeDamage = true; - npc.velocity.Y -= 2f; + npc.velocity.Y -= 1f; if ((double)npc.position.Y < Main.topWorld + 16f) - npc.velocity.Y -= 2f; + npc.velocity.Y -= 1f; if ((double)npc.position.Y < Main.topWorld + 16f) { @@ -465,8 +461,8 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis Vector2 distanceFromDestination = destination - npc.Center; Vector2 desiredVelocity = Vector2.Normalize(distanceFromDestination) * baseVelocity; - // Velocity during deathray spin phase - float spinVelocity = baseVelocity * 0.25f; + // Duration of deathray spin to do a full circle + float spinTime = 120f - baseVelocity * 2.5f; // Set to transition to phase 2 if it hasn't happened yet if (phase2 && npc.localAI[3] == 0f) @@ -507,7 +503,6 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; rotationDirection = 0; - npc.TargetClosest(); } } else @@ -525,7 +520,6 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; rotationDirection = 0; - npc.TargetClosest(); } // Go passive and immune if one of the other mechs is berserk @@ -540,7 +534,6 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; rotationDirection = 0; - npc.TargetClosest(); } } @@ -563,7 +556,6 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; rotationDirection = 0; - npc.TargetClosest(); } // If Artemis and Apollo are the first mechs to go berserk @@ -576,7 +568,6 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; rotationDirection = 0; - npc.TargetClosest(); // Never be passive if berserk SecondaryAIState = (float)SecondaryPhase.Nothing; @@ -602,7 +593,6 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; rotationDirection = 0; - npc.TargetClosest(); } if (berserk) @@ -614,7 +604,6 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; rotationDirection = 0; - npc.TargetClosest(); // Never be passive if berserk SecondaryAIState = (float)SecondaryPhase.Nothing; @@ -706,7 +695,6 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; chargeVelocityNormalized = default; - npc.TargetClosest(); } else { @@ -725,16 +713,15 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis if (doBigAttack) { + calamityGlobalNPC.newAI[3] = 0f; if (phase2) { AIState = npc.localAI[2] == 1f ? (float)Phase.Deathray : (float)Phase.LaserShotgun; - calamityGlobalNPC.newAI[3] = 0f; } else { // Charge until a certain distance is reached and then return to normal phase AIState = (float)Phase.Charge; - calamityGlobalNPC.newAI[3] = 0f; npc.velocity = chargeVelocityNormalized * chargeVelocity; chargeVelocityNormalized = default; } @@ -761,7 +748,6 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis pickNewLocation = true; AIState = (float)Phase.Normal; calamityGlobalNPC.newAI[2] = 0f; - npc.TargetClosest(); } } @@ -799,16 +785,20 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center); + Vector2 laserVelocity = Vector2.Normalize(aimedVector) * 10f; - int spread = 3 + (int)(calamityGlobalNPC.newAI[2] / divisor2) * 3; + int spread = 15 + (int)(calamityGlobalNPC.newAI[2] / divisor2) * 15; float rotation = MathHelper.ToRadians(spread); float distanceFromTarget = Vector2.Distance(npc.Center, player.Center + predictionVector); + for (int i = 0; i < numLasersPerSpread + 1; i++) { - Vector2 perturbedSpeed = laserVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numLasersPerSpread - 1))); + Vector2 perturbedSpeed = laserVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numLasersPerSpread - 1))); Vector2 normalizedPerturbedSpeed = Vector2.Normalize(perturbedSpeed); + Vector2 offset = normalizedPerturbedSpeed * 70f; Vector2 newCenter = npc.Center + offset; + Projectile.NewProjectile(newCenter, newCenter + normalizedPerturbedSpeed * distanceFromTarget, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); } } @@ -822,7 +812,6 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis AIState = (float)Phase.Normal; npc.localAI[2] = berserk ? 1f : 0f; calamityGlobalNPC.newAI[2] = 0f; - npc.TargetClosest(); } break; @@ -865,7 +854,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis rotationDirection = player.direction; // Set spin velocity - npc.velocity.X = MathHelper.Pi * spinRadius / spinVelocity; + npc.velocity.X = MathHelper.Pi * spinRadius / spinTime; npc.velocity *= -rotationDirection; npc.netUpdate = true; @@ -880,7 +869,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis } } else - npc.velocity = npc.velocity.RotatedBy(MathHelper.Pi / spinVelocity * -rotationDirection); + npc.velocity = npc.velocity.RotatedBy(MathHelper.Pi / spinTime * -rotationDirection); } } else @@ -912,7 +901,6 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis AIState = (float)Phase.Normal; npc.localAI[2] = 0f; calamityGlobalNPC.newAI[2] = 0f; - npc.TargetClosest(); } break; @@ -956,7 +944,6 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis npc.localAI[1] = 0f; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; - npc.TargetClosest(); } break; @@ -982,7 +969,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis if (dist4 < minDist) minDist = dist4; - return minDist <= 100f && npc.Opacity == 1f; + return minDist <= 100f && npc.Opacity == 1f && AIState == (float)Phase.Charge; } public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) => !CalamityUtils.AntiButcher(npc, ref damage, 0.5f); diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs index 2fdca2c136..5a96195aef 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs @@ -71,7 +71,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void BossHeadSlot(ref int index) { - if (vulnerable) + if (Main.npc[(int)npc.ai[2]].Calamity().newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune) + index = -1; + else if (vulnerable) index = vulnerableIconIndex; else index = normalIconIndex; @@ -210,7 +212,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (npc.Calamity().newAI[0] == 0f) npc.ai[3] += 1f; - double numSegmentsAbleToFire = malice ? 30D : death ? 20D : revenge ? 17.5 : expertMode ? 15D : 10D; + double numSegmentsAbleToFire = malice ? 35D : death ? 30D : revenge ? 28D : expertMode ? 25D : 20D; if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge && !berserk) { float divisor = 120f; @@ -278,7 +280,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos else { // This is only used in deathray phase to prevent laser spam - float segmentDivisor = (float)Math.Round(numSegments / (berserk ? 5D : numSegmentsAbleToFire)); + float segmentDivisor = (float)Math.Round(numSegments / (berserk ? numSegmentsAbleToFire * 2f : numSegmentsAbleToFire)); float divisor = npc.localAI[2] * 3f; // Ranges from 3 to 300 if ((npc.ai[3] == divisor && npc.localAI[2] % segmentDivisor == 0f) || npc.Calamity().newAI[0] > 0f) { diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs index 43f5d6c34d..e0fd2c5c98 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs @@ -71,7 +71,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void BossHeadSlot(ref int index) { - if (vulnerable) + if (Main.npc[(int)npc.ai[2]].Calamity().newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune) + index = -1; + else if (vulnerable) index = vulnerableIconIndex; else index = normalIconIndex; @@ -210,7 +212,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (npc.Calamity().newAI[0] == 0f) npc.ai[3] += 1f; - double numSegmentsAbleToFire = malice ? 30D : death ? 20D : revenge ? 17.5 : expertMode ? 15D : 10D; + double numSegmentsAbleToFire = malice ? 35D : death ? 30D : revenge ? 28D : expertMode ? 25D : 20D; if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge && !berserk) { float divisor = 120f; @@ -278,7 +280,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos else { // This is only used in deathray phase to prevent laser spam - float segmentDivisor = (float)Math.Round(numSegments / (berserk ? 5D : numSegmentsAbleToFire)); + float segmentDivisor = (float)Math.Round(numSegments / (berserk ? numSegmentsAbleToFire * 2f : numSegmentsAbleToFire)); float divisor = npc.localAI[2] * 3f; // Ranges from 3 to 300 if ((npc.ai[3] == divisor && npc.localAI[2] % segmentDivisor == 0f) || npc.Calamity().newAI[0] > 0f) { diff --git a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs index cdc64402f6..cb47c82bf8 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs @@ -78,7 +78,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos private const float defaultLifeRatio = 5f; // Base distance from the target for most attacks - private const float baseDistance = 800f; + private const float baseDistance = 400f; // Base distance from target location in order to continue turning private const float baseTurnDistance = 160f; @@ -139,7 +139,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void BossHeadSlot(ref int index) { - if (vulnerable) + if (SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune) + index = -1; + else if (vulnerable) index = vulnerableIconIndex; else index = normalIconIndex; @@ -372,9 +374,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos chargeVelocityScalar = 0f; npc.dontTakeDamage = true; - npc.velocity.Y -= 2f; + npc.velocity.Y -= 1f; if ((double)npc.position.Y < Main.topWorld + 16f) - npc.velocity.Y -= 2f; + npc.velocity.Y -= 1f; if ((double)npc.position.Y < Main.topWorld + 16f) { @@ -406,19 +408,14 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos float chargeLocationDistance = turnDistance * 0.2f; // Laser Barrage variables - float laserBarrageLocationBaseDistance = SecondaryAIState == (int)SecondaryPhase.PassiveAndImmune ? baseDistance * 1.5f : baseDistance; + float laserBarrageLocationBaseDistance = SecondaryAIState == (int)SecondaryPhase.PassiveAndImmune ? baseDistance * 2f : baseDistance; Vector2 laserBarrageLocation = new Vector2(0f, laserBarrageLocationBaseDistance); float laserBarrageLocationDistance = turnDistance * 3f; // Velocity and turn speed values - float baseVelocityMult = malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f; - float baseVelocity = 7f * baseVelocityMult; - float turnDegrees = baseVelocity * 0.11f; - if (berserk) - { - baseVelocity *= 1.5f; - turnDegrees *= 1.5f; - } + float baseVelocityMult = (berserk ? 0.5f : 0f) + (malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f); + float baseVelocity = 9f * baseVelocityMult; + float turnDegrees = baseVelocity * 0.11f * (berserk ? 1.5f : 1f); // Increase top velocity if target is dead if (targetDead) diff --git a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs index eb650d31b0..eedf364347 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs @@ -70,7 +70,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void BossHeadSlot(ref int index) { - if (vulnerable) + if (Main.npc[(int)npc.ai[2]].Calamity().newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune) + index = -1; + else if (vulnerable) index = vulnerableIconIndex; else index = normalIconIndex; @@ -209,7 +211,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (npc.Calamity().newAI[0] == 0f) npc.ai[3] += 1f; - double numSegmentsAbleToFire = malice ? 30D : death ? 20D : revenge ? 17.5 : expertMode ? 15D : 10D; + double numSegmentsAbleToFire = malice ? 35D : death ? 30D : revenge ? 28D : expertMode ? 25D : 20D; if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge && !berserk) { float divisor = 120f; @@ -277,7 +279,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos else { // This is only used in deathray phase to prevent laser spam - float segmentDivisor = (float)Math.Round(numSegments / (berserk ? 5D : numSegmentsAbleToFire)); + float segmentDivisor = (float)Math.Round(numSegments / (berserk ? numSegmentsAbleToFire * 2f : numSegmentsAbleToFire)); float divisor = npc.localAI[2] * 3f; // Ranges from 3 to 300 if ((npc.ai[3] == divisor && npc.localAI[2] % segmentDivisor == 0f) || npc.Calamity().newAI[0] > 0f) { diff --git a/Projectiles/Boss/AresDeathBeamStart.cs b/Projectiles/Boss/AresDeathBeamStart.cs index 06d2972a3d..384861305e 100644 --- a/Projectiles/Boss/AresDeathBeamStart.cs +++ b/Projectiles/Boss/AresDeathBeamStart.cs @@ -97,7 +97,7 @@ namespace CalamityMod.Projectiles.Boss samplingPoint = vector78.Value; float[] array3 = new float[(int)num805]; - Collision.LaserScan(samplingPoint, projectile.velocity, num806 * projectile.scale, 2400f, array3); + Collision.LaserScan(samplingPoint, projectile.velocity, num806 * projectile.scale, 4800f, array3); float num807 = 0f; for (int num808 = 0; num808 < array3.Length; num808++) { @@ -108,7 +108,7 @@ namespace CalamityMod.Projectiles.Boss // Fire laser through walls at max length if target cannot be seen if (!Collision.CanHitLine(Main.npc[(int)projectile.ai[1]].Center, 1, 1, Main.player[Main.npc[(int)projectile.ai[1]].target].Center, 1, 1)) { - num807 = 2400f; + num807 = 4800f; } float amount = 0.5f; diff --git a/Projectiles/Boss/AresDeathBeamTelegraph.cs b/Projectiles/Boss/AresDeathBeamTelegraph.cs index 014f80a945..169f679782 100644 --- a/Projectiles/Boss/AresDeathBeamTelegraph.cs +++ b/Projectiles/Boss/AresDeathBeamTelegraph.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Boss public Vector2 OldVelocity; public const float TelegraphTotalTime = 240f; public const float TelegraphFadeTime = 15f; - public const float TelegraphWidth = 4200f; + public const float TelegraphWidth = 4800f; public override void SetStaticDefaults() { diff --git a/Projectiles/Boss/AresPlasmaFireball.cs b/Projectiles/Boss/AresPlasmaFireball.cs index ea79f1db14..12fb3a8163 100644 --- a/Projectiles/Boss/AresPlasmaFireball.cs +++ b/Projectiles/Boss/AresPlasmaFireball.cs @@ -48,9 +48,12 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - Vector2 targetLocation = new Vector2(projectile.ai[0], projectile.ai[1]); - if (Vector2.Distance(targetLocation, projectile.Center) < 80f) - projectile.tileCollide = true; + 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; + } int fadeInTime = 3; projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - (timeLeft - fadeInTime)) / (float)fadeInTime), 0f, 1f); @@ -157,6 +160,11 @@ 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) + totalProjectiles /= 2; + float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); float velocity = projectile.velocity.Length(); diff --git a/Projectiles/Boss/AresTeslaOrb.cs b/Projectiles/Boss/AresTeslaOrb.cs index 8103fff1b5..0278354c98 100644 --- a/Projectiles/Boss/AresTeslaOrb.cs +++ b/Projectiles/Boss/AresTeslaOrb.cs @@ -50,6 +50,9 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + if (projectile.velocity.Length() < 24f) + projectile.velocity *= 1.01f; + int fadeOutTime = 15; int fadeInTime = 3; if (projectile.timeLeft < fadeOutTime) diff --git a/Projectiles/Boss/ArtemisDeathrayTelegraph.cs b/Projectiles/Boss/ArtemisDeathrayTelegraph.cs index 4e7586d93a..84786d9d37 100644 --- a/Projectiles/Boss/ArtemisDeathrayTelegraph.cs +++ b/Projectiles/Boss/ArtemisDeathrayTelegraph.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Boss public Vector2 OldVelocity; public const float TelegraphTotalTime = 60f; public const float TelegraphFadeTime = 15f; - public const float TelegraphWidth = 4200f; + public const float TelegraphWidth = 4800f; public override void SetStaticDefaults() { diff --git a/Projectiles/Boss/ArtemisLaserBeamStart.cs b/Projectiles/Boss/ArtemisLaserBeamStart.cs index db7bfe3aad..5c0a5627e7 100644 --- a/Projectiles/Boss/ArtemisLaserBeamStart.cs +++ b/Projectiles/Boss/ArtemisLaserBeamStart.cs @@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Boss float arraySize = 3f; Vector2 samplingPoint = projectile.Center; float[] samples = new float[(int)arraySize]; - Collision.LaserScan(samplingPoint, projectile.velocity, projectile.width * projectile.scale, 2400f, samples); + Collision.LaserScan(samplingPoint, projectile.velocity, projectile.width * projectile.scale, 4800f, samples); float laserLength = 0f; for (int i = 0; i < samples.Length; i++) { @@ -115,7 +115,7 @@ namespace CalamityMod.Projectiles.Boss // Fire laser through walls at max length if target cannot be seen if (!Collision.CanHitLine(ThingToAttachTo.Center, 1, 1, Main.player[ThingToAttachTo.target].Center, 1, 1)) - laserLength = 2400f; + laserLength = 4800f; float amount = 0.5f; LengthOfLaser = MathHelper.Lerp(LengthOfLaser, laserLength, amount); diff --git a/Projectiles/Boss/ExoDestroyerBeamStart.cs b/Projectiles/Boss/ExoDestroyerBeamStart.cs index eed1a3bc8f..d6b5d73769 100644 --- a/Projectiles/Boss/ExoDestroyerBeamStart.cs +++ b/Projectiles/Boss/ExoDestroyerBeamStart.cs @@ -103,7 +103,7 @@ namespace CalamityMod.Projectiles.Boss float arraySize = 3f; Vector2 samplingPoint = projectile.Center; float[] samples = new float[(int)arraySize]; - Collision.LaserScan(samplingPoint, projectile.velocity, projectile.width * projectile.scale, 2400f, samples); + Collision.LaserScan(samplingPoint, projectile.velocity, projectile.width * projectile.scale, 3600f, samples); float laserLength = 0f; for (int i = 0; i < samples.Length; i++) { @@ -113,7 +113,7 @@ namespace CalamityMod.Projectiles.Boss // Fire laser through walls at max length if target cannot be seen if (!Collision.CanHitLine(ThingToAttachTo.Center, 1, 1, Main.player[ThingToAttachTo.target].Center, 1, 1)) - laserLength = 2400f; + laserLength = 3600f; float amount = 0.5f; LengthOfLaser = MathHelper.Lerp(LengthOfLaser, laserLength, amount); diff --git a/Utilities/NPCStats.cs b/Utilities/NPCStats.cs index c438832c01..b1710ab45f 100644 --- a/Utilities/NPCStats.cs +++ b/Utilities/NPCStats.cs @@ -808,7 +808,7 @@ namespace CalamityMod { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 450, 676, 712, 732, 1068 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 528, 556, 572, 834 } }, - // { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 400, 600, 632, 648, 948 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 400, 600, 632, 648, 948 } }, // { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 450, 676, 712, 732, 1068 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 500, 752, 788, 808, 1182 } },