From 85e7c63c2a840f36f1ac0ecd29eaafeb09dbeaaf Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Sun, 22 Oct 2023 15:05:36 -0400 Subject: [PATCH] Start of boss files --- NPCs/AquaticScourge/AquaticScourgeBody.cs | 10 +- NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs | 10 +- NPCs/AquaticScourge/AquaticScourgeHead.cs | 32 +-- NPCs/AquaticScourge/AquaticScourgeTail.cs | 10 +- NPCs/AstrumAureus/AstrumAureus.cs | 86 ++++---- NPCs/AstrumAureus/AureusSpawn.cs | 79 ++++---- NPCs/AstrumDeus/AstrumDeusBody.cs | 50 ++--- NPCs/AstrumDeus/AstrumDeusHead.cs | 50 ++--- NPCs/AstrumDeus/AstrumDeusTail.cs | 42 ++-- NPCs/BrimstoneElemental/Brimling.cs | 69 ++++--- NPCs/BrimstoneElemental/BrimstoneElemental.cs | 34 ++-- NPCs/Bumblebirb/Bumblefuck.cs | 188 +++++++++--------- NPCs/Bumblebirb/Bumblefuck2.cs | 32 ++- NPCs/CalClone/CalamitasClone.cs | 40 ++-- NPCs/CalClone/Cataclysm.cs | 74 ++++--- NPCs/CalClone/Catastrophe.cs | 74 ++++--- NPCs/CeaselessVoid/CeaselessVoid.cs | 100 +++++----- NPCs/CeaselessVoid/DarkEnergy.cs | 22 +- 18 files changed, 495 insertions(+), 507 deletions(-) diff --git a/NPCs/AquaticScourge/AquaticScourgeBody.cs b/NPCs/AquaticScourge/AquaticScourgeBody.cs index e316b31f81..d66f327dce 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBody.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBody.cs @@ -100,11 +100,11 @@ namespace CalamityMod.NPCs.AquaticScourge spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); + Vector2 scaledDraw = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + drawLocation += scaledDraw * NPC.scale + new Vector2(0f, NPC.gfxOffY); Color color = NPC.GetAlpha(drawColor); if (CalamityWorld.revenge || BossRushEvent.BossRushActive || Main.zenithWorld) @@ -115,7 +115,7 @@ namespace CalamityMod.NPCs.AquaticScourge color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp(Main.npc[(int)NPC.ai[2]].localAI[3] / 90f, 0f, 1f)); } - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, color, NPC.rotation, scaledDraw, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs index 878f092770..06f72e58ef 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs @@ -99,11 +99,11 @@ namespace CalamityMod.NPCs.AquaticScourge spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); + Vector2 scaledDraw = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + drawLocation += scaledDraw * NPC.scale + new Vector2(0f, NPC.gfxOffY); Color color = NPC.GetAlpha(drawColor); if (CalamityWorld.revenge || BossRushEvent.BossRushActive || Main.zenithWorld) @@ -114,7 +114,7 @@ namespace CalamityMod.NPCs.AquaticScourge color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp(Main.npc[(int)NPC.ai[2]].localAI[3] / 90f, 0f, 1f)); } - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, color, NPC.rotation, scaledDraw, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/AquaticScourge/AquaticScourgeHead.cs b/NPCs/AquaticScourge/AquaticScourgeHead.cs index a1c49cf262..f73c8daa8d 100644 --- a/NPCs/AquaticScourge/AquaticScourgeHead.cs +++ b/NPCs/AquaticScourge/AquaticScourgeHead.cs @@ -138,11 +138,11 @@ namespace CalamityMod.NPCs.AquaticScourge spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); + Vector2 scaledDraw = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + drawLocation += scaledDraw * NPC.scale + new Vector2(0f, NPC.gfxOffY); Color color = NPC.GetAlpha(drawColor); if (CalamityWorld.revenge || BossRushEvent.BossRushActive || Main.zenithWorld) @@ -153,7 +153,7 @@ namespace CalamityMod.NPCs.AquaticScourge color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp(NPC.localAI[3] / 90f, 0f, 1f)); } - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, color, NPC.rotation, scaledDraw, NPC.scale, spriteEffects, 0f); return false; } @@ -162,18 +162,18 @@ namespace CalamityMod.NPCs.AquaticScourge { 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 topLeftHitbox = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float topRightHitbox = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float bottomLeftHitbox = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float bottomRightHitbox = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); - float minDist = dist1; - if (dist2 < minDist) - minDist = dist2; - if (dist3 < minDist) - minDist = dist3; - if (dist4 < minDist) - minDist = dist4; + float minDist = topLeftHitbox; + if (topRightHitbox < minDist) + minDist = topRightHitbox; + if (bottomLeftHitbox < minDist) + minDist = bottomLeftHitbox; + if (bottomRightHitbox < minDist) + minDist = bottomRightHitbox; return minDist <= 50f * NPC.scale; } diff --git a/NPCs/AquaticScourge/AquaticScourgeTail.cs b/NPCs/AquaticScourge/AquaticScourgeTail.cs index 8f3c854675..51908a45bf 100644 --- a/NPCs/AquaticScourge/AquaticScourgeTail.cs +++ b/NPCs/AquaticScourge/AquaticScourgeTail.cs @@ -99,11 +99,11 @@ namespace CalamityMod.NPCs.AquaticScourge spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); + Vector2 scaledDraw = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f; + drawLocation += scaledDraw * NPC.scale + new Vector2(0f, NPC.gfxOffY); Color color = NPC.GetAlpha(drawColor); if (CalamityWorld.revenge || BossRushEvent.BossRushActive || Main.zenithWorld) @@ -114,7 +114,7 @@ namespace CalamityMod.NPCs.AquaticScourge color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp(Main.npc[(int)NPC.ai[2]].localAI[3] / 90f, 0f, 1f)); } - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, color, NPC.rotation, scaledDraw, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index 6e276643b5..6a7d4a7caa 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -276,67 +276,67 @@ namespace CalamityMod.NPCs.AstrumAureus } int frameCount = Main.npcFrameCount[NPC.type]; - Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / frameCount / 2); + Vector2 originalDrawSize = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / frameCount / 2); Rectangle frame = NPC.frame; float scale = NPC.scale; float rotation = NPC.rotation; float offsetY = NPC.gfxOffY; - Color color36 = Color.White; + Color slimeColor = Color.White; if (Main.zenithWorld && slimePhaseHP) { - color36 = slimePhase == 0 ? Color.Yellow : Color.Violet; + slimeColor = slimePhase == 0 ? Color.Yellow : Color.Violet; } - float amount9 = 0.5f; - int num153 = 7; + float colorLerpAmt = 0.5f; + int afterimageAmt = 7; if (NPC.ai[0] == 3f || NPC.ai[0] == 4f) - num153 = 10; + afterimageAmt = 10; if (CalamityConfig.Instance.Afterimages) { - for (int num155 = 1; num155 < num153; num155 += 2) + for (int i = 1; i < afterimageAmt; i += 2) { - Color color38 = drawColor; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector41 -= new Vector2(NPCTexture.Width, NPCTexture.Height / frameCount) * scale / 2f; - vector41 += vector11 * scale + new Vector2(0f, 4f + offsetY); - spriteBatch.Draw(NPCTexture, vector41, frame, color38, rotation, vector11, scale, spriteEffects, 0f); + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, slimeColor, colorLerpAmt); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (afterimageAmt - i) / 15f; + Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + afterimagePos -= new Vector2(NPCTexture.Width, NPCTexture.Height / frameCount) * scale / 2f; + afterimagePos += originalDrawSize * scale + new Vector2(0f, 4f + offsetY); + spriteBatch.Draw(NPCTexture, afterimagePos, frame, afterimageColor, rotation, originalDrawSize, scale, spriteEffects, 0f); } } - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(NPCTexture.Width, NPCTexture.Height / frameCount) * scale / 2f; - vector43 += vector11 * scale + new Vector2(0f, 4f + offsetY); - Color toUse = Main.zenithWorld && slimePhaseHP ? color36 : drawColor; - spriteBatch.Draw(NPCTexture, vector43, frame, NPC.GetAlpha(toUse), rotation, vector11, scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(NPCTexture.Width, NPCTexture.Height / frameCount) * scale / 2f; + drawLocation += originalDrawSize * scale + new Vector2(0f, 4f + offsetY); + Color toUse = Main.zenithWorld && slimePhaseHP ? slimeColor : drawColor; + spriteBatch.Draw(NPCTexture, drawLocation, frame, NPC.GetAlpha(toUse), rotation, originalDrawSize, scale, spriteEffects, 0f); if (NPC.ai[0] != 1 || (slimePhaseHP && Main.zenithWorld)) //draw only if not recharging { Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Color.Gold); - Color color40 = Color.Lerp(Color.White, color, 0.5f); + Color attackingColor = Color.Lerp(Color.White, color, 0.5f); if (Main.zenithWorld && slimePhaseHP) { - color40 = slimePhase == 0 ? Color.Violet : Color.Yellow; + attackingColor = slimePhase == 0 ? Color.Violet : Color.Yellow; } if (CalamityConfig.Instance.Afterimages) { - for (int num163 = 1; num163 < num153; num163++) + for (int j = 1; j < afterimageAmt; j++) { - Color color41 = color40; - color41 = Color.Lerp(color41, color36, amount9); - color41 = NPC.GetAlpha(color41); - color41 *= (num153 - num163) / 15f; - Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector44 -= new Vector2(GlowMaskTexture.Width, GlowMaskTexture.Height / frameCount) * scale / 2f; - vector44 += vector11 * scale + new Vector2(0f, 4f + offsetY); - spriteBatch.Draw(GlowMaskTexture, vector44, frame, color41, rotation, vector11, scale, spriteEffects, 0f); + Color attackingAfterimageColor = attackingColor; + attackingAfterimageColor = Color.Lerp(attackingAfterimageColor, slimeColor, colorLerpAmt); + attackingAfterimageColor = NPC.GetAlpha(attackingAfterimageColor); + attackingAfterimageColor *= (afterimageAmt - j) / 15f; + Vector2 attackAfterimagePos = NPC.oldPos[j] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + attackAfterimagePos -= new Vector2(GlowMaskTexture.Width, GlowMaskTexture.Height / frameCount) * scale / 2f; + attackAfterimagePos += originalDrawSize * scale + new Vector2(0f, 4f + offsetY); + spriteBatch.Draw(GlowMaskTexture, attackAfterimagePos, frame, attackingAfterimageColor, rotation, originalDrawSize, scale, spriteEffects, 0f); } } - spriteBatch.Draw(GlowMaskTexture, vector43, frame, color40, rotation, vector11, scale, spriteEffects, 0f); + spriteBatch.Draw(GlowMaskTexture, drawLocation, frame, attackingColor, rotation, originalDrawSize, scale, spriteEffects, 0f); } return false; @@ -440,23 +440,23 @@ namespace CalamityMod.NPCs.AstrumAureus NPC.height = (int)(100 * NPC.scale); NPC.position.X = NPC.position.X - (NPC.width / 2); NPC.position.Y = NPC.position.Y - (NPC.height / 2); - for (int num621 = 0; num621 < 50; num621++) + for (int r = 0; r < 50; r++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int aureusDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[aureusDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[aureusDust].scale = 0.5f; + Main.dust[aureusDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 100; num623++) + for (int s = 0; s < 100; s++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int aureusDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 3f); + Main.dust[aureusDust2].noGravity = true; + Main.dust[aureusDust2].velocity *= 5f; + aureusDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); + Main.dust[aureusDust2].velocity *= 2f; } } } diff --git a/NPCs/AstrumAureus/AureusSpawn.cs b/NPCs/AstrumAureus/AureusSpawn.cs index 90390664c8..848c2a6de0 100644 --- a/NPCs/AstrumAureus/AureusSpawn.cs +++ b/NPCs/AstrumAureus/AureusSpawn.cs @@ -240,49 +240,48 @@ namespace CalamityMod.NPCs.AstrumAureus NPC.DrawBackglow(Color.Lerp(Color.Cyan, Color.Orange, (float)Math.Sin(Main.GlobalTimeWrappedHourly) / 2f + 0.5f) with { A = 0 }, 2f + 8f * ((float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.TwoPi) + 1f), spriteEffects, NPC.frame, screenPos); Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); - Color color36 = Color.White; - float amount9 = 0.5f; - int num153 = 10; + Vector2 originalDrawSize = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + Color whiteColor = Color.White; + int afterimageAmt = 10; if (CalamityConfig.Instance.Afterimages) { - for (int num155 = 1; num155 < num153; num155 += 2) + for (int i = 1; i < afterimageAmt; i += 2) { - Color color38 = drawColor; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, whiteColor, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (afterimageAmt - i) / 15f; + Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + afterimagePos += originalDrawSize * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, originalDrawSize, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawLocation += originalDrawSize * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, originalDrawSize, NPC.scale, spriteEffects, 0f); texture2D15 = ModContent.Request("CalamityMod/NPCs/AstrumAureus/AureusSpawnGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Orange, 0.5f) * NPC.Opacity; + Color afterimageColorLerp = Color.Lerp(Color.White, Color.Orange, 0.5f) * NPC.Opacity; if (CalamityConfig.Instance.Afterimages) { - for (int num163 = 1; num163 < num153; num163++) + for (int j = 1; j < afterimageAmt; j++) { - Color color41 = color37; - color41 = Color.Lerp(color41, color36, amount9); - color41 *= (num153 - num163) / 15f; - Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color secondAfterimageColor = afterimageColorLerp; + secondAfterimageColor = Color.Lerp(secondAfterimageColor, whiteColor, 0.5f); + secondAfterimageColor *= (afterimageAmt - j) / 15f; + Vector2 secondAfterimagePos = NPC.oldPos[j] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + secondAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + secondAfterimagePos += originalDrawSize * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, secondAfterimagePos, NPC.frame, secondAfterimageColor, NPC.rotation, originalDrawSize, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, afterimageColorLerp, NPC.rotation, originalDrawSize, NPC.scale, spriteEffects, 0f); return false; } @@ -351,26 +350,26 @@ namespace CalamityMod.NPCs.AstrumAureus NPC.position.X = NPC.position.X - NPC.width / 2; NPC.position.Y = NPC.position.Y - NPC.height / 2; - for (int num621 = 0; num621 < 30; num621++) + for (int r = 0; r < 30; r++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); - Main.dust[num622].velocity *= 3f; + int astralDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); + Main.dust[astralDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[astralDust].scale = 0.5f; + Main.dust[astralDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } - Main.dust[num622].noGravity = true; + Main.dust[astralDust].noGravity = true; } - for (int num623 = 0; num623 < 60; num623++) + for (int s = 0; s < 60; s++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 173, 0f, 0f, 100, default, 2f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); - Main.dust[num624].velocity *= 2f; - Main.dust[num624].noGravity = true; + int astralDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 173, 0f, 0f, 100, default, 2f); + Main.dust[astralDust2].noGravity = true; + Main.dust[astralDust2].velocity *= 5f; + astralDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); + Main.dust[astralDust2].velocity *= 2f; + Main.dust[astralDust2].noGravity = true; } } } diff --git a/NPCs/AstrumDeus/AstrumDeusBody.cs b/NPCs/AstrumDeus/AstrumDeusBody.cs index 9904695fef..ba1e2f361f 100644 --- a/NPCs/AstrumDeus/AstrumDeusBody.cs +++ b/NPCs/AstrumDeus/AstrumDeusBody.cs @@ -99,34 +99,34 @@ namespace CalamityMod.NPCs.AstrumDeus bool deathModeEnragePhase = Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] == 3f; bool doubleWormPhase = NPC.Calamity().newAI[0] != 0f && !deathModeEnragePhase; - Texture2D texture = altBodyTextures ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltSpectral").Value : TextureAssets.Npc[NPC.type].Value; - Texture2D texture2 = ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow2").Value; - Vector2 vector = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); + Texture2D mainWormTex = altBodyTextures ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltSpectral").Value : TextureAssets.Npc[NPC.type].Value; + Texture2D secondWormTex = ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow2").Value; + Vector2 halfSizeTex = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); - Vector2 vector2 = NPC.Center - screenPos; - vector2 -= new Vector2(texture.Width, texture.Height) * NPC.scale / 2f; - vector2 += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture, vector2, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(mainWormTex.Width, mainWormTex.Height) * NPC.scale / 2f; + drawLocation += halfSizeTex * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(mainWormTex, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); - texture = altBodyTextures ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltGlow").Value : ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow").Value; + mainWormTex = altBodyTextures ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltGlow").Value : ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow").Value; Color phaseColor = drawCyan ? Color.Cyan : Color.Orange; if (doubleWormPhase) { - texture = drawCyan ? texture : (altBodyTextures ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltGlow2").Value : ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow3").Value); - texture2 = drawCyan ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow4").Value : texture2; + mainWormTex = drawCyan ? mainWormTex : (altBodyTextures ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltGlow2").Value : ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow3").Value); + secondWormTex = drawCyan ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow4").Value : secondWormTex; } - Color color = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Cyan, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); - Color color2 = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); + Color mainWormColorLerp = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Cyan, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); + Color secondWormColorLerp = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); int timesToDraw = deathModeEnragePhase ? 3 : drawCyan ? 1 : 2; for (int i = 0; i < timesToDraw; i++) - spriteBatch.Draw(texture, vector2, NPC.frame, color, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(mainWormTex, drawLocation, NPC.frame, mainWormColorLerp, NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); if (!altBodyTextures) { timesToDraw = deathModeEnragePhase ? 3 : drawCyan ? 2 : 1; for (int i = 0; i < timesToDraw; i++) - spriteBatch.Draw(texture2, vector2, NPC.frame, color2, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(secondWormTex, drawLocation, NPC.frame, secondWormColorLerp, NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); } return false; @@ -152,23 +152,23 @@ namespace CalamityMod.NPCs.AstrumDeus NPC.height = 50; NPC.position.X = NPC.position.X - (NPC.width / 2); NPC.position.Y = NPC.position.Y - (NPC.height / 2); - for (int num621 = 0; num621 < 5; num621++) + for (int i = 0; i < 5; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int purpleDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[purpleDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[purpleDust].scale = 0.5f; + Main.dust[purpleDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 10; num623++) + for (int j = 0; j < 10; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int astralDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 3f); + Main.dust[astralDust].noGravity = true; + Main.dust[astralDust].velocity *= 5f; + astralDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); + Main.dust[astralDust].velocity *= 2f; } } } diff --git a/NPCs/AstrumDeus/AstrumDeusHead.cs b/NPCs/AstrumDeus/AstrumDeusHead.cs index faabbec9db..d02666233a 100644 --- a/NPCs/AstrumDeus/AstrumDeusHead.cs +++ b/NPCs/AstrumDeus/AstrumDeusHead.cs @@ -149,32 +149,32 @@ namespace CalamityMod.NPCs.AstrumDeus bool deathModeEnragePhase = NPC.Calamity().newAI[0] == 3f; bool doubleWormPhase = NPC.Calamity().newAI[0] != 0f && !deathModeEnragePhase; - Texture2D texture = TextureAssets.Npc[NPC.type].Value; - Texture2D texture2 = ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow2").Value; - Vector2 vector = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); + Texture2D mainWormTex = TextureAssets.Npc[NPC.type].Value; + Texture2D secondWormTex = ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow2").Value; + Vector2 halfSizeTex = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); - Vector2 vector2 = NPC.Center - screenPos; - vector2 -= new Vector2(texture.Width, texture.Height) * NPC.scale / 2f; - vector2 += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture, vector2, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(mainWormTex.Width, mainWormTex.Height) * NPC.scale / 2f; + drawLocation += halfSizeTex * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(mainWormTex, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow").Value; + mainWormTex = ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow").Value; Color phaseColor = drawCyan ? Color.Cyan : Color.Orange; if (doubleWormPhase) { - texture = drawCyan ? texture : ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow3").Value; - texture2 = drawCyan ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow4").Value : texture2; + mainWormTex = drawCyan ? mainWormTex : ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow3").Value; + secondWormTex = drawCyan ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow4").Value : secondWormTex; } - Color color = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Cyan, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); - Color color2 = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); + Color mainWormColorLerp = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Cyan, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); + Color secondWormColorLerp = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); int timesToDraw = deathModeEnragePhase ? 3 : drawCyan ? 1 : 2; for (int i = 0; i < timesToDraw; i++) - spriteBatch.Draw(texture, vector2, NPC.frame, color, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(mainWormTex, drawLocation, NPC.frame, mainWormColorLerp, NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); timesToDraw = deathModeEnragePhase ? 3 : drawCyan ? 2 : 1; for (int i = 0; i < timesToDraw; i++) - spriteBatch.Draw(texture2, vector2, NPC.frame, color2, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(secondWormTex, drawLocation, NPC.frame, secondWormColorLerp, NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); return false; } @@ -191,23 +191,23 @@ namespace CalamityMod.NPCs.AstrumDeus NPC.height = 50; NPC.position.X = NPC.position.X - (NPC.width / 2); NPC.position.Y = NPC.position.Y - (NPC.height / 2); - for (int num621 = 0; num621 < 5; num621++) + for (int i = 0; i < 5; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int purpleDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[purpleDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[purpleDust].scale = 0.5f; + Main.dust[purpleDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 10; num623++) + for (int j = 0; j < 10; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int astralDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 3f); + Main.dust[astralDust].noGravity = true; + Main.dust[astralDust].velocity *= 5f; + astralDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); + Main.dust[astralDust].velocity *= 2f; } } } diff --git a/NPCs/AstrumDeus/AstrumDeusTail.cs b/NPCs/AstrumDeus/AstrumDeusTail.cs index 5747de46ef..eae753ab00 100644 --- a/NPCs/AstrumDeus/AstrumDeusTail.cs +++ b/NPCs/AstrumDeus/AstrumDeusTail.cs @@ -98,24 +98,24 @@ namespace CalamityMod.NPCs.AstrumDeus bool deathModeEnragePhase = Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] == 3f; bool doubleWormPhase = NPC.Calamity().newAI[0] != 0f && !deathModeEnragePhase; - Texture2D texture = TextureAssets.Npc[NPC.type].Value; - Vector2 vector = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); + Texture2D wormTexture = TextureAssets.Npc[NPC.type].Value; + Vector2 halfSizeTex = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2); - Vector2 vector2 = NPC.Center - screenPos; - vector2 -= new Vector2(texture.Width, texture.Height) * NPC.scale / 2f; - vector2 += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture, vector2, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(wormTexture.Width, wormTexture.Height) * NPC.scale / 2f; + drawLocation += halfSizeTex * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(wormTexture, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); - texture = ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusTailGlow").Value; + wormTexture = ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusTailGlow").Value; Color phaseColor = drawCyan ? Color.Cyan : Color.Orange; if (doubleWormPhase) - texture = drawCyan ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusTailGlow2").Value : texture; + wormTexture = drawCyan ? ModContent.Request("CalamityMod/NPCs/AstrumDeus/AstrumDeusTailGlow2").Value : wormTexture; - Color color = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); + Color wormColorLerp = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity); int timesToDraw = deathModeEnragePhase ? 3 : drawCyan ? 2 : 1; for (int i = 0; i < timesToDraw; i++) - spriteBatch.Draw(texture, vector2, NPC.frame, color, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(wormTexture, drawLocation, NPC.frame, wormColorLerp, NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f); return false; } @@ -135,23 +135,23 @@ namespace CalamityMod.NPCs.AstrumDeus NPC.height = 50; NPC.position.X = NPC.position.X - (NPC.width / 2); NPC.position.Y = NPC.position.Y - (NPC.height / 2); - for (int num621 = 0; num621 < 5; num621++) + for (int i = 0; i < 5; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int purpleDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[purpleDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + Main.dust[purpleDust].scale = 0.5f; + Main.dust[purpleDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 10; num623++) + for (int j = 0; j < 10; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int astralDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 3f); + Main.dust[astralDust].noGravity = true; + Main.dust[astralDust].velocity *= 5f; + astralDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); + Main.dust[astralDust].velocity *= 2f; } } } diff --git a/NPCs/BrimstoneElemental/Brimling.cs b/NPCs/BrimstoneElemental/Brimling.cs index 72d45033b2..bb7d4fa158 100644 --- a/NPCs/BrimstoneElemental/Brimling.cs +++ b/NPCs/BrimstoneElemental/Brimling.cs @@ -182,14 +182,14 @@ namespace CalamityMod.NPCs.BrimstoneElemental Vector2 distanceFromMother = Main.npc[CalamityGlobalNPC.brimstoneElemental].Center - NPC.Center; if (distanceFromMother.Length() > 120f) { - Vector2 value54 = distanceFromMother; - if (value54.Length() > movementVelocity) + Vector2 farFromBrimVelocityMult = distanceFromMother; + if (farFromBrimVelocityMult.Length() > movementVelocity) { - value54.Normalize(); - value54 *= movementVelocity; + farFromBrimVelocityMult.Normalize(); + farFromBrimVelocityMult *= movementVelocity; } int inertia = 20; - NPC.velocity = (NPC.velocity * (inertia - 1) + value54) / inertia; + NPC.velocity = (NPC.velocity * (inertia - 1) + farFromBrimVelocityMult) / inertia; } else NPC.velocity *= 0.96f; @@ -221,13 +221,13 @@ namespace CalamityMod.NPCs.BrimstoneElemental // Teleport to Brim's new location if (NPC.ai[2] != 0f && NPC.ai[3] != 0f) { - for (int num1449 = 0; num1449 < 20; num1449++) + for (int i = 0; i < 20; i++) { - int num1450 = Dust.NewDust(NPC.position, NPC.width, NPC.height, 235, 0f, 0f, 100, Color.Transparent, 1f); - Dust dust = Main.dust[num1450]; + int deepRedDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 235, 0f, 0f, 100, Color.Transparent, 1f); + Dust dust = Main.dust[deepRedDust]; dust.velocity *= 3f; - Main.dust[num1450].noGravity = true; - Main.dust[num1450].scale = 2.5f; + Main.dust[deepRedDust].noGravity = true; + Main.dust[deepRedDust].scale = 2.5f; } NPC.Center = new Vector2(NPC.ai[2] * 16f, NPC.ai[3] * 16f); @@ -238,13 +238,13 @@ namespace CalamityMod.NPCs.BrimstoneElemental SoundEngine.PlaySound(SoundID.Item8, NPC.Center); - for (int num1451 = 0; num1451 < 20; num1451++) + for (int j = 0; j < 20; j++) { - int num1452 = Dust.NewDust(NPC.position, NPC.width, NPC.height, 235, 0f, 0f, 100, Color.Transparent, 1f); - Dust dust = Main.dust[num1452]; + int deepRedDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, 235, 0f, 0f, 100, Color.Transparent, 1f); + Dust dust = Main.dust[deepRedDust2]; dust.velocity *= 3f; - Main.dust[num1452].noGravity = true; - Main.dust[num1452].scale = 2.5f; + Main.dust[deepRedDust2].noGravity = true; + Main.dust[deepRedDust2].scale = 2.5f; } } @@ -261,30 +261,29 @@ namespace CalamityMod.NPCs.BrimstoneElemental // Teleport when Brim teleports if (Main.npc[CalamityGlobalNPC.brimstoneElemental].alpha == 255 && Main.netMode != NetmodeID.MultiplayerClient) { - Point point12 = NPC.Center.ToTileCoordinates(); - Point point13 = Main.npc[CalamityGlobalNPC.brimstoneElemental].Center.ToTileCoordinates(); - int num1453 = 6; - int num1454 = 3; - int num1455 = 4; - int num1456 = 1; - int num1457 = 0; - while (num1457 < 100) + Point npcTileCoords = NPC.Center.ToTileCoordinates(); + Point brimmyTileCoords = Main.npc[CalamityGlobalNPC.brimstoneElemental].Center.ToTileCoordinates(); + int babTeleportRadius = 3; + int brimmyTeleportRadius = 4; + int solidTileRadius = 1; + int increment = 0; + while (increment < 100) { - num1457++; - int num1458 = Main.rand.Next(point13.X - num1453, point13.X + num1453 + 1); - int num1459 = Main.rand.Next(point13.Y - num1453, point13.Y + num1453 + 1); - if ((num1459 < point13.Y - num1455 || num1459 > point13.Y + num1455 || num1458 < point13.X - num1455 || num1458 > point13.X + num1455) && (num1459 < point12.Y - num1454 || num1459 > point12.Y + num1454 || num1458 < point12.X - num1454 || num1458 > point12.X + num1454) && !Main.tile[num1458, num1459].HasUnactuatedTile) + increment++; + int randXOffset = Main.rand.Next(brimmyTileCoords.X - 6, brimmyTileCoords.X + 7); + int randYOffset = Main.rand.Next(brimmyTileCoords.Y - 6, brimmyTileCoords.Y + 7); + if ((randYOffset < brimmyTileCoords.Y - brimmyTeleportRadius || randYOffset > brimmyTileCoords.Y + brimmyTeleportRadius || randXOffset < brimmyTileCoords.X - brimmyTeleportRadius || randXOffset > brimmyTileCoords.X + brimmyTeleportRadius) && (randYOffset < npcTileCoords.Y - babTeleportRadius || randYOffset > npcTileCoords.Y + babTeleportRadius || randXOffset < npcTileCoords.X - babTeleportRadius || randXOffset > npcTileCoords.X + babTeleportRadius) && !Main.tile[randXOffset, randYOffset].HasUnactuatedTile) { - bool flag107 = true; - if (flag107 && Main.tile[num1458, num1459].LiquidType == LiquidID.Lava) - flag107 = false; - if (flag107 && Collision.SolidTiles(num1458 - num1456, num1458 + num1456, num1459 - num1456, num1459 + num1456)) - flag107 = false; + bool canTeleport = true; + if (canTeleport && Main.tile[randXOffset, randYOffset].LiquidType == LiquidID.Lava) + canTeleport = false; + if (canTeleport && Collision.SolidTiles(randXOffset - solidTileRadius, randXOffset + solidTileRadius, randYOffset - solidTileRadius, randYOffset + solidTileRadius)) + canTeleport = false; - if (flag107) + if (canTeleport) { - NPC.ai[2] = num1458; - NPC.ai[3] = num1459; + NPC.ai[2] = randXOffset; + NPC.ai[3] = randYOffset; break; } } diff --git a/NPCs/BrimstoneElemental/BrimstoneElemental.cs b/NPCs/BrimstoneElemental/BrimstoneElemental.cs index 304fd9a09b..bf3c38328e 100644 --- a/NPCs/BrimstoneElemental/BrimstoneElemental.cs +++ b/NPCs/BrimstoneElemental/BrimstoneElemental.cs @@ -263,23 +263,23 @@ namespace CalamityMod.NPCs.BrimstoneElemental NPC.height = 150; NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); - for (int num621 = 0; num621 < 40; num621++) + for (int i = 0; i < 40; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int brimDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + Main.dust[brimDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[brimDust].scale = 0.5f; + Main.dust[brimDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 60; num623++) + for (int j = 0; j < 60; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); + Main.dust[brimDust2].noGravity = true; + Main.dust[brimDust2].velocity *= 5f; + brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + Main.dust[brimDust2].velocity *= 2f; } if (Main.netMode != NetmodeID.Server) { @@ -300,11 +300,11 @@ namespace CalamityMod.NPCs.BrimstoneElemental SpriteEffects spriteEffects = SpriteEffects.None; if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture = TextureAssets.Npc[NPC.type].Value; - Vector2 origin = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.npcFrameCount[NPC.type] / 2)); + Texture2D npcTexture = TextureAssets.Npc[NPC.type].Value; + Vector2 frameLocation = new Vector2((float)(npcTexture.Width / 2), (float)(npcTexture.Height / Main.npcFrameCount[NPC.type] / 2)); Vector2 npcOffset = NPC.Center - screenPos; - npcOffset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); + npcOffset -= new Vector2((float)npcTexture.Width, (float)(npcTexture.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + npcOffset += frameLocation * NPC.scale + new Vector2(0f, NPC.gfxOffY); // Give brimmy an outline based on current elemental mode if (Main.zenithWorld) @@ -340,11 +340,11 @@ namespace CalamityMod.NPCs.BrimstoneElemental for (float i = 0; i < 1; i += 0.125f) { - spriteBatch.Draw(texture, npcOffset + (i * MathHelper.TwoPi).ToRotationVector2() * outlineThickness, NPC.frame, outlineColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(npcTexture, npcOffset + (i * MathHelper.TwoPi).ToRotationVector2() * outlineThickness, NPC.frame, outlineColor, NPC.rotation, frameLocation, NPC.scale, spriteEffects, 0f); } CalamityUtils.ExitShaderRegion(spriteBatch); } - spriteBatch.Draw(texture, npcOffset, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(npcTexture, npcOffset, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, frameLocation, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/Bumblebirb/Bumblefuck.cs b/NPCs/Bumblebirb/Bumblefuck.cs index ab0ff5605b..f5dca66286 100644 --- a/NPCs/Bumblebirb/Bumblefuck.cs +++ b/NPCs/Bumblebirb/Bumblefuck.cs @@ -142,8 +142,8 @@ namespace CalamityMod.NPCs.Bumblebirb if (phaseSwitchPhase || birbSpawn) { float frameGateValue = birbSpawn ? NPC.ai[1] : phase3 ? calamityGlobalNPC.newAI[1] : calamityGlobalNPC.newAI[0]; - int num116 = 180; - if (frameGateValue < (num116 - 60) || frameGateValue > (num116 - 20)) + int frameTimer = 180; + if (frameGateValue < (frameTimer - 60) || frameGateValue > (frameTimer - 20)) { NPC.frameCounter += 1D; if (NPC.frameCounter > 5D) @@ -159,7 +159,7 @@ namespace CalamityMod.NPCs.Bumblebirb else { NPC.frame.Y = frameHeight * 4; - if (frameGateValue > (num116 - 50) && frameGateValue < (num116 - 25)) + if (frameGateValue > (frameTimer - 50) && frameGateValue < (frameTimer - 25)) { NPC.frame.Y = frameHeight * 5; } @@ -167,8 +167,8 @@ namespace CalamityMod.NPCs.Bumblebirb } else if (NPC.ai[0] == 5f) { - int num115 = 120; - if (NPC.ai[1] < (num115 - 50) || NPC.ai[1] > (num115 - 10)) + int otherFrameTimer = 120; + if (NPC.ai[1] < (otherFrameTimer - 50) || NPC.ai[1] > (otherFrameTimer - 10)) { NPC.frameCounter += 1D; if (NPC.frameCounter > 5D) @@ -184,7 +184,7 @@ namespace CalamityMod.NPCs.Bumblebirb else { NPC.frame.Y = frameHeight * 4; - if (NPC.ai[1] > (num115 - 40) && NPC.ai[1] < (num115 - 15)) + if (NPC.ai[1] > (otherFrameTimer - 40) && NPC.ai[1] < (otherFrameTimer - 15)) { NPC.frame.Y = frameHeight * 5; } @@ -228,13 +228,13 @@ namespace CalamityMod.NPCs.Bumblebirb spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); Color color = drawColor; - Color color36 = Color.White; + Color drawColor = Color.White; - float amount9 = 0f; - int num150 = 120; - int num151 = 60; + float lerpDrawTransition = 0f; + int newAITracker = 120; + int buffColorDampener = 60; if (phase3 && calamityGlobalNPC.newAI[3] == 1f) { @@ -244,27 +244,27 @@ namespace CalamityMod.NPCs.Bumblebirb { color = CalamityGlobalNPC.buffColor(color, 0.7f, 0.7f, 0.3f, 1f); } - else if (phase2 && calamityGlobalNPC.newAI[0] > (float)num150) + else if (phase2 && calamityGlobalNPC.newAI[0] > (float)newAITracker) { - float num152 = calamityGlobalNPC.newAI[0] - (float)num150; - num152 /= (float)num151; - color = CalamityGlobalNPC.buffColor(color, 1f - 0.3f * num152, 1f - 0.3f * num152, 1f - 0.7f * num152, 1f); + float phase2TranBuff = calamityGlobalNPC.newAI[0] - (float)newAITracker; + phase2TranBuff /= (float)buffColorDampener; + color = CalamityGlobalNPC.buffColor(color, 1f - 0.3f * phase2TranBuff, 1f - 0.3f * phase2TranBuff, 1f - 0.7f * phase2TranBuff, 1f); } - int num153 = 10; - int num154 = 2; + int afterimageAmt = 10; + int afterimageIncrement = 2; if (NPC.ai[0] == 0f || NPC.ai[0] == 3.1f || NPC.ai[0] == 4f || NPC.ai[0] == 4.2f) { - num153 = 4; + afterimageAmt = 4; } if (NPC.ai[0] == 1f || NPC.ai[0] == 3f || NPC.ai[0] == 4.1f) { - num153 = 7; + afterimageAmt = 7; } if (NPC.ai[0] == 2f || NPC.ai[0] == 3.2f || (phase2 && calamityGlobalNPC.newAI[2] == 1f)) { - color36 = Color.Yellow; - amount9 = 0.5f; + drawColor = Color.Yellow; + lerpDrawTransition = 0.5f; } else { @@ -273,128 +273,126 @@ namespace CalamityMod.NPCs.Bumblebirb if (CalamityConfig.Instance.Afterimages) { - for (int num155 = 1; num155 < num153; num155 += num154) + for (int i = 1; i < afterimageAmt; i += afterimageIncrement) { - Color color38 = color; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (float)(num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color afterimageColor = color; + afterimageColor = Color.Lerp(afterimageColor, drawColor, lerpDrawTransition); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (float)(afterimageAmt - i) / 15f; + Vector2 afterimageDrawPos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; + afterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + afterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, afterimageDrawPos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - int num156 = 0; - float num157 = 0f; - float scaleFactor9 = 0f; + int extraAfterimageAmt = 0; + float extraAfterimageDampener = 0f; + float afterimageScaler = 0f; if (NPC.ai[0] == 0f || NPC.ai[0] == 3.1f || NPC.ai[0] == 4f || NPC.ai[0] == 4.2f) { - num156 = 4; + extraAfterimageAmt = 4; } if (NPC.ai[0] == 5f) { - int num158 = 60; - int num159 = 30; - if (NPC.ai[1] > (float)num158) + if (NPC.ai[1] > 60f) { - num156 = 6; - num157 = 1f - (float)Math.Cos((double)((NPC.ai[1] - (float)num158) / (float)num159 * MathHelper.TwoPi)); - num157 /= 3f; - scaleFactor9 = 40f; + extraAfterimageAmt = 6; + extraAfterimageDampener = 1f - (float)Math.Cos((double)((NPC.ai[1] - 60f) / 30f * MathHelper.TwoPi)); + extraAfterimageDampener /= 3f; + afterimageScaler = 40f; } } if (phaseSwitchPhase) { - if (phase3 && calamityGlobalNPC.newAI[1] > (float)num150) + if (phase3 && calamityGlobalNPC.newAI[1] > (float)newAITracker) { - num156 = 6; - num157 = 1f - (float)Math.Cos((double)((calamityGlobalNPC.newAI[1] - (float)num150) / (float)num151 * MathHelper.TwoPi)); - num157 /= 3f; - scaleFactor9 = 60f; + extraAfterimageAmt = 6; + extraAfterimageDampener = 1f - (float)Math.Cos((double)((calamityGlobalNPC.newAI[1] - (float)newAITracker) / (float)buffColorDampener * MathHelper.TwoPi)); + extraAfterimageDampener /= 3f; + afterimageScaler = 60f; } - else if (phase2 && calamityGlobalNPC.newAI[0] > (float)num150) + else if (phase2 && calamityGlobalNPC.newAI[0] > (float)newAITracker) { - num156 = 6; - num157 = 1f - (float)Math.Cos((double)((calamityGlobalNPC.newAI[0] - (float)num150) / (float)num151 * MathHelper.TwoPi)); - num157 /= 3f; - scaleFactor9 = 60f; + extraAfterimageAmt = 6; + extraAfterimageDampener = 1f - (float)Math.Cos((double)((calamityGlobalNPC.newAI[0] - (float)newAITracker) / (float)buffColorDampener * MathHelper.TwoPi)); + extraAfterimageDampener /= 3f; + afterimageScaler = 60f; } } if (CalamityConfig.Instance.Afterimages) { - for (int num160 = 0; num160 < num156; num160++) + for (int j = 0; j < extraAfterimageAmt; j++) { - Color color39 = drawColor; - color39 = Color.Lerp(color39, color36, amount9); - color39 = NPC.GetAlpha(color39); - color39 *= 1f - num157; - Vector2 vector42 = NPC.Center + ((float)num160 / (float)num156 * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * scaleFactor9 * num157 - screenPos; - vector42 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector42 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector42, NPC.frame, color39, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color extraAfterimageColor = drawColor; + extraAfterimageColor = Color.Lerp(extraAfterimageColor, drawColor, lerpDrawTransition); + extraAfterimageColor = NPC.GetAlpha(extraAfterimageColor); + extraAfterimageColor *= 1f - extraAfterimageDampener; + Vector2 extraAfterimageDrawPos = NPC.Center + ((float)j / (float)extraAfterimageAmt * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * afterimageScaler * extraAfterimageDampener - screenPos; + extraAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + extraAfterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, extraAfterimageDrawPos, NPC.frame, extraAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - Color color2 = drawColor; - color2 = Color.Lerp(color2, color36, amount9); - color2 = NPC.GetAlpha(color2); - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, (phase3 && calamityGlobalNPC.newAI[3] == 1f ? color2 : NPC.GetAlpha(drawColor)), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color mainDrawingColor = drawColor; + mainDrawingColor = Color.Lerp(mainDrawingColor, drawColor, lerpDrawTransition); + mainDrawingColor = NPC.GetAlpha(mainDrawingColor); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, (phase3 && calamityGlobalNPC.newAI[3] == 1f ? mainDrawingColor : NPC.GetAlpha(drawColor)), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); if (phase2) { texture2D15 = ModContent.Request("CalamityMod/NPCs/Bumblebirb/BirbGlow").Value; - Color color40 = Color.Lerp(Color.White, Color.Red, 0.5f); - color36 = Color.Red; + Color glowmaskColor = Color.Lerp(Color.White, Color.Red, 0.5f); + drawColor = Color.Red; - amount9 = 1f; - num157 = 0.5f; - scaleFactor9 = 10f; - num154 = 1; + lerpDrawTransition = 1f; + extraAfterimageDampener = 0.5f; + afterimageScaler = 10f; + afterimageIncrement = 1; if (phaseSwitchPhase) { - float num161 = (phase3 ? calamityGlobalNPC.newAI[1] : calamityGlobalNPC.newAI[0]) - (float)num150; - num161 /= (float)num151; - color36 *= num161; - color40 *= num161; + float glowmaskDampener = (phase3 ? calamityGlobalNPC.newAI[1] : calamityGlobalNPC.newAI[0]) - (float)newAITracker; + glowmaskDampener /= (float)buffColorDampener; + drawColor *= glowmaskDampener; + glowmaskColor *= glowmaskDampener; } if (CalamityConfig.Instance.Afterimages) { - for (int num163 = 1; num163 < num153; num163 += num154) + for (int k = 1; k < afterimageAmt; k += afterimageIncrement) { - Color color41 = color40; - color41 = Color.Lerp(color41, color36, amount9); - color41 *= (float)(num153 - num163) / 15f; - Vector2 vector44 = NPC.oldPos[num163] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color glowmaskAfterimageColor = glowmaskColor; + glowmaskAfterimageColor = Color.Lerp(glowmaskAfterimageColor, drawColor, lerpDrawTransition); + glowmaskAfterimageColor *= (float)(afterimageAmt - k) / 15f; + Vector2 glowmaskAfterimageDrawPos = NPC.oldPos[k] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; + glowmaskAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + glowmaskAfterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, glowmaskAfterimageDrawPos, NPC.frame, glowmaskAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } - for (int num164 = 1; num164 < num156; num164++) + for (int l = 1; l < extraAfterimageAmt; l++) { - Color color42 = color40; - color42 = Color.Lerp(color42, color36, amount9); - color42 = NPC.GetAlpha(color42); - color42 *= 1f - num157; - Vector2 vector45 = NPC.Center + ((float)num164 / (float)num156 * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * scaleFactor9 * num157 - screenPos; - vector45 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector45 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector45, NPC.frame, color42, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color extraGlowmaskAfterimageColor = glowmaskColor; + extraGlowmaskAfterimageColor = Color.Lerp(extraGlowmaskAfterimageColor, drawColor, lerpDrawTransition); + extraGlowmaskAfterimageColor = NPC.GetAlpha(extraGlowmaskAfterimageColor); + extraGlowmaskAfterimageColor *= 1f - extraAfterimageDampener; + Vector2 extraGlowmaskAfterimageDrawPos = NPC.Center + ((float)l / (float)extraAfterimageAmt * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * afterimageScaler * extraAfterimageDampener - screenPos; + extraGlowmaskAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + extraGlowmaskAfterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, extraGlowmaskAfterimageDrawPos, NPC.frame, extraGlowmaskAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color40, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } return false; diff --git a/NPCs/Bumblebirb/Bumblefuck2.cs b/NPCs/Bumblebirb/Bumblefuck2.cs index ab2e47b4b0..9312bb3f08 100644 --- a/NPCs/Bumblebirb/Bumblefuck2.cs +++ b/NPCs/Bumblebirb/Bumblefuck2.cs @@ -99,30 +99,28 @@ namespace CalamityMod.NPCs.Bumblebirb spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); - Color color36 = Color.Gold; - float amount9 = 0.5f; - int num153 = NPC.ai[0] == 2.1f ? 7 : 0; + Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2); + int afterimageAmt = NPC.ai[0] == 2.1f ? 7 : 0; if (CalamityConfig.Instance.Afterimages) { - for (int num155 = 1; num155 < num153; num155 += 2) + for (int i = 1; i < afterimageAmt; i += 2) { - Color color38 = drawColor; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, Color.Gold, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (afterimageAmt - i) / 15f; + Vector2 afterimageDrawPos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + afterimageDrawPos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + afterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, afterimageDrawPos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/CalClone/CalamitasClone.cs b/NPCs/CalClone/CalamitasClone.cs index ca319541ce..1af5ce551a 100644 --- a/NPCs/CalClone/CalamitasClone.cs +++ b/NPCs/CalClone/CalamitasClone.cs @@ -138,14 +138,14 @@ namespace CalamityMod.NPCs.CalClone { for (int i = 1; i < afterimageAmt; i += 2) { - Color color1 = drawColor; - color1 = Color.Lerp(color1, white, colorLerpAmt); - color1 = NPC.GetAlpha(color1); - color1 *= (float)(afterimageAmt - i) / 15f; + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, white, colorLerpAmt); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (float)(afterimageAmt - i) / 15f; Vector2 offset = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; offset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; offset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture, offset, NPC.frame, color1, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, offset, NPC.frame, afterimageColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); } } @@ -165,13 +165,13 @@ namespace CalamityMod.NPCs.CalClone { for (int i = 1; i < afterimageAmt; i++) { - Color color2 = color; - color2 = Color.Lerp(color2, white, colorLerpAmt); - color2 *= (float)(afterimageAmt - i) / 15f; + Color extraAfterimageColor = color; + extraAfterimageColor = Color.Lerp(extraAfterimageColor, white, colorLerpAmt); + extraAfterimageColor *= (float)(afterimageAmt - i) / 15f; Vector2 offset = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; offset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; offset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture, offset, NPC.frame, color2, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, offset, NPC.frame, extraAfterimageColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); } } @@ -275,23 +275,23 @@ namespace CalamityMod.NPCs.CalClone NPC.height = 100; NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); - for (int num621 = 0; num621 < 40; num621++) + for (int i = 0; i < 40; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int brimDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + Main.dust[brimDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[brimDust].scale = 0.5f; + Main.dust[brimDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 70; num623++) + for (int j = 0; j < 70; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); + Main.dust[brimDust2].noGravity = true; + Main.dust[brimDust2].velocity *= 5f; + brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + Main.dust[brimDust2].velocity *= 2f; } } } diff --git a/NPCs/CalClone/Cataclysm.cs b/NPCs/CalClone/Cataclysm.cs index f3e564e480..1f2c153cea 100644 --- a/NPCs/CalClone/Cataclysm.cs +++ b/NPCs/CalClone/Cataclysm.cs @@ -106,49 +106,47 @@ namespace CalamityMod.NPCs.CalClone spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); - Color color36 = Color.White; - float amount9 = 0.5f; - int num153 = 7; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); + int afterimageAmt = 7; if (CalamityConfig.Instance.Afterimages) { - for (int num155 = 1; num155 < num153; num155 += 2) + for (int i = 1; i < afterimageAmt; i += 2) { - Color color38 = drawColor; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (float)(num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, Color.White, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (float)(afterimageAmt - i) / 15f; + Vector2 afterimageDrawPos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; + afterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + afterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, afterimageDrawPos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); texture2D15 = ModContent.Request("CalamityMod/NPCs/CalClone/CataclysmGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f); + Color pinkLerp = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) { - for (int num163 = 1; num163 < num153; num163++) + for (int j = 1; j < afterimageAmt; j++) { - Color color41 = color37; - color41 = Color.Lerp(color41, color36, amount9); - color41 *= (float)(num153 - num163) / 15f; - Vector2 vector44 = NPC.oldPos[num163] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color extraAfterimageColor = pinkLerp; + extraAfterimageColor = Color.Lerp(extraAfterimageColor, Color.White, 0.5f); + extraAfterimageColor *= (float)(afterimageAmt - j) / 15f; + Vector2 extraAfterimageDrawPos = NPC.oldPos[j] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; + extraAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + extraAfterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, extraAfterimageDrawPos, NPC.frame, extraAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, pinkLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } @@ -190,23 +188,23 @@ namespace CalamityMod.NPCs.CalClone NPC.height = 100; NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); - for (int num621 = 0; num621 < 40; num621++) + for (int i = 0; i < 40; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int brimDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + Main.dust[brimDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[brimDust].scale = 0.5f; + Main.dust[brimDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 70; num623++) + for (int j = 0; j < 70; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); + Main.dust[brimDust2].noGravity = true; + Main.dust[brimDust2].velocity *= 5f; + brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + Main.dust[brimDust2].velocity *= 2f; } } } diff --git a/NPCs/CalClone/Catastrophe.cs b/NPCs/CalClone/Catastrophe.cs index 82937e480f..eac8c67b49 100644 --- a/NPCs/CalClone/Catastrophe.cs +++ b/NPCs/CalClone/Catastrophe.cs @@ -106,49 +106,47 @@ namespace CalamityMod.NPCs.CalClone spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); - Color color36 = Color.White; - float amount9 = 0.5f; - int num153 = 7; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); + int afterimageAmt = 7; if (CalamityConfig.Instance.Afterimages) { - for (int num155 = 1; num155 < num153; num155 += 2) + for (int i = 1; i < afterimageAmt; i += 2) { - Color color38 = drawColor; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (float)(num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, Color.White, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (float)(afterimageAmt - i) / 15f; + Vector2 afterimageDrawPos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; + afterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + afterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, afterimageDrawPos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); texture2D15 = ModContent.Request("CalamityMod/NPCs/CalClone/CatastropheGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f); + Color pinkLerp = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) { - for (int num163 = 1; num163 < num153; num163++) + for (int j = 1; j < afterimageAmt; j++) { - Color color41 = color37; - color41 = Color.Lerp(color41, color36, amount9); - color41 *= (float)(num153 - num163) / 15f; - Vector2 vector44 = NPC.oldPos[num163] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color extraAfterimageColor = pinkLerp; + extraAfterimageColor = Color.Lerp(extraAfterimageColor, Color.White, 0.5f); + extraAfterimageColor *= (float)(afterimageAmt - j) / 15f; + Vector2 extraAfterimageDrawPos = NPC.oldPos[j] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; + extraAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + extraAfterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, extraAfterimageDrawPos, NPC.frame, extraAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, pinkLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } @@ -190,23 +188,23 @@ namespace CalamityMod.NPCs.CalClone NPC.height = 100; NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); - for (int num621 = 0; num621 < 40; num621++) + for (int i = 0; i < 40; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; + int brimDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + Main.dust[brimDust].velocity *= 3f; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[brimDust].scale = 0.5f; + Main.dust[brimDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 70; num623++) + for (int j = 0; j < 70; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); - Main.dust[num624].velocity *= 2f; + int brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); + Main.dust[brimDust2].noGravity = true; + Main.dust[brimDust2].velocity *= 5f; + brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + Main.dust[brimDust2].velocity *= 2f; } } } diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index 2b7a7da62a..7ec4467489 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -122,18 +122,18 @@ namespace CalamityMod.NPCs.CeaselessVoid { 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 hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); - float minDist = dist1; - if (dist2 < minDist) - minDist = dist2; - if (dist3 < minDist) - minDist = dist3; - if (dist4 < minDist) - minDist = dist4; + float minDist = hitboxTopLeft; + if (hitboxTopRight < minDist) + minDist = hitboxTopRight; + if (hitboxBotLeft < minDist) + minDist = hitboxBotLeft; + if (hitboxBotRight < minDist) + minDist = hitboxBotRight; return minDist <= 50f; } @@ -145,49 +145,47 @@ namespace CalamityMod.NPCs.CeaselessVoid spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; - Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); - Color color36 = Color.White; - float amount9 = 0.5f; - int num153 = 7; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); + int afterimageAmt = 7; if (CalamityConfig.Instance.Afterimages) { - for (int num155 = 1; num155 < num153; num155 += 2) + for (int i = 1; i < afterimageAmt; i += 2) { - Color color38 = drawColor; - color38 = Color.Lerp(color38, color36, amount9); - color38 = NPC.GetAlpha(color38); - color38 *= (float)(num153 - num155) / 15f; - Vector2 vector41 = NPC.oldPos[num155] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, Color.White, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (float)(afterimageAmt - i) / 15f; + Vector2 afterimageDrawPos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; + afterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + afterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, afterimageDrawPos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - Vector2 vector43 = NPC.Center - screenPos; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); texture2D15 = ModContent.Request("CalamityMod/NPCs/CeaselessVoid/CeaselessVoidGlow").Value; - Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f); + Color cyanLerp = Color.Lerp(Color.White, Color.Cyan, 0.5f); if (CalamityConfig.Instance.Afterimages) { - for (int num163 = 1; num163 < num153; num163++) + for (int j = 1; j < afterimageAmt; j++) { - Color color41 = color37; - color41 = Color.Lerp(color41, color36, amount9); - color41 *= (float)(num153 - num163) / 15f; - Vector2 vector44 = NPC.oldPos[num163] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + Color extraAfterimageColor = cyanLerp; + extraAfterimageColor = Color.Lerp(extraAfterimageColor, Color.White, 0.5f); + extraAfterimageColor *= (float)(afterimageAmt - j) / 15f; + Vector2 extraAfterimageDrawPos = NPC.oldPos[j] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; + extraAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + extraAfterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, extraAfterimageDrawPos, NPC.frame, extraAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, cyanLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } @@ -283,25 +281,25 @@ namespace CalamityMod.NPCs.CeaselessVoid NPC.height = 100; NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); - for (int num621 = 0; num621 < 40; num621++) + for (int i = 0; i < 40; i++) { - int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num622].velocity *= 3f; - Main.dust[num622].noGravity = true; + int purpleDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[purpleDust].velocity *= 3f; + Main.dust[purpleDust].noGravity = true; if (Main.rand.NextBool()) { - Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[purpleDust].scale = 0.5f; + Main.dust[purpleDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int num623 = 0; num623 < 70; num623++) + for (int j = 0; j < 70; j++) { - int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); - Main.dust[num624].noGravity = true; - Main.dust[num624].velocity *= 2f; + int purpleDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f); + Main.dust[purpleDust2].noGravity = true; + Main.dust[purpleDust2].velocity *= 5f; + purpleDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); + Main.dust[purpleDust2].noGravity = true; + Main.dust[purpleDust2].velocity *= 2f; } if (Main.netMode != NetmodeID.Server) diff --git a/NPCs/CeaselessVoid/DarkEnergy.cs b/NPCs/CeaselessVoid/DarkEnergy.cs index 754d971bd2..a254faf2f8 100644 --- a/NPCs/CeaselessVoid/DarkEnergy.cs +++ b/NPCs/CeaselessVoid/DarkEnergy.cs @@ -282,18 +282,18 @@ namespace CalamityMod.NPCs.CeaselessVoid { 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 hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft()); + float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight()); + float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft()); + float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight()); - float minDist = dist1; - if (dist2 < minDist) - minDist = dist2; - if (dist3 < minDist) - minDist = dist3; - if (dist4 < minDist) - minDist = dist4; + float minDist = hitboxTopLeft; + if (hitboxTopRight < minDist) + minDist = hitboxTopRight; + if (hitboxBotLeft < minDist) + minDist = hitboxBotLeft; + if (hitboxBotRight < minDist) + minDist = hitboxBotRight; return minDist <= 35f * NPC.scale; }