diff --git a/Gores/Ares/AresGaussNuke_Gore1.png b/Gores/Ares/AresGaussNuke1.png similarity index 100% rename from Gores/Ares/AresGaussNuke_Gore1.png rename to Gores/Ares/AresGaussNuke1.png diff --git a/Gores/Ares/AresGaussNuke_Gore2.png b/Gores/Ares/AresGaussNuke2.png similarity index 100% rename from Gores/Ares/AresGaussNuke_Gore2.png rename to Gores/Ares/AresGaussNuke2.png diff --git a/Gores/Ares/AresGaussNuke_Gore3.png b/Gores/Ares/AresGaussNuke3.png similarity index 100% rename from Gores/Ares/AresGaussNuke_Gore3.png rename to Gores/Ares/AresGaussNuke3.png diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index 41ee6b7962..eb17bb4fa2 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -6906,7 +6906,7 @@ namespace CalamityMod.NPCs if (npc.ai[2] == -1f || (!retAlive && npc.ai[3] == secondFastCharge)) num48 *= 1.3f; - Vector2 distanceVector = Main.player[npc.target].Center + (retAlive ? Vector2.Zero : Main.player[npc.target].velocity * 20f) - npc.Center; + Vector2 distanceVector = Main.player[npc.target].Center + (!retAlive && malice ? Main.player[npc.target].velocity * 20f : Vector2.Zero) - npc.Center; npc.velocity = Vector2.Normalize(distanceVector) * num48; if (retAlive) diff --git a/NPCs/ExoMechs/Ares/AresBody.cs b/NPCs/ExoMechs/Ares/AresBody.cs index 67e5f18330..6fbda5b4cb 100644 --- a/NPCs/ExoMechs/Ares/AresBody.cs +++ b/NPCs/ExoMechs/Ares/AresBody.cs @@ -135,7 +135,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares bool expertMode = Main.expertMode || malice; // Spawn arms - /*if (npc.ai[0] == 0f) + if (npc.ai[0] == 0f) { int totalArms = 4; for (int i = 0; i < totalArms; i++) @@ -164,7 +164,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); } npc.ai[0] = 1f; - }*/ + } // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; @@ -257,8 +257,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares AIState = (float)Phase.Normal; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; - npc.frameCounter = 0D; - frameX = frameY = exactFrame = 0; npc.velocity.Y -= 2f; if ((double)npc.position.Y < Main.topWorld + 16f) @@ -478,10 +476,11 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Vector2 spinningPoint = new Vector2(0f, -1f); Vector2 laserSpawnPoint = new Vector2(npc.Center.X, npc.Center.Y); + calamityGlobalNPC.newAI[2] += 1f; if (calamityGlobalNPC.newAI[2] < deathrayTelegraphDuration) { // Fire deathray telegraph beams - if (calamityGlobalNPC.newAI[2] == 0f) + if (calamityGlobalNPC.newAI[2] == 1f) { // Set frames to deathray charge up frames npc.frameCounter = 0D; @@ -525,7 +524,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares calamityGlobalNPC.newAI[3] = 0f; npc.TargetClosest(); } - calamityGlobalNPC.newAI[2] += 1f; } } @@ -549,13 +547,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares npc.frameCounter += 1D; if (AIState == (float)Phase.Normal || npc.Calamity().newAI[3] == 0f) { - // Reset frames from deathray phase - if (exactFrame >= secondStageDeathrayChargeFrameLimit + 1) - { - npc.frameCounter = 0D; - frameX = frameY = exactFrame = 0; - } - if (npc.frameCounter >= 10D) { npc.frameCounter = 0D; @@ -567,7 +558,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares frameY = 0; } if (exactFrame > normalFrameLimit) - frameX = frameY = 0; + frameX = frameY = exactFrame = 0; } } else diff --git a/NPCs/ExoMechs/Ares/AresGaussNuke.cs b/NPCs/ExoMechs/Ares/AresGaussNuke.cs new file mode 100644 index 0000000000..75b8e5cfa8 --- /dev/null +++ b/NPCs/ExoMechs/Ares/AresGaussNuke.cs @@ -0,0 +1,447 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; +using CalamityMod.Items.Potions; +using CalamityMod.NPCs.ExoMechs.Thanatos; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Boss; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.ExoMechs.Ares +{ + //[AutoloadBossHead] + public class AresGaussNuke : ModNPC + { + public enum Phase + { + Nothing = 0, + GaussNuke = 1, + Reload = 2 + } + + public float AIState + { + get => npc.Calamity().newAI[0]; + set => npc.Calamity().newAI[0] = value; + } + + // Number of frames on the X and Y axis + private const int maxFramesX = 9; + private const int maxFramesY = 12; + + // Counters for frames on the X and Y axis + private int frameX = 0; + private int frameY = 0; + + // The exact frame the animation is currently on + private int exactFrame = 0; + + // Frame limit per animation, these are the specific frames where each animation ends + private const int normalFrameLimit = 11; + private const int firstStageGaussNukeChargeFrameLimit = 23; + private const int secondStageGaussNukeChargeFrameLimit = 35; + private const int finalStageGaussNukeChargeFrameLimit = 47; + private const int reloadFrameLimit = 107; + + // Default life ratio for the other mechs + private const float defaultLifeRatio = 5f; + + // Total duration of the gauss nuke telegraph + private const float gaussNukeTelegraphDuration = 360f; + + // Total duration of the gauss nuke firing phase + private const float gaussNukeReloadDuration = 600f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("XF-09 Ares Gauss Nuke"); + } + + public override void SetDefaults() + { + npc.npcSlots = 5f; + npc.damage = 100; + npc.width = 170; + npc.height = 120; + npc.defense = 80; + npc.DR_NERD(0.25f); + npc.LifeMaxNERB(1000000, 1150000, 500000); + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); + npc.aiStyle = -1; + aiType = -1; + npc.Opacity = 0f; + npc.knockBackResist = 0f; + npc.noGravity = true; + npc.noTileCollide = true; + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.netAlways = true; + npc.boss = true; + music = /*CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ??*/ MusicID.Boss3; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.chaseable); + writer.Write(npc.dontTakeDamage); + for (int i = 0; i < 4; i++) + writer.Write(npc.Calamity().newAI[i]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.chaseable = reader.ReadBoolean(); + npc.dontTakeDamage = reader.ReadBoolean(); + for (int i = 0; i < 4; i++) + npc.Calamity().newAI[i] = reader.ReadSingle(); + } + + public override void AI() + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + if (CalamityGlobalNPC.draedonExoMechPrime < 0 || !Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + npc.active = false; + return; + } + + // Difficulty modes + bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || malice; + bool revenge = CalamityWorld.revenge || malice; + bool expertMode = Main.expertMode || malice; + + // Percent life remaining + float lifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechPrime].lifeMax; + + // Check if the other exo mechs are alive + int otherExoMechsAlive = 0; + bool exoWormAlive = false; + bool exoSpazAlive = false; + bool exoRetAlive = false; + if (CalamityGlobalNPC.draedonExoMechWorm != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechWorm].active) + { + otherExoMechsAlive++; + exoWormAlive = true; + } + } + if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active) + { + otherExoMechsAlive++; + exoSpazAlive = true; + } + } + if (CalamityGlobalNPC.draedonExoMechTwinRed != -1) + { + if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].active) + { + otherExoMechsAlive++; + exoRetAlive = true; + } + } + + // These are 5 by default to avoid triggering passive phases after the other mechs are dead + float exoWormLifeRatio = defaultLifeRatio; + float exoSpazLifeRatio = defaultLifeRatio; + float exoRetLifeRatio = defaultLifeRatio; + if (exoWormAlive) + exoWormLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechWorm].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechWorm].lifeMax; + if (exoSpazAlive) + exoSpazLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].lifeMax; + if (exoRetAlive) + exoRetLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].lifeMax; + float totalOtherExoMechLifeRatio = exoWormLifeRatio + exoSpazLifeRatio + exoRetLifeRatio; + + // Phases + bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f); + + // Target variable + Player player = Main.player[Main.npc[CalamityGlobalNPC.draedonExoMechPrime].target]; + + if (npc.ai[0] > 0f) + npc.realLife = (int)npc.ai[0]; + + // Despawn if target is dead + bool targetDead = false; + if (player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (player.dead) + { + targetDead = true; + + AIState = (float)Phase.Nothing; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + + npc.velocity.Y -= 2f; + if ((double)npc.position.Y < Main.topWorld + 16f) + npc.velocity.Y -= 2f; + + /*if ((double)npc.position.Y < Main.topWorld + 16f) + { + for (int a = 0; a < Main.maxNPCs; a++) + { + if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) + Main.npc[a].active = false; + } + }*/ + } + } + + CalamityGlobalNPC calamityGlobalNPC_Body = Main.npc[(int)npc.ai[0]].Calamity(); + + // Adjust opacity + bool invisiblePhase = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune; + npc.dontTakeDamage = invisiblePhase; + if (!invisiblePhase) + { + npc.Opacity += 0.2f; + if (npc.Opacity > 1f) + npc.Opacity = 1f; + } + else + { + npc.Opacity -= 0.05f; + if (npc.Opacity < 0f) + npc.Opacity = 0f; + } + + // Rotate the cannon to look at the target + // npc.rotation = npc.velocity.X * 0.003f; + + // 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); + + // Velocity and acceleration values + float baseVelocityMult = malice ? 1.3f : death ? 1.2f : revenge ? 1.15f : expertMode ? 1.1f : 1f; + float baseVelocity = 15f * baseVelocityMult; + float baseAcceleration = 1f; + if (berserk) + { + baseVelocity *= 1.5f; + baseAcceleration *= 1.5f; + } + Vector2 desiredVelocity = Vector2.Normalize(destination - npc.Center) * baseVelocity; + + // Distance from target + float distanceFromTarget = Vector2.Distance(npc.Center, player.Center); + + // Gate values + float gaussNukePhaseGateValue = 600f; + + // Variable to disable deathray firing + bool doNotFire = calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays || calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune; + if (doNotFire) + { + AIState = (float)Phase.Nothing; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + } + + // Attacking phases + switch ((int)AIState) + { + // Do nothing, rotate to aim at the target and fly in place + case (int)Phase.Nothing: + + if (!targetDead) + npc.SimpleFlyMovement(desiredVelocity, baseAcceleration); + + calamityGlobalNPC.newAI[1] += 1f; + if (calamityGlobalNPC.newAI[1] >= gaussNukePhaseGateValue) + { + AIState = (float)Phase.GaussNuke; + calamityGlobalNPC.newAI[1] = 0f; + } + + break; + + // Fire gauss nuke that emits a wave pounder stealth strike-size explosion on death + case (int)Phase.GaussNuke: + + if (!targetDead) + { + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] < gaussNukeTelegraphDuration) + { + if (calamityGlobalNPC.newAI[2] == 1f) + { + // Set frames to gauss nuke charge up frames + npc.frameCounter = 0D; + frameX = 1; + frameY = 0; + exactFrame = 12; + } + + // Fire gauss nuke on frame 41 + if (exactFrame == 41 && calamityGlobalNPC.newAI[1] == 0f) + { + calamityGlobalNPC.newAI[1] = 1f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + /*int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type);*/ + } + } + } + else + { + AIState = (float)Phase.Reload; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + + // Set frames to gauss nuke reload frames + npc.frameCounter = 0D; + frameX = 4; + frameY = 0; + exactFrame = 48; + } + } + + break; + + case (int)Phase.Reload: + + calamityGlobalNPC.newAI[2] += 1f; + if (calamityGlobalNPC.newAI[2] >= gaussNukeReloadDuration) + { + AIState = (float)Phase.Nothing; + calamityGlobalNPC.newAI[2] = 0f; + npc.TargetClosest(); + } + + break; + } + } + + public override bool CanHitPlayer(Player target, ref int cooldownSlot) => false; + + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) => !CalamityUtils.AntiButcher(npc, ref damage, 0.5f); + + public override void FindFrame(int frameHeight) + { + // Use telegraph frames when using gauss nuke + npc.frameCounter += 1D; + if (AIState == (float)Phase.Nothing) + { + if (npc.frameCounter >= 10D) + { + npc.frameCounter = 0D; + frameY++; + exactFrame++; + if (frameY == maxFramesY) + { + frameX++; + frameY = 0; + } + if (exactFrame > normalFrameLimit) + frameX = frameY = exactFrame = 0; + } + } + else + { + if (npc.frameCounter >= 10D) + { + npc.frameCounter = 0D; + frameY++; + exactFrame++; + if (frameY == maxFramesY) + { + frameX++; + frameY = 0; + } + if (exactFrame > reloadFrameLimit) + frameX = frameY = exactFrame = 0; + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + { + Texture2D texture = Main.npcTexture[npc.type]; + Rectangle frame = new Rectangle(npc.width * frameX, npc.height * frameY, npc.width, npc.height); + Vector2 vector = new Vector2(npc.width / 2, npc.height / 2); + Vector2 center = npc.Center - Main.screenPosition; + spriteBatch.Draw(texture, center, frame, npc.GetAlpha(drawColor), npc.rotation, vector, npc.scale, SpriteEffects.None, 0f); + + texture = ModContent.GetTexture("CalamityMod/NPCs/ExoMechs/Ares/AresGaussNukeGlow"); + spriteBatch.Draw(texture, center, frame, Color.White * npc.Opacity, npc.rotation, vector, npc.scale, SpriteEffects.None, 0f); + + return false; + } + + public override void BossLoot(ref string name, ref int potionType) + { + potionType = ModContent.ItemType(); + } + + // Needs edits + public override void NPCLoot() + { + /*DropHelper.DropItem(npc, ModContent.ItemType(), 80, 100); + DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(npc, ModContent.ItemType()); + + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas, 1, 50, 108); + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedCalamitas && Main.expertMode, 2, 15, 27); + DropHelper.DropItemCondition(npc, ItemID.Ectoplasm, NPC.downedPlantBoss, 1, 21, 32);*/ + } + + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 3; k++) + Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f); + + if (npc.life <= 0) + { + for (int num193 = 0; num193 < 2; num193++) + { + Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + } + for (int num194 = 0; num194 < 20; num194++) + { + int num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f); + Main.dust[num195].noGravity = true; + Main.dust[num195].velocity *= 3f; + num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f); + Main.dust[num195].velocity *= 2f; + Main.dust[num195].noGravity = true; + } + + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresGaussNuke1"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresGaussNuke2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresGaussNuke3"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresHandBase1"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresHandBase2"), 1f); + Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Ares/AresHandBase3"), 1f); + } + } + + public override bool CheckActive() => false; + + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + npc.damage = (int)(npc.damage * 0.8f); + } + } +} diff --git a/NPCs/ExoMechs/Ares/AresLaserCannon.cs b/NPCs/ExoMechs/Ares/AresLaserCannon.cs index 5e8b9bcb88..91d5f9ae02 100644 --- a/NPCs/ExoMechs/Ares/AresLaserCannon.cs +++ b/NPCs/ExoMechs/Ares/AresLaserCannon.cs @@ -188,8 +188,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares AIState = (float)Phase.Nothing; calamityGlobalNPC.newAI[1] = 0f; calamityGlobalNPC.newAI[2] = 0f; - npc.frameCounter = 0D; - frameX = frameY = exactFrame = 0; npc.velocity.Y -= 2f; if ((double)npc.position.Y < Main.topWorld + 16f) @@ -258,8 +256,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares AIState = (float)Phase.Nothing; calamityGlobalNPC.newAI[1] = 0f; calamityGlobalNPC.newAI[2] = 0f; - npc.frameCounter = 0D; - frameX = frameY = exactFrame = 0; } // Attacking phases @@ -285,13 +281,14 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (!targetDead) { + calamityGlobalNPC.newAI[2] += 1f; if (calamityGlobalNPC.newAI[2] < deathrayTelegraphDuration) { // Reduce velocity for 15 frames once charging is nearly complete if (calamityGlobalNPC.newAI[2] >= deathrayTelegraphDuration - deathrayDecelerationTime) npc.velocity *= deathrayPhaseVelocityMult; - if (calamityGlobalNPC.newAI[2] == 0f) + if (calamityGlobalNPC.newAI[2] == 1f) { // Set frames to deathray charge up frames npc.frameCounter = 0D; @@ -332,7 +329,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares calamityGlobalNPC.newAI[2] = 0f; npc.TargetClosest(); } - calamityGlobalNPC.newAI[2] += 1f; } break; @@ -349,13 +345,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares npc.frameCounter += 1D; if (AIState == (float)Phase.Nothing) { - // Reset frames from deathray phase - if (exactFrame >= secondStageDeathrayChargeFrameLimit + 1) - { - npc.frameCounter = 0D; - frameX = frameY = exactFrame = 0; - } - if (npc.frameCounter >= 10D) { npc.frameCounter = 0D; @@ -367,7 +356,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares frameY = 0; } if (exactFrame > normalFrameLimit) - frameX = frameY = 0; + frameX = frameY = exactFrame = 0; } } else diff --git a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs index 1e97a70496..c0b77e8258 100644 --- a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs +++ b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs @@ -188,8 +188,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares AIState = (float)Phase.Nothing; calamityGlobalNPC.newAI[1] = 0f; calamityGlobalNPC.newAI[2] = 0f; - npc.frameCounter = 0D; - frameX = frameY = exactFrame = 0; npc.velocity.Y -= 2f; if ((double)npc.position.Y < Main.topWorld + 16f) @@ -255,8 +253,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares AIState = (float)Phase.Nothing; calamityGlobalNPC.newAI[1] = 0f; calamityGlobalNPC.newAI[2] = 0f; - npc.frameCounter = 0D; - frameX = frameY = exactFrame = 0; } // Attacking phases @@ -282,9 +278,10 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (!targetDead) { + calamityGlobalNPC.newAI[2] += 1f; if (calamityGlobalNPC.newAI[2] < plasmaBoltTelegraphDuration) { - if (calamityGlobalNPC.newAI[2] == 0f) + if (calamityGlobalNPC.newAI[2] == 1f) { // Set frames to plasma bolt charge up frames npc.frameCounter = 0D; @@ -315,7 +312,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares calamityGlobalNPC.newAI[2] = 0f; npc.TargetClosest(); } - calamityGlobalNPC.newAI[2] += 1f; } break; @@ -332,13 +328,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares npc.frameCounter += 1D; if (AIState == (float)Phase.Nothing) { - // Reset frames from plasma bolt phase - if (exactFrame >= secondStagePlasmaBoltChargeFrameLimit + 1) - { - npc.frameCounter = 0D; - frameX = frameY = exactFrame = 0; - } - if (npc.frameCounter >= 10D) { npc.frameCounter = 0D; @@ -350,7 +339,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares frameY = 0; } if (exactFrame > normalFrameLimit) - frameX = frameY = 0; + frameX = frameY = exactFrame = 0; } } else diff --git a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs index 67b2b9b484..8ed4abbb2f 100644 --- a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs +++ b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs @@ -188,8 +188,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares AIState = (float)Phase.Nothing; calamityGlobalNPC.newAI[1] = 0f; calamityGlobalNPC.newAI[2] = 0f; - npc.frameCounter = 0D; - frameX = frameY = exactFrame = 0; npc.velocity.Y -= 2f; if ((double)npc.position.Y < Main.topWorld + 16f) @@ -255,8 +253,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares AIState = (float)Phase.Nothing; calamityGlobalNPC.newAI[1] = 0f; calamityGlobalNPC.newAI[2] = 0f; - npc.frameCounter = 0D; - frameX = frameY = exactFrame = 0; } // Attacking phases @@ -282,9 +278,10 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (!targetDead) { + calamityGlobalNPC.newAI[2] += 1f; if (calamityGlobalNPC.newAI[2] < teslaOrbTelegraphDuration) { - if (calamityGlobalNPC.newAI[2] == 0f) + if (calamityGlobalNPC.newAI[2] == 1f) { // Set frames to tesla orb charge up frames npc.frameCounter = 0D; @@ -315,7 +312,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares calamityGlobalNPC.newAI[2] = 0f; npc.TargetClosest(); } - calamityGlobalNPC.newAI[2] += 1f; } break; @@ -332,13 +328,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares npc.frameCounter += 1D; if (AIState == (float)Phase.Nothing) { - // Reset frames from tesla orb phase - if (exactFrame >= secondStageTeslaOrbChargeFrameLimit + 1) - { - npc.frameCounter = 0D; - frameX = frameY = exactFrame = 0; - } - if (npc.frameCounter >= 10D) { npc.frameCounter = 0D; @@ -350,7 +339,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares frameY = 0; } if (exactFrame > normalFrameLimit) - frameX = frameY = 0; + frameX = frameY = exactFrame = 0; } } else diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs index d989cebeed..d509eac569 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs @@ -430,7 +430,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { if (npc.Calamity().newAI[1] == 0f && npc.Calamity().newAI[0] > 0f) { - if (npc.frameCounter >= 12D) + if (npc.frameCounter >= 10D) { npc.frame.Y += frameHeight; npc.frameCounter = 0D; @@ -441,7 +441,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } else { - if (npc.frameCounter >= 12D) + if (npc.frameCounter >= 10D) { npc.frame.Y -= frameHeight; npc.frameCounter = 0D; @@ -452,7 +452,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } else { - if (npc.frameCounter >= 12D) + if (npc.frameCounter >= 10D) { npc.frame.Y -= frameHeight; npc.frameCounter = 0D; diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs index fb915425da..604b0215e0 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs @@ -430,7 +430,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { if (npc.Calamity().newAI[1] == 0f && npc.Calamity().newAI[0] > 0f) { - if (npc.frameCounter >= 12D) + if (npc.frameCounter >= 10D) { npc.frame.Y += frameHeight; npc.frameCounter = 0D; @@ -441,7 +441,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } else { - if (npc.frameCounter >= 12D) + if (npc.frameCounter >= 10D) { npc.frame.Y -= frameHeight; npc.frameCounter = 0D; @@ -452,7 +452,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } else { - if (npc.frameCounter >= 12D) + if (npc.frameCounter >= 10D) { npc.frame.Y -= frameHeight; npc.frameCounter = 0D; diff --git a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs index dfc528dba1..487cf8952f 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs @@ -677,10 +677,11 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos baseVelocity *= velocityScale; turnSpeed *= velocityScale; + calamityGlobalNPC.newAI[2] += 1f; if (calamityGlobalNPC.newAI[2] < deathrayTelegraphDuration) { // Fire deathray telegraph beams - if (calamityGlobalNPC.newAI[2] == 0f) + if (calamityGlobalNPC.newAI[2] == 1f) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -730,7 +731,6 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos chargeVelocityScalar = 0f; npc.TargetClosest(); } - calamityGlobalNPC.newAI[2] += 1f; } break; @@ -833,7 +833,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos npc.frameCounter += 1D; if (AIState == (float)Phase.Charge || AIState == (float)Phase.UndergroundLaserBarrage) { - if (npc.frameCounter >= 12D) + if (npc.frameCounter >= 10D) { npc.frame.Y -= frameHeight; npc.frameCounter = 0D; @@ -843,7 +843,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } else { - if (npc.frameCounter >= 12D) + if (npc.frameCounter >= 10D) { npc.frame.Y += frameHeight; npc.frameCounter = 0D; diff --git a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs index 333db2cead..71025e4eab 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs @@ -429,7 +429,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { if (npc.Calamity().newAI[1] == 0f && npc.Calamity().newAI[0] > 0f) { - if (npc.frameCounter >= 12D) + if (npc.frameCounter >= 10D) { npc.frame.Y += frameHeight; npc.frameCounter = 0D; @@ -440,7 +440,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } else { - if (npc.frameCounter >= 12D) + if (npc.frameCounter >= 10D) { npc.frame.Y -= frameHeight; npc.frameCounter = 0D; @@ -451,7 +451,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } else { - if (npc.frameCounter >= 12D) + if (npc.frameCounter >= 10D) { npc.frame.Y -= frameHeight; npc.frameCounter = 0D;