From f46eed9cc4601c2ebc2c2508b64ac002e1bd9d0e Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Sat, 4 Sep 2021 20:37:43 -0500 Subject: [PATCH] 1 - Nebulous Core tooltip updated, will add revive effect later. 2 - Afterimages for Apollo, Artemis and Ares. 3 - Circular hitboxes for Apollo and Artemis. 4 - T Hanos fixes. 5 - Storm Weaver lightning orb spawns are more predictable and less random. --- Items/Accessories/NebulousCore.cs | 14 ++--- NPCs/ExoMechs/Apollo/Apollo.cs | 56 +++++++++++++++++++ NPCs/ExoMechs/Ares/AresBody.cs | 34 ++++++++++++ NPCs/ExoMechs/Ares/AresGaussNuke.cs | 34 ++++++++++++ NPCs/ExoMechs/Ares/AresLaserCannon.cs | 34 ++++++++++++ NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs | 34 ++++++++++++ NPCs/ExoMechs/Ares/AresTeslaCannon.cs | 34 ++++++++++++ NPCs/ExoMechs/Artemis/Artemis.cs | 57 ++++++++++++++++++++ NPCs/ExoMechs/Thanatos/ThanatosBody1.cs | 29 ++++++---- NPCs/ExoMechs/Thanatos/ThanatosBody2.cs | 29 ++++++---- NPCs/ExoMechs/Thanatos/ThanatosHead.cs | 5 ++ NPCs/ExoMechs/Thanatos/ThanatosTail.cs | 29 ++++++---- NPCs/StormWeaver/StormWeaverHead.cs | 5 +- NPCs/StormWeaver/StormWeaverHeadNaked.cs | 6 +-- 14 files changed, 354 insertions(+), 46 deletions(-) diff --git a/Items/Accessories/NebulousCore.cs b/Items/Accessories/NebulousCore.cs index cfb8b3aba2..449f96c02d 100644 --- a/Items/Accessories/NebulousCore.cs +++ b/Items/Accessories/NebulousCore.cs @@ -12,10 +12,10 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { DisplayName.SetDefault("Nebulous Core"); - Tooltip.SetDefault("12% increased damage\n" + + Tooltip.SetDefault("10% increased damage\n" + "Summons floating nebula stars to protect you\n" + - "You have a 10% chance to survive an attack that would have killed you\n" + - "If this effect activates you will be healed by 100 HP"); + "You will survive an attack that would have killed you and be healed 100 HP\n" + + "This effect has a 90 second cooldown"); } public override void SetDefaults() @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Accessories public override void Update(ref float gravity, ref float maxFallSpeed) { - float num = (float)Main.rand.Next(90, 111) * 0.01f; + float num = Main.rand.Next(90, 111) * 0.01f; num *= Main.essScale; Lighting.AddLight((int)((item.position.X + (float)(item.width / 2)) / 16f), (int)((item.position.Y + (float)(item.height / 2)) / 16f), 0.35f * num, 0.05f * num, 0.35f * num); } @@ -39,8 +39,8 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.nCore = true; - player.allDamage += 0.12f; - int damage = (int)(750 * player.AverageDamage()); + player.allDamage += 0.1f; + int damage = (int)(500 * player.AverageDamage()); float knockBack = 3f; if (Main.rand.NextBool(15)) { @@ -99,7 +99,7 @@ namespace CalamityMod.Items.Accessories } if (flag && Main.myPlayer == player.whoAmI) { - Projectile.NewProjectile(center.X, center.Y, 0f, 0f, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(center.X, center.Y, 0f, 0f, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); return; } } diff --git a/NPCs/ExoMechs/Apollo/Apollo.cs b/NPCs/ExoMechs/Apollo/Apollo.cs index a033ce2ba1..b6463e2556 100644 --- a/NPCs/ExoMechs/Apollo/Apollo.cs +++ b/NPCs/ExoMechs/Apollo/Apollo.cs @@ -555,6 +555,28 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo }*/ } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + + Rectangle targetHitbox = target.Hitbox; + + float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight()); + + float minDist = dist1; + if (dist2 < minDist) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; + + return minDist <= 100f && npc.Opacity == 1f; + } + 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 bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -619,10 +641,44 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo 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); + Color afterimageBaseColor = Color.White; + int numAfterimages = 5; + + if (CalamityConfig.Instance.Afterimages) + { + for (int i = 1; i < numAfterimages; i += 2) + { + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, afterimageBaseColor, 0.5f); + afterimageColor = npc.GetAlpha(afterimageColor); + afterimageColor *= (numAfterimages - i) / 15f; + Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + afterimageCenter -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); + spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.rotation, vector, npc.scale, SpriteEffects.None, 0f); + } + } + 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/Apollo/ApolloGlow"); + + if (CalamityConfig.Instance.Afterimages) + { + for (int i = 1; i < numAfterimages; i += 2) + { + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, afterimageBaseColor, 0.5f); + afterimageColor = npc.GetAlpha(afterimageColor); + afterimageColor *= (numAfterimages - i) / 15f; + Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + afterimageCenter -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); + spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.rotation, vector, npc.scale, SpriteEffects.None, 0f); + } + } + spriteBatch.Draw(texture, center, frame, Color.White * npc.Opacity, npc.rotation, vector, npc.scale, SpriteEffects.None, 0f); return false; diff --git a/NPCs/ExoMechs/Ares/AresBody.cs b/NPCs/ExoMechs/Ares/AresBody.cs index 24eb0611fc..d657c7215a 100644 --- a/NPCs/ExoMechs/Ares/AresBody.cs +++ b/NPCs/ExoMechs/Ares/AresBody.cs @@ -637,10 +637,44 @@ namespace CalamityMod.NPCs.ExoMechs.Ares 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); + Color afterimageBaseColor = Color.White; + int numAfterimages = 5; + + if (CalamityConfig.Instance.Afterimages) + { + for (int i = 1; i < numAfterimages; i += 2) + { + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, afterimageBaseColor, 0.5f); + afterimageColor = npc.GetAlpha(afterimageColor); + afterimageColor *= (numAfterimages - i) / 15f; + Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + afterimageCenter -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); + spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.rotation, vector, npc.scale, SpriteEffects.None, 0f); + } + } + 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/AresBodyGlow"); + + if (CalamityConfig.Instance.Afterimages) + { + for (int i = 1; i < numAfterimages; i += 2) + { + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, afterimageBaseColor, 0.5f); + afterimageColor = npc.GetAlpha(afterimageColor); + afterimageColor *= (numAfterimages - i) / 15f; + Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + afterimageCenter -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); + spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.rotation, vector, npc.scale, SpriteEffects.None, 0f); + } + } + spriteBatch.Draw(texture, center, frame, Color.White * npc.Opacity, npc.rotation, vector, npc.scale, SpriteEffects.None, 0f); return false; diff --git a/NPCs/ExoMechs/Ares/AresGaussNuke.cs b/NPCs/ExoMechs/Ares/AresGaussNuke.cs index 1ef97be59d..2ddaf5ee00 100644 --- a/NPCs/ExoMechs/Ares/AresGaussNuke.cs +++ b/NPCs/ExoMechs/Ares/AresGaussNuke.cs @@ -443,10 +443,44 @@ namespace CalamityMod.NPCs.ExoMechs.Ares 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); + Color afterimageBaseColor = Color.White; + int numAfterimages = 5; + + if (CalamityConfig.Instance.Afterimages) + { + for (int i = 1; i < numAfterimages; i += 2) + { + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, afterimageBaseColor, 0.5f); + afterimageColor = npc.GetAlpha(afterimageColor); + afterimageColor *= (numAfterimages - i) / 15f; + Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + afterimageCenter -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); + spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.rotation, vector, npc.scale, spriteEffects, 0f); + } + } + Vector2 center = npc.Center - Main.screenPosition; spriteBatch.Draw(texture, center, frame, npc.GetAlpha(drawColor), npc.rotation, vector, npc.scale, spriteEffects, 0f); texture = ModContent.GetTexture("CalamityMod/NPCs/ExoMechs/Ares/AresGaussNukeGlow"); + + if (CalamityConfig.Instance.Afterimages) + { + for (int i = 1; i < numAfterimages; i += 2) + { + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, afterimageBaseColor, 0.5f); + afterimageColor = npc.GetAlpha(afterimageColor); + afterimageColor *= (numAfterimages - i) / 15f; + Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + afterimageCenter -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); + spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.rotation, vector, npc.scale, spriteEffects, 0f); + } + } + spriteBatch.Draw(texture, center, frame, Color.White * npc.Opacity, npc.rotation, vector, npc.scale, spriteEffects, 0f); return false; diff --git a/NPCs/ExoMechs/Ares/AresLaserCannon.cs b/NPCs/ExoMechs/Ares/AresLaserCannon.cs index a90d71f420..22361bdb86 100644 --- a/NPCs/ExoMechs/Ares/AresLaserCannon.cs +++ b/NPCs/ExoMechs/Ares/AresLaserCannon.cs @@ -501,10 +501,44 @@ namespace CalamityMod.NPCs.ExoMechs.Ares 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); + Color afterimageBaseColor = Color.White; + int numAfterimages = 5; + + if (CalamityConfig.Instance.Afterimages) + { + for (int i = 1; i < numAfterimages; i += 2) + { + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, afterimageBaseColor, 0.5f); + afterimageColor = npc.GetAlpha(afterimageColor); + afterimageColor *= (numAfterimages - i) / 15f; + Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + afterimageCenter -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); + spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.rotation, vector, npc.scale, spriteEffects, 0f); + } + } + Vector2 center = npc.Center - Main.screenPosition; spriteBatch.Draw(texture, center, frame, npc.GetAlpha(drawColor), npc.rotation, vector, npc.scale, spriteEffects, 0f); texture = ModContent.GetTexture("CalamityMod/NPCs/ExoMechs/Ares/AresLaserCannonGlow"); + + if (CalamityConfig.Instance.Afterimages) + { + for (int i = 1; i < numAfterimages; i += 2) + { + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, afterimageBaseColor, 0.5f); + afterimageColor = npc.GetAlpha(afterimageColor); + afterimageColor *= (numAfterimages - i) / 15f; + Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + afterimageCenter -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); + spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.rotation, vector, npc.scale, spriteEffects, 0f); + } + } + spriteBatch.Draw(texture, center, frame, Color.White * npc.Opacity, npc.rotation, vector, npc.scale, spriteEffects, 0f); return false; diff --git a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs index 20dfd7a411..95877e4150 100644 --- a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs +++ b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs @@ -421,10 +421,44 @@ namespace CalamityMod.NPCs.ExoMechs.Ares 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); + Color afterimageBaseColor = Color.White; + int numAfterimages = 5; + + if (CalamityConfig.Instance.Afterimages) + { + for (int i = 1; i < numAfterimages; i += 2) + { + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, afterimageBaseColor, 0.5f); + afterimageColor = npc.GetAlpha(afterimageColor); + afterimageColor *= (numAfterimages - i) / 15f; + Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + afterimageCenter -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); + spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.rotation, vector, npc.scale, spriteEffects, 0f); + } + } + Vector2 center = npc.Center - Main.screenPosition; spriteBatch.Draw(texture, center, frame, npc.GetAlpha(drawColor), npc.rotation, vector, npc.scale, spriteEffects, 0f); texture = ModContent.GetTexture("CalamityMod/NPCs/ExoMechs/Ares/AresPlasmaFlamethrowerGlow"); + + if (CalamityConfig.Instance.Afterimages) + { + for (int i = 1; i < numAfterimages; i += 2) + { + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, afterimageBaseColor, 0.5f); + afterimageColor = npc.GetAlpha(afterimageColor); + afterimageColor *= (numAfterimages - i) / 15f; + Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + afterimageCenter -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); + spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.rotation, vector, npc.scale, spriteEffects, 0f); + } + } + spriteBatch.Draw(texture, center, frame, Color.White * npc.Opacity, npc.rotation, vector, npc.scale, spriteEffects, 0f); return false; diff --git a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs index 8b9d847609..cbd391108d 100644 --- a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs +++ b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs @@ -422,10 +422,44 @@ namespace CalamityMod.NPCs.ExoMechs.Ares 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); + Color afterimageBaseColor = Color.White; + int numAfterimages = 5; + + if (CalamityConfig.Instance.Afterimages) + { + for (int i = 1; i < numAfterimages; i += 2) + { + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, afterimageBaseColor, 0.5f); + afterimageColor = npc.GetAlpha(afterimageColor); + afterimageColor *= (numAfterimages - i) / 15f; + Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + afterimageCenter -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); + spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.rotation, vector, npc.scale, spriteEffects, 0f); + } + } + Vector2 center = npc.Center - Main.screenPosition; spriteBatch.Draw(texture, center, frame, npc.GetAlpha(drawColor), npc.rotation, vector, npc.scale, spriteEffects, 0f); texture = ModContent.GetTexture("CalamityMod/NPCs/ExoMechs/Ares/AresTeslaCannonGlow"); + + if (CalamityConfig.Instance.Afterimages) + { + for (int i = 1; i < numAfterimages; i += 2) + { + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, afterimageBaseColor, 0.5f); + afterimageColor = npc.GetAlpha(afterimageColor); + afterimageColor *= (numAfterimages - i) / 15f; + Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + afterimageCenter -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); + spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.rotation, vector, npc.scale, spriteEffects, 0f); + } + } + spriteBatch.Draw(texture, center, frame, Color.White * npc.Opacity, npc.rotation, vector, npc.scale, spriteEffects, 0f); return false; diff --git a/NPCs/ExoMechs/Artemis/Artemis.cs b/NPCs/ExoMechs/Artemis/Artemis.cs index c0e62e2820..9d711ba250 100644 --- a/NPCs/ExoMechs/Artemis/Artemis.cs +++ b/NPCs/ExoMechs/Artemis/Artemis.cs @@ -813,6 +813,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // 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(rotationVector); Vector2 offset = goreVelocity * 70f; Gore.NewGore(npc.Center + offset, goreVelocity * 24f, mod.GetGoreSlot("Gores/Artemis/ArtemisTransitionGore"), 1f); @@ -832,6 +833,28 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis } } + public override bool CanHitPlayer(Player target, ref int cooldownSlot) + { + cooldownSlot = 1; + + Rectangle targetHitbox = target.Hitbox; + + float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight()); + + float minDist = dist1; + if (dist2 < minDist) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; + + return minDist <= 100f && npc.Opacity == 1f; + } + 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 bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -919,10 +942,44 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis 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); + Color afterimageBaseColor = Color.White; + int numAfterimages = 5; + + if (CalamityConfig.Instance.Afterimages) + { + for (int i = 1; i < numAfterimages; i += 2) + { + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, afterimageBaseColor, 0.5f); + afterimageColor = npc.GetAlpha(afterimageColor); + afterimageColor *= (numAfterimages - i) / 15f; + Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + afterimageCenter -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); + spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.rotation, vector, npc.scale, SpriteEffects.None, 0f); + } + } + 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/Artemis/ArtemisGlow"); + + if (CalamityConfig.Instance.Afterimages) + { + for (int i = 1; i < numAfterimages; i += 2) + { + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, afterimageBaseColor, 0.5f); + afterimageColor = npc.GetAlpha(afterimageColor); + afterimageColor *= (numAfterimages - i) / 15f; + Vector2 afterimageCenter = npc.oldPos[i] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + afterimageCenter -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + afterimageCenter += vector * npc.scale + new Vector2(0f, npc.gfxOffY); + spriteBatch.Draw(texture, afterimageCenter, npc.frame, afterimageColor, npc.rotation, vector, npc.scale, SpriteEffects.None, 0f); + } + } + spriteBatch.Draw(texture, center, frame, Color.White * npc.Opacity, npc.rotation, vector, npc.scale, SpriteEffects.None, 0f); return false; diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs index fe8266beeb..e21075a414 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs @@ -143,9 +143,16 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos npc.Opacity = 0f; } + // Number of body segments + int numSegments = ThanatosHead.minLength; + // Set timer to whoAmI so that segments don't all fire lasers at the same time if (npc.localAI[2] == 0f) + { npc.localAI[2] = npc.ai[0]; + if (npc.localAI[2] > numSegments) + npc.localAI[2] -= numSegments; + } // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; @@ -175,11 +182,10 @@ 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; if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge && !berserk) { float divisor = 120f; - int numSegments = ThanatosHead.minLength; - double numSegmentsAbleToFire = malice ? 30D : death ? 20D : revenge ? 17.5 : expertMode ? 15D : 10D; float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire); if ((npc.ai[3] % divisor == 0f && npc.localAI[2] % segmentDivisor == 0f) || npc.Calamity().newAI[0] > 0f) { @@ -191,6 +197,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos npc.Calamity().newAI[0] += 1f; if (npc.Calamity().newAI[0] >= 72f) { + npc.ai[3] = 0f; npc.Calamity().newAI[1] = 1f; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -243,15 +250,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos else { // This is only used in deathray phase to prevent laser spam - int numSegments = ThanatosHead.minLength; - double numSegmentsAbleToFire = 5D; - float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire); - - npc.ai[3] += 1f; - float shootProjectile = 120f; - float timer = npc.ai[0] + 15f; - float divisor = timer + shootProjectile; - if ((npc.ai[3] % divisor == 0f && (npc.localAI[2] % segmentDivisor == 0f || !berserk)) || npc.Calamity().newAI[0] > 0f) + float segmentDivisor = (float)Math.Round(numSegments / (berserk ? 5D : 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) { // Body is vulnerable while firing lasers vulnerable = true; @@ -261,6 +262,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos npc.Calamity().newAI[0] += 1f; if (npc.Calamity().newAI[0] >= 72f) { + npc.ai[3] = 0f; npc.Calamity().newAI[1] = 1f; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -333,12 +335,17 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } else { + if (npc.ai[3] > 0f) + npc.ai[3] = 0f; + // Set alternating laser-firing body segments every 3 seconds npc.localAI[1] += 1f; if (npc.localAI[1] >= 180f) { npc.localAI[1] = 0f; npc.localAI[2] += 1f; + if (npc.localAI[2] > numSegments) + npc.localAI[2] -= numSegments; } npc.Calamity().newAI[0] -= 1f; diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs index 48b7893c8c..b22afe9608 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs @@ -143,9 +143,16 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos npc.Opacity = 0f; } + // Number of body segments + int numSegments = ThanatosHead.minLength; + // Set timer to whoAmI so that segments don't all fire lasers at the same time if (npc.localAI[2] == 0f) + { npc.localAI[2] = npc.ai[0]; + if (npc.localAI[2] > numSegments) + npc.localAI[2] -= numSegments; + } // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; @@ -175,11 +182,10 @@ 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; if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge && !berserk) { float divisor = 120f; - int numSegments = ThanatosHead.minLength; - double numSegmentsAbleToFire = malice ? 30D : death ? 20D : revenge ? 17.5 : expertMode ? 15D : 10D; float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire); if ((npc.ai[3] % divisor == 0f && npc.localAI[2] % segmentDivisor == 0f) || npc.Calamity().newAI[0] > 0f) { @@ -191,6 +197,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos npc.Calamity().newAI[0] += 1f; if (npc.Calamity().newAI[0] >= 72f) { + npc.ai[3] = 0f; npc.Calamity().newAI[1] = 1f; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -243,15 +250,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos else { // This is only used in deathray phase to prevent laser spam - int numSegments = ThanatosHead.minLength; - double numSegmentsAbleToFire = 5D; - float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire); - - npc.ai[3] += 1f; - float shootProjectile = 120f; - float timer = npc.ai[0] + 15f; - float divisor = timer + shootProjectile; - if ((npc.ai[3] % divisor == 0f && (npc.localAI[2] % segmentDivisor == 0f || !berserk)) || npc.Calamity().newAI[0] > 0f) + float segmentDivisor = (float)Math.Round(numSegments / (berserk ? 5D : 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) { // Body is vulnerable while firing lasers vulnerable = true; @@ -261,6 +262,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos npc.Calamity().newAI[0] += 1f; if (npc.Calamity().newAI[0] >= 72f) { + npc.ai[3] = 0f; npc.Calamity().newAI[1] = 1f; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -333,12 +335,17 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } else { + if (npc.ai[3] > 0f) + npc.ai[3] = 0f; + // Set alternating laser-firing body segments every 3 seconds npc.localAI[1] += 1f; if (npc.localAI[1] >= 180f) { npc.localAI[1] = 0f; npc.localAI[2] += 1f; + if (npc.localAI[2] > numSegments) + npc.localAI[2] -= numSegments; } npc.Calamity().newAI[0] -= 1f; diff --git a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs index 19aad7eda9..cd70e67d60 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs @@ -374,6 +374,11 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos baseVelocity *= 1.5f; turnDegrees *= 1.5f; } + + // Increase top velocity if target is dead + if (targetDead) + baseVelocity *= 4f; + float turnSpeed = MathHelper.ToRadians(turnDegrees); float chargeVelocityMult = MathHelper.Lerp(1f, 1.5f, chargeVelocityScalar); float chargeTurnSpeedMult = MathHelper.Lerp(1f, 1.5f, chargeVelocityScalar); diff --git a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs index 9e8e253f27..89bfba078c 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs @@ -142,9 +142,16 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos npc.Opacity = 0f; } + // Number of body segments + int numSegments = ThanatosHead.minLength; + // Set timer to whoAmI so that segments don't all fire lasers at the same time if (npc.localAI[2] == 0f) + { npc.localAI[2] = npc.ai[0]; + if (npc.localAI[2] > numSegments) + npc.localAI[2] -= numSegments; + } // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; @@ -174,11 +181,10 @@ 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; if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge && !berserk) { float divisor = 120f; - int numSegments = ThanatosHead.minLength; - double numSegmentsAbleToFire = malice ? 30D : death ? 20D : revenge ? 17.5 : expertMode ? 15D : 10D; float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire); if ((npc.ai[3] % divisor == 0f && npc.localAI[2] % segmentDivisor == 0f) || npc.Calamity().newAI[0] > 0f) { @@ -190,6 +196,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos npc.Calamity().newAI[0] += 1f; if (npc.Calamity().newAI[0] >= 72f) { + npc.ai[3] = 0f; npc.Calamity().newAI[1] = 1f; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -242,15 +249,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos else { // This is only used in deathray phase to prevent laser spam - int numSegments = ThanatosHead.minLength; - double numSegmentsAbleToFire = 5D; - float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire); - - npc.ai[3] += 1f; - float shootProjectile = 120f; - float timer = npc.ai[0] + 15f; - float divisor = timer + shootProjectile; - if ((npc.ai[3] % divisor == 0f && (npc.localAI[2] % segmentDivisor == 0f || !berserk)) || npc.Calamity().newAI[0] > 0f) + float segmentDivisor = (float)Math.Round(numSegments / (berserk ? 5D : 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) { // Body is vulnerable while firing lasers vulnerable = true; @@ -260,6 +261,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos npc.Calamity().newAI[0] += 1f; if (npc.Calamity().newAI[0] >= 72f) { + npc.ai[3] = 0f; npc.Calamity().newAI[1] = 1f; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -332,12 +334,17 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } else { + if (npc.ai[3] > 0f) + npc.ai[3] = 0f; + // Set alternating laser-firing body segments every 3 seconds npc.localAI[1] += 1f; if (npc.localAI[1] >= 180f) { npc.localAI[1] = 0f; npc.localAI[2] += 1f; + if (npc.localAI[2] > numSegments) + npc.localAI[2] -= numSegments; } npc.Calamity().newAI[0] -= 1f; diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index 5a511afc44..b075dab50f 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -152,8 +152,9 @@ namespace CalamityMod.NPCs.StormWeaver npc.localAI[0] = 0f; npc.TargetClosest(); npc.netUpdate = true; - float xPos = Main.rand.NextBool(2) ? Main.player[npc.target].position.X + 500f : Main.player[npc.target].position.X - 500f; - Vector2 spawnPos = new Vector2(xPos, Main.player[npc.target].position.Y + Main.rand.Next(-500, 501)); + float xPos = Main.rand.NextBool(2) ? Main.player[npc.target].position.X + 375f : Main.player[npc.target].position.X - 375f; + float yPos = Main.rand.NextBool(2) ? Main.player[npc.target].position.Y + 375f : Main.player[npc.target].position.Y - 375f; + Vector2 spawnPos = new Vector2(xPos, yPos); int type = ProjectileID.CultistBossLightningOrb; int damage = npc.GetProjectileDamage(type); Projectile.NewProjectile(spawnPos, Vector2.Zero, type, damage, 0f, Main.myPlayer, 0f, 0f); diff --git a/NPCs/StormWeaver/StormWeaverHeadNaked.cs b/NPCs/StormWeaver/StormWeaverHeadNaked.cs index ea90959448..cb96a3bbab 100644 --- a/NPCs/StormWeaver/StormWeaverHeadNaked.cs +++ b/NPCs/StormWeaver/StormWeaverHeadNaked.cs @@ -209,10 +209,8 @@ namespace CalamityMod.NPCs.StormWeaver npc.localAI[0] = 0f; npc.netUpdate = true; - int random = Main.rand.Next(250, 501); - float xPos = Main.rand.NextBool(2) ? Main.player[npc.target].position.X + random : Main.player[npc.target].position.X - random; - random = Main.rand.Next(250, 501); - float yPos = Main.rand.NextBool(2) ? Main.player[npc.target].position.Y + random : Main.player[npc.target].position.Y - random; + float xPos = Main.rand.NextBool(2) ? Main.player[npc.target].position.X + 250f : Main.player[npc.target].position.X - 250f; + float yPos = Main.rand.NextBool(2) ? Main.player[npc.target].position.Y + 250f : Main.player[npc.target].position.Y - 250f; Vector2 spawnPos = new Vector2(xPos, yPos); int type = ProjectileID.CultistBossLightningOrb;