From c65c2be69a9488346221c7ff9339909e9987f550 Mon Sep 17 00:00:00 2001 From: Andrew Marheine Date: Tue, 24 Mar 2020 21:05:14 -0500 Subject: [PATCH] Odd Mushroom dust duplication, New Birb attacks and visuals, Yharon flare bombs slowed down. --- CalPlayer/CalamityPlayer.cs | 52 +- ExtraTextures/Lasers/BirbAuraEnd.png | Bin 0 -> 868 bytes ExtraTextures/Lasers/BirbAuraStart.png | Bin 0 -> 864 bytes ExtraTextures/Lasers/RedLightningTexture.png | Bin 0 -> 193 bytes NPCs/Bumblebirb/BirbGlow.png | Bin 0 -> 13533 bytes NPCs/Bumblebirb/Bumblefuck.cs | 310 ++++++- NPCs/Bumblebirb/Bumblefuck2.cs | 84 +- NPCs/CalamityAI.cs | 848 +++++++++++-------- NPCs/OldDuke/OldDuke.cs | 6 +- NPCs/OldDuke/OldDukeSharkron.cs | 16 - Projectiles/Boss/BirbAura.cs | 187 ++++ Projectiles/Boss/BirbAura.png | Bin 0 -> 990 bytes Projectiles/Boss/BirbAuraFlare.cs | 134 +++ Projectiles/Boss/BirbAuraFlare.png | Bin 0 -> 159 bytes Projectiles/Boss/BrimstoneRay.cs | 6 +- Projectiles/Boss/FlareBomb.cs | 2 +- Projectiles/Boss/RedLightning.cs | 217 +++++ Projectiles/Boss/RedLightning.png | Bin 0 -> 191 bytes Projectiles/CalamityGlobalProjectile.cs | 10 +- 19 files changed, 1420 insertions(+), 452 deletions(-) create mode 100644 ExtraTextures/Lasers/BirbAuraEnd.png create mode 100644 ExtraTextures/Lasers/BirbAuraStart.png create mode 100644 ExtraTextures/Lasers/RedLightningTexture.png create mode 100644 NPCs/Bumblebirb/BirbGlow.png create mode 100644 Projectiles/Boss/BirbAura.cs create mode 100644 Projectiles/Boss/BirbAura.png create mode 100644 Projectiles/Boss/BirbAuraFlare.cs create mode 100644 Projectiles/Boss/BirbAuraFlare.png create mode 100644 Projectiles/Boss/RedLightning.cs create mode 100644 Projectiles/Boss/RedLightning.png diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 2663f55afb..0cde1342ab 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -8316,7 +8316,57 @@ namespace CalamityMod.CalPlayer public override void DrawEffects(PlayerDrawInfo drawInfo, ref float r, ref float g, ref float b, ref float a, ref bool fullBright) { - bool noRogueStealth = rogueStealth == 0f || player.townNPCs > 2f; + // Dust modifications while high + if (trippy) + { + Rectangle rectangle = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 50, Main.screenWidth + 1000, Main.screenHeight + 100); + int dustDrawn = 0; + float maxShroomDust = Main.maxDustToDraw / 2; + for (int i = 0; i < Main.maxDustToDraw; i++) + { + Dust dust = Main.dust[i]; + if (dust.active) + { + if (new Rectangle((int)dust.position.X, (int)dust.position.Y, 4, 4).Intersects(rectangle)) + { + dust.color = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); + for (int num213 = 0; num213 < 4; num213++) + { + Vector2 position9 = dust.position; + Vector2 dustCenter = new Vector2(position9.X + 4f, position9.Y + 4f); + float num214 = Math.Abs(dustCenter.X - player.Center.X); + float num215 = Math.Abs(dustCenter.Y - player.Center.Y); + if (num213 == 0 || num213 == 2) + { + position9.X = player.Center.X + num214; + } + else + { + position9.X = player.Center.X - num214; + } + position9.X -= 4f; + if (num213 == 0 || num213 == 1) + { + position9.Y = player.Center.Y + num215; + } + else + { + position9.Y = player.Center.Y - num215; + } + position9.Y -= 4f; + Main.spriteBatch.Draw(Main.dustTexture, position9 - Main.screenPosition, new Rectangle?(dust.frame), dust.color, dust.rotation, new Vector2(4f, 4f), dust.scale, SpriteEffects.None, 0f); + dustDrawn++; + } + + // Break if too many dust clones have been drawn + if (dustDrawn > maxShroomDust) + break; + } + } + } + } + + bool noRogueStealth = rogueStealth == 0f || player.townNPCs > 2f; if (rogueStealth > 0f && rogueStealthMax > 0f && player.townNPCs < 3f) { //A translucent orchid color, the rogue class color diff --git a/ExtraTextures/Lasers/BirbAuraEnd.png b/ExtraTextures/Lasers/BirbAuraEnd.png new file mode 100644 index 0000000000000000000000000000000000000000..4003d549d627aa2174a25199a570c30c4e4d4df1 GIT binary patch literal 868 zcmeAS@N?(olHy`uVBq!ia0vp^7l3#J2OE&A3wWRhq!^2X+?^QKos)S9a~60+7BevL9R^{>P@?T((_wSd2~(DA z^$pZn@P;A$qN_rJphAR;YizlLc*CNDms-@0ntb&zC};gHXkPzJ#(4hhlRoqQygF-h zyW4Jm-RJx{!FGTDO|)~a{lEBcbK%*_`a+|1xx4oLv0P_a?%)4-*5+T|*T4T?vxiBT zg{84UK|p|osmZ}XfP;gH(NRHx15L2$Y4w7u=luDPn?ApK^W%0gL4p(3OSFig0>FADUHUB@C#}vPt zCwJU5{dM)cQ^Lf=5mQsbbFkk*F-5eV%c BA)5dI literal 0 HcmV?d00001 diff --git a/ExtraTextures/Lasers/BirbAuraStart.png b/ExtraTextures/Lasers/BirbAuraStart.png new file mode 100644 index 0000000000000000000000000000000000000000..1a999c374dfc48d6d76144f319c60ad60c1cccdb GIT binary patch literal 864 zcmeAS@N?(olHy`uVBq!ia0vp^7l3#J2OE&A3wWRhq!^2X+?^QKos)S9a~60+7BevL9R^{>wmw> zc=CGr`~ST=J>u*Bf0E~j>yJ-pYETdmU}0)z|YNdE=nlMdjI(on8O7*N05pDq*`|Y3Hi_gpZlMNr={w|+*T1{$BgPD1V0G_j-(_PhmwoQy&yx{nD)v%MrzQm=88_;tWKXD+mWSlFIIS`3!KdAHDiA;>?b{brRX<(taCVlX*|9UDo^A zSG}^m`1Iz-h~mC;{>P%0J>PwNBq&Zy(LdQ?((0yX~U!X8-ETz+k2S*pQu&u mcA2FG>m|xg?-Xh3a@CTXDWkO4vtRqjjB literal 0 HcmV?d00001 diff --git a/NPCs/Bumblebirb/BirbGlow.png b/NPCs/Bumblebirb/BirbGlow.png new file mode 100644 index 0000000000000000000000000000000000000000..4b6fa2b27d61e049fefcb1982e1a2d15e990a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)Q6Ur|E2PH?b4()p+q%m#O7~;p6=6_AEuw9y89UE( zczp^!Y^Dhx%2C8{JYoJEsh82&;+=O$_PKX#9;QPMF>8g}R(nL5$2$$=#S$T8DA{~K zTun+w@7}W-nY~brICA>7s*GI>@Rvbrq7?*C#Z^QFU*F3=SIkMDEy; z-&6R#3cq9F_m24goEMgJYJ_f&h0*N7nh+Q}#f@_q`^utj>_$`e^+U#H-FaFb zlI#Q@s6=;v?&oZus?cY8vQAPg5I}GFZJ0k>j7@vPwla3^3T5YJw2ejff87E`n(Mae` zIx>yNUE+34Le|vH(3QW@!GEy+K%}PxajF`E?pgIc8#II^b9Yv81S66qXjm&)k)9rJ zI40yfe3XI3TVDwUrM^s!O~;Hc35`4aQQ|X65!hRnj5vkQmlLPHY@P6rOuF?u-=yZBDqQ{XYD? h8oz_#-P#7;ynMCnJGC9q&z3~&jw6qiA2}cQzW~tMJ%0cI literal 0 HcmV?d00001 diff --git a/NPCs/Bumblebirb/Bumblefuck.cs b/NPCs/Bumblebirb/Bumblefuck.cs index 156222b15c..45fce42bf0 100644 --- a/NPCs/Bumblebirb/Bumblefuck.cs +++ b/NPCs/Bumblebirb/Bumblefuck.cs @@ -10,6 +10,9 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -23,7 +26,8 @@ namespace CalamityMod.NPCs.Bumblebirb { DisplayName.SetDefault("Bumblebirb"); Main.npcFrameCount[npc.type] = 6; - } + NPCID.Sets.TrailingMode[npc.type] = 1; + } public override string Texture => "CalamityMod/NPCs/Bumblebirb/Birb"; public override string BossHeadTexture => "CalamityMod/NPCs/Bumblebirb/Birb_Head_Boss"; @@ -76,9 +80,21 @@ namespace CalamityMod.NPCs.Bumblebirb bossBag = ModContent.ItemType(); } - public override void AI() + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(npc.dontTakeDamage); + writer.Write(npc.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + npc.dontTakeDamage = reader.ReadBoolean(); + npc.localAI[0] = reader.ReadSingle(); + } + + public override void AI() { - npc.visualOffset = new Vector2(20f, 50f); + //npc.visualOffset = new Vector2(20f, 50f); CalamityAI.BumblebirbAI(npc, mod); } @@ -90,32 +106,280 @@ namespace CalamityMod.NPCs.Bumblebirb public override void FindFrame(int frameHeight) { - bool lightningBreathAttack = false; //leaving this for fabbo to sort - if (lightningBreathAttack) - { - npc.frame.Y = npc.frame.Height * 5; - } + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + + // Percent life remaining + float lifeRatio = (float)npc.life / (float)npc.lifeMax; + + // Phases + bool phase2 = lifeRatio < (revenge ? 0.75f : 0.5f) || death; + bool phase3 = lifeRatio < (death ? 0.4f : revenge ? 0.25f : 0.1f); + + float newPhaseTimer = 180f; + bool phaseSwitchPhase = (phase2 && calamityGlobalNPC.newAI[0] < newPhaseTimer && calamityGlobalNPC.newAI[2] != 1f) || + (phase3 && calamityGlobalNPC.newAI[1] < newPhaseTimer && calamityGlobalNPC.newAI[3] != 1f); + + if (phaseSwitchPhase) + { + float frameGateValue = phase3 ? calamityGlobalNPC.newAI[1] : calamityGlobalNPC.newAI[0]; + int num116 = 180; + if (frameGateValue < (float)(num116 - 60) || frameGateValue > (float)(num116 - 20)) + { + npc.frameCounter += 1D; + if (npc.frameCounter > 5D) + { + npc.frameCounter = 0D; + npc.frame.Y += frameHeight; + } + if (npc.frame.Y >= frameHeight * 5) + { + npc.frame.Y = 0; + } + } + else + { + npc.frame.Y = frameHeight * 4; + if (frameGateValue > (float)(num116 - 50) && frameGateValue < (float)(num116 - 25)) + { + npc.frame.Y = frameHeight * 5; + } + } + } + else if (npc.ai[0] == 5f) + { + int num115 = 120; + if (npc.ai[1] < (float)(num115 - 50) || npc.ai[1] > (float)(num115 - 10)) + { + npc.frameCounter += 1D; + if (npc.frameCounter > 5D) + { + npc.frameCounter = 0D; + npc.frame.Y += frameHeight; + } + if (npc.frame.Y >= frameHeight * 5) + { + npc.frame.Y = 0; + } + } + else + { + npc.frame.Y = frameHeight * 4; + if (npc.ai[1] > (float)(num115 - 40) && npc.ai[1] < (float)(num115 - 15)) + { + npc.frame.Y = frameHeight * 5; + } + } + } else { - if (npc.frameCounter >= 5) //iban said the time between frames was 5 so using that as a base + npc.frameCounter += (npc.ai[0] == 3.2f ? 1.5 : 1D); + if (npc.frameCounter > 4D) //iban said the time between frames was 5 so using that as a base { - if (npc.frame.Y >= npc.frame.Height * 4) //frame 5 or 6 for transitioning from open jaw - { - npc.frame.Y = 0; - } - else - { - npc.frame.Y += npc.frame.Height; - } - npc.frameCounter = -1; //set to -1 to account for the framecounter increment shortly after + npc.frameCounter = 0D; + npc.frame.Y += frameHeight; } - } - npc.frameCounter++; - if (npc.ai[0] == 3.2f) - npc.frameCounter += 0.5; + if (npc.frame.Y >= frameHeight * 5) + { + npc.frame.Y = 0; + } + } } - public override void BossLoot(ref string name, ref int potionType) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + + bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; + + // Percent life remaining + float lifeRatio = (float)npc.life / (float)npc.lifeMax; + + // Phases + bool phase2 = lifeRatio < (revenge ? 0.75f : 0.5f) || death; + bool phase3 = lifeRatio < (death ? 0.4f : revenge ? 0.25f : 0.1f); + + float newPhaseTimer = 180f; + bool phaseSwitchPhase = (phase2 && calamityGlobalNPC.newAI[0] < newPhaseTimer && calamityGlobalNPC.newAI[2] != 1f) || + (phase3 && calamityGlobalNPC.newAI[1] < newPhaseTimer && calamityGlobalNPC.newAI[3] != 1f); + + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Texture2D texture2D15 = Main.npcTexture[npc.type]; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Color color = lightColor; + Color color36 = phase2 && calamityGlobalNPC.newAI[2] == 1f ? Color.Yellow : Color.White; + + float amount9 = 0f; + int num150 = 120; + int num151 = 60; + + if (phase3 && calamityGlobalNPC.newAI[3] == 1f) + { + color = buffColor(color, 0.4f, 0.8f, 0.4f, 1f); + } + else if (phase3 && calamityGlobalNPC.newAI[1] > (float)num150) + { + float num152 = calamityGlobalNPC.newAI[1] - (float)num150; + num152 /= (float)num151; + color = buffColor(color, 1f - 0.5f * num152, 1f - 0.5f * num152, 1f - 0.3f * num152, 1f); + } + else if (phase2 && calamityGlobalNPC.newAI[2] == 1f) + { + color = buffColor(color, 0.5f, 0.7f, 0.5f, 1f); + } + else if (phase2 && calamityGlobalNPC.newAI[0] > (float)num150) + { + float num152 = calamityGlobalNPC.newAI[0] - (float)num150; + num152 /= (float)num151; + color = buffColor(color, 1f - 0.5f * num152, 1f - 0.5f * num152, 1f - 0.3f * num152, 1f); + } + + int num153 = 10; + int num154 = 2; + if (npc.ai[0] == 0f || npc.ai[0] == 3.1f || npc.ai[0] == 4f || npc.ai[0] == 4.2f) + { + num153 = 4; + } + if (npc.ai[0] == 1f || npc.ai[0] == 3f || npc.ai[0] == 4.1f) + { + num153 = 7; + } + if (npc.ai[0] == 2f || npc.ai[0] == 3.2f) + { + color36 = Color.Yellow; + amount9 = 0.5f; + } + else + { + color = lightColor; + } + + for (int num155 = 1; num155 < num153; num155 += num154) + { + 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 - Main.screenPosition; + vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + vector41 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, new Rectangle?(npc.frame), color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + } + + int num156 = 0; + float num157 = 0f; + float scaleFactor9 = 0f; + + if (npc.ai[0] == 0f || npc.ai[0] == 3.1f || npc.ai[0] == 4f || npc.ai[0] == 4.2f) + { + num156 = 4; + } + + if (npc.ai[0] == 5f) + { + int num158 = 60; + int num159 = 30; + if (npc.ai[1] > (float)num158) + { + num156 = 6; + num157 = 1f - (float)Math.Cos((double)((npc.ai[1] - (float)num158) / (float)num159 * MathHelper.TwoPi)); + num157 /= 3f; + scaleFactor9 = 40f; + } + } + + if (phaseSwitchPhase && (calamityGlobalNPC.newAI[0] > (float)num150 || calamityGlobalNPC.newAI[1] > (float)num150)) + { + num156 = 6; + num157 = 1f - (float)Math.Cos((double)(((phase3 ? calamityGlobalNPC.newAI[1] : calamityGlobalNPC.newAI[0]) - (float)num150) / (float)num151 * MathHelper.TwoPi)); + num157 /= 3f; + scaleFactor9 = 60f; + } + + for (int num160 = 0; num160 < num156; num160++) + { + Color color39 = lightColor; + 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 - Main.screenPosition; + vector42 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + vector42 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); + spriteBatch.Draw(texture2D15, vector42, new Rectangle?(npc.frame), color39, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + } + + Color color2 = lightColor; + color2 = Color.Lerp(color2, color36, amount9); + color2 = npc.GetAlpha(color2); + Vector2 vector43 = npc.Center - Main.screenPosition; + vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, new Rectangle?(npc.frame), (phase3 && calamityGlobalNPC.newAI[3] == 1f ? color2 : npc.GetAlpha(lightColor)), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + + if (phase2) + { + texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/Bumblebirb/BirbGlow"); + Color color40 = Color.Lerp(Color.White, Color.Red, 0.5f); + color36 = Color.Red; + + amount9 = 1f; + num157 = 0.5f; + scaleFactor9 = 10f; + num154 = 1; + + if (phaseSwitchPhase) + { + float num161 = (phase3 ? calamityGlobalNPC.newAI[1] : calamityGlobalNPC.newAI[0]) - (float)num150; + num161 /= (float)num151; + color36 *= num161; + color40 *= num161; + } + + for (int num163 = 1; num163 < num153; num163 += num154) + { + 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 - Main.screenPosition; + vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + vector44 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); + spriteBatch.Draw(texture2D15, vector44, new Rectangle?(npc.frame), color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + } + + for (int num164 = 1; num164 < num156; num164++) + { + 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 - Main.screenPosition; + vector45 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + vector45 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); + spriteBatch.Draw(texture2D15, vector45, new Rectangle?(npc.frame), color42, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + } + + spriteBatch.Draw(texture2D15, vector43, new Rectangle?(npc.frame), color40, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + } + + return false; + } + + private static Color buffColor(Color newColor, float R, float G, float B, float A) + { + newColor.R = (byte)((float)newColor.R * R); + newColor.G = (byte)((float)newColor.G * G); + newColor.B = (byte)((float)newColor.B * B); + newColor.A = (byte)((float)newColor.A * A); + return newColor; + } + + public override void BossLoot(ref string name, ref int potionType) { name = "A Bumblebirb"; potionType = ItemID.SuperHealingPotion; diff --git a/NPCs/Bumblebirb/Bumblefuck2.cs b/NPCs/Bumblebirb/Bumblefuck2.cs index 830d01b7eb..9534e5837e 100644 --- a/NPCs/Bumblebirb/Bumblefuck2.cs +++ b/NPCs/Bumblebirb/Bumblefuck2.cs @@ -1,6 +1,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,7 +14,8 @@ namespace CalamityMod.NPCs.Bumblebirb { DisplayName.SetDefault("Bumblebirb"); Main.npcFrameCount[npc.type] = 6; - } + NPCID.Sets.TrailingMode[npc.type] = 1; + } public override string Texture => "CalamityMod/NPCs/Bumblebirb/Birb"; @@ -59,12 +61,15 @@ namespace CalamityMod.NPCs.Bumblebirb public override void AI() { - npc.visualOffset = new Vector2(10, 40); + //npc.visualOffset = new Vector2(10, 40); Player player = Main.player[npc.target]; Vector2 vector = npc.Center; npc.damage = npc.defDamage; - if (Vector2.Distance(player.Center, vector) > 5600f) + float rotationMult = 4f; + float rotationAmt = 0.04f; + + if (Vector2.Distance(player.Center, vector) > 5600f) { if (npc.timeLeft > 5) { @@ -75,7 +80,7 @@ namespace CalamityMod.NPCs.Bumblebirb npc.noTileCollide = false; npc.noGravity = true; - npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.05f) / 10f; + npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt * 1.25f) / 10f; if (npc.ai[0] == 0f || npc.ai[0] == 1f) { @@ -202,7 +207,7 @@ namespace CalamityMod.NPCs.Bumblebirb npc.direction = 1; } npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.04f) / 10f; + npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt) / 10f; Vector2 value45 = Main.player[npc.target].Center - npc.Center; if (value45.Length() < 800f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) { @@ -235,7 +240,7 @@ namespace CalamityMod.NPCs.Bumblebirb npc.direction = 1; } npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * 7f + npc.velocity.X * 0.05f) / 8f; + npc.rotation = (npc.rotation * rotationMult * 0.75f + npc.velocity.X * rotationAmt * 1.25f) / 8f; npc.noTileCollide = true; Vector2 vector242 = Main.player[npc.target].Center - npc.Center; vector242.Y -= 8f; @@ -312,32 +317,51 @@ namespace CalamityMod.NPCs.Bumblebirb public override void FindFrame(int frameHeight) { - bool lightningBreathAttack = false; //leaving this for fabbo to sort - if (lightningBreathAttack) - { - npc.frame.Y = npc.frame.Height * 5; - } - else - { - if (npc.frameCounter >= 5) //iban said the time between frames was 5 so using that as a base - { - if (npc.frame.Y >= npc.frame.Height * 4) //frame 5 or 6 for transitioning from open jaw - { - npc.frame.Y = 0; - } - else - { - npc.frame.Y += npc.frame.Height; - } - npc.frameCounter = -1; //set to -1 to account for the framecounter increment shortly after - } - } - npc.frameCounter++; - if (npc.ai[0] == 2.1f) - npc.frameCounter += 0.5; + npc.frameCounter += (npc.ai[0] == 2.1f ? 1.5 : 1D); + if (npc.frameCounter > 4D) //iban said the time between frames was 5 so using that as a base + { + npc.frameCounter = 0D; + npc.frame.Y += frameHeight; + } + if (npc.frame.Y >= frameHeight * 4) + { + npc.frame.Y = 0; + } } - public override void HitEffect(int hitDirection, double damage) + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (npc.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Texture2D texture2D15 = Main.npcTexture[npc.type]; + Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Color color36 = Color.Gold; + float amount9 = 0.5f; + int num153 = npc.ai[0] == 2.1f ? 7 : 0; + + for (int num155 = 1; num155 < num153; num155 += 2) + { + Color color38 = lightColor; + 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 - Main.screenPosition; + vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + vector41 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); + spriteBatch.Draw(texture2D15, vector41, new Rectangle?(npc.frame), color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + } + + Vector2 vector43 = npc.Center - Main.screenPosition; + vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); + spriteBatch.Draw(texture2D15, vector43, new Rectangle?(npc.frame), npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + + return false; + } + + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index c255833660..83a636f6bf 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -13,6 +13,7 @@ using CalamityMod.NPCs.OldDuke; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Audio; using System; using Terraria; using Terraria.ID; @@ -3636,6 +3637,8 @@ namespace CalamityMod.NPCs #region Bumblebirb public static void BumblebirbAI(NPC npc, Mod mod) { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + // Get a target if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) npc.TargetClosest(true); @@ -3643,6 +3646,8 @@ namespace CalamityMod.NPCs Player player = Main.player[npc.target]; // Variables + float rotationMult = 3f; + float rotationAmt = 0.03f; bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; bool death = CalamityWorld.death || CalamityWorld.bossRushActive; Vector2 vector = npc.Center; @@ -3655,7 +3660,7 @@ namespace CalamityMod.NPCs if (!player.active || player.dead || Vector2.Distance(player.Center, vector) > 5600f) { - npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.04f) / 10f; + npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt) / 10f; if (npc.velocity.Y > 3f) npc.velocity.Y = 3f; @@ -3687,18 +3692,97 @@ namespace CalamityMod.NPCs float lifeRatio = (float)npc.life / (float)npc.lifeMax; // Phases - float mult = 1f + - (revenge ? 0.25f : 0f) + - (death ? 0.25f : 0f); - bool phase2 = lifeRatio < 0.5f * mult; - bool phase3 = lifeRatio < 0.1f * mult; + bool phase2 = lifeRatio < (revenge ? 0.75f : 0.5f) || death; + bool phase3 = lifeRatio < (death ? 0.4f : revenge ? 0.25f : 0.1f); + + float newPhaseTimer = 180f; + bool phaseSwitchPhase = (phase2 && calamityGlobalNPC.newAI[0] < newPhaseTimer && calamityGlobalNPC.newAI[2] != 1f) || + (phase3 && calamityGlobalNPC.newAI[1] < newPhaseTimer && calamityGlobalNPC.newAI[3] != 1f); + + npc.dontTakeDamage = phaseSwitchPhase; + + if (phaseSwitchPhase) + { + npc.collideX = false; + npc.collideY = false; + npc.noTileCollide = true; + + if (npc.velocity.X < 0f) + npc.direction = -1; + else if (npc.velocity.X > 0f) + npc.direction = 1; + + npc.spriteDirection = npc.direction; + npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt) / 10f; + + if (phase3) + { + calamityGlobalNPC.newAI[1] += 1f; + + // Sound + if (calamityGlobalNPC.newAI[1] == newPhaseTimer - 60f) + { + SoundEffectInstance sound = Main.PlaySound(SoundID.DD2_BetsyScream, (int)npc.position.X, (int)npc.position.Y); + sound.Pitch = 0.25f; + } + + if (calamityGlobalNPC.newAI[1] >= newPhaseTimer) + { + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[3] = 1f; + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + } + else + { + calamityGlobalNPC.newAI[0] += 1f; + + // Sound + if (calamityGlobalNPC.newAI[0] == newPhaseTimer - 60f) + { + SoundEffectInstance sound = Main.PlaySound(SoundID.DD2_BetsyScream, (int)npc.position.X, (int)npc.position.Y); + sound.Pitch = 0.25f; + } + + if (calamityGlobalNPC.newAI[0] >= newPhaseTimer) + { + calamityGlobalNPC.newAI[0] = 0f; + calamityGlobalNPC.newAI[2] = 1f; + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + } + + Vector2 value52 = player.Center - npc.Center; + float scaleFactor16 = 4f + value52.Length() / 100f; + float num1308 = 25f; + value52.Normalize(); + value52 *= scaleFactor16; + npc.velocity = (npc.velocity * (num1308 - 1f) + value52) / num1308; + npc.netSpam = 5; + if (Main.netMode == NetmodeID.Server) + { + NetMessage.SendData(23, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); + } + return; + } // Max spawn amount - int num1305 = revenge ? 4 : 3; - if (death) - num1305 = 5; + int num1305 = revenge ? 3 : 2; if (phase2) - num1305 = death ? 3 : 2; + num1305 = death ? 2 : 1; + + // Variable for charging + float chargeDistance = 600f; + if (phase2) + chargeDistance -= 50f; + if (phase3) + chargeDistance -= 50f; // Don't collide with tiles, disable gravity npc.noTileCollide = false; @@ -3717,7 +3801,7 @@ namespace CalamityMod.NPCs // Direction and rotation npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.05f) / 10f; + npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt * 1.25f) / 10f; // Slow down if colliding with tiles if (npc.collideX) @@ -3771,390 +3855,420 @@ namespace CalamityMod.NPCs npc.netUpdate = true; while (npc.ai[0] == 0f) { - int damage = Main.expertMode ? 50 : 60; + if (phase2) + npc.localAI[0] += 1f; - int num1307 = phase2 ? Main.rand.Next(2) + 1 : Main.rand.Next(3); - if (phase3) - num1307 = 1; + bool canHit = Collision.CanHit(npc.Center, 1, 1, player.Center, 1, 1); - if (num1307 == 0 && Collision.CanHit(npc.Center, 1, 1, player.Center, 1, 1)) + if (npc.localAI[0] >= (phase3 ? 7 : 9) && canHit) { npc.TargetClosest(true); - npc.ai[0] = 2f; + npc.ai[0] = 5f; + npc.localAI[0] = 0f; } - else if (num1307 == 1) + else { - npc.TargetClosest(true); - npc.ai[0] = 3f; - if (phase2) + int num1307 = phase2 ? Main.rand.Next(2) + 1 : Main.rand.Next(3); + if (phase3) + num1307 = 1; + + int damage = Main.expertMode ? 50 : 60; + + if (num1307 == 0 && canHit) { - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 102); - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)Main.rand.Next(-2, 3), -4f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + npc.TargetClosest(true); + npc.ai[0] = 2f; } - } - else if (NPC.CountNPCS(ModContent.NPCType()) < num1305) - { - npc.TargetClosest(true); - npc.ai[0] = 4f; - Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 102); - int featherAmt = phase2 ? 3 : 6; - if (death) - featherAmt *= 2; - for (int num186 = 0; num186 < featherAmt; num186++) + else if (num1307 == 1) { - Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)Main.rand.Next(-4, 5), -3f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + npc.TargetClosest(true); + npc.ai[0] = 3f; + if (phase2) + { + Main.PlaySound(SoundID.Item102, (int)npc.position.X, (int)npc.position.Y); + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)Main.rand.Next(-2, 3), -4f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + } + } + else if (NPC.CountNPCS(ModContent.NPCType()) < num1305) + { + npc.TargetClosest(true); + npc.ai[0] = 4f; + Main.PlaySound(SoundID.Item102, (int)npc.position.X, (int)npc.position.Y); + int featherAmt = phase2 ? 3 : 6; + if (death) + featherAmt *= 2; + for (int num186 = 0; num186 < featherAmt; num186++) + { + Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)Main.rand.Next(-4, 5), -3f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + } } } } } } - else + + // Fly to target + else if (npc.ai[0] == 1f) { - // Fly to target - if (npc.ai[0] == 1f) + npc.collideX = false; + npc.collideY = false; + npc.noTileCollide = true; + + if (npc.velocity.X < 0f) + npc.direction = -1; + else if (npc.velocity.X > 0f) + npc.direction = 1; + + npc.spriteDirection = npc.direction; + npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt) / 10f; + + Vector2 value52 = player.Center - npc.Center; + if (value52.Length() < 800f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) { - npc.collideX = false; - npc.collideY = false; - npc.noTileCollide = true; + npc.TargetClosest(true); + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + + float scaleFactor16 = 14f + value52.Length() / 100f; //7 + float num1308 = 25f; + value52.Normalize(); + value52 *= scaleFactor16; + npc.velocity = (npc.velocity * (num1308 - 1f) + value52) / num1308; + npc.netSpam = 5; + if (Main.netMode == NetmodeID.Server) + { + NetMessage.SendData(23, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); + } + } + + // Fly towards target quickly + else if (npc.ai[0] == 2f) + { + if (npc.target < 0 || !player.active || player.dead) + { + npc.TargetClosest(true); + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + + if (player.Center.X - 10f < npc.Center.X) + npc.direction = -1; + else if (player.Center.X + 10f > npc.Center.X) + npc.direction = 1; + + npc.spriteDirection = npc.direction; + npc.rotation = (npc.rotation * rotationMult * 0.5f + npc.velocity.X * rotationAmt * 1.25f) / 5f; + + if (npc.collideX) + { + npc.velocity.X *= (-npc.oldVelocity.X * 0.5f); + if (npc.velocity.X > 4f) + npc.velocity.X = 4f; + if (npc.velocity.X < -4f) + npc.velocity.X = -4f; + } + if (npc.collideY) + { + npc.velocity.Y *= (-npc.oldVelocity.Y * 0.5f); + if (npc.velocity.Y > 4f) + npc.velocity.Y = 4f; + if (npc.velocity.Y < -4f) + npc.velocity.Y = -4f; + } + + Vector2 value53 = player.Center - npc.Center; + value53.Y -= 20f; + npc.ai[2] += 0.0222222228f; + if (Main.expertMode) + npc.ai[2] += 0.0166666675f; + + float scaleFactor17 = 8f + npc.ai[2] + value53.Length() / 120f; //4 + float num1309 = 20f; + value53.Normalize(); + value53 *= scaleFactor17; + npc.velocity = (npc.velocity * (num1309 - 1f) + value53) / num1309; + + npc.ai[1] += 1f; + if (npc.ai[1] >= 120f || !Collision.CanHit(npc.Center, 1, 1, player.Center, 1, 1)) + { + npc.TargetClosest(true); + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + } + + // Line up charge + else if (npc.ai[0] == 3f) + { + npc.noTileCollide = true; + + if (npc.velocity.X < 0f) + npc.direction = -1; + else + npc.direction = 1; + + npc.spriteDirection = npc.direction; + npc.rotation = (npc.rotation * rotationMult * 0.5f + npc.velocity.X * rotationAmt * 0.85f) / 5f; + + Vector2 value54 = player.Center - npc.Center; + value54.Y -= 12f; + if (npc.Center.X > player.Center.X) + value54.X += chargeDistance; + else + value54.X -= chargeDistance; + + if (Math.Abs(npc.Center.X - player.Center.X) > chargeDistance - 50f && Math.Abs(npc.Center.Y - player.Center.Y) < (phase3 ? 100f : 20f)) + { + npc.ai[0] = 3.1f; + npc.ai[1] = 0f; + } + + npc.ai[1] += 0.0333333351f; + float scaleFactor18 = 18f + npc.ai[1]; + float num1310 = 4f; + value54.Normalize(); + value54 *= scaleFactor18; + npc.velocity = (npc.velocity * (num1310 - 1f) + value54) / num1310; + } + + // Prepare to charge + else if (npc.ai[0] == 3.1f) + { + npc.noTileCollide = true; + + npc.rotation = (npc.rotation * rotationMult * 0.5f + npc.velocity.X * rotationAmt * 0.85f) / 5f; + + Vector2 vector206 = player.Center - npc.Center; + vector206.Y -= 12f; + float scaleFactor19 = 32f; //16 + float num1311 = 8f; + vector206.Normalize(); + vector206 *= scaleFactor19; + npc.velocity = (npc.velocity * (num1311 - 1f) + vector206) / num1311; + + if (npc.velocity.X < 0f) + npc.direction = -1; + else + npc.direction = 1; + + npc.spriteDirection = npc.direction; + + npc.ai[1] += 1f; + if (npc.ai[1] > 10f) + { + npc.velocity = vector206; if (npc.velocity.X < 0f) npc.direction = -1; - else if (npc.velocity.X > 0f) - npc.direction = 1; - - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.04f) / 10f; - - Vector2 value52 = player.Center - npc.Center; - if (value52.Length() < 800f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.TargetClosest(true); - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - - float scaleFactor16 = 14f + value52.Length() / 100f; //7 - float num1308 = 25f; - value52.Normalize(); - value52 *= scaleFactor16; - npc.velocity = (npc.velocity * (num1308 - 1f) + value52) / num1308; - npc.netSpam = 5; - if (Main.netMode == NetmodeID.Server) - { - NetMessage.SendData(23, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); - } - return; - } - - // Fly towards target quickly - if (npc.ai[0] == 2f) - { - if (npc.target < 0 || !player.active || player.dead) - { - npc.TargetClosest(true); - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - - if (player.Center.X - 10f < npc.Center.X) - npc.direction = -1; - else if (player.Center.X + 10f > npc.Center.X) - npc.direction = 1; - - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.05f) / 5f; - - if (npc.collideX) - { - npc.velocity.X *= (-npc.oldVelocity.X * 0.5f); - if (npc.velocity.X > 4f) - npc.velocity.X = 4f; - if (npc.velocity.X < -4f) - npc.velocity.X = -4f; - } - if (npc.collideY) - { - npc.velocity.Y *= (-npc.oldVelocity.Y * 0.5f); - if (npc.velocity.Y > 4f) - npc.velocity.Y = 4f; - if (npc.velocity.Y < -4f) - npc.velocity.Y = -4f; - } - - Vector2 value53 = player.Center - npc.Center; - value53.Y -= 20f; - npc.ai[2] += 0.0222222228f; - if (Main.expertMode) - npc.ai[2] += 0.0166666675f; - - float scaleFactor17 = 8f + npc.ai[2] + value53.Length() / 120f; //4 - float num1309 = 20f; - value53.Normalize(); - value53 *= scaleFactor17; - npc.velocity = (npc.velocity * (num1309 - 1f) + value53) / num1309; - - npc.ai[1] += 1f; - if (npc.ai[1] >= 120f || !Collision.CanHit(npc.Center, 1, 1, player.Center, 1, 1)) - { - npc.TargetClosest(true); - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - } - else - { - // Variable for charging - float chargeDistance = 600f; - if (phase2) - chargeDistance -= 50f; - if (phase3) - chargeDistance -= 50f; - - // Line up charge - if (npc.ai[0] == 3f) - { - npc.noTileCollide = true; - - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.035f) / 5f; - - Vector2 value54 = player.Center - npc.Center; - value54.Y -= 12f; - if (npc.Center.X > player.Center.X) - value54.X += chargeDistance; - else - value54.X -= chargeDistance; - - if (Math.Abs(npc.Center.X - player.Center.X) > chargeDistance - 50f && Math.Abs(npc.Center.Y - player.Center.Y) < (phase3 ? 100f : 20f)) - { - npc.ai[0] = 3.1f; - npc.ai[1] = 0f; - } - - npc.ai[1] += 0.0333333351f; - float scaleFactor18 = 18f + npc.ai[1]; - float num1310 = 4f; - value54.Normalize(); - value54 *= scaleFactor18; - npc.velocity = (npc.velocity * (num1310 - 1f) + value54) / num1310; - return; - } - - // Prepare to charge - if (npc.ai[0] == 3.1f) - { - npc.noTileCollide = true; - - npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.035f) / 5f; - - Vector2 vector206 = player.Center - npc.Center; - vector206.Y -= 12f; - float scaleFactor19 = 32f; //16 - float num1311 = 8f; - vector206.Normalize(); - vector206 *= scaleFactor19; - npc.velocity = (npc.velocity * (num1311 - 1f) + vector206) / num1311; - - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.spriteDirection = npc.direction; - - npc.ai[1] += 1f; - if (npc.ai[1] > 10f) - { - npc.velocity = vector206; - - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.ai[0] = 3.2f; - npc.ai[1] = 0f; - npc.ai[1] = (float)npc.direction; - } - } else + npc.direction = 1; + + npc.ai[0] = 3.2f; + npc.ai[1] = 0f; + npc.ai[1] = (float)npc.direction; + } + } + + // Charge + else if (npc.ai[0] == 3.2f) + { + npc.damage = (int)((double)npc.defDamage * 1.5); + + npc.collideX = false; + npc.collideY = false; + npc.noTileCollide = true; + + npc.ai[2] += 0.0333333351f; + npc.velocity.X = (32f + npc.ai[2]) * npc.ai[1]; + + if ((npc.ai[1] > 0f && npc.Center.X > player.Center.X + (chargeDistance - 140f)) || (npc.ai[1] < 0f && npc.Center.X < player.Center.X - (chargeDistance - 140f))) + { + if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) { - // Charge - if (npc.ai[0] == 3.2f) + npc.TargetClosest(true); + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + else if (Math.Abs(npc.Center.X - player.Center.X) > chargeDistance + 200f) + { + npc.TargetClosest(true); + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + } + } + + npc.rotation = (npc.rotation * rotationMult * 0.5f + npc.velocity.X * rotationAmt * 0.85f) / 5f; + } + + // Find tile coordinates for birb spawn + else if (npc.ai[0] == 4f) + { + npc.ai[0] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.ai[1] = -1f; + npc.ai[2] = -1f; + + for (int num1312 = 0; num1312 < 1000; num1312++) + { + int num1313 = (int)player.Center.X / 16; + int num1314 = (int)player.Center.Y / 16; + + int num1315 = 30 + num1312 / 50; + int num1316 = 20 + num1312 / 75; + + num1313 += Main.rand.Next(-num1315, num1315 + 1); + num1314 += Main.rand.Next(-num1316, num1316 + 1); + + if (!WorldGen.SolidTile(num1313, num1314)) { - npc.damage = (int)((double)npc.defDamage * 1.5); + while (!WorldGen.SolidTile(num1313, num1314) && (double)num1314 < Main.worldSurface) + num1314++; - npc.collideX = false; - npc.collideY = false; - npc.noTileCollide = true; - - npc.ai[2] += 0.0333333351f; - npc.velocity.X = (32f + npc.ai[2]) * npc.ai[1]; - - if ((npc.ai[1] > 0f && npc.Center.X > player.Center.X + (chargeDistance - 140f)) || (npc.ai[1] < 0f && npc.Center.X < player.Center.X - (chargeDistance - 140f))) + if ((new Vector2((float)(num1313 * 16 + 8), (float)(num1314 * 16 + 8)) - player.Center).Length() < 1600f) { - if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.TargetClosest(true); - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - else if (Math.Abs(npc.Center.X - player.Center.X) > chargeDistance + 200f) - { - npc.TargetClosest(true); - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } + npc.ai[0] = 4.1f; + npc.ai[1] = (float)num1313; + npc.ai[2] = (float)num1314; + break; } - - npc.rotation = (npc.rotation * 4f + npc.velocity.X * 0.035f) / 5f; - return; - } - - // Find tile coordinates for birb spawn - if (npc.ai[0] == 4f) - { - npc.ai[0] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[1] = -1f; - npc.ai[2] = -1f; - - for (int num1312 = 0; num1312 < 1000; num1312++) - { - int num1313 = (int)player.Center.X / 16; - int num1314 = (int)player.Center.Y / 16; - - int num1315 = 30 + num1312 / 50; - int num1316 = 20 + num1312 / 75; - - num1313 += Main.rand.Next(-num1315, num1315 + 1); - num1314 += Main.rand.Next(-num1316, num1316 + 1); - - if (!WorldGen.SolidTile(num1313, num1314)) - { - while (!WorldGen.SolidTile(num1313, num1314) && (double)num1314 < Main.worldSurface) - num1314++; - - if ((new Vector2((float)(num1313 * 16 + 8), (float)(num1314 * 16 + 8)) - player.Center).Length() < 1600f) - { - npc.ai[0] = 4.1f; - npc.ai[1] = (float)num1313; - npc.ai[2] = (float)num1314; - break; - } - } - } - } - - npc.netUpdate = true; - return; - } - - // Move to birb spawn location - if (npc.ai[0] == 4.1f) - { - if (npc.velocity.X < -2f) - npc.direction = -1; - else if (npc.velocity.X > 2f) - npc.direction = 1; - - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.05f) / 10f; - - npc.noTileCollide = true; - - int num1317 = (int)npc.ai[1]; - int num1318 = (int)npc.ai[2]; - - float x2 = (float)(num1317 * 16 + 8); - float y2 = (float)(num1318 * 16 - 20); - - Vector2 vector207 = new Vector2(x2, y2); - vector207 -= npc.Center; - float num1319 = 12f + vector207.Length() / 150f; - if (num1319 > 20f) - num1319 = 20f; - - float num1320 = 10f; - if (vector207.Length() < 10f) - npc.ai[0] = 4.2f; - - vector207.Normalize(); - vector207 *= num1319; - npc.velocity = (npc.velocity * (num1320 - 1f) + vector207) / num1320; - return; - } - - // Spawn birbs - if (npc.ai[0] == 4.2f) - { - npc.rotation = (npc.rotation * 9f + npc.velocity.X * 0.05f) / 10f; - - npc.noTileCollide = true; - - int num1321 = (int)npc.ai[1]; - int num1322 = (int)npc.ai[2]; - - float x3 = (float)(num1321 * 16 + 8); - float y3 = (float)(num1322 * 16 - 20); - - Vector2 vector208 = new Vector2(x3, y3); - vector208 -= npc.Center; - - float num1323 = 4f; //4 - float num1324 = 2f; //2 - - if (Main.netMode != NetmodeID.MultiplayerClient && vector208.Length() < 4f) - { - int num1325 = 10; - if (Main.expertMode) - num1325 = (int)((double)num1325 * 0.75); - - npc.ai[3] += 1f; - if (npc.ai[3] == (float)num1325) - NPC.NewNPC(num1321 * 16 + 8, num1322 * 16, ModContent.NPCType(), npc.whoAmI, 0f, 0f, 0f, 0f, 255); - else if (npc.ai[3] == (float)(num1325 * 2)) - { - npc.TargetClosest(true); - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - - if (NPC.CountNPCS(ModContent.NPCType()) < num1305 && Main.rand.Next(5) != 0) - npc.ai[0] = 4f; - else if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - npc.ai[0] = 1f; - } - } - - if (vector208.Length() > num1323) - { - vector208.Normalize(); - vector208 *= num1323; - } - - npc.velocity = (npc.velocity * (num1324 - 1f) + vector208) / num1324; } } } + + npc.netUpdate = true; + } + + // Move to birb spawn location + else if (npc.ai[0] == 4.1f) + { + if (npc.velocity.X < -2f) + npc.direction = -1; + else if (npc.velocity.X > 2f) + npc.direction = 1; + + npc.spriteDirection = npc.direction; + npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt * 1.25f) / 10f; + + npc.noTileCollide = true; + + int num1317 = (int)npc.ai[1]; + int num1318 = (int)npc.ai[2]; + + float x2 = (float)(num1317 * 16 + 8); + float y2 = (float)(num1318 * 16 - 20); + + Vector2 vector207 = new Vector2(x2, y2); + vector207 -= npc.Center; + float num1319 = 12f + vector207.Length() / 150f; + if (num1319 > 20f) + num1319 = 20f; + + float num1320 = 10f; + if (vector207.Length() < 10f) + npc.ai[0] = 4.2f; + + vector207.Normalize(); + vector207 *= num1319; + npc.velocity = (npc.velocity * (num1320 - 1f) + vector207) / num1320; + } + + // Spawn birbs + else if (npc.ai[0] == 4.2f) + { + npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt * 1.25f) / 10f; + + npc.noTileCollide = true; + + int num1321 = (int)npc.ai[1]; + int num1322 = (int)npc.ai[2]; + + float x3 = (float)(num1321 * 16 + 8); + float y3 = (float)(num1322 * 16 - 20); + + Vector2 vector208 = new Vector2(x3, y3); + vector208 -= npc.Center; + + float num1323 = 4f; //4 + float num1324 = 2f; //2 + + if (Main.netMode != NetmodeID.MultiplayerClient && vector208.Length() < 4f) + { + int num1325 = 10; + if (Main.expertMode) + num1325 = (int)((double)num1325 * 0.75); + + npc.ai[3] += 1f; + if (npc.ai[3] == (float)num1325) + { + SoundEffectInstance sound = Main.PlaySound(SoundID.DD2_BetsySummon, (int)npc.position.X, (int)npc.position.Y); + sound.Pitch = 0.25f; + + NPC.NewNPC(num1321 * 16 + 8, num1322 * 16, ModContent.NPCType(), npc.whoAmI, 0f, 0f, 0f, 0f, 255); + } + else if (npc.ai[3] == (float)(num1325 * 2)) + { + npc.TargetClosest(true); + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + + if (NPC.CountNPCS(ModContent.NPCType()) < num1305 && Main.rand.Next(5) != 0) + npc.ai[0] = 4f; + else if (Collision.SolidCollision(npc.position, npc.width, npc.height)) + npc.ai[0] = 1f; + } + } + + if (vector208.Length() > num1323) + { + vector208.Normalize(); + vector208 *= num1323; + } + + npc.velocity = (npc.velocity * (num1324 - 1f) + vector208) / num1324; + } + + // Spit homing aura sphere + else if (npc.ai[0] == 5f) + { + // Velocity + npc.velocity *= 0.98f; + npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt) / 10f; + + // Play sound + float aiGateValue = 120f; + if (npc.ai[1] == aiGateValue - 30f) + { + Main.PlaySound(SoundID.DD2_BetsyFireballShot, (int)npc.position.X, (int)npc.position.Y); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 vector7 = npc.rotation.ToRotationVector2() * (Vector2.UnitX * (float)npc.direction) * (float)(npc.width + 20) / 2f + vector; + Projectile.NewProjectile(vector7.X, vector7.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, (float)(npc.target + 1)); + } + } + + npc.ai[1] += 1f; + if (npc.ai[1] >= aiGateValue) + { + npc.ai[0] = 0f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } } } #endregion diff --git a/NPCs/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index f54ad7ff2e..0be4e43729 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -105,7 +105,7 @@ namespace CalamityMod.NPCs.OldDuke if (npc.frameCounter > (double)num114) { npc.frameCounter = 0D; - npc.frame.Y = npc.frame.Y + frameHeight; + npc.frame.Y += frameHeight; } if (npc.frame.Y >= frameHeight * 6) { @@ -129,7 +129,7 @@ namespace CalamityMod.NPCs.OldDuke if (npc.frameCounter > 7D) { npc.frameCounter = 0D; - npc.frame.Y = npc.frame.Y + frameHeight; + npc.frame.Y += frameHeight; } if (npc.frame.Y >= frameHeight * 6) { @@ -154,7 +154,7 @@ namespace CalamityMod.NPCs.OldDuke if (npc.frameCounter > 7D) { npc.frameCounter = 0D; - npc.frame.Y = npc.frame.Y + frameHeight; + npc.frame.Y += frameHeight; } if (npc.frame.Y >= frameHeight * 6) { diff --git a/NPCs/OldDuke/OldDukeSharkron.cs b/NPCs/OldDuke/OldDukeSharkron.cs index 6d587d5eea..6fa1e52f2e 100644 --- a/NPCs/OldDuke/OldDukeSharkron.cs +++ b/NPCs/OldDuke/OldDukeSharkron.cs @@ -188,22 +188,6 @@ namespace CalamityMod.NPCs.OldDuke spriteBatch.Draw(texture2D15, vector41, new Rectangle?(npc.frame), color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } - int num156 = 0; - float num157 = 0f; - float scaleFactor9 = 0f; - - for (int num160 = 0; num160 < num156; num160++) - { - Color color39 = lightColor; - color39 = Color.Lerp(color39, color36, amount9); - color39 = npc.GetAlpha(color39); - color39 *= 1f - num157; - Vector2 vector42 = npc.Center + ((float)num160 / (float)num156 * 6.28318548f + npc.rotation).ToRotationVector2() * scaleFactor9 * num157 - Main.screenPosition; - vector42 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; - vector42 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector42, new Rectangle?(npc.frame), color39, npc.rotation, vector11, npc.scale, spriteEffects, 0f); - } - Vector2 vector43 = npc.Center - Main.screenPosition; vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); diff --git a/Projectiles/Boss/BirbAura.cs b/Projectiles/Boss/BirbAura.cs new file mode 100644 index 0000000000..7559e7c9a1 --- /dev/null +++ b/Projectiles/Boss/BirbAura.cs @@ -0,0 +1,187 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs.BrimstoneElemental; +using CalamityMod.Dusts; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.Enums; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Boss +{ + public class BirbAura : ModProjectile + { + float timer = 0f; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Birb Aura"); + } + + public override void SetDefaults() + { + projectile.width = 80; + projectile.height = 80; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.timeLeft = 1200; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + writer.Write(timer); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + timer = reader.ReadSingle(); + } + + public override void AI() + { + Vector2? vector78 = null; + + if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) + projectile.velocity = -Vector2.UnitY; + + Vector2 fireFrom = new Vector2(projectile.ai[0], projectile.ai[1]); + projectile.position = fireFrom - new Vector2((float)projectile.width, (float)projectile.height) / 2f; + + if (projectile.velocity.HasNaNs() || projectile.velocity == Vector2.Zero) + projectile.velocity = -Vector2.UnitY; + + if (timer > 0f) + timer -= 1f; + + float num801 = 1f; + + projectile.localAI[0] += 1f; + if (projectile.localAI[0] >= 1200f) + { + projectile.Kill(); + return; + } + + projectile.scale = (float)Math.Sin((double)(projectile.localAI[0] * Math.PI / 1200f)) * 10f * num801; + if (projectile.scale > num801) + projectile.scale = num801; + + float num804 = projectile.velocity.ToRotation(); + projectile.rotation = num804 - MathHelper.PiOver2; + projectile.velocity = num804.ToRotationVector2(); + + float num805 = 3f; //3f + float num806 = (float)projectile.width; + + Vector2 samplingPoint = projectile.Center; + if (vector78.HasValue) + samplingPoint = vector78.Value; + + float laserLength = MathHelper.Clamp(projectile.ai[1] - 160f, 1600f, 3600f); + float[] array3 = new float[(int)num805]; + Collision.LaserScan(samplingPoint, projectile.velocity, num806 * projectile.scale, laserLength, array3); + float num807 = 0f; + for (int num808 = 0; num808 < array3.Length; num808++) + { + num807 += array3[num808]; + } + num807 /= num805; + + float amount = 0.5f; + projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], num807, amount); + + DelegateMethods.v3_1 = new Vector3(0.9f, 0.3f, 0.3f); + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + } + + public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) + { + if (timer <= 0f && projectile.localAI[0] >= 120f) + { + if (projectile.owner == Main.myPlayer) + { + timer = 15f; + Vector2 fireFrom = new Vector2(target.Center.X, target.Center.Y - 900f); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), (int)target.Center.X, (int)target.Center.Y - 300); + Vector2 ai0 = target.Center - fireFrom; + float ai = (float)Main.rand.Next(100); + Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; + Projectile.NewProjectile(fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), projectile.damage, 0f, projectile.owner, ai0.ToRotation(), ai); + } + } + damage = 0; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + if (projectile.velocity == Vector2.Zero) + { + return false; + } + Texture2D texture = Main.projectileTexture[projectile.type]; + Texture2D texture2 = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/BirbAuraStart"); + Texture2D texture3 = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/BirbAuraEnd"); + float num223 = projectile.localAI[1]; //length of laser + Color color44 = new Color(128, 128, 128, 0); + Vector2 vector = projectile.Center - Main.screenPosition; + Rectangle? sourceRectangle2 = null; + spriteBatch.Draw(texture2, vector, sourceRectangle2, color44, projectile.rotation, texture2.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + num223 -= (float)(texture2.Height / 2 + texture3.Height) * projectile.scale; + Vector2 value20 = projectile.Center; + value20 += projectile.velocity * projectile.scale * (float)texture2.Height / 2f; + if (num223 > 0f) + { + float num224 = 0f; + Rectangle rectangle7 = new Rectangle(0, 16 * (projectile.timeLeft / 3 % 5), texture.Width, 16); + while (num224 + 1f < num223) + { + if (num223 - num224 < (float)rectangle7.Height) + { + rectangle7.Height = (int)(num223 - num224); + } + spriteBatch.Draw(texture, value20 - Main.screenPosition, new Rectangle?(rectangle7), color44, projectile.rotation, new Vector2((float)(rectangle7.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); + num224 += (float)rectangle7.Height * projectile.scale; + value20 += projectile.velocity * (float)rectangle7.Height * projectile.scale; + rectangle7.Y += 16; + if (rectangle7.Y + rectangle7.Height > texture.Height) + { + rectangle7.Y = 0; + } + } + } + Vector2 vector2 = value20 - Main.screenPosition; + sourceRectangle2 = null; + spriteBatch.Draw(texture3, vector2, sourceRectangle2, color44, projectile.rotation, texture3.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void CutTiles() + { + DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; + Vector2 unit = projectile.velocity; + Utils.PlotTileLine(projectile.Center, projectile.Center + unit * projectile.localAI[1], (float)projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (projHitbox.Intersects(targetHitbox)) + { + return true; + } + float num6 = 0f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 22f * projectile.scale, ref num6)) + { + return true; + } + return false; + } + } +} diff --git a/Projectiles/Boss/BirbAura.png b/Projectiles/Boss/BirbAura.png new file mode 100644 index 0000000000000000000000000000000000000000..3515f6998c9a2045122272c8341c167fb3297600 GIT binary patch literal 990 zcmeAS@N?(olHy`uVBq!ia0vp^7l8N!2OE$qa~60+7BevL9R^{>EefODb?f0LL`uyXUX?Ab5!i_{s^RZew zBm@usvoU}D@5!h9XOj>Cbouh(+iOha_uFs2cBgh<&M(<7tQbLx)pww9zTA8`GJ9SA z`E-)P`G4ad`HX8)-yIGZ5s1sd7cYY(3{$JC|1(;YMc>$;DrEu8lMJ4&elF{r5}E)n CJQGX+ literal 0 HcmV?d00001 diff --git a/Projectiles/Boss/BirbAuraFlare.cs b/Projectiles/Boss/BirbAuraFlare.cs new file mode 100644 index 0000000000..ef9a5e85bd --- /dev/null +++ b/Projectiles/Boss/BirbAuraFlare.cs @@ -0,0 +1,134 @@ +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class BirbAuraFlare : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Birb Aura Flare"); + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 32; + projectile.hostile = true; + projectile.ignoreWater = true; + projectile.penetrate = -1; + projectile.timeLeft = 600; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + } + + public override void AI() + { + if (projectile.ai[1] > 0f) + { + int num625 = (int)projectile.ai[1] - 1; + if (num625 < 255) + { + projectile.localAI[0] += 1f; + if (projectile.localAI[0] > 10f) + { + // Dust pulse effect + projectile.ai[0] = (float)Math.Abs(Math.Cos((double)MathHelper.ToRadians(projectile.localAI[0] * 2f))); + int num626 = 18; + for (int num627 = 0; num627 < num626; num627++) + { + Vector2 vector45 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * projectile.ai[0]; + vector45 = vector45.RotatedBy((double)(num627 - (num626 / 2 - 1)) * 3.1415926535897931 / (double)(float)num626, default) + projectile.Center; + Vector2 value15 = ((float)(Main.rand.NextDouble() * Math.PI) - MathHelper.PiOver2).ToRotationVector2() * (float)Main.rand.Next(3, 8); + int num628 = Dust.NewDust(vector45 + value15, 0, 0, 60, value15.X * 2f, value15.Y * 2f, 100, default, 1f); + Main.dust[num628].scale = 1.4f; + Main.dust[num628].noGravity = true; + Main.dust[num628].noLight = true; + Main.dust[num628].velocity /= 4f; + Main.dust[num628].velocity -= projectile.velocity; + } + } + + Vector2 value16 = Main.player[num625].Center - projectile.Center; + float num629 = 4f; + num629 += projectile.localAI[0] / 60f; + projectile.velocity = Vector2.Normalize(value16) * num629; + if (value16.Length() < 32f) + { + projectile.Kill(); + } + } + } + } + + public override void Kill(int timeLeft) + { + bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; + Main.PlaySound(SoundID.DD2_BetsyFireballImpact, (int)projectile.position.X, (int)projectile.position.Y); + int num226 = 36; + for (int num227 = 0; num227 < num226; num227++) + { + Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * MathHelper.TwoPi / (float)num226), default) + projectile.Center; + Vector2 vector7 = vector6 - projectile.Center; + int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 60, vector7.X, vector7.Y, 100, default, 1.4f); + Main.dust[num228].noGravity = true; + Main.dust[num228].noLight = true; + Main.dust[num228].velocity = vector7; + } + if (projectile.owner == Main.myPlayer) + { + int num231 = (int)(projectile.Center.Y / 16f); + int num232 = (int)(projectile.Center.X / 16f); + int num233 = 100; + if (num232 < 10) + { + num232 = 10; + } + if (num232 > Main.maxTilesX - 10) + { + num232 = Main.maxTilesX - 10; + } + if (num231 < 10) + { + num231 = 10; + } + if (num231 > Main.maxTilesY - num233 - 10) + { + num231 = Main.maxTilesY - num233 - 10; + } + int spawnAreaY = Main.maxTilesY - num231; + for (int num234 = num231; num234 < num231 + spawnAreaY; num234++) + { + Tile tile = Main.tile[num232, num234]; + if (tile.active() && !TileID.Sets.Platforms[tile.type] && (Main.tileSolid[(int)tile.type] || tile.liquid != 0)) + { + num231 = num234; + break; + } + } + float x = (float)(num232 * 16); + float y = (float)(num231 * 16 - 48); + Vector2 laserVelocity = new Vector2(x, 160f) - new Vector2(x, y); + laserVelocity.Normalize(); + int damage = Main.expertMode ? 75 : 100; + int num236 = Projectile.NewProjectile(x, y, 0f, laserVelocity.Y, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, x, y); + Main.projectile[num236].netUpdate = true; + } + } + } +} diff --git a/Projectiles/Boss/BirbAuraFlare.png b/Projectiles/Boss/BirbAuraFlare.png new file mode 100644 index 0000000000000000000000000000000000000000..2f776c6c064d002f028c0505f183c4eeea58a3fb GIT binary patch literal 159 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzwj^(N7l!{JxM1({$v_d#0*}aI z1_r*vAk26?e?JY5_^A`ZVjXUNFFz`?vA^Zz;H lHhz_aThA^(o7sQ@4lp`wVYY3xl?0j3;OXk;vd$@?2>?6iF-`yg literal 0 HcmV?d00001 diff --git a/Projectiles/Boss/BrimstoneRay.cs b/Projectiles/Boss/BrimstoneRay.cs index 33cb59a9c3..76ac79d3b3 100644 --- a/Projectiles/Boss/BrimstoneRay.cs +++ b/Projectiles/Boss/BrimstoneRay.cs @@ -142,7 +142,7 @@ namespace CalamityMod.Projectiles.Boss Color color44 = new Color(255, 255, 255, 0) * 0.9f; Vector2 vector = projectile.Center - Main.screenPosition; Rectangle? sourceRectangle2 = null; - Main.spriteBatch.Draw(texture2D19, vector, sourceRectangle2, color44, projectile.rotation, texture2D19.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture2D19, vector, sourceRectangle2, color44, projectile.rotation, texture2D19.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); num223 -= (float)(texture2D19.Height / 2 + texture2D21.Height) * projectile.scale; Vector2 value20 = projectile.Center; value20 += projectile.velocity * projectile.scale * (float)texture2D19.Height / 2f; @@ -156,7 +156,7 @@ namespace CalamityMod.Projectiles.Boss { rectangle7.Height = (int)(num223 - num224); } - Main.spriteBatch.Draw(texture2D20, value20 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(rectangle7), color44, projectile.rotation, new Vector2((float)(rectangle7.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture2D20, value20 - Main.screenPosition, new Rectangle?(rectangle7), color44, projectile.rotation, new Vector2((float)(rectangle7.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f); num224 += (float)rectangle7.Height * projectile.scale; value20 += projectile.velocity * (float)rectangle7.Height * projectile.scale; rectangle7.Y += 16; @@ -168,7 +168,7 @@ namespace CalamityMod.Projectiles.Boss } Vector2 vector2 = value20 - Main.screenPosition; sourceRectangle2 = null; - Main.spriteBatch.Draw(texture2D21, vector2, sourceRectangle2, color44, projectile.rotation, texture2D21.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(texture2D21, vector2, sourceRectangle2, color44, projectile.rotation, texture2D21.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f); return false; } diff --git a/Projectiles/Boss/FlareBomb.cs b/Projectiles/Boss/FlareBomb.cs index f3772d6502..ba6d98b64e 100644 --- a/Projectiles/Boss/FlareBomb.cs +++ b/Projectiles/Boss/FlareBomb.cs @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Boss } } - float num1247 = 0.5f; + float num1247 = 0.1f; for (int num1248 = 0; num1248 < Main.maxProjectiles; num1248++) { if (Main.projectile[num1248].active) diff --git a/Projectiles/Boss/RedLightning.cs b/Projectiles/Boss/RedLightning.cs new file mode 100644 index 0000000000..9e6f2d3a1c --- /dev/null +++ b/Projectiles/Boss/RedLightning.cs @@ -0,0 +1,217 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs.BrimstoneElemental; +using CalamityMod.Dusts; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.IO; +using Terraria; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Utilities; +namespace CalamityMod.Projectiles.Boss +{ + public class RedLightning : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Red Lightning"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 20; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.hostile = true; + projectile.alpha = 255; + projectile.penetrate = -1; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.extraUpdates = 20; + projectile.timeLeft = 1260; + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(projectile.localAI[0]); + writer.Write(projectile.localAI[1]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + projectile.localAI[0] = reader.ReadSingle(); + projectile.localAI[1] = reader.ReadSingle(); + } + + public override void AI() + { + if (projectile.frameCounter == 0 || projectile.oldPos[0] == Vector2.Zero) + { + for (int num31 = projectile.oldPos.Length - 1; num31 > 0; num31--) + { + projectile.oldPos[num31] = projectile.oldPos[num31 - 1]; + } + projectile.oldPos[0] = projectile.position; + if (projectile.velocity == Vector2.Zero) + { + float num32 = projectile.rotation + MathHelper.PiOver2 + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; + float num33 = (float)Main.rand.NextDouble() * 2f + 2f; + Vector2 vector2 = new Vector2((float)Math.Cos((double)num32) * num33, (float)Math.Sin((double)num32) * num33); + int num34 = Dust.NewDust(projectile.oldPos[projectile.oldPos.Length - 1], 0, 0, 60, vector2.X, vector2.Y, 0, default, 1f); + Main.dust[num34].noGravity = true; + Main.dust[num34].scale = 1.7f; + } + } + + int num3 = projectile.frameCounter; + projectile.frameCounter = num3 + 1; + Lighting.AddLight(projectile.Center, 0.8f, 0.25f, 0.15f); + if (projectile.velocity == Vector2.Zero) + { + if (projectile.frameCounter >= projectile.extraUpdates * 2) + { + projectile.frameCounter = 0; + bool flag36 = true; + for (int num855 = 1; num855 < projectile.oldPos.Length; num855 = num3 + 1) + { + if (projectile.oldPos[num855] != projectile.oldPos[0]) + { + flag36 = false; + } + num3 = num855; + } + if (flag36) + { + projectile.Kill(); + return; + } + } + if (Main.rand.Next(projectile.extraUpdates) == 0) + { + for (int num856 = 0; num856 < 2; num856 = num3 + 1) + { + float num857 = projectile.rotation + ((Main.rand.Next(2) == 1) ? -1f : 1f) * MathHelper.PiOver2; + float num858 = (float)Main.rand.NextDouble() * 0.8f + 1f; + Vector2 vector96 = new Vector2((float)Math.Cos((double)num857) * num858, (float)Math.Sin((double)num857) * num858); + int num859 = Dust.NewDust(projectile.Center, 0, 0, 60, vector96.X, vector96.Y, 0, default, 1f); + Main.dust[num859].noGravity = true; + Main.dust[num859].scale = 1.2f; + num3 = num856; + } + if (Main.rand.Next(5) == 0) + { + Vector2 value39 = projectile.velocity.RotatedBy((double)MathHelper.PiOver2, default(Vector2)) * ((float)Main.rand.NextDouble() - 0.5f) * (float)projectile.width; + int num860 = Dust.NewDust(projectile.Center + value39 - Vector2.One * 4f, 8, 8, 60, 0f, 0f, 100, default, 1.5f); + Dust dust = Main.dust[num860]; + dust.velocity *= 0.5f; + Main.dust[num860].velocity.Y = -Math.Abs(Main.dust[num860].velocity.Y); + } + } + } + else if (projectile.frameCounter >= projectile.extraUpdates * 2) + { + projectile.frameCounter = 0; + float num861 = projectile.velocity.Length(); + UnifiedRandom unifiedRandom = new UnifiedRandom((int)projectile.ai[1]); + int num862 = 0; + Vector2 vector97 = -Vector2.UnitY; + Vector2 vector98; + do + { + int num863 = unifiedRandom.Next(); + projectile.ai[1] = (float)num863; + num863 %= 100; + float f = (float)num863 / 100f * MathHelper.TwoPi; + vector98 = f.ToRotationVector2(); + if (vector98.Y > 0f) + { + vector98.Y *= -1f; + } + bool flag37 = false; + if (vector98.Y > -0.02f) + { + flag37 = true; + } + if (vector98.X * (float)(projectile.extraUpdates + 1) * 2f * num861 + projectile.localAI[0] > 40f) + { + flag37 = true; + } + if (vector98.X * (float)(projectile.extraUpdates + 1) * 2f * num861 + projectile.localAI[0] < -40f) + { + flag37 = true; + } + if (!flag37) + { + goto IL_25086; + } + num3 = num862; + num862 = num3 + 1; + } + while (num3 < 100); + + projectile.velocity = Vector2.Zero; + projectile.localAI[1] = 1f; + + goto IL_25092; + + IL_25086: + vector97 = vector98; + + IL_25092: + if (projectile.velocity != Vector2.Zero) + { + projectile.localAI[0] += vector97.X * (float)(projectile.extraUpdates + 1) * 2f * num861; + projectile.velocity = vector97.RotatedBy((double)(projectile.ai[0] + MathHelper.PiOver2), default(Vector2)) * num861; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 end = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; + Texture2D tex3 = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/RedLightningTexture"); + projectile.GetAlpha(lightColor); + Vector2 scale16 = new Vector2(projectile.scale) / 2f; + for (int num289 = 0; num289 < 3; num289++) + { + if (num289 == 0) + { + scale16 = new Vector2(projectile.scale) * 0.6f; + DelegateMethods.c_1 = new Microsoft.Xna.Framework.Color(219, 104, 58, 0) * 0.5f; + } + else if (num289 == 1) + { + scale16 = new Vector2(projectile.scale) * 0.4f; + DelegateMethods.c_1 = new Microsoft.Xna.Framework.Color(255, 126, 56, 0) * 0.5f; + } + else + { + scale16 = new Vector2(projectile.scale) * 0.2f; + DelegateMethods.c_1 = new Microsoft.Xna.Framework.Color(255, 128, 128, 0) * 0.5f; + } + DelegateMethods.f_1 = 1f; + for (int num290 = projectile.oldPos.Length - 1; num290 > 0; num290--) + { + if (!(projectile.oldPos[num290] == Vector2.Zero)) + { + Vector2 start = projectile.oldPos[num290] + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; + Vector2 end2 = projectile.oldPos[num290 - 1] + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; + Utils.DrawLaser(spriteBatch, tex3, start, end2, scale16, new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw)); + } + } + if (projectile.oldPos[0] != Vector2.Zero) + { + DelegateMethods.f_1 = 1f; + Vector2 start2 = projectile.oldPos[0] + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; + Utils.DrawLaser(Main.spriteBatch, tex3, start2, end, scale16, new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw)); + } + } + return false; + } + } +} diff --git a/Projectiles/Boss/RedLightning.png b/Projectiles/Boss/RedLightning.png new file mode 100644 index 0000000000000000000000000000000000000000..f99e9c57d500bc2b7e8d33ffe4ce738e005f0b0d GIT binary patch literal 191 zcmeAS@N?(olHy`uVBq!ia0vp^Vj#@H1|*Mc$*~4fjKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCils0(?STf%N~sAJ_vPoCC7LJzX3_JiL=r4lw=$iprll!YwhAb;GQKEK67N z8RRHmTl#|G?$a&hhCB6K*$t*&K6ms=k*3vxnceQZZOwtr4-;NU+OVAF(%@xxUT)*Y ieq`62bER_3%nU1U%Lqmu_`efq1%s!npUXO@geCy~$3Ut8 literal 0 HcmV?d00001 diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 66b406308b..9915f75331 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1880,15 +1880,9 @@ namespace CalamityMod.Projectiles { spriteEffects = SpriteEffects.FlipHorizontally; } - float num66 = 0f; Vector2 vector11 = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.projFrames[projectile.type] / 2)); - Color color9 = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); + Color color9 = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, projectile.alpha); Color alpha15 = projectile.GetAlpha(color9); - float num212 = 0.99f; - alpha15.R = (byte)((float)alpha15.R * num212); - alpha15.G = (byte)((float)alpha15.G * num212); - alpha15.B = (byte)((float)alpha15.B * num212); - alpha15.A = (byte)((float)alpha15.A * num212); for (int num213 = 0; num213 < 4; num213++) { Vector2 position9 = projectile.position; @@ -1915,7 +1909,7 @@ namespace CalamityMod.Projectiles int y = frames * projectile.frame; position9.Y -= (float)(projectile.height / 2); Main.spriteBatch.Draw(texture, - new Vector2(position9.X - Main.screenPosition.X + (float)(projectile.width / 2) - (float)texture.Width * projectile.scale / 2f + vector11.X * projectile.scale, position9.Y - Main.screenPosition.Y + (float)projectile.height - (float)texture.Height * projectile.scale / (float)Main.projFrames[projectile.type] + 4f + vector11.Y * projectile.scale + num66 + projectile.gfxOffY), + new Vector2(position9.X - Main.screenPosition.X + (float)(projectile.width / 2) - (float)texture.Width * projectile.scale / 2f + vector11.X * projectile.scale, position9.Y - Main.screenPosition.Y + (float)projectile.height - (float)texture.Height * projectile.scale / (float)Main.projFrames[projectile.type] + 4f + vector11.Y * projectile.scale + projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y, texture.Width, frames)), alpha15, projectile.rotation, vector11, projectile.scale, spriteEffects, 0f); } }