From 40b57f99c0c0c26491daae7911ceb74bd0dbac30 Mon Sep 17 00:00:00 2001 From: Xyk Date: Sun, 1 Jun 2025 12:53:24 -0700 Subject: [PATCH 01/47] Order --- CalPlayer/CalamityPlayer.cs | 1 + CalPlayer/CalamityPlayerMiscEffects.cs | 16 + CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs | 8 +- Items/CalamityGlobalItemTooltip.cs | 20 +- Items/Weapons/Melee/IridescentExcalibur.cs | 193 ------- Items/Weapons/Melee/IridescentExcalibur.png | Bin 2099 -> 0 bytes .../Weapons/Melee/IridescentExcaliburGlow.png | Bin 666 -> 0 bytes Items/Weapons/Melee/Orderbringer.cs | 191 ++++--- Items/Weapons/Melee/Orderbringer.png | Bin 1896 -> 2099 bytes Items/Weapons/Melee/OrderbringerGlow.png | Bin 2247 -> 666 bytes ...Mods.CalamityMod.Items.Weapons.Melee.hjson | 11 - .../Mods.CalamityMod.Projectiles.Melee.hjson | 1 + Projectiles/Melee/GayBeam.cs | 470 ------------------ Projectiles/Melee/GayBeam.png | Bin 738 -> 0 bytes Projectiles/Melee/IridescentExcaliburSlash.cs | 254 ---------- .../Melee/IridescentExcaliburSlash.png | Bin 2957 -> 0 bytes .../Melee/IridescentExcaliburSlash2.cs | 231 --------- .../Melee/IridescentExcaliburSlash3.cs | 238 --------- Projectiles/Melee/OrderbringerBeam.cs | 15 +- Projectiles/Melee/OrderbringerWaveProj.cs | 44 +- Projectiles/Melee/StarofJudgement.cs | 7 +- Projectiles/Melee/StarofOrder.cs | 118 +++++ Utilities/MathematicalUtils.cs | 12 + 23 files changed, 336 insertions(+), 1494 deletions(-) delete mode 100644 Items/Weapons/Melee/IridescentExcalibur.cs delete mode 100644 Items/Weapons/Melee/IridescentExcalibur.png delete mode 100644 Items/Weapons/Melee/IridescentExcaliburGlow.png delete mode 100644 Projectiles/Melee/GayBeam.cs delete mode 100644 Projectiles/Melee/GayBeam.png delete mode 100644 Projectiles/Melee/IridescentExcaliburSlash.cs delete mode 100644 Projectiles/Melee/IridescentExcaliburSlash.png delete mode 100644 Projectiles/Melee/IridescentExcaliburSlash2.cs delete mode 100644 Projectiles/Melee/IridescentExcaliburSlash3.cs create mode 100644 Projectiles/Melee/StarofOrder.cs diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 55d431690a..1b4ffac083 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -958,6 +958,7 @@ namespace CalamityMod.CalPlayer public bool XykVisualsBlue = false; public bool XykVisualsOrange = false; public Color XykFXColor = Color.Black; + public Color lightRGB = Color.Black; public bool manaOverloader = false; /// Used for allowing Calamity slimes to be affected by Royal Gel. public bool royalGel = false; diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 2842bd89a1..4e9b5ba946 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -568,6 +568,22 @@ namespace CalamityMod.CalPlayer if (heldGaelsLastFrame) rageDiff += rageMax * GaelsGreatsword.RagePerSecond / 60f; + float rate = Main.GlobalTimeWrappedHourly * 29; + List eColors = new List() + { + Color.PaleVioletRed, + Color.Coral, + Color.Khaki, + Color.PaleGreen, + Color.Turquoise, + Color.Violet + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + lightRGB = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + // Calculate and grant proximity rage. // Regular enemies can give up to 1x proximity rage. Bosses can give up to 3x. Multiple regular enemies don't stack. // Proximity rage is maxed out when within 10 blocks (160 pixels) of the enemy's hitbox. diff --git a/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs b/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs index d5a92f8bfc..74577bfced 100644 --- a/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs +++ b/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs @@ -35,6 +35,8 @@ namespace CalamityMod.CalPlayer.DrawLayers if (itemType < ItemID.Count) return; + Color color = new Color(250, 250, 250, heldItem.alpha); + // This is ugly and I don't give a fuck. // If you want it to look better, do it yourself. Texture2D glowMask = default; @@ -62,8 +64,6 @@ namespace CalamityMod.CalPlayer.DrawLayers glowMask = ModContent.Request("CalamityMod/Items/Weapons/Summon/EtherealSubjugatorGlow").Value; else if (itemType == ModContent.ItemType()) glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/ExcelsusGlow").Value; - else if (itemType == ModContent.ItemType()) - glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/IridescentExcaliburGlow").Value; else if (itemType == ModContent.ItemType()) glowMask = ModContent.Request("CalamityMod/Items/Weapons/Magic/FatesRevealGlow").Value; else if (itemType == ModContent.ItemType()) @@ -75,7 +75,10 @@ namespace CalamityMod.CalPlayer.DrawLayers else if (itemType == ModContent.ItemType()) glowMask = ModContent.Request("CalamityMod/Items/SummonItems/NecroplasmicBeaconGlow").Value; else if (itemType == ModContent.ItemType()) + { + color = Color.Lerp(Color.White, drawPlayer.Calamity().lightRGB, 0.75f) with { A = 0 }; glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/OrderbringerGlow").Value; + } else if (itemType == ModContent.ItemType()) glowMask = ModContent.Request("CalamityMod/Items/Weapons/Magic/PhotosynthesisGlow").Value; else if (itemType == ModContent.ItemType()) @@ -140,7 +143,6 @@ namespace CalamityMod.CalPlayer.DrawLayers if (drawInfo.shadow != 0f || drawPlayer.frozen || !(inUse || visuallyHeld) || itemType <= 0 || drawPlayer.dead || heldItem.noUseGraphic || (drawPlayer.wet && heldItem.noWet) || (drawPlayer.happyFunTorchTime && drawPlayer.inventory[drawPlayer.selectedItem].createTile == TileID.Torches && drawPlayer.itemAnimation == 0)) return; - Color color = new Color(250, 250, 250, heldItem.alpha); Vector2 originOffset = Vector2.Zero; // Use to adjust glow mask draw offset and color. diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index 2a35ce43b4..db7cb600a7 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -289,8 +289,26 @@ namespace CalamityMod.Items #region Rarity Coloration private static void ApplyRarityColor(Item item, TooltipLine nameLine) { - if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) + if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) nameLine.OverrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); + if (item.type == ModContent.ItemType()) + { + float rate = Main.GlobalTimeWrappedHourly * 15; + List eColors = new List() + { + Color.PaleVioletRed, + Color.Coral, + Color.Khaki, + Color.PaleGreen, + Color.Turquoise, + Color.Violet + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + nameLine.OverrideColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + } // Developer items if (item.type == ModContent.ItemType()) diff --git a/Items/Weapons/Melee/IridescentExcalibur.cs b/Items/Weapons/Melee/IridescentExcalibur.cs deleted file mode 100644 index 76c749add9..0000000000 --- a/Items/Weapons/Melee/IridescentExcalibur.cs +++ /dev/null @@ -1,193 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Melee; -using CalamityMod.Rarities; -using CalamityMod.Tiles.Furniture.CraftingStations; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - [LegacyName("ElementalExcalibur")] - public class IridescentExcalibur : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Melee"; - - private int MaxBeamTypes = 12; - - private int BeamType = 0; - - private const int Alpha = 100; - - private const float ShootSpeed = 16f; - - public override void SetStaticDefaults() - { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; - } - - public override void SetDefaults() - { - Item.width = 112; - Item.height = 112; - Item.damage = 3000; - Item.useAnimation = Item.useTime = 15; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.DamageType = DamageClass.Melee; - Item.knockBack = 8f; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = ShootSpeed; - Item.rare = ModContent.RarityType(); - Item.shootsEveryUse = true; - } - - public override void UseStyle(Player player, Rectangle heldItemFrame) - { - player.itemLocation += new Vector2(-12f * player.direction, 2f * player.gravDir).RotatedBy(player.itemRotation); - } - - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Melee/IridescentExcaliburGlow").Value); - } - - // Terraria seems to really dislike high crit values in SetDefaults - public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 10; - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - if (player.altFunctionUse == 2) - { - float adjustedItemScale = player.GetAdjustedItemScale(Item); - Projectile.NewProjectile(source, player.MountedCenter, new Vector2(player.direction, 0f), ModContent.ProjectileType(), damage, knockback, player.whoAmI, (float)player.direction * player.gravDir, player.itemAnimationMax, adjustedItemScale); - Projectile.NewProjectile(source, player.MountedCenter, new Vector2(player.direction, 0f), ModContent.ProjectileType(), 0, knockback, player.whoAmI, (float)player.direction * player.gravDir, player.itemAnimationMax, adjustedItemScale); - Projectile.NewProjectile(source, player.MountedCenter, new Vector2(player.direction, 0f), ModContent.ProjectileType(), 0, knockback, player.whoAmI, (float)player.direction * player.gravDir, player.itemAnimationMax, adjustedItemScale); - NetMessage.SendData(MessageID.PlayerControls, -1, -1, null, player.whoAmI); - } - else - { - int proj = Projectile.NewProjectile(source, position, velocity, type, (int)Math.Round(damage * 0.5), knockback * 0.5f, player.whoAmI, (float)BeamType); - if (BeamType == 7) - Main.projectile[proj].penetrate = 3; - - BeamType++; - if (BeamType >= MaxBeamTypes) - BeamType = 0; - } - - return false; - } - - public override bool AltFunctionUse(Player player) => true; - - public override bool? UseItem(Player player) - { - Item.noMelee = player.altFunctionUse == 2; - return base.UseItem(player); - } - - public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers) - { - if (player.altFunctionUse == 2) - modifiers.SourceDamage *= 2; - } - - public override void ModifyHitPvp(Player player, Player target, ref Player.HurtModifiers modifiers) - { - if (player.altFunctionUse == 2) - modifiers.SourceDamage *= 2; - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool()) - { - Color rainbowColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Alpha); - Color color = Color.White; - int dustChoice = player.altFunctionUse == 2 ? Main.rand.Next(12) : BeamType; - switch (dustChoice) - { - case 0: // Red - color = new Color(255, 0, 0, Alpha); - break; - case 1: // Orange - color = new Color(255, 128, 0, Alpha); - break; - case 2: // Yellow - color = new Color(255, 255, 0, Alpha); - break; - case 3: // Lime - color = new Color(128, 255, 0, Alpha); - break; - case 4: // Green - color = new Color(0, 255, 0, Alpha); - break; - case 5: // Turquoise - color = new Color(0, 255, 128, Alpha); - break; - case 6: // Cyan - color = new Color(0, 255, 255, Alpha); - break; - case 7: // Light Blue - color = new Color(0, 128, 255, Alpha); - break; - case 8: // Blue - color = new Color(0, 0, 255, Alpha); - break; - case 9: // Purple - color = new Color(128, 0, 255, Alpha); - break; - case 10: // Fuschia - color = new Color(255, 0, 255, Alpha); - break; - case 11: // Hot Pink - color = new Color(255, 0, 128, Alpha); - break; - default: - break; - } - - Dust rainbow = Main.dust[Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.RainbowMk2)]; - rainbow.velocity *= 0f; - rainbow.color = Color.Lerp(rainbowColor, color, (float)Math.Sqrt((MathF.Cos(Main.GlobalTimeWrappedHourly / 60f) + 1f) * 0.5f)); - rainbow.color.A = 100; - rainbow.scale = Main.rand.NextFloat(1.2f, 1.6f); - rainbow.fadeIn = Main.rand.NextFloat(0.4f, 1f); - rainbow.noGravity = true; - } - } - - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 600); - target.AddBuff(ModContent.BuffType(), 60); - } - - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) - { - target.AddBuff(ModContent.BuffType(), 600); - target.AddBuff(ModContent.BuffType(), 60); - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.TrueExcalibur). - AddIngredient(). - AddIngredient(3). - AddIngredient(15). - AddTile(). - Register(); - } - } -} diff --git a/Items/Weapons/Melee/IridescentExcalibur.png b/Items/Weapons/Melee/IridescentExcalibur.png deleted file mode 100644 index 5ff82d5ac7a7b83abfe38661f2bfb65c9eb91414..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2099 zcmX9=4LFl~8-Liz3Oi0m`I>a zwBzF_M#;xGr|raiR0z$cEt@i|hDT>M?=$CmuK)ADuKT+0-}C(L|L^`?|14i04}`Xf zHUI#K6P|AV&>p8=TeYA!duI70v}q*xd$F~QKYISOQ7e{vr4Lf z%m*uC`wsU`+7Pk9M1_K_a4iqNR63^<*RPKRGY<|8bZ*SU+hN4}D_HlLtZo+X2l;D=iQPF4 zBPbFJGi{w?ghV#N_BPVt_@82CsP)weC24Wp7?51XNpJWQuHNPdlrOghim z73RQm5v@_ejs`@BL*_?c#LRT|8JyNgwTO8lKj0iHvl#PGk;x#lvz>w`++@?%m*~ zSfQ4#>t#Oua4(U*#oJ6xvAn~^SNt3Y>c>CdXNN1|Dth1Bs=LZS!Y;@o=tk`O?+Jp{ zT!FUEZVaYH`HI#p>!4^@lQ(~ji?oza4V7rWFRPOll5cz~FQTAGjP0Aa*$AnFynvf< zND-Qp8r;M9)KWtT;p-Eh-$jlC)@VoH4m@9Ce~rE-fyWlB$plo;>ADRm0~o_BylUu~c!*@X$PkO1qNy|}~e zF|e6MQfR@X8S>5JFatm@1VjLK&QA@~Po>Z`W*E78Fh;%&E~pe!iSqgJr%^4IGVr{O zbY-ketx=zM%#l#(k*zggma=OY&#zp0m!OgK<&KQEgFr|)Y3*igc`NosNR@YGqL-al z-~vB%buAgac{-D<3^<6^SO$sxmM`N~>)iUe@@ZWbt2<5O(s+Jnh-_t`kGe1^D!O9g z-c}Qh21u&M7A*qarFWoFo3gsY`8FDA`3|~H{650$N;Ivt(#KM9dAJZ?XMei{{y0;h{s=tBapo2CG(GoY_f!x7@tSRak=7B*+ z(jpQlzruS9V3jdCKzq-!L7s_&L^|?Onqs+pf8*1b2THO%_p-oH1o0IIUF3<(0>i`c zeD`*&1}i%=P*b)zUULRB-{?na%6aVx5W+Te6vwZmc0vA8CsVl)^1MeU?m8d|{7%t^ z4y*9R>Z^%jJjHO2j=<48AkJ2M@ncQkv7Ke~mFFr@u_ks-}%>7sxVT9HlHe&zB_iV4)*%j9!Pws2#t}L3#qpk+W@*dkm zwqF=~$MBpKw#-f4qUOmHCOZ1J$$sMurlm0ZRLTd#z(?NJjA- zl=)G&2-DGXQgXnur5|aiUuM)EE>a4&&s0^%ZUfHS!(ne48L_p^JJr_4(;lNth0?cP z2pGK(5>5Ew_r8KiVfMp_DND6GO%(V$hoTbx!_EpCyxHR0IP#Jn$Qf|U#WlVOVnD9u zmv&IjMb?uNQ`63Vkc=jGsxfoc8grIFli0;xJO`S-CU+to0fmcVvd_he#-{!o^#>GX z7?=##G`4CAy>%hk)>!lvI6;m0X`wF#%g7C4VxmO+L}VAT-kHv>zzBhEZ+YA|3BFFy!yQBm3#J^KX_^D zQ#EIMRqFpz|J=%@Gqykf=D)Q+@!e^Uoz-ryJFHg*M)L5e80vZDIK%)=<@cP}45Xw> zg8YJk=HLJf>L%Q#KxLc-9+AZi419+{nDKc2iWH!uS9`iRhGaOuy>YRx$v~hrktH@p z)J13NuYdfzZ2clNvm*|8S^56oy-+;fNYQ2Xop9}iXSO)4Zkk}W%iv%Ld(P&Qn?4-i zyZ!3G%crv@^KUi!apXWNd(-W_^8S4#U-q>yFVo!cN6;cF!$QI0&?lSI^I|j>oL%_W zPUXV0Z~az!ECq8O^MBi!A3Xmt->o~2bEW^a03_s;L(j>gQWP_y!#J;i$tsH|L-x9|a9 z`+rNng!!wpAH~(Ld%L6Ih@i)vuU4&(nI0|b6WevWQM+rU4F8753|x#GGM5#}98fvP zo~!xXx}!TKCPPp|^}sU8f3cG1<3B9Rj@~ta#V02A{Nozdc8O`;4`R;wPcU$inAaej zWcOU%L;J0P%LAcv;TQO{rxi&aXARj^;HVR_^7h%D&5s$hu5Me{eA-g(fi?G6-Vm>j zWfL#;EGxIT@1Xc8X5}W6#gl88r%p0T3DAuBrjhEV{*$$C5r>t2)4A>ipOs$hL1DhD b`_Gv0VCF}^%3dX4TrzmN`njxgN@xNARWUJ{ diff --git a/Items/Weapons/Melee/Orderbringer.cs b/Items/Weapons/Melee/Orderbringer.cs index 4bcfb4b25b..bf2bd4daed 100644 --- a/Items/Weapons/Melee/Orderbringer.cs +++ b/Items/Weapons/Melee/Orderbringer.cs @@ -1,18 +1,19 @@ -using CalamityMod.Items.Materials; +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Dusts; +using CalamityMod.Items.Materials; +using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.Audio; -using Terraria.ID; using Microsoft.Xna.Framework; -using Terraria.ModLoader; -using CalamityMod.Particles; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; -using Basic.Reference.Assemblies; -using System; -using Mono.Cecil; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { @@ -20,23 +21,25 @@ namespace CalamityMod.Items.Weapons.Melee public class Orderbringer : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; - private float swingRoatation = 0; - private int time = 0; - private Color mainColor; - private int swordDirection; - private int useTime = 18; - private int opacityAdjust = 0; - private float smearOpacity = 0; + public int time = 0; + public Vector2 bladeHitboxPos; + public float bladeRotation = 0; + public int bladeDirection = 0; + public float bladeFX = 0; + public float completion = 0; + public bool canHit => (completion >= 0.35f && completion <= 0.8f); + public int swingCount = 0; + public bool spawnProj = true; + public bool playSound = true; public override void SetDefaults() { - Item.width = Item.height = 108; - Item.damage = 445; + Item.width = Item.height = 112; + Item.damage = 755; Item.DamageType = DamageClass.Melee; - Item.useAnimation = Item.useTime = useTime; + Item.useAnimation = Item.useTime = 18; Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; Item.knockBack = 8f; - Item.UseSound = SoundID.Item60; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); @@ -45,87 +48,151 @@ namespace CalamityMod.Items.Weapons.Melee } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f); - - for (int i = 0; i < 4; i++) - { - Vector2 vel = (velocity * 2.5f).RotatedByRandom(0.6f); - Projectile.NewProjectile(source, player.ClampedMouseWorld() - (velocity * 40) + Main.rand.NextVector2Circular(130, 130), vel * Main.rand.NextFloat(0.8f, 1.2f), ModContent.ProjectileType(), (int)(damage * 0.1f), knockback * 0.2f, player.whoAmI, 0, 0, 1); - } return false; } public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) { - float scale = 1.2f; + // Basically just insures the enemy is always able to be hit if they're in range, the actual collision check is done in CanHitNPC + float scale = 8f; Vector2 newSize = new Point(hitbox.Width, hitbox.Height).ToVector2() * scale; - hitbox = new Rectangle(hitbox.X - (int)((newSize.X - hitbox.Width) / 2f), hitbox.Y - (int)((newSize.Y - hitbox.Height) / 2f), (int)newSize.X, (int)newSize.Y); + hitbox = new Rectangle((int)(bladeHitboxPos.X - newSize.X / 2f), (int)(bladeHitboxPos.Y - newSize.Y / 2f), (int)newSize.X, (int)newSize.Y); + } + public override bool? CanHitNPC(Player player, NPC target) + { + Vector2 mPos = player.Calamity().mouseWorld; + Vector2 shootDir = player.Center.DirectionTo(mPos); + float _ = float.NaN; + bool hitCheck = Collision.CheckAABBvLineCollision(target.Hitbox.TopLeft(), target.Hitbox.Size(), player.Center, player.Center + shootDir * 245, Item.width * 3f, ref _); + return ((canHit && hitCheck) ? null : false); } public override void UseAnimation(Player player) { - swordDirection = player.direction; + swingCount++; time = 0; - swingRoatation = 0; - mainColor = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; - opacityAdjust = 0; - smearOpacity = 0; + bladeDirection = player.direction; + bladeHitboxPos = player.Center; + bladeRotation = 0; + bladeFX = 0; + spawnProj = true; + playSound = true; + int dir = -Math.Sign(player.Center.X - player.Calamity().mouseWorld.X); + float startRot = MathHelper.ToRadians(-90) * dir * (swingCount % 2 == 0 ? 1 : -1); + //player.itemRotation = player.Center.DirectionTo(player.Calamity().mouseWorld).ToRotation() + startRot; } public override void MeleeEffects(Player player, Rectangle hitbox) { - opacityAdjust++; - if (opacityAdjust >= 5 && opacityAdjust <= 15 && smearOpacity < 0.9f) - smearOpacity += 0.1f; - else if (smearOpacity > 0) - smearOpacity -= 0.2f; + Vector2 mPos = player.Calamity().mouseWorld; + completion = (float)((float)time / ((float)(Item.useAnimation / player.GetAttackSpeed(DamageClass.Melee)))); + int dir = -Math.Sign(player.Center.X - mPos.X); + + float startRot = MathHelper.ToRadians(-110) * dir * (swingCount % 2 == 0 ? 1 : -1); + float endRot = MathHelper.ToRadians(-110) * dir * (swingCount % 2 == 0 ? -1 : 1); + float minRot = MathHelper.ToRadians(-150) * dir * (swingCount % 2 == 0 ? 1 : -1); + float cutoff = 0.2f; + float cutoff2 = 0.95f; + + Vector2 shootDir = player.Center.DirectionTo(mPos) * Item.shootSpeed; + + if (completion <= cutoff) + { + float lerp = Utils.GetLerpValue(0, cutoff, completion, true); + player.itemRotation = player.Center.DirectionTo(mPos).ToRotation() + MathHelper.Lerp(startRot, minRot, CalamityUtils.EaseInOutExp(lerp, 4f, 4f)); + player.itemRotation += (MathHelper.Pi) * (dir == 1 ? 0 : 1) + MathHelper.PiOver4 * dir; + } + else + { + if (playSound) + { + SoundStyle swing = new("CalamityMod/Sounds/Item/SwooshMid"); + SoundEngine.PlaySound(swing with { Pitch = Main.rand.NextFloat(0.1f, 0.3f), Volume = 1f }, player.Center); + playSound = false; + } + if (completion >= 0.65f && spawnProj) + { + Projectile.NewProjectile(player.GetSource_FromThis(), player.Center, shootDir, Item.shoot, Item.damage, Item.knockBack, player.whoAmI, 0f); + + for (int i = 0; i < 4; i++) + { + float rot = Main.rand.NextFloat(0.5f, 0.65f) * (Main.rand.NextBool() ? 1 : -1); + Vector2 vel = (shootDir * 2.5f).RotatedByRandom(0.6f); + Projectile.NewProjectile(player.GetSource_FromThis(), player.ClampedMouseWorld() - (shootDir * 40) + Main.rand.NextVector2Circular(130, 130), vel.RotatedBy(rot) * Main.rand.NextFloat(0.9f, 1.2f), ModContent.ProjectileType(), (int)(Item.damage * 0.12f), (int)(Item.knockBack * 0.2f), player.whoAmI, 0, rot, 1); + } + + Particle swipe = new CustomSpark(player.Center - shootDir * 5, shootDir.RotatedBy(0.4f * (dir * (swingCount % 2 == 0 ? 1 : -1))) * 2.5f, "CalamityMod/Particles/VerticalSmearLarge", false, (int)(14 / player.GetAttackSpeed(DamageClass.Melee)), 0.8f, player.Calamity().lightRGB, new Vector2(1f, 1f), true, false, 0, false, false); + GeneralParticleHandler.SpawnParticle(swipe); + + SoundEngine.PlaySound(SoundID.Item60, player.Center); + spawnProj = false; + } + float lerp = Utils.GetLerpValue(cutoff, cutoff2, completion, true); + player.itemRotation = player.Center.DirectionTo(mPos).ToRotation() + MathHelper.Lerp(minRot, endRot, CalamityUtils.EaseInOutExp(lerp, 6f, 2f)); + player.itemRotation += (MathHelper.Pi) * (dir == 1 ? 0 : 1) + MathHelper.PiOver4 * dir; + } + + float extraRot = (dir == 1 ? -MathHelper.PiOver4 : MathHelper.ToRadians(225)); + bladeHitboxPos = player.Center + (player.itemRotation + extraRot).ToRotationVector2() * 240; + Vector2 tipPos = player.Center + (player.itemRotation + extraRot).ToRotationVector2() * 180; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, player.itemRotation + MathHelper.ToRadians(-130) * dir); + player.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, player.itemRotation + MathHelper.ToRadians(-130) * dir); + + player.itemLocation = player.Center; + player.direction = dir; time++; - swingRoatation += swordDirection == 1 ? 0.17f : -0.17f; - - float Rot = (swordDirection == -1 ? 1.8f : -1.8f) + swingRoatation; - if (swordDirection != player.direction) - { - swingRoatation *= -1; - swordDirection = player.direction; - } - Particle Smear = new SemiCircularSmearFade(player.Center, Vector2.Zero, mainColor * smearOpacity, Rot, Main.rand.NextFloat(2.8f, 3.2f), new Vector2(1, 1), 2, true, false, true, player.direction); - GeneralParticleHandler.SpawnParticle(Smear); - - if (Main.rand.NextBool()) - { - Vector2 dustVel = new Vector2(5 * swordDirection, -5).RotatedByRandom(1.55f) * Main.rand.NextFloat(0.7f, 1.3f) * 2; - Dust dust = Dust.NewDustPerfect(player.Center + dustVel * 9, 278); - dust.scale = Main.rand.NextFloat(0.5f, 0.75f); - dust.velocity = dustVel * 0.55f; - dust.color = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; - dust.noGravity = true; - } } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { int beamDamage = player.CalcIntDamage(Item.damage * 0.5f); Vector2 mouseClamped = player.ClampedMouseWorld(); + SoundEngine.PlaySound(SoundID.Item84 with { Volume = 1f, Pitch = Main.rand.NextFloat(0.5f, 0.7f)}, player.Center); for (int i = 0; i < 2; i++) { Vector2 targetPos = Main.MouseWorld; NPC target2 = Main.MouseWorld.ClosestNPCAt(650); if (target2 != null) - targetPos = target2.Center + target2.velocity * 14; + targetPos = target2.Center; Vector2 spawnPos = mouseClamped + new Vector2(Main.rand.NextFloat(-300, 300), -900); Vector2 vel = (targetPos - spawnPos).SafeNormalize(Vector2.UnitY) * 10; Projectile.NewProjectile(player.GetSource_ItemUse(Item), spawnPos, vel, ModContent.ProjectileType(), beamDamage, 0, player.whoAmI); } } + public override void ModifyTooltips(List list) + { + Player Owner = Main.LocalPlayer; + if (Owner is null) + return; + + float rate = Main.GlobalTimeWrappedHourly * 7; + List eColors = new List() + { + Color.PaleVioletRed, + Color.Coral, + Color.Khaki, + Color.PaleGreen, + Color.Turquoise, + Color.Violet + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + Color finalColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip2"); + if (line != null) + line.OverrideColor = Color.Lerp(finalColor, Color.White, 0.3f); + } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Melee/OrderbringerGlow").Value); } - public override void AddRecipes() { CreateRecipe(). AddIngredient(). - AddIngredient(8). - AddIngredient(20). + AddIngredient(5). + AddIngredient(5). AddTile(). Register(); } diff --git a/Items/Weapons/Melee/Orderbringer.png b/Items/Weapons/Melee/Orderbringer.png index ade13f44bfa2c81d26e8ac2b99d2d426b5418f41..5ff82d5ac7a7b83abfe38661f2bfb65c9eb91414 100644 GIT binary patch literal 2099 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 b`_Gv0VCF}^%3dX4TrzmN`njxgN@xNARWUJ{ literal 2247 zcmV;&2srnNP)lEX77~#<7QEDNL~CG4>GI3}6|f-D(u!~$1h9k;f={QObujA2`+Aea4YhAlDhx{)fC5;;0O8_r zfW~fAjKZ(7_%%A*aQs;!moO}5Kn1Xv0WdYs0V;Y&F{)n|XUXO|b^cOD7-rIGsP_f1 zP}Lh;8EMSF(Ro#rN&8l9fY!;6RqFqEVPJeceE)6UF*~(^#4GS1K z0W4sJhE*MaTChejtE6l0mV#oI*f5_+3Sd4J7*%op2t>QO^(?LM7n{g6n9rKSWhOGU+<4M0t*QOxSvT}cE+Ma3-f z5-mr90A{JExU;zh>XU6JN#xR!j)B@N@e(aZf&gZzsJOEw6)3S`nvo%Z#Z4K@_Pqkt z_v#DO!qWXuQTk2Oo=~Ssp;m6Gt3+fIz!Cw2SqQH{q2~9F&yIvyV#Bf;5WviXIuSW^ zK#l6@6c4dM%(LQRR=a1I0G0^en1#>$H8#LFK%)nj z<&=1L(@whXmSJw0h22ekdVWjoE#2Nksoy;qb}-oI62P*bS7>*DamMHvfqZq@_oo^U zI!D(>uWWT(aLcT!iJR&DtUEImRFBDKr3I+K=V1bv{bS8fPT!BjR$H-9?J5F8I5Y4W zx$1*YQ$8@Oe5ewC=0l2EZW)En>zK9U5%snRY||AtkE8RnF)J{J31EKs;=ZhBh9w24 z=|!)S&8pbCz+tnNSEyY~_zmjRnGW&&!Asw5r}LzGgE}Y$u!Oqrp#cVOPiKQ*y9Si2 zmD#C_ou4gpYrDWGbci#n?CxhAeI4K92|6D?p+BW*WtMLn#@%xP%)LGGQo{8kQ8$m` z-XWMZWVP}N|7dJ+FwDfP;e$t!Z7RMr!O^e6MYHI<^!95U*J~eF%-Z$kGV0Tqk@Km1 zZRP8E!7R@V6TrOiBDgZX8CJhoF^9+exb4FIN!j_@;o0gd(JvmFOEMG|4kkwQ=zJYr zAOGBzoV|3*EX=p+57bkANsA4-g;D@>tFf5#y9SI$EMSWeZ3mP3o&1rycBX${N^uTv zaYw@ny1wt?I!ZaS4u7?WuAkfcmP19|x@SWp*{eF6g+lzBxiRb8ck=?6Zxu#cfe|n` z8Hn+5?+>;JOwut8-Qo=U@TWKE)|hFvl(rn*N9p9OiN@6=Or|;G5UN)%HD9``ux#* zgIWE`RK7Dim3J$Eg@shMUIEOYU_?B?EM#AQeia>_I@J`34FFIRdp%6;R@~CZlkLh| zh5;A>EaXRqW%Wi@04N?KMEz0OGBB&M_w&^BfNM`v`oa-q!+yQ+OPfrG?fR=q*{)*s zM-2IA!vrwPp&wB;EyFlaSCy;XPS~3P`7l3g`d+PD@kj;cUC58vqF0+|TOXfil{F}4 zVaIW&OuD>7=uZGk$%NSmm~Pz*QFcV#;U!|l7z_gws;fU&He+-VrN?$3r?jT#UP^5v z9;mP4hIu(3K9Fa`K=mX5qmY^J<=;6a&lo0vMP!s*He(D;p+4+xGS$zSRen)1t9X&K zWG17SwsNI9$`<$uEE<1qn+z zA_ENaY@2z64jVgq^A<;Rc#PJu#+8;(J)BvvW!TMyc5Q92rQTx8CV<7JdT$K}4j9DX zwhY(3GON{AWf`_)@-Vveb+g*r&wu&CDBdpt%-cYZtyE}$ai;Men!G}tMqtC%uUSc1 zY*&oax`!h&h6!NdkT7(H>BPpo3iq4NG}EDuc_!}=Ow+Z8b+EKX>CrC%EF2<)R%>j4 zVJGm4VRIec-u6RBb9NT^n5UD1ezXl(74;0fsNyEUHr9h=P{~265ZO=UZSX*C)#5 z3!@Ta!vrvI)Qy~B94JKBF+V~#_|9D3y?kYm2}S|Tq@je}j~p<*xkndy;9ew{2>qo! zV&Qch2w+|{7gM0$3_w`d7$SHgT^k-@byDGF-Ic3ScQi@_+U!YOgV6`ifm#0W5Y1+zIdx!4;X> Va|-(h00000NkvXXu0mjf008K2JRSf5 diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index 223e79060f..31ed7e73a1 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -768,16 +768,6 @@ InsidiousImpaler: { ''' } -IridescentExcalibur: { - DisplayName: Iridescent Excalibur - Tooltip: - ''' - True melee strikes freeze enemies - Fires rainbow beams that change their behavior based on their color - Press for true melee - ''' -} - Lacerator: { DisplayName: Lacerator Tooltip: @@ -958,7 +948,6 @@ Orderbringer: { Tooltip: ''' Fires piercing energy waves and summons four homing stars near your cursor - Energy waves deal more damage with each consecutive hit Hits with the blade summon two beams from the sky 'No matter where you may be you are never alone' ''' diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index fcf84f80e5..bdd7180600 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -237,6 +237,7 @@ StarburstBeam.DisplayName: Star Shiv StarburstSHIV.DisplayName: SHIV StarnightBeam.DisplayName: Starnight Beam StarofJudgement.DisplayName: Star of Judgement +StarofOrder.DisplayName: Star of Order StellarContemptBlast.DisplayName: Stellar Blast StellarContemptEcho.DisplayName: Echoes of Contempt StellarContemptHammer.DisplayName: Stellar Contempt diff --git a/Projectiles/Melee/GayBeam.cs b/Projectiles/Melee/GayBeam.cs deleted file mode 100644 index 85cb5f4a85..0000000000 --- a/Projectiles/Melee/GayBeam.cs +++ /dev/null @@ -1,470 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Graphics.Primitives; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.Graphics.Shaders; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class GayBeam : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - - private const int Alpha = 100; - - private const int TimeLeft = 600; - - private const int TrailLength = 36; - - private const int TotalAfterimages = 12; - - private const int AfterimageOffset = TrailLength / TotalAfterimages; - - private const float MaxVelocity = 24f; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailingMode[Type] = 2; - ProjectileID.Sets.TrailCacheLength[Type] = TrailLength; - } - - public override void SetDefaults() - { - Projectile.width = 16; - Projectile.height = 16; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.ignoreWater = true; - Projectile.penetrate = 1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.timeLeft = TimeLeft; - Projectile.alpha = Alpha; - } - - 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() - { - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); - - if (Projectile.ai[2] == 0f) - SoundEngine.PlaySound(SoundID.Item60, Projectile.Center); - - Color color = GetProjectileColor(); - switch ((int)Projectile.ai[0]) - { - case 0: // Red, normal beam - break; - - case 1: // Orange, curve back to player - - int player = (int)Player.FindClosest(Projectile.Center, 1, 1); - Projectile.ai[1] += 1f; - if (Projectile.ai[1] < 360f && Projectile.ai[1] > 60f) - { - float homeSpeed = Projectile.velocity.Length(); - Vector2 vecToPlayer = Main.player[player].Center - Projectile.Center; - vecToPlayer = vecToPlayer.SafeNormalize(Vector2.UnitY); - vecToPlayer *= homeSpeed; - Projectile.velocity = (Projectile.velocity * 29f + vecToPlayer) / 30f; - Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY); - Projectile.velocity *= homeSpeed; - } - - if (Projectile.velocity.Length() < MaxVelocity) - { - Projectile.velocity *= 1.01f; - if (Projectile.velocity.Length() > MaxVelocity) - { - Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY); - Projectile.velocity *= MaxVelocity; - } - } - - break; - - case 2: // Yellow, split after a certain time - - Projectile.localAI[1] += 1f; - if (Projectile.localAI[1] >= 45f) - { - int numProj = 2; - float rotation = MathHelper.ToRadians(10); - if (Projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed * MaxVelocity, Projectile.type, (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner); - } - } - - Projectile.Kill(); - } - - break; - - case 3: // Lime, home in on player within certain distance - - float inertia = 30f; - float homingSpeed = MaxVelocity; - float minDist = 300f; - if (Main.player[Projectile.owner].active && !Main.player[Projectile.owner].dead) - { - if (Projectile.Distance(Main.player[Projectile.owner].Center) > minDist) - { - Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[Projectile.owner].Center, Vector2.UnitY); - Projectile.velocity = (Projectile.velocity * (inertia - 1f) + moveDirection * homingSpeed) / inertia; - } - } - else - { - if (Projectile.timeLeft > 30) - Projectile.timeLeft = 30; - } - - break; - - case 4: // Green, home in on enemies - - CalamityUtils.HomeInOnNPC(Projectile, false, 600f, MaxVelocity, 30f); - - break; - - case 5: // Turquoise, speed up and don't collide with tiles - - Projectile.tileCollide = false; - if (Projectile.velocity.Length() < MaxVelocity) - { - Projectile.velocity *= 1.03f; - if (Projectile.velocity.Length() > MaxVelocity) - { - Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY); - Projectile.velocity *= MaxVelocity; - } - } - - break; - - case 6: // Cyan, upon death create several turquoise swords - case 7: // Light Blue, slow down on hit - case 8: // Blue, bounce off of tiles and enemies - break; - - case 9: // Purple, speed up and slow down over and over - - if (Projectile.localAI[1] < 30f) - Projectile.velocity *= 0.95f; - else if (Projectile.localAI[1] < 60f) - Projectile.velocity *= 1.07f; - else if (Projectile.localAI[1] == 60f) - Projectile.localAI[1] = -1f; - Projectile.localAI[1] += 1f; - - break; - - case 10: // Fuschia, start slow then get faster - - if (Projectile.localAI[1] == 0f) - { - Projectile.velocity *= 0.1f; - Projectile.localAI[1] += 1f; - } - - if (Projectile.velocity.Length() < MaxVelocity) - { - Projectile.velocity *= 1.05f; - if (Projectile.velocity.Length() > MaxVelocity) - { - Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY); - Projectile.velocity *= MaxVelocity; - } - } - - break; - - case 11: // Hot Pink, split into fuschia while travelling - - if (Projectile.localAI[1] == 0f) - Projectile.velocity *= 0.333f; - - if (Projectile.localAI[1] >= 45f) - { - Projectile.localAI[1] = 0f; - if (Main.myPlayer == Projectile.owner) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Projectile.oldVelocity, Projectile.velocity, Projectile.type, (int)Math.Round(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, 10f, 0f); - } - Projectile.localAI[1] += 1f; - - break; - - default: - break; - } - - Projectile.ai[2] += MathHelper.Lerp(1f, 2f, Projectile.ai[0] / 11f); - if (Projectile.ai[2] > 7f) - { - Dust rainbow = Main.dust[Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y), 8, 8, DustID.RainbowMk2, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, 1.25f)]; - rainbow.velocity *= -0.25f; - rainbow.color = color; - rainbow.color.A = 100; - rainbow.scale = Main.rand.NextFloat(1f, 1.25f); - rainbow.fadeIn = Main.rand.NextFloat(0.4f, 1f); - rainbow.noGravity = true; - rainbow.noLightEmittence = true; - - rainbow = Main.dust[Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y), 8, 8, DustID.RainbowMk2, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, 1.25f)]; - rainbow.velocity *= -0.25f; - rainbow.color = color; - rainbow.color.A = 100; - rainbow.scale = Main.rand.NextFloat(1f, 1.25f); - rainbow.fadeIn = Main.rand.NextFloat(0.4f, 1f); - rainbow.noGravity = true; - rainbow.position -= Projectile.velocity * 0.5f; - rainbow.noLightEmittence = true; - - if (Projectile.localAI[0] == 0f) - { - Projectile.scale -= 0.02f; - Projectile.alpha += 5; - if (Projectile.alpha >= Alpha - 5) - { - Projectile.alpha = Alpha; - Projectile.localAI[0] = 1f; - } - } - else if (Projectile.localAI[0] == 1f) - { - Projectile.scale += 0.02f; - Projectile.alpha -= 5; - if (Projectile.alpha <= 0) - { - Projectile.alpha = 0; - Projectile.localAI[0] = 0f; - } - } - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 300); - - if (Projectile.ai[0] == 7f) - Projectile.velocity *= 0.5f; - else if (Projectile.ai[0] == 8f) - Projectile.velocity *= -1f; - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - target.AddBuff(ModContent.BuffType(), 300); - - if (Projectile.ai[0] == 7f) - Projectile.velocity *= 0.5f; - else if (Projectile.ai[0] == 8f) - Projectile.velocity *= -1f; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (Projectile.ai[0] == 8f) - { - if (Projectile.velocity.X != oldVelocity.X) - Projectile.velocity.X = -oldVelocity.X; - if (Projectile.velocity.Y != oldVelocity.Y) - Projectile.velocity.Y = -oldVelocity.Y; - - return false; - } - - return true; - } - - public Color TrailColor(float completionRatio) - { - float hue = (Main.GlobalTimeWrappedHourly * -0.62f + completionRatio * 1.5f) % 1f; - float brightness = MathHelper.SmoothStep(0.5f, 1f, Utils.GetLerpValue(0.3f, 0f, completionRatio, true)); - float opacity = Utils.GetLerpValue(1f, 0.8f, completionRatio, true) * ((255 - Projectile.alpha) / 255f); - Color color = GetProjectileColor() * opacity; - color.A = (byte)(int)(Utils.GetLerpValue(0f, 0.2f, completionRatio) * 128); - return color; - } - - public float TrailWidth(float completionRatio) - { - float widthInterpolant = Utils.GetLerpValue(0f, 0.25f, completionRatio, true) * Utils.GetLerpValue(1.1f, 0.7f, completionRatio, true); - return MathHelper.SmoothStep(0f, 14f, widthInterpolant) * Projectile.scale; - } - - public override Color? GetAlpha(Color lightColor) => GetProjectileColor(); - - public override bool PreDraw(ref Color lightColor) - { - if (Projectile.timeLeft > TimeLeft - 5) - return false; - - Main.spriteBatch.EnterShaderRegion(); - - GameShaders.Misc["CalamityMod:ArtAttack"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); - GameShaders.Misc["CalamityMod:ArtAttack"].Apply(); - - PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(TrailWidth, TrailColor, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:ArtAttack"]), TrailLength); - - Main.spriteBatch.ExitShaderRegion(); - - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - int frameHeight = texture.Height / Main.projFrames[Type]; - int frameY = frameHeight * Projectile.frame; - float scale = Projectile.scale; - Rectangle rectangle = new Rectangle(0, frameY, texture.Width, frameHeight); - Vector2 origin = rectangle.Size() / 2f; - Color alphaColor = Projectile.GetAlpha(lightColor); - - if (CalamityClientConfig.Instance.Afterimages) - { - Vector2 centerOffset = Projectile.Size / 2f; - int totalAfterimages = TotalAfterimages; - for (int i = 0; i < totalAfterimages; i++) - { - int arrayPos = i * AfterimageOffset; - float afterimageRot = Projectile.oldRot[arrayPos]; - SpriteEffects sfxForThisAfterimage = Projectile.oldSpriteDirection[arrayPos] == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Vector2 drawPos = Projectile.oldPos[arrayPos] + centerOffset - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); - float colorAndSizeScalar = (float)(totalAfterimages - i) / (float)totalAfterimages; - Color color = alphaColor * colorAndSizeScalar; - float afterimageScale = scale * MathHelper.Lerp(0.5f, 1f, colorAndSizeScalar); - Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), color, afterimageRot, origin, afterimageScale, sfxForThisAfterimage, 0f); - } - } - else - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (Projectile.spriteDirection == -1) - spriteEffects = SpriteEffects.FlipHorizontally; - - Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), rectangle, alphaColor, Projectile.rotation, origin, scale, spriteEffects, 0f); - } - - return false; - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); - - Color color = GetProjectileColor(); - switch ((int)Projectile.ai[0]) - { - case 0: // Red - case 1: // Orange - case 2: // Yellow - case 3: // Lime - case 4: // Green - case 5: // Turquoise - break; - - case 6: // Cyan - - for (int x = 0; x < 2; x++) - { - if (Projectile.owner == Main.myPlayer) - { - var source = Projectile.GetSource_FromThis(); - CalamityUtils.ProjectileBarrage(source, Projectile.Center, Projectile.Center, x == 1, 500f, 500f, 0f, 500f, MaxVelocity, Projectile.type, (int)Math.Round(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, false, 0f).ai[0] = 5f; - } - } - - break; - - case 7: // Light Blue - case 8: // Blue - case 9: // Purple - case 10: // Fuschia - case 11: // Hot Pink - default: - break; - } - - int totalDust = 60; - for (int i = 4; i < totalDust + 1; i++) - { - Vector2 oldVel = Projectile.oldVelocity * (totalDust / (float)i); - Dust rainbow = Main.dust[Dust.NewDust(Projectile.oldPosition - oldVel * 0.5f, 8, 8, DustID.RainbowMk2, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha)]; - rainbow.color = color; - rainbow.color.A = 100; - rainbow.scale = Main.rand.NextFloat(2.4f, 3.6f); - rainbow.fadeIn = Main.rand.NextFloat(0.4f, 1f); - rainbow.noGravity = true; - rainbow.velocity *= (Main.rand.NextBool() ? 0.05f : 0.5f); - } - } - - private Color GetProjectileColor() - { - Color rainbow = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Alpha); - Color color = Color.White; - switch ((int)Projectile.ai[0]) - { - case 0: // Red - color = new Color(255, 0, 0, Alpha); - break; - case 1: // Orange - color = new Color(255, 128, 0, Alpha); - break; - case 2: // Yellow - color = new Color(255, 255, 0, Alpha); - break; - case 3: // Lime - color = new Color(128, 255, 0, Alpha); - break; - case 4: // Green - color = new Color(0, 255, 0, Alpha); - break; - case 5: // Turquoise - color = new Color(0, 255, 128, Alpha); - break; - case 6: // Cyan - color = new Color(0, 255, 255, Alpha); - break; - case 7: // Light Blue - color = new Color(0, 128, 255, Alpha); - break; - case 8: // Blue - color = new Color(0, 0, 255, Alpha); - break; - case 9: // Purple - color = new Color(128, 0, 255, Alpha); - break; - case 10: // Fuschia - color = new Color(255, 0, 255, Alpha); - break; - case 11: // Hot Pink - color = new Color(255, 0, 128, Alpha); - break; - default: - break; - } - return Color.Lerp(rainbow, color, (float)Math.Sqrt((MathF.Cos(Projectile.ai[2] / 90f) + 1f) * 0.5f)); - } - } -} diff --git a/Projectiles/Melee/GayBeam.png b/Projectiles/Melee/GayBeam.png deleted file mode 100644 index 50aac5b8b22ce5e930922093f4b531efa09533a6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 738 zcmV<80v-K{P)Px%oJmAMRCt{2nk|yTKoCYhwm1qR77G_ZV7UO;2yTHzVBrE-1Q!5{jo>a>(;qOs znayM?$qZ~iLxrKJEd92BW-`D(W4TRm zynT+SGhwsYIM=7s2>@`tUY)<)j1b<|h_*~1W`yu|MueI$8jSz|+wB&B-vnYt2ybIV zXrDkrO(153kbGwuY65ct_ZLDxP=37jUIVnztb8PT^1#EcMT}d%x1I7b-ka^wF$(G5WK(gWHND1 zk(*9)M4v{}1V)@N@_m~?%m|@2N37Rt06>;yPGlJ=ZH|T!){)lhr0LF5TbL1o*NB&h zl)%%Bmk5@x*Lv4@KA$_^M-!MMv>A2h4qanL2*JNTa{+sO{p5*`u!bEZUujHi6Nnih z1b3EvwCY9Vk%m^VkN3dGZgrX>% z^~>b~09dV7mFroS0q~m>8#6*^+(!^bn33l-s|6#^D#54O*jdJ!DSVg_LgPMyW-#(J zLci*q!0O?9&M`J-gb-|m&Ji?1=Kx(T$YQYo@T@ASEe8ChQX!c|EoIW{=pI5rWqUZ9?6&Shru{+XF3%qWtZ9 z`@)P6enf#L=vkueh_!W+))r=jFsPdRa80z}|Uoj(uZ-_K* U8DIPvr~m)}07*qoM6N<$g5hIF1^@s6 diff --git a/Projectiles/Melee/IridescentExcaliburSlash.cs b/Projectiles/Melee/IridescentExcaliburSlash.cs deleted file mode 100644 index a91263e002..0000000000 --- a/Projectiles/Melee/IridescentExcaliburSlash.cs +++ /dev/null @@ -1,254 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.Graphics.Primitives; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.GameContent; -using Terraria.GameContent.Drawing; -using Terraria.Graphics.Shaders; -using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Balancing; -using CalamityMod.Projectiles.Healing; - -namespace CalamityMod.Projectiles.Melee -{ - public class IridescentExcaliburSlash : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 4; - } - - public override void SetDefaults() - { - Projectile.width = 16; - Projectile.height = 16; - Projectile.friendly = true; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.ownerHitCheck = true; - Projectile.ownerHitCheckDistance = 300f; - Projectile.usesOwnerMeleeHitCD = true; - Projectile.stopsDealingDamageAfterPenetrateHits = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - } - - public override void AI() - { - Projectile.localAI[0] += 1f; - Player player = Main.player[Projectile.owner]; - float num = Projectile.localAI[0] / Projectile.ai[1]; - float num2 = Projectile.ai[0]; - float num3 = Projectile.velocity.ToRotation(); - float num4 = (float)Math.PI * num2 * num + num3 + num2 * (float)Math.PI + player.fullRotation; - Projectile.rotation = num4; - float num5 = 1f; - float num6 = 1.2f; - - Projectile.Center = player.RotatedRelativePoint(player.MountedCenter) - Projectile.velocity; - Projectile.scale = num6 + num * num5; - - float colorAIScale = Projectile.localAI[0] / Projectile.ai[1]; - float amount = Utils.Remap(colorAIScale, 0f, 0.6f, 0f, 1f) * Utils.Remap(colorAIScale, 0.6f, 1f, 1f, 0f); - Color rainbow = Color.Lerp(new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB), amount); - float num8 = Projectile.rotation + Main.rand.NextFloatDirection() * MathHelper.PiOver2 * 0.7f; - Vector2 vector2 = Projectile.Center + num8.ToRotationVector2() * 84f * Projectile.scale; - Vector2 vector3 = (num8 + Projectile.ai[0] * MathHelper.PiOver2).ToRotationVector2(); - if (Main.rand.NextFloat() * 2f < Projectile.Opacity) - { - Dust dust2 = Dust.NewDustPerfect(Projectile.Center + num8.ToRotationVector2() * (Main.rand.NextFloat() * 80f * Projectile.scale + 20f * Projectile.scale), 278, vector3 * 1f, 100, rainbow, 0.4f); - dust2.fadeIn = 0.4f + Main.rand.NextFloat() * 0.15f; - dust2.noGravity = true; - } - - if (Main.rand.NextFloat() * 1.5f < Projectile.Opacity) - Dust.NewDustPerfect(vector2, 43, vector3 * 1f, 100, rainbow * Projectile.Opacity, 1.2f * Projectile.Opacity); - - float num10 = Projectile.rotation + Main.rand.NextFloatDirection() * MathHelper.PiOver2 * 0.7f; - Vector2 vector5 = Projectile.Center + num10.ToRotationVector2() * 84f * Projectile.scale; - Vector2 vector6 = (num10 + Projectile.ai[0] * MathHelper.PiOver2).ToRotationVector2(); - if (Main.rand.NextFloat() < Projectile.Opacity) - { - Dust dust4 = Dust.NewDustPerfect(Projectile.Center + num10.ToRotationVector2() * (Main.rand.NextFloat() * 80f * Projectile.scale + 20f * Projectile.scale), 278, vector6 * 1f, 100, rainbow, 0.4f); - dust4.fadeIn = 0.4f + Main.rand.NextFloat() * 0.15f; - dust4.noGravity = true; - } - - if (Main.rand.NextFloat() * 1.5f < Projectile.Opacity) - Dust.NewDustPerfect(vector5, 43, vector6 * 1f, 100, rainbow * Projectile.Opacity, 1.2f * Projectile.Opacity); - - Projectile.scale *= Projectile.ai[2]; - if (Projectile.localAI[0] >= Projectile.ai[1]) - Projectile.Kill(); - - // Enchantment visual bullshit - Vector2 boxPosition = Projectile.position; - int boxWidth = Projectile.width; - int boxHeight = Projectile.height; - for (float i = -MathHelper.PiOver4; i <= MathHelper.PiOver4; i += MathHelper.PiOver2) - { - Rectangle rect = Utils.CenteredRectangle(Projectile.Center + (Projectile.rotation + i).ToRotationVector2() * 70f * Projectile.scale, new Vector2(60f * Projectile.scale, 60f * Projectile.scale)); - Projectile.EmitEnchantmentVisualsAt(rect.TopLeft(), rect.Width, rect.Height); - } - } - - public override bool PreDraw(ref Color lightColor) - { - Vector2 vector = Projectile.Center - Main.screenPosition; - Texture2D asset = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Rectangle rectangle = asset.Frame(1, 4); - Vector2 origin = rectangle.Size() / 2f; - float num = Projectile.scale * 1.1f; - SpriteEffects effects = ((!(Projectile.ai[0] >= 0f)) ? SpriteEffects.FlipVertically : SpriteEffects.None); - float num2 = Projectile.localAI[0] / Projectile.ai[1]; - float num3 = Utils.Remap(num2, 0f, 0.6f, 0f, 1f) * Utils.Remap(num2, 0.6f, 1f, 1f, 0f); - float num4 = 0.975f; - float amount = num3; - float fromValue = Lighting.GetColor(Projectile.Center.ToTileCoordinates()).ToVector3().Length() / (float)Math.Sqrt(3D); - fromValue = Utils.Remap(fromValue, 0.2f, 1f, 0f, 1f); - Color color = Color.Lerp(new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB), amount); - Main.spriteBatch.Draw(asset, vector, rectangle, color * fromValue * num3, Projectile.rotation + Projectile.ai[0] * MathHelper.PiOver4 * -1f * (1f - num2), origin, num, effects, 0f); - Color color2 = Color.Lerp(new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB), amount); - Color color3 = Color.Lerp(new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB), amount); - Color color4 = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB) * num3 * 0.5f; - Color color5 = color4 * fromValue * 0.5f; - Main.spriteBatch.Draw(asset, vector, rectangle, color5 * 0.15f, Projectile.rotation + Projectile.ai[0] * 0.01f, origin, num, effects, 0f); - Main.spriteBatch.Draw(asset, vector, rectangle, color3 * fromValue * num3 * 0.3f, Projectile.rotation, origin, num, effects, 0f); - Main.spriteBatch.Draw(asset, vector, rectangle, color2 * fromValue * num3 * 0.5f, Projectile.rotation, origin, num * num4, effects, 0f); - Main.spriteBatch.Draw(asset, vector, asset.Frame(1, 4, 0, 3), new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB) * 0.6f * num3, Projectile.rotation + Projectile.ai[0] * 0.01f, origin, num, effects, 0f); - Main.spriteBatch.Draw(asset, vector, asset.Frame(1, 4, 0, 3), new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB) * 0.5f * num3, Projectile.rotation + Projectile.ai[0] * -0.05f, origin, num * 0.8f, effects, 0f); - Main.spriteBatch.Draw(asset, vector, asset.Frame(1, 4, 0, 3), new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB) * 0.4f * num3, Projectile.rotation + Projectile.ai[0] * -0.1f, origin, num * 0.6f, effects, 0f); - float num5 = num * 0.75f; - Texture2D value = TextureAssets.Extra[98].Value; - Color shineColor = color3 * Projectile.Opacity * 0.5f; - Vector2 origin2 = value.Size() / 2f; - float num9 = Utils.GetLerpValue(0f, 0.5f, num2, clamped: true) * Utils.GetLerpValue(1f, 0.5f, num2, clamped: true); - Vector2 vector3 = new Vector2((Vector2.One * num5).X * 0.5f, (new Vector2(0f, Utils.Remap(num2, 0f, 1f, 3f, 0f)) * num5).X) * num9; - Vector2 vector2 = new Vector2((Vector2.One * num5).Y * 0.5f, (new Vector2(0f, Utils.Remap(num2, 0f, 1f, 3f, 0f)) * num5).Y) * num9; - shineColor *= num9; - for (float num6 = 0f; num6 < 12f; num6 += 1f) - { - float num7 = Projectile.rotation + Projectile.ai[0] * num6 * -MathHelper.TwoPi * 0.025f + Utils.Remap(num2, 0f, 0.6f, 0f, 0.95504415f) * Projectile.ai[0]; - Vector2 drawpos = vector + num7.ToRotationVector2() * ((float)asset.Width * 0.5f - 6f) * num; - float num8 = num6 / 12f; - - Color color6 = new Color(255, 255, 255, 0) * num3 * num8 * 0.5f; - color6 *= num9; - Main.EntitySpriteDraw(value, drawpos, null, shineColor, MathHelper.PiOver2 + num7, origin2, vector3, SpriteEffects.None); - Main.EntitySpriteDraw(value, drawpos, null, shineColor, 0f + num7, origin2, vector2, SpriteEffects.None); - Main.EntitySpriteDraw(value, drawpos, null, color6, MathHelper.PiOver2 + num7, origin2, vector3 * 0.6f, SpriteEffects.None); - Main.EntitySpriteDraw(value, drawpos, null, color6, 0f + num7, origin2, vector2 * 0.6f, SpriteEffects.None); - } - - Vector2 drawpos2 = vector + (Projectile.rotation + Utils.Remap(num2, 0f, 0.6f, 0f, 0.95504415f) * Projectile.ai[0]).ToRotationVector2() * ((float)asset.Width * 0.5f - 4f) * num; - Color color7 = new Color(255, 255, 255, 0) * num3 * 0.5f; - color7 *= num9; - Main.EntitySpriteDraw(value, drawpos2, null, shineColor, MathHelper.PiOver2 + Projectile.rotation, origin2, vector3, SpriteEffects.None); - Main.EntitySpriteDraw(value, drawpos2, null, shineColor, 0f + Projectile.rotation, origin2, vector2, SpriteEffects.None); - Main.EntitySpriteDraw(value, drawpos2, null, color7, MathHelper.PiOver2 + Projectile.rotation, origin2, vector3 * 0.6f, SpriteEffects.None); - Main.EntitySpriteDraw(value, drawpos2, null, color7, 0f + Projectile.rotation, origin2, vector2 * 0.6f, SpriteEffects.None); - - return false; - } - - public override void CutTiles() - { - Vector2 startPoint = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * 60f * Projectile.scale; - Vector2 endPoint = (Projectile.rotation + MathHelper.PiOver4).ToRotationVector2() * 60f * Projectile.scale; - float projectileSize = 60f * Projectile.scale; - Utils.PlotTileLine(Projectile.Center + startPoint, Projectile.Center + endPoint, projectileSize, DelegateMethods.CutTiles); - } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.HitDirectionOverride = (Main.player[Projectile.owner].Center.X < target.Center.X) ? 1 : -1; - - Vector2 positionInWorld = Main.rand.NextVector2FromRectangle(target.Hitbox); - ParticleOrchestraSettings particleOrchestraSettings = default(ParticleOrchestraSettings); - particleOrchestraSettings.PositionInWorld = positionInWorld; - ParticleOrchestraSettings settings = particleOrchestraSettings; - switch (Main.rand.Next(5)) - { - default: - case 0: - ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.NightsEdge, settings, Projectile.owner); - break; - - case 1: - ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.TrueNightsEdge, settings, Projectile.owner); - break; - - case 2: - settings.MovementVector = Projectile.velocity; - ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.TerraBlade, settings, Projectile.owner); - break; - - case 3: - ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.Excalibur, settings, Projectile.owner); - break; - - case 4: - ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.TrueExcalibur, settings, Projectile.owner); - break; - } - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - float coneLength = 94f * Projectile.scale; - float scale = MathHelper.TwoPi / 25f * Projectile.ai[0]; - float maximumAngle = MathHelper.PiOver4; - float coneRotation = Projectile.rotation + scale; - if (targetHitbox.IntersectsConeSlowMoreAccurate(Projectile.Center, coneLength, coneRotation, maximumAngle)) - return true; - - float rotation = Utils.Remap(Projectile.localAI[0], Projectile.ai[1] * 0.3f, Projectile.ai[1] * 0.5f, 1f, 0f); - if (rotation > 0f) - { - float coneRotation2 = coneRotation - MathHelper.PiOver4 * Projectile.ai[0] * rotation; - if (targetHitbox.IntersectsConeSlowMoreAccurate(Projectile.Center, coneLength, coneRotation2, maximumAngle)) - return true; - } - - return false; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 600); - target.AddBuff(ModContent.BuffType(), 60); - - int heal = (int)Math.Round(hit.Damage * 0.01); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - target.AddBuff(ModContent.BuffType(), 600); - target.AddBuff(ModContent.BuffType(), 60); - - int heal = (int)Math.Round(info.Damage * 0.01); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); - } - } -} diff --git a/Projectiles/Melee/IridescentExcaliburSlash.png b/Projectiles/Melee/IridescentExcaliburSlash.png deleted file mode 100644 index 9a31d6718ad9e30e327450984ea2a4d347b5cca2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2957 zcmZ`*Yfuwe7LJsxF5)<=1RtoB>@oupM8^l^s-T7z2_Ol1UhH;K z?8|=pqUf@B+QYW=ZH2xe+=efHz5Z|$f&Ar|Q;JK#vFc-8ZeT6~;rQ34$!X){=%XB+ zM{{H9=|#tH-OOXr&J6d;u4P({{Z#><>%o|EmhagxP}Iyc>U-oH+>1~zDx+bH%R(H} z#qY#Vs!623*oc-3bgU{;g?Q;6TB1~r+vJ0p!R;g|w0%JHpv_veFoQDRos<=lBE`ax zbG9`%HefF7@EDq}6pv(9)-#Esg_%lHP@g1|G9QT$$q-jgiv+H{ZTlpP$#8HYW9ur4gok6 zfwAy;`4u2DcItXY8E>Kr!_fbI(_1RLGNs9CoZm1UR?H+Uz<8)&l#QM# zOLbT|V*@c|(_aQ8K65LW5MD(O6^!%ziJ&C-arP-LjM;T(Q?`&7Z?^e8O2=3L^R8`U z#5|C5b;N>t|14M*`%+jwc^K-ok>OBFvp+J$3ez6hH7vW+8v}N~Fk@mP`OZ03#n&L3 zJb+Z)-wJn?caRfHcHG{SeIQtd^tEo?IF%kkpBEx)61V zWBOpLvBRTjhI2QZW{v=GP@$l4`brU)ahK{FsLU6xnyGXUAiE@2G4tt@dTcA1O79>w z?s==r7oRXOT7pLA!3hBXU*&R{zimP+-&rGHHr!dL2&#C40djV{W31|AO?RH zAGh(_h&7j(I3;LqxGgKhXuBIbS)5*mA(vGr!KR83l_0J%C9r|CgDUr;$Ku9umu+m0 zs=5aE%DW!RgsW7yu;mg6SpYw;W!|2~^&b=JzuGufH8ZWX$n9Qs zouPeaE&v7HlP4+Vm=;aNsUA1N$r3w;Wk;cFgSGrc|K!+ySYr%7$*La?P86J+YHA#h zjnOxUO`X8Fm{smj>H3zNN%Drv(Zxc~m9zN0wOZw^DG2dbzEsdw#R&{jXu7USjs z0Zts>mWzRhVKjd97a5%2D+8uIH$&!u5@}R)<9p}&CssM8O8_ciXi-62zAfaEeo#^` zaM!A0ID@ITi0-5go2{*kbq~7Fojj(g;``Ht<8RfJcdf((O-|nR%)jf0oI!!fiVH=4 zf_O^!O!{IITCTPAK2D7?sv5@%ShIXoW^vW`R>7S6R=CQ+=8_q#DE(S92Nf3 z1KEQm)K0|wr5{c9>?wibWm|{gdWLcA@R96i+HJ0w#{FD^;K>AT7uIWOj+l9%SjvA4 zGE8N7)KB1^12QfY7eEva9ocmgC(5lAd1I3FpPWhmigeQUE;A8rhz~oW0Z}YI1^?{V z?o~XZWnm2$sOs*@eu&0V{ltgwLb{|4sQ@8+Xzc%LaXCgx`w3=rS1Xwi-MBQx&e38& z;*5|#9jKVA^*3Al&*XCKi`_ulmhy4UFEq8lbS zz__JGU*709$B#U4|M<6W6q|EEl1Ehm^n!`REl5c@%P>-l6In)j)oCg#*XLURaEUw5 zitn0MYTK+MqG|Fvby?Q~wh}Z1prDeFzEgCy8y!l#?)AlbsMt7TrPgvyhe5LgR#+jd z>kMVyWx?JyLA{r(yrO1~b3-7NJX&k7IzxLBUEm(6bJv_VL)mMiD*x#OLp|Apbs!Hf z-F+8&+5s4oAvF}eTIw%~swz%ZZ_l8deZ#jMFMs4AlRZ~e?U=aE27XW!`c>Vz=jwQA z3^q~p9RNb)^7zUr2;+hKRAup-N4vnfu?%i&U+K3p?eM+uFMPtOD;G?1-4pwLBy~-xdpd*eU*H0}ON` zWwjFZXf8BkCx5%N0FI@SX!9V6`z~1d;$(eB2VL!KE1L zI%dBeC;AOb$<`O-*zD zo$X8--6?}Yc3ZHT2|C7Y;~K1SjII^=OT;pD-U0l|@T0DS*O;;+f{aU|)GTz~k)C}4 ym "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/Melee/IridescentExcaliburSlash"; - - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 4; - } - - public override void SetDefaults() - { - Projectile.width = 16; - Projectile.height = 16; - Projectile.friendly = true; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.ownerHitCheck = true; - Projectile.ownerHitCheckDistance = 300f; - Projectile.usesOwnerMeleeHitCD = true; - Projectile.stopsDealingDamageAfterPenetrateHits = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = 3; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - } - - public override void AI() - { - Projectile.localAI[0] += 1f; - Player player = Main.player[Projectile.owner]; - float num = Projectile.localAI[0] / Projectile.ai[1]; - float num2 = Projectile.ai[0]; - float num3 = Projectile.velocity.ToRotation(); - float num4 = (float)Math.PI * num2 * num + num3 + num2 * (float)Math.PI + player.fullRotation; - Projectile.rotation = num4; - float num5 = 0.8f; - float num6 = 1.1f; - - Projectile.Center = player.RotatedRelativePoint(player.MountedCenter) - Projectile.velocity; - Projectile.scale = num6 + num * num5; - - float colorAIScale = Projectile.localAI[0] / Projectile.ai[1]; - float amount = Utils.Remap(colorAIScale, 0f, 0.6f, 0f, 1f) * Utils.Remap(colorAIScale, 0.6f, 1f, 1f, 0f); - Color rainbow = Color.Lerp(new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB), new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), amount); - float num8 = Projectile.rotation + Main.rand.NextFloatDirection() * MathHelper.PiOver2 * 0.7f; - Vector2 vector2 = Projectile.Center + num8.ToRotationVector2() * 84f * Projectile.scale; - Vector2 vector3 = (num8 + Projectile.ai[0] * MathHelper.PiOver2).ToRotationVector2(); - if (Main.rand.NextFloat() * 2f < Projectile.Opacity) - { - Dust dust2 = Dust.NewDustPerfect(Projectile.Center + num8.ToRotationVector2() * (Main.rand.NextFloat() * 80f * Projectile.scale + 20f * Projectile.scale), 278, vector3 * 1f, 100, rainbow, 0.4f); - dust2.fadeIn = 0.4f + Main.rand.NextFloat() * 0.15f; - dust2.noGravity = true; - } - - if (Main.rand.NextFloat() * 1.5f < Projectile.Opacity) - Dust.NewDustPerfect(vector2, 43, vector3 * 1f, 100, rainbow * Projectile.Opacity, 1.2f * Projectile.Opacity); - - float num10 = Projectile.rotation + Main.rand.NextFloatDirection() * MathHelper.PiOver2 * 0.7f; - Vector2 vector5 = Projectile.Center + num10.ToRotationVector2() * 84f * Projectile.scale; - Vector2 vector6 = (num10 + Projectile.ai[0] * MathHelper.PiOver2).ToRotationVector2(); - if (Main.rand.NextFloat() < Projectile.Opacity) - { - Dust dust4 = Dust.NewDustPerfect(Projectile.Center + num10.ToRotationVector2() * (Main.rand.NextFloat() * 80f * Projectile.scale + 20f * Projectile.scale), 278, vector6 * 1f, 100, rainbow, 0.4f); - dust4.fadeIn = 0.4f + Main.rand.NextFloat() * 0.15f; - dust4.noGravity = true; - } - - if (Main.rand.NextFloat() * 1.5f < Projectile.Opacity) - Dust.NewDustPerfect(vector5, 43, vector6 * 1f, 100, rainbow * Projectile.Opacity, 1.2f * Projectile.Opacity); - - Projectile.scale *= Projectile.ai[2]; - if (Projectile.localAI[0] >= Projectile.ai[1]) - Projectile.Kill(); - - // Enchantment visual bullshit - Vector2 boxPosition = Projectile.position; - int boxWidth = Projectile.width; - int boxHeight = Projectile.height; - for (float i = -MathHelper.PiOver4; i <= MathHelper.PiOver4; i += MathHelper.PiOver2) - { - Rectangle rect = Utils.CenteredRectangle(Projectile.Center + (Projectile.rotation + i).ToRotationVector2() * 70f * Projectile.scale, new Vector2(60f * Projectile.scale, 60f * Projectile.scale)); - Projectile.EmitEnchantmentVisualsAt(rect.TopLeft(), rect.Width, rect.Height); - } - } - - public override bool PreDraw(ref Color lightColor) - { - Vector2 vector = Projectile.Center - Main.screenPosition; - Texture2D asset = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Rectangle rectangle = asset.Frame(1, 4); - Vector2 origin = rectangle.Size() / 2f; - float num = Projectile.scale * 1.1f; - SpriteEffects effects = ((!(Projectile.ai[0] >= 0f)) ? SpriteEffects.FlipVertically : SpriteEffects.None); - float num2 = Projectile.localAI[0] / Projectile.ai[1]; - float num3 = Utils.Remap(num2, 0f, 0.6f, 0f, 1f) * Utils.Remap(num2, 0.6f, 1f, 1f, 0f); - float num4 = 0.975f; - float amount = num3; - float fromValue = Lighting.GetColor(Projectile.Center.ToTileCoordinates()).ToVector3().Length() / (float)Math.Sqrt(3D); - fromValue = Utils.Remap(fromValue, 0.2f, 1f, 0f, 1f); - Color color = Color.Lerp(new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB), new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), amount); - Main.spriteBatch.Draw(asset, vector, rectangle, color * fromValue * num3, Projectile.rotation + Projectile.ai[0] * MathHelper.PiOver4 * -1f * (1f - num2), origin, num, effects, 0f); - Color color2 = Color.Lerp(new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB), new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), amount); - Color color3 = Color.Lerp(new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB), new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), amount); - Color color4 = new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB) * num3 * 0.5f; - color4.A = (byte)(((float)(int)color4.A * (1f - fromValue)) * 0.5f); - Color color5 = color4 * fromValue * 0.5f; - Main.spriteBatch.Draw(asset, vector, rectangle, color5 * 0.15f, Projectile.rotation + Projectile.ai[0] * 0.01f, origin, num, effects, 0f); - Main.spriteBatch.Draw(asset, vector, rectangle, color3 * fromValue * num3 * 0.3f, Projectile.rotation, origin, num, effects, 0f); - Main.spriteBatch.Draw(asset, vector, rectangle, color2 * fromValue * num3 * 0.5f, Projectile.rotation, origin, num * num4, effects, 0f); - Main.spriteBatch.Draw(asset, vector, asset.Frame(1, 4, 0, 3), new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB) * 0.6f * num3, Projectile.rotation + Projectile.ai[0] * 0.01f, origin, num, effects, 0f); - Main.spriteBatch.Draw(asset, vector, asset.Frame(1, 4, 0, 3), new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB) * 0.5f * num3, Projectile.rotation + Projectile.ai[0] * -0.05f, origin, num * 0.8f, effects, 0f); - Main.spriteBatch.Draw(asset, vector, asset.Frame(1, 4, 0, 3), new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB) * 0.4f * num3, Projectile.rotation + Projectile.ai[0] * -0.1f, origin, num * 0.6f, effects, 0f); - float num5 = num * 0.75f; - Texture2D value = TextureAssets.Extra[98].Value; - Color shineColor = color3 * Projectile.Opacity * 0.5f; - shineColor.A /= 2; - Vector2 origin2 = value.Size() / 2f; - float num9 = Utils.GetLerpValue(0f, 0.5f, num2, clamped: true) * Utils.GetLerpValue(1f, 0.5f, num2, clamped: true); - Vector2 vector3 = new Vector2((Vector2.One * num5).X * 0.5f, (new Vector2(0f, Utils.Remap(num2, 0f, 1f, 3f, 0f)) * num5).X) * num9; - Vector2 vector2 = new Vector2((Vector2.One * num5).Y * 0.5f, (new Vector2(0f, Utils.Remap(num2, 0f, 1f, 3f, 0f)) * num5).Y) * num9; - shineColor *= num9; - for (float num6 = 0f; num6 < 12f; num6 += 1f) - { - float num7 = Projectile.rotation + Projectile.ai[0] * num6 * -MathHelper.TwoPi * 0.025f + Utils.Remap(num2, 0f, 0.6f, 0f, 0.95504415f) * Projectile.ai[0]; - Vector2 drawpos = vector + num7.ToRotationVector2() * ((float)asset.Width * 0.5f - 6f) * num; - float num8 = num6 / 12f; - - Color color6 = new Color(255, 255, 255, 0) * num3 * num8 * 0.5f; - color6 *= num9; - Main.EntitySpriteDraw(value, drawpos, null, shineColor, MathHelper.PiOver2 + num7, origin2, vector3, SpriteEffects.None); - Main.EntitySpriteDraw(value, drawpos, null, shineColor, 0f + num7, origin2, vector2, SpriteEffects.None); - Main.EntitySpriteDraw(value, drawpos, null, color6, MathHelper.PiOver2 + num7, origin2, vector3 * 0.6f, SpriteEffects.None); - Main.EntitySpriteDraw(value, drawpos, null, color6, 0f + num7, origin2, vector2 * 0.6f, SpriteEffects.None); - } - - Vector2 drawpos2 = vector + (Projectile.rotation + Utils.Remap(num2, 0f, 0.6f, 0f, 0.95504415f) * Projectile.ai[0]).ToRotationVector2() * ((float)asset.Width * 0.5f - 4f) * num; - Color color7 = new Color(255, 255, 255, 0) * num3 * 0.5f; - color7 *= num9; - Main.EntitySpriteDraw(value, drawpos2, null, shineColor, MathHelper.PiOver2 + Projectile.rotation, origin2, vector3, SpriteEffects.None); - Main.EntitySpriteDraw(value, drawpos2, null, shineColor, 0f + Projectile.rotation, origin2, vector2, SpriteEffects.None); - Main.EntitySpriteDraw(value, drawpos2, null, color7, MathHelper.PiOver2 + Projectile.rotation, origin2, vector3 * 0.6f, SpriteEffects.None); - Main.EntitySpriteDraw(value, drawpos2, null, color7, 0f + Projectile.rotation, origin2, vector2 * 0.6f, SpriteEffects.None); - - return false; - } - - public override void CutTiles() - { - Vector2 startPoint = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * 60f * Projectile.scale; - Vector2 endPoint = (Projectile.rotation + MathHelper.PiOver4).ToRotationVector2() * 60f * Projectile.scale; - float projectileSize = 60f * Projectile.scale; - Utils.PlotTileLine(Projectile.Center + startPoint, Projectile.Center + endPoint, projectileSize, DelegateMethods.CutTiles); - } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.HitDirectionOverride = (Main.player[Projectile.owner].Center.X < target.Center.X) ? 1 : -1; - - Vector2 positionInWorld = Main.rand.NextVector2FromRectangle(target.Hitbox); - ParticleOrchestraSettings particleOrchestraSettings = default(ParticleOrchestraSettings); - particleOrchestraSettings.PositionInWorld = positionInWorld; - ParticleOrchestraSettings settings = particleOrchestraSettings; - switch (Main.rand.Next(5)) - { - default: - case 0: - ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.NightsEdge, settings, Projectile.owner); - break; - - case 1: - ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.TrueNightsEdge, settings, Projectile.owner); - break; - - case 2: - settings.MovementVector = Projectile.velocity; - ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.TerraBlade, settings, Projectile.owner); - break; - - case 3: - ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.Excalibur, settings, Projectile.owner); - break; - - case 4: - ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.TrueExcalibur, settings, Projectile.owner); - break; - } - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - float coneLength = 94f * Projectile.scale; - float scale = MathHelper.TwoPi / 25f * Projectile.ai[0]; - float maximumAngle = MathHelper.PiOver4; - float coneRotation = Projectile.rotation + scale; - if (targetHitbox.IntersectsConeSlowMoreAccurate(Projectile.Center, coneLength, coneRotation, maximumAngle)) - return true; - - float rotation = Utils.Remap(Projectile.localAI[0], Projectile.ai[1] * 0.3f, Projectile.ai[1] * 0.5f, 1f, 0f); - if (rotation > 0f) - { - float coneRotation2 = coneRotation - MathHelper.PiOver4 * Projectile.ai[0] * rotation; - if (targetHitbox.IntersectsConeSlowMoreAccurate(Projectile.Center, coneLength, coneRotation2, maximumAngle)) - return true; - } - - return false; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 600); - target.AddBuff(ModContent.BuffType(), 60); - } - } -} diff --git a/Projectiles/Melee/IridescentExcaliburSlash3.cs b/Projectiles/Melee/IridescentExcaliburSlash3.cs deleted file mode 100644 index b370bdf8b5..0000000000 --- a/Projectiles/Melee/IridescentExcaliburSlash3.cs +++ /dev/null @@ -1,238 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.Graphics.Primitives; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.GameContent; -using Terraria.GameContent.Drawing; -using Terraria.Graphics.Shaders; -using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; - -namespace CalamityMod.Projectiles.Melee -{ - public class IridescentExcaliburSlash3 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/Melee/IridescentExcaliburSlash"; - - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 4; - } - - public override void SetDefaults() - { - Projectile.width = 16; - Projectile.height = 16; - Projectile.friendly = true; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.ownerHitCheck = true; - Projectile.ownerHitCheckDistance = 300f; - Projectile.usesOwnerMeleeHitCD = true; - Projectile.stopsDealingDamageAfterPenetrateHits = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = 3; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - } - - public override void AI() - { - Projectile.localAI[0] += 1f; - Player player = Main.player[Projectile.owner]; - float num = Projectile.localAI[0] / Projectile.ai[1]; - float num2 = Projectile.ai[0]; - float num3 = Projectile.velocity.ToRotation(); - float num4 = (float)Math.PI * num2 * num + num3 + num2 * (float)Math.PI + player.fullRotation; - Projectile.rotation = num4; - float num5 = 0.6f; - float num6 = 1f; - - Projectile.Center = player.RotatedRelativePoint(player.MountedCenter) - Projectile.velocity; - Projectile.scale = num6 + num * num5; - - float colorAIScale = Projectile.localAI[0] / Projectile.ai[1]; - float amount = Utils.Remap(colorAIScale, 0f, 0.6f, 0f, 1f) * Utils.Remap(colorAIScale, 0.6f, 1f, 1f, 0f); - Color rainbow = Color.Lerp(new Color(255 - (Math.Abs(128 - Main.DiscoR) * 2 - 1), 255 - (Math.Abs(128 - Main.DiscoG) * 2 - 1), 255 - (Math.Abs(128 - Main.DiscoB) * 2 - 1)), - new Color(Math.Abs(128 - Main.DiscoR) * 2 - 1, Math.Abs(128 - Main.DiscoG) * 2 - 1, Math.Abs(128 - Main.DiscoB) * 2 - 1), amount); - - float num8 = Projectile.rotation + Main.rand.NextFloatDirection() * MathHelper.PiOver2 * 0.7f; - Vector2 vector2 = Projectile.Center + num8.ToRotationVector2() * 84f * Projectile.scale; - Vector2 vector3 = (num8 + Projectile.ai[0] * MathHelper.PiOver2).ToRotationVector2(); - if (Main.rand.NextFloat() * 2f < Projectile.Opacity) - { - Dust dust2 = Dust.NewDustPerfect(Projectile.Center + num8.ToRotationVector2() * (Main.rand.NextFloat() * 80f * Projectile.scale + 20f * Projectile.scale), 278, vector3 * 1f, 100, rainbow, 0.4f); - dust2.fadeIn = 0.4f + Main.rand.NextFloat() * 0.15f; - dust2.noGravity = true; - } - - if (Main.rand.NextFloat() * 1.5f < Projectile.Opacity) - Dust.NewDustPerfect(vector2, 43, vector3 * 1f, 100, rainbow * Projectile.Opacity, 1.2f * Projectile.Opacity); - - float num10 = Projectile.rotation + Main.rand.NextFloatDirection() * MathHelper.PiOver2 * 0.7f; - Vector2 vector5 = Projectile.Center + num10.ToRotationVector2() * 84f * Projectile.scale; - Vector2 vector6 = (num10 + Projectile.ai[0] * MathHelper.PiOver2).ToRotationVector2(); - if (Main.rand.NextFloat() < Projectile.Opacity) - { - Dust dust4 = Dust.NewDustPerfect(Projectile.Center + num10.ToRotationVector2() * (Main.rand.NextFloat() * 80f * Projectile.scale + 20f * Projectile.scale), 278, vector6 * 1f, 100, rainbow, 0.4f); - dust4.fadeIn = 0.4f + Main.rand.NextFloat() * 0.15f; - dust4.noGravity = true; - } - - if (Main.rand.NextFloat() * 1.5f < Projectile.Opacity) - Dust.NewDustPerfect(vector5, 43, vector6 * 1f, 100, rainbow * Projectile.Opacity, 1.2f * Projectile.Opacity); - - Projectile.scale *= Projectile.ai[2]; - if (Projectile.localAI[0] >= Projectile.ai[1]) - Projectile.Kill(); - - // Enchantment visual bullshit - Vector2 boxPosition = Projectile.position; - int boxWidth = Projectile.width; - int boxHeight = Projectile.height; - for (float i = -MathHelper.PiOver4; i <= MathHelper.PiOver4; i += MathHelper.PiOver2) - { - Rectangle rect = Utils.CenteredRectangle(Projectile.Center + (Projectile.rotation + i).ToRotationVector2() * 70f * Projectile.scale, new Vector2(60f * Projectile.scale, 60f * Projectile.scale)); - Projectile.EmitEnchantmentVisualsAt(rect.TopLeft(), rect.Width, rect.Height); - } - } - - public override bool PreDraw(ref Color lightColor) - { - Vector2 vector = Projectile.Center - Main.screenPosition; - Texture2D asset = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Rectangle rectangle = asset.Frame(1, 4); - Vector2 origin = rectangle.Size() / 2f; - float num = Projectile.scale * 1.1f; - SpriteEffects effects = ((!(Projectile.ai[0] >= 0f)) ? SpriteEffects.FlipVertically : SpriteEffects.None); - float num2 = Projectile.localAI[0] / Projectile.ai[1]; - float num3 = Utils.Remap(num2, 0f, 0.6f, 0f, 1f) * Utils.Remap(num2, 0.6f, 1f, 1f, 0f); - float num4 = 0.975f; - float amount = num3; - float fromValue = Lighting.GetColor(Projectile.Center.ToTileCoordinates()).ToVector3().Length() / (float)Math.Sqrt(3D); - fromValue = Utils.Remap(fromValue, 0.2f, 1f, 0f, 1f); - - Color color = Color.Lerp(new Color(255 - (Math.Abs(128 - Main.DiscoR) * 2 - 1), 255 - (Math.Abs(128 - Main.DiscoG) * 2 - 1), 255 - (Math.Abs(128 - Main.DiscoB) * 2 - 1)), - new Color(Math.Abs(128 - Main.DiscoR) * 2 - 1, Math.Abs(128 - Main.DiscoG) * 2 - 1, Math.Abs(128 - Main.DiscoB) * 2 - 1), amount); - Main.spriteBatch.Draw(asset, vector, rectangle, color * fromValue * num3, Projectile.rotation + Projectile.ai[0] * MathHelper.PiOver4 * -1f * (1f - num2), origin, num, effects, 0f); - Color color2 = Color.Lerp(new Color(255 - (Math.Abs(128 - Main.DiscoR) * 2 - 1), 255 - (Math.Abs(128 - Main.DiscoG) * 2 - 1), 255 - (Math.Abs(128 - Main.DiscoB) * 2 - 1)), - new Color(Math.Abs(128 - Main.DiscoR) * 2 - 1, Math.Abs(128 - Main.DiscoG) * 2 - 1, Math.Abs(128 - Main.DiscoB) * 2 - 1), amount); - Color color3 = Color.Lerp(new Color(255 - (Math.Abs(128 - Main.DiscoR) * 2 - 1), 255 - (Math.Abs(128 - Main.DiscoG) * 2 - 1), 255 - (Math.Abs(128 - Main.DiscoB) * 2 - 1)), - new Color(Math.Abs(128 - Main.DiscoR) * 2 - 1, Math.Abs(128 - Main.DiscoG) * 2 - 1, Math.Abs(128 - Main.DiscoB) * 2 - 1), amount); - - Color color4 = new Color(Math.Abs(128 - Main.DiscoR) * 2 - 1, Math.Abs(128 - Main.DiscoG) * 2 - 1, Math.Abs(128 - Main.DiscoB) * 2 - 1) * num3 * 0.5f; - color4.A = (byte)((float)(int)color4.A * (1f - fromValue)); - Color color5 = color4 * fromValue * 0.5f; - Main.spriteBatch.Draw(asset, vector, rectangle, color5 * 0.15f, Projectile.rotation + Projectile.ai[0] * 0.01f, origin, num, effects, 0f); - Main.spriteBatch.Draw(asset, vector, rectangle, color3 * fromValue * num3 * 0.3f, Projectile.rotation, origin, num, effects, 0f); - Main.spriteBatch.Draw(asset, vector, rectangle, color2 * fromValue * num3 * 0.5f, Projectile.rotation, origin, num * num4, effects, 0f); - Main.spriteBatch.Draw(asset, vector, asset.Frame(1, 4, 0, 3), new Color(Math.Abs(128 - Main.DiscoR) * 2 - 1, Math.Abs(128 - Main.DiscoG) * 2 - 1, Math.Abs(128 - Main.DiscoB) * 2 - 1) * 0.6f * num3, Projectile.rotation + Projectile.ai[0] * 0.01f, origin, num, effects, 0f); - Main.spriteBatch.Draw(asset, vector, asset.Frame(1, 4, 0, 3), new Color(Math.Abs(128 - Main.DiscoR) * 2 - 1, Math.Abs(128 - Main.DiscoG) * 2 - 1, Math.Abs(128 - Main.DiscoB) * 2 - 1) * 0.5f * num3, Projectile.rotation + Projectile.ai[0] * -0.05f, origin, num * 0.8f, effects, 0f); - Main.spriteBatch.Draw(asset, vector, asset.Frame(1, 4, 0, 3), new Color(Math.Abs(128 - Main.DiscoR) * 2 - 1, Math.Abs(128 - Main.DiscoG) * 2 - 1, Math.Abs(128 - Main.DiscoB) * 2 - 1) * 0.4f * num3, Projectile.rotation + Projectile.ai[0] * -0.1f, origin, num * 0.6f, effects, 0f); - float num5 = num * 0.75f; - Texture2D value = TextureAssets.Extra[98].Value; - Color shineColor = color3 * Projectile.Opacity * 0.5f; - shineColor.A = 0; - Vector2 origin2 = value.Size() / 2f; - float num9 = Utils.GetLerpValue(0f, 0.5f, num2, clamped: true) * Utils.GetLerpValue(1f, 0.5f, num2, clamped: true); - Vector2 vector3 = new Vector2((Vector2.One * num5).X * 0.5f, (new Vector2(0f, Utils.Remap(num2, 0f, 1f, 3f, 0f)) * num5).X) * num9; - Vector2 vector2 = new Vector2((Vector2.One * num5).Y * 0.5f, (new Vector2(0f, Utils.Remap(num2, 0f, 1f, 3f, 0f)) * num5).Y) * num9; - shineColor *= num9; - for (float num6 = 0f; num6 < 12f; num6 += 1f) - { - float num7 = Projectile.rotation + Projectile.ai[0] * num6 * -MathHelper.TwoPi * 0.025f + Utils.Remap(num2, 0f, 0.6f, 0f, 0.95504415f) * Projectile.ai[0]; - Vector2 drawpos = vector + num7.ToRotationVector2() * ((float)asset.Width * 0.5f - 6f) * num; - float num8 = num6 / 12f; - - Color color6 = new Color(255, 255, 255, 0) * num3 * num8 * 0.5f; - color6 *= num9; - Main.EntitySpriteDraw(value, drawpos, null, shineColor, MathHelper.PiOver2 + num7, origin2, vector3, SpriteEffects.None); - Main.EntitySpriteDraw(value, drawpos, null, shineColor, 0f + num7, origin2, vector2, SpriteEffects.None); - Main.EntitySpriteDraw(value, drawpos, null, color6, MathHelper.PiOver2 + num7, origin2, vector3 * 0.6f, SpriteEffects.None); - Main.EntitySpriteDraw(value, drawpos, null, color6, 0f + num7, origin2, vector2 * 0.6f, SpriteEffects.None); - } - - Vector2 drawpos2 = vector + (Projectile.rotation + Utils.Remap(num2, 0f, 0.6f, 0f, 0.95504415f) * Projectile.ai[0]).ToRotationVector2() * ((float)asset.Width * 0.5f - 4f) * num; - Color color7 = new Color(255, 255, 255, 0) * num3 * 0.5f; - color7 *= num9; - Main.EntitySpriteDraw(value, drawpos2, null, shineColor, MathHelper.PiOver2 + Projectile.rotation, origin2, vector3, SpriteEffects.None); - Main.EntitySpriteDraw(value, drawpos2, null, shineColor, 0f + Projectile.rotation, origin2, vector2, SpriteEffects.None); - Main.EntitySpriteDraw(value, drawpos2, null, color7, MathHelper.PiOver2 + Projectile.rotation, origin2, vector3 * 0.6f, SpriteEffects.None); - Main.EntitySpriteDraw(value, drawpos2, null, color7, 0f + Projectile.rotation, origin2, vector2 * 0.6f, SpriteEffects.None); - - return false; - } - - public override void CutTiles() - { - Vector2 startPoint = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * 60f * Projectile.scale; - Vector2 endPoint = (Projectile.rotation + MathHelper.PiOver4).ToRotationVector2() * 60f * Projectile.scale; - float projectileSize = 60f * Projectile.scale; - Utils.PlotTileLine(Projectile.Center + startPoint, Projectile.Center + endPoint, projectileSize, DelegateMethods.CutTiles); - } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.HitDirectionOverride = (Main.player[Projectile.owner].Center.X < target.Center.X) ? 1 : -1; - - Vector2 positionInWorld = Main.rand.NextVector2FromRectangle(target.Hitbox); - ParticleOrchestraSettings particleOrchestraSettings = default(ParticleOrchestraSettings); - particleOrchestraSettings.PositionInWorld = positionInWorld; - ParticleOrchestraSettings settings = particleOrchestraSettings; - switch (Main.rand.Next(5)) - { - default: - case 0: - ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.NightsEdge, settings, Projectile.owner); - break; - - case 1: - ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.TrueNightsEdge, settings, Projectile.owner); - break; - - case 2: - settings.MovementVector = Projectile.velocity; - ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.TerraBlade, settings, Projectile.owner); - break; - - case 3: - ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.Excalibur, settings, Projectile.owner); - break; - - case 4: - ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.TrueExcalibur, settings, Projectile.owner); - break; - } - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - float coneLength = 94f * Projectile.scale; - float scale = MathHelper.TwoPi / 25f * Projectile.ai[0]; - float maximumAngle = MathHelper.PiOver4; - float coneRotation = Projectile.rotation + scale; - if (targetHitbox.IntersectsConeSlowMoreAccurate(Projectile.Center, coneLength, coneRotation, maximumAngle)) - return true; - - float rotation = Utils.Remap(Projectile.localAI[0], Projectile.ai[1] * 0.3f, Projectile.ai[1] * 0.5f, 1f, 0f); - if (rotation > 0f) - { - float coneRotation2 = coneRotation - MathHelper.PiOver4 * Projectile.ai[0] * rotation; - if (targetHitbox.IntersectsConeSlowMoreAccurate(Projectile.Center, coneLength, coneRotation2, maximumAngle)) - return true; - } - - return false; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 600); - target.AddBuff(ModContent.BuffType(), 60); - } - } -} diff --git a/Projectiles/Melee/OrderbringerBeam.cs b/Projectiles/Melee/OrderbringerBeam.cs index ea5a3dc017..1a7eafdc0d 100644 --- a/Projectiles/Melee/OrderbringerBeam.cs +++ b/Projectiles/Melee/OrderbringerBeam.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = -1; - Projectile.extraUpdates = 6; + Projectile.extraUpdates = 40; Projectile.timeLeft = 180; Projectile.DamageType = DamageClass.Melee; Projectile.usesLocalNPCImmunity = true; @@ -39,17 +39,16 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (time == 0) - { - mainColor = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; - } + Player player = Main.player[Projectile.owner]; + mainColor = player.Calamity().lightRGB; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; Player Owner = Main.player[Projectile.owner]; float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); - if (Projectile.timeLeft % 3 == 0 && targetDist < 1400f) + if (Projectile.timeLeft % 12 == 0 && targetDist < 1400f) { - Particle spark = new SparkParticle(Projectile.Center - Projectile.velocity * 3, -Projectile.velocity * 0.05f, false, 17, 1.5f, mainColor * 0.7f); + Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity * 0.2f, "CalamityMod/Particles/BloomCircle", false, 23, 0.25f, mainColor * 0.75f, new Vector2(1f, 7.35f), true, true, shrinkSpeed: 0.2f, glowOpacity: 0.7f); GeneralParticleHandler.SpawnParticle(spark); } time++; @@ -62,7 +61,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); if (Projectile.numHits < 1) { Particle orb = new GlowSparkParticle(target.Center, Projectile.velocity.SafeNormalize(Vector2.UnitY), false, 12, 0.07f, mainColor, new Vector2(1.5f, 0.8f), true); diff --git a/Projectiles/Melee/OrderbringerWaveProj.cs b/Projectiles/Melee/OrderbringerWaveProj.cs index d38407612a..477ed7fbbe 100644 --- a/Projectiles/Melee/OrderbringerWaveProj.cs +++ b/Projectiles/Melee/OrderbringerWaveProj.cs @@ -9,6 +9,8 @@ using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework.Graphics; using System.ComponentModel; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Microsoft.Build.ObjectModelRemoting; namespace CalamityMod.Projectiles.Melee { @@ -32,21 +34,23 @@ namespace CalamityMod.Projectiles.Melee Projectile.tileCollide = false; Projectile.timeLeft = 450; Projectile.DamageType = DamageClass.Melee; - Projectile.extraUpdates = 10; + Projectile.extraUpdates = 22; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; } public override void AI() { - Vector2 topCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(100f)) * Projectile.scale) * 157; - Vector2 bottomCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-100f)) * Projectile.scale) * 157; + Vector2 topCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(125f)) * Projectile.scale) * 190; + Vector2 bottomCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-125f)) * Projectile.scale) * 190; + + Player player = Main.player[Projectile.owner]; + mainColor = player.Calamity().lightRGB; if (time == 0) { Projectile.scale = 0.0875f; - Projectile.velocity *= 0.9f; - mainColor = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; + Projectile.velocity *= 1.25f; } Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; @@ -67,19 +71,20 @@ namespace CalamityMod.Projectiles.Melee { if (Main.rand.NextBool(3)) { - Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(hitboxSize, hitboxSize) - Projectile.velocity * 2, 66); - trailDust.scale = Main.rand.NextFloat(0.7f, 0.85f) - (time < 150 ? 0 : time * 0.001f); + Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(hitboxSize * 1.25f, hitboxSize * 1.25f) - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 25, ModContent.DustType()); + trailDust.scale = Main.rand.NextFloat(1.6f, 1.95f) - (time < 150 ? 0 : time * 0.001f); trailDust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.85f, 1.5f); - trailDust.color = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; + trailDust.color = mainColor; trailDust.noGravity = true; + trailDust.fadeIn = 2f; } - if (time % 9 == 0) + if (time % 9 == 0 && time < 200) { - Particle orb = new GlowSparkParticle(topCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)), false, 15, Main.rand.NextFloat(0.03f, 0.055f) * Utils.GetLerpValue(250, 150, time, true), mainColor, new Vector2(1, 0.8f), true, false, 0.3f); - GeneralParticleHandler.SpawnParticle(orb); - Particle orb2 = new GlowSparkParticle(bottomCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)), false, 15, Main.rand.NextFloat(0.03f, 0.055f) * Utils.GetLerpValue(250, 150, time, true), mainColor, new Vector2(1, 0.8f), true, false, 0.3f); - GeneralParticleHandler.SpawnParticle(orb2); + Particle spark = new CustomSpark(topCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)), "CalamityMod/Particles/BloomCircle", false, 18, 0.35f, mainColor * 0.75f, new Vector2(1f, 2.5f), true, true, shrinkSpeed: 0.2f, glowOpacity: 0.7f); + GeneralParticleHandler.SpawnParticle(spark); + Particle spark2 = new CustomSpark(bottomCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)), "CalamityMod/Particles/BloomCircle", false, 18, 0.35f, mainColor * 0.75f, new Vector2(1f, 2.5f), true, true, shrinkSpeed: 0.2f, glowOpacity: 0.7f); + GeneralParticleHandler.SpawnParticle(spark2); } if (Main.rand.NextBool(12)) { @@ -90,25 +95,22 @@ namespace CalamityMod.Projectiles.Melee } } - fadeOut = Utils.GetLerpValue(0, 180, Projectile.timeLeft, true); - time++; } public override bool PreDraw(ref Color lightColor) { Texture2D tex = ModContent.Request(Texture).Value; - float waveFade = Utils.GetLerpValue(0, 300, Projectile.timeLeft); - for (int i = 1; i < 6; i++) // Weird for loop because of squash code - Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, mainColor with { A = 0 } * fadeOut, Projectile.rotation, tex.Size() / 2f, new Vector2(1 - (i * 0.2f * waveFade), 1 + (i * 0.35f * waveFade)) * Projectile.scale * 1.1f, SpriteEffects.None, 0); + float waveFade = (float)Math.Pow(Utils.GetLerpValue(0, 250, Projectile.timeLeft, true), 2); + float waveFade2 = (float)Math.Pow(Utils.GetLerpValue(0, 80, Projectile.timeLeft, true), 2); + for (int i = 1; i < 15; i++) // Weird for loop because of squash code + Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 6f * i, null, mainColor with { A = 0 } * waveFade * (1 - 0.1f * i), Projectile.rotation, tex.Size() / 2f, new Vector2(1.1f * MathHelper.Lerp(waveFade2, 1, 0.3f), 0.6f + (1 - waveFade) * 0.8f) * Projectile.scale * 1.1f, SpriteEffects.None, 0); return false; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 300); - if (damageMult < 1.3f && damageDone > 2) - damageMult += 0.325f; + target.AddBuff(ModContent.BuffType(), 300); } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) diff --git a/Projectiles/Melee/StarofJudgement.cs b/Projectiles/Melee/StarofJudgement.cs index 7d8e9fb74c..c272f3cc2c 100644 --- a/Projectiles/Melee/StarofJudgement.cs +++ b/Projectiles/Melee/StarofJudgement.cs @@ -40,8 +40,8 @@ namespace CalamityMod.Projectiles.Melee { if (time == 0) { - Projectile.scale = (Projectile.ai[2] == 1 ? 0.75f : 0.5f); mainColor = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; + Projectile.scale = (Projectile.ai[2] == 1 ? 0.75f : 0.5f); if (Projectile.ai[2] == 1) { Projectile.localNPCHitCooldown = 7; @@ -88,7 +88,10 @@ namespace CalamityMod.Projectiles.Melee } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - int buffType = Projectile.ai[2] == 1f ? ModContent.BuffType() : ModContent.BuffType(); + if (!target.CanBeChasedBy()) + Projectile.penetrate++; + + int buffType = ModContent.BuffType(); target.AddBuff(buffType, 60); if (Projectile.ai[2] == 0) diff --git a/Projectiles/Melee/StarofOrder.cs b/Projectiles/Melee/StarofOrder.cs new file mode 100644 index 0000000000..da986a53c7 --- /dev/null +++ b/Projectiles/Melee/StarofOrder.cs @@ -0,0 +1,118 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using CalamityMod.Particles; +using Terraria.ModLoader; +using Microsoft.Xna.Framework.Graphics; +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; + +namespace CalamityMod.Projectiles.Melee +{ + public class StarofOrder : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public ref float time => ref Projectile.ai[0]; + public Color mainColor; + public override void SetStaticDefaults() + { + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 12; + ProjectileID.Sets.TrailingMode[Type] = 2; + } + public override void SetDefaults() + { + Projectile.width = 44; + Projectile.height = 44; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 4; + Projectile.tileCollide = false; + Projectile.timeLeft = 180; + Projectile.DamageType = DamageClass.Melee; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 7; + } + + public override void AI() + { + Player player = Main.player[Projectile.owner]; + mainColor = player.Calamity().lightRGB; + if (time == 0) + { + Projectile.scale = Main.rand.NextFloat(0.65f, 0.8f); + } + float sine = (float)Math.Sin(time * 0.575f * Projectile.scale / MathHelper.Pi); + + Projectile.rotation = 0.25f * sine; + if (time < 20) + { + Projectile.extraUpdates = 1; + Projectile.velocity = Projectile.velocity.RotatedBy(-Projectile.ai[1] * 0.05f); + } + else + { + Projectile.extraUpdates = 0; + CalamityUtils.HomeInOnNPC(Projectile, true, 900f, 25, MathHelper.Clamp(30 - time, 15, 30)); + } + if (time % 2 == 0 && Projectile.numHits < 1) + { + Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity * 0.2f, "CalamityMod/Particles/BloomCircle", false, 13, 0.35f, mainColor * 0.75f, new Vector2(0.8f, 1.35f), true, false, shrinkSpeed: 0.3f); + GeneralParticleHandler.SpawnParticle(spark); + } + + time++; + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Color drawColor = Color.Lerp(mainColor, Color.White, 0.2f) with { A = 0 }; + float drawRotation = Projectile.rotation; + Vector2 rotationPoint = texture.Size() * 0.5f; + //CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], drawColor * 0.5f, 1, texture, true, true); + bool roted = true; + for (int i = 0; i < 5; i++) + { + Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, (roted ? 0 : MathHelper.PiOver2) + Projectile.rotation, rotationPoint, new Vector2(1 - 0.12f * i, 1 + 0.75f * i) * Projectile.scale * 0.2f * Main.rand.NextFloat(0.8f, 1.1f), SpriteEffects.None); + if (roted && i == 4) + { + i = -1; + roted = false; + } + } + return false; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + int buffType = ModContent.BuffType(); + target.AddBuff(buffType, 60); + + if (Projectile.ai[2] == 0) + { + Projectile.timeLeft = 180; + time = 0; + Projectile.velocity *= 1.2f; + } + } + public override void OnKill(int timeLeft) + { + int points = 4; + float radians = MathHelper.TwoPi / points; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f).RotatedBy(Projectile.rotation)); + for (int k = 0; k < points; k++) + { + Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f); + Dust dust = Dust.NewDustPerfect(Projectile.Center + velocity * 2, ModContent.DustType(), velocity * 8); + dust.scale = 3.5f; + dust.color = mainColor; + dust.noGravity = true; + dust.fadeIn = 6f; + } + } + } +} diff --git a/Utilities/MathematicalUtils.cs b/Utilities/MathematicalUtils.cs index 8108deec16..45fba7b694 100644 --- a/Utilities/MathematicalUtils.cs +++ b/Utilities/MathematicalUtils.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Security.Cryptography.Xml; +using Microsoft.CodeAnalysis; using Microsoft.Xna.Framework; using ReLogic.Threading; using Terraria; @@ -433,6 +434,17 @@ namespace CalamityMod } return ratio; } + /// + /// Xyk's version of easing in and out
+ /// Returns an eased version of a 0 - 1 lerp value. + ///
+ /// The 0 - 1 lerp input + /// The intensisty of the easing in. + /// /// The intensisty of the easing out. + public static float EaseInOutExp(float lerpValue, float inPower, float outPower) + { + return (lerpValue < 0.5f ? (float)Math.Pow(Utils.GetLerpValue(0, 0.5f, lerpValue, true), inPower) * 0.5f : 0.5f + (1 - (float)Math.Pow(Utils.GetLerpValue(1, 0.5f, lerpValue, true), outPower)) * 0.5f); + } #endregion } From 2604fdd346393556c716cae5dfc38ec8278f4a4e Mon Sep 17 00:00:00 2001 From: Xyk Date: Sun, 1 Jun 2025 12:54:35 -0700 Subject: [PATCH 02/47] Localization removal --- ...Mods.CalamityMod.Projectiles.Healing.hjson | 1 - .../Mods.CalamityMod.Projectiles.Melee.hjson | 3 - .../Healing/IridescentExcaliburHeal.cs | 56 ------------------- 3 files changed, 60 deletions(-) delete mode 100644 Projectiles/Healing/IridescentExcaliburHeal.cs diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Healing.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Healing.hjson index 211c3eb65d..dfd1dd43af 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Healing.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Healing.hjson @@ -10,7 +10,6 @@ FungalHeal.DisplayName: Heal GladiatorHealOrb.DisplayName: Heal GreenJellyAura.DisplayName: Green Jelly Aura HydrothermicHealOrb.DisplayName: Hydrothermic Rejuvenation -IridescentExcaliburHeal.DisplayName: Iridescent Excalibur Heal ManaPolarizerHealOrb.DisplayName: Mana Polarizer Heal Orb PhantomicHeart.DisplayName: Phantomic Heart PinkJellyAura.DisplayName: Pink Jelly Aura diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index bdd7180600..53e09e1f92 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -154,9 +154,6 @@ HolyColliderHolyFire.DisplayName: Holy Collider Fire IceBombFriendly.DisplayName: Ice Bomb IllustriousKnife.DisplayName: Illustrious Knife InsidiousHarpoon.DisplayName: Insidious Harpoon -IridescentExcaliburSlash.DisplayName: Iridescent Excalibur Slash -IridescentExcaliburSlash2.DisplayName: Iridescent Excalibur Slash -IridescentExcaliburSlash3.DisplayName: Iridescent Excalibur Slash JudgementProj.DisplayName: JUDGEMENT LamentationsOfTheChained.DisplayName: Lamentations of the Chained LaserFountain.DisplayName: Laser Fountain diff --git a/Projectiles/Healing/IridescentExcaliburHeal.cs b/Projectiles/Healing/IridescentExcaliburHeal.cs deleted file mode 100644 index c71e6050d7..0000000000 --- a/Projectiles/Healing/IridescentExcaliburHeal.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Healing -{ - public class IridescentExcaliburHeal : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Healing"; - - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 4; - Projectile.height = 4; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 300; - Projectile.tileCollide = false; - Projectile.extraUpdates = 3; - } - - public override void AI() - { - Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 10f, 15f); - - Color dustColor = Color.White; - switch (Main.rand.Next(3)) - { - default: - case 0: - dustColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); - break; - - case 1: - dustColor = new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB); - break; - - case 2: - dustColor = new Color(Math.Abs(128 - Main.DiscoR) * 2 - 1, Math.Abs(128 - Main.DiscoG) * 2 - 1, Math.Abs(128 - Main.DiscoB) * 2 - 1); - break; - } - - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 278, 0f, 0f, 100); - Main.dust[dust].color = dustColor; - Main.dust[dust].fadeIn = 0.4f + Main.rand.NextFloat() * 0.15f; - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0f; - Main.dust[dust].position.X -= Projectile.velocity.X * 0.2f; - Main.dust[dust].position.Y += Projectile.velocity.Y * 0.2f; - } - } -} From e2e1c7dbb8ee45e78a908a6cc05ed28e559ca55c Mon Sep 17 00:00:00 2001 From: GinYuH <72181395+GinYuH@users.noreply.github.com> Date: Sun, 1 Jun 2025 17:42:39 -0700 Subject: [PATCH 03/47] Merged LegRev and FTW into just Leg also no more Yharon Dragonfolly summon --- CalPlayer/CalamityPlayerMiscEffects.cs | 2 +- NPCs/AquaticScourge/AquaticScourgeBody.cs | 4 +- NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs | 4 +- NPCs/AquaticScourge/AquaticScourgeHead.cs | 6 +- NPCs/AquaticScourge/AquaticScourgeTail.cs | 4 +- NPCs/AstrumAureus/AstrumAureus.cs | 2 +- NPCs/AstrumAureus/AureusSpawn.cs | 4 +- NPCs/AstrumDeus/AstrumDeusBody.cs | 2 +- NPCs/AstrumDeus/AstrumDeusHead.cs | 2 +- NPCs/AstrumDeus/AstrumDeusTail.cs | 2 +- .../CalamityBossAIs/AquaticScourgeAI.cs | 6 +- .../CalamityBossAIs/AstrumAureusAI.cs | 16 ++--- .../CalamityBossAIs/AstrumDeusAI.cs | 8 +-- .../CalamityBossAIs/BrimstoneElementalAI.cs | 22 +++---- .../CalamityBossAIs/BumblebirbAI.cs | 24 ++++---- .../CalamityBossAIs/CalamitasCloneAI.cs | 20 +++---- .../CalamityBossAIs/CeaselessVoidAI.cs | 16 ++--- NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs | 28 ++++----- NPCs/CalamityGlobalNPC.cs | 32 +++++----- NPCs/CeaselessVoid/DarkEnergy.cs | 2 +- NPCs/Crabulon/CrabShroom.cs | 10 ++-- NPCs/Crabulon/Crabulon.cs | 12 ++-- NPCs/Cryogen/Cryogen.cs | 20 +++---- NPCs/Cryogen/CryogenShield.cs | 2 +- NPCs/DesertScourge/DesertNuisanceBody.cs | 6 +- NPCs/DesertScourge/DesertNuisanceBodyYoung.cs | 6 +- NPCs/DesertScourge/DesertNuisanceHead.cs | 12 ++-- NPCs/DesertScourge/DesertNuisanceHeadYoung.cs | 12 ++-- NPCs/DesertScourge/DesertNuisanceTail.cs | 6 +- NPCs/DesertScourge/DesertNuisanceTailYoung.cs | 6 +- NPCs/DesertScourge/DesertScourgeBody.cs | 6 +- NPCs/DesertScourge/DesertScourgeHead.cs | 16 ++--- NPCs/DesertScourge/DesertScourgeTail.cs | 6 +- NPCs/DevourerofGods/DevourerofGodsBody.cs | 4 +- NPCs/DevourerofGods/DevourerofGodsHead.cs | 20 +++---- NPCs/DevourerofGods/DevourerofGodsTail.cs | 4 +- NPCs/ExoMechs/Apollo/Apollo.cs | 10 ++-- NPCs/ExoMechs/Ares/AresBody.cs | 4 +- NPCs/ExoMechs/Artemis/Artemis.cs | 8 +-- NPCs/ExoMechs/Thanatos/ThanatosBody1.cs | 2 +- NPCs/ExoMechs/Thanatos/ThanatosBody2.cs | 2 +- NPCs/ExoMechs/Thanatos/ThanatosHead.cs | 4 +- NPCs/ExoMechs/Thanatos/ThanatosTail.cs | 2 +- NPCs/HiveMind/DankCreeper.cs | 4 +- NPCs/HiveMind/DarkHeart.cs | 12 ++-- NPCs/HiveMind/HiveBlob.cs | 8 +-- NPCs/HiveMind/HiveBlob2.cs | 8 +-- NPCs/HiveMind/HiveMind.cs | 6 +- NPCs/HiveMind/HiveTumor.cs | 4 +- NPCs/Leviathan/Anahita.cs | 22 +++---- NPCs/Leviathan/AnahitasIceShield.cs | 2 +- NPCs/Leviathan/AquaticAberration.cs | 2 +- NPCs/Leviathan/Leviathan.cs | 14 ++--- NPCs/Leviathan/LeviathanStart.cs | 3 +- NPCs/NormalNPCs/ArmoredDiggerHead.cs | 2 +- NPCs/NormalNPCs/BloodlettingServant.cs | 4 +- NPCs/NormalNPCs/Foveanator.cs | 18 +++--- NPCs/NormalNPCs/PlanterasFreeTentacle.cs | 4 +- NPCs/NormalNPCs/ShockstormShuttle.cs | 7 ++- NPCs/NormalNPCs/SkeletronPrime2.cs | 2 +- NPCs/OldDuke/SulphurousSharkron.cs | 2 +- NPCs/Other/THELORDE.cs | 4 +- NPCs/Perforator/PerforatorHive.cs | 14 ++--- .../PlaguebringerGoliath.cs | 10 ++-- NPCs/Polterghast/PhantomFuckYou.cs | 8 +-- NPCs/Polterghast/PolterPhantom.cs | 6 +- NPCs/Polterghast/Polterghast.cs | 4 +- NPCs/Polterghast/PolterghastHook.cs | 8 +-- NPCs/PrimordialWyrm/PrimordialWyrmHead.cs | 4 +- .../ProfanedGuardianCommander.cs | 18 +++--- .../ProfanedGuardianDefender.cs | 10 ++-- .../ProfanedGuardianHealer.cs | 6 +- NPCs/ProfanedGuardians/ProfanedRocks.cs | 2 +- NPCs/Providence/Providence.cs | 14 ++--- NPCs/Ravager/RavagerBody.cs | 8 +-- NPCs/Signus/Signus.cs | 18 +++--- NPCs/SlimeGod/CorruptSlimeSpawn.cs | 4 +- NPCs/SlimeGod/CorruptSlimeSpawn2.cs | 4 +- NPCs/SlimeGod/CrimsonSlimeSpawn.cs | 4 +- NPCs/SlimeGod/CrimsonSlimeSpawn2.cs | 4 +- NPCs/SlimeGod/CrimulanPaladin.cs | 4 +- NPCs/SlimeGod/EbonianPaladin.cs | 12 ++-- NPCs/SlimeGod/SlimeGodCore.cs | 8 +-- NPCs/SlimeGod/SplitCrimulanPaladin.cs | 2 +- NPCs/SlimeGod/SplitEbonianPaladin.cs | 2 +- NPCs/StormWeaver/StormWeaverBody.cs | 2 +- NPCs/StormWeaver/StormWeaverHead.cs | 10 ++-- NPCs/StormWeaver/StormWeaverTail.cs | 2 +- NPCs/SupremeCalamitas/SoulSeekerSupreme.cs | 2 +- NPCs/SupremeCalamitas/SupremeCalamitas.cs | 24 ++++---- .../Bosses/BrainOfCthulhuAI.cs | 14 ++--- .../VanillaNPCAIOverrides/Bosses/CultistAI.cs | 2 +- .../Bosses/DestroyerAI.cs | 6 +- .../Bosses/DukeFishronAI.cs | 10 ++-- .../Bosses/EaterOfWorldsAI.cs | 6 +- .../Bosses/EmpressofLightAI.cs | 4 +- .../Bosses/EyeOfCthulhuAI.cs | 20 +++---- NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs | 58 +++++++++---------- .../Bosses/KingSlimeAI.cs | 12 ++-- .../Bosses/MoonLordAI.cs | 4 +- .../Bosses/PlanteraAI.cs | 16 ++--- .../Bosses/QueenBeeAI.cs | 4 +- .../Bosses/QueenSlimeAI.cs | 10 ++-- .../Bosses/SkeletronAI.cs | 40 ++++++------- NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs | 28 ++++----- .../Bosses/WallOfFleshAI.cs | 4 +- .../RegularEnemies/RevengeanceAndDeathAI.cs | 6 +- NPCs/Yharon/Yharon.cs | 18 ++---- Projectiles/Boss/ApolloChargeTelegraph.cs | 4 +- Projectiles/Boss/AresGaussNukeProjectile.cs | 2 +- Projectiles/Boss/ArtemisLaser.cs | 2 +- Projectiles/Boss/AstralFlame.cs | 2 +- Projectiles/Boss/BrimstoneRay.cs | 2 +- Projectiles/Boss/DarkEnergyBall.cs | 2 +- Projectiles/Boss/DarkEnergyBall2.cs | 2 +- Projectiles/Boss/DesertScourgeSpit.cs | 4 +- Projectiles/Boss/DoGBeam.cs | 2 +- Projectiles/Boss/Flarenado.cs | 2 +- Projectiles/Boss/GreatSandBlast.cs | 4 +- Projectiles/Boss/HolyBlast.cs | 2 +- Projectiles/Boss/HolyBurnOrb.cs | 2 +- Projectiles/Boss/HolyFire.cs | 8 +-- Projectiles/Boss/Infernado.cs | 2 +- Projectiles/Boss/MoltenBlast.cs | 2 +- Projectiles/Boss/PhantomMine.cs | 2 +- Projectiles/Boss/ShadeNimbusHostile.cs | 2 +- Projectiles/Boss/THanosSideLaser.cs | 2 +- Projectiles/Boss/ThanatosBeamStart.cs | 4 +- Projectiles/Boss/ThanatosLaser.cs | 4 +- Projectiles/Boss/UnstableCrimulanGlob.cs | 2 +- Projectiles/Boss/UnstableEbonianGlob.cs | 2 +- Projectiles/Boss/YharonBulletHellVortex.cs | 4 +- Projectiles/CalamityGlobalProjectile.cs | 6 +- .../MusicScenes/AquaticScourgeMusicScene.cs | 3 +- UI/VanillaBossBars/CeaselessVoidBossBar.cs | 2 +- 135 files changed, 532 insertions(+), 535 deletions(-) diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 2842bd89a1..220cd880d1 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -3094,7 +3094,7 @@ namespace CalamityMod.CalPlayer abyssDeath = false; // Signus headcrab darkness - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) { if (CalamityGlobalNPC.signus != -1) { diff --git a/NPCs/AquaticScourge/AquaticScourgeBody.cs b/NPCs/AquaticScourge/AquaticScourgeBody.cs index b0db3298e4..8d487de579 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBody.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBody.cs @@ -36,7 +36,7 @@ namespace CalamityMod.NPCs.AquaticScourge NPC.knockBackResist = 0f; NPC.alpha = 255; NPC.LifeMaxNERB(80000, 96000, 1000000); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) NPC.lifeMax *= 2; NPC.behindTiles = true; NPC.noGravity = true; @@ -56,7 +56,7 @@ namespace CalamityMod.NPCs.AquaticScourge else if (Main.expertMode) NPC.scale *= 1.1f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.scale *= 1.25f; NPC.Calamity().VulnerableToHeat = false; diff --git a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs index ae65703e57..cfd2418d09 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs.AquaticScourge NPC.knockBackResist = 0f; NPC.alpha = 255; NPC.LifeMaxNERB(80000, 96000, 1000000); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) NPC.lifeMax *= 2; NPC.behindTiles = true; NPC.noGravity = true; @@ -55,7 +55,7 @@ namespace CalamityMod.NPCs.AquaticScourge else if (Main.expertMode) NPC.scale *= 1.1f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.scale *= 1.25f; NPC.Calamity().VulnerableToHeat = false; diff --git a/NPCs/AquaticScourge/AquaticScourgeHead.cs b/NPCs/AquaticScourge/AquaticScourgeHead.cs index 4acad4c1dc..52aa1757aa 100644 --- a/NPCs/AquaticScourge/AquaticScourgeHead.cs +++ b/NPCs/AquaticScourge/AquaticScourgeHead.cs @@ -63,7 +63,7 @@ namespace CalamityMod.NPCs.AquaticScourge NPC.aiStyle = -1; AIType = -1; NPC.LifeMaxNERB(80000, 96000, 1000000); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) NPC.lifeMax *= 2; NPC.knockBackResist = 0f; NPC.value = Item.buyPrice(0, 16, 0, 0); @@ -84,7 +84,7 @@ namespace CalamityMod.NPCs.AquaticScourge else if (Main.expertMode) NPC.scale *= 1.1f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.scale *= 1.25f; NPC.Calamity().VulnerableToHeat = false; @@ -205,7 +205,7 @@ namespace CalamityMod.NPCs.AquaticScourge if (spawnInfo.Player.Calamity().ZoneSulphur && spawnInfo.Water) { if (!NPC.AnyNPCs(ModContent.NPCType())) - return (Main.getGoodWorld ? 0.05f : 0.01f); + return (CalamityWorld.LegendaryMode ? 0.05f : 0.01f); } return 0f; diff --git a/NPCs/AquaticScourge/AquaticScourgeTail.cs b/NPCs/AquaticScourge/AquaticScourgeTail.cs index 989e090678..80b4b07db9 100644 --- a/NPCs/AquaticScourge/AquaticScourgeTail.cs +++ b/NPCs/AquaticScourge/AquaticScourgeTail.cs @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs.AquaticScourge NPC.knockBackResist = 0f; NPC.alpha = 255; NPC.LifeMaxNERB(80000, 96000, 1000000); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) NPC.lifeMax *= 2; NPC.behindTiles = true; NPC.noGravity = true; @@ -55,7 +55,7 @@ namespace CalamityMod.NPCs.AquaticScourge else if (Main.expertMode) NPC.scale *= 1.1f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.scale *= 1.25f; NPC.Calamity().VulnerableToHeat = false; diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index ceada7f56a..5a3d7403f4 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -109,7 +109,7 @@ namespace CalamityMod.NPCs.AstrumAureus NPC.Calamity().VulnerableToSickness = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.scale *= 0.8f; if (Main.zenithWorld) NPC.scale *= 1.5f; diff --git a/NPCs/AstrumAureus/AureusSpawn.cs b/NPCs/AstrumAureus/AureusSpawn.cs index 3daa83d2c7..71749015aa 100644 --- a/NPCs/AstrumAureus/AureusSpawn.cs +++ b/NPCs/AstrumAureus/AureusSpawn.cs @@ -308,11 +308,11 @@ namespace CalamityMod.NPCs.AstrumAureus { if (Main.netMode != NetmodeID.MultiplayerClient) { - int totalProjectiles = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 36 : (3 + (int)((NPC.scale - 1f) * 3)); + int totalProjectiles = CalamityWorld.LegendaryMode ? 36 : (3 + (int)((NPC.scale - 1f) * 3)); double radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); int damage2 = NPC.GetProjectileDamage(type); - float velocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 10f : 6f; + float velocity = CalamityWorld.LegendaryMode ? 10f : 6f; double angleA = radians * 0.5; double angleB = MathHelper.ToRadians(90f) - angleA; float velocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); diff --git a/NPCs/AstrumDeus/AstrumDeusBody.cs b/NPCs/AstrumDeus/AstrumDeusBody.cs index ecfa2a3a11..b5f1a10738 100644 --- a/NPCs/AstrumDeus/AstrumDeusBody.cs +++ b/NPCs/AstrumDeus/AstrumDeusBody.cs @@ -130,7 +130,7 @@ namespace CalamityMod.NPCs.AstrumDeus // Need segment amount to get a smooth transition down the worm based on length int segmentAmt = Main.zenithWorld ? (CalamityWorld.death ? 8 : CalamityWorld.revenge ? 7 : Main.expertMode ? 6 : 5) : (CalamityWorld.death ? 40 : CalamityWorld.revenge ? 35 : Main.expertMode ? 30 : 25); - float cyanThreshold = Main.getGoodWorld ? 300f : 600f; + float cyanThreshold = CalamityWorld.LegendaryMode ? 300f : 600f; float transitionStart = MathHelper.Lerp(cyanThreshold * 0.75f, cyanThreshold * 0.95f, 1f - (NPC.ai[3] / (float)segmentAmt)); float transitionEnd = MathHelper.Lerp(cyanThreshold * 0.8f, cyanThreshold, 1f - (NPC.ai[3] / (float)segmentAmt)); bool drawCyan = NPC.Calamity().newAI[3] >= transitionEnd && NPC.Calamity().newAI[3] <= cyanThreshold + transitionEnd; diff --git a/NPCs/AstrumDeus/AstrumDeusHead.cs b/NPCs/AstrumDeus/AstrumDeusHead.cs index eb5c436317..b004cccb4b 100644 --- a/NPCs/AstrumDeus/AstrumDeusHead.cs +++ b/NPCs/AstrumDeus/AstrumDeusHead.cs @@ -172,7 +172,7 @@ namespace CalamityMod.NPCs.AstrumDeus bool deathModeEnragePhase = NPC.Calamity().newAI[0] == 3f; bool doubleWormPhase = NPC.Calamity().newAI[0] != 0f && !deathModeEnragePhase; - float cyanThreshold = Main.getGoodWorld ? 300f : 600f; + float cyanThreshold = CalamityWorld.LegendaryMode ? 300f : 600f; // Head is always the last segment to visually transition float transitionStart = cyanThreshold * 0.95f; bool drawCyan = NPC.Calamity().newAI[3] >= cyanThreshold; diff --git a/NPCs/AstrumDeus/AstrumDeusTail.cs b/NPCs/AstrumDeus/AstrumDeusTail.cs index 127a782e6c..f703c894ef 100644 --- a/NPCs/AstrumDeus/AstrumDeusTail.cs +++ b/NPCs/AstrumDeus/AstrumDeusTail.cs @@ -111,7 +111,7 @@ namespace CalamityMod.NPCs.AstrumDeus bool deathModeEnragePhase = Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] == 3f; bool doubleWormPhase = NPC.Calamity().newAI[0] != 0f && !deathModeEnragePhase; - float cyanThreshold = Main.getGoodWorld ? 300f : 600f; + float cyanThreshold = CalamityWorld.LegendaryMode ? 300f : 600f; // Tail is always the first segment to visually transition float transitionStart = cyanThreshold * 0.75f; float transitionEnd = cyanThreshold * 0.8f; diff --git a/NPCs/CalamityAIs/CalamityBossAIs/AquaticScourgeAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/AquaticScourgeAI.cs index a8f6e79f8c..b8aa9c21a1 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/AquaticScourgeAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/AquaticScourgeAI.cs @@ -46,7 +46,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs // Adjust hostility and stats bool nonHostile = calamityGlobalNPC.newAI[0] == 0f; - if (npc.justHit || npc.life <= npc.lifeMax * 0.999 || bossRush || Main.getGoodWorld) + if (npc.justHit || npc.life <= npc.lifeMax * 0.999 || bossRush || CalamityWorld.LegendaryMode) { if (nonHostile) { @@ -399,7 +399,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs } Vector2 scourgePosition = npc.Center; - Vector2 predictionVector = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? Main.player[npc.target].velocity * 20f : Vector2.Zero; + Vector2 predictionVector = CalamityWorld.LegendaryMode ? Main.player[npc.target].velocity * 20f : Vector2.Zero; float scourgeTargetX = player.Center.X + predictionVector.X; float scourgeTargetY = player.Center.Y + predictionVector.Y; @@ -432,7 +432,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs scourgeAcceleration *= accelerationMultiplier; } - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { scourgeMaxSpeed *= 1.15f; scourgeAcceleration *= 1.15f; diff --git a/NPCs/CalamityAIs/CalamityBossAIs/AstrumAureusAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/AstrumAureusAI.cs index e7e3f546bb..946ed01765 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/AstrumAureusAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/AstrumAureusAI.cs @@ -90,7 +90,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs if (expertMode) astralFlameBarrageTimerIncrement += death ? (float)Math.Round(3f * (1f - lifeRatio)) : (float)Math.Round(2f * (1f - lifeRatio)); - float walkingVelocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 6f : 5f; + float walkingVelocity = CalamityWorld.LegendaryMode ? 6f : 5f; walkingVelocity += 3f * enrageScale; if (phase5) walkingVelocity += 2f; @@ -98,7 +98,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs walkingVelocity += 1.5f * (1f - lifeRatio); if (revenge) walkingVelocity += Math.Abs(npc.Center.X - player.Center.X) * 0.0025f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) walkingVelocity *= 1.15f; float walkingProjectileVelocity = walkingVelocity * 0.8f; @@ -531,11 +531,11 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs calamityGlobalNPC.newAI[1] = speedMultLimit; } - float velocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 27f : 20f; + float velocity = CalamityWorld.LegendaryMode ? 27f : 20f; velocity += 6f * enrageScale; if (expertMode) velocity += death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) velocity *= 1.15f; npc.velocity = (new Vector2(player.Center.X, player.Center.Y - 500f) - npc.Center).SafeNormalize(Vector2.Zero) * velocity; @@ -661,7 +661,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs if (Main.netMode != NetmodeID.MultiplayerClient) { - float laserVelocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 7f : death ? 6f : 5f; + float laserVelocity = CalamityWorld.LegendaryMode ? 7f : death ? 6f : 5f; int maxProjectiles = !phase3 ? (bossRush ? 13 : death ? 11 : 9) : (bossRush ? 17 : death ? 15 : 13); int spread = !phase3 ? (bossRush ? 20 : death ? 18 : 16) : (bossRush ? 24 : death ? 22 : 20); @@ -714,7 +714,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs fallSpeed += 0.36f * enrageScale; if (expertMode) fallSpeed += death ? 0.36f * (1f - lifeRatio) : 0.24f * (1f - lifeRatio); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) fallSpeed += 0.5f; if (calamityGlobalNPC.newAI[1] > 0f) @@ -741,7 +741,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs velocityXCap += 3.6f * enrageScale; if (expertMode) velocityXCap += death ? 3.6f * (1f - lifeRatio) : 2.4f * (1f - lifeRatio); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) velocityXCap += 5f; if (calamityGlobalNPC.newAI[0] > 0f) @@ -954,7 +954,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs if (calamityGlobalNPC.newAI[1] > 0f && !reduceFallSpeed) maxFallSpeed *= calamityGlobalNPC.newAI[1] + 1f; - if (Main.getGoodWorld && !reduceFallSpeed) + if (CalamityWorld.LegendaryMode && !reduceFallSpeed) { gravity *= 1.15f; maxFallSpeed *= 1.15f; diff --git a/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs index c7bc0300cc..a4419a123b 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs @@ -97,7 +97,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = calamityGlobalNPC.newAI[1] < resistanceTime; // Flight timer - float aiSwitchTimer = doubleWormPhase ? (Main.getGoodWorld ? 600f : 1200f) : (Main.getGoodWorld ? 900f : 1800f); + float aiSwitchTimer = doubleWormPhase ? (CalamityWorld.LegendaryMode ? 600f : 1200f) : (CalamityWorld.LegendaryMode ? 900f : 1800f); calamityGlobalNPC.newAI[3] += 1f; if (calamityGlobalNPC.newAI[3] >= aiSwitchTimer) @@ -118,7 +118,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs // Become gradually more pissed as more worms are killed int gfbMaxWormCount = 10; int gfbWormCount = 0; - if (CalamityWorld.LegendaryMode && revenge) + if (CalamityWorld.LegendaryMode) gfbWormCount = NPC.CountNPCS(ModContent.NPCType()); if (gfbWormCount > gfbMaxWormCount) gfbWormCount = gfbMaxWormCount; @@ -230,7 +230,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs int startIndexHeadTwo = startIndexHeadOne + phase2Length + 1; int headTwoID = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, npc.type, startIndexHeadTwo); Main.npc[headTwoID].Calamity().newAI[0] = 2f; - Main.npc[headTwoID].Calamity().newAI[3] = Main.getGoodWorld ? 300f : 600f; + Main.npc[headTwoID].Calamity().newAI[3] = CalamityWorld.LegendaryMode ? 300f : 600f; Main.npc[headTwoID].velocity = Vector2.Normalize(player.Center - Main.npc[headTwoID].Center) * 16f; Main.npc[headTwoID].timeLeft *= 20; Main.npc[headTwoID].ForceNetUpdate(); @@ -524,7 +524,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs speed *= increaseSpeedMore ? 2f : increaseSpeed ? 1.5f : 1f; turnSpeed *= increaseSpeedMore ? 2f : increaseSpeed ? 1.5f : 1f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { speed *= 1.15f; turnSpeed *= 1.15f; diff --git a/NPCs/CalamityAIs/CalamityBossAIs/BrimstoneElementalAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/BrimstoneElementalAI.cs index 2134f154b2..b0a00922b7 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/BrimstoneElementalAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/BrimstoneElementalAI.cs @@ -366,7 +366,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs npc.chaseable = true; npc.ai[3] += 1f; npc.alpha = 0; - if (npc.ai[3] >= 2f || phase2 || Main.getGoodWorld) + if (npc.ai[3] >= 2f || phase2 || CalamityWorld.LegendaryMode) { npc.ai[0] = -1f; npc.ai[1] = 0f; @@ -419,7 +419,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs { int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 5f, projectileVelocity, type, damage, 0f, Main.myPlayer, player.position.X, player.position.Y); Main.projectile[proj].timeLeft = 240; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) Main.projectile[proj].extraUpdates += 1; } @@ -440,7 +440,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs projectileVelocity = (player.Center - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; int numProj = death ? 8 : 4; int spread = death ? 90 : 45; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { numProj *= 3; spread *= 2; @@ -454,7 +454,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs { Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); int proj2 = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 5f, perturbedSpeed, type, damage, 0f, Main.myPlayer, 1f, 0f, projectileVelocityToPass); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) Main.projectile[proj2].extraUpdates += 1; } } @@ -482,7 +482,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs npc.chaseable = false; npc.localAI[0] += 1f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) npc.localAI[0] += 2f; if (expertMode) npc.localAI[0] += 1f - lifeRatio; @@ -520,7 +520,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, projectileVelocity, type, damage, 0f, Main.myPlayer, 1f, 0f); Main.projectile[proj].timeLeft = 300; Main.projectile[proj].tileCollide = false; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) Main.projectile[proj].extraUpdates += 1; } } @@ -550,7 +550,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs { Vector2 vector255 = spinningPoint.RotatedBy(radians2 * k); int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + vector255.SafeNormalize(Vector2.UnitY) * 5f, vector255, type, damage, 0f, Main.myPlayer, 1f, 0f, projectileVelocityToPass); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) Main.projectile[proj].extraUpdates += 1; } @@ -561,7 +561,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs { Vector2 vector255 = spinningPoint.RotatedBy(radians2 * k); int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + vector255.SafeNormalize(Vector2.UnitY) * 5f, vector255 * 0.75f, type, damage, 0f, Main.myPlayer, 1f, 0f, projectileVelocityToPass); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) Main.projectile[proj].extraUpdates += 1; } } @@ -653,7 +653,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs int damage = npc.GetProjectileDamage(type); Projectile.NewProjectile(npc.GetSource_FromAI(), source, laserVelocity2, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) Projectile.NewProjectile(npc.GetSource_FromAI(), source, -laserVelocity2, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); if (Main.zenithWorld) @@ -694,7 +694,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs if (Main.netMode != NetmodeID.MultiplayerClient) { Projectile.NewProjectile(npc.GetSource_FromAI(), source, laserVelocity, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, npc.whoAmI); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) Projectile.NewProjectile(npc.GetSource_FromAI(), source, -laserVelocity, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, npc.whoAmI); if (Main.zenithWorld) @@ -716,7 +716,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs if (Main.netMode != NetmodeID.MultiplayerClient) { Projectile.NewProjectile(npc.GetSource_FromAI(), source.X, source.Y, npc.localAI[0], npc.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.whoAmI); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) Projectile.NewProjectile(npc.GetSource_FromAI(), source.X, source.Y, -npc.localAI[0], -npc.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.whoAmI); if (Main.zenithWorld) diff --git a/NPCs/CalamityAIs/CalamityBossAIs/BumblebirbAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/BumblebirbAI.cs index 15d826ab41..ea6e34d8d2 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/BumblebirbAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/BumblebirbAI.cs @@ -88,7 +88,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs if (npc.localAI[2] > 0f || bossRush) enrageScale += 1f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) enrageScale += 0.5f; if (enrageScale > 3f) @@ -252,7 +252,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs } // Max spawn amount - int maxBirbs = (CalamityWorld.LegendaryMode && revenge) ? 12 : revenge ? 3 : 2; + int maxBirbs = CalamityWorld.LegendaryMode ? 12 : revenge ? 3 : 2; // Variable for charging float chargeDistance = 600f; @@ -382,7 +382,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs bool spawnRight = player.velocity.X > 0f; for (int i = 0; i < totalProjectiles; i++) { - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { if (i >= (int)(totalProjectiles * 0.125) && i <= (int)(totalProjectiles * 0.375)) { @@ -449,13 +449,13 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs { int totalProjectiles = phase2 ? 40 : 48; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) totalProjectiles *= 2; float radians = MathHelper.TwoPi / totalProjectiles; int distance = phase2 ? 1200 : 1320; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) distance *= 2; bool spawnRight = player.velocity.X > 0f; @@ -564,7 +564,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs float velocity = 8f + (enrageScale - 1f) * 2f; float follyQuickFlySpeed = velocity + npc.ai[2] + follyQuickFlyTargetDirection.Length() / 120f; - if (CalamityWorld.LegendaryMode && revenge) + if (CalamityWorld.LegendaryMode) follyQuickFlySpeed *= 2f; float follyQuickFlyVelMult = 20f; @@ -573,7 +573,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs npc.velocity = (npc.velocity * (follyQuickFlyVelMult - 1f) + follyQuickFlyTargetDirection) / follyQuickFlyVelMult; npc.ai[1] += 1f; - if (npc.ai[1] >= ((CalamityWorld.LegendaryMode && revenge) ? 90f : 180f)) + if (npc.ai[1] >= ((CalamityWorld.LegendaryMode) ? 90f : 180f)) { npc.TargetClosest(); npc.ai[0] = 0f; @@ -771,7 +771,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs if (Main.netMode != NetmodeID.MultiplayerClient) { - bool gfbSpawnFlag = CalamityWorld.LegendaryMode && revenge && (npc.ai[1] == 145f || npc.ai[1] == 150f || npc.ai[1] == 160f || npc.ai[1] == 165f); + bool gfbSpawnFlag = CalamityWorld.LegendaryMode && (npc.ai[1] == 145f || npc.ai[1] == 150f || npc.ai[1] == 160f || npc.ai[1] == 165f); bool spawnFlag = NPC.CountNPCS(ModContent.NPCType()) < maxBirbs && (npc.ai[1] == 140f || (revenge && npc.ai[1] == 155f) || npc.ai[1] == 170f || gfbSpawnFlag); if (spawnFlag) { @@ -933,7 +933,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs swarmerIdleTargetDist.Normalize(); swarmerIdleTargetDist *= swarmerIdleSpeed; npc.velocity = (npc.velocity * 29f + swarmerIdleTargetDist) / 30f; - if (Main.getGoodWorld && !Main.zenithWorld) + if (CalamityWorld.LegendaryMode && !Main.zenithWorld) npc.velocity *= 1.15f; } else if (npc.velocity.Length() > 2f) @@ -981,7 +981,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs swarmerChargeTargetDist.Normalize(); swarmerChargeTargetDist *= swarmerChargeSpeed; npc.velocity = (npc.velocity * (swarmerChargeVelMult - 1f) + swarmerChargeTargetDist) / swarmerChargeVelMult; - if (Main.getGoodWorld && !Main.zenithWorld) + if (CalamityWorld.LegendaryMode && !Main.zenithWorld) npc.velocity *= 1.15f; npc.ForceNetUpdate(); @@ -1009,7 +1009,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs swarmerDecelerateTargetDist.Normalize(); swarmerDecelerateTargetDist *= swarmerDecelerateSpeed; npc.velocity = (npc.velocity * (swarmerDecelerateVelMult - 1f) + swarmerDecelerateTargetDist) / swarmerDecelerateVelMult; - if (Main.getGoodWorld && !Main.zenithWorld) + if (CalamityWorld.LegendaryMode && !Main.zenithWorld) npc.velocity *= 1.15f; if (npc.velocity.X < 0f) @@ -1026,7 +1026,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs npc.damage = npc.defDamage; npc.velocity = swarmerDecelerateTargetDist; - if (Main.getGoodWorld && !Main.zenithWorld) + if (CalamityWorld.LegendaryMode && !Main.zenithWorld) npc.velocity *= 1.15f; if (npc.velocity.X < 0f) diff --git a/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs index 7dfb5557da..39f773db3a 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs @@ -93,7 +93,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs SoundEngine.PlaySound(SoundID.Item109, npc.Center); calamityGlobalNPC.newAI[2] = 2f; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) calamityGlobalNPC.newAI[3] = 0f; SpawnDust(); @@ -117,7 +117,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs SoundEngine.PlaySound(SoundID.Item109, npc.Center); calamityGlobalNPC.newAI[2] = 1f; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) calamityGlobalNPC.newAI[3] = 0f; SpawnDust(); @@ -287,7 +287,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs baseVelocity += 1.5f * (1f - lifeRatio); baseAcceleration += 0.03f * (1f - lifeRatio); } - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { baseVelocity *= 1.15f; baseAcceleration *= 1.15f; @@ -355,7 +355,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs if (Main.zenithWorld) type = ModContent.ProjectileType(); - float gigaBlastFrequency = (Main.getGoodWorld ? 120f : expertMode ? 180f : 240f) - enrageScale * 15f; + float gigaBlastFrequency = (CalamityWorld.LegendaryMode ? 120f : expertMode ? 180f : 240f) - enrageScale * 15f; float projSpeed = bossRush ? 6.25f : 5f; if (calamityGlobalNPC.newAI[3] <= 300f) { @@ -492,7 +492,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs return; } - else if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + else if (CalamityWorld.LegendaryMode) { if (calamityGlobalNPC.newAI[3] < 900f) calamityGlobalNPC.newAI[3] += 1f; @@ -580,7 +580,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs projectileVelocity += 3f * enrageScale; int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); - bool shootPredictiveShot = CalamityWorld.LegendaryMode && CalamityWorld.revenge && Main.rand.NextBool(); + bool shootPredictiveShot = CalamityWorld.LegendaryMode && Main.rand.NextBool(); Vector2 predictionVector = shootPredictiveShot ? player.velocity * 20f : Vector2.Zero; Vector2 fireballVelocity = Vector2.Normalize(player.Center + predictionVector - npc.Center) * projectileVelocity; Vector2 offset = Vector2.Normalize(fireballVelocity) * 40f; @@ -862,7 +862,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs calCloneBroProjAttackMaxSpeed += 2f * enrageScale; calCloneBroProjAttackAccel += 0.06f * enrageScale; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { calCloneBroProjAttackMaxSpeed *= 1.15f; calCloneBroProjAttackAccel *= 1.15f; @@ -989,7 +989,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs calCloneBroChargeSpeed += 2f; if (revenge) calCloneBroChargeSpeed += 2f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) calCloneBroChargeSpeed *= 1.25f; Vector2 calCloneBroChargeCenter = npc.Center; @@ -1196,7 +1196,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs calCloneBroProjAttackMaxSpeed += 2f * enrageScale; calCloneBroProjAttackAccel += 0.1f * enrageScale; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { calCloneBroProjAttackMaxSpeed *= 1.15f; calCloneBroProjAttackAccel *= 1.15f; @@ -1320,7 +1320,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs calCloneBroChargeSpeed += 2f; if (revenge) calCloneBroChargeSpeed += 2f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) calCloneBroChargeSpeed *= 1.25f; Vector2 calCloneBroChargeCenter = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); diff --git a/NPCs/CalamityAIs/CalamityBossAIs/CeaselessVoidAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/CeaselessVoidAI.cs index 7fc43d201c..211de577a9 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/CeaselessVoidAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/CeaselessVoidAI.cs @@ -62,7 +62,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs if (phase4) darkEnergyAmt += 1; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) darkEnergyAmt *= 2; // Spawn a few Dark Energies as soon as the fight starts @@ -121,7 +121,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs else if (npc.timeLeft < 1800) npc.timeLeft = 1800; - float tileEnrageMult = (CalamityWorld.LegendaryMode && revenge) ? 1.5f : bossRush ? 1.375f : 1f; + float tileEnrageMult = (CalamityWorld.LegendaryMode) ? 1.5f : bossRush ? 1.375f : 1f; npc.Calamity().CurrentlyEnraged = tileEnrageMult > 1f && !bossRush; // Set AI variable to be used by Dark Energies @@ -131,14 +131,14 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs float projectileFireRateMultiplier = MathHelper.Lerp(0.5f, 1.5f, 1f - ((tileEnrageMult - 1f) / 0.5f)); // Decides whether Ceaseless moves closer to its target or not - float distanceRequiredToMove = (Main.getGoodWorld || !anyDarkEnergies) ? 320f : bossRush ? 600f : death ? 520f : revenge ? 480f : expertMode ? 440f : 400f; + float distanceRequiredToMove = (CalamityWorld.LegendaryMode || !anyDarkEnergies) ? 320f : bossRush ? 600f : death ? 520f : revenge ? 480f : expertMode ? 440f : 400f; bool move = Vector2.Distance(npc.Center, player.Center) > distanceRequiredToMove || !Collision.CanHit(npc.Center, 1, 1, player.Center, 1, 1); // Succ attack if (!anyDarkEnergies) { // This is here because it's used in multiple places - float suckDistance = (CalamityWorld.LegendaryMode && revenge) ? 2400f : bossRush ? 1920f : death ? 1600f : revenge ? 1440f : expertMode ? 1280f : 1040f; + float suckDistance = (CalamityWorld.LegendaryMode) ? 2400f : bossRush ? 1920f : death ? 1600f : revenge ? 1440f : expertMode ? 1280f : 1040f; // Move closer to the target before trying to succ if (movingDuringSuccPhase) @@ -474,7 +474,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs acceleration *= 2f; } - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { velocity *= 1.15f; acceleration *= 1.15f; @@ -484,8 +484,8 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs // Move between 8 different positions around the player, in order float maxDistance = 320f; - Vector2 moveToOffset = succ ? Vector2.Zero : Main.getGoodWorld ? new Vector2(0f, -maxDistance) : Vector2.Zero; - if (!succ && Main.getGoodWorld) + Vector2 moveToOffset = succ ? Vector2.Zero : CalamityWorld.LegendaryMode ? new Vector2(0f, -maxDistance) : Vector2.Zero; + if (!succ && CalamityWorld.LegendaryMode) { // Move to a new location every few seconds calamityGlobalNPC.newAI[2] += 1f; @@ -537,7 +537,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs Vector2 distanceFromDestination = destination - npc.Center; // Movement - if (npc.Distance(destination) > maxDistance || succ || !Main.getGoodWorld) + if (npc.Distance(destination) > maxDistance || succ || !CalamityWorld.LegendaryMode) CalamityUtils.SmoothMovement(npc, 0f, distanceFromDestination, velocity, acceleration, true); } diff --git a/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs index 281d6b94ab..6cda24b637 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs @@ -50,7 +50,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs bool death = CalamityWorld.death || bossRush; float exhaustionGateValue = 360f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) exhaustionGateValue *= 0.5f; float numberOfAttacksBeforeExhaustion = 12f; @@ -147,7 +147,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs } // The dumbest thing to ever exist - if (CalamityWorld.LegendaryMode && revenge) + if (CalamityWorld.LegendaryMode) chargeVelocity *= 1.25f; if (exhausted) @@ -305,7 +305,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs } // The dumbest thing to ever exist - if (CalamityWorld.LegendaryMode && revenge) + if (CalamityWorld.LegendaryMode) chargeTime *= 2; // Set variables for spawn effects @@ -609,7 +609,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs npc.damage = setDamage; // The dumbest thing to ever exist - if (CalamityWorld.LegendaryMode && revenge && npc.ai[2] % 10f == 0f) + if (CalamityWorld.LegendaryMode && npc.ai[2] % 10f == 0f) { // Rotation and direction int dir = Math.Sign(player.Center.X - npc.Center.X); @@ -781,7 +781,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + 900f), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - 900f), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + 1800f), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - 1800f), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); @@ -828,7 +828,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + 50f + calamityGlobalNPC.newAI[2]), (int)(npc.Center.Y + 540f), ModContent.NPCType(), 0, 0f, 0f, 1f, -sharkronVelocity, 255); NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - 50f - calamityGlobalNPC.newAI[2]), (int)(npc.Center.Y + 540f), ModContent.NPCType(), 0, 0f, 0f, -1f, -sharkronVelocity, 255); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + 50f + calamityGlobalNPC.newAI[2] * 0.5f), (int)(npc.Center.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, 1f, -sharkronVelocity, 255); NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - 50f - calamityGlobalNPC.newAI[2] * 0.5f), (int)(npc.Center.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, -1f, -sharkronVelocity, 255); @@ -984,7 +984,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs npc.damage = setDamage; // The dumbest thing to ever exist - if (CalamityWorld.LegendaryMode && revenge && npc.ai[2] % 8f == 0f) + if (CalamityWorld.LegendaryMode && npc.ai[2] % 8f == 0f) { // Rotation and direction int dir = Math.Sign(player.Center.X - npc.Center.X); @@ -1141,13 +1141,13 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs Vector2 phase2GoreDirection = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + npc.Center; int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); - int totalGore = Main.getGoodWorld ? 40 : 20; + int totalGore = CalamityWorld.LegendaryMode ? 40 : 20; for (int i = 0; i < totalGore; i++) { float velocityX = npc.direction * goreVelocityX * (Main.rand.NextFloat(0.2f, 0.8f) + 0.5f); float velocityY = goreVelocityY * (Main.rand.NextFloat(0.2f, 0.8f) + 0.5f); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { velocityX *= Main.rand.NextFloat() + 0.5f; velocityY *= Main.rand.NextFloat() + 0.5f; @@ -1211,7 +1211,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + 50f + calamityGlobalNPC.newAI[2]), (int)(npc.Center.Y - 540f), ModContent.NPCType(), 0, 0f, 0f, 1f, sharkronVelocity, 255); NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - 50f - calamityGlobalNPC.newAI[2]), (int)(npc.Center.Y - 540f), ModContent.NPCType(), 0, 0f, 0f, -1f, sharkronVelocity, 255); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + 50f + calamityGlobalNPC.newAI[2] * 0.5f), (int)(npc.Center.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, 1f, -sharkronVelocity, 255); NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - 50f - calamityGlobalNPC.newAI[2] * 0.5f), (int)(npc.Center.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, -1f, -sharkronVelocity, 255); @@ -1379,7 +1379,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs npc.damage = setDamage; // The dumbest thing to ever exist - if (CalamityWorld.LegendaryMode && revenge && npc.ai[2] % 6f == 0f) + if (CalamityWorld.LegendaryMode && npc.ai[2] % 6f == 0f) { // Rotation and direction int dir = Math.Sign(player.Center.X - npc.Center.X); @@ -1517,13 +1517,13 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs Vector2 phase3GoreDirection = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + npc.Center; int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); - int totalGore = Main.getGoodWorld ? 40 : 20; + int totalGore = CalamityWorld.LegendaryMode ? 40 : 20; for (int i = 0; i < totalGore; i++) { float velocityX = npc.direction * goreVelocityX * (Main.rand.NextFloat(0.2f, 0.8f) + 0.5f); float velocityY = goreVelocityY * (Main.rand.NextFloat(0.2f, 0.8f) + 0.5f); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { velocityX *= Main.rand.NextFloat() + 0.5f; velocityY *= Main.rand.NextFloat() + 0.5f; @@ -1546,7 +1546,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + x), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - x), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + x), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2] * 0.5f), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - x), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2] * 0.5f), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index de28c11370..f760d3aff0 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -1979,11 +1979,11 @@ namespace CalamityMod.NPCs else if (npc.type == NPCID.KingSlime) { if (CalamityWorld.death) - npc.scale = Main.getGoodWorld ? 6f : 2.5f; + npc.scale = CalamityWorld.LegendaryMode ? 6f : 2.5f; else - npc.scale = Main.getGoodWorld ? 3f : 1.5f; + npc.scale = CalamityWorld.LegendaryMode ? 3f : 1.5f; - npc.lifeMax = (int)Math.Round(npc.lifeMax * (Main.getGoodWorld ? 1.8 : 1.5)); + npc.lifeMax = (int)Math.Round(npc.lifeMax * (CalamityWorld.LegendaryMode ? 1.8 : 1.5)); } else if ((npc.type == NPCID.Wraith || npc.type == NPCID.Mimic || npc.type == NPCID.Reaper || npc.type == NPCID.PresentMimic || npc.type == NPCID.SandElemental || npc.type == NPCID.Ghost) && CalamityWorld.LegendaryMode) { @@ -4124,14 +4124,14 @@ namespace CalamityMod.NPCs { npc.TargetClosest(); - float velocity = Main.getGoodWorld ? 12f : (CalamityWorld.death || BossRushEvent.BossRushActive) ? 10.5f : 9f; + float velocity = CalamityWorld.LegendaryMode ? 12f : (CalamityWorld.death || BossRushEvent.BossRushActive) ? 10.5f : 9f; if (npc.ai[1] == 70f) velocity *= 0.4f; npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; } - if (Main.getGoodWorld && !npc.dontTakeDamage) + if (CalamityWorld.LegendaryMode && !npc.dontTakeDamage) { if ((double)(npc.Center.Y / 16f) < Main.worldSurface) npc.dontTakeDamage = true; @@ -6779,7 +6779,7 @@ namespace CalamityMod.NPCs { if (Main.netMode != NetmodeID.MultiplayerClient) { - int slimeAmt = Main.getGoodWorld ? Main.rand.Next(6) + 10 : Main.rand.Next(2) + 2; // 2 to 3 extra + int slimeAmt = CalamityWorld.LegendaryMode ? Main.rand.Next(6) + 10 : Main.rand.Next(2) + 2; // 2 to 3 extra for (int s = 0; s < slimeAmt; s++) { int slime = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)(npc.position.Y + npc.height), NPCID.BlueSlime, 0, 0f, 0f, 0f, 0f, 255); @@ -6787,8 +6787,8 @@ namespace CalamityMod.NPCs npc2.SetDefaults(NPCID.BabySlime); npc2.velocity.X = npc.velocity.X * 2f; npc2.velocity.Y = npc.velocity.Y; - npc2.velocity.X += Main.rand.Next(-20, 20) * (Main.getGoodWorld ? 0.5f : 0.1f) + s * npc.direction * (Main.getGoodWorld ? 0.5f : 0.3f); - npc2.velocity.Y -= Main.rand.Next(0, 10) * (Main.getGoodWorld ? 0.5f : 0.1f) + s; + npc2.velocity.X += Main.rand.Next(-20, 20) * (CalamityWorld.LegendaryMode ? 0.5f : 0.1f) + s * npc.direction * (CalamityWorld.LegendaryMode ? 0.5f : 0.3f); + npc2.velocity.Y -= Main.rand.Next(0, 10) * (CalamityWorld.LegendaryMode ? 0.5f : 0.1f) + s; npc2.ai[0] = -1000 * Main.rand.Next(3); if (Main.dedServ && slime < Main.maxNPCs) @@ -6801,7 +6801,7 @@ namespace CalamityMod.NPCs case NPCID.CursedHammer: case NPCID.EnchantedSword: case NPCID.CrimsonAxe: - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) npc.justHit = false; break; @@ -6812,13 +6812,13 @@ namespace CalamityMod.NPCs case NPCID.IceTortoise: case NPCID.BlackRecluse: case NPCID.BlackRecluseWall: - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) npc.justHit = false; break; case NPCID.Paladin: - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) npc.justHit = false; break; @@ -6826,7 +6826,7 @@ namespace CalamityMod.NPCs if (npc.type == NPCType()) { - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) npc.justHit = false; } } @@ -7660,7 +7660,7 @@ namespace CalamityMod.NPCs if (npc.IsABestiaryIconDummy) return null; - if (Main.LocalPlayer.Calamity().trippy || (npc.type == NPCID.KingSlime && CalamityWorld.LegendaryMode && CalamityWorld.revenge)) + if (Main.LocalPlayer.Calamity().trippy || (npc.type == NPCID.KingSlime && CalamityWorld.LegendaryMode)) return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Main.DiscoR); if (npc.type == NPCID.KingSlime && CalamityWorld.death) @@ -8352,7 +8352,7 @@ namespace CalamityMod.NPCs { Color currentColor = npc.GetAlpha(drawColor); float opacityScale = 1f - MathHelper.Lerp(0.34f, 1f, npc.life / (float)secondAfterimageSetHealthValue); - float opacity = Main.getGoodWorld ? 0.7f : opacityScale; + float opacity = CalamityWorld.LegendaryMode ? 0.7f : opacityScale; opacity = MathHelper.Clamp(opacity, 0f, 1f); currentColor.R = (byte)((float)(int)currentColor.R * opacity); @@ -8455,7 +8455,7 @@ namespace CalamityMod.NPCs Color currentColor = npc.GetAlpha(drawColor); float opacity = (1f - Main.npc[NPC.crimsonBoss].life / (float)Main.npc[NPC.crimsonBoss].lifeMax) * 2f; opacity *= opacity; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) opacity = 1f; opacity = MathHelper.Clamp(opacity, 0f, 1f); @@ -8492,7 +8492,7 @@ namespace CalamityMod.NPCs { currentColor = npc.GetAlpha(drawColor); float opacityScale = 1f - Main.npc[NPC.crimsonBoss].life / (float)secondAfterimageSetHealthValue; - opacity = Main.getGoodWorld ? 1f : opacityScale; + opacity = CalamityWorld.LegendaryMode ? 1f : opacityScale; opacity = MathHelper.Clamp(opacity, 0f, 1f); currentColor.R = (byte)((float)(int)currentColor.R * opacity); diff --git a/NPCs/CeaselessVoid/DarkEnergy.cs b/NPCs/CeaselessVoid/DarkEnergy.cs index 52f34259d9..ed609587c8 100644 --- a/NPCs/CeaselessVoid/DarkEnergy.cs +++ b/NPCs/CeaselessVoid/DarkEnergy.cs @@ -123,7 +123,7 @@ namespace CalamityMod.NPCs.CeaselessVoid if (NPC.Opacity > 1f) NPC.Opacity = 1f; - NPC.scale = MathHelper.Lerp(0.05f, Main.getGoodWorld ? 0.5f : 1f, NPC.Opacity); + NPC.scale = MathHelper.Lerp(0.05f, CalamityWorld.LegendaryMode ? 0.5f : 1f, NPC.Opacity); } else { diff --git a/NPCs/Crabulon/CrabShroom.cs b/NPCs/Crabulon/CrabShroom.cs index 2c3e928208..d31e1f70bc 100644 --- a/NPCs/Crabulon/CrabShroom.cs +++ b/NPCs/Crabulon/CrabShroom.cs @@ -31,13 +31,13 @@ namespace CalamityMod.NPCs.Crabulon NPC.GetNPCDamage(); NPC.width = 14; NPC.height = 14; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) NPC.scale = 2f; - NPC.lifeMax = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 180 : 15; + NPC.lifeMax = CalamityWorld.LegendaryMode ? 180 : 15; if (BossRushEvent.BossRushActive) NPC.lifeMax = 8000; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.lifeMax *= 2; AIType = -1; NPC.knockBackResist = 0.5f; @@ -71,7 +71,7 @@ namespace CalamityMod.NPCs.Crabulon bool death = CalamityWorld.death || BossRushEvent.BossRushActive; float xVelocityLimit = BossRushEvent.BossRushActive ? 12f : death ? 8f : revenge ? 6f : 5f; - float yVelocityLimit = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.25f : death ? 0.75f : revenge ? 0.9f : 1f; + float yVelocityLimit = CalamityWorld.LegendaryMode ? 0.25f : death ? 0.75f : revenge ? 0.9f : 1f; // Get a target if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) @@ -103,7 +103,7 @@ namespace CalamityMod.NPCs.Crabulon NPC.rotation = NPC.velocity.X * 0.1f; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) { float pushVelocity = 0.5f; foreach (NPC n in Main.ActiveNPCs) diff --git a/NPCs/Crabulon/Crabulon.cs b/NPCs/Crabulon/Crabulon.cs index fedab5f87a..d7b8c63f86 100644 --- a/NPCs/Crabulon/Crabulon.cs +++ b/NPCs/Crabulon/Crabulon.cs @@ -95,7 +95,7 @@ namespace CalamityMod.NPCs.Crabulon NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { NPC.scale *= 1.5f; NPC.defense += 12; @@ -208,7 +208,7 @@ namespace CalamityMod.NPCs.Crabulon enrageScale += 1f; } - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) enrageScale += 0.5f; if (NPC.ai[0] < 2f) @@ -285,7 +285,7 @@ namespace CalamityMod.NPCs.Crabulon walkingVelocity += 0.75f; if (phase4) walkingVelocity += 1f; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) walkingVelocity *= 2f; bool shouldWalkSlower = false; @@ -982,7 +982,7 @@ namespace CalamityMod.NPCs.Crabulon { if (Main.netMode != NetmodeID.MultiplayerClient) { - int crabShroomSpawnFreq = (int)(NPC.lifeMax * ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.01 : Main.getGoodWorld ? 0.02 : 0.05)); + int crabShroomSpawnFreq = (int)(NPC.lifeMax * (CalamityWorld.LegendaryMode ? 0.01 : CalamityWorld.LegendaryMode ? 0.02 : 0.05)); if ((NPC.life + crabShroomSpawnFreq) < NPC.localAI[0]) { NPC.localAI[0] = NPC.life; @@ -994,8 +994,8 @@ namespace CalamityMod.NPCs.Crabulon int npcType = ModContent.NPCType(); int crabShroom = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, npcType); Main.npc[crabShroom].SetDefaults(npcType); - Main.npc[crabShroom].velocity.X = Main.rand.Next(-50, 51) * (Main.getGoodWorld ? 0.2f : 0.1f); - Main.npc[crabShroom].velocity.Y = Main.rand.Next(-50, -31) * (Main.getGoodWorld ? 0.2f : 0.1f); + Main.npc[crabShroom].velocity.X = Main.rand.Next(-50, 51) * (CalamityWorld.LegendaryMode ? 0.2f : 0.1f); + Main.npc[crabShroom].velocity.Y = Main.rand.Next(-50, -31) * (CalamityWorld.LegendaryMode ? 0.2f : 0.1f); if (Main.dedServ && crabShroom < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, crabShroom); } diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index 0f477936d4..5e29bf0c3a 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -111,7 +111,7 @@ namespace CalamityMod.NPCs.Cryogen NPC.HitSound = HitSound; NPC.DeathSound = DeathSound; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.scale *= 0.8f; if (Main.zenithWorld) @@ -294,7 +294,7 @@ namespace CalamityMod.NPCs.Cryogen else if (NPC.timeLeft < 1800) NPC.timeLeft = 1800; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) { int spawnType = Main.zenithWorld ? NPCID.RedDevil : NPCID.IceGolem; if (!NPC.AnyNPCs(spawnType)) @@ -322,13 +322,13 @@ namespace CalamityMod.NPCs.Cryogen float chargePhaseGateValue = bossRush ? 240f : 360f; float chargeDuration = 60f; - float chargeTelegraphTime = NPC.ai[0] == 2f ? ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 60f : 80f) : ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 90f : 120f); + float chargeTelegraphTime = NPC.ai[0] == 2f ? (CalamityWorld.LegendaryMode ? 60f : 80f) : (CalamityWorld.LegendaryMode ? 90f : 120f); float chargeTelegraphMaxRotationIncrement = 1f; float chargeTelegraphRotationIncrement = chargeTelegraphMaxRotationIncrement / chargeTelegraphTime; float chargeSlowDownTime = 15f; - float chargeVelocityMin = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 24f : 12f; - float chargeVelocityMax = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 42f : 30f; - if (Main.getGoodWorld) + float chargeVelocityMin = CalamityWorld.LegendaryMode ? 24f : 12f; + float chargeVelocityMax = CalamityWorld.LegendaryMode ? 42f : 30f; + if (CalamityWorld.LegendaryMode) { chargePhaseGateValue *= 0.7f; chargeDuration *= 0.8f; @@ -414,7 +414,7 @@ namespace CalamityMod.NPCs.Cryogen playerYDist *= playerDistance; float inertia = 50f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) inertia *= 0.5f; NPC.velocity.X = (NPC.velocity.X * inertia + playerXDist) / (inertia + 1f); @@ -688,7 +688,7 @@ namespace CalamityMod.NPCs.Cryogen playerYDist *= playerDistance; float inertia = 50f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) inertia *= 0.5f; NPC.velocity.X = (NPC.velocity.X * inertia + playerXDist) / (inertia + 1f); @@ -851,7 +851,7 @@ namespace CalamityMod.NPCs.Cryogen playerYDist *= playerDistance; float inertia = 50f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) inertia *= 0.5f; NPC.velocity.X = (NPC.velocity.X * inertia + playerXDist) / (inertia + 1f); @@ -1130,7 +1130,7 @@ namespace CalamityMod.NPCs.Cryogen } float inertia = 30f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) inertia *= 0.5f; NPC.velocity.X = (NPC.velocity.X * inertia + playerchargeXDist) / (inertia + 1f); diff --git a/NPCs/Cryogen/CryogenShield.cs b/NPCs/Cryogen/CryogenShield.cs index bb4ee5cc49..47ec58b979 100644 --- a/NPCs/Cryogen/CryogenShield.cs +++ b/NPCs/Cryogen/CryogenShield.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.Cryogen NPC.GetNPCDamage(); NPC.width = 216; NPC.height = 216; - NPC.scale *= (CalamityWorld.death || BossRushEvent.BossRushActive || Main.getGoodWorld) ? 0.8f : 1f; + NPC.scale *= (CalamityWorld.death || BossRushEvent.BossRushActive || CalamityWorld.LegendaryMode) ? 0.8f : 1f; NPC.DR_NERD(0.4f); NPC.LifeMaxNERB(2800, 3360, 33600); NPC.Opacity = 0f; diff --git a/NPCs/DesertScourge/DesertNuisanceBody.cs b/NPCs/DesertScourge/DesertNuisanceBody.cs index c5c3c4229e..9b572476d2 100644 --- a/NPCs/DesertScourge/DesertNuisanceBody.cs +++ b/NPCs/DesertScourge/DesertNuisanceBody.cs @@ -44,11 +44,11 @@ namespace CalamityMod.NPCs.DesertScourge NPC.height = 88; NPC.defense = 5; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.defense += 27; NPC.LifeMaxNERB(1500, 1800, 40000); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) NPC.lifeMax = 4800; NPC.aiStyle = -1; AIType = -1; @@ -173,7 +173,7 @@ namespace CalamityMod.NPCs.DesertScourge // Calculate contact damage based on velocity float maxChaseSpeed = Main.zenithWorld ? DesertNuisanceHead.SegmentVelocity_ZenithSeed : - Main.getGoodWorld ? DesertNuisanceHead.SegmentVelocity_GoodWorld : + CalamityWorld.LegendaryMode ? DesertNuisanceHead.SegmentVelocity_GoodWorld : death ? DesertNuisanceHead.SegmentVelocity_Death : DesertNuisanceHead.SegmentVelocity_Expert; maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); diff --git a/NPCs/DesertScourge/DesertNuisanceBodyYoung.cs b/NPCs/DesertScourge/DesertNuisanceBodyYoung.cs index fc10337135..9201fcf04e 100644 --- a/NPCs/DesertScourge/DesertNuisanceBodyYoung.cs +++ b/NPCs/DesertScourge/DesertNuisanceBodyYoung.cs @@ -44,11 +44,11 @@ namespace CalamityMod.NPCs.DesertScourge NPC.height = 78; NPC.defense = 4; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.defense += 26; NPC.LifeMaxNERB(1300, 1560, 35000); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) NPC.lifeMax = 4000; NPC.aiStyle = -1; AIType = -1; @@ -181,7 +181,7 @@ namespace CalamityMod.NPCs.DesertScourge // Calculate contact damage based on velocity float maxChaseSpeed = Main.zenithWorld ? DesertNuisanceHeadYoung.SegmentVelocity_ZenithSeed : - Main.getGoodWorld ? DesertNuisanceHeadYoung.SegmentVelocity_GoodWorld : + CalamityWorld.LegendaryMode ? DesertNuisanceHeadYoung.SegmentVelocity_GoodWorld : death ? DesertNuisanceHeadYoung.SegmentVelocity_Death : DesertNuisanceHeadYoung.SegmentVelocity_Expert; maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); diff --git a/NPCs/DesertScourge/DesertNuisanceHead.cs b/NPCs/DesertScourge/DesertNuisanceHead.cs index f1bc6a6ad5..5b1f4cf895 100644 --- a/NPCs/DesertScourge/DesertNuisanceHead.cs +++ b/NPCs/DesertScourge/DesertNuisanceHead.cs @@ -56,14 +56,14 @@ namespace CalamityMod.NPCs.DesertScourge NPC.GetNPCDamage(); NPC.defense = 3; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.defense += 19; NPC.width = 88; NPC.height = 88; NPC.LifeMaxNERB(1500, 1800, 40000); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) NPC.lifeMax = 4800; NPC.aiStyle = -1; AIType = -1; @@ -146,7 +146,7 @@ namespace CalamityMod.NPCs.DesertScourge speed += 0.085f * enrageScale; turnSpeed += 0.17f * enrageScale; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { speed *= 1.1f; turnSpeed *= 1.2f; @@ -168,7 +168,7 @@ namespace CalamityMod.NPCs.DesertScourge { int previous = NPC.whoAmI; int minLength = 8; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) minLength *= 2; int bodyTypeAIVariable = 0; @@ -272,7 +272,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.spriteDirection = -1; float maxChaseSpeed = Main.zenithWorld ? SegmentVelocity_ZenithSeed : - Main.getGoodWorld ? SegmentVelocity_GoodWorld : + CalamityWorld.LegendaryMode ? SegmentVelocity_GoodWorld : death ? SegmentVelocity_Death : SegmentVelocity_Expert; maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); @@ -299,7 +299,7 @@ namespace CalamityMod.NPCs.DesertScourge } } - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) { speed *= 1.5f; turnSpeed *= 1.5f; diff --git a/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs b/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs index 58cd825560..62e8c3c773 100644 --- a/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs +++ b/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs @@ -48,14 +48,14 @@ namespace CalamityMod.NPCs.DesertScourge NPC.GetNPCDamage(); NPC.defense = 2; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.defense += 18; NPC.width = 78; NPC.height = 78; NPC.LifeMaxNERB(1300, 1560, 35000); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) NPC.lifeMax = 4000; NPC.aiStyle = -1; AIType = -1; @@ -142,7 +142,7 @@ namespace CalamityMod.NPCs.DesertScourge speed += 0.07f * enrageScale; turnSpeed += 0.14f * enrageScale; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { speed *= 1.1f; turnSpeed *= 1.2f; @@ -203,7 +203,7 @@ namespace CalamityMod.NPCs.DesertScourge { int previous = NPC.whoAmI; int minLength = 8; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) minLength *= 2; int bodyTypeAIVariable = 0; @@ -311,7 +311,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.spriteDirection = -1; float maxChaseSpeed = Main.zenithWorld ? SegmentVelocity_ZenithSeed : - Main.getGoodWorld ? SegmentVelocity_GoodWorld : + CalamityWorld.LegendaryMode ? SegmentVelocity_GoodWorld : death ? SegmentVelocity_Death : SegmentVelocity_Expert; maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); @@ -338,7 +338,7 @@ namespace CalamityMod.NPCs.DesertScourge } } - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) { speed *= 1.5f; turnSpeed *= 1.5f; diff --git a/NPCs/DesertScourge/DesertNuisanceTail.cs b/NPCs/DesertScourge/DesertNuisanceTail.cs index 6769923e9b..e06bd14066 100644 --- a/NPCs/DesertScourge/DesertNuisanceTail.cs +++ b/NPCs/DesertScourge/DesertNuisanceTail.cs @@ -26,11 +26,11 @@ namespace CalamityMod.NPCs.DesertScourge NPC.height = 88; NPC.defense = 8; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.defense += 34; NPC.LifeMaxNERB(1500, 1800, 40000); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) NPC.lifeMax = 4800; NPC.aiStyle = -1; AIType = -1; @@ -137,7 +137,7 @@ namespace CalamityMod.NPCs.DesertScourge // Calculate contact damage based on velocity float maxChaseSpeed = Main.zenithWorld ? DesertNuisanceHead.SegmentVelocity_ZenithSeed : - Main.getGoodWorld ? DesertNuisanceHead.SegmentVelocity_GoodWorld : + CalamityWorld.LegendaryMode ? DesertNuisanceHead.SegmentVelocity_GoodWorld : death ? DesertNuisanceHead.SegmentVelocity_Death : DesertNuisanceHead.SegmentVelocity_Expert; maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); diff --git a/NPCs/DesertScourge/DesertNuisanceTailYoung.cs b/NPCs/DesertScourge/DesertNuisanceTailYoung.cs index 8b502c0df0..90b0fc0dc7 100644 --- a/NPCs/DesertScourge/DesertNuisanceTailYoung.cs +++ b/NPCs/DesertScourge/DesertNuisanceTailYoung.cs @@ -26,11 +26,11 @@ namespace CalamityMod.NPCs.DesertScourge NPC.height = 78; NPC.defense = 7; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.defense += 33; NPC.LifeMaxNERB(1300, 1560, 35000); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) NPC.lifeMax = 4000; NPC.aiStyle = -1; AIType = -1; @@ -145,7 +145,7 @@ namespace CalamityMod.NPCs.DesertScourge // Calculate contact damage based on velocity float maxChaseSpeed = Main.zenithWorld ? DesertNuisanceHeadYoung.SegmentVelocity_ZenithSeed : - Main.getGoodWorld ? DesertNuisanceHeadYoung.SegmentVelocity_GoodWorld : + CalamityWorld.LegendaryMode ? DesertNuisanceHeadYoung.SegmentVelocity_GoodWorld : death ? DesertNuisanceHeadYoung.SegmentVelocity_Death : DesertNuisanceHeadYoung.SegmentVelocity_Expert; maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); diff --git a/NPCs/DesertScourge/DesertScourgeBody.cs b/NPCs/DesertScourge/DesertScourgeBody.cs index 23d2a5c5a6..e6a8aed1fe 100644 --- a/NPCs/DesertScourge/DesertScourgeBody.cs +++ b/NPCs/DesertScourge/DesertScourgeBody.cs @@ -50,7 +50,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.DR_NERD(0.05f); NPC.LifeMaxNERB(4200, 5000, 1150000); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.lifeMax *= 4; NPC.aiStyle = -1; AIType = -1; @@ -65,7 +65,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.netAlways = true; NPC.dontCountMe = true; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.scale *= 0.4f; NPC.Calamity().VulnerableToCold = true; @@ -217,7 +217,7 @@ namespace CalamityMod.NPCs.DesertScourge // Calculate contact damage based on velocity float maxChaseSpeed = Main.zenithWorld ? DesertScourgeHead.SegmentVelocity_ZenithSeed : - Main.getGoodWorld ? DesertScourgeHead.SegmentVelocity_GoodWorld : + CalamityWorld.LegendaryMode ? DesertScourgeHead.SegmentVelocity_GoodWorld : death ? DesertScourgeHead.SegmentVelocity_Death : expertMode ? DesertScourgeHead.SegmentVelocity_Expert : DesertScourgeHead.SegmentVelocity_Normal; diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index de32d8946f..0595e9e6dc 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -95,7 +95,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.height = 104; NPC.LifeMaxNERB(4200, 5000, 1150000); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.lifeMax *= 4; NPC.aiStyle = -1; AIType = -1; @@ -110,7 +110,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.DeathSound = DeathSound; NPC.netAlways = true; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.scale *= 0.4f; if (Main.zenithWorld) @@ -257,7 +257,7 @@ namespace CalamityMod.NPCs.DesertScourge speed += 0.085f * enrageScale; turnSpeed += 0.17f * enrageScale; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { speed *= 1.1f; turnSpeed *= 1.2f; @@ -431,7 +431,7 @@ namespace CalamityMod.NPCs.DesertScourge { int previous = NPC.whoAmI; int minLength = death ? 24 : revenge ? 21 : expertMode ? 18 : 15; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) minLength *= 3; int bodyTypeAIVariable = 0; @@ -542,7 +542,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.spriteDirection = -1; float maxChaseSpeed = Main.zenithWorld ? SegmentVelocity_ZenithSeed : - Main.getGoodWorld ? SegmentVelocity_GoodWorld : + CalamityWorld.LegendaryMode ? SegmentVelocity_GoodWorld : death ? SegmentVelocity_Death : expertMode ? SegmentVelocity_Expert : SegmentVelocity_Normal; @@ -601,15 +601,15 @@ namespace CalamityMod.NPCs.DesertScourge { // Spit a huge spread of sand upwards that falls down SoundEngine.PlaySound(SandBlastSound, NPC.Center); - float velocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 16f : bossRush ? 10f : death ? 8.5f : revenge ? 8f : expertMode ? 7.5f : 6f; + float velocity = CalamityWorld.LegendaryMode ? 16f : bossRush ? 10f : death ? 8.5f : revenge ? 8f : expertMode ? 7.5f : 6f; int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); Vector2 projectileVelocity = (NPC.Center + NPC.velocity * 10f - NPC.Center).SafeNormalize(Vector2.UnitY) * velocity; int numProj = bossRush ? 30 : death ? 24 : revenge ? 21 : expertMode ? 18 : 12; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) numProj *= 2; - int spread = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 120 : 90; + int spread = CalamityWorld.LegendaryMode ? 120 : 90; float rotation = MathHelper.ToRadians(spread); for (int i = 0; i < numProj; i++) { diff --git a/NPCs/DesertScourge/DesertScourgeTail.cs b/NPCs/DesertScourge/DesertScourgeTail.cs index 5415c8e938..d3ee5cce9e 100644 --- a/NPCs/DesertScourge/DesertScourgeTail.cs +++ b/NPCs/DesertScourge/DesertScourgeTail.cs @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.DR_NERD(0.1f); NPC.LifeMaxNERB(4200, 5000, 1150000); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.lifeMax *= 4; NPC.aiStyle = -1; AIType = -1; @@ -45,7 +45,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.netAlways = true; NPC.dontCountMe = true; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.scale *= 0.4f; NPC.Calamity().VulnerableToCold = true; @@ -179,7 +179,7 @@ namespace CalamityMod.NPCs.DesertScourge // Calculate contact damage based on velocity float maxChaseSpeed = Main.zenithWorld ? DesertScourgeHead.SegmentVelocity_ZenithSeed : - Main.getGoodWorld ? DesertScourgeHead.SegmentVelocity_GoodWorld : + CalamityWorld.LegendaryMode ? DesertScourgeHead.SegmentVelocity_GoodWorld : death ? DesertScourgeHead.SegmentVelocity_Death : expertMode ? DesertScourgeHead.SegmentVelocity_Expert : DesertScourgeHead.SegmentVelocity_Normal; diff --git a/NPCs/DevourerofGods/DevourerofGodsBody.cs b/NPCs/DevourerofGods/DevourerofGodsBody.cs index 79e71a6b1d..25d2be171a 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBody.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBody.cs @@ -89,7 +89,7 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.BossBar = Main.BigBossProgressBar.NeverValid; NPC.dontCountMe = true; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.scale *= 1.5f; // Scale HP in Master @@ -275,7 +275,7 @@ namespace CalamityMod.NPCs.DevourerofGods float segmentVelocity = bossRush ? 19f : death ? 17.5f : 16f; if (expertMode) segmentVelocity += 4f * (1f - lifeRatio); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) segmentVelocity *= 1.1f; // Calculate contact damage based on velocity diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index 2d1b9fc913..b33e0e5517 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -213,7 +213,7 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.DeathSound = SoundID.NPCDeath14; NPC.netAlways = true; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.scale *= 1.5f; // Scale HP in Master @@ -425,7 +425,7 @@ namespace CalamityMod.NPCs.DevourerofGods groundPhaseTurnSpeed += Vector2.Distance(destination, NPC.Center) * 0.0002f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { segmentVelocity *= 1.1f; speed *= 1.1f; @@ -751,10 +751,10 @@ namespace CalamityMod.NPCs.DevourerofGods // Fireballs // Check angle and distance to make sure it's realistic that they'd be fired - if (NPC.Opacity >= 1f && (distanceFromTarget > 480f || (CalamityWorld.LegendaryMode && CalamityWorld.revenge)) && (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY).ToRotation().AngleTowards(NPC.velocity.ToRotation(), MathHelper.PiOver4) == NPC.velocity.ToRotation()) + if (NPC.Opacity >= 1f && (distanceFromTarget > 480f || CalamityWorld.LegendaryMode) && (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY).ToRotation().AngleTowards(NPC.velocity.ToRotation(), MathHelper.PiOver4) == NPC.velocity.ToRotation()) { calamityGlobalNPC.newAI[0] += 1f; - if (calamityGlobalNPC.newAI[0] >= ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 30f : 150f) && calamityGlobalNPC.newAI[0] % ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 30f : phase7 ? 30f : 60f) == 0f) + if (calamityGlobalNPC.newAI[0] >= (CalamityWorld.LegendaryMode ? 30f : 150f) && calamityGlobalNPC.newAI[0] % (CalamityWorld.LegendaryMode ? 30f : phase7 ? 30f : 60f) == 0f) { float fireballSpeed = 8f; Vector2 fireballVelocity = Vector2.Normalize(player.Center - NPC.Center) * fireballSpeed + NPC.velocity * 0.5f; @@ -769,7 +769,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (Main.netMode != NetmodeID.MultiplayerClient) Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, fireballVelocity, type, damage, 0f, Main.myPlayer); - if (CalamityWorld.LegendaryMode && revenge) + if (CalamityWorld.LegendaryMode) { for (int l = 0; l < 8; l++) { @@ -1112,7 +1112,7 @@ namespace CalamityMod.NPCs.DevourerofGods speedCopy += Vector2.Distance(destination, NPC.Center) * 0.005f; turnSpeedCopy += Vector2.Distance(destination, NPC.Center) * 0.00025f; - if (CalamityWorld.LegendaryMode && revenge) + if (CalamityWorld.LegendaryMode) { if ((player.Center - NPC.Center).SafeNormalize(Vector2.UnitY).ToRotation().AngleTowards(NPC.velocity.ToRotation(), MathHelper.PiOver4) == NPC.velocity.ToRotation()) speedCopy *= 2f; @@ -1270,7 +1270,7 @@ namespace CalamityMod.NPCs.DevourerofGods else if (increaseSpeed) groundPhaseTurnSpeed *= 2f; - if (CalamityWorld.LegendaryMode && revenge) + if (CalamityWorld.LegendaryMode) { if ((player.Center - NPC.Center).SafeNormalize(Vector2.UnitY).ToRotation().AngleTowards(NPC.velocity.ToRotation(), MathHelper.PiOver4) == NPC.velocity.ToRotation()) segmentVelocity *= 2f; @@ -1871,7 +1871,7 @@ namespace CalamityMod.NPCs.DevourerofGods turnSpeedCopy += distanceFromTarget * 0.0001f * (1f - lifeRatio); } - if (CalamityWorld.LegendaryMode && revenge) + if (CalamityWorld.LegendaryMode) { if ((player.Center - NPC.Center).SafeNormalize(Vector2.UnitY).ToRotation().AngleTowards(NPC.velocity.ToRotation(), MathHelper.PiOver4) == NPC.velocity.ToRotation()) speedCopy *= 2f; @@ -2015,7 +2015,7 @@ namespace CalamityMod.NPCs.DevourerofGods else if (increaseSpeed) groundPhaseTurnSpeed *= 2f; - if (CalamityWorld.LegendaryMode && revenge) + if (CalamityWorld.LegendaryMode) { if ((player.Center - NPC.Center).SafeNormalize(Vector2.UnitY).ToRotation().AngleTowards(NPC.velocity.ToRotation(), MathHelper.PiOver4) == NPC.velocity.ToRotation()) segmentVelocity *= 2f; @@ -2331,7 +2331,7 @@ namespace CalamityMod.NPCs.DevourerofGods float mult = revenge ? 1.5f : 3f; for (int i = 0; i < totalSpreads; i++) { - int totalProjectiles = (CalamityWorld.LegendaryMode && revenge) ? 30 : bossRush ? 18 : 12; + int totalProjectiles = (CalamityWorld.LegendaryMode) ? 30 : bossRush ? 18 : 12; float radians = MathHelper.TwoPi / totalProjectiles; float newVelocity = finalVelocity - i * mult; float velocityMult = 1f + ((finalVelocity - newVelocity) / (newVelocity * 2f) / 100f); diff --git a/NPCs/DevourerofGods/DevourerofGodsTail.cs b/NPCs/DevourerofGods/DevourerofGodsTail.cs index ac2e7d6dc6..2dd5f1834d 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTail.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTail.cs @@ -85,7 +85,7 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.takenDamageMultiplier = 1.25f; NPC.dontCountMe = true; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.scale *= 1.5f; // Scale HP in Master @@ -309,7 +309,7 @@ namespace CalamityMod.NPCs.DevourerofGods float segmentVelocity = bossRush ? 19f : death ? 17.5f : 16f; if (expertMode) segmentVelocity += 4f * (1f - lifeRatio); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) segmentVelocity *= 1.1f; // Calculate contact damage based on velocity diff --git a/NPCs/ExoMechs/Apollo/Apollo.cs b/NPCs/ExoMechs/Apollo/Apollo.cs index b00a9ac876..b274341ca0 100644 --- a/NPCs/ExoMechs/Apollo/Apollo.cs +++ b/NPCs/ExoMechs/Apollo/Apollo.cs @@ -424,7 +424,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo float timeToLineUpAttack = 30f; float timeToLineUpCharge = bossRush ? 45f : death ? 60f : revenge ? 68f : expertMode ? 75f : 90f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { timeToLineUpAttack *= 0.5f; timeToLineUpCharge *= 0.5f; @@ -445,7 +445,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Charge velocity float chargeVelocity = bossRush ? 115f : death ? 105f : revenge ? 101.25f : expertMode ? 97.5f : 90f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { baseVelocity *= 1.5f; chargeVelocity *= 1.15f; @@ -466,7 +466,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo float rocketPhaseDuration = lastMechAlive ? 60f : 90f; int numRockets = nerfedAttacks ? 2 : 3; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) numRockets += 3; // Default vector to fly to @@ -488,7 +488,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo int randomLocationVarianceX = shouldGetBuffedByBerserkPhase ? 50 : 20; int randomLocationVarianceY = shouldGetBuffedByBerserkPhase ? 250 : 100; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { randomLocationVarianceX *= 2; randomLocationVarianceY *= 2; @@ -1180,7 +1180,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo NPC.ForceNetUpdate(); // Plasma bolts on charge - if (Main.netMode != NetmodeID.MultiplayerClient && (!(Main.zenithWorld && !exoMechdusa) || (CalamityWorld.LegendaryMode && revenge))) + if (Main.netMode != NetmodeID.MultiplayerClient && (!(Main.zenithWorld && !exoMechdusa) || (CalamityWorld.LegendaryMode))) { int totalProjectiles = bossRush ? 16 : death ? 12 : 8; float radians = MathHelper.TwoPi / totalProjectiles; diff --git a/NPCs/ExoMechs/Ares/AresBody.cs b/NPCs/ExoMechs/Ares/AresBody.cs index 167ada2582..416eb7870a 100644 --- a/NPCs/ExoMechs/Ares/AresBody.cs +++ b/NPCs/ExoMechs/Ares/AresBody.cs @@ -888,7 +888,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares else { // Enrage if the target is more than the deathray length away - if ((distanceFromTarget > DeathrayEnrageDistance || (CalamityWorld.LegendaryMode && revenge)) && EnragedState == (float)Enraged.No) + if ((distanceFromTarget > DeathrayEnrageDistance || (CalamityWorld.LegendaryMode)) && EnragedState == (float)Enraged.No) { // Play enrage sound if (Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < soundDistance) @@ -908,7 +908,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares NPC.velocity *= decelerationVelocityMult; int totalProjectiles = bossRush ? 12 : death ? 10 : revenge ? 9 : expertMode ? 8 : 6; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) totalProjectiles += 4; float radians = MathHelper.TwoPi / totalProjectiles; diff --git a/NPCs/ExoMechs/Artemis/Artemis.cs b/NPCs/ExoMechs/Artemis/Artemis.cs index 7818bae958..58abe447e0 100644 --- a/NPCs/ExoMechs/Artemis/Artemis.cs +++ b/NPCs/ExoMechs/Artemis/Artemis.cs @@ -457,7 +457,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis float attackPhaseGateValue = shouldGetBuffedByBerserkPhase ? berserkAttackTime : normalAttackTime; float timeToLineUpAttack = phase2 ? 30f : 45f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) timeToLineUpAttack *= 0.5f; // Spin variables @@ -496,7 +496,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Charge variables float chargeVelocity = nerfedAttacks ? 60f : bossRush ? 81f : death ? 74f : revenge ? 70.5f : expertMode ? 67f : 60f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) chargeVelocity *= 1.15f; float chargeDistance = 2000f; @@ -521,7 +521,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis float baseVelocity = ((AIState == (int)Phase.Deathray || lineUpAttack || AIState == (int)Phase.LaserShotgun) ? 40f : 20f) * baseVelocityMult; float decelerationVelocityMult = 0.85f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) baseVelocity *= 1.5f; // Laser shotgun variables @@ -535,7 +535,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis int randomLocationVarianceX = shouldGetBuffedByBerserkPhase ? 50 : 20; int randomLocationVarianceY = shouldGetBuffedByBerserkPhase ? 250 : 100; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { randomLocationVarianceX *= 2; randomLocationVarianceY *= 2; diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs index e2eda50072..f9381b3b1f 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs @@ -531,7 +531,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos else baseVelocity *= increaseSpeedMult; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) baseVelocity *= 1.15f; // Calculate contact damage based on velocity diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs index 411630ec67..2fb50e7c18 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs @@ -534,7 +534,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos else baseVelocity *= increaseSpeedMult; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) baseVelocity *= 1.15f; // Calculate contact damage based on velocity diff --git a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs index d4eb16b82b..e211d48748 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs @@ -253,7 +253,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } public float GetSlowdownAreaEdgeRadius(bool lastMechAlive) => - (BossRushEvent.BossRushActive ? 400f : CalamityWorld.death ? 600f : CalamityWorld.revenge ? 700f : Main.expertMode ? 800f : 1000f) * (lastMechAlive ? 0.6f : 1f) * (Main.zenithWorld && !exoMechdusa ? 2 : Main.getGoodWorld ? 0.5f : 1f); + (BossRushEvent.BossRushActive ? 400f : CalamityWorld.death ? 600f : CalamityWorld.revenge ? 700f : Main.expertMode ? 800f : 1000f) * (lastMechAlive ? 0.6f : 1f) * (Main.zenithWorld && !exoMechdusa ? 2 : CalamityWorld.LegendaryMode ? 0.5f : 1f); public int CheckForOtherMechs(ref int targetIndex, out bool exoPrimeAlive, out bool exoTwinsAlive) { @@ -527,7 +527,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos else baseVelocity *= increaseSpeedMult; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) baseVelocity *= 1.15f; float turnDegrees = baseVelocity * 0.1f * (shouldGetBuffedByBerserkPhase ? 1.25f : 1.1f); diff --git a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs index 8faffda3d8..90e279edff 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs @@ -532,7 +532,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos else baseVelocity *= increaseSpeedMult; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) baseVelocity *= 1.15f; // Calculate contact damage based on velocity diff --git a/NPCs/HiveMind/DankCreeper.cs b/NPCs/HiveMind/DankCreeper.cs index 9e5ae8406a..117610775c 100644 --- a/NPCs/HiveMind/DankCreeper.cs +++ b/NPCs/HiveMind/DankCreeper.cs @@ -24,10 +24,10 @@ namespace CalamityMod.NPCs.HiveMind NPC.lifeMax = 120; if (BossRushEvent.BossRushActive) NPC.lifeMax = 2000; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.lifeMax *= 4; - if ((CalamityWorld.LegendaryMode && CalamityWorld.revenge)) + if (CalamityWorld.LegendaryMode) NPC.reflectsProjectiles = true; NPC.aiStyle = -1; diff --git a/NPCs/HiveMind/DarkHeart.cs b/NPCs/HiveMind/DarkHeart.cs index e44757e78c..fa19aa7ce7 100644 --- a/NPCs/HiveMind/DarkHeart.cs +++ b/NPCs/HiveMind/DarkHeart.cs @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.HiveMind NPC.lifeMax = 75; if (BossRushEvent.BossRushActive) NPC.lifeMax = 1800; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.lifeMax *= 4; NPC.aiStyle = -1; @@ -73,9 +73,9 @@ namespace CalamityMod.NPCs.HiveMind if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) NPC.TargetClosest(); - float velocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 10f : death ? 7f : revenge ? 6f : 4f; - float acceleration = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.5f : death ? 0.35f : revenge ? 0.3f : 0.2f; - float deceleration = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.9f : death ? 0.95f : revenge ? 0.96f : 0.98f; + float velocity = CalamityWorld.LegendaryMode ? 10f : death ? 7f : revenge ? 6f : 4f; + float acceleration = CalamityWorld.LegendaryMode ? 0.5f : death ? 0.35f : revenge ? 0.3f : 0.2f; + float deceleration = CalamityWorld.LegendaryMode ? 0.9f : death ? 0.95f : revenge ? 0.96f : 0.98f; if (BossRushEvent.BossRushActive) { velocity *= 2f; @@ -121,7 +121,7 @@ namespace CalamityMod.NPCs.HiveMind if (dropRain && Main.netMode != NetmodeID.MultiplayerClient) { NPC.ai[0] += 1f; - float rainDropRate = Main.getGoodWorld ? 10f : death ? 15f : revenge ? 20f : 30f; + float rainDropRate = CalamityWorld.LegendaryMode ? 10f : death ? 15f : revenge ? 20f : 30f; if (NPC.ai[0] >= rainDropRate) { NPC.ai[0] = 0f; @@ -129,7 +129,7 @@ namespace CalamityMod.NPCs.HiveMind int shaderainYos = (int)(NPC.position.Y + NPC.height + 4f); int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - float randomXVelocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? Main.rand.NextFloat() * 5f : 0f; + float randomXVelocity = CalamityWorld.LegendaryMode ? Main.rand.NextFloat() * 5f : 0f; float velocityY = 8f; Projectile.NewProjectile(NPC.GetSource_FromAI(), shaderainXPos, shaderainYos, randomXVelocity, velocityY, type, damage, 0f, Main.myPlayer); } diff --git a/NPCs/HiveMind/HiveBlob.cs b/NPCs/HiveMind/HiveBlob.cs index e3bcc35ee9..c763368275 100644 --- a/NPCs/HiveMind/HiveBlob.cs +++ b/NPCs/HiveMind/HiveBlob.cs @@ -34,7 +34,7 @@ namespace CalamityMod.NPCs.HiveMind NPC.lifeMax = 50; if (BossRushEvent.BossRushActive) NPC.lifeMax = 1300; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.lifeMax *= 2; NPC.knockBackResist = 0.9f; @@ -110,7 +110,7 @@ namespace CalamityMod.NPCs.HiveMind float hiveMindVelocity = Main.npc[hiveMind].velocity.Length(); float relocateSpeed = getFuckedAI ? 1.2f : death ? 0.8f : revenge ? 0.7f : expertMode ? 0.6f : 0.5f; float acceleration = 0.8f; - float distanceFromMind = Main.getGoodWorld ? 256f : 128f; + float distanceFromMind = CalamityWorld.LegendaryMode ? 256f : 128f; float hiveMindX = Main.npc[hiveMind].Center.X; float hiveMindY = Main.npc[hiveMind].Center.Y; @@ -183,7 +183,7 @@ namespace CalamityMod.NPCs.HiveMind if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[Main.npc[hiveMind].target].position, Main.player[Main.npc[hiveMind].target].width, Main.player[Main.npc[hiveMind].target].height)) { float projSpeed = death ? 8f : revenge ? 7f : expertMode ? 6f : 4f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) projSpeed *= 1.5f; Vector2 projDirection = NPC.Center; @@ -193,7 +193,7 @@ namespace CalamityMod.NPCs.HiveMind playerDist = projSpeed / playerDist; playerX *= playerDist; playerY *= playerDist; - int type = (CalamityWorld.LegendaryMode && CalamityWorld.revenge && Main.rand.NextBool(5)) ? ProjectileID.CursedFlameHostile : ModContent.ProjectileType(); + int type = (CalamityWorld.LegendaryMode && Main.rand.NextBool(5)) ? ProjectileID.CursedFlameHostile : ModContent.ProjectileType(); int damage = type == ProjectileID.CursedFlameHostile ? 30 : NPC.GetProjectileDamage(type); Vector2 projectileVelocity = new Vector2(playerX, playerY); if (type == ProjectileID.CursedFlameHostile) diff --git a/NPCs/HiveMind/HiveBlob2.cs b/NPCs/HiveMind/HiveBlob2.cs index 47acb7e3dc..76ae6a25d1 100644 --- a/NPCs/HiveMind/HiveBlob2.cs +++ b/NPCs/HiveMind/HiveBlob2.cs @@ -38,7 +38,7 @@ namespace CalamityMod.NPCs.HiveMind NPC.lifeMax = 75; if (BossRushEvent.BossRushActive) NPC.lifeMax = 1300; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.lifeMax *= 2; NPC.knockBackResist = 0.9f; @@ -104,7 +104,7 @@ namespace CalamityMod.NPCs.HiveMind float hiveMindVelocity = Main.npc[hiveMind].velocity.Length(); float relocateSpeed = getFuckedAI ? 1.2f : death ? 0.8f : revenge ? 0.7f : expertMode ? 0.6f : 0.5f; float acceleration = 0.8f; - float distanceFromMind = Main.getGoodWorld ? 192f : 96f; + float distanceFromMind = CalamityWorld.LegendaryMode ? 192f : 96f; float hiveMindX = Main.npc[hiveMind].Center.X; float hiveMindY = Main.npc[hiveMind].Center.Y; @@ -177,7 +177,7 @@ namespace CalamityMod.NPCs.HiveMind if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[Main.npc[hiveMind].target].position, Main.player[Main.npc[hiveMind].target].width, Main.player[Main.npc[hiveMind].target].height)) { float projSpeed = death ? 8f : revenge ? 7f : expertMode ? 6f : 4f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) projSpeed *= 1.5f; Vector2 projDirection = NPC.Center; @@ -187,7 +187,7 @@ namespace CalamityMod.NPCs.HiveMind playerDist = projSpeed / playerDist; playerX *= playerDist; playerY *= playerDist; - int type = (CalamityWorld.LegendaryMode && CalamityWorld.revenge && Main.rand.NextBool(5)) ? ProjectileID.CursedFlameHostile : ModContent.ProjectileType(); + int type = (CalamityWorld.LegendaryMode && Main.rand.NextBool(5)) ? ProjectileID.CursedFlameHostile : ModContent.ProjectileType(); int damage = type == ProjectileID.CursedFlameHostile ? 30 : NPC.GetProjectileDamage(type); Vector2 projectileVelocity = new Vector2(playerX, playerY); if (type == ProjectileID.CursedFlameHostile) diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index dac83e0034..8904122f79 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -203,7 +203,7 @@ namespace CalamityMod.NPCs.HiveMind vileSpitFireRate = 12; } - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { reelbackFade *= 10; arcTime *= 0.5f; @@ -574,7 +574,7 @@ namespace CalamityMod.NPCs.HiveMind { NPC.localAI[0] = 1f; int maxBlobs = death ? 15 : revenge ? 7 : expertMode ? 6 : 5; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) maxBlobs *= 2; if (Main.zenithWorld) maxBlobs = 50; @@ -1168,7 +1168,7 @@ namespace CalamityMod.NPCs.HiveMind int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); Vector2 cloudSpawnPos = new Vector2(NPC.position.X + Main.rand.Next(NPC.width), NPC.position.Y + Main.rand.Next(NPC.height)); - Vector2 randomVelocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? Main.rand.NextVector2CircularEdge(4f, 4f) : Vector2.Zero; + Vector2 randomVelocity = CalamityWorld.LegendaryMode ? Main.rand.NextVector2CircularEdge(4f, 4f) : Vector2.Zero; Projectile.NewProjectile(NPC.GetSource_FromAI(), cloudSpawnPos, randomVelocity, type, damage, 0, Main.myPlayer, 11f); } diff --git a/NPCs/HiveMind/HiveTumor.cs b/NPCs/HiveMind/HiveTumor.cs index 8a3269a23c..209437e1ea 100644 --- a/NPCs/HiveMind/HiveTumor.cs +++ b/NPCs/HiveMind/HiveTumor.cs @@ -25,7 +25,7 @@ namespace CalamityMod.NPCs.HiveMind NPC.width = 30; //324 NPC.height = 30; //216 NPC.defense = 0; - NPC.lifeMax = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 10 : 1000; + NPC.lifeMax = CalamityWorld.LegendaryMode ? 10 : 1000; NPC.knockBackResist = 0f; NPC.chaseable = false; NPC.HitSound = SoundID.NPCHit1; @@ -131,7 +131,7 @@ namespace CalamityMod.NPCs.HiveMind { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Demonite, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.MultiplayerClient && (!NPC.AnyNPCs(ModContent.NPCType()) || (CalamityWorld.LegendaryMode && CalamityWorld.revenge))) + if (Main.netMode != NetmodeID.MultiplayerClient && (!NPC.AnyNPCs(ModContent.NPCType()) || CalamityWorld.LegendaryMode)) { Vector2 spawnAt = NPC.Bottom; NPC.NewNPC(NPC.GetSource_Death(), (int)spawnAt.X, (int)spawnAt.Y, ModContent.NPCType()); diff --git a/NPCs/Leviathan/Anahita.cs b/NPCs/Leviathan/Anahita.cs index c1d15e08a3..221e6c3237 100644 --- a/NPCs/Leviathan/Anahita.cs +++ b/NPCs/Leviathan/Anahita.cs @@ -83,7 +83,7 @@ namespace CalamityMod.NPCs.Leviathan NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.scale *= 0.8f; if (Main.zenithWorld) @@ -192,9 +192,9 @@ namespace CalamityMod.NPCs.Leviathan bubbleVelocity += 4f * enrageScale; if (!leviAlive) bubbleVelocity += 2f * (1f - lifeRatio); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) bubbleVelocity *= 1.15f; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) bubbleVelocity *= 2f; // Phases @@ -617,14 +617,14 @@ namespace CalamityMod.NPCs.Leviathan float velocity = death ? 13.5f : 12f; velocity += 6f * enrageScale; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) velocity *= 1.15f; Vector2 chargeSetupLocation = Vector2.Normalize(targetVector - NPC.Center - NPC.velocity) * velocity; float acceleration = death ? 0.28f : 0.25f; acceleration += 0.2f * enrageScale; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) acceleration *= 1.15f; if (Math.Abs(NPC.Center.Y - targetVector.Y) > 50f * NPC.scale || Math.Abs(NPC.Center.X - player.Center.X) > 350f * NPC.scale) @@ -654,7 +654,7 @@ namespace CalamityMod.NPCs.Leviathan float telegraphDist = 500f; // In Legendary, the projectiles she fires is randomized - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) { LegendaryModeAttackChosen = Main.rand.Next(3); if (LegendaryModeAttackChosen == 2) @@ -708,7 +708,7 @@ namespace CalamityMod.NPCs.Leviathan int totalProjectiles = 8; int projectileDistance = 600; int type = ModContent.ProjectileType(); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) { float radians = MathHelper.TwoPi / totalProjectiles; int damage = NPC.GetProjectileDamage(type); @@ -827,7 +827,7 @@ namespace CalamityMod.NPCs.Leviathan if (revenge) chargeVelocity += 2f + (death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio)); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) chargeVelocity *= 1.15f; NPC.velocity = Vector2.Normalize(player.Center - NPC.Center) * chargeVelocity; @@ -853,7 +853,7 @@ namespace CalamityMod.NPCs.Leviathan NPC.Calamity().canBreakPlayerDefense = true; NPC.damage = (int)Math.Round(NPC.defDamage * 1.5); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge && NPC.ai[1] % 5f == 0f) + if (CalamityWorld.LegendaryMode && NPC.ai[1] % 5f == 0f) { SoundEngine.PlaySound(SoundID.Item85, NPC.Center); Vector2 bubbleSpawnPos = new Vector2(NPC.position.X + (NPC.width / 2) + (15 * NPC.direction * NPC.scale), NPC.position.Y + 30 * NPC.scale); @@ -923,7 +923,7 @@ namespace CalamityMod.NPCs.Leviathan Vector2 chargeSetupLocation = Vector2.Normalize(player.Center + new Vector2(NPC.localAI[0], -distance) - NPC.Center - NPC.velocity) * 12f; float acceleration = revenge ? 0.75f : 0.5f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) acceleration *= 1.15f; NPC.SimpleFlyMovement(chargeSetupLocation, acceleration); @@ -980,7 +980,7 @@ namespace CalamityMod.NPCs.Leviathan if (DrawProjectileTelegraphTimer > 0) { Color telegraphColor = Color.Black; - switch (CalamityWorld.LegendaryMode && CalamityWorld.revenge ? LegendaryModeAttackChosen : (int)NPC.localAI[3]) + switch (CalamityWorld.LegendaryMode ? LegendaryModeAttackChosen : (int)NPC.localAI[3]) { case 0: telegraphColor = new Color(55, 70, 240); diff --git a/NPCs/Leviathan/AnahitasIceShield.cs b/NPCs/Leviathan/AnahitasIceShield.cs index cd2355115a..448a2afe0d 100644 --- a/NPCs/Leviathan/AnahitasIceShield.cs +++ b/NPCs/Leviathan/AnahitasIceShield.cs @@ -46,7 +46,7 @@ namespace CalamityMod.NPCs.Leviathan NPC.Calamity().VulnerableToCold = false; NPC.Calamity().VulnerableToSickness = false; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.scale *= 0.8f; } diff --git a/NPCs/Leviathan/AquaticAberration.cs b/NPCs/Leviathan/AquaticAberration.cs index 59dded4f7f..efb3e7f858 100644 --- a/NPCs/Leviathan/AquaticAberration.cs +++ b/NPCs/Leviathan/AquaticAberration.cs @@ -55,7 +55,7 @@ namespace CalamityMod.NPCs.Leviathan NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.scale *= 1.3f; // Scale stats in Expert and Master diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index 5a301b94a5..61310b6b58 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -84,7 +84,7 @@ namespace CalamityMod.NPCs.Leviathan NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.scale *= 1.3f; if (Main.zenithWorld) @@ -313,7 +313,7 @@ namespace CalamityMod.NPCs.Leviathan hoverAcceleration += death ? 0.15f * (1f - lifeRatio) : 0.1f * (1f - lifeRatio); } - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { hoverSpeed *= 1.15f; hoverAcceleration *= 1.15f; @@ -413,7 +413,7 @@ namespace CalamityMod.NPCs.Leviathan if (Main.zenithWorld) { - type = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? ProjectileID.BouncyBoulder : ProjectileID.Boulder; + type = CalamityWorld.LegendaryMode ? ProjectileID.BouncyBoulder : ProjectileID.Boulder; leviCenter.Y -= 5; //Shoot a bit more up since boulders are affected by gravity damage *= 2; } @@ -452,7 +452,7 @@ namespace CalamityMod.NPCs.Leviathan NPC.ai[1] += activePlayerAmt / 2; bool spawnedAberration = false; - float aberrationSpawnDelay = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 20f : (!sirenAlive || phase4) ? 60f : 40f; + float aberrationSpawnDelay = CalamityWorld.LegendaryMode ? 20f : (!sirenAlive || phase4) ? 60f : 40f; if (NPC.ai[1] > aberrationSpawnDelay) { NPC.ai[1] = 0f; @@ -460,7 +460,7 @@ namespace CalamityMod.NPCs.Leviathan spawnedAberration = true; } - int spawnLimit = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 10 : (sirenAlive && !phase4) ? 1 : (death ? 2 : 3); + int spawnLimit = CalamityWorld.LegendaryMode ? 10 : (sirenAlive && !phase4) ? 1 : (death ? 2 : 3); if (spawnedAberration && NPC.CountNPCS(ModContent.NPCType()) < spawnLimit) { SoundEngine.PlaySound(soundChoice with { Pitch = soundChoice.Pitch + extrapitch }, npcCenter); @@ -575,7 +575,7 @@ namespace CalamityMod.NPCs.Leviathan if (revenge && (!sirenAlive || phase4)) lineupSpeed += death ? 9f * (1f - lifeRatio) : 6f * (1f - lifeRatio); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) lineupSpeed *= 1.15f; Vector2 leviChargeCenter = npcCenter; @@ -611,7 +611,7 @@ namespace CalamityMod.NPCs.Leviathan chargeAcceleration += death ? 0.15f * (1f - lifeRatio) : 0.1f * (1f - lifeRatio); } - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { chargeSpeed *= 1.15f; chargeAcceleration *= 1.15f; diff --git a/NPCs/Leviathan/LeviathanStart.cs b/NPCs/Leviathan/LeviathanStart.cs index 19205bd748..35ddf96f39 100644 --- a/NPCs/Leviathan/LeviathanStart.cs +++ b/NPCs/Leviathan/LeviathanStart.cs @@ -1,6 +1,7 @@ using System.IO; using CalamityMod.CalPlayer; using CalamityMod.Items.Accessories; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -58,7 +59,7 @@ namespace CalamityMod.NPCs.Leviathan NPC.Calamity().VulnerableToWater = false; NPC.Calamity().ProvidesProximityRage = false; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.scale *= 0.8f; } diff --git a/NPCs/NormalNPCs/ArmoredDiggerHead.cs b/NPCs/NormalNPCs/ArmoredDiggerHead.cs index 5f230ad2bb..c2ab126f4d 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerHead.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerHead.cs @@ -439,7 +439,7 @@ namespace CalamityMod.NPCs.NormalNPCs { if (!CalamityPlayer.areThereAnyDamnBosses && NPC.downedPlantBoss && !NPC.AnyNPCs(ModContent.NPCType())) { - float spawnRateDivisor = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 125f : CalamityWorld.revenge ? 425f : 500f; + float spawnRateDivisor = CalamityWorld.LegendaryMode ? 125f : CalamityWorld.revenge ? 425f : 500f; return 1 / spawnRateDivisor; } } diff --git a/NPCs/NormalNPCs/BloodlettingServant.cs b/NPCs/NormalNPCs/BloodlettingServant.cs index d2b172c462..21cbc7976d 100644 --- a/NPCs/NormalNPCs/BloodlettingServant.cs +++ b/NPCs/NormalNPCs/BloodlettingServant.cs @@ -38,7 +38,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 30; if (Main.tenthAnniversaryWorld) NPC.scale *= 0.5f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.scale *= 1.1f; NPC.defense = 5; @@ -81,7 +81,7 @@ namespace CalamityMod.NPCs.NormalNPCs bool charging = (attemptingToCharge && farEnoughForCharge && closeEnoughForCharge) || NPC.ai[1] > 0f; float projectileShootGateValue = CalamityWorld.death ? 180f : 270f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) projectileShootGateValue *= 0.5f; Vector2 lookAt = target.Center - NPC.Center; diff --git a/NPCs/NormalNPCs/Foveanator.cs b/NPCs/NormalNPCs/Foveanator.cs index 30d5b09bca..228c0e81b8 100644 --- a/NPCs/NormalNPCs/Foveanator.cs +++ b/NPCs/NormalNPCs/Foveanator.cs @@ -60,7 +60,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 100; if (Main.tenthAnniversaryWorld) NPC.scale *= 0.5f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.scale *= 0.8f; NPC.defense = 10; @@ -247,7 +247,7 @@ namespace CalamityMod.NPCs.NormalNPCs acceleration += phase1MaxAccelerationIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); } - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { maxVelocity *= 1.15f; acceleration *= 1.15f; @@ -302,7 +302,7 @@ namespace CalamityMod.NPCs.NormalNPCs if (!Main.player[NPC.target].dead) { NPC.ai[3] += 1f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.ai[3] += 0.5f; } @@ -346,7 +346,7 @@ namespace CalamityMod.NPCs.NormalNPCs chargeSpeed += 1f * enrageScale; if (death) chargeSpeed += phase1MaxChargeSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) chargeSpeed += 1f; NPC.velocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * chargeSpeed; @@ -380,7 +380,7 @@ namespace CalamityMod.NPCs.NormalNPCs maxVelocity += 6f * enrageScale; if (death) maxVelocity += (phase1MaxChargeSpeedIncrease * 6f) * ((1f - lifeRatio) / (1f - phase2LifeRatio)); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) maxVelocity += 6f; if (NPC.velocity.Length() < maxVelocity) @@ -576,7 +576,7 @@ namespace CalamityMod.NPCs.NormalNPCs if (distanceFromDestination > distanceFromTarget) maxVelocity += MathHelper.Lerp(0f, 12f, MathHelper.Clamp((distanceFromDestination - distanceFromTarget) / 1000f, 0f, 1f)); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { maxVelocity *= 1.15f; acceleration *= 1.15f; @@ -675,7 +675,7 @@ namespace CalamityMod.NPCs.NormalNPCs float chargeSpeed = 4.5f + (death ? 1.25f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); chargeSpeed += 4f * enrageScale; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) chargeSpeed *= 1.2f; NPC.velocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * chargeSpeed; @@ -714,7 +714,7 @@ namespace CalamityMod.NPCs.NormalNPCs maxVelocity += 6f * enrageScale; if (death) maxVelocity += 7.5f * ((1f - lifeRatio) / (1f - phase2LifeRatio)); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) maxVelocity *= 1.2f; // Spawn Energy Bombs along the way @@ -782,7 +782,7 @@ namespace CalamityMod.NPCs.NormalNPCs maxVelocity += 6f * enrageScale; acceleration += 0.08f * enrageScale; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { maxVelocity *= 1.15f; acceleration *= 1.15f; diff --git a/NPCs/NormalNPCs/PlanterasFreeTentacle.cs b/NPCs/NormalNPCs/PlanterasFreeTentacle.cs index d766fc1f04..bcb3f9070d 100644 --- a/NPCs/NormalNPCs/PlanterasFreeTentacle.cs +++ b/NPCs/NormalNPCs/PlanterasFreeTentacle.cs @@ -81,7 +81,7 @@ namespace CalamityMod.NPCs.NormalNPCs bool death = CalamityWorld.death || BossRushEvent.BossRushActive; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { if (Main.rand.NextBool(5)) NPC.reflectsProjectiles = true; @@ -135,7 +135,7 @@ namespace CalamityMod.NPCs.NormalNPCs Vector2 idealVelocity = NPC.SafeDirectionTo(Main.player[NPC.target].Center) * (death ? 7f : 5.5f); float acceleration = death ? 0.14f : 0.105f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { idealVelocity *= 1.2f; acceleration *= 1.4f; diff --git a/NPCs/NormalNPCs/ShockstormShuttle.cs b/NPCs/NormalNPCs/ShockstormShuttle.cs index c41c3b21dc..66e4382050 100644 --- a/NPCs/NormalNPCs/ShockstormShuttle.cs +++ b/NPCs/NormalNPCs/ShockstormShuttle.cs @@ -4,6 +4,7 @@ using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Placeables.Ores; +using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.Bestiary; @@ -89,8 +90,8 @@ namespace CalamityMod.NPCs.NormalNPCs npcPos.X += velocity.X; npcPos.Y += velocity.Y; - int spread = Main.getGoodWorld ? 100 : 20; - for (int i = 0; i < (Main.getGoodWorld ? 10 : 2); i++) + int spread = CalamityWorld.LegendaryMode ? 100 : 20; + for (int i = 0; i < (CalamityWorld.LegendaryMode ? 10 : 2); i++) { velocity = Main.player[NPC.target].Center - npcPos; targetDist = velocity.Length(); @@ -408,7 +409,7 @@ namespace CalamityMod.NPCs.NormalNPCs { return 0f; } - return SpawnCondition.Sky.Chance * (Main.getGoodWorld ? 0.5f : 0.1f); + return SpawnCondition.Sky.Chance * (CalamityWorld.LegendaryMode ? 0.5f : 0.1f); } public override void ModifyNPCLoot(NPCLoot npcLoot) diff --git a/NPCs/NormalNPCs/SkeletronPrime2.cs b/NPCs/NormalNPCs/SkeletronPrime2.cs index 76ea9c25c2..cd1fc136af 100644 --- a/NPCs/NormalNPCs/SkeletronPrime2.cs +++ b/NPCs/NormalNPCs/SkeletronPrime2.cs @@ -50,7 +50,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 102; if (Main.tenthAnniversaryWorld) NPC.scale *= 0.5f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.scale *= 1.1f; NPC.defense = 24; diff --git a/NPCs/OldDuke/SulphurousSharkron.cs b/NPCs/OldDuke/SulphurousSharkron.cs index e2b4fdfe64..b239e96ef1 100644 --- a/NPCs/OldDuke/SulphurousSharkron.cs +++ b/NPCs/OldDuke/SulphurousSharkron.cs @@ -212,7 +212,7 @@ namespace CalamityMod.NPCs.OldDuke if (Main.rand.NextBool(8) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - if (Main.netMode != NetmodeID.MultiplayerClient && Main.getGoodWorld) + if (Main.netMode != NetmodeID.MultiplayerClient && CalamityWorld.LegendaryMode) { int spawnX = NPC.width / 2; int type = ModContent.ProjectileType(); diff --git a/NPCs/Other/THELORDE.cs b/NPCs/Other/THELORDE.cs index 360e1a19fa..3262a9b565 100644 --- a/NPCs/Other/THELORDE.cs +++ b/NPCs/Other/THELORDE.cs @@ -584,8 +584,8 @@ namespace CalamityMod.NPCs.Other public override void ModifyNPCLoot(NPCLoot npcLoot) { double pisquaredover6 = Math.Pow(MathHelper.Pi, 2) / 6; - npcLoot.AddIf(() => CalamityWorld.LegendaryMode && CalamityWorld.revenge, ModContent.ItemType()); // guaranteed in legendarev mode - npcLoot.AddIf(() => !(CalamityWorld.LegendaryMode && CalamityWorld.revenge), ModContent.ItemType(), 27); // otherwise 1 in 27 + npcLoot.AddIf(() => CalamityWorld.LegendaryMode, ModContent.ItemType()); // guaranteed in legendarev mode + npcLoot.AddIf(() => !CalamityWorld.LegendaryMode, ModContent.ItemType(), 27); // otherwise 1 in 27 npcLoot.Add(ModContent.ItemType(), 1, 22, (int)(pisquaredover6 * 100)); } } diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index 144a0ed936..4b9461d401 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -252,12 +252,12 @@ namespace CalamityMod.NPCs.Perforator if (NPC.ai[3] == 0f && NPC.life > 0) NPC.ai[3] = NPC.lifeMax; - bool canSpawnWorms = !small || !medium || !large || Main.getGoodWorld; + bool canSpawnWorms = !small || !medium || !large || CalamityWorld.LegendaryMode; if (NPC.life > 0 && canSpawnWorms) { if (Main.netMode != NetmodeID.MultiplayerClient) { - int wormSpawnGateValue = (int)(NPC.lifeMax * (Main.getGoodWorld ? 0.15 : 0.25)); + int wormSpawnGateValue = (int)(NPC.lifeMax * (CalamityWorld.LegendaryMode ? 0.15 : 0.25)); if ((NPC.life + wormSpawnGateValue) < NPC.ai[3]) { NPC.ai[3] = NPC.life; @@ -277,7 +277,7 @@ namespace CalamityMod.NPCs.Perforator wormType = ModContent.NPCType(); } - if (Main.getGoodWorld && lifeRatio < 0.5f) + if (CalamityWorld.LegendaryMode && lifeRatio < 0.5f) { if (lifeRatio > 0.35f) NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X + Main.rand.Next(-25, 26), (int)NPC.Center.Y + Main.rand.Next(-25, 26), ModContent.NPCType(), 1); @@ -329,7 +329,7 @@ namespace CalamityMod.NPCs.Perforator // Emit ichor blobs if (phase2) { - if (wormsAlive == 0 || large || bossRush || floatAboveToFireBlobs || (CalamityWorld.LegendaryMode && CalamityWorld.revenge)) + if (wormsAlive == 0 || large || bossRush || floatAboveToFireBlobs || CalamityWorld.LegendaryMode) { NPC.ai[2] += 1f; if (NPC.ai[2] >= blobPhaseGateValue) @@ -360,7 +360,7 @@ namespace CalamityMod.NPCs.Perforator bool ichorBlobBigWormPhase = wormsAlive > 0 && large; int numBlobs = expertMode ? (ichorBlobBigWormPhase ? 4 : 6) : (ichorBlobBigWormPhase ? 2 : 4); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) numBlobs *= 2; int type = ModContent.ProjectileType(); @@ -373,7 +373,7 @@ namespace CalamityMod.NPCs.Perforator blobVelocity.Normalize(); blobVelocity *= Main.rand.Next(400, 801) * (bossRush ? 0.02f : 0.01f); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) blobVelocity *= Main.rand.NextFloat() + 1f; float blobVelocityYAdd = Math.Abs(blobVelocity.Y) * 0.25f; @@ -480,7 +480,7 @@ namespace CalamityMod.NPCs.Perforator int numProj = death ? 16 : revenge ? 14 : expertMode ? 12 : 10; if (phase3) numProj = death ? 12 : revenge ? 10 : expertMode ? 8 : 6; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) numProj *= 2; int spread = 75; diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index 79c8333645..ae0563d785 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -176,7 +176,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath float challengeAmt = (1f - lifeRatio) * 100f; float nukeBarrageChallengeAmt = (0.5f - lifeRatio) * 200f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { challengeAmt *= 1.5f; nukeBarrageChallengeAmt *= 1.5f; @@ -209,7 +209,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Missile countdown if (halfLife && MissileCountdown == 0) - MissileCountdown = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 300 : 600; + MissileCountdown = CalamityWorld.LegendaryMode ? 300 : 600; if (MissileCountdown > 1) MissileCountdown--; @@ -250,7 +250,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (enrageScale > 1.5f) enrageScale = 1.5f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) enrageScale += 0.5f; if (bossRush) @@ -545,7 +545,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.velocity *= 1.01f; // Spawn honey in legendary rev+ - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge && calamityGlobalNPC.newAI[0] % 6f == 0f) + if (CalamityWorld.LegendaryMode && calamityGlobalNPC.newAI[0] % 6f == 0f) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -803,7 +803,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.direction = playerLocation < 0 ? 1 : -1; NPC.spriteDirection = NPC.direction; - if (NPC.ai[2] > ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 3f : 5f)) + if (NPC.ai[2] > (CalamityWorld.LegendaryMode ? 3f : 5f)) { NPC.ai[0] = -1f; NPC.ai[1] = 2f; diff --git a/NPCs/Polterghast/PhantomFuckYou.cs b/NPCs/Polterghast/PhantomFuckYou.cs index 5e0b097a77..7a829ce8d6 100644 --- a/NPCs/Polterghast/PhantomFuckYou.cs +++ b/NPCs/Polterghast/PhantomFuckYou.cs @@ -80,7 +80,7 @@ namespace CalamityMod.NPCs.Polterghast } float chargePhaseGateValue = 480f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) chargePhaseGateValue *= 0.5f; bool chargePhase = Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] >= chargePhaseGateValue - 60f; @@ -98,11 +98,11 @@ namespace CalamityMod.NPCs.Polterghast direction *= 0.5f; NPC.rotation = direction.ToRotation(); - if (!chargePhase || (CalamityWorld.LegendaryMode && CalamityWorld.revenge)) + if (!chargePhase || CalamityWorld.LegendaryMode) { NPC.ai[2] += 1f; float shootMineGateValue = 150f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) shootMineGateValue *= 0.5f; if (NPC.ai[2] >= shootMineGateValue) @@ -130,7 +130,7 @@ namespace CalamityMod.NPCs.Polterghast if (SPEEN < 0f) SPEEN = 0f; - NPC.ai[1] += (Main.getGoodWorld ? 1.5f : 0.5f) + SPEEN; + NPC.ai[1] += (CalamityWorld.LegendaryMode ? 1.5f : 0.5f) + SPEEN; } public override Color? GetAlpha(Color drawColor) => new Color(200, 200, 200, 0); diff --git a/NPCs/Polterghast/PolterPhantom.cs b/NPCs/Polterghast/PolterPhantom.cs index d5de2b05cd..c388f8f5fd 100644 --- a/NPCs/Polterghast/PolterPhantom.cs +++ b/NPCs/Polterghast/PolterPhantom.cs @@ -44,7 +44,7 @@ namespace CalamityMod.NPCs.Polterghast NPC.defense = 45; NPC.DR_NERD(0.1f); NPC.LifeMaxNERB(62500, 75000, 60000); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) NPC.lifeMax *= 4; NPC.knockBackResist = 0f; @@ -121,7 +121,7 @@ namespace CalamityMod.NPCs.Polterghast Vector2 vector = NPC.Center; float chargePhaseGateValue = 480f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) chargePhaseGateValue *= 0.5f; float colorChangeTime = 180f; @@ -440,7 +440,7 @@ namespace CalamityMod.NPCs.Polterghast spriteEffects = SpriteEffects.FlipHorizontally; float chargePhaseGateValue = 480f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) chargePhaseGateValue *= 0.5f; float timeToReachFullColor = 120f; diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index 34c64b4665..5bd7df5b36 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -222,7 +222,7 @@ namespace CalamityMod.NPCs.Polterghast // Velocity and acceleration calamityGlobalNPC.newAI[0] += 1f; float chargePhaseGateValue = 480f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) chargePhaseGateValue *= 0.5f; bool chargePhase = calamityGlobalNPC.newAI[0] >= chargePhaseGateValue; @@ -1120,7 +1120,7 @@ namespace CalamityMod.NPCs.Polterghast } float chargePhaseGateValue = 480f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) chargePhaseGateValue *= 0.5f; float timeToReachFullColor = 120f; diff --git a/NPCs/Polterghast/PolterghastHook.cs b/NPCs/Polterghast/PolterghastHook.cs index a31142c7f1..2afb116640 100644 --- a/NPCs/Polterghast/PolterghastHook.cs +++ b/NPCs/Polterghast/PolterghastHook.cs @@ -94,7 +94,7 @@ namespace CalamityMod.NPCs.Polterghast } float chargePhaseGateValue = 480f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) chargePhaseGateValue *= 0.5f; bool chargePhase = Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] >= chargePhaseGateValue - 60f; @@ -150,7 +150,7 @@ namespace CalamityMod.NPCs.Polterghast NPC.ai[2] += 1f; if (NPC.ai[3] == 0f) { - if (NPC.ai[2] > ((CalamityWorld.LegendaryMode && revenge) ? 12f : 120f)) + if (NPC.ai[2] > ((CalamityWorld.LegendaryMode) ? 12f : 120f)) { NPC.ai[2] = 0f; NPC.ai[3] = 1f; @@ -183,7 +183,7 @@ namespace CalamityMod.NPCs.Polterghast private void Movement(bool phase2, bool expertMode, bool revenge, bool death, bool speedBoost, bool despawnBoost, float lifeRatio, float tileEnrageMult, Player player) { float chargePhaseGateValue = 480f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) chargePhaseGateValue *= 0.5f; float colorChangeTime = 180f; @@ -325,7 +325,7 @@ namespace CalamityMod.NPCs.Polterghast Color lightRed = new Color(255, 100, 100, 255); float chargePhaseGateValue = 480f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) chargePhaseGateValue *= 0.5f; float timeToReachFullColor = 120f; diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs b/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs index 81ecc448d3..43b7bc4470 100644 --- a/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs +++ b/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs @@ -329,7 +329,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm float ancientDoomGateValue = death ? 95f : revenge ? 100f : expertMode ? 105f : 120f; float lightningChargePhaseGateValue = death ? 120f : revenge ? 135f : expertMode ? 150f : 180f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { lightningRainDuration *= 0.5f; eidolonWyrmPhaseDuration *= 0.25f; @@ -448,7 +448,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm // Velocity and turn speed values float velocityScale = death ? 1.8f : revenge ? 1.5f : expertMode ? 1.2f : 0f; float baseVelocity = (targetDownDeep ? 10f : 15f) + (targetDownDeep ? velocityScale : velocityScale * 1.5f); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) baseVelocity *= 1.15f; float turnSpeed = baseVelocity * 0.015f; diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs index 4afdca7d56..67639e3cc1 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs @@ -368,9 +368,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Charge variables float chargeVelocityMult = 0.25f; float maxChargeVelocity = bossRush ? 32f : death ? 28f : revenge ? 26f : expertMode ? 24f : 20f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) maxChargeVelocity *= 1.15f; - if (CalamityWorld.LegendaryMode && revenge) + if (CalamityWorld.LegendaryMode) maxChargeVelocity *= 2f; float inertia = bossRush ? 40f : death ? 45f : revenge ? 47f : expertMode ? 50f : 55f; @@ -378,7 +378,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians inertia *= 0.8f; if (!phase1) inertia *= 0.75f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) inertia *= 0.8f; bool speedUp = Vector2.Distance(NPC.Center, player.Center) > 960f; @@ -457,7 +457,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians calamityGlobalNPC.newAI[0] = -NPC.direction; float velocity = bossRush ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) velocity *= 1.25f; if (healerAlive) velocity *= 0.8f; @@ -792,7 +792,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians bool targetRanAwayAndWillNowBeFucked = NPC.ai[2] == 1f; bool boostVelocityToCatchUp = NPC.ai[1] == 0f || targetRanAwayAndWillNowBeFucked; float velocity = bossRush ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) velocity *= 1.25f; if (boostVelocityToCatchUp) velocity *= 2f; @@ -849,7 +849,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians else if (NPC.ai[1] % spearShootDivisor == 0f) { float spearVelocity = bossRush ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) spearVelocity *= 1.25f; if (boostVelocityToCatchUp) spearVelocity *= 1.5f; @@ -906,7 +906,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians float velocity = bossRush ? 4.5f : death ? 4f : revenge ? 3.75f : expertMode ? 3.5f : 3f; if (NPC.ai[1] < laserGateValue) velocity *= 6f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) velocity *= 1.25f; calamityGlobalNPC.newAI[0] = -NPC.direction; @@ -924,7 +924,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Limit Y velocity while firing laser if (NPC.ai[1] >= laserGateValue) { - float speedCap = Main.getGoodWorld ? 4f : 2f; + float speedCap = CalamityWorld.LegendaryMode ? 4f : 2f; if (NPC.velocity.Y > speedCap) NPC.velocity.Y = speedCap; if (NPC.velocity.Y < -speedCap) @@ -984,7 +984,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (revenge) Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, -laserVelocity, type, damage, 0f, Main.myPlayer, -beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI); - if (CalamityWorld.LegendaryMode && revenge) + if (CalamityWorld.LegendaryMode) { rotation *= 0.33f; laserVelocity = laserVelocity.RotatedBy(-(double)beamDirection * MathHelper.TwoPi / 2f); diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs index 8c0774d5d3..53af9efb83 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs @@ -262,7 +262,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Charge variables float chargeVelocityMult = 0.25f; float maxChargeVelocity = bossRush ? 25f : death ? 22f : revenge ? 20.5f : expertMode ? 19f : 16f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) maxChargeVelocity *= 1.15f; // Whether the commander is calling all guardians together for the laser attack @@ -382,7 +382,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians } float moveVelocity = bossRush ? 24f : death ? 22f : revenge ? 21f : expertMode ? 20f : 18f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) moveVelocity *= 1.25f; if (healerAlive) moveVelocity *= 0.8f; @@ -457,7 +457,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (distanceFromDestination.Length() > 40f) { float inertia = (commanderUsingLaser || commanderGoingLowOrHighInPhase1) ? 10f : 15f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) inertia *= 0.8f; NPC.velocity = (NPC.velocity * (inertia - 1) + desiredVelocity) / inertia; @@ -489,7 +489,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (NPC.ai[1] >= -throwRocksGateValue) { NPC.velocity *= 0.8f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.velocity *= 0.5f; } @@ -555,7 +555,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (distanceFromDestination.Length() > 40f) { float inertia = commanderGoingLowOrHighInPhase2 ? 8f : 15f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) inertia *= 0.8f; NPC.velocity = (NPC.velocity * (inertia - 1) + desiredVelocity) / inertia; diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs b/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs index 5a23446c69..a2fdabec4d 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs @@ -217,7 +217,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians bool useCrystalShards = AIState == (float)Phase.CrystalShards; float velocity = useCrystalShards ? (bossRush ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f) : (Main.npc[CalamityGlobalNPC.doughnutBoss].velocity.Length() + 5f); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) velocity *= 1.25f; float idealDistanceFromDestination = useCrystalShards ? 80f : 160f; @@ -251,7 +251,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (distanceFromDestination.Length() > 40f) { float inertia = 10f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) inertia *= 0.8f; NPC.velocity = (NPC.velocity * (inertia - 1) + desiredVelocity) / inertia; @@ -407,7 +407,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians float inertia = bossRush ? 28f : death ? 32f : revenge ? 34f : expertMode ? 36f : 40f; if (lifeRatio < 0.5f) inertia *= 0.8f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) inertia *= 0.8f; NPC.velocity = (NPC.velocity * (inertia - 1) + desiredVelocity) / inertia; diff --git a/NPCs/ProfanedGuardians/ProfanedRocks.cs b/NPCs/ProfanedGuardians/ProfanedRocks.cs index 64ea8d4e8b..379bf88d68 100644 --- a/NPCs/ProfanedGuardians/ProfanedRocks.cs +++ b/NPCs/ProfanedGuardians/ProfanedRocks.cs @@ -209,7 +209,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Start off slow Vector2 finalVelocity = NPC.SafeDirectionTo(player.Center, -Vector2.UnitY) * chargeSpeed; - if (CalamityWorld.LegendaryMode && revenge) + if (CalamityWorld.LegendaryMode) finalVelocity *= Main.rand.NextFloat(1f, 1.7f); NPC.Calamity().newAI[2] = finalVelocity.X; diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 7a97449c25..617ab71868 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -261,7 +261,7 @@ namespace CalamityMod.NPCs.Providence NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.scale *= 0.25f; // Scale HP in Master @@ -884,7 +884,7 @@ namespace CalamityMod.NPCs.Providence acceleration = 2f; } - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { velocity *= 1.2f; acceleration *= 1.2f; @@ -900,12 +900,12 @@ namespace CalamityMod.NPCs.Providence float moveUpThreshold = player.position.Y - (NPC.position.Y + NPC.height); if (moveUpThreshold < (laserPhaseSlow ? 150f : 200f)) // 150 - NPC.velocity.Y -= Main.getGoodWorld ? 0.4f : 0.2f; + NPC.velocity.Y -= CalamityWorld.LegendaryMode ? 0.4f : 0.2f; if (moveUpThreshold > (laserPhaseSlow ? 200f : 250f)) // 200 - NPC.velocity.Y += Main.getGoodWorld ? 0.4f : 0.2f; + NPC.velocity.Y += CalamityWorld.LegendaryMode ? 0.4f : 0.2f; float speedCap = laserPhaseSlow ? 2f : 6f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) speedCap *= 1.5f; if (NPC.velocity.Y > speedCap) @@ -1567,7 +1567,7 @@ namespace CalamityMod.NPCs.Providence { Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, vector2, projectileType, holySpearDamage, 0f, Main.myPlayer); - if (CalamityWorld.LegendaryMode && revenge) + if (CalamityWorld.LegendaryMode) Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, -vector2, projectileType, holySpearDamage, 0f, Main.myPlayer); } } @@ -1594,7 +1594,7 @@ namespace CalamityMod.NPCs.Providence { Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, velocity2, projectileType, holySpearDamage, 0f, Main.myPlayer, 1f, 0f); - if (CalamityWorld.LegendaryMode && revenge) + if (CalamityWorld.LegendaryMode) Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, -velocity2, projectileType, holySpearDamage, 0f, Main.myPlayer, 1f, 0f); } } diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index 1003555aee..a71e1c3a6f 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -497,7 +497,7 @@ namespace CalamityMod.NPCs.Ravager NPC.ai[1] += 1f; } - float jumpGateValue = Main.getGoodWorld ? 0f : 180f; + float jumpGateValue = CalamityWorld.LegendaryMode ? 0f : 180f; if (NPC.ai[1] >= jumpGateValue) { NPC.ai[1] = -20f; @@ -594,7 +594,7 @@ namespace CalamityMod.NPCs.Ravager bool anyRockPillars = NPC.AnyNPCs(ModContent.NPCType()); bool anyFlamePillars = NPC.AnyNPCs(ModContent.NPCType()); - if (CalamityWorld.LegendaryMode && revenge) + if (CalamityWorld.LegendaryMode) { if (!expertMode || anyRockPillars || anyFlamePillars) SoundEngine.PlaySound(PillarSound, NPC.Center); @@ -636,12 +636,12 @@ namespace CalamityMod.NPCs.Ravager { SoundEngine.PlaySound(PillarSound, NPC.Center); } - if (!anyRockPillars || Main.getGoodWorld) + if (!anyRockPillars || CalamityWorld.LegendaryMode) { NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.Center.X - spawnDistance * 1.25f), (int)player.Center.Y - 100, ModContent.NPCType()); NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.Center.X + spawnDistance * 1.25f), (int)player.Center.Y - 100, ModContent.NPCType()); } - else if (!anyFlamePillars || Main.getGoodWorld) + else if (!anyFlamePillars || CalamityWorld.LegendaryMode) { float distanceMultiplier = finalPhase ? 2.5f : 2f; NPC.NewNPC(NPC.GetSource_FromAI(), (int)player.Center.X - (int)(spawnDistance * distanceMultiplier), (int)player.Center.Y - 100, ModContent.NPCType()); diff --git a/NPCs/Signus/Signus.cs b/NPCs/Signus/Signus.cs index eb3761f198..e087815b33 100644 --- a/NPCs/Signus/Signus.cs +++ b/NPCs/Signus/Signus.cs @@ -138,12 +138,12 @@ namespace CalamityMod.NPCs.Signus double lifeRatio = NPC.life / (double)NPC.lifeMax; - lifeToAlpha = (int)((Main.getGoodWorld ? 200D : 100D) * (1D - lifeRatio)); + lifeToAlpha = (int)((CalamityWorld.LegendaryMode ? 200D : 100D) * (1D - lifeRatio)); int maxCharges = death ? 1 : revenge ? 2 : expertMode ? 3 : 4; int maxTeleports = (death && lifeRatio < 0.9) ? 1 : revenge ? 2 : expertMode ? 3 : 4; float inertia = bossRush ? 9f : death ? 10f : revenge ? 11f : expertMode ? 12f : 14f; float chargeVelocity = bossRush ? 16f : death ? 14f : revenge ? 13f : expertMode ? 12f : 10f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { inertia *= 0.5f; chargeVelocity *= 1.15f; @@ -197,7 +197,7 @@ namespace CalamityMod.NPCs.Signus else if (NPC.timeLeft < 1800) NPC.timeLeft = 1800; - if (lifeToAlpha < (Main.getGoodWorld ? 100 : 50) && NPC.ai[0] != 1f) + if (lifeToAlpha < (CalamityWorld.LegendaryMode ? 100 : 50) && NPC.ai[0] != 1f) { for (int i = 0; i < 2; i++) { @@ -263,7 +263,7 @@ namespace CalamityMod.NPCs.Signus playerYDist *= playerDistance; float inertia2 = 50f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) inertia2 *= 0.5f; NPC.velocity.X = (NPC.velocity.X * inertia2 + playerXDist) / (inertia2 + 1f); @@ -298,7 +298,7 @@ namespace CalamityMod.NPCs.Signus if (expertMode) NPC.localAI[1] += death ? 3f * (float)(1D - lifeRatio) : 2f * (float)(1D - lifeRatio); - if (NPC.localAI[1] >= (Main.getGoodWorld ? 0f : 120f)) + if (NPC.localAI[1] >= (CalamityWorld.LegendaryMode ? 0f : 120f)) { NPC.localAI[1] = 0f; @@ -573,7 +573,7 @@ namespace CalamityMod.NPCs.Signus { if (Main.netMode != NetmodeID.MultiplayerClient) { - int totalLamps = (Main.getGoodWorld && !Main.zenithWorld) ? 10 : 5; + int totalLamps = (CalamityWorld.LegendaryMode && !Main.zenithWorld) ? 10 : 5; if (NPC.CountNPCS(ModContent.NPCType()) < totalLamps) { bool buffed = false; @@ -712,10 +712,10 @@ namespace CalamityMod.NPCs.Signus if ((phase2 || buffed) && NPC.ai[2] % 3f == 0f) { SoundEngine.PlaySound(SoundID.Item73, NPC.Center); - int type = (CalamityWorld.LegendaryMode && revenge) ? ModContent.ProjectileType() : ModContent.ProjectileType(); - int damage = (CalamityWorld.LegendaryMode && revenge) ? 60 : NPC.GetProjectileDamage(type); + int type = (CalamityWorld.LegendaryMode) ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int damage = (CalamityWorld.LegendaryMode) ? 60 : NPC.GetProjectileDamage(type); Vector2 velocity = Main.zenithWorld ? new Vector2(Main.rand.Next(-10, 11), Main.rand.Next(-10, 11)) : Vector2.Zero; - if (Main.getGoodWorld && !Main.zenithWorld) + if (CalamityWorld.LegendaryMode && !Main.zenithWorld) { velocity = new Vector2(Main.rand.Next(-5, 6), Main.rand.Next(-5, 6)); } diff --git a/NPCs/SlimeGod/CorruptSlimeSpawn.cs b/NPCs/SlimeGod/CorruptSlimeSpawn.cs index 9d19bc6ba6..474c9f9480 100644 --- a/NPCs/SlimeGod/CorruptSlimeSpawn.cs +++ b/NPCs/SlimeGod/CorruptSlimeSpawn.cs @@ -26,11 +26,11 @@ namespace CalamityMod.NPCs.SlimeGod NPC.GetNPCDamage(); NPC.width = 40; NPC.height = 30; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) NPC.scale = 2f; NPC.defense = 6; - NPC.lifeMax = BossRushEvent.BossRushActive ? 10000 : (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 360 : 180; + NPC.lifeMax = BossRushEvent.BossRushActive ? 10000 : CalamityWorld.LegendaryMode ? 360 : 180; NPC.knockBackResist = 0.7f; AnimationType = NPCID.Slimer; NPC.lavaImmune = false; diff --git a/NPCs/SlimeGod/CorruptSlimeSpawn2.cs b/NPCs/SlimeGod/CorruptSlimeSpawn2.cs index e8df94c69d..b22feaf472 100644 --- a/NPCs/SlimeGod/CorruptSlimeSpawn2.cs +++ b/NPCs/SlimeGod/CorruptSlimeSpawn2.cs @@ -26,11 +26,11 @@ namespace CalamityMod.NPCs.SlimeGod NPC.GetNPCDamage(); NPC.width = 40; NPC.height = 30; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) NPC.scale = 2f; NPC.defense = 4; - NPC.lifeMax = BossRushEvent.BossRushActive ? 5000 : (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 180 : 90; + NPC.lifeMax = BossRushEvent.BossRushActive ? 5000 : CalamityWorld.LegendaryMode ? 180 : 90; NPC.knockBackResist = 0.9f; AnimationType = NPCID.CorruptSlime; NPC.lavaImmune = false; diff --git a/NPCs/SlimeGod/CrimsonSlimeSpawn.cs b/NPCs/SlimeGod/CrimsonSlimeSpawn.cs index 4cb9744c71..3c21567a51 100644 --- a/NPCs/SlimeGod/CrimsonSlimeSpawn.cs +++ b/NPCs/SlimeGod/CrimsonSlimeSpawn.cs @@ -25,11 +25,11 @@ namespace CalamityMod.NPCs.SlimeGod NPC.GetNPCDamage(); NPC.width = 40; NPC.height = 30; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) NPC.scale = 2f; NPC.defense = 4; - NPC.lifeMax = BossRushEvent.BossRushActive ? 10000 : (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 220 : 110; + NPC.lifeMax = BossRushEvent.BossRushActive ? 10000 : CalamityWorld.LegendaryMode ? 220 : 110; NPC.knockBackResist = 0.8f; AnimationType = NPCID.CorruptSlime; NPC.lavaImmune = false; diff --git a/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs b/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs index 9f321b1817..3223c1ea4a 100644 --- a/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs +++ b/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs @@ -32,11 +32,11 @@ namespace CalamityMod.NPCs.SlimeGod NPC.GetNPCDamage(); NPC.width = 40; NPC.height = 30; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) NPC.scale = 2f; NPC.defense = 6; - NPC.lifeMax = BossRushEvent.BossRushActive ? 12000 : (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 260 : 130; + NPC.lifeMax = BossRushEvent.BossRushActive ? 12000 : CalamityWorld.LegendaryMode ? 260 : 130; NPC.knockBackResist = 0.7f; NPC.lavaImmune = false; NPC.noGravity = false; diff --git a/NPCs/SlimeGod/CrimulanPaladin.cs b/NPCs/SlimeGod/CrimulanPaladin.cs index 07b540a747..6909ef9f42 100644 --- a/NPCs/SlimeGod/CrimulanPaladin.cs +++ b/NPCs/SlimeGod/CrimulanPaladin.cs @@ -112,7 +112,7 @@ namespace CalamityMod.NPCs.SlimeGod addedStretch = -landingRecoil; // Used for teleporting - float scale = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.6f : Main.getGoodWorld ? 0.8f : 1f; + float scale = CalamityWorld.LegendaryMode ? 0.6f : CalamityWorld.LegendaryMode ? 0.8f : 1f; // How fast the slime slams down float slamVelocity = bossRush ? 20f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; @@ -155,7 +155,7 @@ namespace CalamityMod.NPCs.SlimeGod if (lifeRatio <= 0.5f && Main.netMode != NetmodeID.MultiplayerClient && expertMode) { // Spread of random globs in meme mode - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) { int type = ModContent.ProjectileType(); for (int i = 0; i < 30; i++) diff --git a/NPCs/SlimeGod/EbonianPaladin.cs b/NPCs/SlimeGod/EbonianPaladin.cs index c366736034..6cd7be29a6 100644 --- a/NPCs/SlimeGod/EbonianPaladin.cs +++ b/NPCs/SlimeGod/EbonianPaladin.cs @@ -101,7 +101,7 @@ namespace CalamityMod.NPCs.SlimeGod setDamage += 22; } - float scale = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.6f : Main.getGoodWorld ? 0.8f : 1f; + float scale = CalamityWorld.LegendaryMode ? 0.6f : CalamityWorld.LegendaryMode ? 0.8f : 1f; NPC.aiAction = 0; // Get a target @@ -131,7 +131,7 @@ namespace CalamityMod.NPCs.SlimeGod if (lifeRatio <= 0.5f && Main.netMode != NetmodeID.MultiplayerClient && expertMode) { - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) { int type = ModContent.ProjectileType(); for (int i = 0; i < 30; i++) @@ -319,7 +319,7 @@ namespace CalamityMod.NPCs.SlimeGod { if (Main.netMode != NetmodeID.MultiplayerClient) { - int numProjectiles = Main.getGoodWorld ? 12 : death ? 6 : 4; + int numProjectiles = CalamityWorld.LegendaryMode ? 12 : death ? 6 : 4; float projectileVelocity = death ? 8f : 6f; int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); @@ -499,15 +499,15 @@ namespace CalamityMod.NPCs.SlimeGod // Charge variables float chargeVelocityMult = 0.1f; float maxChargeVelocity = (bossRush || enraged) ? 12f : death ? 10f : revenge ? 9f : expertMode ? 8f : 6f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) maxChargeVelocity *= 1.15f; - if (CalamityWorld.LegendaryMode && revenge) + if (CalamityWorld.LegendaryMode) maxChargeVelocity *= 2f; float inertia = (bossRush || enraged) ? 100f : death ? 110f : revenge ? 114f : expertMode ? 120f : 130f; if (lifeRatio < 0.75f) inertia *= 0.8f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) inertia *= 0.8f; // Start charge diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index b6fe65cfe7..42f3e8c2fa 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -101,7 +101,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.npcSlots = 10f; NPC.width = 96; NPC.height = 98; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) NPC.scale = 2f; NPC.defense = 6; @@ -548,7 +548,7 @@ namespace CalamityMod.NPCs.SlimeGod flySpeed *= 1.1f; if (bossRush) flySpeed *= 1.2f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) flySpeed *= 1.3f; Vector2 flyDestination = aggressionLevel >= (int)AggressionLevel.ChargeAtPlayer ? player.Center : player.Center - Vector2.UnitY * 320f; @@ -590,9 +590,9 @@ namespace CalamityMod.NPCs.SlimeGod float maxInertiaDistance = 600f; float totalInertiaAdjustmentDistance = maxInertiaDistance - minInertiaDistance; float distanceFromInertiaAdjustmentCutoff = distanceFromFlyDestination - minInertiaDistance; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) maxInertia *= 0.8f; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) maxInertia *= Main.rand.NextFloat(0.2f, 1f); float inertia = distanceFromFlyDestination >= maxInertiaDistance ? maxInertia : diff --git a/NPCs/SlimeGod/SplitCrimulanPaladin.cs b/NPCs/SlimeGod/SplitCrimulanPaladin.cs index dfd3f73e7d..b588ad49fd 100644 --- a/NPCs/SlimeGod/SplitCrimulanPaladin.cs +++ b/NPCs/SlimeGod/SplitCrimulanPaladin.cs @@ -127,7 +127,7 @@ namespace CalamityMod.NPCs.SlimeGod addedStretch = -landingRecoil; // Used for teleporting - float scale = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.6f : Main.getGoodWorld ? 0.8f : 1f; + float scale = CalamityWorld.LegendaryMode ? 0.6f : CalamityWorld.LegendaryMode ? 0.8f : 1f; // How fast the slime slams down float slamVelocity = bossRush ? 22.25f : death ? 18.25f : revenge ? 16.5f : expertMode ? 15.5f : 13.5f; diff --git a/NPCs/SlimeGod/SplitEbonianPaladin.cs b/NPCs/SlimeGod/SplitEbonianPaladin.cs index bbbd3c5e50..16c55de137 100644 --- a/NPCs/SlimeGod/SplitEbonianPaladin.cs +++ b/NPCs/SlimeGod/SplitEbonianPaladin.cs @@ -123,7 +123,7 @@ namespace CalamityMod.NPCs.SlimeGod addedStretch = -landingRecoil; - float scale = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.6f : Main.getGoodWorld ? 0.8f : 1f; + float scale = CalamityWorld.LegendaryMode ? 0.6f : CalamityWorld.LegendaryMode ? 0.8f : 1f; // How fast the slime slams down float slamVelocity = bossRush ? 20f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; diff --git a/NPCs/StormWeaver/StormWeaverBody.cs b/NPCs/StormWeaver/StormWeaverBody.cs index 0519194931..4e7b558647 100644 --- a/NPCs/StormWeaver/StormWeaverBody.cs +++ b/NPCs/StormWeaver/StormWeaverBody.cs @@ -69,7 +69,7 @@ namespace CalamityMod.NPCs.StormWeaver else if (Main.expertMode) NPC.scale *= 1.1f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.scale *= 0.7f; NPC.Calamity().VulnerableToElectricity = false; diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index e2488b3a43..57ac9cf977 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -121,7 +121,7 @@ namespace CalamityMod.NPCs.StormWeaver else if (Main.expertMode) NPC.scale *= 1.1f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.scale *= 0.7f; NPC.Calamity().VulnerableToElectricity = false; @@ -193,7 +193,7 @@ namespace CalamityMod.NPCs.StormWeaver bool phase4 = lifeRatio < 0.3f; // Update armored settings to naked settings - if (phase2 && (!CalamityWorld.LegendaryMode || !revenge)) + if (phase2 && !CalamityWorld.LegendaryMode) { // Spawn armor gore, roar and set other crucial variables if (!NPC.chaseable) @@ -280,7 +280,7 @@ namespace CalamityMod.NPCs.StormWeaver } // Used for body and tail projectile firing timings in phase 1 - if (!phase2 || (CalamityWorld.LegendaryMode && revenge)) + if (!phase2 || CalamityWorld.LegendaryMode) NPC.localAI[0] += 1f; } @@ -621,7 +621,7 @@ namespace CalamityMod.NPCs.StormWeaver } } - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { velocity *= 1.4f; acceleration *= 1.4f; @@ -847,7 +847,7 @@ namespace CalamityMod.NPCs.StormWeaver float lifeRatio = NPC.life / (float)NPC.lifeMax; - bool phase2 = lifeRatio < 0.8f && (!CalamityWorld.LegendaryMode || !revenge); + bool phase2 = lifeRatio < 0.8f && !CalamityWorld.LegendaryMode; bool phase3 = lifeRatio < 0.55f; // Gate value that decides when Storm Weaver will charge diff --git a/NPCs/StormWeaver/StormWeaverTail.cs b/NPCs/StormWeaver/StormWeaverTail.cs index 4fb551873c..5d16fee8aa 100644 --- a/NPCs/StormWeaver/StormWeaverTail.cs +++ b/NPCs/StormWeaver/StormWeaverTail.cs @@ -68,7 +68,7 @@ namespace CalamityMod.NPCs.StormWeaver else if (Main.expertMode) NPC.scale *= 1.1f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.scale *= 0.7f; NPC.Calamity().VulnerableToElectricity = false; diff --git a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs index ce3a029a3b..37ab41f7fa 100644 --- a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs +++ b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs @@ -210,7 +210,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas GeneralParticleHandler.SpawnParticle(spark2); } - float distanceFromSCal = Main.getGoodWorld ? 300f : 225f; + float distanceFromSCal = CalamityWorld.LegendaryMode ? 300f : 225f; NPC.position = SCal.Center - MathHelper.ToRadians(RotationalDegreeOffset).ToRotationVector2() * distanceFromSCal - NPC.Size * 0.5f; NPC.velocity = Vector2.Zero; RotationalDegreeOffset += 0.5f; diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 667b952204..bf55046af4 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -454,7 +454,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas bool teleport = false; // permafrost and zenith scal are mutually exclusive unless it's legendary - bool zenithAI = Main.zenithWorld && (!permafrost || (CalamityWorld.LegendaryMode && revenge && permafrost)); + bool zenithAI = Main.zenithWorld && (!permafrost || (CalamityWorld.LegendaryMode && permafrost)); // Percent life remaining float lifeRatio = NPC.life / (float)NPC.lifeMax; @@ -489,7 +489,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas int bodyHeight = 42; int baseBulletHellProjectileGateValue = revenge ? 8 : expertMode ? 9 : 10; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) baseBulletHellProjectileGateValue -= 2; Vector2 vectorCenter = NPC.Center; @@ -1970,9 +1970,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas else { SoundEngine.PlaySound(SoundID.Item74, NPC.Center); - int totalSeekers = Main.getGoodWorld ? 20 : 10; + int totalSeekers = CalamityWorld.LegendaryMode ? 20 : 10; int degreesBetweenEachSeeker = 360 / totalSeekers; - int distanceFromSCal = Main.getGoodWorld ? 300 : 225; + int distanceFromSCal = CalamityWorld.LegendaryMode ? 300 : 225; for (int i = 0; i < totalSeekers; i++) { int FireEye = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(vectorCenter.X + (Math.Sin(i * degreesBetweenEachSeeker) * distanceFromSCal)), (int)(vectorCenter.Y + (Math.Cos(i * degreesBetweenEachSeeker) * distanceFromSCal)), ModContent.NPCType(), NPC.whoAmI, 0, 0, 0, -1); @@ -2182,7 +2182,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas float velocity = 12f; float acceleration = 0.12f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { velocity *= 1.15f; acceleration *= 1.15f; @@ -2296,7 +2296,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas float chargeVelocity = (wormAlive ? 26f : 30f) + (1f - lifeRatio) * 8f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) chargeVelocity *= 1.15f; if (!canDespawn) @@ -2398,7 +2398,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas float velocity = 32f; float acceleration = 1.2f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { velocity *= 1.15f; acceleration *= 1.15f; @@ -2477,7 +2477,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas float velocity = 32f; float acceleration = 1.2f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { velocity *= 1.15f; acceleration *= 1.15f; @@ -2748,7 +2748,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas float velocity = 12f; float acceleration = 0.12f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { velocity *= 1.15f; acceleration *= 1.15f; @@ -2857,7 +2857,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas float chargeVelocity = (wormAlive ? 26f : 30f) + (1f - lifeRatio) * 8f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) chargeVelocity *= 1.15f; if (!canDespawn) @@ -2931,7 +2931,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas float velocity = 32f; float acceleration = 1.2f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { velocity *= 1.15f; acceleration *= 1.15f; @@ -3015,7 +3015,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas float velocity = 32f; float acceleration = 1.2f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { velocity *= 1.15f; acceleration *= 1.15f; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs index 7847c6a171..52081a7f87 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs @@ -107,7 +107,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Phase 2 if (npc.ai[0] < 0f) { - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.brainOfGravity = npc.whoAmI; // Spawn gore @@ -237,7 +237,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float velocityScale = death ? 6f : 4.5f; float velocityBoost = velocityScale * (1f - lifeRatio); float nonChargeSpeed = (death ? 24f : 18f) + velocityBoost + 3f * enrageScale; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) nonChargeSpeed *= 1.15f; float minInertia = death ? 50f : 75f; @@ -291,7 +291,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Velocity npc.velocity = (Main.player[npc.target].Center + (death ? Main.player[npc.target].velocity * 20f * enrageScale : Vector2.Zero) - npc.Center).SafeNormalize(Vector2.UnitY) * chargeVelocity; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) npc.velocity *= 1.15f; } } @@ -336,7 +336,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * (-chargeVelocity - 2f * enrageScale); if (death) npc.velocity *= 1.5f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) npc.velocity *= 1.15f; } } @@ -728,7 +728,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float targetYDistPhase1 = Main.player[npc.target].Center.Y - brainCenterPhase1.Y; float targetDistancePhase1 = (float)Math.Sqrt(targetXDistPhase1 * targetXDistPhase1 + targetYDistPhase1 * targetYDistPhase1); float maxMoveVelocity = (death ? 4f : 1.5f) + velocityScale; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) maxMoveVelocity *= 2f; if (targetDistancePhase1 < maxMoveVelocity) @@ -997,7 +997,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 destination = Main.player[npc.target].Center + (death ? Main.player[npc.target].velocity * 20f : Vector2.Zero); Vector2 targetDirection = destination - npc.Center; targetDirection = targetDirection.SafeNormalize(Vector2.UnitY); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { targetDirection *= chargeVelocity + 6f; npc.velocity = (npc.velocity * 49f + targetDirection) / 50f; @@ -1052,7 +1052,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses public static int GetBrainOfCthuluCreepersCountRevDeath() { - return CalamityWorld.LegendaryMode ? 40 : Main.getGoodWorld ? 35 : (CalamityWorld.death || BossRushEvent.BossRushActive) ? 30 : 20; + return CalamityWorld.LegendaryMode ? 40 : CalamityWorld.LegendaryMode ? 35 : (CalamityWorld.death || BossRushEvent.BossRushActive) ? 30 : 20; } private static float GetCrimsonBossKnockBack(NPC npc, int numPlayers, float lifeScale, float baseKnockBackResist) diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs index 4f716d58db..2550684678 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs @@ -83,7 +83,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses idleTime = 20; } - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { iceMistFireRate = 30; iceMistSpeed = 15f; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs index 2a3aaf073a..cc7839314e 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs @@ -195,7 +195,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Total segment variable - int totalSegments = Main.getGoodWorld ? 100 : 80; + int totalSegments = CalamityWorld.LegendaryMode ? 100 : 80; // Calculate aggression based on how many broken segments there are float brokenSegmentAggressionMultiplier = 1f; @@ -230,7 +230,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (oblivionAlive) { calamityGlobalNPC.newAI[3] = 0f; - totalSegments = Main.getGoodWorld ? 75 : 60; + totalSegments = CalamityWorld.LegendaryMode ? 75 : 60; spitLaserSpreads = false; noFlyZoneBoxHeight = 2000; } @@ -264,7 +264,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses speed *= brokenSegmentAggressionMultiplier; turnSpeed *= brokenSegmentAggressionMultiplier; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { segmentVelocity *= 1.2f; speed *= 1.2f; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/DukeFishronAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/DukeFishronAI.cs index 05ba82522b..ea9ef2d04b 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/DukeFishronAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/DukeFishronAI.cs @@ -58,7 +58,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses idlePhaseVelocity = 10f; } - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { idlePhaseAcceleration *= 1.15f; idlePhaseVelocity *= 1.15f; @@ -86,7 +86,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses chargeVelocity *= 1.13f; } - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) chargeVelocity *= 1.15f; int bubbleBelchPhaseTimer = death ? 60 : 80; @@ -94,7 +94,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float bubbleBelchPhaseAcceleration = death ? 0.35f : 0.3f; float bubbleBelchPhaseVelocity = death ? 5.5f : 5f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { bubbleBelchPhaseAcceleration *= 1.5f; bubbleBelchPhaseVelocity *= 1.5f; @@ -112,7 +112,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float bubbleSpinPhaseVelocity = 20f; float bubbleSpinPhaseRotation = MathHelper.TwoPi / (bubbleSpinPhaseTimer / 2); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) bubbleSpinBubbleVelocity *= 1.5f; int spawnEffectPhaseTimer = 75; @@ -192,7 +192,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses chargeTime += Main.rand.Next(5, 66); // Spawn cthulhunadoes in phase 3 - if (phase3AI && ((!phase4 && !deathModeSurprise) || Main.getGoodWorld)) + if (phase3AI && ((!phase4 && !deathModeSurprise) || CalamityWorld.LegendaryMode)) { calamityGlobalNPC.newAI[0] += 1f; float timeGateValue = 600f; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.cs index 50a819dfd8..392bbf42bc 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.cs @@ -94,7 +94,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.localAI[1] -= 1f; int vileSpitGateValue = (int)MathHelper.Lerp(death ? 45f : 90f, 900f, lifeRatio); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) vileSpitGateValue = (int)(vileSpitGateValue * 0.5f); Vector2 vileSpitShootLocation = npc.Center + npc.velocity; @@ -414,7 +414,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses segmentAcceleration += (npc.justHit ? 0.16f : 0.04f); } - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { segmentVelocity += 4f; segmentAcceleration += 0.05f; @@ -451,7 +451,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int npcWidth = npc.width; npcWidth = (int)(npcWidth * npc.scale); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) npcWidth = 62; targetDistance = (targetDistance - npcWidth) / targetDistance; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs index 96ddd8c381..7476547f4f 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs @@ -73,7 +73,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool visible = true; bool takeDamage = true; float lessTimeSpentPerPhaseMultiplier = phase2 ? (death ? 0.375f : 0.5f) : (death ? 0.75f : 1f); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) lessTimeSpentPerPhaseMultiplier *= 0.2f; float extraPhaseTime; @@ -151,7 +151,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.damage = 0; float idleTimer = phase2 ? (death ? 10f : 15f) : (death ? 20f : 30f); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) idleTimer *= 0.5f; if (idleTimer < 10f) idleTimer = 10f; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/EyeOfCthulhuAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/EyeOfCthulhuAI.cs index 81121e90df..71ffb3da2d 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/EyeOfCthulhuAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/EyeOfCthulhuAI.cs @@ -144,7 +144,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses hoverAcceleration += 0.15f * (1f - lifeRatio); } - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { hoverSpeed += 3f; hoverAcceleration += 0.08f; @@ -173,7 +173,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[3] += 1f; float servantSpawnGateValue = death ? 10f : 40f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) servantSpawnGateValue *= 0.8f; if (npc.ai[3] >= servantSpawnGateValue && shootProjectile) @@ -226,7 +226,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses chargeSpeed += 5f * enrageScale; if (death) chargeSpeed += 10f * (1f - lifeRatio); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) chargeSpeed += 4f; npc.velocity = npc.SafeDirectionTo(Main.player[npc.target].Center) * chargeSpeed; @@ -240,7 +240,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.damage = npc.defDamage; int chargeDelay = death ? (75 - (int)Math.Round(30f * (1f - lifeRatio))) : 95; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) chargeDelay -= 30; float slowDownGateValue = chargeDelay * (death ? 0.85f : 0.65f); @@ -256,7 +256,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses decelerationScalar = 0f; npc.velocity *= (MathHelper.Lerp(death ? 0.76f : 0.92f, death ? 0.88f : 0.96f, decelerationScalar)); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) npc.velocity *= 0.99f; if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) @@ -307,7 +307,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Avoid cheap bullshit npc.damage = 0; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) npc.reflectsProjectiles = true; if (npc.ai[0] == 1f) @@ -326,13 +326,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.rotation += npc.ai[2]; float phaseChangeRate = death ? 2f : 1f; - float servantSpawnGateValue = Main.getGoodWorld ? 4f : 20f; + float servantSpawnGateValue = CalamityWorld.LegendaryMode ? 4f : 20f; npc.ai[1] += phaseChangeRate; if (npc.ai[1] % servantSpawnGateValue == 0f) { float servantVelocity = death ? 11.3f : 5.65f; Vector2 servantSpawnVelocity = Main.rand.NextVector2CircularEdge(servantVelocity, servantVelocity); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) servantSpawnVelocity *= 3f; Vector2 servantSpawnCenter = npc.Center + servantSpawnVelocity.SafeNormalize(Vector2.UnitY) * ProjectileOffset; @@ -457,7 +457,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { hoverSpeed += 1f; hoverAcceleration += 0.1f; @@ -520,7 +520,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses chargeSpeed *= 1.15f; if (npc.ai[3] == 2f) chargeSpeed *= 1.3f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) chargeSpeed *= 1.2f; npc.velocity = npc.SafeDirectionTo(Main.player[npc.target].Center) * chargeSpeed; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs index b7bc32aaa0..d57056008a 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs @@ -63,12 +63,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (tile.WallType == WallID.LihzahrdBrickUnsafe) enrage = false; else - turboEnrage = bossRush || Main.getGoodWorld; + turboEnrage = bossRush || CalamityWorld.LegendaryMode; } else - turboEnrage = bossRush || Main.getGoodWorld; + turboEnrage = bossRush || CalamityWorld.LegendaryMode; - if (bossRush || Main.getGoodWorld) + if (bossRush || CalamityWorld.LegendaryMode) enrage = true; npc.Calamity().CurrentlyEnraged = !bossRush && (enrage || turboEnrage); @@ -98,7 +98,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int despawnDistance = turboEnrage ? 7500 : enrage ? 6000 : 4500; // Deactivate torches - if (Main.netMode != NetmodeID.MultiplayerClient && Main.getGoodWorld && npc.velocity.Y > 0f) + if (Main.netMode != NetmodeID.MultiplayerClient && CalamityWorld.LegendaryMode && npc.velocity.Y > 0f) { for (int j = (int)(npc.position.X / 16f); (float)j < (npc.position.X + (float)npc.width) / 16f; j++) { @@ -115,7 +115,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Spawn arm dust - if (!Main.getGoodWorld) + if (!CalamityWorld.LegendaryMode) { if (!leftFistAlive) { @@ -190,7 +190,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (enrage) divisor = 5f; - if (turboEnrage && Main.getGoodWorld) + if (turboEnrage && CalamityWorld.LegendaryMode) divisor = 2f; Vector2 projectileFirePos = new Vector2(npc.Center.X, npc.Center.Y - 60f); @@ -212,7 +212,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { int bodyLaser = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileFirePos + laserVelocity.SafeNormalize(Vector2.UnitY) * 40f, laserVelocity, type, damage, 0f, Main.myPlayer); Main.projectile[bodyLaser].timeLeft = enrage ? 720 : 360; - if (turboEnrage && Main.getGoodWorld) + if (turboEnrage && CalamityWorld.LegendaryMode) Main.projectile[bodyLaser].extraUpdates += 1; } } @@ -231,7 +231,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[1] > 0f) { npc.ai[1] += (death ? 2f : 1f); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) npc.ai[1] += 100f; if (enrage || death) @@ -530,7 +530,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses destination.Normalize(); destination *= projectileVelocity; int totalFireballsPerSide = 3; - int totalIterations = (turboEnrage && Main.getGoodWorld) ? 11 : death ? 25 : 35; + int totalIterations = (turboEnrage && CalamityWorld.LegendaryMode) ? 11 : death ? 25 : 35; float rotation = MathHelper.ToRadians(90); for (int i = 0; i < totalIterations; i++) { @@ -540,7 +540,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(totalIterations - 1))); int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.UnitY * (npc.height / 2 * 0.8f) * npc.scale + Vector2.Normalize(perturbedSpeed) * (npc.width / 3) * npc.scale, perturbedSpeed, type, damage, 0f, Main.myPlayer); Main.projectile[proj].timeLeft = enrage ? 480 : 240; - if (turboEnrage && Main.getGoodWorld) + if (turboEnrage && CalamityWorld.LegendaryMode) Main.projectile[proj].extraUpdates += 1; } } @@ -578,7 +578,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 projVelocity = laserVelocity.RotatedBy(radians * j + MathHelper.PiOver2); int bodyLaser = Projectile.NewProjectile(npc.GetSource_FromAI(), fireFrom, projVelocity, type, damage, 0f, Main.myPlayer); Main.projectile[bodyLaser].timeLeft = enrage ? 720 : 360; - if (turboEnrage && Main.getGoodWorld) + if (turboEnrage && CalamityWorld.LegendaryMode) Main.projectile[bodyLaser].extraUpdates += 1; } } @@ -643,8 +643,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses void CustomGravity(bool isSlamming) { - float gravity = turboEnrage ? (Main.getGoodWorld ? 1.15f : 0.85f) : enrage ? 0.75f : (!leftFistAlive && !rightFistAlive) ? 0.45f : 0.3f; - float maxFallSpeed = reduceFallSpeed ? 12f : turboEnrage ? (Main.getGoodWorld ? 40f : 30f) : enrage ? 25f : (!leftFistAlive && !rightFistAlive) ? 15f : 10f; + float gravity = turboEnrage ? (CalamityWorld.LegendaryMode ? 1.15f : 0.85f) : enrage ? 0.75f : (!leftFistAlive && !rightFistAlive) ? 0.45f : 0.3f; + float maxFallSpeed = reduceFallSpeed ? 12f : turboEnrage ? (CalamityWorld.LegendaryMode ? 40f : 30f) : enrage ? 25f : (!leftFistAlive && !rightFistAlive) ? 15f : 10f; if (isSlamming && !reduceFallSpeed) { gravity *= 4f; @@ -715,15 +715,15 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (tile.WallType == WallID.LihzahrdBrickUnsafe) enrage = false; else - turboEnrage = bossRush || Main.getGoodWorld; + turboEnrage = bossRush || CalamityWorld.LegendaryMode; } else - turboEnrage = bossRush || Main.getGoodWorld; + turboEnrage = bossRush || CalamityWorld.LegendaryMode; - if (bossRush || Main.getGoodWorld) + if (bossRush || CalamityWorld.LegendaryMode) enrage = true; - float aggression = turboEnrage ? (Main.getGoodWorld ? 4f : 3f) : enrage ? 2f : death ? 1.7f : 1f; + float aggression = turboEnrage ? (CalamityWorld.LegendaryMode ? 4f : 3f) : enrage ? 2f : death ? 1.7f : 1f; Vector2 fistCenter = golem.Center + golem.velocity + new Vector2(0f, -9f * npc.scale); fistCenter.X += (float)((npc.type == NPCID.GolemFistLeft) ? -84 : 78) * npc.scale; @@ -805,7 +805,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Dust dust = Dust.NewDustPerfect(npc.Center + largeRandDustRecoil + largeRandDustRadius + smallRandDustRadius, 228, largeRandDustRecoil); dust.fadeIn = 1.5f; dust.scale = 0.5f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) dust.noLight = true; dust.noGravity = true; @@ -846,7 +846,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Set damage npc.damage = npc.defDamage; - if (Main.netMode != NetmodeID.MultiplayerClient && Main.getGoodWorld) + if (Main.netMode != NetmodeID.MultiplayerClient && CalamityWorld.LegendaryMode) { for (int j = (int)(npc.position.X / 16f) - 1; (float)j < (npc.position.X + (float)npc.width) / 16f + 1f; j++) { @@ -1042,12 +1042,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (tile.WallType == WallID.LihzahrdBrickUnsafe) enrage = false; else - turboEnrage = bossRush || Main.getGoodWorld; + turboEnrage = bossRush || CalamityWorld.LegendaryMode; } else - turboEnrage = bossRush || Main.getGoodWorld; + turboEnrage = bossRush || CalamityWorld.LegendaryMode; - if (bossRush || Main.getGoodWorld) + if (bossRush || CalamityWorld.LegendaryMode) enrage = true; // Alpha @@ -1188,7 +1188,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { int bodyLaser = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileFirePos + laserVelocity.SafeNormalize(Vector2.UnitY) * 40f, laserVelocity, projType, dmg, 0f, Main.myPlayer); Main.projectile[bodyLaser].timeLeft = enrage ? 600 : 300; - if (turboEnrage && Main.getGoodWorld) + if (turboEnrage && CalamityWorld.LegendaryMode) Main.projectile[bodyLaser].extraUpdates += 1; npc.netUpdate = true; @@ -1217,7 +1217,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { int extraLasers = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileFirePos + laserVelocity.SafeNormalize(Vector2.UnitY) * 40f, laserVelocity, projType, dmg, 0f, Main.myPlayer); Main.projectile[extraLasers].timeLeft = enrage ? 600 : 300; - if (turboEnrage && Main.getGoodWorld) + if (turboEnrage && CalamityWorld.LegendaryMode) Main.projectile[extraLasers].extraUpdates += 1; npc.netUpdate = true; @@ -1286,12 +1286,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (tile.WallType == WallID.LihzahrdBrickUnsafe) enrage = false; else - turboEnrage = bossRush || Main.getGoodWorld; + turboEnrage = bossRush || CalamityWorld.LegendaryMode; } else - turboEnrage = bossRush || Main.getGoodWorld; + turboEnrage = bossRush || CalamityWorld.LegendaryMode; - if (bossRush || Main.getGoodWorld) + if (bossRush || CalamityWorld.LegendaryMode) enrage = true; if (turboEnrage) @@ -1522,12 +1522,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int damage = npc.GetProjectileDamage(type); int freeHeadLaser = Projectile.NewProjectile(npc.GetSource_FromAI(), freeHeadProjSpawn + laserVelocity.SafeNormalize(Vector2.UnitY) * 40f, laserVelocity, type, damage, 0f, Main.myPlayer); Main.projectile[freeHeadLaser].timeLeft = enrage ? 600 : 300; - if (turboEnrage && Main.getGoodWorld) + if (turboEnrage && CalamityWorld.LegendaryMode) Main.projectile[freeHeadLaser].extraUpdates += 1; } } - if (!Main.getGoodWorld) + if (!CalamityWorld.LegendaryMode) { npc.position += npc.netOffset; int randDustOffset = Main.rand.Next(2) * 2 - 1; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs index b3fa63a8d6..8d6bc39693 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs @@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool teleported = false; npc.aiAction = 0; float teleportScaleSpeed = 2f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { teleportScaleSpeed -= 1f - lifeRatio; teleportScale *= teleportScaleSpeed; @@ -317,7 +317,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[0] += teleportRate; teleportScale = MathHelper.Clamp((60f - npc.ai[0]) / 60f, 0f, 1f); teleportScale = 0.5f + teleportScale * 0.5f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) teleportScale *= teleportScaleSpeed; if (npc.ai[0] >= 60f) @@ -399,7 +399,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[0] += teleportRate; teleportScale = MathHelper.Clamp(npc.ai[0] / 30f, 0f, 1f); teleportScale = 0.5f + teleportScale * 0.5f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) teleportScale *= teleportScaleSpeed; if (npc.ai[0] >= 30f && Main.netMode != NetmodeID.MultiplayerClient) @@ -516,7 +516,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float jumpVelocityLimit = redCrystalAlive ? 3f : 4.5f; if (death) jumpVelocityLimit += 3f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) jumpVelocityLimit = 8f; if ((npc.direction == 1 && npc.velocity.X < jumpVelocityLimit) || (npc.direction == -1 && npc.velocity.X > -jumpVelocityLimit)) @@ -554,12 +554,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; // Adjust size based on HP - float maxScale = death ? (Main.getGoodWorld ? 6f : 2.5f) : (Main.getGoodWorld ? 3f : 1.5f); + float maxScale = death ? (CalamityWorld.LegendaryMode ? 6f : 2.5f) : (CalamityWorld.LegendaryMode ? 3f : 1.5f); float minScale = death ? 0.5f : 0.75f; float maxScaledValue = maxScale - minScale; // Inversed scale in FTW - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) lifeRatio = (maxScaledValue - lifeRatio * maxScaledValue) + minScale; else lifeRatio = lifeRatio * maxScaledValue + minScale; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/MoonLordAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/MoonLordAI.cs index 15a895165c..7b5a439579 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/MoonLordAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/MoonLordAI.cs @@ -48,7 +48,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (bossRush) aggressionLevel = 5; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) aggressionLevel = 6; if (npc.type == NPCID.MoonLordCore) @@ -811,7 +811,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.localAI[1] < 0f) { npc.localAI[1] = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient && Main.getGoodWorld && Main.remixWorld) + if (Main.netMode != NetmodeID.MultiplayerClient && CalamityWorld.LegendaryMode && Main.remixWorld) { for (int k = 0; k < 30; k++) { diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs index d6af968e23..58c09def7a 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs @@ -173,7 +173,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { velocity *= 1.15f; acceleration *= 1.15f; @@ -649,7 +649,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (enrage) npc.localAI[1] += 2f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) npc.localAI[1] += 1f; float shootProjectileGateValue = death ? 30f : 60f; @@ -729,7 +729,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { npc.localAI[0] = 2f; int totalTentacles = death ? 12 : 8; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) totalTentacles += 6; if (CalamityWorld.LegendaryMode) totalTentacles *= 2; @@ -737,7 +737,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses for (int i = 0; i < totalTentacles; i++) NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { foreach (NPC n in Main.ActiveNPCs) { @@ -1095,7 +1095,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float hookMoveDistance = (float)Math.Sqrt(hookMoveX * hookMoveX + hookMoveY * hookMoveY); if (hookMoveDistance < 12f + velocity) { - if (Main.netMode != NetmodeID.MultiplayerClient && Main.getGoodWorld && npc.localAI[3] == 1f) + if (Main.netMode != NetmodeID.MultiplayerClient && CalamityWorld.LegendaryMode && npc.localAI[3] == 1f) { npc.localAI[3] = 0f; WorldGen.SpawnPlanteraThorns(npc.Center); @@ -1106,7 +1106,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } else { - if (Main.netMode != NetmodeID.MultiplayerClient && Main.getGoodWorld) + if (Main.netMode != NetmodeID.MultiplayerClient && CalamityWorld.LegendaryMode) npc.localAI[3] = 1f; hookMoveDistance = velocity / hookMoveDistance; @@ -1140,7 +1140,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool death = CalamityWorld.death || BossRushEvent.BossRushActive; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { if (Main.rand.NextBool(5)) npc.reflectsProjectiles = true; @@ -1218,7 +1218,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses deceleration *= 0.75f; } - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) tentacleAcceleration += 4f; // Fast retraction diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs index 6815bf8ea1..380f498762 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs @@ -47,8 +47,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses enrageScale += 0.5f; } - if (Main.getGoodWorld) - enrageScale += ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 1f : 0.5f); + if (CalamityWorld.LegendaryMode) + enrageScale += (CalamityWorld.LegendaryMode ? 1f : 0.5f); if (bossRush) enrageScale = 2f; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs index 347925e93e..c46b92bfc1 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs @@ -328,7 +328,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (death) { int numGelProjectiles = 12; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) numGelProjectiles = 15; float gelVelocity = death ? 20f : 16f; @@ -466,7 +466,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses break; float jumpVelocity = bossRush ? 9f : death ? 7f : 4.5f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) jumpVelocity = 12f; if ((npc.direction == 1 && npc.velocity.X < jumpVelocity) || (npc.direction == -1 && npc.velocity.X > 0f - jumpVelocity)) @@ -512,7 +512,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (phase2) slamDelay = 10; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) slamDelay = 0; if (npc.velocity.Y == 0f) @@ -626,7 +626,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.velocity.Y += bossRush ? 2f : death ? 1.75f : 1.5f; float slamVelocity = bossRush ? 15.99f : death ? 15.5f : 15f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { npc.velocity.Y += 1f; slamVelocity = 15.99f; @@ -732,7 +732,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int numGelProjectiles = phase4 ? Main.rand.Next(9, 12) : phase2 ? Main.rand.Next(6, 9) : 12; if (phase5) numGelProjectiles += 6; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) numGelProjectiles = 20; float projectileVelocity = death ? 12f : 10.5f; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs index fb166011a6..ede2fc2457 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs @@ -155,39 +155,39 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Hand variables bool handsDead = numHandsAlive == 0; - int numProj = Main.getGoodWorld ? 22 : death ? 5 : 3; - float spread = Main.getGoodWorld ? 180 : 60; + int numProj = CalamityWorld.LegendaryMode ? 22 : death ? 5 : 3; + float spread = CalamityWorld.LegendaryMode ? 180 : 60; float headSpinVelocityMult = bossRush ? (phase3 ? 18f : 9f) : (phase3 ? 12f : 4.5f); switch (numHandsAlive) { case 0: - numProj = Main.getGoodWorld ? 36 : death ? 9 : 7; - spread = Main.getGoodWorld ? 180 : death ? 90 : 82; + numProj = CalamityWorld.LegendaryMode ? 36 : death ? 9 : 7; + spread = CalamityWorld.LegendaryMode ? 180 : death ? 90 : 82; headSpinVelocityMult = bossRush ? (phase3 ? 18f : 12f) : (phase3 ? 12f : 6f); break; case 1: - numProj = Main.getGoodWorld ? 27 : death ? 7 : 5; - spread = Main.getGoodWorld ? 150 : death ? 76 : 68; + numProj = CalamityWorld.LegendaryMode ? 27 : death ? 7 : 5; + spread = CalamityWorld.LegendaryMode ? 150 : death ? 76 : 68; headSpinVelocityMult = bossRush ? (phase3 ? 15f : 10f) : (phase3 ? 11.5f : 5f); break; case 2: - numProj = Main.getGoodWorld ? 18 : death ? 6 : 4; - spread = Main.getGoodWorld ? 140 : death ? 70 : 62; + numProj = CalamityWorld.LegendaryMode ? 18 : death ? 6 : 4; + spread = CalamityWorld.LegendaryMode ? 140 : death ? 70 : 62; headSpinVelocityMult = bossRush ? (phase3 ? 13.5f : 9f) : (phase3 ? 11f : 4.5f); break; case 3: - numProj = Main.getGoodWorld ? 15 : death ? 5 : 3; - spread = Main.getGoodWorld ? 130 : death ? 64 : 56; + numProj = CalamityWorld.LegendaryMode ? 15 : death ? 5 : 3; + spread = CalamityWorld.LegendaryMode ? 130 : death ? 64 : 56; headSpinVelocityMult = bossRush ? (phase3 ? 12f : 8f) : (phase3 ? 10.5f : 4f); break; case 4: - numProj = Main.getGoodWorld ? 12 : death ? 4 : 3; - spread = Main.getGoodWorld ? 120 : 56; + numProj = CalamityWorld.LegendaryMode ? 12 : death ? 4 : 3; + spread = CalamityWorld.LegendaryMode ? 120 : 56; headSpinVelocityMult = bossRush ? (phase3 ? 10f : 7f) : (phase3 ? 10f : 3.5f); break; } @@ -367,7 +367,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if ((handsDead || death) && npc.ai[1] == 0f && !phase4) { float skullProjFrequency = bossRush ? 15f : phase2 ? (48f - (death ? 17.5f * (1f - lifeRatio) : 0f)) : 60f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) skullProjFrequency *= 0.8f; skullProjFrequency = (float)Math.Ceiling(skullProjFrequency); @@ -444,11 +444,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - float headYAcceleration = (Main.getGoodWorld ? 0.07f : death ? (0.06f + 0.04f * (1f - lifeRatio)) : 0.04f); + float headYAcceleration = (CalamityWorld.LegendaryMode ? 0.07f : death ? (0.06f + 0.04f * (1f - lifeRatio)) : 0.04f); float headYTopSpeed = headYAcceleration * 100f; - float headXAcceleration = (Main.getGoodWorld ? 0.21f : death ? (0.16f + 0.08f * (1f - lifeRatio)) : 0.08f); + float headXAcceleration = (CalamityWorld.LegendaryMode ? 0.21f : death ? (0.16f + 0.08f * (1f - lifeRatio)) : 0.08f); float headXTopSpeed = headXAcceleration * 100f; - float deceleration = Main.getGoodWorld ? 0.83f : death ? 0.86f : 0.89f; + float deceleration = CalamityWorld.LegendaryMode ? 0.83f : death ? 0.86f : 0.89f; if (bossRush) { @@ -545,7 +545,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Set damage npc.damage = npc.defDamage; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { npc.reflectsProjectiles = true; if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == 0f) @@ -646,7 +646,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float dashPhaseTime = death ? 210f : 300f; if (npc.ai[2] >= dashPhaseTime) { - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(NPCID.DarkCaster) < 6) { @@ -737,7 +737,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses headSpinVelocityMult *= baseDistanceVelocityMult; } - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) headSpinVelocityMult *= 1.3f; headSpinTargetDist = headSpinVelocityMult / headSpinTargetDist; @@ -902,7 +902,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float velocityMultiplier = MathHelper.Lerp(death ? 0.6f : 0.7f, 1f, skeletronLifeRatio); float velocityIncrement = MathHelper.Lerp(0.2f, death ? 0.4f : 0.3f, 1f - skeletronLifeRatio); float handSwipeVelocity = MathHelper.Lerp(16f, death ? 24f : 20f, 1f - skeletronLifeRatio); - float deceleration = Main.getGoodWorld ? 0.78f : death ? 0.82f : 0.86f; + float deceleration = CalamityWorld.LegendaryMode ? 0.78f : death ? 0.82f : 0.86f; if (death) { diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs index 10f0500657..079c869044 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs @@ -170,7 +170,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses acceleration += phase1MaxAccelerationIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); } - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { maxVelocity *= 1.15f; acceleration *= 1.15f; @@ -224,7 +224,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!Main.player[npc.target].dead) { npc.ai[3] += 1f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) npc.ai[3] += 0.5f; } @@ -269,7 +269,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses chargeSpeed += 10f * enrageScale; if (death) chargeSpeed += phase1MaxChargeSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) chargeSpeed += 2f; npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitX * direction) * chargeSpeed; @@ -468,7 +468,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses maxVelocity += 4.5f * enrageScale; acceleration += 0.075f * enrageScale; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { maxVelocity *= 1.15f; acceleration *= 1.15f; @@ -556,7 +556,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses maxVelocity += 4.5f * enrageScale; acceleration += 0.15f * enrageScale; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { maxVelocity *= 1.15f; acceleration *= 1.15f; @@ -629,7 +629,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses chargeSpeed += 10f * enrageScale; if (!spazAlive) chargeSpeed += 2f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) chargeSpeed += 2f; npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * chargeSpeed; @@ -750,7 +750,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses chargeAcceleration *= 0.75f; } - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { chargeSpeed *= 1.15f; chargeAcceleration *= 1.15f; @@ -934,7 +934,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses acceleration += phase1MaxAccelerationIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); } - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { maxVelocity *= 1.15f; acceleration *= 1.15f; @@ -979,7 +979,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!Main.player[npc.target].dead) { npc.ai[3] += 1f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) npc.ai[3] += 0.4f; } @@ -1025,7 +1025,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses chargeSpeed += 8f * enrageScale; if (death) chargeSpeed += phase1MaxChargeSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) chargeSpeed *= 1.2f; npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitX * direction) * chargeSpeed; @@ -1236,7 +1236,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (distanceFromDestination > distanceFromTarget) maxVelocity += MathHelper.Lerp(0f, oblivionAlive ? 3f : death ? 8f : 6f, MathHelper.Clamp((distanceFromDestination - distanceFromTarget) / 1000f, 0f, 1f)); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { maxVelocity *= 1.15f; acceleration *= 1.15f; @@ -1343,7 +1343,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float chargeSpeed = 18f + (death ? 5f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); chargeSpeed += 16f * enrageScale; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) chargeSpeed *= 1.2f; npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitX * direction) * chargeSpeed; @@ -1427,7 +1427,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses spazmatismPhase3ChargeSpeed += 10f * enrageScale; if (npc.ai[2] == -1f || (!retAlive && npc.ai[3] == secondFastCharge)) spazmatismPhase3ChargeSpeed *= 1.3f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) spazmatismPhase3ChargeSpeed *= 1.2f; Vector2 distanceVector = Main.player[npc.target].Center + (!retAlive && bossRush ? Main.player[npc.target].velocity * 20f : Vector2.Zero) - npc.Center; @@ -1551,7 +1551,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses chargeAcceleration *= 0.75f; } - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { chargeSpeed *= 1.15f; chargeAcceleration *= 1.15f; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs index 38aea8f081..e94a7788b1 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs @@ -45,7 +45,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool phase2 = lifeRatio < 0.66f; bool phase3 = lifeRatio < 0.33f; - if (Main.getGoodWorld && Main.netMode != NetmodeID.MultiplayerClient && Main.rand.NextBool(180)) + if (CalamityWorld.LegendaryMode && Main.netMode != NetmodeID.MultiplayerClient && Main.rand.NextBool(180)) { if (NPC.CountNPCS(NPCID.FireImp) < 4) { @@ -327,7 +327,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (death) velocityX *= 1.2f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { velocityX *= 1.1f; velocityX += 0.1f; diff --git a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs index 9b9ac80d81..97af54642c 100644 --- a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs +++ b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs @@ -4167,7 +4167,7 @@ PrepareToShoot: if (Main.netMode != NetmodeID.MultiplayerClient && !targetDead) { - if (Main.getGoodWorld && npc.type == NPCID.EaterofSouls) + if (CalamityWorld.LegendaryMode && npc.type == NPCID.EaterofSouls) { if (NPC.AnyNPCs(NPCID.EaterofWorldsHead)) { @@ -5433,7 +5433,7 @@ PrepareToShoot: } else { - if (Main.getGoodWorld && npc.type == NPCID.FireImp) + if (CalamityWorld.LegendaryMode && npc.type == NPCID.FireImp) { if (NPC.AnyNPCs(NPCID.WallofFlesh)) { @@ -6792,7 +6792,7 @@ PrepareToShoot: // If FTW is enabled, can fire 8 to 13 sand balls (random chance for 10x the amount) int projAmt = 1; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { projAmt = Main.rand.Next(8, 14); if (Main.rand.NextBool(1000) || Main.zenithWorld) diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index 12220297eb..2d02ef43ab 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -369,12 +369,12 @@ namespace CalamityMod.NPCs.Yharon enraged = false; if (Main.netMode != NetmodeID.MultiplayerClient) { - safeBox.X = (int)(player.Center.X - (Main.zenithWorld ? 1500f : Main.getGoodWorld ? 1000f : bossRush ? 2000f : revenge ? 3000f : 3500f)); + safeBox.X = (int)(player.Center.X - (Main.zenithWorld ? 1500f : CalamityWorld.LegendaryMode ? 1000f : bossRush ? 2000f : revenge ? 3000f : 3500f)); safeBox.Y = (int)Main.topWorld; - safeBox.Width = Main.zenithWorld ? 3000 : Main.getGoodWorld ? 2000 : bossRush ? 4000 : revenge ? 6000 : 7000; + safeBox.Width = Main.zenithWorld ? 3000 : CalamityWorld.LegendaryMode ? 2000 : bossRush ? 4000 : revenge ? 6000 : 7000; safeBox.Height = Main.maxTilesY * 16; - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + (Main.zenithWorld ? 1500f : Main.getGoodWorld ? 1000f : bossRush ? 2000f : revenge ? 3000f : 3500f), player.Center.Y + 100f, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X - (Main.zenithWorld ? 1500f : Main.getGoodWorld ? 1000f : bossRush ? 2000f : revenge ? 3000f : 3500f), player.Center.Y + 100f, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + (Main.zenithWorld ? 1500f : CalamityWorld.LegendaryMode ? 1000f : bossRush ? 2000f : revenge ? 3000f : 3500f), player.Center.Y + 100f, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X - (Main.zenithWorld ? 1500f : CalamityWorld.LegendaryMode ? 1000f : bossRush ? 2000f : revenge ? 3000f : 3500f), player.Center.Y + 100f, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); } // Force Yharon to send a sync packet so that the arena gets sent immediately @@ -396,7 +396,7 @@ namespace CalamityMod.NPCs.Yharon protectionBoost = false; } - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) phaseSwitchTimer /= 2; // Set DR based on protection boost (aka enrage) @@ -1815,7 +1815,7 @@ namespace CalamityMod.NPCs.Yharon chargeSpeed *= velocityMult; } - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) phaseSwitchTimer *= 0.5f; if (NPC.ai[0] == 0f) @@ -2024,12 +2024,6 @@ namespace CalamityMod.NPCs.Yharon if (Main.netMode != NetmodeID.MultiplayerClient) { - if (CalamityWorld.LegendaryMode && revenge) - { - if (!NPC.AnyNPCs(ModContent.NPCType())) - NPC.SpawnOnPlayer(NPC.FindClosestPlayer(), ModContent.NPCType()); - } - float bulletHellTeleportLocationDistance = 540f; Vector2 teleportLocation = -Vector2.UnitY * bulletHellTeleportLocationDistance * (targetData.velocity.Y >= 0f).ToDirectionInt(); Vector2 center = targetData.Center + teleportLocation; diff --git a/Projectiles/Boss/ApolloChargeTelegraph.cs b/Projectiles/Boss/ApolloChargeTelegraph.cs index b038018e4c..3da901c212 100644 --- a/Projectiles/Boss/ApolloChargeTelegraph.cs +++ b/Projectiles/Boss/ApolloChargeTelegraph.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Boss bool expertMode = Main.expertMode || bossRush; Projectile.timeLeft = bossRush ? 45 : death ? 60 : revenge ? 68 : expertMode ? 75 : 90; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) Projectile.timeLeft /= 2; } @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Boss // Determine opacity float telegraphTotalTime = bossRush ? 45f : death ? 60f : revenge ? 68f : expertMode ? 75f : 90f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) telegraphTotalTime *= 0.5f; Projectile.Opacity = Utils.GetLerpValue(0f, 6f, Projectile.timeLeft, true) * Utils.GetLerpValue(telegraphTotalTime, telegraphTotalTime - 6f, Projectile.timeLeft, true); diff --git a/Projectiles/Boss/AresGaussNukeProjectile.cs b/Projectiles/Boss/AresGaussNukeProjectile.cs index e657cca25b..1881f84842 100644 --- a/Projectiles/Boss/AresGaussNukeProjectile.cs +++ b/Projectiles/Boss/AresGaussNukeProjectile.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Boss CooldownSlot = ImmunityCooldownID.Bosses; Projectile.timeLeft = timeLeft; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) Projectile.extraUpdates = 1; } diff --git a/Projectiles/Boss/ArtemisLaser.cs b/Projectiles/Boss/ArtemisLaser.cs index 454670d01a..a0220bfd95 100644 --- a/Projectiles/Boss/ArtemisLaser.cs +++ b/Projectiles/Boss/ArtemisLaser.cs @@ -106,7 +106,7 @@ namespace CalamityMod.Projectiles.Boss // If a velocity is in reserve, set the true velocity to it and make it as "taken" by setting it to <0,0> if (Velocity != Vector2.Zero) { - Projectile.extraUpdates = Main.getGoodWorld ? 4 : 3; + Projectile.extraUpdates = CalamityWorld.LegendaryMode ? 4 : 3; Projectile.velocity = Velocity * (BossRushEvent.BossRushActive ? 1.25f : 1f); Velocity = Vector2.Zero; Projectile.netUpdate = true; diff --git a/Projectiles/Boss/AstralFlame.cs b/Projectiles/Boss/AstralFlame.cs index 99629bc81a..1d1de9d9f3 100644 --- a/Projectiles/Boss/AstralFlame.cs +++ b/Projectiles/Boss/AstralFlame.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = 1; Projectile.timeLeft = 600; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) Projectile.extraUpdates = 1; } diff --git a/Projectiles/Boss/BrimstoneRay.cs b/Projectiles/Boss/BrimstoneRay.cs index 860895fc39..c5955b1f99 100644 --- a/Projectiles/Boss/BrimstoneRay.cs +++ b/Projectiles/Boss/BrimstoneRay.cs @@ -136,7 +136,7 @@ namespace CalamityMod.Projectiles.Boss Vector2 projVelocity = Projectile.velocity.RotatedBy(radians * j + MathHelper.PiOver2); int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), fireFrom, projVelocity, type, damage, 0f, Main.myPlayer, death ? 2f : 1f, 0f, projectileVelocityToPass); Main.projectile[proj].tileCollide = true; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) Main.projectile[proj].extraUpdates += 1; } fireFrom += velocity * distanceBetweenProjectiles; diff --git a/Projectiles/Boss/DarkEnergyBall.cs b/Projectiles/Boss/DarkEnergyBall.cs index ad7fa65911..498edb8a4e 100644 --- a/Projectiles/Boss/DarkEnergyBall.cs +++ b/Projectiles/Boss/DarkEnergyBall.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = -1; Projectile.Opacity = 0f; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) Projectile.extraUpdates = 1; } diff --git a/Projectiles/Boss/DarkEnergyBall2.cs b/Projectiles/Boss/DarkEnergyBall2.cs index 17076168fc..53e95b4bfe 100644 --- a/Projectiles/Boss/DarkEnergyBall2.cs +++ b/Projectiles/Boss/DarkEnergyBall2.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = -1; Projectile.Opacity = 0f; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) Projectile.extraUpdates = 1; } diff --git a/Projectiles/Boss/DesertScourgeSpit.cs b/Projectiles/Boss/DesertScourgeSpit.cs index 15b83a8c5d..8f1271c812 100644 --- a/Projectiles/Boss/DesertScourgeSpit.cs +++ b/Projectiles/Boss/DesertScourgeSpit.cs @@ -25,12 +25,12 @@ namespace CalamityMod.Projectiles.Boss { Projectile.width = 16; Projectile.height = 16; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) Projectile.scale = 2f; Projectile.hostile = true; Projectile.tileCollide = false; Projectile.penetrate = 1; - Projectile.timeLeft = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 900 : 600; + Projectile.timeLeft = CalamityWorld.LegendaryMode ? 900 : 600; Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.alpha = 255; } diff --git a/Projectiles/Boss/DoGBeam.cs b/Projectiles/Boss/DoGBeam.cs index 6be31c977f..7336ec46f6 100644 --- a/Projectiles/Boss/DoGBeam.cs +++ b/Projectiles/Boss/DoGBeam.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = 1; Projectile.timeLeft = 960; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) Projectile.extraUpdates = 1; } diff --git a/Projectiles/Boss/Flarenado.cs b/Projectiles/Boss/Flarenado.cs index e8e1ce6b58..18c38a055e 100644 --- a/Projectiles/Boss/Flarenado.cs +++ b/Projectiles/Boss/Flarenado.cs @@ -129,7 +129,7 @@ namespace CalamityMod.Projectiles.Boss { Projectile.velocity.X = Main.rand.NextBool() ? -tornadoSpeed : tornadoSpeed; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) Projectile.velocity.X *= 1.5f; } diff --git a/Projectiles/Boss/GreatSandBlast.cs b/Projectiles/Boss/GreatSandBlast.cs index b7fa0c573f..cbceb613d7 100644 --- a/Projectiles/Boss/GreatSandBlast.cs +++ b/Projectiles/Boss/GreatSandBlast.cs @@ -22,12 +22,12 @@ namespace CalamityMod.Projectiles.Boss { Projectile.width = 10; Projectile.height = 10; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) Projectile.scale = 2f; Projectile.hostile = true; Projectile.tileCollide = false; Projectile.penetrate = 1; - Projectile.timeLeft = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 900 : 600; + Projectile.timeLeft = CalamityWorld.LegendaryMode ? 900 : 600; Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.alpha = 255; } diff --git a/Projectiles/Boss/HolyBlast.cs b/Projectiles/Boss/HolyBlast.cs index 4b2b1d3666..6023f80dfa 100644 --- a/Projectiles/Boss/HolyBlast.cs +++ b/Projectiles/Boss/HolyBlast.cs @@ -158,7 +158,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.owner == Main.myPlayer) { int totalProjectiles = !ProvUtils.StandardAI() ? 8 : 6; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) totalProjectiles *= 2; float radians = MathHelper.TwoPi / totalProjectiles; diff --git a/Projectiles/Boss/HolyBurnOrb.cs b/Projectiles/Boss/HolyBurnOrb.cs index 64c20b7f63..4874585c60 100644 --- a/Projectiles/Boss/HolyBurnOrb.cs +++ b/Projectiles/Boss/HolyBurnOrb.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.timeLeft = 160; } - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) { if (Projectile.velocity.Length() < 12f && Projectile.ai[1] == 0f) { diff --git a/Projectiles/Boss/HolyFire.cs b/Projectiles/Boss/HolyFire.cs index 3385962d35..8cc4b52c1c 100644 --- a/Projectiles/Boss/HolyFire.cs +++ b/Projectiles/Boss/HolyFire.cs @@ -93,12 +93,12 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.owner == Main.myPlayer) { Vector2 velocity = new Vector2(0.01f, 0f); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) velocity *= Main.rand.NextFloat(1f, 2f); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 1f); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) velocity *= Main.rand.NextFloat(1f, 2f); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 1f); @@ -109,12 +109,12 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.owner == Main.myPlayer) { Vector2 velocity = new Vector2(0.05f, 0f); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) velocity *= Main.rand.NextFloat(1f, 2f); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 1f); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) velocity *= Main.rand.NextFloat(1f, 2f); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 1f); diff --git a/Projectiles/Boss/Infernado.cs b/Projectiles/Boss/Infernado.cs index 691c909e79..dbfda46530 100644 --- a/Projectiles/Boss/Infernado.cs +++ b/Projectiles/Boss/Infernado.cs @@ -131,7 +131,7 @@ namespace CalamityMod.Projectiles.Boss { Projectile.velocity.X = Main.rand.NextBool() ? -tornadoSpeed : tornadoSpeed; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) Projectile.velocity.X *= 1.5f; } diff --git a/Projectiles/Boss/MoltenBlast.cs b/Projectiles/Boss/MoltenBlast.cs index 457affed38..664acc90b4 100644 --- a/Projectiles/Boss/MoltenBlast.cs +++ b/Projectiles/Boss/MoltenBlast.cs @@ -153,7 +153,7 @@ namespace CalamityMod.Projectiles.Boss for (int b = 0; b < blobAmt; b++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f) + additionalBlobVelocity; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) velocity *= 2f; Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)Math.Round(Projectile.damage * 0.75), 0f, Projectile.owner); diff --git a/Projectiles/Boss/PhantomMine.cs b/Projectiles/Boss/PhantomMine.cs index fcadc0e03b..98d97725c7 100644 --- a/Projectiles/Boss/PhantomMine.cs +++ b/Projectiles/Boss/PhantomMine.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.velocity *= Projectile.ai[0]; } - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (CalamityWorld.LegendaryMode) { if (Projectile.velocity.Length() >= Projectile.ai[0]) { diff --git a/Projectiles/Boss/ShadeNimbusHostile.cs b/Projectiles/Boss/ShadeNimbusHostile.cs index a4e68db418..cc42d08de0 100644 --- a/Projectiles/Boss/ShadeNimbusHostile.cs +++ b/Projectiles/Boss/ShadeNimbusHostile.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Boss else { Projectile.ai[0] += 1f; - if (Projectile.ai[0] >= (Main.getGoodWorld ? 10f : 36f)) + if (Projectile.ai[0] >= (CalamityWorld.LegendaryMode ? 10f : 36f)) { Projectile.ai[0] = 0f; int rainSpawnX = (int)(Projectile.position.X + 14f + (float)Main.rand.Next(Projectile.width - 28)); diff --git a/Projectiles/Boss/THanosSideLaser.cs b/Projectiles/Boss/THanosSideLaser.cs index 89b47ae15d..7ee16eee49 100644 --- a/Projectiles/Boss/THanosSideLaser.cs +++ b/Projectiles/Boss/THanosSideLaser.cs @@ -94,7 +94,7 @@ namespace CalamityMod.Projectiles.Boss // If a velocity is in reserve, set the true velocity to it and make it as "taken" by setting it to <0,0> if (Velocity != Vector2.Zero) { - Projectile.extraUpdates = Main.getGoodWorld ? 4 : 3; + Projectile.extraUpdates = CalamityWorld.LegendaryMode ? 4 : 3; Projectile.velocity = Velocity * (BossRushEvent.BossRushActive ? 1.25f : 1f); Velocity = Vector2.Zero; Projectile.netUpdate = true; diff --git a/Projectiles/Boss/ThanatosBeamStart.cs b/Projectiles/Boss/ThanatosBeamStart.cs index 1169549444..b0ae9f8529 100644 --- a/Projectiles/Boss/ThanatosBeamStart.cs +++ b/Projectiles/Boss/ThanatosBeamStart.cs @@ -137,7 +137,7 @@ namespace CalamityMod.Projectiles.Boss } // Periodically fire beams along the laser perpendicular to its direction. - float laserFireRate = (CalamityWorld.LegendaryMode && revenge) ? 60f : expertMode ? 80f : 160f; + float laserFireRate = (CalamityWorld.LegendaryMode) ? 60f : expertMode ? 80f : 160f; if (Main.npc[OwnerIndex].Calamity().newAI[2] % laserFireRate == 0f) { // Play a laser sound to go with the beams. @@ -157,7 +157,7 @@ namespace CalamityMod.Projectiles.Boss float radians = MathHelper.TwoPi / totalProjectiles; for (int j = 0; j < totalProjectiles; j++) { - Vector2 projVelocity = (CalamityWorld.LegendaryMode && revenge) ? new Vector2(Main.rand.Next(-12, 12), Main.rand.Next(-12, 12)) : Projectile.velocity.RotatedBy(radians * j + MathHelper.PiOver2) * 12f; + Vector2 projVelocity = (CalamityWorld.LegendaryMode) ? new Vector2(Main.rand.Next(-12, 12), Main.rand.Next(-12, 12)) : Projectile.velocity.RotatedBy(radians * j + MathHelper.PiOver2) * 12f; Projectile.NewProjectile(Projectile.GetSource_FromThis(), laserFirePosition, projVelocity, type, damage, 0f, Main.myPlayer, 0f, -1f); } laserFirePosition += beamDirection * distanceBetweenProjectiles; diff --git a/Projectiles/Boss/ThanatosLaser.cs b/Projectiles/Boss/ThanatosLaser.cs index 75739ff077..46d82f7611 100644 --- a/Projectiles/Boss/ThanatosLaser.cs +++ b/Projectiles/Boss/ThanatosLaser.cs @@ -98,7 +98,7 @@ namespace CalamityMod.Projectiles.Boss // If a velocity is in reserve, set the true velocity to it and make it as "taken" by setting it to <0,0> if (Velocity != Vector2.Zero) { - Projectile.extraUpdates = Main.getGoodWorld ? 4 : 3; + Projectile.extraUpdates = CalamityWorld.LegendaryMode ? 4 : 3; Projectile.velocity = Velocity * (BossRushEvent.BossRushActive ? 1.25f : 1f); Velocity = Vector2.Zero; Projectile.netUpdate = true; @@ -161,7 +161,7 @@ namespace CalamityMod.Projectiles.Boss // If a velocity is in reserve, set the true velocity to it and make it as "taken" by setting it to <0,0> if (Velocity != Vector2.Zero) { - Projectile.extraUpdates = Main.getGoodWorld ? 4 : 3; + Projectile.extraUpdates = CalamityWorld.LegendaryMode ? 4 : 3; Projectile.velocity = Velocity * (BossRushEvent.BossRushActive ? 1.25f : 1f); Velocity = Vector2.Zero; Projectile.netUpdate = true; diff --git a/Projectiles/Boss/UnstableCrimulanGlob.cs b/Projectiles/Boss/UnstableCrimulanGlob.cs index 71ac79c0a2..ae55efbd51 100644 --- a/Projectiles/Boss/UnstableCrimulanGlob.cs +++ b/Projectiles/Boss/UnstableCrimulanGlob.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.tileCollide = false; Projectile.timeLeft = BossRushEvent.BossRushActive ? 640 : CalamityWorld.death ? 490 : CalamityWorld.revenge ? 440 : Main.expertMode ? 390 : 240; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) Projectile.extraUpdates = 1; } diff --git a/Projectiles/Boss/UnstableEbonianGlob.cs b/Projectiles/Boss/UnstableEbonianGlob.cs index 89b77b7a77..48e4bc7d82 100644 --- a/Projectiles/Boss/UnstableEbonianGlob.cs +++ b/Projectiles/Boss/UnstableEbonianGlob.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.tileCollide = false; Projectile.timeLeft = BossRushEvent.BossRushActive ? 780 : CalamityWorld.death ? 600 : CalamityWorld.revenge ? 540 : Main.expertMode ? 480 : 300; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) Projectile.extraUpdates = 1; } diff --git a/Projectiles/Boss/YharonBulletHellVortex.cs b/Projectiles/Boss/YharonBulletHellVortex.cs index 4fde90ccdf..8497db0b18 100644 --- a/Projectiles/Boss/YharonBulletHellVortex.cs +++ b/Projectiles/Boss/YharonBulletHellVortex.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.hostile = true; Projectile.width = Projectile.height = (int)(408f * Projectile.scale); float inertia = 5f; - float speed = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 10.7f : 5.35f; + float speed = CalamityWorld.LegendaryMode ? 10.7f : 5.35f; float minDist = 160f; if (victim >= 0 && Main.player[victim].active && !Main.player[victim].dead) { @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Boss } // Fly away from other vortices - float pushForce = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.1f : 0.05f; + float pushForce = CalamityWorld.LegendaryMode ? 0.1f : 0.05f; for (int k = 0; k < Main.maxProjectiles; k++) { Projectile otherProj = Main.projectile[k]; diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index da046e41d1..62d606b23f 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -2677,7 +2677,7 @@ namespace CalamityMod.Projectiles Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0.3f; Main.dust[dust].velocity += projectile.velocity * 0.1f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) Main.dust[dust].noLight = true; } @@ -2727,7 +2727,7 @@ namespace CalamityMod.Projectiles Main.dust[dust].noGravity = true; Main.dust[dust].position = dustPosition; Main.dust[dust].velocity = dustVelocity; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) Main.dust[dust].noLight = true; } @@ -4824,7 +4824,7 @@ namespace CalamityMod.Projectiles projectile.position = vector76; projectile.width = projectile.height = 22; - if (Main.getGoodWorld && !Main.remixWorld) + if (CalamityWorld.LegendaryMode && !Main.remixWorld) { int num1011 = 4; Vector2 center3 = projectile.position; diff --git a/Scenes/MusicScenes/AquaticScourgeMusicScene.cs b/Scenes/MusicScenes/AquaticScourgeMusicScene.cs index c9689876c6..70fb82de7f 100644 --- a/Scenes/MusicScenes/AquaticScourgeMusicScene.cs +++ b/Scenes/MusicScenes/AquaticScourgeMusicScene.cs @@ -1,6 +1,7 @@ using CalamityMod.Events; using CalamityMod.NPCs; using CalamityMod.NPCs.AquaticScourge; +using CalamityMod.World; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -20,7 +21,7 @@ namespace CalamityMod.Systems { if (CalamityGlobalNPC.aquaticScourge == -1) return false; - return Main.npc[CalamityGlobalNPC.aquaticScourge].justHit || Main.npc[CalamityGlobalNPC.aquaticScourge].life <= Main.npc[CalamityGlobalNPC.aquaticScourge].lifeMax * 0.999 || BossRushEvent.BossRushActive || Main.getGoodWorld; + return Main.npc[CalamityGlobalNPC.aquaticScourge].justHit || Main.npc[CalamityGlobalNPC.aquaticScourge].life <= Main.npc[CalamityGlobalNPC.aquaticScourge].lifeMax * 0.999 || BossRushEvent.BossRushActive || CalamityWorld.LegendaryMode; } } } diff --git a/UI/VanillaBossBars/CeaselessVoidBossBar.cs b/UI/VanillaBossBars/CeaselessVoidBossBar.cs index 29fb7c446c..55c3541beb 100644 --- a/UI/VanillaBossBars/CeaselessVoidBossBar.cs +++ b/UI/VanillaBossBars/CeaselessVoidBossBar.cs @@ -40,7 +40,7 @@ namespace CalamityMod.UI.VanillaBossBars // Determine the shield health // Amount of Dark Energies expected from each phase/difficulty - int ExpectedBallsCounter = ((lifePercent <= 0.1f ? 3 : lifePercent <= 0.4f ? 2 : lifePercent <= 0.7f ? 1 : 0) + (CalamityWorld.death ? 6 : CalamityWorld.revenge ? 5 : Main.expertMode ? 4 : 3)) * (Main.getGoodWorld ? 6 : 3) + 2; + int ExpectedBallsCounter = ((lifePercent <= 0.1f ? 3 : lifePercent <= 0.4f ? 2 : lifePercent <= 0.7f ? 1 : 0) + (CalamityWorld.death ? 6 : CalamityWorld.revenge ? 5 : Main.expertMode ? 4 : 3)) * (CalamityWorld.LegendaryMode ? 6 : 3) + 2; // The Dark Energies will instantly all die at a certain point of their total max health float RatioToCombust = 0.2f; if (NPC.AnyNPCs(NPCType())) From 3b7f72a288058efd344d2fcb3484af8de99b7fac Mon Sep 17 00:00:00 2001 From: Xyk Date: Mon, 2 Jun 2025 20:51:52 -0700 Subject: [PATCH 04/47] Better balanced Orderbringer Also improved it's custom rarity and gave it the iri exc legacy name --- Items/CalamityGlobalItemTooltip.cs | 76 +++++++++++++++++------ Items/Weapons/Melee/Orderbringer.cs | 9 ++- Projectiles/Melee/OrderbringerBeam.cs | 4 +- Projectiles/Melee/OrderbringerWaveProj.cs | 15 ++--- Projectiles/Melee/StarofOrder.cs | 15 +++-- 5 files changed, 75 insertions(+), 44 deletions(-) diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index db7cb600a7..7d0e330974 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -291,24 +291,6 @@ namespace CalamityMod.Items { if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) nameLine.OverrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); - if (item.type == ModContent.ItemType()) - { - float rate = Main.GlobalTimeWrappedHourly * 15; - List eColors = new List() - { - Color.PaleVioletRed, - Color.Coral, - Color.Khaki, - Color.PaleGreen, - Color.Turquoise, - Color.Violet - }; - - int colorIndex = (int)(rate / 2 % eColors.Count); - Color currentColor = eColors[colorIndex]; - Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; - nameLine.OverrideColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); - } // Developer items if (item.type == ModContent.ItemType()) @@ -1677,6 +1659,64 @@ namespace CalamityMod.Items return false; } + + if (line.Name == "ItemName" && line.Mod == "Terraria" && item.type == ModContent.ItemType()) + { + Color rarityColor = Color.White; + Vector2 basePosition = new Vector2(line.X, line.Y); + + float rate = Main.GlobalTimeWrappedHourly * 29; + List eColors = new List() + { + Color.PaleVioletRed, + Color.Coral, + Color.Khaki, + Color.PaleGreen, + Color.Turquoise, + Color.Violet + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + Color usedColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + + float sine = (float)Math.Sin(Main.GlobalTimeWrappedHourly * 3 / MathHelper.Pi); + sine = (float)Math.Pow(MathHelper.Lerp(sine, 0, 0.35f), 5); + Vector2 backScale = line.BaseScale; + Color backColor = usedColor; + Vector2 shake = Main.rand.NextVector2Circular(15, 15) * sine; + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, null, null, null, null, Main.UIScaleMatrix); + + int draws = 20; + for (int i = 0; i < draws; i++) + { + shake = Main.rand.NextVector2Circular(15, 15) * sine; + Vector2 backPosition = basePosition + (MathHelper.TwoPi * i / 20f).ToRotationVector2() * (5 + 0.5f * sine); + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, shake * 4 + backPosition, backColor, line.Rotation, line.Origin, backScale, line.MaxWidth, line.Spread); + } + Texture2D texture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + Vector2 drawPosition = basePosition; + Color drawColor = backColor; + Vector2 rotationPoint = texture.Size() * 0.5f; + for (int i = 0; i < 6; i++) + { + int length = line.Text.Length; + Main.EntitySpriteDraw(texture, basePosition + Vector2.UnitX * length * 4 + Vector2.UnitY * 10 + Vector2.UnitX * (i % 2 == 0 ? -7 * i : 7 * i), null, drawColor, (MathHelper.PiOver2), rotationPoint, new Vector2(1 - 0.05f * i * (1 + 0.2f * -sine), 1 + 0.75f * i * (1 + 0.2f * sine) * 1f) * 0.3f * Main.rand.NextFloat(0.9f, 1f), SpriteEffects.None); + } + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Main.UIScaleMatrix); + + // Draw the front text as usual. + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, shake + basePosition, rarityColor, line.Rotation, line.Origin, line.BaseScale, line.MaxWidth, line.Spread); + + return false; + } return true; } #endregion diff --git a/Items/Weapons/Melee/Orderbringer.cs b/Items/Weapons/Melee/Orderbringer.cs index bf2bd4daed..505652d794 100644 --- a/Items/Weapons/Melee/Orderbringer.cs +++ b/Items/Weapons/Melee/Orderbringer.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; @@ -18,6 +17,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { [LegacyName("GreatswordofBlah")] + [LegacyName("IridescentExcalibur")] public class Orderbringer : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; @@ -34,9 +34,9 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = Item.height = 112; - Item.damage = 755; + Item.damage = 840; Item.DamageType = DamageClass.Melee; - Item.useAnimation = Item.useTime = 18; + Item.useAnimation = Item.useTime = 16; Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; Item.knockBack = 8f; @@ -77,7 +77,6 @@ namespace CalamityMod.Items.Weapons.Melee playSound = true; int dir = -Math.Sign(player.Center.X - player.Calamity().mouseWorld.X); float startRot = MathHelper.ToRadians(-90) * dir * (swingCount % 2 == 0 ? 1 : -1); - //player.itemRotation = player.Center.DirectionTo(player.Calamity().mouseWorld).ToRotation() + startRot; } public override void MeleeEffects(Player player, Rectangle hitbox) { @@ -143,7 +142,7 @@ namespace CalamityMod.Items.Weapons.Melee } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { - int beamDamage = player.CalcIntDamage(Item.damage * 0.5f); + int beamDamage = player.CalcIntDamage(Item.damage * 0.4f); Vector2 mouseClamped = player.ClampedMouseWorld(); SoundEngine.PlaySound(SoundID.Item84 with { Volume = 1f, Pitch = Main.rand.NextFloat(0.5f, 0.7f)}, player.Center); for (int i = 0; i < 2; i++) diff --git a/Projectiles/Melee/OrderbringerBeam.cs b/Projectiles/Melee/OrderbringerBeam.cs index 1a7eafdc0d..2fc3736a21 100644 --- a/Projectiles/Melee/OrderbringerBeam.cs +++ b/Projectiles/Melee/OrderbringerBeam.cs @@ -1,9 +1,7 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; -using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Melee/OrderbringerWaveProj.cs b/Projectiles/Melee/OrderbringerWaveProj.cs index 477ed7fbbe..c75a37a4ae 100644 --- a/Projectiles/Melee/OrderbringerWaveProj.cs +++ b/Projectiles/Melee/OrderbringerWaveProj.cs @@ -1,16 +1,11 @@ using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using CalamityMod.Particles; -using Terraria.ModLoader; -using CalamityMod.Projectiles.Ranged; -using Microsoft.Xna.Framework.Graphics; -using System.ComponentModel; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; -using Microsoft.Build.ObjectModelRemoting; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { diff --git a/Projectiles/Melee/StarofOrder.cs b/Projectiles/Melee/StarofOrder.cs index da986a53c7..958b843c75 100644 --- a/Projectiles/Melee/StarofOrder.cs +++ b/Projectiles/Melee/StarofOrder.cs @@ -1,13 +1,12 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using CalamityMod.Particles; -using Terraria.ModLoader; -using Microsoft.Xna.Framework.Graphics; -using System; +using System; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { From 42162baeb732b9a1776cdc965178bdf1c6aad845 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Tue, 3 Jun 2025 00:37:44 -0400 Subject: [PATCH 05/47] Princess sells Prismatic Lacewing --- NPCs/CalamityGlobalTownNPC.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index 37104cfa0b..330a259a1a 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -1251,6 +1251,7 @@ namespace CalamityMod.NPCs musicMod.TryFind("DevourerofGodsEulogyMusicBox", out ModItem eulogyBox); shop.AddWithCustomValue(ItemID.PrincessWeapon, Item.buyPrice(gold: 50), Condition.Hardmode) + .AddWithCustomValue(ItemID.EmpressButterfly, Item.buyPrice(gold: 15), Condition.InHallow) .Add(ItemType()) .AddWithCustomValue(interlude1Box.Type, Item.buyPrice(gold: 10), CalamityConditions.DownedCalamitasClone) .AddWithCustomValue(interlude2Box.Type, Item.buyPrice(gold: 10), Condition.DownedMoonLord) From 46339f2fc173c090d97669f690a35bed2c50d661 Mon Sep 17 00:00:00 2001 From: Xyk Date: Tue, 3 Jun 2025 01:15:00 -0700 Subject: [PATCH 06/47] Updated GoJ Is now more Orderbringer-like --- Items/Weapons/Melee/GreatswordofJudgement.cs | 151 ++++++++++++------ Items/Weapons/Melee/Orderbringer.cs | 4 +- ...Mods.CalamityMod.Items.Weapons.Melee.hjson | 6 +- Projectiles/Melee/JudgementProj.cs | 16 +- Projectiles/Melee/StarofJudgement.cs | 27 ++-- 5 files changed, 136 insertions(+), 68 deletions(-) diff --git a/Items/Weapons/Melee/GreatswordofJudgement.cs b/Items/Weapons/Melee/GreatswordofJudgement.cs index 19486833cb..5b0b5fb1a8 100644 --- a/Items/Weapons/Melee/GreatswordofJudgement.cs +++ b/Items/Weapons/Melee/GreatswordofJudgement.cs @@ -1,85 +1,144 @@ -using CalamityMod.Dusts; +using System; +using CalamityMod.Items.Materials; using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Terraria; using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { public class GreatswordofJudgement : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; - private float swingRoatation = 0; - private int time = 0; - private Color mainColor; - private int swordDirection; - private int useTime = 20; - private int opacityAdjust = 0; - private float smearOpacity = 0; + public int time = 0; + public Vector2 bladeHitboxPos; + public float bladeRotation = 0; + public int bladeDirection = 0; + public float completion = 0; + public bool canHit => (completion >= 0.35f && completion <= 0.8f); + public int swingCount = 0; + public bool spawnProj = true; + public bool playSound = true; + + public Color clr = Color.MediumOrchid; + public override void SetDefaults() { Item.width = 78; Item.height = 78; - Item.damage = 155; + Item.damage = 240; Item.DamageType = DamageClass.Melee; Item.useStyle = ItemUseStyleID.Swing; - Item.useAnimation = Item.useTime = useTime; + Item.useAnimation = Item.useTime = 20; Item.useTurn = true; Item.knockBack = 7f; - Item.UseSound = SoundID.Item60; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 5f; + Item.shootSpeed = 5.5f; + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + return false; } public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) { - float scale = 1.1f; + // Basically just insures the enemy is always able to be hit if they're in range, the actual collision check is done in CanHitNPC + float scale = 8f; Vector2 newSize = new Point(hitbox.Width, hitbox.Height).ToVector2() * scale; - hitbox = new Rectangle(hitbox.X - (int)((newSize.X - hitbox.Width) / 2f), hitbox.Y - (int)((newSize.Y - hitbox.Height) / 2f), (int)newSize.X, (int)newSize.Y); + hitbox = new Rectangle((int)(bladeHitboxPos.X - newSize.X / 2f), (int)(bladeHitboxPos.Y - newSize.Y / 2f), (int)newSize.X, (int)newSize.Y); + } + public override bool? CanHitNPC(Player player, NPC target) + { + Vector2 mPos = player.Calamity().mouseWorld; + Vector2 shootDir = player.Center.DirectionTo(mPos); + float _ = float.NaN; + bool hitCheck = Collision.CheckAABBvLineCollision(target.Hitbox.TopLeft(), target.Hitbox.Size(), player.Center - shootDir * 30, player.Center + shootDir * 145, Item.width * 3f, ref _); + return ((canHit && hitCheck) ? null : false); } public override void UseAnimation(Player player) { - swordDirection = player.direction; + swingCount++; time = 0; - swingRoatation = 0; - mainColor = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; - opacityAdjust = 0; - smearOpacity = 0; + bladeDirection = player.direction; + bladeHitboxPos = player.Center; + bladeRotation = 0; + spawnProj = true; + playSound = true; + int dir = -Math.Sign(player.Center.X - player.Calamity().mouseWorld.X); + float startRot = MathHelper.ToRadians(-90) * dir * (swingCount % 2 == 0 ? 1 : -1); + + clr = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; } public override void MeleeEffects(Player player, Rectangle hitbox) { - opacityAdjust++; - if (opacityAdjust >= 5 && opacityAdjust <= 15 && smearOpacity < 0.9f) - smearOpacity += 0.1f; - else if (smearOpacity > 0) - smearOpacity -= 0.2f; + Vector2 mPos = player.Calamity().mouseWorld; + completion = (float)((float)time / ((float)(Item.useAnimation / player.GetAttackSpeed(DamageClass.Melee)))); + int dir = -Math.Sign(player.Center.X - mPos.X); + + float startRot = MathHelper.ToRadians(-110) * dir * (swingCount % 2 == 0 ? 1 : -1); + float endRot = MathHelper.ToRadians(-110) * dir * (swingCount % 2 == 0 ? -1 : 1); + float minRot = MathHelper.ToRadians(-150) * dir * (swingCount % 2 == 0 ? 1 : -1); + float cutoff = 0.2f; + float cutoff2 = 0.95f; + + Vector2 shootDir = player.Center.DirectionTo(mPos) * Item.shootSpeed; + + if (completion <= cutoff) + { + float lerp = Utils.GetLerpValue(0, cutoff, completion, true); + player.itemRotation = player.Center.DirectionTo(mPos).ToRotation() + MathHelper.Lerp(startRot, minRot, CalamityUtils.EaseInOutExp(lerp, 4f, 4f)); + player.itemRotation += (MathHelper.Pi) * (dir == 1 ? 0 : 1) + MathHelper.PiOver4 * dir; + } + else + { + if (playSound) + { + SoundStyle swing = new("CalamityMod/Sounds/Item/SwooshMid"); + SoundEngine.PlaySound(swing with { Pitch = Main.rand.NextFloat(0.1f, 0.3f), Volume = 1f }, player.Center); + playSound = false; + } + if (completion >= 0.65f && spawnProj) + { + Projectile.NewProjectile(player.GetSource_FromThis(), player.Center, shootDir, Item.shoot, Item.damage, Item.knockBack, player.whoAmI, 0f); + + Particle swipe = new CustomSpark(player.Center - shootDir * 5, shootDir.RotatedBy(0.4f * (dir * (swingCount % 2 == 0 ? 1 : -1))) * 2.5f, "CalamityMod/Particles/VerticalSmearLarge", false, (int)(14 / player.GetAttackSpeed(DamageClass.Melee)), 0.6f, clr, new Vector2(1f, 1f), true, false, 0, false, false); + GeneralParticleHandler.SpawnParticle(swipe); + + SoundEngine.PlaySound(SoundID.Item60, player.Center); + spawnProj = false; + } + float lerp = Utils.GetLerpValue(cutoff, cutoff2, completion, true); + player.itemRotation = player.Center.DirectionTo(mPos).ToRotation() + MathHelper.Lerp(minRot, endRot, CalamityUtils.EaseInOutExp(lerp, 6f, 2f)); + player.itemRotation += (MathHelper.Pi) * (dir == 1 ? 0 : 1) + MathHelper.PiOver4 * dir; + } + + float extraRot = (dir == 1 ? -MathHelper.PiOver4 : MathHelper.ToRadians(225)); + bladeHitboxPos = player.Center + (player.itemRotation + extraRot).ToRotationVector2() * 180; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, player.itemRotation + MathHelper.ToRadians(-130) * dir); + player.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, player.itemRotation + MathHelper.ToRadians(-130) * dir); + + player.itemLocation = player.Center; + player.direction = dir; time++; - swingRoatation += swordDirection == 1 ? 0.13f : -0.13f; - - float Rot = (swordDirection == -1 ? 1.8f : -1.8f) + swingRoatation; - if (swordDirection != player.direction) + } + public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) + { + int beamDamage = player.CalcIntDamage(Item.damage * 0.4f); + Vector2 mouseClamped = player.ClampedMouseWorld(); + SoundEngine.PlaySound(SoundID.Item84 with { Volume = 1f, Pitch = Main.rand.NextFloat(0.5f, 0.7f) }, player.Center); + for (int i = 0; i < 2; i++) { - swingRoatation *= -1; - swordDirection = player.direction; - } - Particle Smear = new SemiCircularSmearFade(player.Center, Vector2.Zero, mainColor * smearOpacity, Rot, Main.rand.NextFloat(1.95f, 2.2f), new Vector2(1, 1), 2, true, false, true, player.direction); - GeneralParticleHandler.SpawnParticle(Smear); - - if (Main.rand.NextBool(3)) - { - Vector2 dustVel = new Vector2(5 * swordDirection, -5).RotatedByRandom(1.55f) * Main.rand.NextFloat(0.7f, 1.3f); - Dust dust = Dust.NewDustPerfect(player.Center + dustVel * 9, 278); - dust.scale = Main.rand.NextFloat(0.4f, 0.55f); - dust.velocity = dustVel * 0.55f; - dust.color = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; - dust.noGravity = true; + Vector2 vel = player.Center.DirectionFrom(target.Center).RotatedByRandom(0.7f) * Main.rand.NextFloat(18, 20); + Projectile.NewProjectile(player.GetSource_ItemUse(Item), player.Center, vel, ModContent.ProjectileType(), beamDamage, 0, player.whoAmI, 0, (i == 0 ? -1 : 1), 1); } } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) @@ -90,6 +149,8 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(ItemID.LunarBar, 7). + AddIngredient(). + AddIngredient(5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Melee/Orderbringer.cs b/Items/Weapons/Melee/Orderbringer.cs index 505652d794..2a05c47c20 100644 --- a/Items/Weapons/Melee/Orderbringer.cs +++ b/Items/Weapons/Melee/Orderbringer.cs @@ -25,7 +25,6 @@ namespace CalamityMod.Items.Weapons.Melee public Vector2 bladeHitboxPos; public float bladeRotation = 0; public int bladeDirection = 0; - public float bladeFX = 0; public float completion = 0; public bool canHit => (completion >= 0.35f && completion <= 0.8f); public int swingCount = 0; @@ -62,7 +61,7 @@ namespace CalamityMod.Items.Weapons.Melee Vector2 mPos = player.Calamity().mouseWorld; Vector2 shootDir = player.Center.DirectionTo(mPos); float _ = float.NaN; - bool hitCheck = Collision.CheckAABBvLineCollision(target.Hitbox.TopLeft(), target.Hitbox.Size(), player.Center, player.Center + shootDir * 245, Item.width * 3f, ref _); + bool hitCheck = Collision.CheckAABBvLineCollision(target.Hitbox.TopLeft(), target.Hitbox.Size(), player.Center - shootDir * 30, player.Center + shootDir * 245, Item.width * 3f, ref _); return ((canHit && hitCheck) ? null : false); } public override void UseAnimation(Player player) @@ -72,7 +71,6 @@ namespace CalamityMod.Items.Weapons.Melee bladeDirection = player.direction; bladeHitboxPos = player.Center; bladeRotation = 0; - bladeFX = 0; spawnProj = true; playSound = true; int dir = -Math.Sign(player.Center.X - player.Calamity().mouseWorld.X); diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index 31ed7e73a1..f51d72f7fb 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -695,7 +695,11 @@ GrandGuardian: { GreatswordofJudgement: { DisplayName: Greatsword of Judgement - Tooltip: Fires a piercing energy wave that releases homing stars as it flies + Tooltip: + ''' +Fires a piercing energy wave that releases homing stars as it flies +Hits with the blade summon two stronger stars from behind you + ''' } Greentide: { diff --git a/Projectiles/Melee/JudgementProj.cs b/Projectiles/Melee/JudgementProj.cs index 583ad48e1e..9065cf775f 100644 --- a/Projectiles/Melee/JudgementProj.cs +++ b/Projectiles/Melee/JudgementProj.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -26,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.tileCollide = false; Projectile.timeLeft = 450; Projectile.DamageType = DamageClass.Melee; - Projectile.extraUpdates = 9; + Projectile.extraUpdates = 14; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; } @@ -49,10 +50,10 @@ namespace CalamityMod.Projectiles.Melee Projectile.scale += 0.0026f; hitboxSize += 0.4525f; Projectile.velocity *= 0.995f; - // Spawn 3 - if (time % 50 == 0 && time > 10) + // Spawn 2 + if (time % 85 == 0 && time > 10) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Main.rand.NextVector2Circular(hitboxSize * 0.8f, hitboxSize * 0.8f) - Projectile.velocity * 2, (-Projectile.velocity * 3).RotatedByRandom(0.9f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.2f), 3f, Projectile.owner, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Main.rand.NextVector2Circular(hitboxSize * 0.8f, hitboxSize * 0.8f) - Projectile.velocity * 2, (-Projectile.velocity * 3).RotatedByRandom(0.9f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.35f), 3f, Projectile.owner, 0f); } } else @@ -80,7 +81,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool(3)) { - Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(hitboxSize, hitboxSize) - Projectile.velocity * 2, 66); + Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(hitboxSize, hitboxSize) - Projectile.velocity * 2, ModContent.DustType()); trailDust.scale = Main.rand.NextFloat(0.7f, 0.85f) - (time < 150 ? 0 : time * 0.001f); trailDust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.85f, 1.5f); trailDust.color = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; @@ -102,11 +103,10 @@ namespace CalamityMod.Projectiles.Melee { Texture2D tex = ModContent.Request(Texture).Value; float waveFade = Utils.GetLerpValue(0, 300, Projectile.timeLeft); - Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, mainColor with { A = 0 } * fadeOut, Projectile.rotation, tex.Size() / 2f, new Vector2(1 - (0.2f * waveFade), 1 + (0.45f * waveFade)) * Projectile.scale, SpriteEffects.None, 0); + for (int i = 0; i < 5; i++) + Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition + (Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * 9 * i, null, mainColor with { A = 0 } * fadeOut * 0.6f, Projectile.rotation, tex.Size() / 2f, new Vector2(1 - (0.2f * waveFade) + 0.01f * i, 1 + (0.45f * waveFade) - 0.06f * i) * Projectile.scale, SpriteEffects.None, 0); return false; } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { if (Projectile.numHits > 0) diff --git a/Projectiles/Melee/StarofJudgement.cs b/Projectiles/Melee/StarofJudgement.cs index c272f3cc2c..fb825f10b1 100644 --- a/Projectiles/Melee/StarofJudgement.cs +++ b/Projectiles/Melee/StarofJudgement.cs @@ -7,6 +7,7 @@ using Terraria.ModLoader; using Microsoft.Xna.Framework.Graphics; using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; namespace CalamityMod.Projectiles.Melee { @@ -44,27 +45,33 @@ namespace CalamityMod.Projectiles.Melee Projectile.scale = (Projectile.ai[2] == 1 ? 0.75f : 0.5f); if (Projectile.ai[2] == 1) { - Projectile.localNPCHitCooldown = 7; - Projectile.penetrate = 4; + Projectile.localNPCHitCooldown = -1; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; } } Projectile.rotation += (Projectile.velocity.X + MathF.Abs(Projectile.velocity.Y) * Projectile.direction) * 0.01f; if (Projectile.ai[2] == 1) { - CalamityUtils.HomeInOnNPC(Projectile, true, 900f, 25, MathHelper.Clamp(30 - time, 15, 30)); - if (Main.rand.NextBool(4) && Projectile.numHits < 1) + if (time > 18) { - Particle spark = new GlowOrbParticle(Projectile.Center + Main.rand.NextVector2Circular(7, 7) - Projectile.velocity, -Projectile.velocity * Main.rand.NextFloat(0.5f, 0.8f), false, 13, 1f, mainColor * 0.5f); + CalamityUtils.HomeInOnNPC(Projectile, true, 900f, 25, MathHelper.Clamp(30 - time, 15, 30)); + } + else + Projectile.velocity = Projectile.velocity.RotatedBy(0.085f * Projectile.ai[1]); + if (time % 2 == 0) + { + Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity * 0.2f, "CalamityMod/Particles/BloomCircle", false, 13, 0.35f, mainColor * 0.75f, new Vector2(0.8f, 1.35f), true, false, shrinkSpeed: 0.3f); GeneralParticleHandler.SpawnParticle(spark); } } - else if (time > 15) + if (Projectile.ai[2] != 1 && time > 10) { CalamityUtils.HomeInOnNPC(Projectile, true, 700f * (Projectile.numHits > 1 ? 2 : 1), 20, 20f * (Projectile.numHits > 1 ? 5 : 1)); if (Main.rand.NextBool(3)) { - Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5) - Projectile.velocity, 66); + Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5) - Projectile.velocity, ModContent.DustType()); trailDust.scale = Main.rand.NextFloat(0.7f, 0.85f); trailDust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.5f); trailDust.color = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; @@ -84,6 +91,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 rotationPoint = texture.Size() * 0.5f; CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], drawColor * 0.5f, 1, texture, true, true); Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale, SpriteEffects.None); + Main.EntitySpriteDraw(texture, drawPosition, null, Color.White with { A = 0 }, drawRotation, rotationPoint, Projectile.scale * 0.8f, SpriteEffects.None); return false; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) @@ -91,14 +99,11 @@ namespace CalamityMod.Projectiles.Melee if (!target.CanBeChasedBy()) Projectile.penetrate++; - int buffType = ModContent.BuffType(); - target.AddBuff(buffType, 60); - if (Projectile.ai[2] == 0) { Projectile.timeLeft = 180; time = 0; - Projectile.velocity *= 1.2f; + Projectile.velocity *= 1.1f; } } public override void OnKill(int timeLeft) From d74790a8184781069529fc6b20c4328cbd93bcee Mon Sep 17 00:00:00 2001 From: Xyk Date: Tue, 3 Jun 2025 01:22:37 -0700 Subject: [PATCH 07/47] Fixed Void Vortex MP bug --- Projectiles/Magic/VoidVortexProj.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Projectiles/Magic/VoidVortexProj.cs b/Projectiles/Magic/VoidVortexProj.cs index c0a5cfbf3f..314b58ac56 100644 --- a/Projectiles/Magic/VoidVortexProj.cs +++ b/Projectiles/Magic/VoidVortexProj.cs @@ -145,9 +145,12 @@ namespace CalamityMod.Projectiles.Magic Projectile.ExpandHitboxBy(400); Projectile.Damage(); - for (int k = 0; k < 12; k++) + if (Main.myPlayer == Projectile.owner) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(10, 10).RotatedByRandom(100) * Main.rand.NextFloat(0.4f, 0.55f), ModContent.ProjectileType(), Projectile.damage / 6, 0f, Main.myPlayer, 0f, 0f, 3f); + for (int k = 0; k < 12; k++) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(10, 10).RotatedByRandom(100) * Main.rand.NextFloat(0.4f, 0.55f), ModContent.ProjectileType(), Projectile.damage / 6, 0f, Main.myPlayer, 0f, 0f, 3f); + } } for (int k = 0; k < 40; k++) { From 2834b0bc3462b58222c91d793709b19d2f418e50 Mon Sep 17 00:00:00 2001 From: Xyk Date: Tue, 3 Jun 2025 01:50:38 -0700 Subject: [PATCH 08/47] Small Vitriolic Viper fix --- Projectiles/Magic/VitriolicViperSpit.cs | 2 +- Sounds/Item/ViperSpit.ogg | Bin 29278 -> 26419 bytes 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/Projectiles/Magic/VitriolicViperSpit.cs b/Projectiles/Magic/VitriolicViperSpit.cs index 3dbd357902..441f6044a2 100644 --- a/Projectiles/Magic/VitriolicViperSpit.cs +++ b/Projectiles/Magic/VitriolicViperSpit.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Magic } if (time > 3) - Projectile.Center += offset * direction; + Projectile.Center += offset * direction * Utils.GetLerpValue(3, 10, time, true); if (time > 3 && targetDist < 1400) { diff --git a/Sounds/Item/ViperSpit.ogg b/Sounds/Item/ViperSpit.ogg index b7fb928fa1c480cd7783377cdda1e74527d7f0c8..2be1d386cd0f6a594edcf3383e860c10a30d3738 100644 GIT binary patch delta 25214 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�#r8SE|HNh3AzY=?bONfu{Oef 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 Date: Tue, 3 Jun 2025 01:51:16 -0700 Subject: [PATCH 09/47] Dragon's Breath barrel miss protection --- Projectiles/Ranged/DragonsBreathFlames.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Projectiles/Ranged/DragonsBreathFlames.cs b/Projectiles/Ranged/DragonsBreathFlames.cs index d6a65bac8e..cec31f3c36 100644 --- a/Projectiles/Ranged/DragonsBreathFlames.cs +++ b/Projectiles/Ranged/DragonsBreathFlames.cs @@ -229,7 +229,18 @@ namespace CalamityMod.Projectiles.Ranged target.AddBuff(ModContent.BuffType(), 240); } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.ai[1] == 1 ? 4 : Projectile.width + Time * 0.1f, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + Player Owner = Main.player[Projectile.owner]; + if (Time <= 1) + { + float _ = float.NaN; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Owner.Center, Projectile.width, ref _); + } + else + return CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.ai[1] == 1 ? 4 : Projectile.width + Time * 0.1f, targetHitbox); + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { if (Projectile.numHits > 0) From ce75b3058af85d4ed463b5f452be6c4f110c9c5c Mon Sep 17 00:00:00 2001 From: Xyk Date: Tue, 3 Jun 2025 01:51:33 -0700 Subject: [PATCH 10/47] Vanquisher Arrow rotation fix --- Projectiles/Ranged/VanquisherArrowProj.cs | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/Projectiles/Ranged/VanquisherArrowProj.cs b/Projectiles/Ranged/VanquisherArrowProj.cs index 30c1d474cd..4d5556908d 100644 --- a/Projectiles/Ranged/VanquisherArrowProj.cs +++ b/Projectiles/Ranged/VanquisherArrowProj.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.Graphics.Metaballs; using CalamityMod.Items.Ammo; using CalamityMod.Particles; using CalamityMod.Projectiles.Typeless; @@ -26,6 +27,8 @@ namespace CalamityMod.Projectiles.Ranged public float HomingTime = 0; public Color MainColor; public NPC targeted; + public int rotDir = 0; + public float rotSpeed = 0; public override void SetStaticDefaults() { ProjectileID.Sets.CultistIsResistantTo[Type] = true; @@ -64,6 +67,8 @@ namespace CalamityMod.Projectiles.Ranged if (Time == 0) { + rotDir = (Main.rand.NextBool() ? -1 : 1); + rotSpeed = Main.rand.NextFloat(0.8f, 1.1f); Projectile.scale = 0.014f; Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 7f; ProjectileSpeed = 30; @@ -96,34 +101,20 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.timeLeft++; CalamityUtils.HomeInOnSelectedNPC(Projectile, targeted, true, 0.65f, 7, 0.98f, 0.95f, true); - //CalamityUtils.HomeInOnNPC(Projectile, true, 2000f, 12, 200f); } else if (Projectile.velocity.Length() < 7) Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.velocity.SafeNormalize(Vector2.UnitX) * 7f, 0.04f); if (HomingTime > 1) { HomingTime--; - Projectile.velocity = Projectile.velocity.RotatedByRandom(0.09f); + Projectile.velocity = Projectile.velocity.RotatedBy(0.2f * rotDir * rotSpeed * Utils.GetLerpValue(15, 5, HomingTime, true)); } Time++; } - - public override void PostDraw(Color lightColor) - { - //Color color = Color.White; - //Rectangle frame = new Rectangle(0, 0, Terraria.GameContent.TextureAssets.Projectile[Type].Value.Width, Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height); - //Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Items/Ammo/VanquisherArrowGlow").Value, Projectile.Center - Main.screenPosition, frame, color, Projectile.rotation, Projectile.Size / 2, 1f, SpriteEffects.None, 0); - } - - public override Color? GetAlpha(Color lightColor) - { - return lightColor; - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - HomingTime = Main.rand.Next(10, 20 + 1) * Projectile.extraUpdates; + HomingTime = Main.rand.Next(12, 15 + 1) * Projectile.extraUpdates; target.AddBuff(ModContent.BuffType(), 180); } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) From 02060a0a80663c4c2b432a662466a5b5022e622c Mon Sep 17 00:00:00 2001 From: Xyk Date: Tue, 3 Jun 2025 04:21:57 -0700 Subject: [PATCH 11/47] Fixed small stuff on Xyk's Blessing And gave them custom tooltip effects --- CalPlayer/CalamityPlayer.cs | 1 + CalPlayer/CalamityPlayerMiscEffects.cs | 15 +- Items/Accessories/Vanity/XyksBlessingBlue.cs | 7 +- .../Accessories/Vanity/XyksBlessingOrange.cs | 6 +- Items/CalamityGlobalItemTooltip.cs | 123 ++++++++++++ .../Mods.CalamityMod.Items.Accessories.hjson | 4 +- Projectiles/Typeless/XykWings.cs | 177 +++++++++--------- 7 files changed, 231 insertions(+), 102 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 3ad266c8db..8e722d25a9 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -957,6 +957,7 @@ namespace CalamityMod.CalPlayer public bool XykVisualsBlue = false; public bool XykVisualsOrange = false; public Color XykFXColor = Color.Black; + public int XykWingTimer = 0; public bool manaOverloader = false; /// Used for allowing Calamity slimes to be affected by Royal Gel. public bool royalGel = false; diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index bbbc40946b..a9a450e91a 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -254,12 +254,21 @@ namespace CalamityMod.CalPlayer foreach (Projectile p in Main.ActiveProjectiles) if (p.type == ModContent.ProjectileType() && p.owner == Player.whoAmI && p.ai[1] == 0) numOfActiveWings++; - bool spawnWings = numOfActiveWings < maxWingPieces && !Player.dead && Player.wingsLogic > 0 && !(Player.wingTime == Player.wingTimeMax && Player.velocity.Y == 0) && Player.wingTime > 0; + bool spawnWings = numOfActiveWings < maxWingPieces && !Player.dead && Player.wingsLogic > 0 && ((!(Player.wingTime == Player.wingTimeMax && Player.velocity.Y == 0) && Player.wingTime > 0) || XykWingTimer >= 3); if (spawnWings) { - int wingCount = numOfActiveWings; - Projectile wings = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Player.whoAmI, wingCount); + if (XykWingTimer >= 3) + { + int wingCount = numOfActiveWings; + Projectile wings = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Player.whoAmI, wingCount); + if (numOfActiveWings + 1 == maxWingPieces) + XykWingTimer = 0; + } + else + XykWingTimer++; } + else + XykWingTimer = 0; } // First Frame dash effects diff --git a/Items/Accessories/Vanity/XyksBlessingBlue.cs b/Items/Accessories/Vanity/XyksBlessingBlue.cs index 7df7a6b928..0ebe73db84 100644 --- a/Items/Accessories/Vanity/XyksBlessingBlue.cs +++ b/Items/Accessories/Vanity/XyksBlessingBlue.cs @@ -22,7 +22,6 @@ namespace CalamityMod.Items.Accessories.Vanity EquipLoader.AddEquipTexture(Mod, "CalamityMod/Projectiles/InvisibleProj", EquipType.Wings, this); } } - public override void SetStaticDefaults() { if (Main.dedServ) @@ -44,17 +43,15 @@ namespace CalamityMod.Items.Accessories.Vanity Item.width = 36; Item.height = 34; Item.accessory = true; - Item.consumable = true; Item.vanity = true; Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.Calamity().devItem = true; } public override bool CanRightClick() => true; - - public override void ModifyItemLoot(ItemLoot itemLoot) + public override void RightClick(Player player) { - itemLoot.Add(ModContent.ItemType()); + player.PutItemInInventoryFromItemUsage(ModContent.ItemType(), 1); } public override void UpdateVanity(Player player) { diff --git a/Items/Accessories/Vanity/XyksBlessingOrange.cs b/Items/Accessories/Vanity/XyksBlessingOrange.cs index 29f2d69f89..9e20a49940 100644 --- a/Items/Accessories/Vanity/XyksBlessingOrange.cs +++ b/Items/Accessories/Vanity/XyksBlessingOrange.cs @@ -44,17 +44,15 @@ namespace CalamityMod.Items.Accessories.Vanity Item.width = 36; Item.height = 34; Item.accessory = true; - Item.consumable = true; Item.vanity = true; Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.Calamity().devItem = true; } public override bool CanRightClick() => true; - - public override void ModifyItemLoot(ItemLoot itemLoot) + public override void RightClick(Player player) { - itemLoot.Add(ModContent.ItemType()); + player.PutItemInInventoryFromItemUsage(ModContent.ItemType(), 1); } public override void UpdateVanity(Player player) { diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index 2a35ce43b4..5cd62ffeb2 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -6,6 +6,7 @@ using CalamityMod.Balancing; using CalamityMod.CustomRecipes; using CalamityMod.DataStructures; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Armor.Demonshade; using CalamityMod.Items.PermanentBoosters; using CalamityMod.Items.Tools; @@ -1633,6 +1634,128 @@ namespace CalamityMod.Items #region Enchanted Rarity Text Drawing public override bool PreDrawTooltipLine(Item item, DrawableTooltipLine line, ref int yOffset) { + if (line.Name == "ItemName" && line.Mod == "Terraria" && item.type == ModContent.ItemType()) + { + Color rarityColor = Color.White; + Vector2 basePosition = new Vector2(line.X, line.Y); + + float rate = Main.GlobalTimeWrappedHourly * 6; + List eColors = new List() + { + Color.DodgerBlue, + Color.Cyan, + Color.RoyalBlue + }; + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + Color usedColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + Vector2 backScale = line.BaseScale; + Color backColor = usedColor; + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, null, null, null, null, Main.UIScaleMatrix); + + int draws = 20; + for (int i = 0; i < draws; i++) + { + Vector2 backPosition = basePosition + (MathHelper.TwoPi * i / 20f).ToRotationVector2() * (3.5f); + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, backPosition, backColor, line.Rotation, line.Origin, backScale, line.MaxWidth, line.Spread); + } + Texture2D texture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Texture2D square = ModContent.Request("CalamityMod/Particles/BloomRing").Value; + + Vector2 drawPosition = basePosition; + Color drawColor = backColor; + Vector2 rotationPoint = texture.Size() * 0.5f; + int length = line.Text.Length; + for (int i = 0; i < 8; i++) + { + Main.EntitySpriteDraw(texture, basePosition + Vector2.UnitX * length * 4 + Vector2.UnitY * 23 + Vector2.UnitX * (i % 2 == 0 ? -10 * i : 10 * i), null, drawColor, (MathHelper.PiOver2), rotationPoint, new Vector2(0.3f - 0.02f * i, 1 + 0.35f * i) * 0.3f * Main.rand.NextFloat(0.9f, 1f), SpriteEffects.None); + } + for (int i = 0; i < 10; i++) + { + float sine = (float)Math.Sin(Main.GlobalTimeWrappedHourly * (0 + i * 0.8f) / MathHelper.Pi); + float sine2 = (float)Math.Sin(Main.GlobalTimeWrappedHourly * (5) / MathHelper.Pi); + float squareSine = (float)Math.Sin(i * 2.5f / MathHelper.Pi); + float clockSine = (float)Math.Sin((float)Math.Pow(Utils.GetLerpValue(0, 110, ((int)(Main.GlobalTimeWrappedHourly * (60 + i * 2)) % 120)), 5)); + Vector2 weirdPos = Vector2.UnitX * 53 * i * (Utils.GetLerpValue(20, 0, i, true)) + Vector2.UnitY * -23 * squareSine * sine2 + new Vector2(5, 10); + for (int t = 0; t < 3; t++) + Main.EntitySpriteDraw(square, basePosition + weirdPos, null, drawColor * (1 - 0.03f * i), 0, square.Size() * 0.5f, (1.2f - 0.07f * t) * new Vector2(1, 1) * (0.25f * ((float)Math.Pow(Utils.GetLerpValue(11, 0, i, true), 3) + 0.2f)), SpriteEffects.None); + for (int t = 0; t < 3; t++) + Main.EntitySpriteDraw(texture, basePosition + weirdPos, null, drawColor * (1 - 0.03f * i), 0, texture.Size() * 0.5f, (0.65f - 0.07f * t) * new Vector2(1, 1) * (0.25f * ((float)Math.Pow(Utils.GetLerpValue(11, 0, i, true), 3) + 0.2f)), SpriteEffects.None); + } + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Main.UIScaleMatrix); + + // Draw the front text as usual. + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, basePosition, rarityColor, line.Rotation, line.Origin, line.BaseScale, line.MaxWidth, line.Spread); + + return false; + } + if (line.Name == "ItemName" && line.Mod == "Terraria" && item.type == ModContent.ItemType()) + { + Color rarityColor = Color.White; + Vector2 basePosition = new Vector2(line.X, line.Y); + + float rate = Main.GlobalTimeWrappedHourly * 6; + List eColors = new List() + { + new Color(248, 117, 52), + Color.Gold, + Color.Orange + }; + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + Color usedColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + Vector2 backScale = line.BaseScale; + Color backColor = usedColor; + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, null, null, null, null, Main.UIScaleMatrix); + + int draws = 20; + for (int i = 0; i < draws; i++) + { + Vector2 backPosition = basePosition + (MathHelper.TwoPi * i / 20f).ToRotationVector2() * (3.5f); + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, backPosition, backColor, line.Rotation, line.Origin, backScale, line.MaxWidth, line.Spread); + } + Texture2D texture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Texture2D texture2 = ModContent.Request("CalamityMod/Particles/SquareRotated").Value; + Texture2D square = ModContent.Request("CalamityMod/Particles/GlowSquareParticleThick").Value; + + Vector2 drawPosition = basePosition; + Color drawColor = backColor; + Vector2 rotationPoint = texture.Size() * 0.5f; + int length = line.Text.Length; + for (int i = 0; i < 8; i++) + { + Main.EntitySpriteDraw(texture, basePosition + Vector2.UnitX * length * 4 + Vector2.UnitY * 23 + Vector2.UnitX * (i % 2 == 0 ? -10 * i : 10 * i), null, drawColor, (MathHelper.PiOver2), rotationPoint, new Vector2(0.3f - 0.02f * i, 1 + 0.35f * i) * 0.3f * Main.rand.NextFloat(0.9f, 1f), SpriteEffects.None); + } + for (int i = 0; i < 10; i++) + { + float sine = (float)Math.Sin(Main.GlobalTimeWrappedHourly * (0 + i * 0.8f) / MathHelper.Pi); + float squareSine = (float)Math.Sin(i * 2.5f / MathHelper.Pi); + float clockSine = (float)Math.Sin((float)Math.Pow(Utils.GetLerpValue(0, 110, ((int)(Main.GlobalTimeWrappedHourly * (60 + i * 2)) % 120)), 5)); + Vector2 weirdPos = Vector2.UnitX * 53 * i * (Utils.GetLerpValue(20, 0, i, true)) + Vector2.UnitY * 23 * squareSine + Vector2.UnitY * 5.5f * sine + new Vector2(5, 10); + for (int t = 0; t < 3; t++) + Main.EntitySpriteDraw(square, basePosition + weirdPos, null, drawColor * (1 - 0.03f * i), clockSine * MathHelper.PiOver2 + MathHelper.PiOver4, square.Size() * 0.5f, (1 - 0.07f * t) * new Vector2(1, 1) * (0.25f * ((float)Math.Pow(Utils.GetLerpValue(11, 0, i, true), 3) + 0.2f)), SpriteEffects.None); + for (int t = 0; t < 3; t++) + Main.EntitySpriteDraw(texture2, basePosition + weirdPos, null, drawColor * (1 - 0.03f * i), clockSine * MathHelper.PiOver2, texture2.Size() * 0.5f, (0.6f - 0.07f * t) * new Vector2(1, 1) * (0.25f * ((float)Math.Pow(Utils.GetLerpValue(11, 0, i, true), 3) + 0.2f)), SpriteEffects.None); + } + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Main.UIScaleMatrix); + + // Draw the front text as usual. + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, basePosition, rarityColor, line.Rotation, line.Origin, line.BaseScale, line.MaxWidth, line.Spread); + + return false; + } // Special enchantment line color. if (line.Name == "ItemName" && line.Mod == "Terraria" && item.IsEnchanted()) { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index fe2992f93b..2a23878b03 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -2203,7 +2203,7 @@ XyksBlessingBlue: { DisplayName: Xyk's Blessing (Blue) Tooltip: ''' - Applies visual effects to your dashes and deaths + Applies visual effects to your dashes, wings, and deaths to transform 'It's simply too much to turn back now; passion and time have long since stained it. [c/5f8ae1:Have I always been so selfish?'] @@ -2214,7 +2214,7 @@ XyksBlessingOrange: { DisplayName: Xyk's Blessing (Orange) Tooltip: ''' - Applies visual effects to your dashes and deaths + Applies visual effects to your dashes, wings, and deaths to transform 'Even so, the march of time waits for none. Recall that feeling of fulfillment, and show it to the world. [c/E1B65F:Prove that it was never a waste.'] diff --git a/Projectiles/Typeless/XykWings.cs b/Projectiles/Typeless/XykWings.cs index 222fc845b6..191990362d 100644 --- a/Projectiles/Typeless/XykWings.cs +++ b/Projectiles/Typeless/XykWings.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Typeless public float backWingRot = 0; public int lastDir = 0; public float spawnFade = 0; - public float spawnFadePow => (Projectile.ai[1] == 5 ? 1 - (float)Math.Pow(spawnFade, 4) : (float)Math.Pow(spawnFade, 4)); + public float spawnFadePow => (Projectile.ai[1] == 5 ? (float)Math.Pow(spawnFade, 1) : (float)Math.Pow(spawnFade, 4)); public int deathFadeTimer = 0; public bool iAmTopWing = false; @@ -157,7 +157,7 @@ namespace CalamityMod.Projectiles.Typeless deathFadeTimer++; int fadeTime = (BreakApart ? 90 : 20); - spawnFade = Utils.GetLerpValue(0, fadeTime, deathFadeTimer, true); + spawnFade = Utils.GetLerpValue(fadeTime, 0, deathFadeTimer, true); Projectile.scale = intendedScale * spawnFadePow; if (deathFadeTimer >= fadeTime) { @@ -166,101 +166,103 @@ namespace CalamityMod.Projectiles.Typeless } return; } - - bool isFlying = Owner.controlJump; - bool isFalling = Owner.controlDown && !isFlying && Owner.velocity.Y > 0; - bool isUpBoosting = Owner.wingTime > 0 && Owner.controlJump && Owner.controlUp; - bool isHovering = Owner.wingTime > 0 && Owner.controlDown && Owner.controlJump && !isUpBoosting; - if (isFalling || timeFalling < 0) - timeFalling++; - else if (timeFalling > 0) - timeFalling -= 2; - float fallingLerp = (float)Math.Pow(Utils.GetLerpValue(0, 60, timeFalling, true), 3); - float topWingNum = (checkActiveWings() - 1); - - float sine = (float)Math.Sin((time * 0.35f * (isFalling ? 3 : (isHovering || isUpBoosting) ? 3.2f : isFlying ? 2f : 1) + wingNum * ((isHovering || isUpBoosting) ? 3f : 2f)) / MathHelper.Pi); - - if (Owner.dashDelay == -1 || isUpBoosting || isHovering || Owner.Calamity().adrenalineModeActive || Owner.Calamity().rageModeActive || isFalling && Owner.velocity.Y > 16) - { - dashfx = MathHelper.Lerp(dashfx, 1, 0.25f); - float bonusScale = 1; - if (Owner.Calamity().rageModeActive) - bonusScale += 0.25f; - if (Owner.Calamity().adrenalineModeActive) - bonusScale += 0.5f; - if (Projectile.scale < bonusScale) - Projectile.scale = bonusScale; - } else { - dashfx = MathHelper.Lerp(dashfx, 0, 0.03f); - if (dashfx > 0) - dashfx -= 0.01f; - else - dashfx = 0; - } + bool isFlying = Owner.controlJump; + bool isFalling = Owner.controlDown && !isFlying && Owner.velocity.Y > 0; + bool isUpBoosting = Owner.wingTime > 0 && Owner.controlJump && Owner.controlUp; + bool isHovering = Owner.wingTime > 0 && Owner.controlDown && Owner.controlJump && !isUpBoosting; + if (isFalling || timeFalling < 0) + timeFalling++; + else if (timeFalling > 0) + timeFalling -= 3; + float fallingLerp = (float)Math.Pow(Utils.GetLerpValue(0, 40, timeFalling, true), 3); + float topWingNum = (checkActiveWings() - 1); - float flapSpeed = MathHelper.Lerp(0.06f * (isHovering ? 2.5f : isFlying ? 2f : 1), 0.55f * (isHovering ? 2.5f : isFlying ? 2f : 1), (float)Math.Pow(Utils.GetLerpValue(-1, 1, sine), 3)); + float sine = (float)Math.Sin((time * 0.35f * (isFalling ? 3 : (isHovering || isUpBoosting) ? 3.2f : isFlying ? 2f : 1) + wingNum * ((isHovering || isUpBoosting) ? 3f : 2f)) / MathHelper.Pi); - wingFlapHeight = MathHelper.Lerp(wingFlapHeight, sine, flapSpeed) * spawnFadePow; - - for (int i = -1; i <= 1; i += 2) - { - float dir = i * lastDir; - Vector2 flightMovement = Vector2.UnitY.RotatedBy(isFalling ? MathHelper.ToRadians(13) * dir * fallingLerp : 0) * (-15 * Projectile.scale + 10 * (isFalling ? 0.35f : isUpBoosting ? 5f : isHovering ? 1.5f : isFlying ? 2.5f : 1) * wingFlapHeight) * ((Owner.velocity.Y == 0) ? 0 : 1); - float wingPartDist = (1.6f / (checkActiveWings() + 1)) * wingNum * (isFalling ? 1 - 0.3f * fallingLerp : isHovering ? 0.5f : 1); - Vector2 destination = (playerCenterPoint - (Vector2.UnitX.RotatedBy(isFalling ? MathHelper.ToRadians(13) * dir * fallingLerp : 0) * (22 + 7 * wingFlapHeight * (i == -1 ? 0.5f : 1)) * Projectile.scale).RotatedBy((-0.8f + (isFalling ? 0.7f * fallingLerp : 0) + wingPartDist + (wingNum == topWingNum ? 0.1f : wingNum == 0 ? -0.1f : 0)) * dir) * dir + (Vector2.One * (isFlying ? 0 : 1)).RotatedBy((time * 0.12f + wingNum * 0.9f) * dir)) + flightMovement; - - float lerpSpeed = (1 + wingNum * (0.1f + 0.15f * fallingLerp)); - float spawnDistance = 150; - if (i == 1) - expectedWingPosition1 += ((destination + destination.DirectionFrom(playerCenterPoint) * Math.Max(1, spawnDistance * (1 - spawnFadePow))) - expectedWingPosition1) / lerpSpeed; - else - expectedWingPosition2 += ((destination + (Vector2.UnitX * -6f * lastDir) + destination.DirectionFrom(playerCenterPoint) * Math.Max(1, spawnDistance * (1 - spawnFadePow))) - expectedWingPosition2) / lerpSpeed; - } - Projectile.Center = Owner.Center; - - Projectile.rotation = expectedWingPosition1.DirectionFrom(playerCenterPoint).ToRotation() - MathHelper.PiOver2; - backWingRot = expectedWingPosition2.DirectionFrom(playerCenterPoint).ToRotation() - MathHelper.PiOver2; - - if (wingNum == 0) - Lighting.AddLight(Owner.Center, Color.Lerp(drawColor, Color.White, 0.5f).ToVector3() * 1.1f * spawnFadePow); - - if (dashfx > 0.3f && (wingNum == checkActiveWings() - 1 || wingNum == 0)) - { - for (int i = -2; i <= 2; i += 1) + if (Owner.dashDelay == -1 || isUpBoosting || isHovering || Owner.Calamity().adrenalineModeActive || Owner.Calamity().rageModeActive || isFalling && Owner.velocity.Y > 16) { - if (i == 0) - i++; - - bool front = i > 0; - Vector2 pos1 = expectedWingPosition1 + (Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * (45 + 5 * wingNum) * (Projectile.scale + 0.15f); - Vector2 pos2 = expectedWingPosition2 + (backWingRot + MathHelper.PiOver2).ToRotationVector2() * (15 + 3 * wingNum) * (Projectile.scale + 0.15f); - - if (Owner.Calamity().XykVisualsBlue) - { - bool circle = Main.rand.NextBool(3); - Dust dust = Dust.NewDustPerfect(front ? pos1 : pos2, circle ? ModContent.DustType() : ModContent.DustType(), Owner.velocity.RotatedByRandom(circle ? 0.5f : 0) * Main.rand.NextFloat(-0.5f, -0.2f) * dashfx); - dust.scale = Main.rand.NextFloat(1.3f, 1.4f) * (front ? 1 : 0.6f) * dashfx * (circle ? 0.6f : 1f) * (float)Math.Pow(Projectile.scale, 0.4f); - dust.noGravity = true; - dust.color = drawColor; - dust.noLightEmittence = true; - dust.fadeIn = 1.5f * (circle ? 0 : 1f); - } + dashfx = MathHelper.Lerp(dashfx, 1, 0.25f); + float bonusScale = 1; + if (Owner.Calamity().rageModeActive) + bonusScale += 0.25f; + if (Owner.Calamity().adrenalineModeActive) + bonusScale += 0.5f; + if (Projectile.scale < bonusScale) + Projectile.scale = bonusScale; + } + else + { + dashfx = MathHelper.Lerp(dashfx, 0, 0.03f); + if (dashfx > 0) + dashfx -= 0.01f; else + dashfx = 0; + } + + float flapSpeed = MathHelper.Lerp(0.06f * (isHovering ? 2.5f : isFlying ? 2f : 1), 0.55f * (isHovering ? 2.5f : isFlying ? 2f : 1), (float)Math.Pow(Utils.GetLerpValue(-1, 1, sine), 3)); + + wingFlapHeight = MathHelper.Lerp(wingFlapHeight, sine, flapSpeed) * spawnFadePow; + + for (int i = -1; i <= 1; i += 2) + { + float dir = i * lastDir; + Vector2 flightMovement = Vector2.UnitY.RotatedBy(isFalling ? MathHelper.ToRadians(13) * dir * fallingLerp : 0) * (-15 * Projectile.scale + 10 * (isFalling ? 0.35f : isUpBoosting ? 5f : isHovering ? 1.5f : isFlying ? 2.5f : 1) * wingFlapHeight) * ((Owner.velocity.Y == 0) ? 0 : 1); + float wingPartDist = (1.6f / (checkActiveWings() + 1)) * wingNum * (isFalling ? 1 - 0.3f * fallingLerp : isHovering ? 0.5f : 1); + Vector2 destination = (playerCenterPoint - (Vector2.UnitX.RotatedBy(isFalling ? MathHelper.ToRadians(13) * dir * fallingLerp : 0) * (22 + 7 * wingFlapHeight * (i == -1 ? 0.5f : 1)) * Projectile.scale).RotatedBy((-0.8f + (isFalling ? 0.7f * fallingLerp : 0) + wingPartDist + (wingNum == topWingNum ? 0.1f : wingNum == 0 ? -0.1f : 0)) * dir) * dir + (Vector2.One * (isFlying ? 0 : 1)).RotatedBy((time * 0.12f + wingNum * 0.9f) * dir)) + flightMovement; + + float lerpSpeed = (1 + wingNum * (0.1f + 0.15f * fallingLerp) / (Owner.moveSpeed * 0.3f + 1)); + float spawnDistance = 150; + if (i == 1) + expectedWingPosition1 += ((destination + destination.DirectionFrom(playerCenterPoint) * Math.Max(1, spawnDistance * (1 - spawnFadePow))) - expectedWingPosition1) / lerpSpeed; + else + expectedWingPosition2 += ((destination + (Vector2.UnitX * -6f * lastDir) + destination.DirectionFrom(playerCenterPoint) * Math.Max(1, spawnDistance * (1 - spawnFadePow))) - expectedWingPosition2) / lerpSpeed; + } + Projectile.Center = Owner.Center; + + Projectile.rotation = expectedWingPosition1.DirectionFrom(playerCenterPoint).ToRotation() - MathHelper.PiOver2; + backWingRot = expectedWingPosition2.DirectionFrom(playerCenterPoint).ToRotation() - MathHelper.PiOver2; + + if (wingNum == 0) + Lighting.AddLight(Owner.Center, Color.Lerp(drawColor, Color.White, 0.5f).ToVector3() * 1.1f * spawnFadePow); + + if (dashfx > 0.3f && (wingNum == checkActiveWings() - 1 || wingNum == 0)) + { + for (int i = -2; i <= 2; i += 1) { - bool square = Main.rand.NextBool(3); - Dust dust = Dust.NewDustPerfect(front ? pos1 : pos2, square ? ModContent.DustType() : ModContent.DustType(), Owner.velocity.RotatedByRandom(0.25f) * Main.rand.NextFloat(-0.5f, -0.2f) * dashfx); - dust.scale = Main.rand.NextFloat(0.8f, 1f) * (front ? 1 : 0.6f) * dashfx * (square ? 1 : 1.5f) * (float)Math.Pow(Projectile.scale, 0.4f); - dust.noGravity = true; - dust.color = drawColor; - dust.noLightEmittence = true; - dust.fadeIn = 0.1f * (square ? 1 : 3f); + if (i == 0) + i++; + + bool front = i > 0; + Vector2 pos1 = expectedWingPosition1 + (Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * (45 + 5 * wingNum) * (Projectile.scale + 0.15f); + Vector2 pos2 = expectedWingPosition2 + (backWingRot + MathHelper.PiOver2).ToRotationVector2() * (15 + 3 * wingNum) * (Projectile.scale + 0.15f); + + if (Owner.Calamity().XykVisualsBlue) + { + bool circle = Main.rand.NextBool(3); + Dust dust = Dust.NewDustPerfect(front ? pos1 : pos2, circle ? ModContent.DustType() : ModContent.DustType(), Owner.velocity.RotatedByRandom(circle ? 0.5f : 0) * Main.rand.NextFloat(-0.5f, -0.2f) * dashfx); + dust.scale = Main.rand.NextFloat(1.3f, 1.4f) * (front ? 1 : 0.6f) * dashfx * (circle ? 0.6f : 1f) * (float)Math.Pow(Projectile.scale, 0.4f); + dust.noGravity = true; + dust.color = drawColor; + dust.noLightEmittence = true; + dust.fadeIn = 1.5f * (circle ? 0 : 1f); + } + else + { + bool square = Main.rand.NextBool(3); + Dust dust = Dust.NewDustPerfect(front ? pos1 : pos2, square ? ModContent.DustType() : ModContent.DustType(), Owner.velocity.RotatedByRandom(0.25f) * Main.rand.NextFloat(-0.5f, -0.2f) * dashfx); + dust.scale = Main.rand.NextFloat(0.8f, 1f) * (front ? 1 : 0.6f) * dashfx * (square ? 1 : 1.5f) * (float)Math.Pow(Projectile.scale, 0.4f); + dust.noGravity = true; + dust.color = drawColor; + dust.noLightEmittence = true; + dust.fadeIn = 0.1f * (square ? 1 : 3f); + } } } - } - time++; + time++; + } } public override bool PreDraw(ref Color lightColor) { @@ -310,7 +312,6 @@ namespace CalamityMod.Projectiles.Typeless Main.EntitySpriteDraw(tex, expectedWingPosition1 - Main.screenPosition, null, Color.Lerp(drawColor, Color.White, dashfx) with { A = 0 } * spawnFadePow * MathHelper.Lerp(1, 0.6f, dashfx), Projectile.rotation, new Vector2(tex.Width * 0.5f, 0), scale, lastDir == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0); Main.EntitySpriteDraw(tex, expectedWingPosition2 - Main.screenPosition, null, Color.Lerp(drawColor, Color.White, dashfx) with { A = 0 } * spawnFadePow * MathHelper.Lerp(1, 0.6f, dashfx), backWingRot, new Vector2(tex.Width * 0.5f, 0), scaleBack, lastDir == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0); - return false; } public int checkActiveWings() From b4d16f041a9b9f71cac6c13a6424f895f6d45ee6 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Tue, 3 Jun 2025 13:24:15 -0400 Subject: [PATCH 12/47] Murdered Oblivion in cold blood (mostly) No longer plays Boss 3 No longer has different type names No longer spawns Twins and Destroyer --- .../en-US/Mods.CalamityMod.NPCs.hjson | 7 +- NPCs/CalamityGlobalNPC.cs | 29 ----- .../Bosses/DestroyerAI.cs | 101 ++++++------------ .../Bosses/SkeletronPrimeAI.cs | 66 ------------ NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs | 87 ++++----------- .../SkeletronPrimeMasterMusicScene.cs | 14 --- 6 files changed, 54 insertions(+), 250 deletions(-) delete mode 100644 Scenes/MusicScenes/SkeletronPrimeMasterMusicScene.cs diff --git a/Localization/en-US/Mods.CalamityMod.NPCs.hjson b/Localization/en-US/Mods.CalamityMod.NPCs.hjson index ca33d6a044..88ed6fb8e1 100644 --- a/Localization/en-US/Mods.CalamityMod.NPCs.hjson +++ b/Localization/en-US/Mods.CalamityMod.NPCs.hjson @@ -189,12 +189,7 @@ Rotdog.DisplayName: Rotdog ScornEater.DisplayName: Scorn Eater ShockstormShuttle.DisplayName: Shockstorm Shuttle Shroomble.DisplayName: Shroomble -SkeletronOmega.DisplayName: Skeletron Omega -OmegaSaw.DisplayName: Omega Saw -OmegaLaser.DisplayName: Omega Laser -SkeletronPrime2.DisplayName: Skeletron Alpha -AlphaVice.DisplayName: Alpha Vice -AlphaCannon.DisplayName: Alpha Cannon +SkeletronPrime2.DisplayName: Skeletron Prime Stormlion.DisplayName: Stormlion StormlionSentry.DisplayName: Stormlion Sentry Sunskater.DisplayName: Sunskater diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 68ee28826c..900cd940e9 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -10195,34 +10195,5 @@ namespace CalamityMod.NPCs return result; } #endregion - - #region Type Name Changes - public override void ModifyTypeName(NPC npc, ref string typeName) - { - if (CalamityWorld.death || BossRushEvent.BossRushActive) - { - if (npc.type == NPCID.SkeletronPrime) - { - typeName = CalamityUtils.GetTextValue("NPCs.SkeletronOmega.DisplayName"); - } - if (npc.type == NPCID.PrimeSaw) - { - typeName = CalamityUtils.GetTextValue("NPCs.OmegaSaw.DisplayName"); - } - if (npc.type == NPCID.PrimeLaser) - { - typeName = CalamityUtils.GetTextValue("NPCs.OmegaLaser.DisplayName"); - } - if (npc.type == NPCID.PrimeVice) - { - typeName = CalamityUtils.GetTextValue("NPCs.AlphaVice.DisplayName"); - } - if (npc.type == NPCID.PrimeCannon) - { - typeName = CalamityUtils.GetTextValue("NPCs.AlphaCannon.DisplayName"); - } - } - } - #endregion } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs index 2a3aaf073a..c26be9d26d 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs @@ -151,8 +151,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Check if other segments are still alive, if not, die - // Check for Oblivion too, since having a max power Destroyer during that fight would be turbo cancer - bool oblivionAlive = false; if (npc.type > NPCID.TheDestroyer) { bool shouldDespawn = true; @@ -179,27 +177,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.active = false; } } - else - { - if (death && !bossRush && npc.localAI[3] == 1f) - { - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active && (Main.npc[i].type == ModContent.NPCType() || Main.npc[i].type == NPCID.SkeletronPrime)) - { - oblivionAlive = true; - break; - } - } - } - } // Total segment variable int totalSegments = Main.getGoodWorld ? 100 : 80; // Calculate aggression based on how many broken segments there are float brokenSegmentAggressionMultiplier = 1f; - if (npc.type == NPCID.TheDestroyer && !oblivionAlive) + if (npc.type == NPCID.TheDestroyer) { int numProbeSegments = 0; for (int i = 0; i < Main.maxNPCs; i++) @@ -225,51 +209,39 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Increase velocity based on distance float velocityMultiplier = increaseSpeedMore ? 2f : increaseSpeed ? 1.5f : 1f; + noFlyZoneBoxHeight -= death ? 400 : (int)(400f * (1f - lifeRatio)); - // If Oblivion is alive, don't fly, don't spit laser spreads, use the default vanilla no fly zone, reduce segment count to 60, use base speed and use base turn speed - if (oblivionAlive) + float segmentVelocityBoost = death ? (flyAtTarget ? 4.5f : 6f) * (1f - lifeRatio) : (flyAtTarget ? 3f : 4f) * (1f - lifeRatio); + float speedBoost = death ? (flyAtTarget ? 0.1125f : 0.15f) * (1f - lifeRatio) : (flyAtTarget ? 0.075f : 0.1f) * (1f - lifeRatio); + float turnSpeedBoost = death ? 0.18f * (1f - lifeRatio) : 0.12f * (1f - lifeRatio); + + segmentVelocity += segmentVelocityBoost; + speed += speedBoost; + turnSpeed += turnSpeedBoost; + + segmentVelocity += 5f * enrageScale; + speed += 0.05f * enrageScale; + turnSpeed += 0.075f * enrageScale; + + if (flyAtTarget) { - calamityGlobalNPC.newAI[3] = 0f; - totalSegments = Main.getGoodWorld ? 75 : 60; - spitLaserSpreads = false; - noFlyZoneBoxHeight = 2000; + float speedMultiplier = phase5 ? 1.8f : phase4 ? 1.65f : 1.5f; + speed *= speedMultiplier; } - else + + segmentVelocity *= velocityMultiplier; + speed *= velocityMultiplier; + turnSpeed *= velocityMultiplier; + + segmentVelocity *= brokenSegmentAggressionMultiplier; + speed *= brokenSegmentAggressionMultiplier; + turnSpeed *= brokenSegmentAggressionMultiplier; + + if (Main.getGoodWorld) { - noFlyZoneBoxHeight -= death ? 400 : (int)(400f * (1f - lifeRatio)); - - float segmentVelocityBoost = death ? (flyAtTarget ? 4.5f : 6f) * (1f - lifeRatio) : (flyAtTarget ? 3f : 4f) * (1f - lifeRatio); - float speedBoost = death ? (flyAtTarget ? 0.1125f : 0.15f) * (1f - lifeRatio) : (flyAtTarget ? 0.075f : 0.1f) * (1f - lifeRatio); - float turnSpeedBoost = death ? 0.18f * (1f - lifeRatio) : 0.12f * (1f - lifeRatio); - - segmentVelocity += segmentVelocityBoost; - speed += speedBoost; - turnSpeed += turnSpeedBoost; - - segmentVelocity += 5f * enrageScale; - speed += 0.05f * enrageScale; - turnSpeed += 0.075f * enrageScale; - - if (flyAtTarget) - { - float speedMultiplier = phase5 ? 1.8f : phase4 ? 1.65f : 1.5f; - speed *= speedMultiplier; - } - - segmentVelocity *= velocityMultiplier; - speed *= velocityMultiplier; - turnSpeed *= velocityMultiplier; - - segmentVelocity *= brokenSegmentAggressionMultiplier; - speed *= brokenSegmentAggressionMultiplier; - turnSpeed *= brokenSegmentAggressionMultiplier; - - if (Main.getGoodWorld) - { - segmentVelocity *= 1.2f; - speed *= 1.2f; - turnSpeed *= 1.2f; - } + segmentVelocity *= 1.2f; + speed *= 1.2f; + turnSpeed *= 1.2f; } bool probeLaunched = npc.ai[2] == 1f; @@ -287,9 +259,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses calamityGlobalNPC.newAI[2] -= 1f; } - // Regenerate Probes in Master Mode if the number of Probes is less than 40 and the number of living NPCs is less than the segment count + 40 (this limit is here just in case) - // This doesn't happen if Oblivion is alive - if (death && probeLaunched && !oblivionAlive) + // Regenerate Probes in Death Mode if the number of Probes is less than 40 and the number of living NPCs is less than the segment count + 40 (this limit is here just in case) + if (death && probeLaunched) { npc.localAI[2] += 1f; if (npc.localAI[2] >= 600f) @@ -770,8 +741,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Despawn - bool oblivionFightDespawn = (oblivionAlive && lifeRatio < 0.8f) && npc.localAI[3] == 1f; - if (player.dead || oblivionFightDespawn) + if (player.dead) { shouldFly = false; npc.velocity.Y += 2f; @@ -1034,12 +1004,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - // Force the fucker to turn around in ground phase in Master - // Turns slower if Oblivion is alive, for fairness + // Force the fucker to turn around in ground phase in Death if (npc.type == NPCID.TheDestroyer && death && !flyAtTarget) { if (npc.Distance(player.Center) > 2000f) - npc.velocity += (player.Center - npc.Center).SafeNormalize(Vector2.UnitY) * (oblivionAlive ? speed : turnSpeed); + npc.velocity += (player.Center - npc.Center).SafeNormalize(Vector2.UnitY) * turnSpeed; } if (NPC.IsMechQueenUp && npc.type == NPCID.TheDestroyer) diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs index e4889ff152..83d7210b95 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs @@ -182,73 +182,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Phases bool phase2 = lifeRatio < 0.66f; - bool spawnDestroyer = lifeRatio < 0.75f && death && !bossRush && npc.localAI[2] == 0f; bool phase3 = lifeRatio < 0.33f; - bool spawnRetinazer = lifeRatio < 0.5f && death && !bossRush && npc.localAI[2] == 1f; - - // Spawn The Destroyer in Master Mode (just like Oblivion from Avalon) - if (spawnDestroyer) - { - Player destroyerSpawnPlayer = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)]; - SoundEngine.PlaySound(SoundID.Roar, destroyerSpawnPlayer.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int destroyer = NPC.NewNPC(NPC.GetBossSpawnSource(destroyerSpawnPlayer.whoAmI), (int)destroyerSpawnPlayer.Center.X, (int)destroyerSpawnPlayer.Center.Y + 810, NPCID.TheDestroyer, 1); - if (destroyer != Main.maxNPCs) - { - Main.npc[destroyer].target = destroyerSpawnPlayer.whoAmI; - Main.npc[destroyer].timeLeft *= 20; - Main.npc[destroyer].localAI[3] = 1f; - Main.npc[destroyer].SyncVanillaLocalAI(); - string typeName = Main.npc[destroyer].TypeName; - if (Main.dedServ && destroyer < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, destroyer); - - AchievementsHelper.CheckMechaMayhem(); - - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue("Announcement.HasAwoken", typeName), 175, 75); - else if (Main.dedServ) - ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", Main.npc[destroyer].GetTypeNetName()), new Color(175, 75, 255)); - } - } - - npc.localAI[2] = 1f; - npc.SyncVanillaLocalAI(); - } - - // Spawn Retinazer in Master Mode (just like Oblivion from Avalon) - if (spawnRetinazer) - { - Player retinazerSpawnPlayer = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)]; - SoundEngine.PlaySound(SoundID.Roar, retinazerSpawnPlayer.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int retinazer = NPC.NewNPC(NPC.GetBossSpawnSource(retinazerSpawnPlayer.whoAmI), (int)retinazerSpawnPlayer.Center.X, (int)retinazerSpawnPlayer.Center.Y - 810, NPCID.Retinazer, 1); - if (retinazer != Main.maxNPCs) - { - Main.npc[retinazer].target = retinazerSpawnPlayer.whoAmI; - Main.npc[retinazer].timeLeft *= 20; - Main.npc[retinazer].localAI[3] = 1f; - Main.npc[retinazer].SyncVanillaLocalAI(); - string typeName = Main.npc[retinazer].TypeName; - if (Main.dedServ && retinazer < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, retinazer); - - AchievementsHelper.CheckMechaMayhem(); - - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Lang.misc[48].Value, 175, 75); - else if (Main.dedServ) - ChatHelper.BroadcastChatMessage(Lang.misc[48].ToNetworkText(), new Color(175, 75, 255)); - } - } - - npc.localAI[2] = 2f; - npc.SyncVanillaLocalAI(); - } // Despawn if (npc.ai[1] != 3f) diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs index 10f0500657..aedd0dc065 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs @@ -76,22 +76,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - // Check for Oblivion in Master Mode - bool oblivionAlive = false; - if (death && !bossRush && npc.localAI[3] == 1f) - { - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active && (Main.npc[i].type == ModContent.NPCType() || Main.npc[i].type == NPCID.SkeletronPrime)) - { - oblivionAlive = true; - break; - } - } - } - // Foveanator spawn - if (!oblivionAlive && death && calamityGlobalNPC.newAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient && !bossRush) + if (death && calamityGlobalNPC.newAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient && !bossRush) { NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType()); calamityGlobalNPC.newAI[0] = 1f; @@ -101,7 +87,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool foveanatorAlive = NPC.AnyNPCs(ModContent.NPCType()); // Phase HP ratios - float phase2LifeRatio = oblivionAlive ? 0.5f : death ? 0.85f : 0.7f; + float phase2LifeRatio = death ? 0.85f : 0.7f; float finalPhaseLifeRatio = death ? 0.4f : 0.25f; // Movement variables @@ -112,16 +98,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Phase duration variables float phase1MaxLaserPhaseDurationDecrease = death ? 120f : 300f; - // If Oblivion is alive reduce aggression of all attacks - if (oblivionAlive) - { - phase1MaxSpeedIncrease = death ? 1f : 2f; - phase1MaxAccelerationIncrease = death ? 0.0125f : 0.025f; - phase1MaxChargeSpeedIncrease = death ? 1.5f : 3f; - - phase1MaxLaserPhaseDurationDecrease = death ? 60f : 150f; - } - // Phase checks bool phase2 = lifeRatio < phase2LifeRatio; bool finalPhase = lifeRatio < finalPhaseLifeRatio; @@ -141,8 +117,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.reflectsProjectiles = false; // Despawn - bool oblivionFightDespawn = ((oblivionAlive && lifeRatio < 0.8f) || (oblivionAlive && !spazAlive && lifeRatio < 0.95f)) && npc.localAI[3] == 1f; - if (Main.player[npc.target].dead || oblivionFightDespawn) + if (Main.player[npc.target].dead) { npc.velocity.Y -= 0.04f; if (npc.timeLeft > 10) @@ -199,7 +174,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.SimpleFlyMovement(idealVelocity * maxVelocity, acceleration); float phaseGateValue = death ? (300f - phase1MaxLaserPhaseDurationDecrease * ((1f - lifeRatio) / (1f - phase2LifeRatio))) : 450f; - float laserGateValue = oblivionAlive ? 60f : foveanatorAlive ? 45f : 30f; + float laserGateValue = foveanatorAlive ? 45f : 30f; if (NPC.IsMechQueenUp) { phaseGateValue = 900f; @@ -300,7 +275,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; float delayBeforeChargingAgain = (death ? 48f : 56f) - (death ? 3f * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); - if (npc.ai[2] >= delayBeforeChargingAgain + (oblivionAlive ? 15f : 0f)) + if (npc.ai[2] >= delayBeforeChargingAgain) { npc.ai[3] += 1f; npc.ai[2] = 0f; @@ -387,7 +362,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses damage = (int)(damage * secondMechMultiplier); } - Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * (oblivionAlive ? 6f : 7f); + Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * 7f; int numProj = shootLaser ? 6 : 2; int spread = shootLaser ? 20 : 80; float rotation = MathHelper.ToRadians(spread); @@ -474,7 +449,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses acceleration *= 1.15f; } - float distanceFromTarget = oblivionAlive ? 480f : 420f; + float distanceFromTarget = 420f; Vector2 destination = Main.player[npc.target].Center - Vector2.UnitY * distanceFromTarget; float distanceFromDestination = (destination - npc.Center).Length(); Vector2 idealVelocity = (destination - npc.Center).SafeNormalize(Vector2.UnitX * direction); @@ -516,7 +491,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[1] += 1f + (death ? (phase2LifeRatio - lifeRatio) / phase2LifeRatio : 0f); - if (npc.localAI[1] >= (spazAlive ? (oblivionAlive ? 76f : foveanatorAlive ? 64f : 52f) : foveanatorAlive ? 39f : 26f)) + if (npc.localAI[1] >= (spazAlive ? (foveanatorAlive ? 64f : 52f) : foveanatorAlive ? 39f : 26f)) { if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { @@ -562,7 +537,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses acceleration *= 1.15f; } - float distanceFromTarget = oblivionAlive ? 480f : 420f; + float distanceFromTarget = 420f; Vector2 destination = Main.player[npc.target].Center + Vector2.UnitX * distanceFromTarget * direction; float distanceFromDestination = (destination - npc.Center).Length(); Vector2 idealVelocity = (destination - npc.Center).SafeNormalize(Vector2.UnitX * direction); @@ -573,7 +548,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[1] += 1f + (death ? (phase2LifeRatio - lifeRatio) / phase2LifeRatio : 0f); - if (npc.localAI[1] > (spazAlive ? (oblivionAlive ? 30f : foveanatorAlive ? 25f : 20f) : foveanatorAlive ? 15f : 10f)) + if (npc.localAI[1] > (spazAlive ? (foveanatorAlive ? 25f : 20f) : foveanatorAlive ? 15f : 10f)) { if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { @@ -843,24 +818,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - // Check for Oblivion in Master Mode - bool oblivionAlive = false; - if (death && !bossRush && npc.localAI[3] == 1f) - { - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active && (Main.npc[i].type == ModContent.NPCType() || Main.npc[i].type == NPCID.SkeletronPrime)) - { - oblivionAlive = true; - break; - } - } - } - bool foveanatorAlive = NPC.AnyNPCs(ModContent.NPCType()); // Phase HP ratios - float phase2LifeRatio = oblivionAlive ? 0.5f : death ? 0.85f : 0.7f; + float phase2LifeRatio = death ? 0.85f : 0.7f; float finalPhaseLifeRatio = death ? 0.3f : 0.15f; // Movement variables @@ -872,17 +833,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float phase1MaxCursedFlamePhaseDurationDecrease = death ? 80f : 200f; float phase1MaxChargesDecrease = death ? 2f : 4f; - // If Oblivion is alive reduce aggression of all attacks - if (oblivionAlive) - { - phase1MaxSpeedIncrease = death ? 1.125f : 2.25f; - phase1MaxAccelerationIncrease = death ? 0.0375f : 0.075f; - phase1MaxChargeSpeedIncrease = death ? 1.5f : 3f; - - phase1MaxCursedFlamePhaseDurationDecrease = death ? 40f : 100f; - phase1MaxChargesDecrease = death ? 1f : 2f; - } - // Phase checks bool phase2 = lifeRatio < phase2LifeRatio; bool finalPhase = lifeRatio < finalPhaseLifeRatio; @@ -902,8 +852,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.reflectsProjectiles = false; // Despawn - bool oblivionFightDespawn = ((oblivionAlive && lifeRatio < 0.8f) || (oblivionAlive && !retAlive && lifeRatio < 0.95f)) && npc.localAI[3] == 1f; - if (Main.player[npc.target].dead || oblivionFightDespawn) + if (Main.player[npc.target].dead) { npc.velocity.Y -= 0.04f; if (npc.timeLeft > 10) @@ -940,7 +889,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses acceleration *= 1.15f; } - float distanceFromTarget = oblivionAlive ? 480f : 400f; + float distanceFromTarget = 400f; Vector2 destination = Main.player[npc.target].Center + Vector2.UnitX * distanceFromTarget * direction; float distanceFromDestination = (destination - npc.Center).Length(); Vector2 idealVelocity = (destination - npc.Center).SafeNormalize(Vector2.UnitX * direction); @@ -983,7 +932,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[3] += 0.4f; } - if (npc.ai[3] >= (oblivionAlive ? 60f : foveanatorAlive ? 45f : 30f)) + if (npc.ai[3] >= (foveanatorAlive ? 45f : 30f)) { npc.ai[3] = 0f; @@ -1058,7 +1007,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Charge 8 times float chargeTime = death ? 45f : 25f; - if (npc.ai[2] >= chargeTime + (oblivionAlive ? 15f : 0f)) + if (npc.ai[2] >= chargeTime) { // Reset AI array and go to cursed fireball phase npc.ai[3] += 1f; @@ -1144,7 +1093,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses damage = (int)(damage * secondMechMultiplier); } - Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * (oblivionAlive ? 12f : 16f) + Main.rand.NextVector2CircularEdge(3f, 3f); + Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * 16f + Main.rand.NextVector2CircularEdge(3f, 3f); int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 50f, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 1f); Main.projectile[proj].tileCollide = false; } @@ -1234,7 +1183,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { // Boost speed if too far from target if (distanceFromDestination > distanceFromTarget) - maxVelocity += MathHelper.Lerp(0f, oblivionAlive ? 3f : death ? 8f : 6f, MathHelper.Clamp((distanceFromDestination - distanceFromTarget) / 1000f, 0f, 1f)); + maxVelocity += MathHelper.Lerp(0f, death ? 8f : 6f, MathHelper.Clamp((distanceFromDestination - distanceFromTarget) / 1000f, 0f, 1f)); if (Main.getGoodWorld) { @@ -1380,7 +1329,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; // Charges 5 times - if (npc.ai[2] >= (chargeTime * 1.6f) + (oblivionAlive ? 15f : 0f)) + if (npc.ai[2] >= chargeTime * 1.6f) { npc.ai[3] += 1f; npc.ai[2] = 0f; diff --git a/Scenes/MusicScenes/SkeletronPrimeMasterMusicScene.cs b/Scenes/MusicScenes/SkeletronPrimeMasterMusicScene.cs deleted file mode 100644 index e5597c0d2e..0000000000 --- a/Scenes/MusicScenes/SkeletronPrimeMasterMusicScene.cs +++ /dev/null @@ -1,14 +0,0 @@ -using CalamityMod.World; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Systems -{ - public class SkeletronPrimeMasterMusicScene : ModSceneEffect - { - public override int Music => MusicID.Boss3; // I spent 20 minutes trying to get this music to play while forgetting to actually override this in the first place _ YuH - public override SceneEffectPriority Priority => SceneEffectPriority.BossLow; - public override bool IsSceneEffectActive(Player player) => CalamityWorld.death && NPC.AnyNPCs(NPCID.SkeletronPrime) && Main.npc[NPC.FindFirstNPC(NPCID.SkeletronPrime)].Distance(player.Center) <= 525f * 16f; - } -} From d060fad9b74adc9a1acb20dfb578d7862e97eadb Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Wed, 4 Jun 2025 02:51:49 +0700 Subject: [PATCH 13/47] Added Aqult's set --- Items/Accessories/Vanity/LucisSight.cs | 32 ++++++++++++++++++ Items/Accessories/Vanity/LucisSight.png | Bin 0 -> 318 bytes Items/Accessories/Vanity/LucisSight_Face.png | Bin 0 -> 2245 bytes Items/Armor/Vanity/LucisBoots.cs | 22 ++++++++++++ Items/Armor/Vanity/LucisBoots.png | Bin 0 -> 279 bytes Items/Armor/Vanity/LucisBoots_Legs.png | Bin 0 -> 3810 bytes Items/Armor/Vanity/LucisHairstyle.cs | 22 ++++++++++++ Items/Armor/Vanity/LucisHairstyle.png | Bin 0 -> 576 bytes Items/Armor/Vanity/LucisHairstyle_Head.png | Bin 0 -> 5103 bytes Items/Armor/Vanity/LucisMilitaryUniform.cs | 22 ++++++++++++ Items/Armor/Vanity/LucisMilitaryUniform.png | Bin 0 -> 540 bytes .../Vanity/LucisMilitaryUniform_Body.png | Bin 0 -> 5853 bytes .../Mods.CalamityMod.Items.Accessories.hjson | 5 +++ .../Mods.CalamityMod.Items.Armor.Vanity.hjson | 15 ++++++++ NPCs/CalamityGlobalTownNPC.cs | 7 +++- 15 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 Items/Accessories/Vanity/LucisSight.cs create mode 100644 Items/Accessories/Vanity/LucisSight.png create mode 100644 Items/Accessories/Vanity/LucisSight_Face.png create mode 100644 Items/Armor/Vanity/LucisBoots.cs create mode 100644 Items/Armor/Vanity/LucisBoots.png create mode 100644 Items/Armor/Vanity/LucisBoots_Legs.png create mode 100644 Items/Armor/Vanity/LucisHairstyle.cs create mode 100644 Items/Armor/Vanity/LucisHairstyle.png create mode 100644 Items/Armor/Vanity/LucisHairstyle_Head.png create mode 100644 Items/Armor/Vanity/LucisMilitaryUniform.cs create mode 100644 Items/Armor/Vanity/LucisMilitaryUniform.png create mode 100644 Items/Armor/Vanity/LucisMilitaryUniform_Body.png diff --git a/Items/Accessories/Vanity/LucisSight.cs b/Items/Accessories/Vanity/LucisSight.cs new file mode 100644 index 0000000000..0afdc9724c --- /dev/null +++ b/Items/Accessories/Vanity/LucisSight.cs @@ -0,0 +1,32 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories.Vanity +{ + [AutoloadEquip(EquipType.Face)] + public class LucisSight : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Accessories"; + + public override void SetStaticDefaults() + { + if (!Main.dedServ) + { + int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Face); + ArmorIDs.Face.Sets.DrawInFaceUnderHairLayer[equipSlot] = true; + } + } + + public override void SetDefaults() + { + Item.width = 28; + Item.height = 18; + Item.value = Item.buyPrice(gold: 10); // Sold by Steampunker + Item.rare = ItemRarityID.Pink; + Item.accessory = true; + Item.vanity = true; + Item.Calamity().donorItem = true; + } + } +} diff --git a/Items/Accessories/Vanity/LucisSight.png b/Items/Accessories/Vanity/LucisSight.png new file mode 100644 index 0000000000000000000000000000000000000000..47aa49c9a112dd36f4fc76969ffde25a649043e0 GIT binary patch literal 318 zcmV-E0m1%>P);00035NklT^nQbeBW?0 z#lz+3m{#bFklHyM3{{cq?Z&t=tHn}nlF2wV6dq4mC%(E~j1CCrgmhEDRh&ZHPsG{c zv0HW9pwu?O*9hT8%o2&Y%|i>-_mIqvRp^Y6&XR5#+xPI(W@2B9UlBe4jZ6^|3&&fR Q00000NkvXXu0mjf0L1Z$`v3p{ literal 0 HcmV?d00001 diff --git a/Items/Accessories/Vanity/LucisSight_Face.png b/Items/Accessories/Vanity/LucisSight_Face.png new file mode 100644 index 0000000000000000000000000000000000000000..b56c28cf6eef820f40c132c297c1a08355a38fce GIT binary patch literal 2245 zcmeAS@N?(olHy`uVBq!ia0vp^8Vn392^?%d*6dv(^+1ZTILO_JVcj{ImkbOXsh%#5 zAr*0NZ*4rQ>nYkAsKzAJ5MpqmQR5^dGrP33u#f`N1UD^CMVFVaR=1n&%HCuC_5HP- ztINx+pD&N^`Tza$kDC1k345JcIKvueU3Y8>UGS`QLW1auO4&KWf9~ej{qC=qef7Qm zkMk~X%|G)?(%5a9|L(r=^MC!X&+&EtZ0mpjj<{qp(nKkY#Day#34y&o?bw(mE8;QOM??}J*2wR(l{uDQZ{IPae0 zyw{TVoF(6BdvTNb!rPVyXJ2?bhg!;h79YI1b&9f~^@BfAr~Wj2&er_QJg@!8y)$o* z{@ia@|8G&NS5BcdOs4CbSynroeXVd%E8w%0#|Ew|d-#YHK5uQYds@+wH1;|1 z-ZSM3>U2}<4t$<)WA;k@YuA51*Uw_!C${2xaW_Ult3!ZrxIul{XomUk`c) z@y-Vum2YXUy1$nG``LY~VLj`suXmD=5(_DQsFVe%{#VJKem$t~${R>@fW1>8Csb|x z_2@6F|9@O_4_s&ZT9s!=dORS-+W$Sxo3l0Dv&s(q+&bka#5*?poqK2gN~)a;jCZpK z*^O1U+h>3iJn4RjV}H()K3xm!32)KQ%;)q&&+r315iJk$#QWfIN|V(6>!5^NteuXL zrt<$?|M~v+B!L>;fc4ACPO?@WAA%c!Hhgx*NVPw|?ESv@|Gn)yxP-|G806&qU^&y~ zZrkVWXZS4k-!Qg+@F(f~pN8j(8!NxOtbXtQe{X)Fs2WK*4Jn2p*|k0%l$g$~og)j$ zcHr1P@0^ssY~RoL=lkD#JAK&duy-D@IT^!zU~%Bjng+CieC?f?J) literal 0 HcmV?d00001 diff --git a/Items/Armor/Vanity/LucisBoots.cs b/Items/Armor/Vanity/LucisBoots.cs new file mode 100644 index 0000000000..da9ce01a0c --- /dev/null +++ b/Items/Armor/Vanity/LucisBoots.cs @@ -0,0 +1,22 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Legs)] + public class LucisBoots : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Armor.Vanity"; + + public override void SetDefaults() + { + Item.width = 28; + Item.height = 20; + Item.value = Item.buyPrice(gold: 10); // Sold by Steampunker + Item.rare = ItemRarityID.Pink; + Item.vanity = true; + Item.Calamity().donorItem = true; + } + } +} diff --git a/Items/Armor/Vanity/LucisBoots.png b/Items/Armor/Vanity/LucisBoots.png new file mode 100644 index 0000000000000000000000000000000000000000..2b91e15ca468442a0ed9af6b856e647b3f3cae10 GIT binary patch literal 279 zcmV+y0qFjTP)tYn|NnJ@STDqjVsVl!O+ZqLLLa&hPO^!U$&g)U$wM%n)?EWMt?w!}{b*X>CC<`R@s^;l$K@^ok<|rBu|($_r%WCGtj!+_%@kPAAq+CQtReJ}1xh d{7doC#7`U!-rLWG$(jHF002ovPDHLkV1l~3deHy? literal 0 HcmV?d00001 diff --git a/Items/Armor/Vanity/LucisBoots_Legs.png b/Items/Armor/Vanity/LucisBoots_Legs.png new file mode 100644 index 0000000000000000000000000000000000000000..cb73585b170c0e5551899c24515a1559d991d4e4 GIT binary patch literal 3810 zcmcJSX;f3!7RRYgqiB#=WfVvt5h6uFkXi&{ z7(_6L5T+PGLg)&p%#+9rVQQFyL^T;hdXVpA+r0KPvD!61=$X~RM7C9s z>-Z1zPnr*H1YP$dr(chkKOk-%FZGCkR5muhIobFKqVm-<6h$fv@{|YrgNag9M9F%< zZ2wB^!0P0Oh$wt#zWM+nHAOX@%nlS(F8rKs#g23AtlSV@)rC^dCZqNA?AM6_q2-}G zPS{H2!pPx!>_-7=tEP}_q`iDkO`i@V8x_1(CsW@ox8d#l3u#D|G&9+5TA*6ME1!ko= z<0nfryDWTm$QzZJOV|ucB`7GJn0GrHks#JiGZwemavp#xofbdK+50&YlI}jbtb~b} z<8AFW2haK5&PM8mso@Be+?*#Sd$QF;7}qmY9yVkL6ZHcy+51*{P6bdE-!FdIe{CIw zyatT!JAUXIKu5i5>$IVxN*_9!n^Y~i5v=a(y%M>d(s;)=v#Gzl8aAeJe=-(wk+gWh z6xH{v6MH15$M3J+bPKORpMYuMVSwA&1y3*l`1jMxX=bo4YZnojDdRyz&M8iC3fuVX z=F4SV7Y>wo=Ry6MFML=~3efPp!~T9Z%2b!9=9WG#b<)TVMv@h!6`?Nd8-Yuq0e;1y zX{(_NV7lhwtw4nuNVB|Q7F@z3^8$~I5KGBld~ zLianza{Zcv=8rcH=HGqyBGZ@vQT#+lpPAU7tUxqj6VxhC7#iOb;;as>rybv|7Bt?b zD@%kcGDF-w81brGHuFx;ak2KcmmvkmQ9Rn>xLOO7L=5vn+>1#TjpNxsVW4ADo-0!~ zqD@Y9p-x)K2i`qaTv3+tu^)()9Y;Hx~>;G~~=U{gG~9d{gghO-4QT|JWh8gaqHL?}o&a^0XV$ zDLm}UDB5%_HlhvQK-%MlFW0B^YR5C|D0?$Jog@C%AvAe#4uqD3rPG-^4H$eOEAit% z^}WQfJ0()Dog(QIjTpQp0r_oY@IiFXiOGtFt5LxK6wgYyk1?CBYnKEZ1Yri&dD+xK z57;TXwzm5(74`}VK{*V<~J?(NDRa37q6xk-5*KSi6;ubNeGut@Tk7bdG?@}QMsFubQJIId^t8Y zi)VG%z38B+9Cqqqb8F5sQ0D|b?ZvX>0a-AZEOa_yzR}%R7>#0;LsiWFDo^e4@+Yg5 z6NR{8Fjth(zL3F*?+aT18(c3D-t3QJVoV;T0C%E@|V870)iY(NSGaR^9p_dqo}R2rJr)sxGnIj&%&+>UL$*N$~1C<`Yr}%<5o2 zhF^!hMSR6r9wPb*pyPh<&#?->m-448xSVfQk9;*lqUWKRvpkHfV=UKmoyrqce=xH# zctu1d<1~&r`T8ZyHhXSfDBkv_LdSAbN(b|$0VP*UHp_#V@s1ue@xB?hiIp2WG7Her z^ODjj9auNdwvm1a%1gm19g6(EyA<-b4vU&xPwo3%KKgibf&Xv|c^O*oXwEo4^O0Zw zOb$K(1+-U*tu&qy%i$XeTJfa7x}S#VgUSd z;ev%m@}LfsnS*R1g%zFH?q_`W1^S^lD0{EvLb50U~Y~Zy~;(}zv!(KnKDq!nWpd6 zh#<6Vx2%T-mj;tbJdc>@6Df^EVI#&}llb16QDw{K;~YGVVn#L#&9wz$aqrh37j_Nt!>aLot$zA+`U8gk`Wk|S_vr?1cunXxhli|eq7i@PVI z%s|e=q@7d2EXF+?ZPkIA5|IXYdBz(oUJVB{W?q+g6PUw7N!KU&D?C8UAMG%7j5S`K z&9Os=YE1XHjDLjhQ$np?3HL6v6CRjWx}dJ{g{R$^aBCTD4LSOwq_5zX-cQCfQ{%^q zD2xAC>;xH}X9YD?hWI$qhIZ%hD6N|axH(ez2h?MXv<5J$B}^U$B%tPV6lKn?_9^H_ zQJ^tQ{j0_h>=Do@#zf@UxE43LXlyQtiF+_}yhov}e8K}xVev2lyQjna-48fO_4U&7 zD{FWXi4Sf*%{0^xyD?<$xAc||ihJ)3mowt1HaJXs#;8owS%e!F8j#!C=b-gYcCzXM z<)S_v4wWO9g<7*-`@rxHpm2^!h@_4rCH*W(xc#lGE{AE75S;hPkF)Ri1AD~ zW#-ql*4o "Items.Armor.Vanity"; + + public override void SetDefaults() + { + Item.width = 28; + Item.height = 20; + Item.value = Item.buyPrice(gold: 10); // Sold by Steampunker + Item.rare = ItemRarityID.Pink; + Item.vanity = true; + Item.Calamity().donorItem = true; // Donor: xAqult (Sprites made by Gote) + } + } +} diff --git a/Items/Armor/Vanity/LucisHairstyle.png b/Items/Armor/Vanity/LucisHairstyle.png new file mode 100644 index 0000000000000000000000000000000000000000..5808d530128226d48344c08dd395cde73941613f GIT binary patch literal 576 zcmV-G0>AxW{!xZ8`d-g4}k%50L;Z(>e|7nUqx92ETryc zj^Y_x$7nGB@cyM_C45*K!bk&y#sRRz2=h5C?gA2v!ETJQ_5#zHEs&645RgOh%-aj6 zz*=&2e#8z+XBfz|hP7U9*083KdN0kG7H zD{j&244BW+^Ls^dFjxp?4lHdE3;~)u09Of!D^;WW3_Y$(%KOljfca*s`d~UN#TiVm znzI*7GY%RDpr>+JE`WIlJ+5K$FrUE62|{V0WA0k8kqZv(fRqEU5Ew8Az!8Pd|X&1dG$H)3<{8K24P$<(R$l+K>i%_$-OD!7Ryi| zY;IfI(<%!oke~XZ!_oenuKj72m1&E7xqb~RYY^*2=3*0e3$t@uHwSb=_JwkM37Z0G zI}>$leb?vH{krxa#G}`qkT%ul!E5PCw|t~9&xFN7M|X6A(s(7Tgy+SjMpAMdw*#N#!6;Eti$8DqLOrgpC5X=2R_(tdZp5bx1euTvmOD57Fso~4OQ@T<_p0$$m6>y@zv_~7ZnM$`2iGK@ ze7dq#{PGL>-$G=N%U<$2?#SzBROdMMzZNUJ*u?)NsafIu7dwW+1|QplqCN!M?(JqC z^BrxB-#GB!6*A@>msxRpbo@4&HDon#tHtBV?T$LU@0WHwqc+lDHYorRoQ@}3v3I*E z@XV_^Gbr<<)N8%<&lPh-5z%uOB;Moq?ah&-HQlV0-0vO22oy02vKp{II$#4;eYtrs zYy4C&YSW9Y>#t>6_#Dl?jcz1U7(IUe3Ei3Gk+YA^BHFL*EO`F5We>`(5SUPHTpL9n z_H0vj=E?qt1Sg4A7vWbrgAIP^`onv>Sm*F~ zUtieZKAldCSaYWg{jY#WLXvDK@+r_&sT~-qnVpsyT@181UvRzDv-7pN z8~(Kjx}a@zG2*@{u$skVU?mXJpx}m6!=o6V{)J!fiEdvT=7=~{qNuYO&4Sj(Ku_) zmXA@|(uMf&-P}ePe)3bjrmk;_L|n9Jj7?Z1=93J!B6DVNK=H2D)nmF4``)^IQUv&d zH|(p15x0q_D$gDwsXQ0ntF7IIr5y62M`Y||V4NwkRvhQFl4$tf3;YVM z`_awfq+C&Zi0j5d^ri&9Jw%MCQ@Y~5Ii#uhJ~7@@8o!%@Fq%*z$hUJ0c$VzEiE0{R%<9VT1*OxuBtp& zJT0;Bz>b|?-+`gq*bs)ruB7aMG-;fbQc>c!JjMTRwT;7uC-iL)h4p4|`ddl6AWu`I z?ny)EG92lN>yhe~w9HMc5MQjlo76k-bmZ-fuV%!@u)XGQDU==GoBK$d>?r=<2Zn?KUR3 z(OF@4r>;^_TDN!2pi%H0KQ2Jc&W3uE=JLXS(5`$PUXJ61z#l?&+}-cW7_pzd3x5~? zZB3zZYwXALUn-ngej0PUAknt;9sjZ`*?JwlF0MfVeZ2O8)5#}I9on&5FE+)|Ca&>T z=-SoB$eM6Pg`RU}@Wmcz9+Sbxx%8SaV;_arT+YD zw~iEPq2t1KO4*2OKFqG-WF6R`+HV6UGh3p6FVVJCFN7MbL2q5Aqq|PxT_n*T;Do6c%0S3@E6vU zg7uySs4w7J!rB-fynkHmYm{B_K<7U*|94j~PgMckw8u&G@{VkVtP@B6uwrl%S8S9M zYiu?r@a06+Y>@iE@pA0+dA6<_L|e@4$Xlx_x!f-gD^rmO6t;lB(r%=s-lJz5n|^l> z5stT!BD0Vri<)hXlf0cn*NHi@IXK2GFWE$w*T~aLJzq(O9xBfpVCg+A04<$@OOoYv z2!p(qdozCA;cils43!^6)lA&xaQeeIMp5>g5CR`EpRJsTQKHZt9Tn)E&foR9RZ`&K zO=d|`N!LWiF0zJd2m54jE+AxyF}&93d>hx8nD7FQhO^ z`=v013mZI(v^evR@LC{9s)>ccS7uta!1TZsA>s{3VSPeBGi~PuS-b~xnrB&b3L64D zSLEd!?JSND&3`R*1w)z?+2is`zfDN3!YJkIIpXANND(!kqPUBcsjl)Sgwz*80@iMq z9E}T*o#RxZ#+{17T;J$=Q#{`i&dM&UIE|+>DQ=@Qlw%}PuHy>^u%B3D-Uig{#;k3< z)XR!Qx!FS-aCx2`!bkunyhsahnuQXfZ)2=9j&t6>YD5lgj=xx>dF5(I_3Pm@jrbgm z+7}#_dvs&6vP+1%)HG4jZCb0J{~vd%<<(M+mcAzreqTE8GIxDrQC8C#sJ{xekWsR{ zdaG^-jp`4w;=AADXDY{T5of*KzO;PTLdCdDEQ=p&W45gCUH#e48RcSH);yL`qR~X% zp=3kV=<>YIn1M=X=F)oWIV>B767j59+jkCZFk?3v2h`x?+YjRl@9H%BM;za)0LrKV z0iy(qlZM6U>(jd<4BEJPI<>Wp3205gToi;JnysP2Lhq+KlSV$$U@D zlC|DY_e2z;m9c2W&ZgrbQ;L{e(0`WKzcm+7*_Fp;BXj!D=jz5PC*i*KPglmEkDy^+=TJRx;hhHB~9zesBkpj2%c zhDYXMl&Zl_WcmiK?^o?s?^;mh%ThM;>zdtNrK(AWwc$YAhA7dXZ8#;N>+zdvPkWq7Re@FE`4R+O1II{Oic#Id zJ^CPfkhxF!aNAGZ8`yb$3ja&^iBJDxE(lEm3CO%sq6C>`3bLPYWrrBTQ|p80TWeS= zNFo=JfLbNlkOqtjz=&T;4mV&T_E=|J!>bKbT7C#U^0KYR*zY`PjG8$gZ6No|Mr)Xm zx^VhDEbC#osVdLX)3TjGMFL;tV%H+bAzyBEZ)M?ET-mMTPmwvwoV;I5?bUks zk~0O5E;>e|no^1G-b3w@ax>ec34Zq#Pkn#}-HNw;452)hI2o6YZLl7mJ8Wz-94@EY z4%lot-H7k(Kfvyh7f@y^5EwgUpx;hKA`Ma#KaBuENY9;GrgS2gntO=OoH%42zO3uY zbBq$teN`XrS@(-#O-_7}Rd zxwSYRFqW?O{1a3NBrLsQU(i^ zGu)h{XAEHj== zY-yq#s9>7-?XLG8M`>c2giY4UMG6q-K|SEj?I*WHThg&^G0uR+9Q{mOYK!*KA^0SV z5QL-r%tN_&JCn|m!0~5O#`b%ol9r>)Nu7Qj9k+qBz=w_r7DmXK5W{2P&A*#xZJ(M_ zMtRJ8Jgcjd>rnPo!FFF-GHWJ7(K9327e+V+WL`q;B68HQbq&ne#}6;XIoO1Y@xtIs zMD)OAr8V<}3l~c?*HW!jg6{?R#=%vv)X`x# z7}BUW2?2RJW2vLRe?0L_j1mHq>#v04N8eeIbS^uwa?n`I&EoMlpTV0)#r#%7@)e7I z6p-#E=*6yJ3Z3p%s3Bb&bI2!WM0gk+OlvT2Sba?c@Up~|Hzd9P(#zbWs2F0p9xPXo z!A*WZUfcoiE9J;0KJV7+n^(0bsLFOjC0#T^6KI0DmO!JiXK}PU-58ey!~HS8ghkha zhJm>+`3~6P2=zMeV;rFTvL1yQB{43FEPlg_cJyNsJ)|6?19C!9f@aJU{=i-i zSD$2Jv0<06?RcFa2bylKlBUjB=TO_2D<_5O<`Yq)eSV)anmveq6g4`m7{}) zt=~xBNN%u)a@{+p$s)s^IoH@7bgNGmIT%}FS97mi(}Xt5 z`u=hU{B_Y5XNQx8}FgIeJJs9b@-7q}IA%S_0G zDM%dqa&M!sp)LAeAJ;l4dq-CUVe`~W@Hv-d%zL9VE6C6)#ym%oDcvYH$3KbU|0rck zyxw1Oo@peQOO<-KifeiPoC`3w)G^2$Frak>D*Iz;7^Tx0V0sOid55MD1+pRF%|k1* zpBL;z1q4}+{}k`a?NxL6EC|zsMt0?LHx~~vyo&1}qz2MOJ#ej}Y53-Ls6f>S_jYUu z1soKjFgsvaTx*ex8U@<%2)I&6kwcR+8ZCHi0{2iPs?Fv5^uYoHfgPaFK((5Je*8ZIrfO|X|eVx17B{$(gH2(rT(UQFY literal 0 HcmV?d00001 diff --git a/Items/Armor/Vanity/LucisMilitaryUniform.cs b/Items/Armor/Vanity/LucisMilitaryUniform.cs new file mode 100644 index 0000000000..c2fde13007 --- /dev/null +++ b/Items/Armor/Vanity/LucisMilitaryUniform.cs @@ -0,0 +1,22 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Body)] + public class LucisMilitaryUniform : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Armor.Vanity"; + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 20; + Item.value = Item.buyPrice(gold: 10); // Sold by Steampunker + Item.rare = ItemRarityID.Pink; + Item.vanity = true; + Item.Calamity().donorItem = true; + } + } +} diff --git a/Items/Armor/Vanity/LucisMilitaryUniform.png b/Items/Armor/Vanity/LucisMilitaryUniform.png new file mode 100644 index 0000000000000000000000000000000000000000..d8017d98d069900b31109832b87b3c3dc47543b2 GIT binary patch literal 540 zcmV+%0^|LOP)M3 zsK!Vf9M(}8ieMM)yZIYTfBk0!rYA1m2&Tn9`~uV7dhB3&>!qJy`lSFHn9h&&2h*Q# zZ2;2}8ggLz#r`K?nvrf6ak8?5eI&@w54ITwrZ<;>nVp?;!L-zWh|3&8G{E$MH8;TY zGe#LOU0$9HrZa1MP|SJ%@gu}Xbhk)WQVMMImv3Lev;vPHnD!5}1Jeyt7J+G4zJleO zhMYLC_{Q~z!1RMJ@4++=7dM!G{QMcJk7#aDf}ICAjshc{z&78wbsJ3g%v}wpy$vkD z^sZ~?z_gndBsHS*w_Z2_7B5K-1=AX8s$hEk@_i5=(aj>Tbqov)Fbi)zx)0{V;(&(} zQWCJTLGlZ_kADAx)Si$-^8*NIgy; e5z(KsDOA=|uPALgl-wY<0aZfwRuRHnNN) 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 literal 0 HcmV?d00001 diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 2a23878b03..ef1dc5d284 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -2161,6 +2161,11 @@ HapuFruit: { Tooltip: "'A fruit that calms your nerves (may have unintended side effects)'" } +LucisSight: { + DisplayName: Luci's Sight + Tooltip: "'Fashionable glasses? In Earthia's current economy?!'" +} + OracleHeadphones: { DisplayName: Oracle Headphones Tooltip: "'Hey game's over!'" diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.Vanity.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.Vanity.hjson index 7ac8dddb6c..dbcac168c2 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.Vanity.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.Vanity.hjson @@ -128,6 +128,21 @@ LeviathanMask: { Tooltip: "" } +LucisBoots: { + DisplayName: Luci's Boots + Tooltip: "'One small step a time, you can do this.'" +} + +LucisHairstyle: { + DisplayName: Luci's Hairstyle + Tooltip: "'Hero of Light, Luci Skyshot.'" +} + +LucisMilitaryUniform: { + DisplayName: Luci's Military Uniform + Tooltip: "'Bearing the iconic Liberation Army insignia of freedom.'" +} + OldDukeMask: { DisplayName: Old Duke Mask Tooltip: "" diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index 330a259a1a..2e8c0548e0 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using CalamityMod.Events; using CalamityMod.Items; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Ammo; using CalamityMod.Items.Armor; using CalamityMod.Items.Armor.Vanity; @@ -1207,7 +1208,11 @@ namespace CalamityMod.NPCs { shop.Add(ItemType(), Condition.NotRemixWorld) .Add(ItemID.PurpleSolution, Condition.InGraveyard, Condition.CrimsonWorld, Condition.NotRemixWorld) - .Add(ItemID.RedSolution, Condition.InGraveyard, Condition.CorruptWorld, Condition.NotRemixWorld); + .Add(ItemID.RedSolution, Condition.InGraveyard, Condition.CorruptWorld, Condition.NotRemixWorld) + .Add(ItemType()) + .Add(ItemType()) + .Add(ItemType()) + .Add(ItemType()); } if (type == NPCID.Wizard) From 651503f85aae28c971790e9d433a1d69b88e1e1f Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Wed, 4 Jun 2025 03:09:54 +0700 Subject: [PATCH 14/47] 2.1 im getting tired of that one build number is outdated from workshop text needing to be fixed every time we release a hotfix --- build.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.txt b/build.txt index 23f413337a..f89177c05d 100644 --- a/build.txt +++ b/build.txt @@ -1,5 +1,5 @@ author = The Calamity Dev Team -version = 2.0.4.006 +version = 2.1 displayName = Calamity Mod modReferences = CalamityModMusic homepage = https://discord.gg/calamity From f25ce7771e59d62fe249b55afaeaf0efa2e5bf6a Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Tue, 3 Jun 2025 16:53:42 -0400 Subject: [PATCH 15/47] Bunch of Destroyer stuff 1 - Changed laser firing pattern to be rapid firing from head to tail, like in 1.5.0 2 - Decreased how often individual body segments fire lasers in Rev+ 3 - Destroyer and Probes no longer have further increased size in Death 4 - Fixed EoW and Destroyer forever having spawn DR outside of Rev (in-dev fix) 5 - Fixed Probes drawing backwards outside of Rev (in-dev fix) 6 - Changed Probe telegraph to be a sparkle instead of a glowmask --- NPCs/CalamityGlobalNPC.cs | 42 +++--- .../Bosses/DestroyerAI.cs | 123 +++++++++--------- 2 files changed, 79 insertions(+), 86 deletions(-) diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 900cd940e9..ce7719554c 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -1900,7 +1900,7 @@ namespace CalamityMod.NPCs else if (DestroyerIDList.Includes(npc.type)) { npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.25); - npc.scale *= Main.zenithWorld ? 2f : CalamityWorld.death ? 1.4f : 1.2f; + npc.scale *= Main.zenithWorld ? 2f : 1.2f; npc.npcSlots = 10f; } else if (npc.type == NPCID.Probe) @@ -1908,7 +1908,7 @@ namespace CalamityMod.NPCs if (CalamityWorld.death) npc.lifeMax = (int)Math.Round(npc.lifeMax * 2D); - npc.scale *= Main.zenithWorld ? 2f : CalamityWorld.death ? 1.4f : 1.2f; + npc.scale *= Main.zenithWorld ? 2f : 1.2f; } else if (npc.type == NPCID.SkeletronPrime || npc.type == NPCType()) { @@ -3793,10 +3793,13 @@ namespace CalamityMod.NPCs ApplyDR(npc, ref modifiers); // Damage reduction on spawn for certain worm bosses. - if (EaterOfWorldsIDList.Includes(npc.type) && newAI[1] < EaterOfWorldsAI.DRIncreaseTime) - modifiers.FinalDamage *= 1f - (float)Math.Sqrt(MathHelper.Lerp(BossRushEvent.BossRushActive ? 0.6f : 0f, 0.99f, MathHelper.Clamp(1f - newAI[1] / EaterOfWorldsAI.DRIncreaseTime, 0f, 1f))); - if (DestroyerIDList.Includes(npc.type) && newAI[1] < DestroyerAI.DRIncreaseTime) - modifiers.FinalDamage *= 1f - (float)Math.Sqrt(MathHelper.Lerp(0f, 0.99f, MathHelper.Clamp(1f - newAI[1] / DestroyerAI.DRIncreaseTime, 0f, 1f))); + if (CalamityWorld.revenge) + { + if (EaterOfWorldsIDList.Includes(npc.type) && newAI[1] < EaterOfWorldsAI.DRIncreaseTime) + modifiers.FinalDamage *= 1f - (float)Math.Sqrt(MathHelper.Lerp(BossRushEvent.BossRushActive ? 0.6f : 0f, 0.99f, MathHelper.Clamp(1f - newAI[1] / EaterOfWorldsAI.DRIncreaseTime, 0f, 1f))); + if (DestroyerIDList.Includes(npc.type) && newAI[1] < DestroyerAI.DRIncreaseTime) + modifiers.FinalDamage *= 1f - (float)Math.Sqrt(MathHelper.Lerp(0f, 0.99f, MathHelper.Clamp(1f - newAI[1] / DestroyerAI.DRIncreaseTime, 0f, 1f))); + } if (AstrumDeusIDList.Includes(npc.type)) { float drTime = newAI[0] != 0f ? 300f : 600f; @@ -6630,7 +6633,6 @@ namespace CalamityMod.NPCs #endregion - #region Summon Tag //doze 03-15-2025: A full refactor of the summon tag system to make it easier to use and more flexible. Ping me with any questions. private void EditSummonTagDamage(Projectile proj, NPC npc, ref NPC.HitModifiers modifiers) @@ -8084,7 +8086,7 @@ namespace CalamityMod.NPCs shouldDrawBool = false; } - if (npc.type == NPCID.Corruptor || npc.type == NPCID.BloodSquid || npc.type == NPCID.Probe || (npc.type == NPCID.HornetHoney && npc.ai[3] == 1f)) + if (npc.type == NPCID.Corruptor || npc.type == NPCID.BloodSquid || (npc.type == NPCID.HornetHoney && npc.ai[3] == 1f)) { Texture2D texture = TextureAssets.Npc[npc.type].Value; @@ -8439,10 +8441,8 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.TheDestroyerBody && revenge) { - float shootProjectileTime = death ? (phase5 ? 120f : phase4 ? 150f : 180f) : 450f; - float bodySegmentTime = npc.ai[0] * (death ? 20f : 30f); - float shootProjectileGateValue = bodySegmentTime + shootProjectileTime; - float telegraphGateValue = shootProjectileGateValue - DestroyerAI.LaserTelegraphTime; + float shootProjectileTime = death ? (phase5 ? 180f : phase4 ? 270f : 360f) : 450f; + float telegraphGateValue = shootProjectileTime - DestroyerAI.LaserTelegraphTime; if (newAI[0] > telegraphGateValue) { switch (destroyerLaserColor) @@ -8486,22 +8486,18 @@ namespace CalamityMod.NPCs } // Laser telegraph - else if (npc.type == NPCID.Probe && CalamityClientConfig.Instance.EnableVanillaTextureEdits) + else if (npc.type == NPCID.Probe) { float eyeTelegraphGateValue = (NPC.IsMechQueenUp ? DestroyerAI.ProbeLaserGateValue_Mechdusa : BossRushEvent.BossRushActive ? DestroyerAI.ProbeLaserGateValue_BossRush : revenge ? DestroyerAI.ProbeLaserGateValue_Rev : DestroyerAI.ProbeLaserGateValue) - DestroyerAI.ProbeLaserTelegraphTime; - Texture2D glowTexture = ExtraTextureRefs.ProbeGlowmask.Value; + Texture2D glowTexture = Request("CalamityMod/Particles/Sparkle").Value; Vector2 halfSize = npc.frame.Size() / 2; - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == -1) - spriteEffects = SpriteEffects.FlipHorizontally; + Vector2 drawPosition = npc.Center - screenPos + Vector2.UnitX.RotatedBy(npc.rotation) * (npc.width * 0.45f * npc.spriteDirection) + Vector2.UnitY * npc.gfxOffY; float colorScale = MathHelper.Clamp((npc.localAI[0] - eyeTelegraphGateValue) / DestroyerAI.ProbeLaserTelegraphTime, 0f, 1f); - Color drawColor2 = Color.Lerp(new Color(150, 0, 0, 192), new Color(255, 100, 150, 192), colorScale); - for (int i = 0; i < 2; i++) - { - spriteBatch.Draw(glowTexture, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, - drawColor2, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); - } + Color drawColor2 = new Color(255, 100, 150, 192) * colorScale; + spriteBatch.SetBlendState(BlendState.Additive); + spriteBatch.Draw(glowTexture, drawPosition, npc.frame, drawColor2, npc.rotation, halfSize, npc.scale * 1.1f, SpriteEffects.None, 0f); + spriteBatch.SetBlendState(BlendState.AlphaBlend); } if (revenge) diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs index c26be9d26d..daf09376b2 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs @@ -311,13 +311,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (j == totalSegments) type = NPCID.TheDestroyerTail; - int segment = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X), (int)(npc.position.Y + npc.height), type, npc.whoAmI); - Main.npc[segment].ai[3] = npc.whoAmI; - Main.npc[segment].realLife = npc.whoAmI; - Main.npc[segment].ai[1] = index; - Main.npc[index].ai[0] = segment; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, segment); - index = segment; + int segment = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X), (int)(npc.position.Y + npc.height), type, npc.whoAmI); + Main.npc[segment].ai[3] = npc.whoAmI; + Main.npc[segment].realLife = npc.whoAmI; + Main.npc[segment].ai[1] = index; + Main.npc[index].ai[0] = segment; + Main.npc[index].Calamity().newAI[0] = -90f - Main.npc[index].ai[0] * (death ? 12f : 3f); // This controls the delay between laser shots + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, segment); + index = segment; } } @@ -412,28 +413,25 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Set laser color and type if (calamityGlobalNPC.destroyerLaserColor == -1 && !probeLaunched) { - if (Main.rand.NextBool(death ? OneInXChanceToFireLaser / (phase5 ? 4 : phase4 ? 3 : 2) : OneInXChanceToFireLaser)) + int random = phase3 ? 4 : phase2 ? 3 : 2; + switch (Main.rand.Next(random)) { - int random = phase3 ? 4 : phase2 ? 3 : 2; - switch (Main.rand.Next(random)) - { - case 0: - case 1: - calamityGlobalNPC.destroyerLaserColor = 0; - break; - case 2: - calamityGlobalNPC.destroyerLaserColor = 1; - break; - case 3: - calamityGlobalNPC.destroyerLaserColor = 2; - break; - } - - if (calamityGlobalNPC.newAI[2] > 0f || bossRush) + case 0: + case 1: + calamityGlobalNPC.destroyerLaserColor = 0; + break; + case 2: + calamityGlobalNPC.destroyerLaserColor = 1; + break; + case 3: calamityGlobalNPC.destroyerLaserColor = 2; - - npc.SyncDestroyerLaserColor(); + break; } + + if (calamityGlobalNPC.newAI[2] > 0f || bossRush) + calamityGlobalNPC.destroyerLaserColor = 2; + + npc.SyncDestroyerLaserColor(); } if (probeLaunched && ableToFireLaser) @@ -443,12 +441,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Laser rate of fire - float shootProjectileTime = death ? (phase5 ? 120f : phase4 ? 150f : 180f) : 450f; - float bodySegmentTime = npc.ai[0] * (death ? 20f : 30f); - float shootProjectileGateValue = bodySegmentTime + shootProjectileTime; - float laserTimerIncrement = (calamityGlobalNPC.newAI[0] > shootProjectileGateValue - LaserTelegraphTime) ? 1f : 2f; + float shootProjectileTime = death ? (phase5 ? 180f : phase4 ? 270f : 360f) : 450f; if (ableToFireLaser) - calamityGlobalNPC.newAI[0] += laserTimerIncrement; + calamityGlobalNPC.newAI[0] += 1f; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -471,7 +466,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses break; } - if (calamityGlobalNPC.newAI[0] == shootProjectileGateValue - LaserTelegraphTime) + if (calamityGlobalNPC.newAI[0] == shootProjectileTime - LaserTelegraphTime) { Particle telegraph = new DestroyerReticleTelegraph( npc, @@ -482,7 +477,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses GeneralParticleHandler.SpawnParticle(telegraph); } - if (calamityGlobalNPC.newAI[0] == shootProjectileGateValue - SparkTelegraphTime) + if (calamityGlobalNPC.newAI[0] == shootProjectileTime - SparkTelegraphTime) { Particle spark = new DestroyerSparkTelegraph( npc, @@ -496,40 +491,44 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Shoot lasers // Shoot nothing if probe has been launched - if (calamityGlobalNPC.newAI[0] >= shootProjectileGateValue && ableToFireLaser) + if (calamityGlobalNPC.newAI[0] >= shootProjectileTime && ableToFireLaser) { + int numProbeSegments = 0; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == npc.type && Main.npc[i].ai[2] == 0f) + numProbeSegments++; + } + float lerpAmount = MathHelper.Clamp(numProbeSegments / (float)totalSegments, 0f, 1f); + float laserShootTimeBonus = (int)MathHelper.Lerp(0f, shootProjectileTime - LaserTelegraphTime, 1f - lerpAmount); + // Controls the fire rate getting slower as health lowers if (!death) { - int numProbeSegments = 0; - for (int i = 0; i < Main.maxNPCs; i++) + if (npc.localAI[3] == 0f && phase2) { - if (Main.npc[i].active && Main.npc[i].type == npc.type && Main.npc[i].ai[2] == 0f) - numProbeSegments++; + npc.localAI[3] = 1f; + npc.SyncVanillaLocalAI(); + laserShootTimeBonus -= npc.ai[0] * 2f; + } + else if (npc.localAI[3] == 1f && phase3) + { + npc.localAI[3] = 2f; + npc.SyncVanillaLocalAI(); + laserShootTimeBonus -= npc.ai[0] * 2f; + } + else if (npc.localAI[3] == 2f && startFlightPhase) + { + npc.localAI[3] = 3f; + npc.SyncVanillaLocalAI(); + laserShootTimeBonus -= npc.ai[0]; } - float lerpAmount = MathHelper.Clamp(numProbeSegments / (float)totalSegments, 0f, 1f); - float laserShootTimeBonus = (int)MathHelper.Lerp(0f, (shootProjectileTime + bodySegmentTime * lerpAmount) - LaserTelegraphTime, 1f - lerpAmount); - calamityGlobalNPC.newAI[0] = laserShootTimeBonus; - npc.SyncExtraAI(); - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); } + calamityGlobalNPC.newAI[0] = laserShootTimeBonus; + npc.SyncExtraAI(); + CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { - if (death) - { - int numProbeSegments = 0; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active && Main.npc[i].type == npc.type && Main.npc[i].ai[2] == 0f) - numProbeSegments++; - } - float lerpAmount = MathHelper.Clamp(numProbeSegments / (float)totalSegments, 0f, 1f); - float laserShootTimeBonus = (int)MathHelper.Lerp(0f, (shootProjectileTime + bodySegmentTime * lerpAmount) - LaserTelegraphTime, 1f - lerpAmount); - calamityGlobalNPC.newAI[0] = laserShootTimeBonus; - npc.SyncExtraAI(); - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - } - // Laser speed float projectileSpeed = (death ? 4.5f : 3.5f) + Main.rand.NextFloat() * 1.5f; projectileSpeed += enrageScale; @@ -713,9 +712,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else if (npc.type == NPCID.TheDestroyerBody) { float shootProjectileTime = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 270f : 450f; - float bodySegmentTime = npc.ai[0] * 30f; - float shootProjectileGateValue = bodySegmentTime + shootProjectileTime; - float telegraphGateValue = shootProjectileGateValue - LaserTelegraphTime; + float telegraphGateValue = shootProjectileTime - LaserTelegraphTime; if (calamityGlobalNPC.newAI[0] > telegraphGateValue) { switch (calamityGlobalNPC.destroyerLaserColor) @@ -1241,12 +1238,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (targetData.Center.X - npc.Center.X > 0f) { - npc.spriteDirection = -1; + npc.spriteDirection = 1; npc.rotation = (float)Math.Atan2(targetData.Center.Y - npc.Center.Y, targetData.Center.X - npc.Center.X); } else { - npc.spriteDirection = 1; + npc.spriteDirection = -1; npc.rotation = (float)Math.Atan2(targetData.Center.Y - npc.Center.Y, targetData.Center.X - npc.Center.X) + MathHelper.Pi; } From bebc57a75ec678e9ccf5848124dc704d9b8c715c Mon Sep 17 00:00:00 2001 From: Xyk Date: Wed, 28 May 2025 12:58:01 -0700 Subject: [PATCH 16/47] Makes Holy Collider able to launch Provi's fireballs --- Projectiles/Melee/HolyColliderHoldout.cs | 29 +++++++++++++++++++---- Projectiles/Melee/HolyColliderHolyFire.cs | 2 +- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/Projectiles/Melee/HolyColliderHoldout.cs b/Projectiles/Melee/HolyColliderHoldout.cs index ae4988b83b..85b81b9c35 100644 --- a/Projectiles/Melee/HolyColliderHoldout.cs +++ b/Projectiles/Melee/HolyColliderHoldout.cs @@ -5,6 +5,7 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.NPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.Boss; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -333,10 +334,29 @@ namespace CalamityMod.Projectiles.Melee for (int x = 0; x < Main.maxProjectiles; x++) { Projectile projectile = Main.projectile[x]; - if (Vector2.Distance(Owner.Center + (new Vector2(100, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))), projectile.Center) <= 100 && projectile.active && projectile.type == ModContent.ProjectileType()) + bool isProviProj = (projectile.type == ModContent.ProjectileType() || + projectile.type == ModContent.ProjectileType() || + projectile.type == ModContent.ProjectileType() || + projectile.type == ModContent.ProjectileType() || + projectile.type == ModContent.ProjectileType()); + bool isAFireball = (projectile.active && projectile.type == ModContent.ProjectileType() && projectile.ai[0] != 10) || isProviProj; + if (Vector2.Distance(Owner.Center + (new Vector2(100, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))), projectile.Center) <= 100 + Math.Max(projectile.width, projectile.height) && projectile.active && isAFireball) { - projectile.ai[2] = 5; - projectile.owner = Owner.whoAmI; + if (isProviProj) + { + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), projectile.Center, (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -2.5f, ModContent.ProjectileType(), (int)((Projectile.damage * 0.1) + projectile.damage), Projectile.knockBack, Projectile.owner, 0, 15, 5); + Particle orb2 = new CustomPulse(projectile.Center, Vector2.Zero, Color.Goldenrod, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.8f, 11); + GeneralParticleHandler.SpawnParticle(orb2); + if (projectile.type == ModContent.ProjectileType()) + projectile.active = false; + else + projectile.Kill(); + } + else + { + projectile.ai[2] = 5; + projectile.owner = Owner.whoAmI; + } } } } @@ -345,7 +365,8 @@ namespace CalamityMod.Projectiles.Melee for (int x = 0; x < Main.maxProjectiles; x++) { Projectile projectile = Main.projectile[x]; - if (Vector2.Distance(Owner.Center + (new Vector2(100, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))), projectile.Center) <= 100 && projectile.active && projectile.type == ModContent.ProjectileType() && projectile.ai[0] != 10) + bool isAFireball = (projectile.active && projectile.type == ModContent.ProjectileType() && projectile.ai[0] != 10); + if (Vector2.Distance(Owner.Center + (new Vector2(100, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))), projectile.Center) <= 100 && isAFireball) { Vector2 launch = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -2.5f; projectile.velocity += launch; diff --git a/Projectiles/Melee/HolyColliderHolyFire.cs b/Projectiles/Melee/HolyColliderHolyFire.cs index fd51d02d91..828efb341a 100644 --- a/Projectiles/Melee/HolyColliderHolyFire.cs +++ b/Projectiles/Melee/HolyColliderHolyFire.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Melee public bool setStats = true; public static int statMax = 8; public int setStatTimer = statMax; - public int time = 0; + public ref float time => ref Projectile.ai[1]; public override void SetStaticDefaults() { Main.projFrames[Type] = 4; From 445ad6b0efa281da9307ac25cd241e0ca4a628c3 Mon Sep 17 00:00:00 2001 From: Xyk Date: Wed, 28 May 2025 23:34:11 -0700 Subject: [PATCH 17/47] Better proj collision --- Projectiles/Melee/HolyColliderHoldout.cs | 4 ++-- Projectiles/Melee/HolyColliderHolyFire.cs | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Projectiles/Melee/HolyColliderHoldout.cs b/Projectiles/Melee/HolyColliderHoldout.cs index 85b81b9c35..1ae89b259a 100644 --- a/Projectiles/Melee/HolyColliderHoldout.cs +++ b/Projectiles/Melee/HolyColliderHoldout.cs @@ -340,7 +340,7 @@ namespace CalamityMod.Projectiles.Melee projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()); bool isAFireball = (projectile.active && projectile.type == ModContent.ProjectileType() && projectile.ai[0] != 10) || isProviProj; - if (Vector2.Distance(Owner.Center + (new Vector2(100, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))), projectile.Center) <= 100 + Math.Max(projectile.width, projectile.height) && projectile.active && isAFireball) + if (Vector2.Distance(Owner.Center + (new Vector2(60, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))), projectile.Center) <= 150 + Math.Max(projectile.width, projectile.height) && projectile.active && isAFireball) { if (isProviProj) { @@ -366,7 +366,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile projectile = Main.projectile[x]; bool isAFireball = (projectile.active && projectile.type == ModContent.ProjectileType() && projectile.ai[0] != 10); - if (Vector2.Distance(Owner.Center + (new Vector2(100, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))), projectile.Center) <= 100 && isAFireball) + if (Vector2.Distance(Owner.Center + (new Vector2(60, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))), projectile.Center) <= 150 && isAFireball) { Vector2 launch = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -2.5f; projectile.velocity += launch; diff --git a/Projectiles/Melee/HolyColliderHolyFire.cs b/Projectiles/Melee/HolyColliderHolyFire.cs index 828efb341a..d5b585955f 100644 --- a/Projectiles/Melee/HolyColliderHolyFire.cs +++ b/Projectiles/Melee/HolyColliderHolyFire.cs @@ -44,10 +44,13 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { Player Owner = Main.player[Projectile.owner]; - if (Projectile.ai[2] == 5 && time > 10 && Projectile.ai[0] != 10) + int hitTime = 13; // Time to pass before it can be launched + + if (Projectile.ai[2] == 5 && time >= hitTime && Projectile.ai[0] != 10) isLaunched = true; else Projectile.ai[2] = 0; + Projectile.scale = Utils.GetLerpValue(0, 40, Projectile.timeLeft, true); From b547614358eb2329a2c2471f00de81456d22bb80 Mon Sep 17 00:00:00 2001 From: Xyk Date: Wed, 28 May 2025 12:56:07 -0700 Subject: [PATCH 18/47] Fixed some bullets breaking when fired from Infinity and Svant --- Items/Weapons/Ranged/Infinity.cs | 4 ++-- Items/Weapons/Ranged/Svantechnical.cs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Items/Weapons/Ranged/Infinity.cs b/Items/Weapons/Ranged/Infinity.cs index 8a164a88ae..f2f5ffe8ec 100644 --- a/Items/Weapons/Ranged/Infinity.cs +++ b/Items/Weapons/Ranged/Infinity.cs @@ -64,8 +64,8 @@ namespace CalamityMod.Items.Weapons.Ranged { Vector2 helixVel1 = (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedBy(MathHelper.ToRadians(sine)); Vector2 helixVel2 = (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedBy(MathHelper.ToRadians(-sine)); - int shot1 = Projectile.NewProjectile(source, position.X, position.Y, helixVel1.X, helixVel1.Y, shotType, damage, knockback, player.whoAmI, 0f, 0, 1f); - int shot2 = Projectile.NewProjectile(source, position.X, position.Y, helixVel2.X, helixVel2.Y, shotType, damage, knockback, player.whoAmI, 0f, 0, 1f); + int shot1 = Projectile.NewProjectile(source, position.X, position.Y, helixVel1.X, helixVel1.Y, shotType, damage, knockback, player.whoAmI, 0f, 0, player.altFunctionUse != 2 ? 1 : 0); + int shot2 = Projectile.NewProjectile(source, position.X, position.Y, helixVel2.X, helixVel2.Y, shotType, damage, knockback, player.whoAmI, 0f, 0, player.altFunctionUse != 2 ? 1 : 0); } else if (player.altFunctionUse != 2) { diff --git a/Items/Weapons/Ranged/Svantechnical.cs b/Items/Weapons/Ranged/Svantechnical.cs index 2261b93f72..d8f1d3de75 100644 --- a/Items/Weapons/Ranged/Svantechnical.cs +++ b/Items/Weapons/Ranged/Svantechnical.cs @@ -65,9 +65,9 @@ namespace CalamityMod.Items.Weapons.Ranged Vector2 helixVel1 = (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedBy(MathHelper.ToRadians(sine)); Vector2 helixVel2 = (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedBy(MathHelper.ToRadians(-sine)); Vector2 helixVel3 = (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedBy(MathHelper.ToRadians(sine2)); - int shot1 = Projectile.NewProjectile(source, position.X, position.Y, helixVel1.X, helixVel1.Y, shotType, damage, knockback, player.whoAmI, 0f, 0, 2f); - int shot2 = Projectile.NewProjectile(source, position.X, position.Y, helixVel2.X, helixVel2.Y, shotType, damage, knockback, player.whoAmI, 0f, 0, 4f); - int shot3 = Projectile.NewProjectile(source, position.X, position.Y, helixVel3.X, helixVel3.Y, shotType, damage, knockback, player.whoAmI, 0f, 0, 3f); + int shot1 = Projectile.NewProjectile(source, position.X, position.Y, helixVel1.X, helixVel1.Y, shotType, damage, knockback, player.whoAmI, 0f, 0, player.altFunctionUse != 2 ? 2f : 0); + int shot2 = Projectile.NewProjectile(source, position.X, position.Y, helixVel2.X, helixVel2.Y, shotType, damage, knockback, player.whoAmI, 0f, 0, player.altFunctionUse != 2 ? 4f : 0); + int shot3 = Projectile.NewProjectile(source, position.X, position.Y, helixVel3.X, helixVel3.Y, shotType, damage, knockback, player.whoAmI, 0f, 0, player.altFunctionUse != 2 ? 3f : 0); } else if (player.altFunctionUse != 2) { From 87b8f0f95bd03edf6b0f988d6f2e16c4c73fd245 Mon Sep 17 00:00:00 2001 From: Eddie Spaghetti Date: Tue, 3 Jun 2025 17:36:36 -0500 Subject: [PATCH 19/47] Refactors Refactored Aerospec and Auric armor to have readable internal names. --- .../{AerospecHat.cs => AerospecHeadMagic.cs} | 3 ++- .../{AerospecHat.png => AerospecHeadMagic.png} | Bin ...ospecHat_Head.png => AerospecHeadMagic_Head.png} | Bin .../{AerospecHelm.cs => AerospecHeadMelee.cs} | 5 +++-- .../{AerospecHelm.png => AerospecHeadMelee.png} | Bin ...specHelm_Head.png => AerospecHeadMelee_Head.png} | Bin .../{AerospecHood.cs => AerospecHeadRanged.cs} | 5 +++-- .../{AerospecHood.png => AerospecHeadRanged.png} | Bin ...pecHood_Head.png => AerospecHeadRanged_Head.png} | Bin .../{AerospecHeadgear.cs => AerospecHeadRogue.cs} | 5 +++-- .../{AerospecHeadgear.png => AerospecHeadRogue.png} | Bin ...Headgear_Head.png => AerospecHeadRogue_Head.png} | Bin .../{AerospecHelmet.cs => AerospecHeadSummon.cs} | 5 +++-- .../{AerospecHelmet.png => AerospecHeadSummon.png} | Bin ...cHelmet_Head.png => AerospecHeadSummon_Head.png} | Bin ...laWireHemmedVisage.cs => AuricTeslaHeadMagic.cs} | 5 +++-- ...WireHemmedVisage.png => AuricTeslaHeadMagic.png} | Bin ...Visage_Head.png => AuricTeslaHeadMagic_Head.png} | Bin ...uricTeslaRoyalHelm.cs => AuricTeslaHeadMelee.cs} | 5 +++-- ...icTeslaRoyalHelm.png => AuricTeslaHeadMelee.png} | Bin ...alHelm_Head.png => AuricTeslaHeadMelee_Head.png} | Bin ...slaHoodedFacemask.cs => AuricTeslaHeadRanged.cs} | 5 +++-- ...aHoodedFacemask.png => AuricTeslaHeadRanged.png} | Bin ...emask_Head.png => AuricTeslaHeadRanged_Head.png} | Bin ...ricTeslaPlumedHelm.cs => AuricTeslaHeadRogue.cs} | 3 ++- ...cTeslaPlumedHelm.png => AuricTeslaHeadRogue.png} | Bin ...edHelm_Head.png => AuricTeslaHeadRogue_Head.png} | Bin ...cTeslaSpaceHelmet.cs => AuricTeslaHeadSummon.cs} | 5 +++-- ...eslaSpaceHelmet.png => AuricTeslaHeadSummon.png} | Bin ...elmet_Head.png => AuricTeslaHeadSummon_Head.png} | Bin .../Mods.CalamityMod.Items.Armor.PostMoonLord.hjson | 10 +++++----- .../Mods.CalamityMod.Items.Armor.PreHardmode.hjson | 12 ++++++------ 32 files changed, 39 insertions(+), 29 deletions(-) rename Items/Armor/Aerospec/{AerospecHat.cs => AerospecHeadMagic.cs} (95%) rename Items/Armor/Aerospec/{AerospecHat.png => AerospecHeadMagic.png} (100%) rename Items/Armor/Aerospec/{AerospecHat_Head.png => AerospecHeadMagic_Head.png} (100%) rename Items/Armor/Aerospec/{AerospecHelm.cs => AerospecHeadMelee.cs} (94%) rename Items/Armor/Aerospec/{AerospecHelm.png => AerospecHeadMelee.png} (100%) rename Items/Armor/Aerospec/{AerospecHelm_Head.png => AerospecHeadMelee_Head.png} (100%) rename Items/Armor/Aerospec/{AerospecHood.cs => AerospecHeadRanged.cs} (94%) rename Items/Armor/Aerospec/{AerospecHood.png => AerospecHeadRanged.png} (100%) rename Items/Armor/Aerospec/{AerospecHood_Head.png => AerospecHeadRanged_Head.png} (100%) rename Items/Armor/Aerospec/{AerospecHeadgear.cs => AerospecHeadRogue.cs} (94%) rename Items/Armor/Aerospec/{AerospecHeadgear.png => AerospecHeadRogue.png} (100%) rename Items/Armor/Aerospec/{AerospecHeadgear_Head.png => AerospecHeadRogue_Head.png} (100%) rename Items/Armor/Aerospec/{AerospecHelmet.cs => AerospecHeadSummon.cs} (96%) rename Items/Armor/Aerospec/{AerospecHelmet.png => AerospecHeadSummon.png} (100%) rename Items/Armor/Aerospec/{AerospecHelmet_Head.png => AerospecHeadSummon_Head.png} (100%) rename Items/Armor/Auric/{AuricTeslaWireHemmedVisage.cs => AuricTeslaHeadMagic.cs} (96%) rename Items/Armor/Auric/{AuricTeslaWireHemmedVisage.png => AuricTeslaHeadMagic.png} (100%) rename Items/Armor/Auric/{AuricTeslaWireHemmedVisage_Head.png => AuricTeslaHeadMagic_Head.png} (100%) rename Items/Armor/Auric/{AuricTeslaRoyalHelm.cs => AuricTeslaHeadMelee.cs} (97%) rename Items/Armor/Auric/{AuricTeslaRoyalHelm.png => AuricTeslaHeadMelee.png} (100%) rename Items/Armor/Auric/{AuricTeslaRoyalHelm_Head.png => AuricTeslaHeadMelee_Head.png} (100%) rename Items/Armor/Auric/{AuricTeslaHoodedFacemask.cs => AuricTeslaHeadRanged.cs} (96%) rename Items/Armor/Auric/{AuricTeslaHoodedFacemask.png => AuricTeslaHeadRanged.png} (100%) rename Items/Armor/Auric/{AuricTeslaHoodedFacemask_Head.png => AuricTeslaHeadRanged_Head.png} (100%) rename Items/Armor/Auric/{AuricTeslaPlumedHelm.cs => AuricTeslaHeadRogue.cs} (97%) rename Items/Armor/Auric/{AuricTeslaPlumedHelm.png => AuricTeslaHeadRogue.png} (100%) rename Items/Armor/Auric/{AuricTeslaPlumedHelm_Head.png => AuricTeslaHeadRogue_Head.png} (100%) rename Items/Armor/Auric/{AuricTeslaSpaceHelmet.cs => AuricTeslaHeadSummon.cs} (96%) rename Items/Armor/Auric/{AuricTeslaSpaceHelmet.png => AuricTeslaHeadSummon.png} (100%) rename Items/Armor/Auric/{AuricTeslaSpaceHelmet_Head.png => AuricTeslaHeadSummon_Head.png} (100%) diff --git a/Items/Armor/Aerospec/AerospecHat.cs b/Items/Armor/Aerospec/AerospecHeadMagic.cs similarity index 95% rename from Items/Armor/Aerospec/AerospecHat.cs rename to Items/Armor/Aerospec/AerospecHeadMagic.cs index 5b81c6206c..084d548d20 100644 --- a/Items/Armor/Aerospec/AerospecHat.cs +++ b/Items/Armor/Aerospec/AerospecHeadMagic.cs @@ -7,7 +7,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Aerospec { [AutoloadEquip(EquipType.Head)] - public class AerospecHat : ModItem, ILocalizedModType + [LegacyName("AerospecHat")] + public class AerospecHeadMagic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PreHardmode"; public override void SetDefaults() diff --git a/Items/Armor/Aerospec/AerospecHat.png b/Items/Armor/Aerospec/AerospecHeadMagic.png similarity index 100% rename from Items/Armor/Aerospec/AerospecHat.png rename to Items/Armor/Aerospec/AerospecHeadMagic.png diff --git a/Items/Armor/Aerospec/AerospecHat_Head.png b/Items/Armor/Aerospec/AerospecHeadMagic_Head.png similarity index 100% rename from Items/Armor/Aerospec/AerospecHat_Head.png rename to Items/Armor/Aerospec/AerospecHeadMagic_Head.png diff --git a/Items/Armor/Aerospec/AerospecHelm.cs b/Items/Armor/Aerospec/AerospecHeadMelee.cs similarity index 94% rename from Items/Armor/Aerospec/AerospecHelm.cs rename to Items/Armor/Aerospec/AerospecHeadMelee.cs index 0a8e39c35d..1d7b21e058 100644 --- a/Items/Armor/Aerospec/AerospecHelm.cs +++ b/Items/Armor/Aerospec/AerospecHeadMelee.cs @@ -7,7 +7,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Aerospec { [AutoloadEquip(EquipType.Head)] - public class AerospecHelm : ModItem, ILocalizedModType + [LegacyName("AerospecHelm")] + public class AerospecHeadMelee : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PreHardmode"; public override void SetDefaults() @@ -52,7 +53,7 @@ namespace CalamityMod.Items.Armor.Aerospec AddIngredient(ItemID.SunplateBlock, 3). AddIngredient(ItemID.Feather). AddTile(TileID.Anvils). - SortBeforeFirstRecipesOf(ModContent.ItemType()). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Aerospec/AerospecHelm.png b/Items/Armor/Aerospec/AerospecHeadMelee.png similarity index 100% rename from Items/Armor/Aerospec/AerospecHelm.png rename to Items/Armor/Aerospec/AerospecHeadMelee.png diff --git a/Items/Armor/Aerospec/AerospecHelm_Head.png b/Items/Armor/Aerospec/AerospecHeadMelee_Head.png similarity index 100% rename from Items/Armor/Aerospec/AerospecHelm_Head.png rename to Items/Armor/Aerospec/AerospecHeadMelee_Head.png diff --git a/Items/Armor/Aerospec/AerospecHood.cs b/Items/Armor/Aerospec/AerospecHeadRanged.cs similarity index 94% rename from Items/Armor/Aerospec/AerospecHood.cs rename to Items/Armor/Aerospec/AerospecHeadRanged.cs index 6b41319026..01fc45869d 100644 --- a/Items/Armor/Aerospec/AerospecHood.cs +++ b/Items/Armor/Aerospec/AerospecHeadRanged.cs @@ -7,7 +7,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Aerospec { [AutoloadEquip(EquipType.Head)] - public class AerospecHood : ModItem, ILocalizedModType + [LegacyName("AerospecHood")] + public class AerospecHeadRanged : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PreHardmode"; public override void SetDefaults() @@ -51,7 +52,7 @@ namespace CalamityMod.Items.Armor.Aerospec AddIngredient(ItemID.SunplateBlock, 3). AddIngredient(ItemID.Feather). AddTile(TileID.Anvils). - SortAfterFirstRecipesOf(ModContent.ItemType()). + SortAfterFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Aerospec/AerospecHood.png b/Items/Armor/Aerospec/AerospecHeadRanged.png similarity index 100% rename from Items/Armor/Aerospec/AerospecHood.png rename to Items/Armor/Aerospec/AerospecHeadRanged.png diff --git a/Items/Armor/Aerospec/AerospecHood_Head.png b/Items/Armor/Aerospec/AerospecHeadRanged_Head.png similarity index 100% rename from Items/Armor/Aerospec/AerospecHood_Head.png rename to Items/Armor/Aerospec/AerospecHeadRanged_Head.png diff --git a/Items/Armor/Aerospec/AerospecHeadgear.cs b/Items/Armor/Aerospec/AerospecHeadRogue.cs similarity index 94% rename from Items/Armor/Aerospec/AerospecHeadgear.cs rename to Items/Armor/Aerospec/AerospecHeadRogue.cs index e4e6d096d3..be4a49a3d4 100644 --- a/Items/Armor/Aerospec/AerospecHeadgear.cs +++ b/Items/Armor/Aerospec/AerospecHeadRogue.cs @@ -7,7 +7,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Aerospec { [AutoloadEquip(EquipType.Head)] - public class AerospecHeadgear : ModItem, ILocalizedModType + [LegacyName("AerospecHeadgear")] + public class AerospecHeadRogue : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PreHardmode"; public override void SetStaticDefaults() @@ -60,7 +61,7 @@ namespace CalamityMod.Items.Armor.Aerospec AddIngredient(ItemID.SunplateBlock, 3). AddIngredient(ItemID.Feather). AddTile(TileID.Anvils). - SortAfterFirstRecipesOf(ModContent.ItemType()). + SortAfterFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Aerospec/AerospecHeadgear.png b/Items/Armor/Aerospec/AerospecHeadRogue.png similarity index 100% rename from Items/Armor/Aerospec/AerospecHeadgear.png rename to Items/Armor/Aerospec/AerospecHeadRogue.png diff --git a/Items/Armor/Aerospec/AerospecHeadgear_Head.png b/Items/Armor/Aerospec/AerospecHeadRogue_Head.png similarity index 100% rename from Items/Armor/Aerospec/AerospecHeadgear_Head.png rename to Items/Armor/Aerospec/AerospecHeadRogue_Head.png diff --git a/Items/Armor/Aerospec/AerospecHelmet.cs b/Items/Armor/Aerospec/AerospecHeadSummon.cs similarity index 96% rename from Items/Armor/Aerospec/AerospecHelmet.cs rename to Items/Armor/Aerospec/AerospecHeadSummon.cs index 2ab7b3fd09..30c0bd3564 100644 --- a/Items/Armor/Aerospec/AerospecHelmet.cs +++ b/Items/Armor/Aerospec/AerospecHeadSummon.cs @@ -10,7 +10,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Aerospec { [AutoloadEquip(EquipType.Head)] - public class AerospecHelmet : ModItem, ILocalizedModType + [LegacyName("AreospectHelmet")] + public class AerospecHeadSummon : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PreHardmode"; public static int ValkyrieDamage = 20; @@ -74,7 +75,7 @@ namespace CalamityMod.Items.Armor.Aerospec AddIngredient(ItemID.SunplateBlock, 3). AddIngredient(ItemID.Feather). AddTile(TileID.Anvils). - SortBeforeFirstRecipesOf(ModContent.ItemType()). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Aerospec/AerospecHelmet.png b/Items/Armor/Aerospec/AerospecHeadSummon.png similarity index 100% rename from Items/Armor/Aerospec/AerospecHelmet.png rename to Items/Armor/Aerospec/AerospecHeadSummon.png diff --git a/Items/Armor/Aerospec/AerospecHelmet_Head.png b/Items/Armor/Aerospec/AerospecHeadSummon_Head.png similarity index 100% rename from Items/Armor/Aerospec/AerospecHelmet_Head.png rename to Items/Armor/Aerospec/AerospecHeadSummon_Head.png diff --git a/Items/Armor/Auric/AuricTeslaWireHemmedVisage.cs b/Items/Armor/Auric/AuricTeslaHeadMagic.cs similarity index 96% rename from Items/Armor/Auric/AuricTeslaWireHemmedVisage.cs rename to Items/Armor/Auric/AuricTeslaHeadMagic.cs index aa367ba49a..6c932422b7 100644 --- a/Items/Armor/Auric/AuricTeslaWireHemmedVisage.cs +++ b/Items/Armor/Auric/AuricTeslaHeadMagic.cs @@ -12,7 +12,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Auric { [AutoloadEquip(EquipType.Head)] - public class AuricTeslaWireHemmedVisage : ModItem, ILocalizedModType + [LegacyName("AuricTeslaWireHemmedVisage")] + public class AuricTeslaHeadMagic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; public override void SetDefaults() @@ -95,7 +96,7 @@ namespace CalamityMod.Items.Armor.Auric AddIngredient(). AddIngredient(12). AddTile(). - SortBeforeFirstRecipesOf(ModContent.ItemType()). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Auric/AuricTeslaWireHemmedVisage.png b/Items/Armor/Auric/AuricTeslaHeadMagic.png similarity index 100% rename from Items/Armor/Auric/AuricTeslaWireHemmedVisage.png rename to Items/Armor/Auric/AuricTeslaHeadMagic.png diff --git a/Items/Armor/Auric/AuricTeslaWireHemmedVisage_Head.png b/Items/Armor/Auric/AuricTeslaHeadMagic_Head.png similarity index 100% rename from Items/Armor/Auric/AuricTeslaWireHemmedVisage_Head.png rename to Items/Armor/Auric/AuricTeslaHeadMagic_Head.png diff --git a/Items/Armor/Auric/AuricTeslaRoyalHelm.cs b/Items/Armor/Auric/AuricTeslaHeadMelee.cs similarity index 97% rename from Items/Armor/Auric/AuricTeslaRoyalHelm.cs rename to Items/Armor/Auric/AuricTeslaHeadMelee.cs index ce0b3e9aae..bb5430ef7a 100644 --- a/Items/Armor/Auric/AuricTeslaRoyalHelm.cs +++ b/Items/Armor/Auric/AuricTeslaHeadMelee.cs @@ -15,7 +15,8 @@ namespace CalamityMod.Items.Armor.Auric { [AutoloadEquip(EquipType.Head)] [LegacyName("AuricTeslaHelm")] - public class AuricTeslaRoyalHelm : ModItem, ILocalizedModType + [LegacyName("AuricTeslaRoyalHelm")] + public class AuricTeslaHeadMelee : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; public override void SetDefaults() @@ -103,7 +104,7 @@ namespace CalamityMod.Items.Armor.Auric AddIngredient(). AddIngredient(12). AddTile(). - SortBeforeFirstRecipesOf(ModContent.ItemType()). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Auric/AuricTeslaRoyalHelm.png b/Items/Armor/Auric/AuricTeslaHeadMelee.png similarity index 100% rename from Items/Armor/Auric/AuricTeslaRoyalHelm.png rename to Items/Armor/Auric/AuricTeslaHeadMelee.png diff --git a/Items/Armor/Auric/AuricTeslaRoyalHelm_Head.png b/Items/Armor/Auric/AuricTeslaHeadMelee_Head.png similarity index 100% rename from Items/Armor/Auric/AuricTeslaRoyalHelm_Head.png rename to Items/Armor/Auric/AuricTeslaHeadMelee_Head.png diff --git a/Items/Armor/Auric/AuricTeslaHoodedFacemask.cs b/Items/Armor/Auric/AuricTeslaHeadRanged.cs similarity index 96% rename from Items/Armor/Auric/AuricTeslaHoodedFacemask.cs rename to Items/Armor/Auric/AuricTeslaHeadRanged.cs index 061585b631..27e6e250ed 100644 --- a/Items/Armor/Auric/AuricTeslaHoodedFacemask.cs +++ b/Items/Armor/Auric/AuricTeslaHeadRanged.cs @@ -13,7 +13,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Auric { [AutoloadEquip(EquipType.Head)] - public class AuricTeslaHoodedFacemask : ModItem, ILocalizedModType + [LegacyName("AuricTeslaHoodedFacemask")] + public class AuricTeslaHeadRanged : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; public override void SetDefaults() @@ -98,7 +99,7 @@ namespace CalamityMod.Items.Armor.Auric AddIngredient(). AddIngredient(12). AddTile(). - SortBeforeFirstRecipesOf(ModContent.ItemType()). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Auric/AuricTeslaHoodedFacemask.png b/Items/Armor/Auric/AuricTeslaHeadRanged.png similarity index 100% rename from Items/Armor/Auric/AuricTeslaHoodedFacemask.png rename to Items/Armor/Auric/AuricTeslaHeadRanged.png diff --git a/Items/Armor/Auric/AuricTeslaHoodedFacemask_Head.png b/Items/Armor/Auric/AuricTeslaHeadRanged_Head.png similarity index 100% rename from Items/Armor/Auric/AuricTeslaHoodedFacemask_Head.png rename to Items/Armor/Auric/AuricTeslaHeadRanged_Head.png diff --git a/Items/Armor/Auric/AuricTeslaPlumedHelm.cs b/Items/Armor/Auric/AuricTeslaHeadRogue.cs similarity index 97% rename from Items/Armor/Auric/AuricTeslaPlumedHelm.cs rename to Items/Armor/Auric/AuricTeslaHeadRogue.cs index e7bc207d37..bab13f54b6 100644 --- a/Items/Armor/Auric/AuricTeslaPlumedHelm.cs +++ b/Items/Armor/Auric/AuricTeslaHeadRogue.cs @@ -13,7 +13,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Auric { [AutoloadEquip(EquipType.Head)] - public class AuricTeslaPlumedHelm : ModItem, ILocalizedModType + [LegacyName("AuricTeslaPlumedHelm")] + public class AuricTeslaHeadRogue : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; public override void SetDefaults() diff --git a/Items/Armor/Auric/AuricTeslaPlumedHelm.png b/Items/Armor/Auric/AuricTeslaHeadRogue.png similarity index 100% rename from Items/Armor/Auric/AuricTeslaPlumedHelm.png rename to Items/Armor/Auric/AuricTeslaHeadRogue.png diff --git a/Items/Armor/Auric/AuricTeslaPlumedHelm_Head.png b/Items/Armor/Auric/AuricTeslaHeadRogue_Head.png similarity index 100% rename from Items/Armor/Auric/AuricTeslaPlumedHelm_Head.png rename to Items/Armor/Auric/AuricTeslaHeadRogue_Head.png diff --git a/Items/Armor/Auric/AuricTeslaSpaceHelmet.cs b/Items/Armor/Auric/AuricTeslaHeadSummon.cs similarity index 96% rename from Items/Armor/Auric/AuricTeslaSpaceHelmet.cs rename to Items/Armor/Auric/AuricTeslaHeadSummon.cs index b15fc1f6fd..44c56a3720 100644 --- a/Items/Armor/Auric/AuricTeslaSpaceHelmet.cs +++ b/Items/Armor/Auric/AuricTeslaHeadSummon.cs @@ -12,7 +12,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Auric { [AutoloadEquip(EquipType.Head)] - public class AuricTeslaSpaceHelmet : ModItem, ILocalizedModType + [LegacyName("AuricTeslaSpaceHelmet")] + public class AuricTeslaHeadSummon : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; public override void SetDefaults() @@ -95,7 +96,7 @@ namespace CalamityMod.Items.Armor.Auric AddIngredient(). AddIngredient(12). AddTile(). - SortBeforeFirstRecipesOf(ModContent.ItemType()). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Auric/AuricTeslaSpaceHelmet.png b/Items/Armor/Auric/AuricTeslaHeadSummon.png similarity index 100% rename from Items/Armor/Auric/AuricTeslaSpaceHelmet.png rename to Items/Armor/Auric/AuricTeslaHeadSummon.png diff --git a/Items/Armor/Auric/AuricTeslaSpaceHelmet_Head.png b/Items/Armor/Auric/AuricTeslaHeadSummon_Head.png similarity index 100% rename from Items/Armor/Auric/AuricTeslaSpaceHelmet_Head.png rename to Items/Armor/Auric/AuricTeslaHeadSummon_Head.png diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson index 3f5b3eb4a3..645abad5d7 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson @@ -17,7 +17,7 @@ AuricTeslaCuisses: { ''' } -AuricTeslaHoodedFacemask: { +AuricTeslaHeadRanged: { DisplayName: Auric Tesla Hooded Facemask Tooltip: 30% increased ranged damage and critical strike chance SetBonus: @@ -45,7 +45,7 @@ AuricTeslaHoodedFacemask: { ''' } -AuricTeslaPlumedHelm: { +AuricTeslaHeadRogue: { DisplayName: Auric Tesla Plumed Helm Tooltip: ''' @@ -78,7 +78,7 @@ AuricTeslaPlumedHelm: { ''' } -AuricTeslaRoyalHelm: { +AuricTeslaHeadMelee: { DisplayName: Auric Tesla Royal Helm Tooltip: ''' @@ -112,7 +112,7 @@ AuricTeslaRoyalHelm: { ''' } -AuricTeslaSpaceHelmet: { +AuricTeslaHeadSummon: { DisplayName: Auric Tesla Space Helmet Tooltip: 15% increased summon damage SetBonus: @@ -142,7 +142,7 @@ AuricTeslaSpaceHelmet: { ''' } -AuricTeslaWireHemmedVisage: { +AuricTeslaHeadMagic: { DisplayName: Auric Tesla Wire-Hemmed Visage Tooltip: 30% increased magic damage, 20% increased magic critical strike chance, +100 max mana and 20% reduced mana usage SetBonus: diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson index 3095f99502..45c5a42110 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson @@ -8,7 +8,7 @@ AerospecBreastplate: { ''' } -AerospecHat: { +AerospecHeadMagic: { DisplayName: Aerospec Hat Tooltip: 10% increased magic damage and +30 max mana SetBonus: @@ -18,7 +18,7 @@ AerospecHat: { ''' } -AerospecHeadgear: { +AerospecHeadRogue: { DisplayName: Aerospec Headgear Tooltip: 10% increased rogue damage and 5% increased movement speed SetBonus: @@ -28,17 +28,17 @@ AerospecHeadgear: { ''' } -AerospecHelm: { +AerospecHeadMelee: { DisplayName: Aerospec Helm Tooltip: 10% increased melee damage SetBonus: ''' - 5% increased movement speed and melee critical strike chance + Helm: 5% increased movement speed and melee critical strike chance Enemies are more likely to target you ''' } -AerospecHelmet: { +AerospecHeadSummon: { DisplayName: Aerospec Helmet Tooltip: 10% increased summon damage and 5% increased movement speed SetBonus: @@ -48,7 +48,7 @@ AerospecHelmet: { ''' } -AerospecHood: { +AerospecHeadRanged: { DisplayName: Aerospec Hood Tooltip: 10% increased ranged damage SetBonus: 5% increased movement speed and ranged critical strike chance From 2e4e10cb0396c81587b6935c3fab83941ab3b053 Mon Sep 17 00:00:00 2001 From: Eddie Spaghetti Date: Tue, 3 Jun 2025 17:59:31 -0500 Subject: [PATCH 20/47] Fixes Fixed minor mistakes --- Items/Armor/Aerospec/AerospecHeadSummon.cs | 2 +- .../en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Items/Armor/Aerospec/AerospecHeadSummon.cs b/Items/Armor/Aerospec/AerospecHeadSummon.cs index 30c0bd3564..652ef4ea59 100644 --- a/Items/Armor/Aerospec/AerospecHeadSummon.cs +++ b/Items/Armor/Aerospec/AerospecHeadSummon.cs @@ -10,7 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Aerospec { [AutoloadEquip(EquipType.Head)] - [LegacyName("AreospectHelmet")] + [LegacyName("AreospecHelmet")] public class AerospecHeadSummon : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PreHardmode"; diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson index 45c5a42110..19a3b8ddc3 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson @@ -33,7 +33,7 @@ AerospecHeadMelee: { Tooltip: 10% increased melee damage SetBonus: ''' - Helm: 5% increased movement speed and melee critical strike chance + 5% increased movement speed and melee critical strike chance Enemies are more likely to target you ''' } From 50099f4293a30b3f8806dcc686dc054cc4a9b937 Mon Sep 17 00:00:00 2001 From: Cameron Ewell Date: Tue, 3 Jun 2025 19:10:51 -0400 Subject: [PATCH 21/47] Fix AerospecHelmet typo finally --- Items/Armor/Aerospec/AerospecHeadSummon.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Armor/Aerospec/AerospecHeadSummon.cs b/Items/Armor/Aerospec/AerospecHeadSummon.cs index 652ef4ea59..b54a722b93 100644 --- a/Items/Armor/Aerospec/AerospecHeadSummon.cs +++ b/Items/Armor/Aerospec/AerospecHeadSummon.cs @@ -10,7 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Aerospec { [AutoloadEquip(EquipType.Head)] - [LegacyName("AreospecHelmet")] + [LegacyName("AerospecHelmet")] public class AerospecHeadSummon : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PreHardmode"; From d43b663fc2e16acd97b0ef7120419f6c377c7afc Mon Sep 17 00:00:00 2001 From: Xyk Date: Tue, 3 Jun 2025 20:54:22 -0700 Subject: [PATCH 22/47] DVD line improvements / balance --- CalPlayer/CalamityPlayerMiscEffects.cs | 4 + Items/Weapons/Magic/DeathValleyDuster.cs | 4 +- Items/Weapons/Magic/PrimordialAncient.cs | 7 +- Items/Weapons/Magic/PrimordialEarth.cs | 8 +- .../en-US/Mods.CalamityMod.Buffs.hjson | 4 +- ...Mods.CalamityMod.Items.Weapons.Magic.hjson | 6 +- .../Magic/DeathValleyDusterProjectile.cs | 38 ++++++++-- .../Magic/PrimordialAncientExplosion.cs | 3 + .../Magic/PrimordialAncientProjectile.cs | 73 +++++++++++++------ Projectiles/Magic/PrimordialEarthExplosion.cs | 3 + .../Magic/PrimordialEarthProjectile.cs | 70 +++++++++++++----- 11 files changed, 163 insertions(+), 57 deletions(-) diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 40a564129d..dc1d30416e 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -3829,11 +3829,15 @@ namespace CalamityMod.CalPlayer { Player.GetDamage() += PrimordialEarth.BuffDamageBoost; Player.statDefense += PrimordialEarth.BuffDefenseBoost; + Player.manaRegenDelayBonus += 1; + Player.manaRegenBonus += 50 + (int)(400 * (float)Math.Pow((1 - ((float)Player.statMana / (float)Player.statManaMax2)), 2)); } if (aeolianEarthBuff) { Player.GetDamage() += PrimordialAncient.BuffDamageBoost; Player.endurance += PrimordialAncient.BuffDamageReductionBoost; + Player.manaRegenDelayBonus += 1; + Player.manaRegenBonus += 75 + (int)(600 * (float)Math.Pow((1 - ((float)Player.statMana / (float)Player.statManaMax2)), 2)); } if (frostFlare) diff --git a/Items/Weapons/Magic/DeathValleyDuster.cs b/Items/Weapons/Magic/DeathValleyDuster.cs index 1067e27f81..0a19d54c0c 100644 --- a/Items/Weapons/Magic/DeathValleyDuster.cs +++ b/Items/Weapons/Magic/DeathValleyDuster.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.height = 40; Item.damage = 159; Item.DamageType = DamageClass.Magic; - Item.mana = 38; + Item.mana = 45; Item.useTime = 50; Item.useAnimation = 50; Item.useStyle = ItemUseStyleID.Shoot; @@ -33,6 +33,8 @@ namespace CalamityMod.Items.Weapons.Magic } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + if (player.velocity.Length() <= 12) + player.velocity += -velocity.SafeNormalize(Vector2.UnitX) * 5f; bool MaxMana = player.statMana >= (player.statManaMax2 - ((int)(Item.mana * player.manaCost))) && !player.HasBuff(BuffID.ManaSickness); Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 0f, MaxMana ? 1f : 0f); diff --git a/Items/Weapons/Magic/PrimordialAncient.cs b/Items/Weapons/Magic/PrimordialAncient.cs index 8da0f86ef4..0e5ae09073 100644 --- a/Items/Weapons/Magic/PrimordialAncient.cs +++ b/Items/Weapons/Magic/PrimordialAncient.cs @@ -24,9 +24,9 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 40; Item.height = 56; - Item.damage = 3900; + Item.damage = 5000; Item.DamageType = DamageClass.Magic; - Item.mana = 85; + Item.mana = 95; Item.useTime = 78; Item.useAnimation = 78; Item.useStyle = ItemUseStyleID.Shoot; @@ -41,6 +41,9 @@ namespace CalamityMod.Items.Weapons.Magic } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + if (player.velocity.Length() <= 16) + player.velocity += -velocity.SafeNormalize(Vector2.UnitX) * 7.5f; + bool MaxMana = player.statMana >= (player.statManaMax2 - ((int)(Item.mana * player.manaCost))) && !player.HasBuff(BuffID.ManaSickness); for (int i = -2; i <= 2; i++) { diff --git a/Items/Weapons/Magic/PrimordialEarth.cs b/Items/Weapons/Magic/PrimordialEarth.cs index bfe7b3b5d2..55fcdc89a0 100644 --- a/Items/Weapons/Magic/PrimordialEarth.cs +++ b/Items/Weapons/Magic/PrimordialEarth.cs @@ -38,10 +38,14 @@ namespace CalamityMod.Items.Weapons.Magic } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + if (player.velocity.Length() <= 14) + player.velocity += -velocity.SafeNormalize(Vector2.UnitX) * 6f; + + Vector2 staticSpeed = Utils.DirectionTo(player.Center, player.Calamity().mouseWorld) * Utils.Distance(player.Center, player.ClampedMouseWorld()) * 0.008f; bool MaxMana = player.statMana >= (player.statManaMax2 - ((int)(Item.mana * player.manaCost))) && !player.HasBuff(BuffID.ManaSickness); float rotation = 0.4f; - Projectile.NewProjectile(source, position, velocity.RotatedBy(-rotation), type, damage / 2, knockback, player.whoAmI, 0f, 1f, MaxMana ? 1f : 0f); - Projectile.NewProjectile(source, position, velocity.RotatedBy(rotation), type, damage / 2, knockback, player.whoAmI, 0f, 0f, MaxMana ? 1f : 0f); + Projectile.NewProjectile(source, position, staticSpeed.RotatedBy(-rotation), type, damage / 2, knockback, player.whoAmI, 0f, 1f, MaxMana ? 1f : 0f); + Projectile.NewProjectile(source, position, staticSpeed.RotatedBy(rotation), type, damage / 2, knockback, player.whoAmI, 0f, 0f, MaxMana ? 1f : 0f); return false; } diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index cbc1e06da4..971ac6e917 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -675,7 +675,7 @@ AeolianEarthBuff: { Description: ''' You are strengthened by primordial powers - Damage reduction increased by {0}%, damage increased by {1}% + Damage reduction increased by {0}%, damage increased by {1}%, and massively buffed mana regen ''' } @@ -885,7 +885,7 @@ SandsWindBuff: { Description: ''' You are strengthened by the powers of sand - Defense increased by {0}, damage increased by {1}% + Defense increased by {0}, damage increased by {1}%, and greatly buffed mana regen ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson index 427c9585ef..28265b59b3 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson @@ -246,7 +246,7 @@ DeathValleyDuster: { ''' Casts an enchanted blast of sand that passes through enemies and tiles Casting this spell at max mana while without mana sickness will cause it to give you and any player it hits the Sand's Wind Buff - The Sand's Wind Buff increases your defense by 10 and damage by 12% + The Sand's Wind Buff increases your defense by 10, damage by 12%, and greatly buffed mana regen ''' } @@ -654,7 +654,7 @@ PrimordialAncient: { ''' Casts five primordial sand blasts that converge at your cursor after a moment and create a giant explosion Casting this spell at max mana while without mana sickness will cause it to give you and any player it hits the {$Buffs.AeolianEarthBuff.DisplayName} buff - The {$Buffs.AeolianEarthBuff.DisplayName} buff increases your damage reduction by {0}% and damage by {1}% + The {$Buffs.AeolianEarthBuff.DisplayName} buff increases your damage reduction by {0}%, damage by {1}%, and massively buffed mana regen ''' } @@ -664,7 +664,7 @@ PrimordialEarth: { ''' Casts two enchanted blasts of sand that coverge with each other and explode Casting this spell at max mana while without mana sickness will cause it to give you and any player it hits the {$Buffs.SandsWindBuff.DisplayName} buff - The {$Buffs.SandsWindBuff.DisplayName} buff increases your defense by {0} and damage by {1}% + The {$Buffs.SandsWindBuff.DisplayName} buff increases your defense by {0}, damage by {1}%, and greatly buffed mana regen ''' } diff --git a/Projectiles/Magic/DeathValleyDusterProjectile.cs b/Projectiles/Magic/DeathValleyDusterProjectile.cs index 0fd107a6bf..33520aff80 100644 --- a/Projectiles/Magic/DeathValleyDusterProjectile.cs +++ b/Projectiles/Magic/DeathValleyDusterProjectile.cs @@ -10,6 +10,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using System.Collections.Generic; +using CalamityMod.Items.Placeables.FurnitureMarnite; namespace CalamityMod.Projectiles.Magic { public class DeathValleyDusterProjectile : ModProjectile, ILocalizedModType @@ -34,7 +35,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Magic; Projectile.penetrate = -1; - Projectile.extraUpdates = 4; + Projectile.extraUpdates = 7; Projectile.timeLeft = 400; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; @@ -60,7 +61,7 @@ namespace CalamityMod.Projectiles.Magic if (buffList[playerIndex] == false) { buffList[playerIndex] = true; - player.AddBuff(ModContent.BuffType(), 600); + player.AddBuff(ModContent.BuffType(), 720); int Dusts = 12; float radians = MathHelper.TwoPi / Dusts; @@ -141,7 +142,6 @@ namespace CalamityMod.Projectiles.Magic Projectile.rotation += Main.rand.NextFloat(0.01f, 0.18f) * (float)Projectile.direction * Projectile.Opacity * rotDirection; - if (Projectile.timeLeft <= 45) { Projectile.extraUpdates = 1; @@ -152,15 +152,37 @@ namespace CalamityMod.Projectiles.Magic } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - if (Projectile.numHits > 0) - Projectile.damage = (int)(Projectile.damage * 0.95f); - if (Projectile.damage < 1) - Projectile.damage = 1; + float minMult = 0.25f; + int hitsToMinMult = 6; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + if (Projectile.numHits == 0) + { + Player Owner = Main.player[Projectile.owner]; + Owner.Calamity().GeneralScreenShakePower = 3.5f; + damageMult += 0.5f; + for (int i = 0; i < 3; i++) + SoundEngine.PlaySound(SoundID.DD2_MonkStaffGroundImpact with { Volume = 0.9f, Pitch = -0.4f + i * 0.25f, MaxInstances = 3 }, Projectile.Center); + for (int i = 0; i < 14; i++) + { + float range = Main.rand.NextFloat(-0.5f, 0.5f); + float power = 1 - Math.Abs(range); + Vector2 vel = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(range) * Main.rand.NextFloat(45, 50) * power; + MediumMistParticle SandCloud = new MediumMistParticle(Projectile.Center, vel, Color.Peru, Color.PeachPuff, Main.rand.NextFloat(1.7f, 2.3f), 120f, Main.rand.NextFloat(0.03f, -0.03f)); + GeneralParticleHandler.SpawnParticle(SandCloud); + for (int b = 0; b < 5; b++) + { + Color clr = Color.Lerp((Main.rand.NextBool() ? Color.Peru : Color.PeachPuff), Color.Black, Main.rand.NextFloat(0.25f, 0.45f)); + Particle sand = new CustomSpark(Projectile.Center, vel.RotatedByRandom(0.4f) * Main.rand.NextFloat(0.4f, 0.9f) * power, "CalamityMod/Particles/SmallSmoke", false, Main.rand.Next(15, 25 + 1), Projectile.scale * Main.rand.NextFloat(0.08f, 0.14f) * 7, clr, new Vector2(1, Main.rand.NextFloat(0.2f, 2f)), false, extraRotation: Main.rand.NextFloat(-4, 4), spin: Main.rand.NextFloat(-0.8f, 0.8f), affectedByLight: true); + GeneralParticleHandler.SpawnParticle(sand); + } + } + } + modifiers.SourceDamage *= damageMult; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (Projectile.numHits >= 3 && Projectile.timeLeft > 45) + if (Projectile.numHits >= 5 && Projectile.timeLeft > 45) { Projectile.timeLeft = 45; Projectile.velocity *= 0.4f; diff --git a/Projectiles/Magic/PrimordialAncientExplosion.cs b/Projectiles/Magic/PrimordialAncientExplosion.cs index 8b4f5a9c1a..0f24414cb2 100644 --- a/Projectiles/Magic/PrimordialAncientExplosion.cs +++ b/Projectiles/Magic/PrimordialAncientExplosion.cs @@ -28,6 +28,9 @@ namespace CalamityMod.Projectiles.Magic } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { + Vector2 launchVel = Utils.DirectionTo(Projectile.Center, target.Center); + target.MoveNPC(launchVel, 40, true); + if (Projectile.numHits > 0) Projectile.damage = (int)(Projectile.damage * 0.95f); if (Projectile.damage < 1) diff --git a/Projectiles/Magic/PrimordialAncientProjectile.cs b/Projectiles/Magic/PrimordialAncientProjectile.cs index 6eac8df489..1d04c30342 100644 --- a/Projectiles/Magic/PrimordialAncientProjectile.cs +++ b/Projectiles/Magic/PrimordialAncientProjectile.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Particles; +using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -37,10 +38,10 @@ namespace CalamityMod.Projectiles.Magic Projectile.DamageType = DamageClass.Magic; Projectile.tileCollide = false; Projectile.penetrate = -1; - Projectile.extraUpdates = 6; + Projectile.extraUpdates = 8; Projectile.timeLeft = 430; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 40 * Projectile.extraUpdates; + Projectile.localNPCHitCooldown = -1; } public override void AI() { @@ -71,7 +72,7 @@ namespace CalamityMod.Projectiles.Magic if (buffList[playerIndex] == false) { buffList[playerIndex] = true; - player.AddBuff(ModContent.BuffType(), 840); + player.AddBuff(ModContent.BuffType(), 900); int Dusts = 8; float radians = MathHelper.TwoPi / Dusts; @@ -190,7 +191,6 @@ namespace CalamityMod.Projectiles.Magic GeneralParticleHandler.SpawnParticle(SandCloud); } - Dust dust2 = Dust.NewDustPerfect(Projectile.Center + new Vector2(25, 25).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.3f) * Projectile.scale, Main.rand.NextBool(5) ? 86 : 287, -Projectile.velocity * Main.rand.NextFloat(0.1f, 1.3f)); dust2.noGravity = true; dust2.scale = Main.rand.NextFloat(0.4f, 0.7f); @@ -203,21 +203,43 @@ namespace CalamityMod.Projectiles.Magic } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - modifiers.SourceDamage *= 0.05f; + float minMult = 0.25f; + int hitsToMinMult = 6; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + if (Projectile.numHits == 0) + { + damageMult += 0.5f; + for (int i = 0; i < 3; i++) + SoundEngine.PlaySound(SoundID.DD2_MonkStaffGroundImpact with { Volume = 0.9f, Pitch = -0.4f + i * 0.25f, MaxInstances = 9 }, Projectile.Center); + for (int i = 0; i < 6; i++) + { + float range = Main.rand.NextFloat(-0.3f, 0.3f); + float power = 1 - Math.Abs(range); + Vector2 vel = Projectile.Center.DirectionTo(target.Center).RotatedBy(range) * Main.rand.NextFloat(35, 40) * power; + MediumMistParticle SandCloud = new MediumMistParticle(Projectile.Center, vel, Color.Peru, Color.PeachPuff, Main.rand.NextFloat(1.7f, 2.3f), 120f, Main.rand.NextFloat(0.03f, -0.03f)); + GeneralParticleHandler.SpawnParticle(SandCloud); + for (int b = 0; b < 5; b++) + { + Color clr = Color.Lerp((Main.rand.NextBool() ? Color.Peru : Color.PeachPuff), Color.Black, Main.rand.NextFloat(0.25f, 0.45f)); + Particle sand = new CustomSpark(Projectile.Center, vel.RotatedByRandom(0.4f) * Main.rand.NextFloat(0.4f, 0.9f) * power, "CalamityMod/Particles/SmallSmoke", false, Main.rand.Next(25, 35 + 1), Projectile.scale * Main.rand.NextFloat(0.08f, 0.14f) * 7, clr, new Vector2(1, Main.rand.NextFloat(0.2f, 2f)), false, extraRotation: Main.rand.NextFloat(-4, 4), spin: Main.rand.NextFloat(-0.8f, 0.8f), affectedByLight: true); + GeneralParticleHandler.SpawnParticle(sand); + } + } + } - if (Projectile.numHits > 0) - Projectile.damage = (int)(Projectile.damage * 0.95f); - if (Projectile.damage < 1) - Projectile.damage = 1; + modifiers.SourceDamage *= damageMult * 0.03f; } public override void OnKill(int timeLeft) { Lighting.AddLight(Projectile.Center, Color.Purple.ToVector3() * 2); if (Projectile.ai[1] == 1) { - Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Purple, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0f, 0.82f, 11); + Player Owner = Main.player[Projectile.owner]; + Owner.Calamity().GeneralScreenShakePower = 8f; + + Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Purple, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.2f * 2f, 0.6f * 2.5f, 17); GeneralParticleHandler.SpawnParticle(orb); - Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0f, 0.74f, 11); + Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.1f * 2f, 0.5f * 2.5f, 17); GeneralParticleHandler.SpawnParticle(orb2); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 1.5f, Projectile.owner); @@ -227,24 +249,33 @@ namespace CalamityMod.Projectiles.Magic Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(Color.Purple, Color.White, 0.5f) * 0.55f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 2.56f * 2.3f, 18); GeneralParticleHandler.SpawnParticle(bolt2); - Particle bolt3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Peru * 0.55f, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.3f, 30); + Particle bolt3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Peru * 0.55f, "CalamityMod/Particles/SmokeExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.4f, 23); GeneralParticleHandler.SpawnParticle(bolt3); - Particle bolt4 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.PeachPuff * 0.55f, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.3f * 1.35f, 30); + Particle bolt4 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.PeachPuff * 0.55f, "CalamityMod/Particles/SmokeExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.4f * 1.35f, 18); GeneralParticleHandler.SpawnParticle(bolt4); for (int i = 0; i < 140; i++) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(5) ? 86 : 287, new Vector2(21, 21).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.3f)); - dust.noGravity = false; - dust.scale = Main.rand.NextFloat(0.8f, 1.3f); - if (dust.type == 86) + if (Main.rand.NextBool(5)) { - dust.noGravity = true; - dust.fadeIn = 0.5f; - dust.velocity *= 2; + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(5) ? 86 : 287, new Vector2(21, 21).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.3f)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.8f, 1.3f); + if (dust.type == 86) + { + dust.noGravity = true; + dust.fadeIn = 0.5f; + dust.velocity *= 2; + } + dust.alpha = 100; + } + else + { + Color clr = Color.Lerp((Main.rand.NextBool() ? Color.Peru : Color.PeachPuff), Color.Black, Main.rand.NextFloat(0.25f, 0.45f)); + Particle sand = new CustomSpark(Projectile.Center, (Vector2.One * Main.rand.NextFloat(9, 33)).RotatedByRandom(MathHelper.TwoPi), "CalamityMod/Particles/SmallSmoke", true, Main.rand.Next(25, 55 + 1), Projectile.scale * Main.rand.NextFloat(0.08f, 0.14f) * 23, clr, new Vector2(1, Main.rand.NextFloat(0.2f, 2f)), false, extraRotation: Main.rand.NextFloat(-4, 4), spin: Main.rand.NextFloat(-0.8f, 0.8f), affectedByLight: true); + GeneralParticleHandler.SpawnParticle(sand); } - dust.alpha = 100; } for (int i = 0; i < 30; i++) { diff --git a/Projectiles/Magic/PrimordialEarthExplosion.cs b/Projectiles/Magic/PrimordialEarthExplosion.cs index 7a2fc6d42f..3fc8e0e945 100644 --- a/Projectiles/Magic/PrimordialEarthExplosion.cs +++ b/Projectiles/Magic/PrimordialEarthExplosion.cs @@ -28,6 +28,9 @@ namespace CalamityMod.Projectiles.Magic } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { + Vector2 launchVel = Utils.DirectionTo(Projectile.Center, target.Center); + target.MoveNPC(launchVel, 20, true); + if (Projectile.numHits > 0) Projectile.damage = (int)(Projectile.damage * 0.9f); if (Projectile.damage < 1) diff --git a/Projectiles/Magic/PrimordialEarthProjectile.cs b/Projectiles/Magic/PrimordialEarthProjectile.cs index 6a5a77c9ef..83cd70b476 100644 --- a/Projectiles/Magic/PrimordialEarthProjectile.cs +++ b/Projectiles/Magic/PrimordialEarthProjectile.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Magic; Projectile.penetrate = -1; - Projectile.extraUpdates = 6; + Projectile.extraUpdates = 9; Projectile.timeLeft = 132; // NOTE: Do not change this. Specific timing is needed for the weapon to function properly. Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Magic if (buffList[playerIndex] == false) { buffList[playerIndex] = true; - player.AddBuff(ModContent.BuffType(), 720); + player.AddBuff(ModContent.BuffType(), 840); int Dusts = 12; float radians = MathHelper.TwoPi / Dusts; @@ -135,7 +135,6 @@ namespace CalamityMod.Projectiles.Magic GeneralParticleHandler.SpawnParticle(SandCloud); } - Dust dust2 = Dust.NewDustPerfect(Projectile.Center + new Vector2(25, 25).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.3f) * Projectile.scale, Main.rand.NextBool(8) ? 262 : 287, -Projectile.velocity * Main.rand.NextFloat(0.1f, 1.3f)); dust2.noGravity = true; dust2.scale = Main.rand.NextFloat(0.4f, 0.7f); @@ -148,36 +147,71 @@ namespace CalamityMod.Projectiles.Magic } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - if (Projectile.numHits > 0) - Projectile.damage = (int)(Projectile.damage * 0.95f); - if (Projectile.damage < 1) - Projectile.damage = 1; + float minMult = 0.25f; + int hitsToMinMult = 6; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + if (Projectile.numHits == 0) + { + damageMult += 0.5f; + for (int i = 0; i < 3; i++) + SoundEngine.PlaySound(SoundID.DD2_MonkStaffGroundImpact with { Volume = 0.9f, Pitch = -0.4f + i * 0.25f, MaxInstances = 6 }, Projectile.Center); + for (int i = 0; i < 9; i++) + { + float range = Main.rand.NextFloat(-0.3f, 0.3f); + float power = 1 - Math.Abs(range); + Vector2 vel = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(range) * Main.rand.NextFloat(35, 40) * power; + MediumMistParticle SandCloud = new MediumMistParticle(Projectile.Center, vel, Color.Peru, Color.PeachPuff, Main.rand.NextFloat(1.7f, 2.3f), 120f, Main.rand.NextFloat(0.03f, -0.03f)); + GeneralParticleHandler.SpawnParticle(SandCloud); + for (int b = 0; b < 6; b++) + { + Color clr = Color.Lerp((Main.rand.NextBool() ? Color.Peru : Color.PeachPuff), Color.Black, Main.rand.NextFloat(0.25f, 0.45f)); + Particle sand = new CustomSpark(Projectile.Center, vel.RotatedByRandom(0.4f) * Main.rand.NextFloat(0.4f, 0.9f) * power, "CalamityMod/Particles/SmallSmoke", false, Main.rand.Next(25, 35 + 1), Projectile.scale * Main.rand.NextFloat(0.08f, 0.14f) * 7, clr, new Vector2(1, Main.rand.NextFloat(0.2f, 2f)), false, extraRotation: Main.rand.NextFloat(-4, 4), spin: Main.rand.NextFloat(-0.8f, 0.8f), affectedByLight: true); + GeneralParticleHandler.SpawnParticle(sand); + } + } + } + modifiers.SourceDamage *= damageMult; } public override void OnKill(int timeLeft) { if (Projectile.ai[1] == 1) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage * 2, Projectile.knockBack * 1.5f, Projectile.owner); + Player Owner = Main.player[Projectile.owner]; + Owner.Calamity().GeneralScreenShakePower = 5f; + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 2.5f), 0, Projectile.owner); SoundStyle explo = new("CalamityMod/Sounds/Item/MagicRockImpact"); SoundEngine.PlaySound(explo with { Volume = 0.75f }, Projectile.Center); - //Particle bolt = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Gold * 0.3f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 1.86f, 15); - //GeneralParticleHandler.SpawnParticle(bolt); Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Gold * 0.55f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 2.56f, 15); GeneralParticleHandler.SpawnParticle(bolt2); + + Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Gold, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.1f, 0.4f * 1.5f, 17); + GeneralParticleHandler.SpawnParticle(orb); + Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.05f, 0.3f * 1.5f, 17); + GeneralParticleHandler.SpawnParticle(orb2); } for (int i = 0; i < 65; i++) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(6) ? 262 : 287, new Vector2(7, 7).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.3f)); - dust.noGravity = false; - dust.scale = Main.rand.NextFloat(0.8f, 1.3f); - if (dust.type == 262) + if (Main.rand.NextBool(4)) { - dust.noGravity = true; - dust.fadeIn = 0.5f; - dust.velocity *= 2; + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(6) ? 262 : 287, new Vector2(7, 7).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.3f)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.8f, 1.3f); + if (dust.type == 262) + { + dust.noGravity = true; + dust.fadeIn = 0.5f; + dust.velocity *= 2; + } + dust.alpha = 100; + } + else + { + Color clr = Color.Lerp((Main.rand.NextBool() ? Color.Peru : Color.PeachPuff), Color.Black, Main.rand.NextFloat(0.25f, 0.45f)); + Particle sand = new CustomSpark(Projectile.Center, (Vector2.One * Main.rand.NextFloat(6, 15)).RotatedByRandom(MathHelper.TwoPi), "CalamityMod/Particles/SmallSmoke", true, Main.rand.Next(20, 45 + 1), Projectile.scale * Main.rand.NextFloat(0.08f, 0.14f) * 8, clr, new Vector2(1, Main.rand.NextFloat(0.2f, 2f)), false, extraRotation: Main.rand.NextFloat(-4, 4), spin: Main.rand.NextFloat(-0.8f, 0.8f), affectedByLight: true); + GeneralParticleHandler.SpawnParticle(sand); } - dust.alpha = 100; } for (int i = 0; i < 9; i++) { From acb010ec1f99381b3467eb341be093b7d339c4c4 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Wed, 4 Jun 2025 00:23:10 -0400 Subject: [PATCH 23/47] Fixed DVD line tooltip grammar Also removed the Probe glowmask file (forgot to do so earlier) --- ExtraTextures/VanillaBossGlowmasks/ProbeGlow.png | Bin 594 -> 0 bytes .../Mods.CalamityMod.Items.Weapons.Magic.hjson | 6 +++--- 2 files changed, 3 insertions(+), 3 deletions(-) delete mode 100644 ExtraTextures/VanillaBossGlowmasks/ProbeGlow.png diff --git a/ExtraTextures/VanillaBossGlowmasks/ProbeGlow.png b/ExtraTextures/VanillaBossGlowmasks/ProbeGlow.png deleted file mode 100644 index c0105e82e40e9adc2281a85bb8f551ee318245fd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 594 zcmV-Y0kdg0003bX+uL$Nkc;* zaB^>EX>4Tx04R~2kUdMoP!xurR;eH8mH#jRe``+l_U=}YN-iO0E?|bisx)Yf=pFe~+DKfWr$-KHXMtIX>vWgw5Syllc9u{>=a_J63usp_K< zyg$OK4{Oh`d|i>X`1@@YGp%ywpKtsESeSad^gZEa<4bO1wg zWnpw>WFU8GbZ8()Nlj2!fese{004AJL_t(Y$L-U>4TC@oMA5fs8=!;G1ybsu%GAL% zEhG{JYzdnKP(T1-4$R%2Z;#Ebi>R$_-CEo1HBU1E9o{K`Ag}H{K9!QrCV&A`R0tIQ+TbH7(!4IDv!_|z}NqucnHC*E9eKZnG+mpC@#GK000hUSV?A0 gO#mtY000O800000007cclK=n!07*qoM6N<$g4Ejd$^ZZW diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson index 28265b59b3..89d5f7e200 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson @@ -246,7 +246,7 @@ DeathValleyDuster: { ''' Casts an enchanted blast of sand that passes through enemies and tiles Casting this spell at max mana while without mana sickness will cause it to give you and any player it hits the Sand's Wind Buff - The Sand's Wind Buff increases your defense by 10, damage by 12%, and greatly buffed mana regen + The Sand's Wind Buff increases your defense by 10, damage by 12%, and greatly buffs mana regen ''' } @@ -654,7 +654,7 @@ PrimordialAncient: { ''' Casts five primordial sand blasts that converge at your cursor after a moment and create a giant explosion Casting this spell at max mana while without mana sickness will cause it to give you and any player it hits the {$Buffs.AeolianEarthBuff.DisplayName} buff - The {$Buffs.AeolianEarthBuff.DisplayName} buff increases your damage reduction by {0}%, damage by {1}%, and massively buffed mana regen + The {$Buffs.AeolianEarthBuff.DisplayName} buff increases your damage reduction by {0}%, damage by {1}%, and massively buffs mana regen ''' } @@ -664,7 +664,7 @@ PrimordialEarth: { ''' Casts two enchanted blasts of sand that coverge with each other and explode Casting this spell at max mana while without mana sickness will cause it to give you and any player it hits the {$Buffs.SandsWindBuff.DisplayName} buff - The {$Buffs.SandsWindBuff.DisplayName} buff increases your defense by {0}, damage by {1}%, and greatly buffed mana regen + The {$Buffs.SandsWindBuff.DisplayName} buff increases your defense by {0}, damage by {1}%, and greatly buffs mana regen ''' } From f7d92016e1ceb750a0c0d03d23837cfceaa8fd26 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Wed, 4 Jun 2025 00:32:38 -0400 Subject: [PATCH 24/47] Moved back tomat on Thank You --- Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs b/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs index 073307f246..3d465cc42d 100644 --- a/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs +++ b/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs @@ -91,6 +91,7 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "Spider Prov", "StipulateVenus", "Tobias", + "Tomat", "Triangle", "TYESKI (Universe)", "Uncle Danny", @@ -189,7 +190,6 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "ThousandFields", "TikiWiki", "Tinymanx", - "Tomat", "Trivaxy", "Uberransy", "Vaikyia", From 56de3c2955575922434f7b2de961b3fa8ccb7941 Mon Sep 17 00:00:00 2001 From: Xyk Date: Tue, 3 Jun 2025 22:08:44 -0700 Subject: [PATCH 25/47] Sound fix --- .../en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson | 8 ++++---- Projectiles/Magic/PrimordialAncientProjectile.cs | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index f51d72f7fb..a7f7715998 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -696,10 +696,10 @@ GrandGuardian: { GreatswordofJudgement: { DisplayName: Greatsword of Judgement Tooltip: - ''' -Fires a piercing energy wave that releases homing stars as it flies -Hits with the blade summon two stronger stars from behind you - ''' + ''' + Fires a piercing energy wave that releases homing stars as it flies + Hits with the blade summon two stronger stars from behind you + ''' } Greentide: { diff --git a/Projectiles/Magic/PrimordialAncientProjectile.cs b/Projectiles/Magic/PrimordialAncientProjectile.cs index 1d04c30342..aa9db9e1f2 100644 --- a/Projectiles/Magic/PrimordialAncientProjectile.cs +++ b/Projectiles/Magic/PrimordialAncientProjectile.cs @@ -245,6 +245,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 1.5f, Projectile.owner); SoundStyle explo = new("CalamityMod/Sounds/Item/MineralMortarExplode"); SoundEngine.PlaySound(explo with { Volume = 0.9f }, Projectile.Center); + SoundStyle explo2 = new("CalamityMod/Sounds/Item/EarthMeteor"); + SoundEngine.PlaySound(explo2 with { Volume = 0.9f, Pitch = -0.3f }, Projectile.Center); Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(Color.Purple, Color.White, 0.5f) * 0.55f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 2.56f * 2.3f, 18); GeneralParticleHandler.SpawnParticle(bolt2); From e8ee705cf9a50c6f069eb41dcdac2a43102c07c6 Mon Sep 17 00:00:00 2001 From: Listentowind <2926669682@qq.com> Date: Wed, 4 Jun 2025 17:29:53 +0800 Subject: [PATCH 26/47] Removed vanilla npc's Drunk Princess chat and duplicate sylvstaff projectiles localization why it still on this branch? --- .../Mods.CalamityMod.Projectiles.Magic.hjson | 2 -- .../en-US/Mods.CalamityMod.Vanilla.hjson | 19 ++----------------- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson index c3c7de4c15..316d23fe65 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson @@ -261,5 +261,3 @@ WyvernFeatherPurple.DisplayName: Feather WyvernProjectile.DisplayName: Wyvern YharimsCrystalBeam.DisplayName: Yharim's Beam YharimsCrystalPrism.DisplayName: Yermes Christal -SylvBolt.DisplayName: Sylv Bolt -SylvRay.DisplayName: Sylv Ray diff --git a/Localization/en-US/Mods.CalamityMod.Vanilla.hjson b/Localization/en-US/Mods.CalamityMod.Vanilla.hjson index b037db0068..eb9bbf4fc6 100644 --- a/Localization/en-US/Mods.CalamityMod.Vanilla.hjson +++ b/Localization/en-US/Mods.CalamityMod.Vanilla.hjson @@ -339,7 +339,6 @@ DemolitionistChat: { DryadChat: { DarksunEclipse: There's a dark solar energy emanating from the moths that appear during this time. What's up with moths getting stronger as you do too? Hardmode: That starborne illness sits upon this land like a blister. Do even more vile forces of corruption exist in worlds beyond? - DrunkPrincessShroom: "{0} put me up to this." Mushroom: I'm not here for any reason! Just picking up mushrooms for uh, later use. SulphurSea: My Goddess is resting deep below this sea. If you may excuse me, I wish to pay my respects to her alone. } @@ -377,7 +376,6 @@ MechanicChat: { MoonLordDefeated: What do you mean your traps aren't making the cut? Don't look at me! Eclipse: Um... should my nightlight be on? AcidRain: Maybe I should've waterproofed my gadgets... They're starting to corrode. - DrunkPrincess: Well, I like {0}, but I, ah... I have my eyes on someone else. } MerchantChat: { @@ -407,7 +405,6 @@ PainterChat: { } PartyGirlChat: { - DrunkPrincess: I have a feeling we're going to have absolutely fantastic parties with {0} around! Eclipse1: I think my light display is turning into an accidental bug zapper. At least the monsters are enjoying it. Eclipse2: Ooh! I love parties where everyone wears a scary costume! } @@ -415,7 +412,6 @@ PartyGirlChat: { PirateChat: { PreLeviathan: Aye, I've heard of a mythical creature in the oceans, singing with an alluring voice. Careful when yer fishin out there. WetScourgeDefeated: I have to thank ye again for takin' care of that sea serpent. Or was that another one... - DrunkPrincess: Twenty-nine bottles of beer on the wall... SeaKing: I remember legends about that {0}. He ain't quite how the stories make him out to be though. Ocean: Now this is a scene that I can admire any time! I feel like something is watching me though. SulphurSea1: It ain't much of a sight, but there's still life living in these waters. @@ -442,18 +438,12 @@ SteampunkerChat: { StylistChat: { Hardmode: Please don't catch space lice. Or {0} lice. Or just lice in general. - DrunkPrincess1: "{0} is always trying to brighten my mood... even though, deep down, I know she's sad..." - DrunkPrincess2: Sometimes I catch {0} sneaking up from behind me. - DrunkPrincess3: "{0} has been smiling more often lately, even without alcohol. I think I can thank you for that, at least somewhat." ProfanedSoulCrystal1: They look so cute and yet, I can feel their immense power just by being near them. What are you? ProfanedSoulCrystal2: I hate to break it to you, but you don't have hair to cut or style, hun. ProfanedDonuts: Aww, they're so cute, do they have names? } -TavernkeepChat: { - FullMoon: Care for a little Moonshine? - DrunkPrincess: Sheesh, {0} is a little cruel, isn't she? I never claimed to be an expert on anything but ale! -} +TavernkeepChat.FullMoon: Care for a little Moonshine? TaxCollectorChat: { DoGDefeated: Devourer of what, you said? Devourer of Funds, if its payroll is anything to go by! @@ -463,12 +453,7 @@ TaxCollectorChat: { Has100Plat: BAH! Doesn't seem like I'll ever be able to quarrel with the debts of the town again! } -TravellingMerchantChat.DrunkPrincessMerchant: Tell {0} I'll take up her offer and meet with her at the back of {1}'s house. - -TruffleChat: { - Normal: I don't feel very safe; I think there's pigs following me around and it frightens me. - DrunkPrincess: Sometimes, {0} just looks at me funny and I'm not sure how I feel about that. -} +TruffleChat.Normal: I don't feel very safe; I think there's pigs following me around and it frightens me. WitchDoctorChat: { BloodMoon: This is as good a time as any to pick up the best ingredients for potions. From 2e7fbfd55b91bca4d30d583e41dd2cddb9553947 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Wed, 4 Jun 2025 08:21:07 -0400 Subject: [PATCH 27/47] oop lemme remove Probe glowmask loading --- ExtraTextures/ExtraTextureRefs.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/ExtraTextures/ExtraTextureRefs.cs b/ExtraTextures/ExtraTextureRefs.cs index bc86cb89a7..ab359512cb 100644 --- a/ExtraTextures/ExtraTextureRefs.cs +++ b/ExtraTextures/ExtraTextureRefs.cs @@ -19,7 +19,6 @@ namespace CalamityMod.ExtraTextures public static Asset DestroyerHeadGlowmask; public static Asset DestroyerBodyGlowmask; public static Asset DestroyerTailGlowmask; - public static Asset ProbeGlowmask; // Master Rev+ Skeletron Prime public static Asset ChadPrime; @@ -62,8 +61,6 @@ namespace CalamityMod.ExtraTextures DestroyerBodyGlowmask = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/DestroyerBodyGlow", AssetRequestMode.AsyncLoad); DestroyerTailGlowmask = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/DestroyerTailGlow", AssetRequestMode.AsyncLoad); - ProbeGlowmask = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/ProbeGlow", AssetRequestMode.AsyncLoad); - ChadPrime = ModContent.Request("CalamityMod/ExtraTextures/ChadPrime", AssetRequestMode.AsyncLoad); ChadPrimeEyeGlowmask = ModContent.Request("CalamityMod/ExtraTextures/ChadPrimeHeadGlow", AssetRequestMode.AsyncLoad); From 008da1ade0c270acb5fd0951cf81aea18c39aa2f Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Wed, 4 Jun 2025 11:11:14 -0400 Subject: [PATCH 28/47] 1 - Fixed Galaxia Phoenix's Pride making Yharon firewalls turn translucent 2 - Actually fixed Sylvestaff localization 3 - Removed additional clones from Rev+ Brain of Cthulhu, and slightly decreased downtime between later phase spins --- .../Mods.CalamityMod.Projectiles.Magic.hjson | 4 +- NPCs/CalamityGlobalNPC.cs | 98 +------------------ .../Bosses/BrainOfCthulhuAI.cs | 2 +- Projectiles/Boss/InfernadoRevenge.cs | 1 + 4 files changed, 5 insertions(+), 100 deletions(-) diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson index 316d23fe65..16d495a2de 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson @@ -214,8 +214,8 @@ SpiritDust.DisplayName: Spirit Dust Starblast.DisplayName: Star StardustElementalBeam.DisplayName: Stardust Beam StickyFeather.DisplayName: Feather -SylveBolt.DisplayName: Sylv Bolt -SylveRay.DisplayName: Sylv Ray +SylvBolt.DisplayName: Sylv Bolt +SylvRay.DisplayName: Sylv Ray TacticiansElectricBoom.DisplayName: Electric Explosion TacticiansTrumpCardProj.DisplayName: Trump Beam TearsofHeavenProjectile.DisplayName: Tears of Heaven diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index ce7719554c..7bda915868 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -8502,104 +8502,8 @@ namespace CalamityMod.NPCs if (revenge) { - // Create additional afterimages in the cardinal directions in Rev+ - if (npc.type == NPCID.BrainofCthulhu) - { - float secondAfterimageSetHealthValue = (int)(npc.lifeMax * 0.8f); - if (npc.life < secondAfterimageSetHealthValue) - { - int totalAfterimages = death ? 12 : 4; - for (int i = 0; i < totalAfterimages; i++) - { - Color currentColor = npc.GetAlpha(drawColor); - float opacityScale = 1f - MathHelper.Lerp(0.34f, 1f, npc.life / (float)secondAfterimageSetHealthValue); - float opacity = Main.getGoodWorld ? 0.7f : opacityScale; - - opacity = MathHelper.Clamp(opacity, 0f, 1f); - currentColor.R = (byte)((float)(int)currentColor.R * opacity); - currentColor.G = (byte)((float)(int)currentColor.G * opacity); - currentColor.B = (byte)((float)(int)currentColor.B * opacity); - currentColor.A = (byte)((float)(int)currentColor.A * opacity); - - Vector2 position = npc.position; - float distanceFromTargetX = Math.Abs(npc.Center.X - Main.LocalPlayer.Center.X); - float distanceFromTargetY = Math.Abs(npc.Center.Y - Main.LocalPlayer.Center.Y); - if (i > 3) - { - currentColor *= 0.5f; - distanceFromTargetX *= 0.5f; - distanceFromTargetY *= 0.5f; - } - if (i > 7) - currentColor *= 0.5f; - - switch (i) - { - case 0: - case 4: - position.X = Main.LocalPlayer.Center.X - distanceFromTargetX; - position.Y = Main.LocalPlayer.Center.Y; - break; - - case 1: - case 5: - position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY; - position.X = Main.LocalPlayer.Center.X; - break; - - case 2: - case 6: - position.X = Main.LocalPlayer.Center.X + distanceFromTargetX; - position.Y = Main.LocalPlayer.Center.Y; - break; - - case 3: - case 7: - position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY; - position.X = Main.LocalPlayer.Center.X; - break; - - case 8: - position.X = Main.LocalPlayer.Center.X - distanceFromTargetX; - position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY; - break; - - case 9: - position.X = Main.LocalPlayer.Center.X + distanceFromTargetX; - position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY; - break; - - case 10: - position.X = Main.LocalPlayer.Center.X + distanceFromTargetX; - position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY; - break; - - case 11: - position.X = Main.LocalPlayer.Center.X - distanceFromTargetX; - position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY; - break; - - default: - break; - } - - position.X -= npc.width / 2; - position.Y -= npc.height / 2; - - Vector2 halfSize = npc.frame.Size() / 2; - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - int width = TextureAssets.Npc[npc.type] is null ? 0 : TextureAssets.Npc[npc.type].Width(); - int height = TextureAssets.Npc[npc.type] is null ? 0 : TextureAssets.Npc[npc.type].Height(); - spriteBatch.Draw(TextureAssets.Npc[npc.type].Value, new Vector2(position.X - screenPos.X + (float)(npc.width / 2) - (float)width * npc.scale / 2f + halfSize.X * npc.scale, position.Y - screenPos.Y + (float)npc.height - (float)height * npc.scale / (float)Main.npcFrameCount[npc.type] + 4f + halfSize.Y * npc.scale + npc.gfxOffY), npc.frame, currentColor, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); - } - } - } - // Telegraph for charge and blood shots - else if (npc.type == NPCID.Creeper) + if (npc.type == NPCID.Creeper) { if (NPC.crimsonBoss < 0) return; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs index 7847c6a171..f8756c948e 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs @@ -527,7 +527,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!despawn) npc.localAI[1] += 1f; - float teleportGateValue = npc.ai[0] == -6f ? 300f : 210f; + float teleportGateValue = npc.ai[0] == -6f ? 270f : 210f; if (npc.localAI[1] >= teleportGateValue) { npc.localAI[1] = 0f; diff --git a/Projectiles/Boss/InfernadoRevenge.cs b/Projectiles/Boss/InfernadoRevenge.cs index d193737273..7e73ff201f 100644 --- a/Projectiles/Boss/InfernadoRevenge.cs +++ b/Projectiles/Boss/InfernadoRevenge.cs @@ -75,6 +75,7 @@ namespace CalamityMod.Projectiles.Boss Main.spriteBatch.EnterShaderRegion(); GameShaders.Misc["CalamityMod:Bordernado"].UseSaturation(-0.2f); + GameShaders.Misc["CalamityMod:Bordernado"].UseOpacity(1f); GameShaders.Misc["CalamityMod:Bordernado"].SetShaderTexture(ModContent.Request("Terraria/Images/Misc/Perlin")); Vector2[] drawPoints = new Vector2[5]; Vector2 upwardAscent = Vector2.UnitY * TornadoHeight; From ab3c6db0a42707eb5ce69da70625ed8cc22e2366 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Wed, 4 Jun 2025 17:29:30 -0400 Subject: [PATCH 29/47] Increased distance before CV moves to the player Also moved its AI code to its NPC file and refactored the AI a bit --- .../CalamityBossAIs/CeaselessVoidAI.cs | 619 ------------------ NPCs/CeaselessVoid/CeaselessVoid.cs | 597 ++++++++++++++++- 2 files changed, 574 insertions(+), 642 deletions(-) delete mode 100644 NPCs/CalamityAIs/CalamityBossAIs/CeaselessVoidAI.cs diff --git a/NPCs/CalamityAIs/CalamityBossAIs/CeaselessVoidAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/CeaselessVoidAI.cs deleted file mode 100644 index 7fc43d201c..0000000000 --- a/NPCs/CalamityAIs/CalamityBossAIs/CeaselessVoidAI.cs +++ /dev/null @@ -1,619 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.CalPlayer; -using CalamityMod.Dusts; -using CalamityMod.Events; -using CalamityMod.NPCs.Abyss; -using CalamityMod.NPCs.AquaticScourge; -using CalamityMod.NPCs.AstrumAureus; -using CalamityMod.NPCs.AstrumDeus; -using CalamityMod.NPCs.BrimstoneElemental; -using CalamityMod.NPCs.Bumblebirb; -using CalamityMod.NPCs.CalClone; -using CalamityMod.NPCs.CeaselessVoid; -using CalamityMod.NPCs.Crags; -using CalamityMod.NPCs.NormalNPCs; -using CalamityMod.NPCs.OldDuke; -using CalamityMod.NPCs.SulphurousSea; -using CalamityMod.NPCs.SunkenSea; -using CalamityMod.Projectiles.Boss; -using CalamityMod.Projectiles.Enemy; -using CalamityMod.Sounds; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs -{ - public static class CeaselessVoidAI - { - public static void VanillaCeaselessVoidAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - CalamityGlobalNPC.voidBoss = npc.whoAmI; - - // Percent life remaining - double lifeRatio = npc.life / (double)npc.lifeMax; - - // Difficulty modes - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; - - // Phases - bool phase2 = lifeRatio <= 0.7; - bool phase3 = lifeRatio <= 0.4; - bool phase4 = lifeRatio <= 0.1; - bool theBigSucc = npc.life / (double)npc.lifeMax <= 0.1; - bool succSoHardThatYouDie = npc.life / (double)npc.lifeMax <= 0.005; - - // Spawn Dark Energies - int darkEnergyAmt = death ? 6 : revenge ? 5 : expertMode ? 4 : 3; - if (phase2) - darkEnergyAmt += 1; - if (phase3) - darkEnergyAmt += 1; - if (phase4) - darkEnergyAmt += 1; - - if (Main.getGoodWorld) - darkEnergyAmt *= 2; - - // Spawn a few Dark Energies as soon as the fight starts - int spacing = 360 / darkEnergyAmt; - int distance2 = 10; - if (npc.ai[2] == 0f) - { - npc.ai[2] = 1f; - for (int i = 0; i < darkEnergyAmt; i++) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 0f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 1f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 2f, 0f, 0f); - } - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 0.5f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 1.5f, 0f, 0f); - } - - // If there are any Dark Energies alive, change AI and don't take damage - bool anyDarkEnergies = NPC.AnyNPCs(ModContent.NPCType()); - bool movingDuringSuccPhase = npc.ai[3] == 0f; - npc.dontTakeDamage = anyDarkEnergies || theBigSucc || movingDuringSuccPhase; - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); - - // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); - - Player player = Main.player[npc.target]; - - // Speed enrage - bool moveVeryFast = Vector2.Distance(npc.Center, player.Center) > 960f || (!player.ZoneDungeon && !bossRush && player.position.Y < Main.worldSurface * 16.0); - - // Despawn - if (!player.active || player.dead || Vector2.Distance(player.Center, npc.Center) > 5600f) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead || Vector2.Distance(player.Center, npc.Center) > 5600f) - { - if (npc.velocity.Y > 3f) - npc.velocity.Y = 3f; - npc.velocity.Y -= 0.1f; - if (npc.velocity.Y < -12f) - npc.velocity.Y = -12f; - - if (npc.timeLeft > 60) - npc.timeLeft = 60; - - return; - } - } - else if (npc.timeLeft < 1800) - npc.timeLeft = 1800; - - float tileEnrageMult = (CalamityWorld.LegendaryMode && revenge) ? 1.5f : bossRush ? 1.375f : 1f; - npc.Calamity().CurrentlyEnraged = tileEnrageMult > 1f && !bossRush; - - // Set AI variable to be used by Dark Energies - npc.ai[1] = tileEnrageMult; - - // Increase projectile fire rate based on number of nearby active tiles - float projectileFireRateMultiplier = MathHelper.Lerp(0.5f, 1.5f, 1f - ((tileEnrageMult - 1f) / 0.5f)); - - // Decides whether Ceaseless moves closer to its target or not - float distanceRequiredToMove = (Main.getGoodWorld || !anyDarkEnergies) ? 320f : bossRush ? 600f : death ? 520f : revenge ? 480f : expertMode ? 440f : 400f; - bool move = Vector2.Distance(npc.Center, player.Center) > distanceRequiredToMove || !Collision.CanHit(npc.Center, 1, 1, player.Center, 1, 1); - - // Succ attack - if (!anyDarkEnergies) - { - // This is here because it's used in multiple places - float suckDistance = (CalamityWorld.LegendaryMode && revenge) ? 2400f : bossRush ? 1920f : death ? 1600f : revenge ? 1440f : expertMode ? 1280f : 1040f; - - // Move closer to the target before trying to succ - if (movingDuringSuccPhase) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (move) - Movement(true); - else - npc.ai[3] = 1f; - } - else - { - // Set damage - npc.damage = npc.defDamage; - - // Use this to generate more and more dust in final phase - float finalPhaseDustRatio = 1f; - if (succSoHardThatYouDie) - { - finalPhaseDustRatio = 5f; - } - else if (theBigSucc) - { - float amount = (10f - (float)(npc.life / (double)npc.lifeMax) * 100f) / 10f; - finalPhaseDustRatio += MathHelper.Lerp(0f, 2f, amount); - } - - // Slow down - if (npc.velocity.Length() > 0.5f) - npc.velocity *= 0.8f; - else - npc.velocity = Vector2.Zero; - - // Move towards target again if they get outside the succ radius - float moveCloserGateValue = suckDistance * 0.8f; - if (Vector2.Distance(npc.Center, player.Center) > moveCloserGateValue) - npc.ai[3] = 0f; - - // Ceaseless Void sucks in dark energy in different patterns - // This attack also sucks in all players that are within reach of the succ - int dustRings = 3; - for (int h = 0; h < dustRings; h++) - { - float distanceDivisor = h + 1f; - float dustDistance = suckDistance / distanceDivisor; - int numDust = (int)(0.1f * MathHelper.TwoPi * dustDistance); - float angleIncrement = MathHelper.TwoPi / numDust; - Vector2 dustOffset = new Vector2(dustDistance, 0f); - dustOffset = dustOffset.RotatedByRandom(MathHelper.TwoPi); - - int var = (int)(dustDistance / finalPhaseDustRatio); - float dustVelocity = 24f / distanceDivisor * finalPhaseDustRatio; - for (int i = 0; i < numDust; i++) - { - if (Main.rand.NextBool(var)) - { - dustOffset = dustOffset.RotatedBy(angleIncrement); - int dust = Dust.NewDust(npc.Center, 1, 1, ModContent.DustType()); - Main.dust[dust].position = npc.Center + dustOffset; - Main.dust[dust].fadeIn = 1f; - Main.dust[dust].velocity = Vector2.Normalize(npc.Center - Main.dust[dust].position) * dustVelocity; - Main.dust[dust].scale = 3f - h; - } - } - } - - float succPower = 0.125f + finalPhaseDustRatio * 0.125f; - for (int i = 0; i < Main.maxPlayers; i++) - { - float distance = Vector2.Distance(Main.player[i].Center, npc.Center); - if (distance < suckDistance && Main.player[i].grappling[0] == -1) - { - if (Collision.CanHit(npc.Center, 1, 1, Main.player[i].Center, 1, 1)) - { - float distanceRatio = distance / suckDistance; - float multiplier = 1f - distanceRatio; - - if (Main.player[i].Center.X < npc.Center.X) - Main.player[i].velocity.X += succPower * multiplier; - else - Main.player[i].velocity.X -= succPower * multiplier; - } - } - } - - // Slowly die in final phase and then implode - // This phase lasts 20 seconds - if (theBigSucc && calamityGlobalNPC.newAI[1] % 60f == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int damageAmt = npc.lifeMax / 200; - npc.life -= damageAmt; - npc.DamageEffect(damageAmt); - } - - if (npc.life <= ((npc.lifeMax / 200) * 5) && !npc.ModNPC().playedbuildsound) - { - SoundEngine.PlaySound(CeaselessVoid.CeaselessVoid.BuildupSound, npc.Center); - npc.ModNPC().playedbuildsound = true; - } - - if (npc.life <= 0) - { - npc.life = 0; - npc.HitEffect(); - npc.checkDead(); - } - - npc.netUpdate = true; - } - - // Beam Portals - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (calamityGlobalNPC.newAI[1] == 0f) - { - int numBeamPortals = bossRush ? 4 : revenge ? 3 : 2; - float degrees = 360 / numBeamPortals; - float beamPortalDistance = bossRush ? 360f : death ? 400f : revenge ? 420f : expertMode ? 440f : 480f; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - for (int i = 0; i < numBeamPortals; i++) - { - float ai1 = i * degrees; - Projectile.NewProjectile(npc.GetSource_FromAI(), player.Center.X + (float)(Math.Sin(i * degrees) * beamPortalDistance), player.Center.Y + (float)(Math.Cos(i * degrees) * beamPortalDistance), 0f, 0f, type, damage, 0f, Main.myPlayer, ai1, 0f); - } - } - } - - // Use this timer to lessen Dark Energy projectile rate of fire while Beam Portals are active - float beamPortalTimeLeft = 600f; - bool summonLessDarkEnergies = false; - if (calamityGlobalNPC.newAI[1] < beamPortalTimeLeft) - { - calamityGlobalNPC.newAI[1] += 1f; - summonLessDarkEnergies = true; - } - else if (theBigSucc) - calamityGlobalNPC.newAI[1] += 1f; - - // Suck in Dark Energy projectiles from far away - calamityGlobalNPC.newAI[3] += 1f; - float darkEnergySpiralGateValue = (summonLessDarkEnergies ? 24f : 12f) * projectileFireRateMultiplier; - if (calamityGlobalNPC.newAI[3] >= darkEnergySpiralGateValue) - { - calamityGlobalNPC.newAI[3] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - bool normalSpread = npc.localAI[0] % 2f == 0f; - float speed = 0.5f; - int totalProjectiles = 4; - float radians = MathHelper.TwoPi / totalProjectiles; - double angleA = radians * 0.5; - double angleB = MathHelper.ToRadians(90f) - angleA; - float velocityX = (float)(speed * Math.Sin(angleA) / Math.Sin(angleB)); - Vector2 spinningPoint = normalSpread ? new Vector2(0f, -speed) : new Vector2(-velocityX, -speed); - float radialOffset = MathHelper.ToRadians(npc.localAI[1]); - for (int i = 0; i < totalProjectiles; i++) - { - Vector2 spawnVector = npc.Center + Vector2.Normalize(spinningPoint.RotatedBy(radians * i + radialOffset)) * suckDistance; - Vector2 velocity = Vector2.Normalize(npc.Center - spawnVector) * speed; - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); - } - } - - npc.localAI[1] += 10f; - } - - // Summon some extra projectiles in Expert Mode - if (phase2 && expertMode) - { - npc.localAI[2] += 1f; - if (npc.localAI[2] >= 60f * projectileFireRateMultiplier) - { - npc.localAI[2] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - bool normalSpread = npc.localAI[0] % 2f != 0f; - float speed = 2f; - int totalProjectiles = 2; - float radians = MathHelper.TwoPi / totalProjectiles; - double angleA = radians * 0.5; - double angleB = MathHelper.ToRadians(90f) - angleA; - float velocityX = (float)(speed * Math.Sin(angleA) / Math.Sin(angleB)); - Vector2 spinningPoint = normalSpread ? new Vector2(0f, -speed) : new Vector2(-velocityX, -speed); - float radialOffset = MathHelper.ToRadians(npc.localAI[1] * 0.25f); - for (int i = 0; i < totalProjectiles; i++) - { - Vector2 spawnVector = npc.Center + Vector2.Normalize(spinningPoint.RotatedBy(radians * i + radialOffset)) * suckDistance; - Vector2 velocity = Vector2.Normalize(npc.Center - spawnVector) * speed; - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); - } - } - } - } - - // Summon some extra projectiles in Revengeance Mode - if (phase4 && revenge) - { - npc.localAI[3] += 1f; - if (npc.localAI[3] >= 90f * projectileFireRateMultiplier) - { - npc.localAI[3] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - bool normalSpread = npc.localAI[0] % 2f == 0f; - float speed = 4f; - int totalProjectiles = 2; - float radians = MathHelper.TwoPi / totalProjectiles; - double angleA = radians * 0.5; - double angleB = MathHelper.ToRadians(90f) - angleA; - float velocityX = (float)(speed * Math.Sin(angleA) / Math.Sin(angleB)); - Vector2 spinningPoint = normalSpread ? new Vector2(0f, -speed) : new Vector2(-velocityX, -speed); - float radialOffset = MathHelper.ToRadians(npc.localAI[1] * 0.25f); - for (int i = 0; i < totalProjectiles; i++) - { - Vector2 spawnVector = npc.Center + Vector2.Normalize(spinningPoint.RotatedBy(radians * i + radialOffset)) * suckDistance; - Vector2 velocity = Vector2.Normalize(npc.Center - spawnVector) * speed; - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); - } - } - } - } - } - } - else - { - // Avoid cheap bullshit - npc.damage = 0; - - if (move) - { - Movement(false); - } - else - { - // Slow down - if (npc.velocity.Length() > 0.5f) - npc.velocity *= 0.8f; - else - npc.velocity = Vector2.Zero; - } - - // Count up all Dark Energy HP values - int totalDarkEnergyHP = 0; - for (int i = 0; i < Main.maxNPCs; i++) - { - NPC darkEnergy = Main.npc[i]; - if (darkEnergy.active && darkEnergy.type == ModContent.NPCType()) - totalDarkEnergyHP += darkEnergy.life; - } - - // Destroy all Dark Energies if their total HP is below 20% - int darkEnergyMaxHP = bossRush ? DarkEnergy.MaxBossRushHP : DarkEnergy.MaxHP; - //These are still needed so that CV Dark energy despawn works properly - double HPBoost = CalamityServerConfig.Instance.BossHealthBoost * 0.01; - darkEnergyMaxHP += (int)(darkEnergyMaxHP * HPBoost); - - int totalDarkEnergiesSpawned = darkEnergyAmt * 3 + 2; - int totalDarkEnergyMaxHP = darkEnergyMaxHP * totalDarkEnergiesSpawned; - int succPhaseGateValue = (int)(totalDarkEnergyMaxHP * 0.2); - if (totalDarkEnergyHP < succPhaseGateValue) - { - SoundEngine.PlaySound(SoundID.NPCDeath44, npc.Center); - - // Kill all Dark Energies - for (int i = 0; i < Main.maxNPCs; i++) - { - NPC darkEnergy = Main.npc[i]; - if (darkEnergy.active && darkEnergy.type == ModContent.NPCType()) - { - darkEnergy.HitEffect(); - darkEnergy.active = false; - darkEnergy.netUpdate = true; - } - } - - // Generate a dust explosion - int dustAmt = 30; - int random = 3; - for (int j = 0; j < 10; j++) - { - random += j * 2; - int dustAmtSpawned = 0; - int scale = random * 13; - float dustPositionX = npc.Center.X - (scale / 2); - float dustPositionY = npc.Center.Y - (scale / 2); - while (dustAmtSpawned < dustAmt) - { - float dustVelocityX = Main.rand.Next(-random, random); - float dustVelocityY = Main.rand.Next(-random, random); - float dustVelocityScalar = random * 2f; - float dustVelocity = (float)Math.Sqrt(dustVelocityX * dustVelocityX + dustVelocityY * dustVelocityY); - dustVelocity = dustVelocityScalar / dustVelocity; - dustVelocityX *= dustVelocity; - dustVelocityY *= dustVelocity; - int dust = Dust.NewDust(new Vector2(dustPositionX, dustPositionY), scale, scale, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 5f); - Main.dust[dust].noGravity = true; - Main.dust[dust].position.X = npc.Center.X; - Main.dust[dust].position.Y = npc.Center.Y; - Main.dust[dust].position.X += Main.rand.Next(-10, 11); - Main.dust[dust].position.Y += Main.rand.Next(-10, 11); - Main.dust[dust].velocity.X = dustVelocityX; - Main.dust[dust].velocity.Y = dustVelocityY; - dustAmtSpawned++; - } - } - } - } - - // Basic movement towards a location - void Movement(bool succ) - { - float velocity = moveVeryFast ? 25f : bossRush ? 15f : ((expertMode ? 7.5f : 6f) + (float)(death ? 2f * (1D - lifeRatio) : 0f)) * tileEnrageMult; - float acceleration = (moveVeryFast ? 0.75f : bossRush ? 0.3f : death ? 0.2f : expertMode ? 0.16f : 0.12f) + (float)(death ? 0.04f * (1D - lifeRatio) : 0f) * tileEnrageMult; - - // Increase speed dramatically in succ phase - if (succ) - { - velocity *= 2f; - acceleration *= 2f; - } - - if (Main.getGoodWorld) - { - velocity *= 1.15f; - acceleration *= 1.15f; - } - - Vector2 destination = player.Center; - - // Move between 8 different positions around the player, in order - float maxDistance = 320f; - Vector2 moveToOffset = succ ? Vector2.Zero : Main.getGoodWorld ? new Vector2(0f, -maxDistance) : Vector2.Zero; - if (!succ && Main.getGoodWorld) - { - // Move to a new location every few seconds - calamityGlobalNPC.newAI[2] += 1f; - float newPositionGateValue = bossRush ? 120f : death ? 180f : revenge ? 210f : expertMode ? 240f : 300f; - if (calamityGlobalNPC.newAI[2] > newPositionGateValue) - { - calamityGlobalNPC.newAI[2] = 0f; - - npc.ai[0] += 1f; - if (npc.ai[0] > 7f) - npc.ai[0] = 0f; - } - - switch ((int)npc.ai[0]) - { - case 0: - break; - case 1: - moveToOffset.X = -maxDistance; - break; - case 2: - moveToOffset.X = -maxDistance; - moveToOffset.Y = 0f; - break; - case 3: - moveToOffset.X = -maxDistance; - moveToOffset.Y = maxDistance; - break; - case 4: - moveToOffset.Y = maxDistance; - break; - case 5: - moveToOffset.X = maxDistance; - moveToOffset.Y = maxDistance; - break; - case 6: - moveToOffset.X = maxDistance; - moveToOffset.Y = 0f; - break; - case 7: - moveToOffset.X = maxDistance; - break; - } - } - - destination += moveToOffset; - - // How far Ceaseless Void is from where it's supposed to be - Vector2 distanceFromDestination = destination - npc.Center; - - // Movement - if (npc.Distance(destination) > maxDistance || succ || !Main.getGoodWorld) - CalamityUtils.SmoothMovement(npc, 0f, distanceFromDestination, velocity, acceleration, true); - } - - // Spawn more Dark Energies as the fight progresses - if (calamityGlobalNPC.newAI[0] == 0f && npc.life > 0) - calamityGlobalNPC.newAI[0] = npc.lifeMax; - - if (npc.life > 0) - { - int healthGateValue = (int)(npc.lifeMax * 0.3); - if ((npc.life + healthGateValue) < calamityGlobalNPC.newAI[0]) - { - npc.TargetClosest(); - calamityGlobalNPC.newAI[0] = npc.life; - calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - calamityGlobalNPC.newAI[3] = 0f; - npc.ai[3] = 0f; - npc.localAI[0] += 1f; - npc.localAI[1] = 0f; - npc.localAI[2] = 0f; - npc.localAI[3] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (phase4) - { - for (int i = 0; i < darkEnergyAmt; i++) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 0f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 2f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 4f, 0f, 0f); - } - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 1f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 3f, 0f, 0f); - } - else if (phase3) - { - for (int i = 0; i < darkEnergyAmt; i++) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 0f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 1.5f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 3f, 0f, 0f); - } - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 0.5f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 2f, 0f, 0f); - } - else - { - for (int i = 0; i < darkEnergyAmt; i++) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 0f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 1f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 2f, 0f, 0f); - } - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 1.5f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 2.5f, 0f, 0f); - } - } - - // Despawn potentially hazardous projectiles when entering a new phase - for (int i = 0; i < Main.maxProjectiles; i++) - { - Projectile projectile = Main.projectile[i]; - if (projectile.active) - { - if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || - projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) - { - if (projectile.timeLeft > 30) - projectile.timeLeft = 30; - } - } - } - } - } - } - } -} diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index 64336874e0..cc077b9f94 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -12,13 +12,14 @@ using CalamityMod.Items.Potions; using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Summon; -using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; +using CalamityMod.Projectiles.Boss; using CalamityMod.Sounds; using CalamityMod.UI.VanillaBossBars; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; +using System; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -26,6 +27,7 @@ using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.NPCs.CeaselessVoid { @@ -52,20 +54,18 @@ namespace CalamityMod.NPCs.CeaselessVoid NPCID.Sets.MPAllowedEnemies[Type] = true; if (!Main.dedServ) { - GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + GlowTexture = Request(Texture + "Glow", AssetRequestMode.AsyncLoad); } } public override void SetDefaults() { - NPC.Calamity().canBreakPlayerDefense = true; NPC.GetNPCDamage(); NPC.npcSlots = 36f; NPC.width = 100; NPC.height = 100; NPC.defense = 80; - CalamityGlobalNPC global = NPC.Calamity(); - global.DR = 0.5f; + NPC.Calamity().DR = 0.5f; NPC.LifeMaxNERB(65000, 78000, 72000); NPC.value = Item.buyPrice(1, 0, 0, 0); NPC.aiStyle = -1; @@ -74,8 +74,9 @@ namespace CalamityMod.NPCs.CeaselessVoid NPC.noGravity = true; NPC.noTileCollide = true; NPC.boss = true; - NPC.BossBar = ModContent.GetInstance(); + NPC.BossBar = GetInstance(); NPC.DeathSound = DeathSound; + NPC.Calamity().canBreakPlayerDefense = true; NPC.Calamity().VulnerableToSickness = false; // Scale HP in Master @@ -125,7 +126,557 @@ namespace CalamityMod.NPCs.CeaselessVoid public override void AI() { - CeaselessVoidAI.VanillaCeaselessVoidAI(NPC, Mod); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + CalamityGlobalNPC.voidBoss = NPC.whoAmI; + + // Percent life remaining + double lifeRatio = NPC.life / (double)NPC.lifeMax; + + // Difficulty modes + bool bossRush = BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool death = CalamityWorld.death || bossRush; + + // Phases + bool phase2 = lifeRatio <= 0.7; + bool phase3 = lifeRatio <= 0.4; + bool phase4 = lifeRatio <= 0.1; + bool theBigSucc = NPC.life / (double)NPC.lifeMax <= 0.1; + bool succSoHardThatYouDie = NPC.life / (double)NPC.lifeMax <= 0.005; + + // Spawn Dark Energies + int darkEnergyAmt = death ? 6 : revenge ? 5 : expertMode ? 4 : 3; + if (phase2) + darkEnergyAmt += 1; + if (phase3) + darkEnergyAmt += 1; + if (phase4) + darkEnergyAmt += 1; + + if (Main.getGoodWorld) + darkEnergyAmt *= 2; + + // Spawn a few Dark Energies as soon as the fight starts + int spacing = 360 / darkEnergyAmt; + int distance2 = 10; + if (NPC.ai[2] == 0f) + { + NPC.ai[2] = 1f; + for (int i = 0; i < darkEnergyAmt; i++) + { + for (int j = 0; j < 3; j++) + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(NPC.Center.Y + (Math.Cos(i * spacing) * distance2)), NPCType(), NPC.whoAmI, i * spacing, j); + } + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)(NPC.Center.Y + distance2), NPCType(), NPC.whoAmI, 0f, 0.5f); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)(NPC.Center.Y + distance2), NPCType(), NPC.whoAmI, 0f, 1.5f); + } + + // If there are any Dark Energies alive, change AI and don't take damage + bool anyDarkEnergies = NPC.AnyNPCs(NPCType()); + bool movingDuringSuccPhase = NPC.ai[3] == 0f; + NPC.dontTakeDamage = anyDarkEnergies || theBigSucc || movingDuringSuccPhase; + + // Get a target + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); + + // Despawn safety, make sure to target another player if the current player target is too far away + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); + + Player player = Main.player[NPC.target]; + + // Speed enrage + bool moveVeryFast = Vector2.Distance(NPC.Center, player.Center) > 960f || (!player.ZoneDungeon && !bossRush && player.position.Y < Main.worldSurface * 16.0); + + // Despawn + if (!player.active || player.dead || Vector2.Distance(player.Center, NPC.Center) > 5600f) + { + NPC.TargetClosest(false); + player = Main.player[NPC.target]; + if (!player.active || player.dead || Vector2.Distance(player.Center, NPC.Center) > 5600f) + { + if (NPC.velocity.Y > 3f) + NPC.velocity.Y = 3f; + NPC.velocity.Y -= 0.1f; + if (NPC.velocity.Y < -12f) + NPC.velocity.Y = -12f; + + if (NPC.timeLeft > 60) + NPC.timeLeft = 60; + + return; + } + } + else if (NPC.timeLeft < 1800) + NPC.timeLeft = 1800; + + float tileEnrageMult = (CalamityWorld.LegendaryMode && revenge) ? 1.5f : bossRush ? 1.375f : 1f; + NPC.Calamity().CurrentlyEnraged = tileEnrageMult > 1f && !bossRush; + + // Set AI variable to be used by Dark Energies + NPC.ai[1] = tileEnrageMult; + + // Increase projectile fire rate based on number of nearby active tiles + float projectileFireRateMultiplier = MathHelper.Lerp(0.5f, 1.5f, 1f - ((tileEnrageMult - 1f) / 0.5f)); + + // Decides whether Ceaseless moves closer to its target or not + float distanceRequiredToMove = (Main.getGoodWorld || !anyDarkEnergies) ? 320f : bossRush ? 600f : 720f; + bool move = Vector2.Distance(NPC.Center, player.Center) > distanceRequiredToMove || !Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1); + + // Succ attack + if (!anyDarkEnergies) + { + // This is here because it's used in multiple places + float suckDistance = (CalamityWorld.LegendaryMode && revenge) ? 2400f : bossRush ? 1920f : death ? 1600f : revenge ? 1440f : expertMode ? 1280f : 1040f; + + // Move closer to the target before trying to succ + if (movingDuringSuccPhase) + { + // Avoid cheap bullshit + NPC.damage = 0; + + if (move) + Movement(true); + else + NPC.ai[3] = 1f; + } + else + { + // Set damage + NPC.damage = NPC.defDamage; + + // Use this to generate more and more dust in final phase + float finalPhaseDustRatio = 1f; + if (succSoHardThatYouDie) + { + finalPhaseDustRatio = 5f; + } + else if (theBigSucc) + { + float amount = (10f - (float)(NPC.life / (double)NPC.lifeMax) * 100f) / 10f; + finalPhaseDustRatio += MathHelper.Lerp(0f, 2f, amount); + } + + // Slow down + if (NPC.velocity.Length() > 0.5f) + NPC.velocity *= 0.8f; + else + NPC.velocity = Vector2.Zero; + + // Move towards target again if they get outside the succ radius + float moveCloserGateValue = suckDistance * 0.8f; + if (Vector2.Distance(NPC.Center, player.Center) > moveCloserGateValue) + NPC.ai[3] = 0f; + + // Ceaseless Void sucks in dark energy in different patterns + // This attack also sucks in all players that are within reach of the succ + for (int h = 0; h < 3; h++) + { + float distanceDivisor = h + 1f; + float dustDistance = suckDistance / distanceDivisor; + int numDust = (int)(0.1f * MathHelper.TwoPi * dustDistance); + Vector2 dustOffset = Vector2.UnitX.RotatedByRandom(MathHelper.Pi) * dustDistance; + + int var = (int)(dustDistance / finalPhaseDustRatio); + float dustVelocity = 24f / distanceDivisor * finalPhaseDustRatio; + for (int i = 0; i < numDust; i++) + { + if (Main.rand.NextBool(var)) + { + dustOffset = dustOffset.RotatedBy(MathHelper.TwoPi / numDust); + Vector2 dustSpawn = NPC.Center + dustOffset; + Dust dust = Dust.NewDustPerfect(dustSpawn, DustType(), Utils.DirectionTo(dustSpawn, NPC.Center) * dustVelocity, Scale: 3 - h); + dust.fadeIn = 1f; + } + } + } + + float succPower = 0.125f + finalPhaseDustRatio * 0.125f; + for (int i = 0; i < Main.maxPlayers; i++) + { + float distance = Vector2.Distance(Main.player[i].Center, NPC.Center); + if (distance < suckDistance && Main.player[i].grappling[0] == -1) + { + if (Collision.CanHit(NPC.Center, 1, 1, Main.player[i].Center, 1, 1)) + { + float distanceRatio = distance / suckDistance; + float multiplier = 1f - distanceRatio; + + if (Main.player[i].Center.X < NPC.Center.X) + Main.player[i].velocity.X += succPower * multiplier; + else + Main.player[i].velocity.X -= succPower * multiplier; + } + } + } + + // Slowly die in final phase and then implode + // This phase lasts 20 seconds + if (theBigSucc && calamityGlobalNPC.newAI[1] % 60f == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int damageAmt = NPC.lifeMax / 200; + NPC.life -= damageAmt; + NPC.DamageEffect(damageAmt); + } + + if (NPC.life <= (NPC.lifeMax / 40) && !playedbuildsound) + { + SoundEngine.PlaySound(BuildupSound, NPC.Center); + playedbuildsound = true; + } + + if (NPC.life <= 0) + { + NPC.life = 0; + NPC.HitEffect(); + NPC.checkDead(); + } + + NPC.netUpdate = true; + } + + // Beam Portals + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (calamityGlobalNPC.newAI[1] == 0f) + { + int numBeamPortals = bossRush ? 4 : revenge ? 3 : 2; + float degrees = 360 / numBeamPortals; + float beamPortalDistance = bossRush ? 360f : death ? 400f : revenge ? 420f : expertMode ? 440f : 480f; + int type = ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + for (int i = 0; i < numBeamPortals; i++) + { + float ai1 = i * degrees; + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + (float)(Math.Sin(i * degrees) * beamPortalDistance), player.Center.Y + (float)(Math.Cos(i * degrees) * beamPortalDistance), 0f, 0f, type, damage, 0f, Main.myPlayer, ai1, 0f); + } + } + } + + // Use this timer to lessen Dark Energy projectile rate of fire while Beam Portals are active + float beamPortalTimeLeft = 600f; + bool summonLessDarkEnergies = false; + if (calamityGlobalNPC.newAI[1] < beamPortalTimeLeft) + { + calamityGlobalNPC.newAI[1] += 1f; + summonLessDarkEnergies = true; + } + else if (theBigSucc) + calamityGlobalNPC.newAI[1] += 1f; + + // Suck in Dark Energy projectiles from far away + calamityGlobalNPC.newAI[3] += 1f; + float darkEnergySpiralGateValue = (summonLessDarkEnergies ? 24f : 12f) * projectileFireRateMultiplier; + if (calamityGlobalNPC.newAI[3] >= darkEnergySpiralGateValue) + { + calamityGlobalNPC.newAI[3] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + bool normalSpread = NPC.localAI[0] % 2f == 0f; + float speed = 0.5f; + int totalProjectiles = 4; + Vector2 spinningPoint = new Vector2(normalSpread ? 0f : -speed, -speed); + float radialOffset = MathHelper.ToRadians(NPC.localAI[1]); + for (int i = 0; i < totalProjectiles; i++) + { + Vector2 spawnVector = NPC.Center + Vector2.Normalize(spinningPoint.RotatedBy(MathHelper.TwoPi / totalProjectiles * i + radialOffset)) * suckDistance; + Vector2 velocity = Vector2.Normalize(NPC.Center - spawnVector) * speed; + Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); + } + } + + NPC.localAI[1] += 10f; + } + + // Summon some extra projectiles in Expert Mode + if (phase2 && expertMode) + { + NPC.localAI[2] += 1f; + if (NPC.localAI[2] >= 60f * projectileFireRateMultiplier) + { + NPC.localAI[2] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + bool normalSpread = NPC.localAI[0] % 2f != 0f; + float speed = 2f; + int totalProjectiles = 2; + float radians = MathHelper.TwoPi / totalProjectiles; + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX = (float)(speed * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = new Vector2(normalSpread ? 0f : -velocityX, -speed); + float radialOffset = MathHelper.ToRadians(NPC.localAI[1] * 0.25f); + for (int i = 0; i < totalProjectiles; i++) + { + Vector2 spawnVector = NPC.Center + Vector2.Normalize(spinningPoint.RotatedBy(radians * i + radialOffset)) * suckDistance; + Vector2 velocity = Vector2.Normalize(NPC.Center - spawnVector) * speed; + Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); + } + } + } + } + + // Summon some extra projectiles in Revengeance Mode + if (phase4 && revenge) + { + NPC.localAI[3] += 1f; + if (NPC.localAI[3] >= 90f * projectileFireRateMultiplier) + { + NPC.localAI[3] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + bool normalSpread = NPC.localAI[0] % 2f == 0f; + float speed = 4f; + int totalProjectiles = 2; + float radians = MathHelper.TwoPi / totalProjectiles; + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX = (float)(speed * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = new Vector2(normalSpread ? 0f : -velocityX, -speed); + float radialOffset = MathHelper.ToRadians(NPC.localAI[1] * 0.25f); + for (int i = 0; i < totalProjectiles; i++) + { + Vector2 spawnVector = NPC.Center + Vector2.Normalize(spinningPoint.RotatedBy(radians * i + radialOffset)) * suckDistance; + Vector2 velocity = Vector2.Normalize(NPC.Center - spawnVector) * speed; + Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); + } + } + } + } + } + } + else + { + // Avoid cheap bullshit + NPC.damage = 0; + + if (move) + { + Movement(false); + } + else + { + // Slow down + if (NPC.velocity.Length() > 0.5f) + NPC.velocity *= 0.8f; + else + NPC.velocity = Vector2.Zero; + } + + // Count up all Dark Energy HP values + int totalDarkEnergyHP = 0; + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC darkEnergy = Main.npc[i]; + if (darkEnergy.active && darkEnergy.type == NPCType()) + totalDarkEnergyHP += darkEnergy.life; + } + + // Destroy all Dark Energies if their total HP is below 20% + int darkEnergyMaxHP = bossRush ? DarkEnergy.MaxBossRushHP : DarkEnergy.MaxHP; + //These are still needed so that CV Dark energy despawn works properly + double HPBoost = CalamityServerConfig.Instance.BossHealthBoost * 0.01; + darkEnergyMaxHP += (int)(darkEnergyMaxHP * HPBoost); + + int totalDarkEnergiesSpawned = darkEnergyAmt * 3 + 2; + int totalDarkEnergyMaxHP = darkEnergyMaxHP * totalDarkEnergiesSpawned; + int succPhaseGateValue = (int)(totalDarkEnergyMaxHP * 0.2); + if (totalDarkEnergyHP < succPhaseGateValue) + { + SoundEngine.PlaySound(SoundID.NPCDeath44, NPC.Center); + + // Kill all Dark Energies + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC darkEnergy = Main.npc[i]; + if (darkEnergy.active && darkEnergy.type == NPCType()) + { + darkEnergy.HitEffect(); + darkEnergy.active = false; + darkEnergy.netUpdate = true; + } + } + + // Generate a dust explosion + int dustAmt = 30; + int random = 3; + for (int j = 0; j < 10; j++) + { + random += j * 2; + for (int d = 0; d < dustAmt; d++) + { + Vector2 dustVelocity = new Vector2(Main.rand.Next(-random, random), Main.rand.Next(-random, random)); + dustVelocity = Vector2.Normalize(dustVelocity) * random * 2f; + Dust realDust = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2CircularEdge(10f, 10f), (int)CalamityDusts.PurpleCosmilite, dustVelocity, 100, default, 5f); + realDust.noGravity = true; + } + } + } + } + + // Basic movement towards a location + void Movement(bool succ) + { + float velocity = moveVeryFast ? 25f : bossRush ? 15f : ((expertMode ? 7.5f : 6f) + (float)(death ? 2f * (1D - lifeRatio) : 0f)) * tileEnrageMult; + float acceleration = (moveVeryFast ? 0.75f : bossRush ? 0.3f : death ? 0.2f : expertMode ? 0.16f : 0.12f) + (float)(death ? 0.04f * (1D - lifeRatio) : 0f) * tileEnrageMult; + + // Increase speed dramatically in succ phase + if (succ) + { + velocity *= 2f; + acceleration *= 2f; + } + + if (Main.getGoodWorld) + { + velocity *= 1.15f; + acceleration *= 1.15f; + } + + Vector2 destination = player.Center; + + // Move between 8 different positions around the player, in order + float maxDistance = 320f; + Vector2 moveToOffset = succ ? Vector2.Zero : Main.getGoodWorld ? new Vector2(0f, -maxDistance) : Vector2.Zero; + if (!succ && Main.getGoodWorld) + { + // Move to a new location every few seconds + calamityGlobalNPC.newAI[2] += 1f; + float newPositionGateValue = bossRush ? 120f : death ? 180f : revenge ? 210f : expertMode ? 240f : 300f; + if (calamityGlobalNPC.newAI[2] > newPositionGateValue) + { + calamityGlobalNPC.newAI[2] = 0f; + + NPC.ai[0] += 1f; + if (NPC.ai[0] > 7f) + NPC.ai[0] = 0f; + } + + switch ((int)NPC.ai[0]) + { + case 0: + break; + case 1: + moveToOffset.X = -maxDistance; + break; + case 2: + moveToOffset.X = -maxDistance; + moveToOffset.Y = 0f; + break; + case 3: + moveToOffset.X = -maxDistance; + moveToOffset.Y = maxDistance; + break; + case 4: + moveToOffset.Y = maxDistance; + break; + case 5: + moveToOffset.X = maxDistance; + moveToOffset.Y = maxDistance; + break; + case 6: + moveToOffset.X = maxDistance; + moveToOffset.Y = 0f; + break; + case 7: + moveToOffset.X = maxDistance; + break; + } + } + + destination += moveToOffset; + + // How far Ceaseless Void is from where it's supposed to be + Vector2 distanceFromDestination = destination - NPC.Center; + + // Movement + if (NPC.Distance(destination) > maxDistance || succ || !Main.getGoodWorld) + CalamityUtils.SmoothMovement(NPC, 0f, distanceFromDestination, velocity, acceleration, true); + } + + // Spawn more Dark Energies as the fight progresses + if (calamityGlobalNPC.newAI[0] == 0f && NPC.life > 0) + calamityGlobalNPC.newAI[0] = NPC.lifeMax; + + if (NPC.life > 0) + { + int healthGateValue = (int)(NPC.lifeMax * 0.3); + if ((NPC.life + healthGateValue) < calamityGlobalNPC.newAI[0]) + { + NPC.TargetClosest(); + calamityGlobalNPC.newAI[0] = NPC.life; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + NPC.ai[3] = 0f; + NPC.localAI[0] += 1f; + NPC.localAI[1] = 0f; + NPC.localAI[2] = 0f; + NPC.localAI[3] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (phase4) + { + for (int i = 0; i < darkEnergyAmt; i++) + { + for (int j = 0; j < 3; j++) + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(NPC.Center.Y + (Math.Cos(i * spacing) * distance2)), NPCType(), NPC.whoAmI, i * spacing, j * 2f); + } + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)(NPC.Center.Y + distance2), NPCType(), NPC.whoAmI, 0f, 1f); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)(NPC.Center.Y + distance2), NPCType(), NPC.whoAmI, 0f, 3f); + } + else if (phase3) + { + for (int i = 0; i < darkEnergyAmt; i++) + { + for (int j = 0; j < 3; j++) + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(NPC.Center.Y + (Math.Cos(i * spacing) * distance2)), NPCType(), NPC.whoAmI, i * spacing, j * 1.5f); + } + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)(NPC.Center.Y + distance2), NPCType(), NPC.whoAmI, 0f, 0.5f); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)(NPC.Center.Y + distance2), NPCType(), NPC.whoAmI, 0f, 2f); + } + else + { + for (int i = 0; i < darkEnergyAmt; i++) + { + for (int j = 0; j < 3; j++) + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(NPC.Center.Y + (Math.Cos(i * spacing) * distance2)), NPCType(), NPC.whoAmI, i * spacing, j); + } + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)(NPC.Center.Y + distance2), NPCType(), NPC.whoAmI, 0f, 1.5f); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)(NPC.Center.Y + distance2), NPCType(), NPC.whoAmI, 0f, 2.5f); + } + } + + // Despawn potentially hazardous projectiles when entering a new phase + for (int i = 0; i < Main.maxProjectiles; i++) + { + Projectile projectile = Main.projectile[i]; + if (projectile.active) + { + if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || + projectile.type == ProjectileType() || projectile.type == ProjectileType()) + { + if (projectile.timeLeft > 30) + projectile.timeLeft = 30; + } + } + } + } + } } public override bool CanHitPlayer(Player target, ref int cooldownSlot) @@ -219,7 +770,7 @@ namespace CalamityMod.NPCs.CeaselessVoid public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.Add(ItemDropRule.BossBag(ModContent.ItemType())); + npcLoot.Add(ItemDropRule.BossBag(ItemType())); // Normal drops: Everything that would otherwise be in the bag LeadingConditionRule normalOnly = new LeadingConditionRule(new Conditions.NotExpert()); @@ -228,40 +779,40 @@ namespace CalamityMod.NPCs.CeaselessVoid // Weapons int[] weapons = new int[] { - ModContent.ItemType(), - ModContent.ItemType(), + ItemType(), + ItemType(), }; normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, weapons)); // Materials - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 10, 12)); + normalOnly.Add(DropHelper.PerPlayer(ItemType(), 1, 10, 12)); // Equipment - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + normalOnly.Add(DropHelper.PerPlayer(ItemType())); // Vanity - normalOnly.Add(ModContent.ItemType(), 7); - var godSlayerVanity = ItemDropRule.Common(ModContent.ItemType(), 20); - godSlayerVanity.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); - godSlayerVanity.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); + normalOnly.Add(ItemType(), 7); + var godSlayerVanity = ItemDropRule.Common(ItemType(), 20); + godSlayerVanity.OnSuccess(ItemDropRule.Common(ItemType())); + godSlayerVanity.OnSuccess(ItemDropRule.Common(ItemType())); normalOnly.Add(godSlayerVanity); - normalOnly.Add(ModContent.ItemType(), ThankYouPainting.DropInt); + normalOnly.Add(ItemType(), ThankYouPainting.DropInt); } - npcLoot.Add(ModContent.ItemType(), 10); + npcLoot.Add(ItemType(), 10); // Relic - npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ItemType()); // GFB Eclipse Mirror and Nucleogenesis drop var GFBOnly = npcLoot.DefineConditionalDropSet(DropHelper.GFB); { - GFBOnly.Add(DropHelper.PerPlayer(ModContent.ItemType()), hideLootReport: true); - GFBOnly.Add(DropHelper.PerPlayer(ModContent.ItemType()), hideLootReport: true); + GFBOnly.Add(DropHelper.PerPlayer(ItemType()), hideLootReport: true); + GFBOnly.Add(DropHelper.PerPlayer(ItemType()), hideLootReport: true); } // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedCeaselessVoid, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedCeaselessVoid, ItemType(), desc: DropHelper.FirstKillText); } public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) @@ -271,7 +822,7 @@ namespace CalamityMod.NPCs.CeaselessVoid public override void BossLoot(ref string name, ref int potionType) { - potionType = ModContent.ItemType(); + potionType = ItemType(); } public override void HitEffect(NPC.HitInfo hit) From 4629351c18fa12ea25df6137ed956a3631894f91 Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Thu, 5 Jun 2025 04:56:11 +0700 Subject: [PATCH 30/47] screap --- Items/Materials/WulfrumMetalScrap.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Materials/WulfrumMetalScrap.cs b/Items/Materials/WulfrumMetalScrap.cs index 29df19b121..1f1031014f 100644 --- a/Items/Materials/WulfrumMetalScrap.cs +++ b/Items/Materials/WulfrumMetalScrap.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Items.Materials return true; else { - spriteBatch.Draw(altTexture.Value, position, null, drawColor, 0, origin, altTexture.Size() / 2, SpriteEffects.None, 0); + spriteBatch.Draw(altTexture.Value, position, null, drawColor, 0, altTexture.Size() / 2, scale, SpriteEffects.None, 0); return false; } } From 1aacebbe4405402e823746dca7533911b60c276d Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Thu, 5 Jun 2025 00:47:57 -0400 Subject: [PATCH 31/47] More boss tweaks I've been sitting on 1 - Removed Hive Mind firing vile spit 2 - Cal Clone no longer has aimed hellblasts during BH2 3 - Removed Lunatic Cultist summoning an Ancient Vision after interrupting the ritual --- NPCs/CalClone/CalamitasClone.cs | 2 +- .../CalamityBossAIs/CalamitasCloneAI.cs | 5 +- NPCs/CalamityGlobalNPC.cs | 67 ------------------- NPCs/HiveMind/HiveMind.cs | 58 +--------------- .../VanillaNPCAIOverrides/Bosses/CultistAI.cs | 7 -- 5 files changed, 6 insertions(+), 133 deletions(-) diff --git a/NPCs/CalClone/CalamitasClone.cs b/NPCs/CalClone/CalamitasClone.cs index 1fa25a84ae..86483769a4 100644 --- a/NPCs/CalClone/CalamitasClone.cs +++ b/NPCs/CalClone/CalamitasClone.cs @@ -134,7 +134,7 @@ namespace CalamityMod.NPCs.CalClone public override void AI() { - CalamitasCloneAI.VanillaCalamitasCloneAI(NPC, Mod, BulletHellWarnSlot); + CalamitasCloneAI.VanillaCalamitasCloneAI(NPC, BulletHellWarnSlot); } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) diff --git a/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs index 7dfb5557da..1f70165548 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs { public static class CalamitasCloneAI { - public static void VanillaCalamitasCloneAI(NPC npc, Mod mod, SlotId warn) + public static void VanillaCalamitasCloneAI(NPC npc, SlotId warn) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); @@ -386,7 +386,8 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); float projSpeed = bossRush ? 4.5f : 4f; - if (calamityGlobalNPC.newAI[3] % (hellblastGateValue * 6f) == 0f) + // Blasts aimed directly at the player's horizontal position, does not spawn during the second bullet hell + if (calamityGlobalNPC.newAI[3] % (hellblastGateValue * 6f) == 0f && calamityGlobalNPC.newAI[2] != 2f) { float distance = Main.rand.NextBool() ? -1000f : 1000f; float velocity = distance == -1000f ? projSpeed : -projSpeed; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 7bda915868..545cc5dcef 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -4137,73 +4137,6 @@ namespace CalamityMod.NPCs return DukeFishronAI.BuffedDetonatingBubbleAI(npc, Mod); } - // Expert+ Hive Mind Vile Spits - if (npc.type == NPCID.VileSpitEaterOfWorlds) - { - if (Main.expertMode || BossRushEvent.BossRushActive) - { - if (npc.ai[1] >= 69f) - { - if (npc.target == Main.maxPlayers) - { - npc.TargetClosest(); - - float velocity = Main.getGoodWorld ? 12f : (CalamityWorld.death || BossRushEvent.BossRushActive) ? 10.5f : 9f; - if (npc.ai[1] == 70f) - velocity *= 0.4f; - - npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; - } - - if (Main.getGoodWorld && !npc.dontTakeDamage) - { - if ((double)(npc.Center.Y / 16f) < Main.worldSurface) - npc.dontTakeDamage = true; - } - - npc.damage = npc.GetAttackDamage_ScaledByStrength(32f); - - npc.ai[0] += 1f; - if (npc.ai[0] > 3f) - npc.ai[0] = 3f; - - if (npc.ai[0] == 2f) - { - npc.position += npc.velocity; - SoundEngine.PlaySound(SoundID.NPCDeath9, npc.Center); - for (int i = 0; i < 20; i++) - { - int dust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f) + npc.netOffset, npc.width, npc.height, DustID.CorruptGibs, 0f, 0f, 100, default, 1.8f); - Main.dust[dust].velocity *= 1.3f; - Main.dust[dust].velocity += npc.velocity; - Main.dust[dust].noGravity = true; - } - } - - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - npc.StrikeInstantKill(); - } - - npc.EncourageDespawn(100); - - npc.position += npc.netOffset; - for (int i = 0; i < 2; i++) - { - int dust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f), npc.width, npc.height, DustID.CorruptGibs, npc.velocity.X * 0.1f, npc.velocity.Y * 0.1f, 80, default, 1.3f); - Main.dust[dust].velocity *= 0.3f; - Main.dust[dust].noGravity = true; - } - - npc.rotation += 0.4f * npc.direction; - npc.position -= npc.netOffset; - - return false; - } - } - } - if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { switch (npc.type) diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index dac83e0034..1917f8fbce 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -74,7 +74,6 @@ namespace CalamityMod.NPCs.HiveMind private int rainDashAmount = 1; private int rainDashesPerformed = 0; private bool performingRainDashCombo = false; - private int vileSpitFireRate = 24; // Fire rate for Expert-exclusive Vile Spits during phase 1 teleports private int phase2timer = 360; private int rotationDirection; private double rotation; @@ -176,7 +175,6 @@ namespace CalamityMod.NPCs.HiveMind lungeTime = 28; driftSpeed = 2f; driftBoost = 2f; - vileSpitFireRate = 18; } if (death) @@ -189,7 +187,6 @@ namespace CalamityMod.NPCs.HiveMind lungeTime = 23; driftSpeed = 3.5f; driftBoost = 1.5f; - vileSpitFireRate = 15; } if (bossRush) @@ -200,7 +197,6 @@ namespace CalamityMod.NPCs.HiveMind lungeTime = 16; driftSpeed = 6f; driftBoost = 1f; - vileSpitFireRate = 12; } if (Main.getGoodWorld) @@ -674,15 +670,6 @@ namespace CalamityMod.NPCs.HiveMind burrowedDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, DustID.Demonite, 0f, -3f, 100, default, 2.5f * NPC.scale); Main.dust[burrowedDust2].velocity *= 1f; } - - if (expertMode) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (Collision.CanHitLine(NPC.Center, 1, 1, player.Center, 1, 1) && NPC.Distance(player.Center) > 160f && burrowTimer % vileSpitFireRate == 0) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, NPCID.VileSpitEaterOfWorlds, 0, 0f, 69f); - } - } } else if (burrowTimer == -60) { @@ -735,15 +722,6 @@ namespace CalamityMod.NPCs.HiveMind burrowedDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, DustID.Demonite, 0f, -3f, 100, default, 2.5f * NPC.scale); Main.dust[burrowedDust2].velocity *= 1f; } - - if (expertMode) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (Collision.CanHitLine(NPC.Center, 1, 1, player.Center, 1, 1) && NPC.Distance(player.Center) > 160f && burrowTimer % vileSpitFireRate == 0) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, NPCID.VileSpitEaterOfWorlds, 0, 0f, 69f); - } - } } else if (burrowTimer == 0) { @@ -858,16 +836,6 @@ namespace CalamityMod.NPCs.HiveMind return; } - if (expertMode) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.localAI[2] += 1f; - if (Collision.CanHitLine(NPC.Center, 1, 1, player.Center, 1, 1) && NPC.Distance(player.Center) > 160f && NPC.localAI[2] % (vileSpitFireRate * 2) == 0) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, NPCID.VileSpitEaterOfWorlds, 0, 0f, 69f); - } - } - NPC.velocity = player.Center - NPC.Center; phase2timer--; @@ -985,18 +953,7 @@ namespace CalamityMod.NPCs.HiveMind NPC.ForceNetUpdate(); if (NPC.alpha > 0) { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.Center = player.Center + new Vector2(teleportRadius, 0).RotatedBy(rotation); - - if (death) - { - NPC.localAI[2] += 1f; - if (Collision.CanHitLine(NPC.Center, 1, 1, player.Center, 1, 1) && NPC.Distance(player.Center) > 160f && NPC.localAI[2] % vileSpitFireRate == 0) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, NPCID.VileSpitEaterOfWorlds, 0, 0f, 70f); - } - } - + NPC.Center = player.Center + new Vector2(teleportRadius, 0).RotatedBy(rotation); rotation += rotationIncrement * rotationDirection; phase2timer = lungesPerformed > 0 ? (lungeDelay / (lungesPerformed + 1)) : lungeDelay; @@ -1024,18 +981,7 @@ namespace CalamityMod.NPCs.HiveMind } else { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.Center = player.Center + new Vector2(teleportRadius, 0).RotatedBy(rotation); - - if (death) - { - NPC.localAI[2] += 1f; - if (Collision.CanHitLine(NPC.Center, 1, 1, player.Center, 1, 1) && NPC.Distance(player.Center) > 160f && NPC.localAI[2] % vileSpitFireRate == 0) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, NPCID.VileSpitEaterOfWorlds, 0, 0f, 70f); - } - } - + NPC.Center = player.Center + new Vector2(teleportRadius, 0).RotatedBy(rotation); rotation += rotationIncrement * rotationDirection * phase2timer / lungeDelay; } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs index 4f716d58db..d75e76189f 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs @@ -157,13 +157,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityUtils.CalamityTargeting(npc, options); npc.netUpdate = true; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (!NPC.AnyNPCs(NPCID.AncientCultistSquidhead)) - NPC.NewNPC(npc.GetSource_FromAI(), (int)Main.projectile[(int)npc.ai[2]].Center.X, (int)Main.projectile[(int)npc.ai[2]].Center.Y, NPCID.AncientCultistSquidhead); - } - Main.projectile[(int)npc.ai[2]].ai[1] = -1f; Main.projectile[(int)npc.ai[2]].netUpdate = true; } From 9f4bd8455f1ab2f87ceea80b9cd1453bd385b9be Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Thu, 5 Jun 2025 08:17:06 -0500 Subject: [PATCH 32/47] fixed NPC Cap shader issue --- NPCs/CalamityDrawParameterNPC.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NPCs/CalamityDrawParameterNPC.cs b/NPCs/CalamityDrawParameterNPC.cs index ca630f4f02..b05b4f6b4a 100644 --- a/NPCs/CalamityDrawParameterNPC.cs +++ b/NPCs/CalamityDrawParameterNPC.cs @@ -45,8 +45,8 @@ namespace CalamityMod.NPCs #region Load / Unload public override void Load() { - DrawingMiracleBlight = new bool[Main.maxNPCs]; - DrawingPolarity = new bool[Main.maxNPCs]; + DrawingMiracleBlight = new bool[Main.maxNPCs + 1]; + DrawingPolarity = new bool[Main.maxNPCs + 1]; } public override void Unload() From ebdc4899874c57d5a638064450c06bed697ce80a Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Thu, 5 Jun 2025 18:39:14 -0400 Subject: [PATCH 33/47] Removed Meteor Fist ignoring projectile NPCs since it was done purely for Hive Mind vile spit --- Projectiles/Rogue/MeteorFistProj.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/Projectiles/Rogue/MeteorFistProj.cs b/Projectiles/Rogue/MeteorFistProj.cs index cc694bad98..13e1a8b6f4 100644 --- a/Projectiles/Rogue/MeteorFistProj.cs +++ b/Projectiles/Rogue/MeteorFistProj.cs @@ -110,9 +110,6 @@ namespace CalamityMod.Projectiles.Rogue return false; } public override bool? CanDamage() => Projectile.numHits == 0 ? null : false; - - // Fuck off stupid Vile Spits - public override bool? CanHitNPC(NPC target) => NPCID.Sets.ProjectileNPC[target.type] ? false : null; public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.OnFire, 120); From f5def149772200164b2d71250ffb91b6b29fc430 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Thu, 5 Jun 2025 22:13:55 -0400 Subject: [PATCH 34/47] Added Disgusting Meat Unobtainable debug item which can remove permanent boosters, dropping them as items --- Items/DisgustingMeat.cs | 60 ++++++++++++++++++ Items/DisgustingMeat.png | Bin 0 -> 434 bytes .../en-US/Mods.CalamityMod.Items.Misc.hjson | 11 ++++ 3 files changed, 71 insertions(+) create mode 100644 Items/DisgustingMeat.cs create mode 100644 Items/DisgustingMeat.png diff --git a/Items/DisgustingMeat.cs b/Items/DisgustingMeat.cs new file mode 100644 index 0000000000..e383ac2bbe --- /dev/null +++ b/Items/DisgustingMeat.cs @@ -0,0 +1,60 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.PermanentBoosters; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public class DisgustingMeat : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + + public override void SetDefaults() + { + Item.DefaultToFood(32, 30, 0, 0); + Item.value = 0; + Item.UseSound = SoundID.NPCDeath13; + Item.maxStack = 1; + Item.consumable = false; + } + + public override bool AltFunctionUse(Player player) => true; + public override bool? UseItem(Player player) + { + var calPlayer = player.Calamity(); + if (player.altFunctionUse == 2) + { + TryDropBoosterItem(player, ref calPlayer.rageBoostOne, ModContent.ItemType()); + TryDropBoosterItem(player, ref calPlayer.rageBoostTwo, ModContent.ItemType()); + TryDropBoosterItem(player, ref calPlayer.rageBoostThree, ModContent.ItemType()); + TryDropBoosterItem(player, ref calPlayer.adrenalineBoostOne, ModContent.ItemType()); + TryDropBoosterItem(player, ref calPlayer.adrenalineBoostTwo, ModContent.ItemType()); + TryDropBoosterItem(player, ref calPlayer.adrenalineBoostThree, ModContent.ItemType()); + TryDropBoosterItem(player, ref calPlayer.nimbleBounderBoost, ModContent.ItemType()); + } + else + { + TryDropBoosterItem(player, ref calPlayer.sTangerine, ModContent.ItemType()); + TryDropBoosterItem(player, ref calPlayer.mFruit, ModContent.ItemType()); + TryDropBoosterItem(player, ref calPlayer.tCloudberry, ModContent.ItemType()); + TryDropBoosterItem(player, ref calPlayer.sStrawberry, ModContent.ItemType()); + TryDropBoosterItem(player, ref calPlayer.cShard, ModContent.ItemType()); + TryDropBoosterItem(player, ref calPlayer.eCore, ModContent.ItemType()); + TryDropBoosterItem(player, ref calPlayer.pHeart, ModContent.ItemType()); + } + + return null; + } + + private static void TryDropBoosterItem(Player player, ref bool condition, int itemType) + { + if (condition) + { + condition = false; + int drop = Item.NewItem(player.GetSource_DropAsItem(), player.Hitbox, itemType); + Main.item[drop].noGrabDelay = 100; + } + } + } +} diff --git a/Items/DisgustingMeat.png b/Items/DisgustingMeat.png new file mode 100644 index 0000000000000000000000000000000000000000..32e4aad4d2f8cb1940efd06e396ca278c4c7c196 GIT binary patch literal 434 zcmV;j0ZsmiP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0Y^zhK~z{r-IhN} z13?%^Upzn>8%e4(K~RIiMr?vYJb(nj(!we>fi#LJ0kINn1Pc!!XvhI96fDF>6hR0! zc9J?5h=u%Q{Mf`lS=||5m6tnPL&~|#Q!N^&2KNB0GL_G!+;Xu7Lc)MuI;(YcXO4nthSCI$O1B#@#XbB z0P}OxFu+{ will remove health and mana upgrades + will remove rage and adrenaline upgrades, plus other miscellaneous boosters + Removed boosters will be vomited out of you as items + ''' +} + MomentumCapacitor: { DisplayName: Momentum Capacitor GFBName: Burden Breaker From c365144ae9161ffd2d3c28b59d4f3b630e1019b0 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Thu, 5 Jun 2025 23:25:38 -0400 Subject: [PATCH 35/47] 1 - Removed extra Creeper clones 2 - Actually fixed Skeletron Prime not spinning on the first spin attack 3 - Skeletron Prime no longer spawns Probes --- NPCs/CalamityGlobalNPC.cs | 93 +------------------ .../Bosses/SkeletronPrimeAI.cs | 9 +- 2 files changed, 6 insertions(+), 96 deletions(-) diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 545cc5dcef..2a620e8b76 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -8218,7 +8218,6 @@ namespace CalamityMod.NPCs public override void PostDraw(NPC npc, SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - bool masterMode = Main.masterMode || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; @@ -8457,10 +8456,10 @@ namespace CalamityMod.NPCs opacity = 1f; opacity = MathHelper.Clamp(opacity, 0f, 1f); - currentColor.R = (byte)((float)(int)currentColor.R * opacity); - currentColor.G = (byte)((float)(int)currentColor.G * opacity); - currentColor.B = (byte)((float)(int)currentColor.B * opacity); - currentColor.A = (byte)((float)(int)currentColor.A * opacity); + currentColor.R = (byte)(currentColor.R * opacity); + currentColor.G = (byte)(currentColor.G * opacity); + currentColor.B = (byte)(currentColor.B * opacity); + currentColor.A = (byte)(currentColor.A * opacity); int totalAfterimages = 4; for (int i = 0; i < totalAfterimages; i++) { @@ -8484,90 +8483,6 @@ namespace CalamityMod.NPCs int height = TextureAssets.Npc[npc.type] is null ? 0 : TextureAssets.Npc[npc.type].Height(); spriteBatch.Draw(TextureAssets.Npc[npc.type].Value, new Vector2(position.X - screenPos.X + (float)(npc.width / 2) - (float)width * npc.scale / 2f + halfSize.X * npc.scale, position.Y - screenPos.Y + (float)npc.height - (float)height * npc.scale / (float)Main.npcFrameCount[npc.type] + 4f + halfSize.Y * npc.scale + npc.gfxOffY), npc.frame, currentColor, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); } - - float secondAfterimageSetHealthValue = (int)(Main.npc[NPC.crimsonBoss].lifeMax * 0.8f); - if (Main.npc[NPC.crimsonBoss].life < secondAfterimageSetHealthValue) - { - currentColor = npc.GetAlpha(drawColor); - float opacityScale = 1f - Main.npc[NPC.crimsonBoss].life / (float)secondAfterimageSetHealthValue; - opacity = Main.getGoodWorld ? 1f : opacityScale; - - opacity = MathHelper.Clamp(opacity, 0f, 1f); - currentColor.R = (byte)((float)(int)currentColor.R * opacity); - currentColor.G = (byte)((float)(int)currentColor.G * opacity); - currentColor.B = (byte)((float)(int)currentColor.B * opacity); - currentColor.A = (byte)((float)(int)currentColor.A * opacity); - totalAfterimages = death ? 12 : 4; - for (int i = 0; i < totalAfterimages; i++) - { - Vector2 position = npc.position; - float distanceFromTargetX = Math.Abs(npc.Center.X - Main.LocalPlayer.Center.X); - float distanceFromTargetY = Math.Abs(npc.Center.Y - Main.LocalPlayer.Center.Y); - if (i > 3) - { - currentColor *= 0.5f; - distanceFromTargetX *= 0.5f; - distanceFromTargetY *= 0.5f; - } - - switch (i) - { - case 0: - case 4: - position.X = Main.LocalPlayer.Center.X - distanceFromTargetX; - position.Y = Main.LocalPlayer.Center.Y + distanceFromBrain.Y; - break; - - case 1: - case 5: - position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY; - position.X = Main.LocalPlayer.Center.X + distanceFromBrain.X; - break; - - case 2: - case 6: - position.X = Main.LocalPlayer.Center.X + distanceFromTargetX; - position.Y = Main.LocalPlayer.Center.Y + distanceFromBrain.Y; - break; - - case 3: - case 7: - position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY; - position.X = Main.LocalPlayer.Center.X + distanceFromBrain.X; - break; - - case 8: - position.X = Main.LocalPlayer.Center.X - distanceFromTargetX; - position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY; - break; - - case 9: - position.X = Main.LocalPlayer.Center.X + distanceFromTargetX; - position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY; - break; - - case 10: - position.X = Main.LocalPlayer.Center.X + distanceFromTargetX; - position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY; - break; - - case 11: - position.X = Main.LocalPlayer.Center.X - distanceFromTargetX; - position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY; - break; - - default: - break; - } - - position.X -= npc.width / 2; - position.Y -= npc.height / 2; - - int width = TextureAssets.Npc[npc.type] is null ? 0 : TextureAssets.Npc[npc.type].Width(); - int height = TextureAssets.Npc[npc.type] is null ? 0 : TextureAssets.Npc[npc.type].Height(); - spriteBatch.Draw(TextureAssets.Npc[npc.type].Value, new Vector2(position.X - screenPos.X + (float)(npc.width / 2) - (float)width * npc.scale / 2f + halfSize.X * npc.scale, position.Y - screenPos.Y + (float)npc.height - (float)height * npc.scale / (float)Main.npcFrameCount[npc.type] + 4f + halfSize.Y * npc.scale + npc.gfxOffY), npc.frame, currentColor, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); - } - } } float beginTelegraphGateValue = BrainOfCthulhuAI.TimeBeforeCreeperAttack - BrainOfCthulhuAI.CreeperTelegraphTime; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs index 83d7210b95..5c1d32375d 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs @@ -37,6 +37,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Spawn arms if (calamityGlobalNPC.newAI[1] == 0f) { + CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); calamityGlobalNPC.newAI[1] = 1f; if (Main.netMode != NetmodeID.MultiplayerClient) @@ -269,6 +270,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[2] = 0f; npc.ai[1] = shouldSpinAround ? 5f : 1f; + CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); npc.netUpdate = true; } } @@ -652,13 +654,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses damage = (int)(damage * secondMechMultiplier); } - if (npc.localAI[0] % 3f == 0f) - { - int probeLimit = death ? 3 : 2; - if (NPC.CountNPCS(NPCID.Probe) < probeLimit) - NPC.NewNPC(npc.GetSource_FromAI(), (int)headCenter.X, (int)headCenter.Y + 30, NPCID.Probe); - } - int enragedSkulls = Projectile.NewProjectile(npc.GetSource_FromAI(), headCenter.X, headCenter.Y + 30f, enragedHeadSkullTargetX, enragedHeadSkullTargetY, type, damage, 0f, Main.myPlayer, -3f, 0f); Main.projectile[enragedSkulls].timeLeft = 480; Main.projectile[enragedSkulls].tileCollide = false; From 48e1c167fa566fafdeec8ddccb45e9b4d4ba463a Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Fri, 6 Jun 2025 13:45:51 -0400 Subject: [PATCH 36/47] Moved several boss AIs from the CalamityAIs folder to their actual files Bosses moved: Astrum Aureus, Brimstone Elemental, Calamitas Clone, Dragonfolly, Old Duke Also internally renamed Dragonfolly and Draconic Swarmers because I'm pretty sure Fabsol was the only person who insisted on keeping it Bumblefuck --- DataStructures/NPCStats.cs | 10 +- Events/BossRushEvent.cs | 2 +- Items/SummonItems/ExoticPheromones.cs | 4 +- Items/TreasureBags/DragonfollyBag.cs | 2 +- .../en-US/Mods.CalamityMod.NPCs.hjson | 4 + ModSupport/WeakReferenceSupport.cs | 2 +- NPCs/AstrumAureus/AstrumAureus.cs | 934 ++++++++- NPCs/BrimstoneElemental/BrimstoneElemental.cs | 708 ++++++- NPCs/Bumblebirb/Bumblefuck.cs | 539 ------ NPCs/Bumblebirb/Bumblefuck2.cs | 153 -- NPCs/Bumblebirb/DraconicSwarmer.cs | 369 ++++ NPCs/Bumblebirb/Dragonfolly.cs | 1356 +++++++++++++ NPCs/CalClone/CalamitasClone.cs | 718 ++++++- NPCs/CalClone/Cataclysm.cs | 335 +++- NPCs/CalClone/Catastrophe.cs | 331 +++- .../CalamityBossAIs/AstrumAureusAI.cs | 969 ---------- .../CalamityBossAIs/BrimstoneElementalAI.cs | 734 ------- .../CalamityBossAIs/BumblebirbAI.cs | 1077 ----------- .../CalamityBossAIs/CalamitasCloneAI.cs | 1406 -------------- NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs | 1702 ----------------- NPCs/CalamityGlobalNPC.cs | 4 +- NPCs/NormalNPCs/WildBumblebirb.cs | 389 ++++ NPCs/NormalNPCs/WildBumblefuck.cs | 173 -- NPCs/OldDuke/OldDuke.cs | 1653 +++++++++++++++- NPCs/SupremeCalamitas/SupremeCalamitas.cs | 4 +- NPCs/Yharon/Yharon.cs | 4 +- Projectiles/Boss/BirbAuraFlare.cs | 2 +- Scenes/MusicScenes/DragonfollyMusicScene.cs | 2 +- Systems/Collections/NPCs/BossHPScalingList.cs | 2 +- Systems/Collections/NPCs/BossTypeDict.cs | 2 +- .../Collections/NPCs/EnemyImmunitiesList.cs | 2 +- Tiles/MonsterBanner.cs | 2 +- UI/SpeedrunTimerUI.cs | 2 +- Utilities/NPCDebuffs.cs | 6 +- 34 files changed, 6807 insertions(+), 6795 deletions(-) delete mode 100644 NPCs/Bumblebirb/Bumblefuck.cs delete mode 100644 NPCs/Bumblebirb/Bumblefuck2.cs create mode 100644 NPCs/Bumblebirb/DraconicSwarmer.cs create mode 100644 NPCs/Bumblebirb/Dragonfolly.cs delete mode 100644 NPCs/CalamityAIs/CalamityBossAIs/AstrumAureusAI.cs delete mode 100644 NPCs/CalamityAIs/CalamityBossAIs/BrimstoneElementalAI.cs delete mode 100644 NPCs/CalamityAIs/CalamityBossAIs/BumblebirbAI.cs delete mode 100644 NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs delete mode 100644 NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs create mode 100644 NPCs/NormalNPCs/WildBumblebirb.cs delete mode 100644 NPCs/NormalNPCs/WildBumblefuck.cs diff --git a/DataStructures/NPCStats.cs b/DataStructures/NPCStats.cs index 18cef5a312..c346d23677 100644 --- a/DataStructures/NPCStats.cs +++ b/DataStructures/NPCStats.cs @@ -261,7 +261,7 @@ namespace CalamityMod { ModContent.NPCType(), 0.8 }, - { ModContent.NPCType(), 0.8 }, + { ModContent.NPCType(), 0.8 }, { ModContent.NPCType(), 0.8 }, { ModContent.NPCType(), 0.8 }, @@ -510,8 +510,8 @@ namespace CalamityMod { ModContent.NPCType(), new int[] { 100, 200, 220, 240, 300 } }, { ModContent.NPCType(), new int[] { 100, 200, 220, 232, 300 } }, - { ModContent.NPCType(), new int[] { 170, 256, 288, 320, 504 } }, - { ModContent.NPCType(), new int[] { 145, 220, 242, 264, 435 } }, + { ModContent.NPCType(), new int[] { 170, 256, 288, 320, 504 } }, + { ModContent.NPCType(), new int[] { 145, 220, 242, 264, 435 } }, { ModContent.NPCType(), new int[] { 240, 360, 396, 432, 720 } }, { ModContent.NPCType(), new int[] { 175, 260, 288, 316, 525 } }, @@ -769,8 +769,8 @@ namespace CalamityMod { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 248, 360 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 35, 50, 50, 0, 0 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 268, 420 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 200, 300, 332, 364, 600 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 268, 420 } }, + { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 200, 300, 332, 364, 600 } }, { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 150, 264, 288, 312, 450 } }, // Split holy fire does: 113, 198, 216, 234, 338 { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 248, 360 } }, diff --git a/Events/BossRushEvent.cs b/Events/BossRushEvent.cs index d3bf603ee5..42f0556052 100644 --- a/Events/BossRushEvent.cs +++ b/Events/BossRushEvent.cs @@ -309,7 +309,7 @@ namespace CalamityMod.Events NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, type); }, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }), - new Boss(ModContent.NPCType(), permittedNPCs: new int[] { ModContent.NPCType() }), + new Boss(ModContent.NPCType(), permittedNPCs: new int[] { ModContent.NPCType() }), new Boss(ModContent.NPCType(), TimeChangeContext.Day, type => { diff --git a/Items/SummonItems/ExoticPheromones.cs b/Items/SummonItems/ExoticPheromones.cs index 995118804c..6c6504bc90 100644 --- a/Items/SummonItems/ExoticPheromones.cs +++ b/Items/SummonItems/ExoticPheromones.cs @@ -34,12 +34,12 @@ namespace CalamityMod.Items.SummonItems public override bool CanUseItem(Player player) { - return player.ZoneJungle && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; + return player.ZoneJungle && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } public override bool? UseItem(Player player) { - CalamityUtils.SpawnBossUsingItem(player, SoundID.Roar); + CalamityUtils.SpawnBossUsingItem(player, SoundID.Roar); return true; } diff --git a/Items/TreasureBags/DragonfollyBag.cs b/Items/TreasureBags/DragonfollyBag.cs index bdbc785757..ac6f05ebad 100644 --- a/Items/TreasureBags/DragonfollyBag.cs +++ b/Items/TreasureBags/DragonfollyBag.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Items.TreasureBags public override void ModifyItemLoot(ItemLoot itemLoot) { // Money - itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials itemLoot.Add(ModContent.ItemType(), 1, 30, 35); diff --git a/Localization/en-US/Mods.CalamityMod.NPCs.hjson b/Localization/en-US/Mods.CalamityMod.NPCs.hjson index 88ed6fb8e1..125f690431 100644 --- a/Localization/en-US/Mods.CalamityMod.NPCs.hjson +++ b/Localization/en-US/Mods.CalamityMod.NPCs.hjson @@ -563,3 +563,7 @@ SeaKing: { Princess_LovesNPC: "{NPCName} always smiles when I'm nearby, I like being around him just for that!" } } + +WildBumblebirb.DisplayName: Wild Bumblebirb +DraconicSwarmer.DisplayName: Draconic Swarmer +Dragonfolly.DisplayName: Dragonfolly diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index e5aaf5bc23..65c8470dcf 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -741,7 +741,7 @@ namespace CalamityMod { string entryName = "Dragonfolly"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); - int type = NPCType(); + int type = NPCType(); List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; AddBoss(bossChecklist, calamity, entryName, order, DownedDragonfolly, type, new Dictionary() { diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index ceada7f56a..4e84d6c3b8 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -19,12 +19,13 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; -using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; -using CalamityMod.NPCs.TownNPCs; +using CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies; +using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; +using System; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -153,7 +154,934 @@ namespace CalamityMod.NPCs.AstrumAureus public override void AI() { - AstrumAureusAI.VanillaAstrumAureusAI(NPC, Mod); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + CalamityGlobalNPC.astrumAureus = NPC.whoAmI; + + // Variables + bool bossRush = BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool death = CalamityWorld.death || bossRush; + + // Percent life remaining + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + // Phases + bool phase2 = lifeRatio < (revenge ? 0.85f : expertMode ? 0.8f : 0.75f); + bool phase3 = lifeRatio < (revenge ? 0.7f : expertMode ? 0.6f : 0.5f); + bool phase4 = lifeRatio < (revenge ? 0.5f : 0.4f) && expertMode; + bool phase5 = lifeRatio < 0.3f && revenge; + + // Exhaustion + bool exhausted = NPC.ai[2] >= (phase3 ? 2f : 1f); + calamityGlobalNPC.DR = exhausted ? 0.2f : 0.4f; + NPC.defense = exhausted ? NPC.defDefense / 2 : NPC.defDefense; + + // Get a target + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); + + // Despawn safety, make sure to target another player if the current player target is too far away + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); + + Player player = Main.player[NPC.target]; + + // Don't fire projectiles and don't increment phase timers for 4 seconds after the teleport phase to avoid cheap bullshit + float noProjectileOrPhaseIncrementTime = 240f; + + bool dontAttack = NPC.localAI[3] > 0f; + if (dontAttack) + { + NPC.localAI[3] -= 1f; + if (NPC.Distance(player.Center) < 240f) + NPC.localAI[3] -= death ? 4f : expertMode ? 2f : 1f; + } + + float enrageScale = bossRush ? 1f : 0f; + if ((Main.IsItDay() && !player.Calamity().ZoneAstral) || bossRush) + { + NPC.Calamity().CurrentlyEnraged = !bossRush; + enrageScale += 1f; + } + + float astralFlameBarrageTimerIncrement = 1f; + if (expertMode) + astralFlameBarrageTimerIncrement += death ? (float)Math.Round(3f * (1f - lifeRatio)) : (float)Math.Round(2f * (1f - lifeRatio)); + + float walkingVelocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 6f : 5f; + walkingVelocity += 3f * enrageScale; + if (phase5) + walkingVelocity += 2f; + if (expertMode) + walkingVelocity += 1.5f * (1f - lifeRatio); + if (revenge) + walkingVelocity += Math.Abs(NPC.Center.X - player.Center.X) * 0.0025f; + if (Main.getGoodWorld) + walkingVelocity *= 1.15f; + + float walkingProjectileVelocity = walkingVelocity * 0.8f; + + // Direction + NPC.spriteDirection = (NPC.direction > 0) ? 1 : -1; + + // Used to reduce Aureus' fall speed + bool reduceFallSpeed = NPC.velocity.Y > 0f && Collision.SolidCollision(NPC.position + Vector2.UnitY * 1.1f * NPC.velocity.Y, NPC.width, NPC.height) && NPC.ai[0] == 4f; + + // Despawn + bool despawnDistance = Vector2.Distance(player.Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles; + if (!player.active || player.dead || despawnDistance) + { + NPC.TargetClosest(false); + player = Main.player[NPC.target]; + if (!player.active || player.dead || despawnDistance) + { + NPC.noTileCollide = true; + + if (NPC.velocity.Y < -3f) + NPC.velocity.Y = -3f; + NPC.velocity.Y += 0.1f; + if (NPC.velocity.Y > 12f) + NPC.velocity.Y = 12f; + + if (NPC.timeLeft > 60) + NPC.timeLeft = 60; + + if (NPC.ai[0] != 0f) + { + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.localAI[2] = 0f; + NPC.localAI[3] = 0f; + calamityGlobalNPC.newAI[0] = 0f; + calamityGlobalNPC.newAI[1] = 0f; + NPC.netUpdate = true; + } + return; + } + } + else if (NPC.timeLeft < 1800) + NPC.timeLeft = 1800; + + bool geldonPhase1 = lifeRatio > 0.6f && lifeRatio <= 0.7f; + bool geldonPhase2 = lifeRatio <= 0.1f; + if (Main.zenithWorld && (geldonPhase1 || geldonPhase2)) + { + slimeProjCounter++; + if (slimeProjCounter % 180 == 0) + { + SoundEngine.PlaySound(SoundID.Item33, NPC.Center); // Intentionally keeping the old laser sound in GFB + + if (slimePhase == 1) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + int totalProjectiles = bossRush ? 14 : death ? 12 : revenge ? 10 : expertMode ? 8 : 6; + float radians = MathHelper.TwoPi / totalProjectiles; + float velocity = 10f; + Vector2 spinningPoint = new Vector2(0f, -velocity); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 1f); + } + } + slimePhase = 0; + } + else + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + float aureusLaserSpeed = 7f; + float aureusLaserTargetX = player.Center.X - NPC.Center.X; + float aureusLaserTargetY = player.Center.Y - NPC.Center.Y; + float aureusLaserTargetDist = (float)Math.Sqrt(aureusLaserTargetX * aureusLaserTargetX + aureusLaserTargetY * aureusLaserTargetY); + aureusLaserTargetDist = aureusLaserSpeed / aureusLaserTargetDist; + aureusLaserTargetX *= aureusLaserTargetDist; + aureusLaserTargetY *= aureusLaserTargetDist; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y, aureusLaserTargetX, aureusLaserTargetY, type, damage, 0f, Main.myPlayer); + for (int i = 0; i < 4; i++) + { + Vector2 offset = new Vector2(Main.rand.Next(-6, 7), Main.rand.Next(-6, 7)); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y, aureusLaserTargetX + offset.X, aureusLaserTargetY + offset.Y, type, damage, 0f, Main.myPlayer); + } + } + slimePhase = 1; + } + } + RevengeanceAndDeathAI.BuffedMimicAI(NPC, Mod); + NPC.noGravity = false; + NPC.noTileCollide = false; + return; + } + else + { + NPC.noGravity = true; + } + + // Emit light when not Idle + if (NPC.ai[0] != 1f) + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 1.3f, 0.5f, 0f); + + // Fire projectiles while walking, teleporting, or falling + if (NPC.ai[0] == 2f || NPC.ai[0] >= 5f) + { + if (!dontAttack) + NPC.localAI[0] += NPC.ai[0] == 2f ? 1f : astralFlameBarrageTimerIncrement; + + float astralFlameBarrageGateValue = phase4 ? 30f : 60f; + if (NPC.localAI[0] >= astralFlameBarrageGateValue) + { + // Fire astral flames while teleporting + if (NPC.ai[0] >= 5f && NPC.ai[0] != 7) + { + NPC.localAI[0] = 0f; + SoundEngine.PlaySound(FlameCrystalSound, NPC.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float velocity = death ? (8f + NPC.localAI[2] * 0.025f) : 7f; + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + float spreadLimit = (phase4 ? 100f : 50f) + enrageScale * 50f; + float randomSpread = (Main.rand.NextFloat() - 0.5f) * spreadLimit; + Vector2 spawnVector = new Vector2(NPC.Center.X, NPC.Center.Y - 80f * NPC.scale); + Vector2 destination = new Vector2(spawnVector.X + randomSpread, spawnVector.Y - 100f * NPC.scale); + Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnVector, Vector2.Normalize(destination - spawnVector) * velocity, type, damage, 0f, Main.myPlayer); + } + } + } + + float laserBarrageGateValue = phase5 ? 160f : phase3 ? 120f : phase2 ? 80f : 60f; + if (NPC.localAI[0] >= laserBarrageGateValue) + { + // Fire astral lasers while walking + if (NPC.ai[0] == 2f) + { + NPC.localAI[0] = 0f; + + SoundEngine.PlaySound(LaserSound, NPC.Center); + + if (calamityGlobalNPC.newAI[2] == 0f) + { + calamityGlobalNPC.newAI[2] = 1f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int maxProjectiles = !phase2 ? (bossRush ? 5 : 3) : (bossRush ? 7 : 5); + int spread = !phase2 ? (bossRush ? 11 : 8) : (bossRush ? 12 : 10); + + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + Vector2 projectileVelocity = Vector2.Normalize(player.Center - NPC.Center) * walkingProjectileVelocity; + float rotation = MathHelper.ToRadians(spread); + for (int i = 0; i < maxProjectiles; i++) + { + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1))); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, walkingProjectileVelocity * 2f); + } + + if (phase3) + { + float flameVelocity = walkingProjectileVelocity; + maxProjectiles = 2; + spread = 45; + + type = ModContent.ProjectileType(); + damage = NPC.GetProjectileDamage(type); + projectileVelocity = Vector2.Normalize(player.Center - NPC.Center) * flameVelocity; + rotation = MathHelper.ToRadians(spread); + for (int i = 0; i < maxProjectiles; i++) + { + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1))); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer); + } + } + } + } + else + { + calamityGlobalNPC.newAI[2] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int maxProjectiles = !phase3 ? (bossRush ? 13 : death ? 11 : 9) : (bossRush ? 19 : death ? 17 : 15); + int spread = !phase3 ? (bossRush ? 20 : death ? 18 : 16) : (bossRush ? 24 : death ? 22 : 20); + + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + int centralLaser = maxProjectiles / 2; + int[] lasersToNotFire = new int[6] { centralLaser - 3, centralLaser - 2, centralLaser - 1, centralLaser + 1, centralLaser + 2, centralLaser + 3 }; + Vector2 projectileVelocity = Vector2.Normalize(player.Center - NPC.Center) * walkingProjectileVelocity; + float rotation = MathHelper.ToRadians(spread); + for (int i = 0; i < maxProjectiles; i++) + { + if (i != lasersToNotFire[0] && i != lasersToNotFire[1] && i != lasersToNotFire[2] && i != lasersToNotFire[3] && i != lasersToNotFire[4] && i != lasersToNotFire[5]) + { + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1))); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, walkingProjectileVelocity * 2f); + } + } + } + } + } + } + } + else + NPC.localAI[0] = 0f; + + // Start up + if (NPC.ai[0] == 0f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.ai[0] = 1f; + NPC.netUpdate = true; + CustomGravity(); + } + + // Idle + else if (NPC.ai[0] == 1f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + // Slow down + NPC.velocity.X *= 0.8f; + + // Stay vulnerable for 3 seconds + NPC.ai[1] += 1f; + if (NPC.Distance(player.Center) < 240f) + NPC.ai[1] += death ? 4f : expertMode ? 2f : 1f; + + if (NPC.ai[1] >= 180f || bossRush) + { + // Set AI to random state and reset other AI arrays + NPC.TargetClosest(); + switch (Main.rand.Next(phase3 ? 3 : 2)) + { + case 0: + NPC.ai[0] = 2f; + break; + + case 1: + NPC.ai[0] = 3f; + break; + + case 2: + NPC.ai[0] = 5f; + break; + + default: + break; + } + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + + // Stop colliding with tiles if entering walking phase + NPC.noTileCollide = NPC.ai[0] == 2f; + + NPC.netUpdate = true; + } + else + CustomGravity(); + } + + // Walk + else if (NPC.ai[0] == 2f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + // Set walking direction + if (Math.Abs(NPC.Center.X - player.Center.X) < 200f * NPC.scale) + { + NPC.velocity.X *= 0.8f; + if (NPC.velocity.X > -0.1 && NPC.velocity.X < 0.1) + NPC.velocity.X = 0f; + } + else + { + float playerLocation = NPC.Center.X - player.Center.X; + NPC.direction = playerLocation < 0 ? 1 : -1; + + if (NPC.direction > 0) + NPC.velocity.X = (NPC.velocity.X * 20f + walkingVelocity) / 21f; + if (NPC.direction < 0) + NPC.velocity.X = (NPC.velocity.X * 20f - walkingVelocity) / 21f; + } + + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height) && player.position.Y <= NPC.position.Y + NPC.height && !NPC.collideX) + { + CustomGravity(); + NPC.noTileCollide = false; + } + else + { + NPC.noTileCollide = true; + + // Walk through tiles if colliding with tiles and player is out of reach + int aureusHitboxWidth = 80; + int aureusHitboxHeight = 20; + Vector2 aureusHitboxTileCollideSize = new Vector2(NPC.Center.X - (aureusHitboxWidth / 2), NPC.position.Y + NPC.height - aureusHitboxHeight); + + bool nearPlayerWalkingThroughTiles = false; + if (NPC.position.X < player.position.X && NPC.position.X + NPC.width > player.position.X + player.width && NPC.position.Y + NPC.height < player.position.Y + player.height - 16f) + nearPlayerWalkingThroughTiles = true; + + if (nearPlayerWalkingThroughTiles) + { + NPC.velocity.Y += 0.5f; + } + else if (Collision.SolidCollision(aureusHitboxTileCollideSize, aureusHitboxWidth, aureusHitboxHeight)) + { + if (NPC.velocity.Y > 0f) + NPC.velocity.Y = 0f; + + if (NPC.velocity.Y > -0.2) + NPC.velocity.Y -= 0.025f; + else + NPC.velocity.Y -= 0.2f; + + if (NPC.velocity.Y < -4f) + NPC.velocity.Y = -4f; + } + else + { + if (NPC.velocity.Y < 0f) + NPC.velocity.Y = 0f; + + if (NPC.velocity.Y < 0.1) + NPC.velocity.Y += 0.025f; + else + NPC.velocity.Y += 0.5f; + } + } + + // Walk for a maximum of 6 seconds + if (!dontAttack) + { + NPC.ai[1] += 1f; + if (NPC.Distance(player.Center) < 240f) + NPC.ai[1] += death ? 4f : expertMode ? 2f : 1f; + } + + if (NPC.ai[1] >= ((bossRush ? 270f : 360f) - (death ? 90f * (1f - lifeRatio) : 0f))) + { + // Collide with tiles again + NPC.noTileCollide = false; + + // Set AI to next phase (Jump) and reset other AI + NPC.TargetClosest(); + NPC.ai[0] = exhausted ? 1f : 3f; + NPC.ai[1] = 0f; + NPC.ai[2] += 1f; + NPC.netUpdate = true; + } + + // Limit downward velocity + if (NPC.velocity.Y > 10f) + NPC.velocity.Y = 10f; + } + + // Jump + else if (NPC.ai[0] == 3f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.noTileCollide = false; + + if (NPC.velocity.Y == 0f) + { + // Slow down + NPC.velocity.X *= 0.8f; + + // Half second delay before jumping + if (!dontAttack) + NPC.ai[1] += 1f; + + if (NPC.ai[1] >= 30f) + { + NPC.ai[1] = -20f; + } + else if (NPC.ai[1] == -1f) + { + // Set damage + NPC.damage = NPC.defDamage; + + // Set jump velocity, reset and set AI to next phase (Stomp) + float distanceFromPlayerOnXAxis = NPC.Center.X - player.Center.X; + NPC.direction = distanceFromPlayerOnXAxis < 0 ? 1 : -1; + calamityGlobalNPC.newAI[3] = NPC.direction; + + // The limit for how much Aureus can multiply its jump velocity + float speedMultLimit = 1f; + + // Maxes out when the player is a full 2000 pixels away from or above Aureus + float multiplier = 1f / 2000f; + + // Increase Aureus jump velocity X if it's far enough away from the player + float distanceAwayFromTarget = Math.Abs(distanceFromPlayerOnXAxis); + float distanceGateValue = 400f; + bool increaseJumpVelocityX = distanceAwayFromTarget > distanceGateValue && expertMode; + if (increaseJumpVelocityX) + { + calamityGlobalNPC.newAI[0] = (distanceAwayFromTarget - distanceGateValue) * multiplier; + if (calamityGlobalNPC.newAI[0] > speedMultLimit) + calamityGlobalNPC.newAI[0] = speedMultLimit; + } + + // Increase Aureus jump velocity Y if it's far enough above the player + float distanceBelowTarget = NPC.position.Y - (player.position.Y + 80f); + bool increaseJumpVelocityY = distanceBelowTarget > 0f && revenge; + if (increaseJumpVelocityY) + { + calamityGlobalNPC.newAI[1] = distanceBelowTarget * multiplier; + if (calamityGlobalNPC.newAI[1] > speedMultLimit) + calamityGlobalNPC.newAI[1] = speedMultLimit; + } + + float velocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 27f : 20f; + velocity += 6f * enrageScale; + if (expertMode) + velocity += death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); + if (Main.getGoodWorld) + velocity *= 1.15f; + + NPC.velocity = (new Vector2(player.Center.X, player.Center.Y - 500f) - NPC.Center).SafeNormalize(Vector2.Zero) * velocity; + NPC.velocity *= new Vector2(calamityGlobalNPC.newAI[0] + 1f, calamityGlobalNPC.newAI[1] + 1f); + + NPC.noTileCollide = true; + + NPC.ai[0] = 4f; + NPC.ai[1] = 0f; + + SoundEngine.PlaySound(JumpSound, NPC.Center); + + NPC.netUpdate = true; + } + } + + // Don't run custom gravity when starting a jump + if (NPC.ai[0] != 4f) + CustomGravity(); + } + + // Stomp + else if (NPC.ai[0] == 4f) + { + if (NPC.velocity.Y == 0f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + // Play stomp sound. Gotta specify the filepath to avoid confusion between the namespace and NPC + SoundStyle soundToPlay = Main.zenithWorld ? ExoMechs.Ares.AresGaussNuke.NukeExplosionSound : StompSound; + SoundEngine.PlaySound(soundToPlay, NPC.Center); + + if (Main.zenithWorld) + { + float screenShakePower = 16 * Utils.GetLerpValue(1300f, 0f, NPC.Distance(Main.LocalPlayer.Center), true); + if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < screenShakePower) + Main.LocalPlayer.Calamity().GeneralScreenShakePower = screenShakePower; + } + + // Stomp and jump again, if stomped twice then reset and set AI to next phase (Teleport or Idle) + NPC.TargetClosest(); + NPC.localAI[1] += 1f; + float maxStompAmt = phase5 ? 5f : phase3 ? 2f : 3f; + if (NPC.localAI[1] >= maxStompAmt) + { + NPC.ai[0] = exhausted ? 1f : (phase3 ? 5f : 2f); + NPC.localAI[1] = 0f; + NPC.ai[2] += 1f; + NPC.ai[3] = 0f; + NPC.noTileCollide = false; + NPC.netUpdate = true; + } + else + { + float playerLocation = NPC.Center.X - player.Center.X; + NPC.direction = playerLocation < 0 ? 1 : -1; + NPC.ai[0] = 3f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; + } + + calamityGlobalNPC.newAI[0] = 0f; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + + // Spawn dust for visual effect + for (int i = (int)NPC.position.X - 20; i < (int)NPC.position.X + NPC.width + 40; i += 20) + { + for (int j = 0; j < 4; j++) + { + int stompDust = Dust.NewDust(new Vector2(NPC.position.X - 20f, NPC.position.Y + NPC.height), NPC.width + 20, 4, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); + Main.dust[stompDust].velocity *= 0.2f; + } + } + + // Fire lasers or flames on stomp + SoundEngine.PlaySound(LaserSound, NPC.Center); + + if (Main.zenithWorld) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + int totalProjectiles = bossRush ? 14 : death ? 12 : revenge ? 10 : expertMode ? 8 : 6; + float radians = MathHelper.TwoPi / totalProjectiles; + float velocity = 10f; + Vector2 spinningPoint = new Vector2(0f, -velocity); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 1f); + } + } + } + else if (calamityGlobalNPC.newAI[2] == 0f && phase2) + { + calamityGlobalNPC.newAI[2] = 1f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float flameVelocity = 6f; + int maxProjectiles = bossRush ? 4 : death ? 3 : 2; + int spread = bossRush ? 36 : death ? 28 : 20; + + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + Vector2 spawnVector = new Vector2(NPC.Center.X, NPC.Center.Y - 80f * NPC.scale); + Vector2 destination = new Vector2(spawnVector.X, spawnVector.Y + 100f * NPC.scale); + Vector2 projectileVelocity = Vector2.Normalize(destination - spawnVector) * flameVelocity; + float rotation = MathHelper.ToRadians(spread); + for (int i = 0; i < maxProjectiles; i++) + { + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1))); + Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnVector + Vector2.Normalize(perturbedSpeed) * 100f, perturbedSpeed, type, damage, 0f, Main.myPlayer); + } + } + } + else + { + calamityGlobalNPC.newAI[2] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float laserVelocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 7f : death ? 6f : 5f; + int maxProjectiles = !phase3 ? (bossRush ? 13 : death ? 11 : 9) : (bossRush ? 17 : death ? 15 : 13); + int spread = !phase3 ? (bossRush ? 20 : death ? 18 : 16) : (bossRush ? 24 : death ? 22 : 20); + + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + int[] lasersToNotFire = new int[4] { 1, 3, maxProjectiles - 2, maxProjectiles - 4 }; + Vector2 projectileVelocity = Vector2.Normalize(player.Center - NPC.Center) * laserVelocity; + float rotation = MathHelper.ToRadians(spread); + for (int i = 0; i < maxProjectiles; i++) + { + if (i != lasersToNotFire[0] && i != lasersToNotFire[1] && i != lasersToNotFire[2] && i != lasersToNotFire[3]) + { + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1))); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, laserVelocity * 2f); + } + } + } + } + } + else + { + // Set damage + NPC.damage = NPC.defDamage; + + // Set velocities while falling, this happens before the stomp + // Fall through + if (!player.dead) + { + if ((player.position.Y > NPC.Bottom.Y && NPC.velocity.Y > 0f) || (player.position.Y < NPC.Bottom.Y && NPC.velocity.Y < 0f)) + NPC.noTileCollide = true; + else if ((NPC.velocity.Y > 0f && NPC.Bottom.Y > Main.player[NPC.target].Top.Y) || (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height))) + NPC.noTileCollide = false; + } + + if (NPC.position.X < player.position.X && NPC.position.X + NPC.width > player.position.X + player.width) + { + // Make sure Aureus falls quickly when directly on top of or below the player + if (NPC.ai[3] < 30f) + NPC.ai[3] = 30f; + + NPC.velocity.X *= 0.8f; + + if (NPC.Bottom.Y < player.position.Y) + { + // Make sure Aureus falls rather quickly + if (NPC.velocity.Y < -3f) + NPC.velocity.Y = -3f; + + float fallSpeed = 1.2f; + fallSpeed += 0.36f * enrageScale; + if (expertMode) + fallSpeed += death ? 0.36f * (1f - lifeRatio) : 0.24f * (1f - lifeRatio); + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + fallSpeed += 0.5f; + + if (calamityGlobalNPC.newAI[1] > 0f) + fallSpeed *= calamityGlobalNPC.newAI[1] + 1f; + + NPC.velocity.Y += fallSpeed; + } + } + else + { + // Push Aureus towards the player on the X axis if he's not directly on top of or below the player + float velocityXChange = 0.2f + Math.Abs(NPC.Center.X - player.Center.X) * 0.0001f; + velocityXChange += 0.1f * enrageScale; + + if (calamityGlobalNPC.newAI[0] > 0f) + velocityXChange *= calamityGlobalNPC.newAI[0] + 1f; + + if (NPC.direction < 0) + NPC.velocity.X -= velocityXChange; + else if (NPC.direction > 0) + NPC.velocity.X += velocityXChange; + + float velocityXCap = 12f; + velocityXCap += 3.6f * enrageScale; + if (expertMode) + velocityXCap += death ? 3.6f * (1f - lifeRatio) : 2.4f * (1f - lifeRatio); + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + velocityXCap += 5f; + + if (calamityGlobalNPC.newAI[0] > 0f) + velocityXCap *= calamityGlobalNPC.newAI[0] + 1f; + + float playerLocation = NPC.Center.X - player.Center.X; + int directionRelativeToTarget = playerLocation < 0 ? 1 : -1; + bool slowDown = directionRelativeToTarget != calamityGlobalNPC.newAI[3]; + + if (slowDown) + velocityXCap *= 0.333f; + + if (NPC.velocity.X < -velocityXCap) + NPC.velocity.X = -velocityXCap; + if (NPC.velocity.X > velocityXCap) + NPC.velocity.X = velocityXCap; + } + + // Don't start falling quickly until half a second has passed + NPC.ai[3] += 1f; + if (NPC.ai[3] > 30f) + CustomGravity(); + } + } + + // Teleport + else if (NPC.ai[0] == 5f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + // Slow down + NPC.velocity.X *= 0.8f; + + // Start teleport + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.localAI[1] += 1f; + if (death) + NPC.localAI[2] += 1.25f; + + if (phase4) + { + NPC.localAI[1] += 1f; + if (death) + NPC.localAI[2] += 1.25f; + } + + if (NPC.localAI[1] >= (bossRush ? 60f : death ? 180f : 240f)) + { + // Reset localAI and find a teleport destination + NPC.TargetClosest(); + NPC.localAI[1] = 0f; + + Vector2 vectorAimedAheadOfTarget = Main.player[NPC.target].Center + new Vector2((float)Math.Round(Main.player[NPC.target].velocity.X), 0f).SafeNormalize(Vector2.Zero) * 1000f; + Point point4 = vectorAimedAheadOfTarget.ToTileCoordinates(); + int teleportTries = 0; + while (teleportTries < 100) + { + teleportTries++; + int teleportTileX = Main.rand.Next(point4.X - 5, point4.X + 6); + int teleportTileY = Main.rand.Next(point4.Y - 5, point4.Y); + + if (!Main.tile[teleportTileX, teleportTileY].HasUnactuatedTile) + { + NPC.ai[1] = teleportTileX * 16 + 8; + NPC.ai[3] = teleportTileY * 16 + 16; + break; + } + } + + // Default teleport if the above conditions aren't met in 100 iterations + if (teleportTries >= 100) + { + Vector2 bottom = Main.player[Player.FindClosest(NPC.position, NPC.width, NPC.height)].Bottom; + NPC.ai[1] = bottom.X; + NPC.ai[3] = bottom.Y; + } + + // Set AI to next phase (Mid-teleport) + NPC.ai[0] = 6f; + NPC.netUpdate = true; + } + } + + CustomGravity(); + } + + // Mid-teleport + else if (NPC.ai[0] == 6f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + if (death) + NPC.localAI[2] += 1.25f; + + if (phase4) + { + if (death) + NPC.localAI[2] += 1.25f; + } + + // Turn invisible + NPC.alpha += 10; + if (NPC.alpha >= 255) + { + // Set position to teleport destination + NPC.Bottom = new Vector2(NPC.ai[1], NPC.ai[3]); + + // Reset alpha and set AI to next phase (End of teleport) + NPC.alpha = 255; + NPC.ai[0] = 7f; + NPC.localAI[2] = 0f; + NPC.netUpdate = true; + } + + // Play sound for cool effect + if (NPC.soundDelay == 0) + { + NPC.soundDelay = 15; + SoundEngine.PlaySound(TeleportSound, NPC.Center); + } + + // Emit dust to make the teleport pretty + for (int i = 0; i < 10; i++) + { + int teleportDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), NPC.velocity.X, NPC.velocity.Y, 255, default, 2f); + Main.dust[teleportDust].noGravity = true; + Main.dust[teleportDust].velocity *= 0.5f; + } + + CustomGravity(); + } + + // End of teleport + else if (NPC.ai[0] == 7f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + // Turn visible + NPC.alpha -= 10; + if (NPC.alpha <= 0) + { + // Spawn Aureus Spawns + bool spawnFlag = expertMode; + if (NPC.CountNPCS(ModContent.NPCType()) >= 2) + spawnFlag = false; + + if (spawnFlag && Main.netMode != NetmodeID.MultiplayerClient) + { + int aureusSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)(NPC.Center.Y - 25f * NPC.scale), ModContent.NPCType()); + Main.npc[aureusSpawn].velocity.Y = -10f; + Main.npc[aureusSpawn].netUpdate = true; + if (revenge) + { + aureusSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)(NPC.Center.Y - 25f * NPC.scale), ModContent.NPCType()); + Main.npc[aureusSpawn].velocity.Y = -15f; + Main.npc[aureusSpawn].netUpdate = true; + } + + if (death) + { + int damageAmt = NPC.lifeMax / 50; + NPC.life -= damageAmt; + if (NPC.life < 1) + NPC.life = 1; + + NPC.DamageEffect(damageAmt); + } + } + + // Reset alpha and set AI to next phase (Idle) + NPC.alpha = 0; + NPC.ai[0] = exhausted ? 1f : 2f; + NPC.ai[1] = 0f; + NPC.ai[2] += 1f; + NPC.localAI[3] = noProjectileOrPhaseIncrementTime; + + // Stop colliding with tiles if entering walking phase + NPC.noTileCollide = NPC.ai[0] == 2f; + + NPC.netUpdate = true; + } + + // Play sound at teleport destination for cool effect + if (NPC.soundDelay == 0) + { + NPC.soundDelay = 15; + SoundEngine.PlaySound(SoundID.Item109, NPC.Center); + } + + // Emit dust to make the teleport pretty + for (int i = 0; i < 10; i++) + { + int teleportDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), NPC.velocity.X, NPC.velocity.Y, 255, default, 2f); + Main.dust[teleportDust].noGravity = true; + Main.dust[teleportDust].velocity *= 0.5f; + } + + CustomGravity(); + } + + void CustomGravity() + { + float gravity = 0.36f + 0.12f * enrageScale; + float maxFallSpeed = reduceFallSpeed ? 12f : 12f + 4f * enrageScale; + + if (calamityGlobalNPC.newAI[1] > 0f && !reduceFallSpeed) + maxFallSpeed *= calamityGlobalNPC.newAI[1] + 1f; + + if (Main.getGoodWorld && !reduceFallSpeed) + { + gravity *= 1.15f; + maxFallSpeed *= 1.15f; + } + + NPC.velocity.Y += gravity; + if (NPC.velocity.Y > maxFallSpeed) + NPC.velocity.Y = maxFallSpeed; + } } public override void FindFrame(int frameHeight) diff --git a/NPCs/BrimstoneElemental/BrimstoneElemental.cs b/NPCs/BrimstoneElemental/BrimstoneElemental.cs index 7a5a563e17..7bec19de5f 100644 --- a/NPCs/BrimstoneElemental/BrimstoneElemental.cs +++ b/NPCs/BrimstoneElemental/BrimstoneElemental.cs @@ -16,9 +16,12 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; +using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.Enemy; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -123,7 +126,710 @@ namespace CalamityMod.NPCs.BrimstoneElemental public override void AI() { - BrimstoneElementalAI.VanillaBrimstoneElementalAI(NPC, Mod); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + + // Used for Brimling AI states + CalamityGlobalNPC.brimstoneElemental = NPC.whoAmI; + + // Emit light + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 1.2f, 0f, 0f); + + // Get a target + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); + + Player player = Main.player[NPC.target]; + + bool despawnDistance = Vector2.Distance(player.Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles; + + if (!player.active || player.dead || despawnDistance) + { + NPC.TargetClosest(false); + player = Main.player[NPC.target]; + if (!player.active || player.dead || despawnDistance) + { + NPC.rotation = NPC.velocity.X * 0.04f; + + if (NPC.velocity.Y > 3f) + NPC.velocity.Y = 3f; + NPC.velocity.Y -= 0.1f; + if (NPC.velocity.Y < -12f) + NPC.velocity.Y = -12f; + + if (NPC.timeLeft > 60) + NPC.timeLeft = 60; + + if (NPC.ai[0] != 0f) + { + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.localAI[0] = 0f; + NPC.localAI[1] = 0f; + NPC.netUpdate = true; + } + return; + } + } + else if (NPC.timeLeft < 1800) + NPC.timeLeft = 1800; + + // Reset defense + NPC.defense = NPC.defDefense; + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = NPC.ai[0] == 4f; + + // Percent life remaining + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + // Variables for buffing the AI + bool bossRush = BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool death = CalamityWorld.death || bossRush; + + bool phase2 = lifeRatio < 0.5f && revenge; + bool phase3 = lifeRatio < 0.33f; + + // Enrage + if ((!player.ZoneUnderworldHeight || !player.Calamity().ZoneCalamity) && !bossRush) + { + if (calamityGlobalNPC.newAI[3] > 0f) + calamityGlobalNPC.newAI[3] -= 1f; + } + else + calamityGlobalNPC.newAI[3] = CalamityGlobalNPC.biomeEnrageTimerMax; + + bool biomeEnraged = calamityGlobalNPC.newAI[3] <= 0f || bossRush; + + float enrageScale = bossRush ? 0.5f : 0f; + if (biomeEnraged && (!player.ZoneUnderworldHeight || bossRush)) + { + NPC.Calamity().CurrentlyEnraged = !bossRush; + enrageScale += 0.5f; + } + if (biomeEnraged && (!player.Calamity().ZoneCalamity || bossRush)) + { + NPC.Calamity().CurrentlyEnraged = !bossRush; + enrageScale += 1f; + } + + NPC.Calamity().DR = NPC.ai[0] == 4f ? 0.6f : 0.2f; + + // Emit dust + int dustAmt = (NPC.ai[0] == 2f) ? 2 : 1; + int size = (NPC.ai[0] == 2f) ? 50 : 35; + if (NPC.ai[0] != 1f) + { + for (int i = 0; i < 2; i++) + { + if (Main.rand.Next(3) < dustAmt) + { + int dust = Dust.NewDust(NPC.Center - new Vector2(size), size * 2, size * 2, DustID.LifeDrain, NPC.velocity.X * 0.5f, NPC.velocity.Y * 0.5f, 90, default, 1.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.2f; + Main.dust[dust].fadeIn = 1f; + } + } + } + + // Distance from destination where Brimmy stops moving + float movementDistanceGateValue = 100f; + + // How fast Brimmy moves to the destination + float baseVelocity = (death ? 6f : revenge ? 5.5f : expertMode ? 5f : 4.5f) * (NPC.ai[0] == 5f ? 0.05f : NPC.ai[0] == 3f ? 1.5f : 1f); + baseVelocity += 3f * enrageScale; + if (expertMode) + baseVelocity += death ? 3f * (1f - lifeRatio) : 2f * (1f - lifeRatio); + + float baseAcceleration = (death ? 0.12f : 0.1f) * (NPC.ai[0] == 5f ? 0.5f : NPC.ai[0] == 3f ? 1.5f : 1f); + baseAcceleration += 0.06f * enrageScale; + if (expertMode) + baseAcceleration += 0.03f * (1f - lifeRatio); + + // This is where Brimmy should be + Vector2 destination = NPC.ai[0] != 3f ? player.Center : new Vector2(player.Center.X, player.Center.Y - 300f); + + // How far Brimmy is from where she's supposed to be + Vector2 distanceFromDestination = destination - NPC.Center; + + // Movement + if (NPC.ai[0] != 4f) + CalamityUtils.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity, baseAcceleration, true); + + // Rotation and direction + if (NPC.ai[0] <= 2f || NPC.ai[0] == 5f) + { + NPC.rotation = NPC.velocity.X * 0.04f; + if (NPC.ai[0] != 5 || (NPC.ai[1] < 180f && NPC.ai[0] == 5f)) + { + float playerLocation = NPC.Center.X - player.Center.X; + NPC.direction = playerLocation < 0f ? 1 : -1; + NPC.spriteDirection = NPC.direction; + } + } + + if (Main.zenithWorld) // in gfb, Brimmy channels the power of the other elementals. + { + int newMode; + if (lifeRatio <= 0.8f && lifeRatio > 0.6f) + { + newMode = 1; // Sand + } + else if (lifeRatio <= 0.6f && lifeRatio > 0.4f) + { + newMode = 2; // Rare Sand + } + else if (lifeRatio <= 0.4f && lifeRatio > 0.2f) + { + newMode = 3; // Cloud + } + else if (lifeRatio <= 0.2f) + { + newMode = 4; // Water + } + else + { + newMode = 0; // Brimstone, default + } + if (newMode != currentMode) + { + SoundEngine.PlaySound(SoundID.Item29, NPC.Center); + } + currentMode = newMode; + } + + if (NPC.ai[0] == -1f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int phase; + int random = phase2 ? 6 : 5; + do phase = Main.rand.Next(random); + while (phase == NPC.ai[1] || (phase == 0 && phase3 && revenge) || phase == 1 || phase == 2 || (phase == 4 && NPC.localAI[3] != 0f)); + + NPC.ai[0] = phase; + NPC.ai[1] = 0f; + + // Cocoon phase cooldown + if (NPC.localAI[3] > 0f) + NPC.localAI[3] -= 1f; + else if (phase == 4) + { + NPC.localAI[3] = 3f; + SoundEngine.PlaySound(HideInShellSound, player.Center); + } + + // Prevent netUpdate from being blocked by the spam counter. + // A phase switch sync is a critical operation that must be synced. + NPC.ForceNetUpdate(false); + } + } + + // Pick a location to teleport to + else if (NPC.ai[0] == 0f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.chaseable = true; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.localAI[1] += 1f; + if (NPC.Distance(player.Center) < 160f) + NPC.localAI[1] += death ? 4f : expertMode ? 2f : 1f; + + if (NPC.localAI[1] >= (bossRush ? 90f : death ? 120f : 180f)) + { + NPC.TargetClosest(); + NPC.localAI[1] = 0f; + int timer = 0; + int playerPosX; + int playerPosY; + while (true) + { + timer++; + playerPosX = (int)player.Center.X / 16; + playerPosY = (int)player.Center.Y / 16; + + int min = 12; + int max = 16; + + if (Main.rand.NextBool()) + playerPosX += Main.rand.Next(min, max); + else + playerPosX -= Main.rand.Next(min, max); + + if (Main.rand.NextBool()) + playerPosY += Main.rand.Next(min, max); + else + playerPosY -= Main.rand.Next(min, max); + + if (!WorldGen.SolidTile(playerPosX, playerPosY)) + break; + + if (timer > 100) + return; + } + NPC.ai[0] = 1f; + NPC.ai[1] = playerPosX; + NPC.ai[2] = playerPosY; + NPC.netUpdate = true; + } + } + } + + // Teleport to location + else if (NPC.ai[0] == 1f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.chaseable = true; + Vector2 position = new Vector2(NPC.ai[1] * 16f - (NPC.width / 2), NPC.ai[2] * 16f - (NPC.height / 2)); + for (int m = 0; m < 5; m++) + { + int dust = Dust.NewDust(position, NPC.width, NPC.height, DustID.LifeDrain, 0f, -1f, 90, default, 2f); + Main.dust[dust].noGravity = true; + Main.dust[dust].fadeIn = 1f; + } + NPC.alpha += bossRush ? 8 : death ? 5 : revenge ? 4 : expertMode ? 3 : 2; + if (NPC.alpha >= 255) + { + int spawnType = currentMode == 3 ? NPCID.AngryNimbus : ModContent.NPCType(); + int enemyCount = currentMode == 3 ? 3 : 1; // 3 angry nimbi if cloud, otherwise 1 brimling + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(spawnType) < (death ? 1 : 2) && revenge && currentMode != 2) // dont spawn anything if gfb rare sand + { + for (int i = 0; i < enemyCount; i++) + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, spawnType); + } + SoundEngine.PlaySound(TeleportSound, NPC.Center); + NPC.alpha = 255; + NPC.position = position; + for (int n = 0; n < 15; n++) + { + int warpDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.LifeDrain, 0f, -1f, 90, default, 3f); + Main.dust[warpDust].noGravity = true; + } + NPC.ai[0] = 2f; + NPC.netUpdate = true; + } + } + + // Either teleport again or go to next AI state + else if (NPC.ai[0] == 2f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + if (NPC.alpha >= 255) + { + if (Main.zenithWorld) + { + SoundEngine.PlaySound(SoundID.Item68, NPC.Center); + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + Vector2 pos = NPC.Center; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), pos, new Vector2(0, 1), type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), pos, new Vector2(0, -1), type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), pos, new Vector2(1, 0), type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), pos, new Vector2(-1, 0), type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + } + if (currentMode >= 1 && currentMode <= 3) + { + int tornadoType = currentMode == 3 ? ModContent.ProjectileType() : ProjectileID.SandnadoHostileMark; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), pos, Vector2.Zero, tornadoType, damage, 0f, Main.myPlayer, 0f, 0f); + } + } + if (currentMode == 2) + { + int healAmt = NPC.lifeMax / 25; + if (healAmt > 0) + { + NPC.life += healAmt; + NPC.HealEffect(healAmt, true); + NPC.netUpdate = true; + } + } + } + } + + NPC.alpha -= 50; + if (NPC.alpha <= 0) + { + NPC.chaseable = true; + NPC.ai[3] += 1f; + NPC.alpha = 0; + if (NPC.ai[3] >= 2f || phase2 || Main.getGoodWorld) + { + NPC.ai[0] = -1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + } + else + { + NPC.ai[0] = 0f; + } + NPC.netUpdate = true; + } + } + + // Float above target and fire projectiles + else if (NPC.ai[0] == 3f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.chaseable = true; + NPC.rotation = NPC.velocity.X * 0.04f; + + float playerLocation = NPC.Center.X - player.Center.X; + NPC.direction = playerLocation < 0f ? 1 : -1; + NPC.spriteDirection = NPC.direction; + + NPC.ai[1] += 1f; + float divisor = expertMode ? (death ? 80f : revenge ? 45f : 50f) - (float)Math.Ceiling(10f * (1f - lifeRatio)) : 50f; + divisor -= 3f * enrageScale; + float divisor2 = divisor * 2f; + + if (NPC.ai[1] % divisor == divisor - 1f) + { + float velocity = (death ? 7f : revenge ? 6f : 5f) + (2f * enrageScale) + (expertMode ? 3f * (1f - lifeRatio) : 0f); + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + if (currentMode == 4) + { + type = ModContent.ProjectileType(); + SoundEngine.PlaySound(SoundID.Item30, player.Center); + } + else + { + SoundEngine.PlaySound(HellfireballSound, player.Center); + } + Vector2 projectileVelocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * velocity; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 5f, projectileVelocity, type, damage, 0f, Main.myPlayer, player.position.X, player.position.Y); + Main.projectile[proj].timeLeft = 240; + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + Main.projectile[proj].extraUpdates += 1; + } + + if (NPC.ai[1] % divisor2 == divisor2 - 1f) + { + velocity = (death ? 5f : 4f) + 2f * enrageScale; + type = ModContent.ProjectileType(); + damage = NPC.GetProjectileDamage(type); + if (currentMode == 4) + { + type = ModContent.ProjectileType(); + SoundEngine.PlaySound(SoundID.Item21, player.Center); + } + else + { + SoundEngine.PlaySound(DartSound, player.Center); + } + projectileVelocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * velocity; + int numProj = death ? 8 : 4; + int spread = death ? 90 : 45; + if (Main.getGoodWorld) + { + numProj *= 3; + spread *= 2; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float rotation = MathHelper.ToRadians(spread); + float projectileVelocityToPass = velocity * 3f; + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + int proj2 = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 5f, perturbedSpeed, type, damage, 0f, Main.myPlayer, 1f, 0f, projectileVelocityToPass); + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + Main.projectile[proj2].extraUpdates += 1; + } + } + } + } + + if (NPC.ai[1] >= divisor * (death ? 5f : 10f)) + { + NPC.TargetClosest(); + NPC.ai[0] = -1f; + NPC.ai[1] = 3f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; + } + } + + // Cocoon bullet hell + else if (NPC.ai[0] == 4f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.defense = NPC.defDefense * 4; + + NPC.chaseable = false; + NPC.localAI[0] += 1f; + if (Main.getGoodWorld) + NPC.localAI[0] += 2f; + if (expertMode) + NPC.localAI[0] += 1f - lifeRatio; + NPC.localAI[0] += enrageScale; + + if (NPC.localAI[0] >= 120f) + { + NPC.localAI[0] = 0f; + + float projectileSpeed = death ? 9f : revenge ? 8f : 6f; + projectileSpeed += 2f * enrageScale; + + Vector2 projectileVelocity = player.Center - NPC.Center; + + float radialOffset = 0.2f; + float diameter = 80f; + + projectileVelocity = projectileVelocity.SafeNormalize(Vector2.UnitY) * projectileSpeed; + + Vector2 velocity = projectileVelocity; + velocity = velocity.SafeNormalize(Vector2.UnitY); + velocity *= diameter; + + int totalProjectiles = 6; + float offsetAngle = MathHelper.Pi * radialOffset; + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int j = 0; j < totalProjectiles; j++) + { + float radians = j - (totalProjectiles - 1f) / 2f; + Vector2 offset = velocity.RotatedBy(offsetAngle * radians); + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, projectileVelocity, type, damage, 0f, Main.myPlayer, 1f, 0f); + Main.projectile[proj].timeLeft = 300; + Main.projectile[proj].tileCollide = false; + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + Main.projectile[proj].extraUpdates += 1; + } + } + + totalProjectiles = 12; + float radians2 = MathHelper.TwoPi / totalProjectiles; + type = ModContent.ProjectileType(); + damage = NPC.GetProjectileDamage(type); + if (currentMode == 4) + { + type = ModContent.ProjectileType(); + SoundEngine.PlaySound(SoundID.Item26, player.Center); + } + else + { + SoundEngine.PlaySound(ShellFireSound, player.Center); + } + double angleA = radians2 * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX = (float)(projectileSpeed * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = NPC.localAI[2] % 2f == 0f ? new Vector2(0f, -projectileSpeed) : new Vector2(-velocityX, -projectileSpeed); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float projectileVelocityToPass = projectileSpeed * 3f; + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 vector255 = spinningPoint.RotatedBy(radians2 * k); + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + vector255.SafeNormalize(Vector2.UnitY) * 5f, vector255, type, damage, 0f, Main.myPlayer, 1f, 0f, projectileVelocityToPass); + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + Main.projectile[proj].extraUpdates += 1; + } + + if (death) + { + spinningPoint = NPC.localAI[2] % 2f == 0f ? new Vector2(-velocityX, -projectileSpeed) : new Vector2(0f, -projectileSpeed); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 vector255 = spinningPoint.RotatedBy(radians2 * k); + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + vector255.SafeNormalize(Vector2.UnitY) * 5f, vector255 * 0.75f, type, damage, 0f, Main.myPlayer, 1f, 0f, projectileVelocityToPass); + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + Main.projectile[proj].extraUpdates += 1; + } + } + } + + NPC.localAI[2] += 1f; + } + + NPC.velocity *= 0.95f; + NPC.rotation = NPC.velocity.X * 0.04f; + float playerLocation = NPC.Center.X - player.Center.X; + NPC.direction = playerLocation < 0f ? 1 : -1; + NPC.spriteDirection = NPC.direction; + + NPC.ai[1] += 1f; + if (NPC.ai[1] >= (death ? 240f : 300f)) + { + NPC.TargetClosest(); + NPC.ai[0] = -1f; + NPC.ai[1] = 4f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.localAI[0] = 0f; + NPC.netUpdate = true; + } + } + + // Laser beam attack + else if (NPC.ai[0] == 5f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.chaseable = true; + + NPC.defense = NPC.defDefense * 2; + + Vector2 source = new Vector2(NPC.Center.X + (NPC.spriteDirection > 0 ? 34f : -34f), NPC.Center.Y - 74f); + Vector2 aimAt = player.Center + player.velocity * 20f; + float aimResponsiveness = bossRush ? 0.05f : (NPC.ai[2] == 1f || death) ? 0.1f : 0.25f; + + Vector2 aimVector = (aimAt - source).SafeNormalize(Vector2.UnitY); + if (aimVector.HasNaNs()) + aimVector = -Vector2.UnitY; + aimVector = Vector2.Lerp(aimVector, NPC.velocity.SafeNormalize(Vector2.UnitY), aimResponsiveness).SafeNormalize(Vector2.UnitY); + aimVector *= 6f; + + Vector2 laserVelocity = aimVector.SafeNormalize(Vector2.UnitY); + if (laserVelocity.HasNaNs()) + laserVelocity = -Vector2.UnitY; + + calamityGlobalNPC.newAI[1] = laserVelocity.X; + calamityGlobalNPC.newAI[2] = laserVelocity.Y; + + // Rev = 190 + 165 = 355 + // Death = 165 + + NPC.ai[1] += 1f; + if (NPC.ai[1] >= 240f) + { + NPC.TargetClosest(); + NPC.ai[2] += 1f; + NPC.localAI[0] = 0f; + NPC.localAI[1] = 0f; + if (NPC.ai[2] >= (death ? 1f : 2f)) + { + NPC.ai[0] = -1f; + NPC.ai[1] = 5f; + NPC.ai[2] = 0f; + calamityGlobalNPC.newAI[0] = 0f; + } + else + { + NPC.ai[1] = 0f; + calamityGlobalNPC.newAI[0] = 0f; + } + } + else if (NPC.ai[1] >= 180f) + { + NPC.velocity *= 0.95f; + if (NPC.ai[1] == 180f) + { + SoundEngine.PlaySound(SoundID.Item68, source); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 laserVelocity2 = new Vector2(NPC.localAI[0], NPC.localAI[1]); + laserVelocity2 = laserVelocity2.SafeNormalize(Vector2.UnitY); + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + + Projectile.NewProjectile(NPC.GetSource_FromAI(), source, laserVelocity2, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + if (Main.getGoodWorld) + Projectile.NewProjectile(NPC.GetSource_FromAI(), source, -laserVelocity2, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + + if (Main.zenithWorld) + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), source, new Vector2(-laserVelocity2.X, laserVelocity2.Y), type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), source, new Vector2(laserVelocity2.X, -laserVelocity2.Y), type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + } + } + } + } + else + { + float playSoundTimer = 30f; + if (NPC.ai[1] < 150f) + { + switch ((int)NPC.ai[2]) + { + case 0: + NPC.ai[1] += 0.5f; + break; + case 1: + NPC.ai[1] += 1f; + playSoundTimer = 40f; + break; + } + if (death) + { + NPC.ai[1] += 0.5f; + playSoundTimer += 10f; + } + } + + if (NPC.ai[1] % playSoundTimer == 0f) + SoundEngine.PlaySound(SoundID.Item20, NPC.Center); + + if (NPC.ai[1] < 150f && calamityGlobalNPC.newAI[0] == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), source, laserVelocity, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, NPC.whoAmI); + if (Main.getGoodWorld) + Projectile.NewProjectile(NPC.GetSource_FromAI(), source, -laserVelocity, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, NPC.whoAmI); + + if (Main.zenithWorld) + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), source, new Vector2(-laserVelocity.X, laserVelocity.Y), ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), source, new Vector2(laserVelocity.X, -laserVelocity.Y), ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, NPC.whoAmI); + } + } + + calamityGlobalNPC.newAI[0] = 1f; + } + else + { + if (NPC.ai[1] == 150f) + { + NPC.localAI[0] = laserVelocity.X; + NPC.localAI[1] = laserVelocity.Y; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), source.X, source.Y, NPC.localAI[0], NPC.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, NPC.whoAmI); + if (Main.getGoodWorld) + Projectile.NewProjectile(NPC.GetSource_FromAI(), source.X, source.Y, -NPC.localAI[0], -NPC.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, NPC.whoAmI); + + if (Main.zenithWorld) + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), source.X, source.Y, -NPC.localAI[0], NPC.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), source.X, source.Y, NPC.localAI[0], -NPC.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, NPC.whoAmI); + } + } + } + } + } + } } public override bool CanHitPlayer(Player target, ref int cooldownSlot) diff --git a/NPCs/Bumblebirb/Bumblefuck.cs b/NPCs/Bumblebirb/Bumblefuck.cs deleted file mode 100644 index a5b097b190..0000000000 --- a/NPCs/Bumblebirb/Bumblefuck.cs +++ /dev/null @@ -1,539 +0,0 @@ -using System; -using System.IO; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Events; -using CalamityMod.Items.Accessories; -using CalamityMod.Items.Armor.Vanity; -using CalamityMod.Items.LoreItems; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Mounts; -using CalamityMod.Items.Placeables.Furniture.BossRelics; -using CalamityMod.Items.Placeables.Furniture.DevPaintings; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using CalamityMod.Items.Potions; -using CalamityMod.Items.TreasureBags; -using CalamityMod.Items.Weapons.Magic; -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; -using CalamityMod.Projectiles.Boss; -using CalamityMod.Sounds; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.GameContent.Bestiary; -using Terraria.GameContent.ItemDropRules; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.Bumblebirb -{ - [AutoloadBossHead] - public class Bumblefuck : ModNPC - { - public static Asset GlowTexture; - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 6; - NPCID.Sets.TrailingMode[Type] = 1; - NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() - { - Scale = 0.5f, - PortraitScale = 0.85f, - PortraitPositionYOverride = 14f - }; - value.Position.X += 20f; - value.Position.Y += 8f; - NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - NPCID.Sets.MPAllowedEnemies[Type] = true; - if (!Main.dedServ) - { - GlowTexture = ModContent.Request("CalamityMod/NPCs/Bumblebirb/BirbGlow", AssetRequestMode.AsyncLoad); - } - } - - public override string Texture => "CalamityMod/NPCs/Bumblebirb/Birb"; - public override string BossHeadTexture => "CalamityMod/NPCs/Bumblebirb/Birb_Head_Boss"; - - public override void SetDefaults() - { - NPC.Calamity().canBreakPlayerDefense = true; - NPC.npcSlots = 32f; - NPC.aiStyle = -1; - AIType = -1; - NPC.GetNPCDamage(); - NPC.width = 130; - NPC.height = 100; - NPC.defense = 40; - NPC.DR_NERD(0.1f); - NPC.LifeMaxNERB(187500, 225000, 300000); // Old HP - 227500, 252500 - NPC.knockBackResist = 0f; - NPC.boss = true; - NPC.noTileCollide = true; - NPC.lavaImmune = true; - NPC.noGravity = true; - NPC.value = Item.buyPrice(1, 0, 0, 0); - NPC.HitSound = SoundID.NPCHit51; - NPC.DeathSound = SoundID.NPCDeath46; - NPC.Calamity().VulnerableToHeat = true; - NPC.Calamity().VulnerableToCold = true; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = false; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Jungle, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Bumblefuck") - }); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(NPC.localAI[0]); - writer.Write(NPC.localAI[1]); - writer.Write(NPC.localAI[2]); - writer.Write(NPC.localAI[3]); - for (int i = 0; i < 4; i++) - writer.Write(NPC.Calamity().newAI[i]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - NPC.localAI[0] = reader.ReadSingle(); - NPC.localAI[1] = reader.ReadSingle(); - NPC.localAI[2] = reader.ReadSingle(); - NPC.localAI[3] = reader.ReadSingle(); - for (int i = 0; i < 4; i++) - NPC.Calamity().newAI[i] = reader.ReadSingle(); - } - - public override void AI() - { - BumblebirbAI.VanillaBumblebirbAI(NPC, Mod); - } - - public override void FindFrame(int frameHeight) - { - CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); - - bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || BossRushEvent.BossRushActive; - - // Percent life remaining - float lifeRatio = 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); - bool birbSpawn = NPC.ai[0] == 4f && NPC.ai[1] > 0f; - - // Animation goes nyoom - if (Main.zenithWorld) - { - NPC.frameCounter += 4; - } - - 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 || birbSpawn) - { - float frameGateValue = birbSpawn ? NPC.ai[1] : phase3 ? calamityGlobalNPC.newAI[1] : calamityGlobalNPC.newAI[0]; - int frameTimer = 180; - if (frameGateValue < (frameTimer - 60) || frameGateValue > (frameTimer - 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 > (frameTimer - 50) && frameGateValue < (frameTimer - 25)) - { - NPC.frame.Y = frameHeight * 5; - } - } - } - else if (NPC.ai[0] == 5f) - { - int otherFrameTimer = 120; - if (NPC.ai[1] < (otherFrameTimer - 50) || NPC.ai[1] > (otherFrameTimer - 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] > (otherFrameTimer - 40) && NPC.ai[1] < (otherFrameTimer - 15)) - { - NPC.frame.Y = frameHeight * 5; - } - } - } - else - { - 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 - { - NPC.frameCounter = 0D; - NPC.frame.Y += frameHeight; - } - if (NPC.frame.Y >= frameHeight * 5) - { - NPC.frame.Y = 0; - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); - - bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || BossRushEvent.BossRushActive; - - // Percent life remaining - float lifeRatio = 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 = TextureAssets.Npc[Type].Value; - Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2)); - Color color = drawColor; - Color altColor = Color.White; - - float lerpDrawTransition = 0f; - int newAITracker = 120; - int buffColorDampener = 60; - - if (phase3 && calamityGlobalNPC.newAI[3] == 1f) - { - color = CalamityGlobalNPC.buffColor(color, 0.9f, 0.6f, 0.2f, 1f); - } - else if (phase2 && calamityGlobalNPC.newAI[2] == 1f) - { - color = CalamityGlobalNPC.buffColor(color, 0.7f, 0.7f, 0.3f, 1f); - } - else if (phase2 && calamityGlobalNPC.newAI[0] > (float)newAITracker) - { - 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 afterimageAmt = 10; - int afterimageIncrement = 2; - if (NPC.ai[0] == 0f || NPC.ai[0] == 3.1f || NPC.ai[0] == 4f || NPC.ai[0] == 4.2f) - { - afterimageAmt = 4; - } - if (NPC.ai[0] == 1f || NPC.ai[0] == 3f || NPC.ai[0] == 4.1f) - { - afterimageAmt = 7; - } - if (NPC.ai[0] == 2f || NPC.ai[0] == 3.2f || (phase2 && calamityGlobalNPC.newAI[2] == 1f)) - { - altColor = Color.Yellow; - lerpDrawTransition = 0.5f; - } - else - { - color = altColor; - } - - if (CalamityClientConfig.Instance.Afterimages) - { - for (int i = 1; i < afterimageAmt; i += afterimageIncrement) - { - Color afterimageColor = color; - afterimageColor = Color.Lerp(afterimageColor, altColor, 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[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 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) - { - extraAfterimageAmt = 4; - } - - if (NPC.ai[0] == 5f) - { - if (NPC.ai[1] > 60f) - { - 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)newAITracker) - { - 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)newAITracker) - { - extraAfterimageAmt = 6; - extraAfterimageDampener = 1f - (float)Math.Cos((double)((calamityGlobalNPC.newAI[0] - (float)newAITracker) / (float)buffColorDampener * MathHelper.TwoPi)); - extraAfterimageDampener /= 3f; - afterimageScaler = 60f; - } - } - - if (CalamityClientConfig.Instance.Afterimages) - { - for (int j = 0; j < extraAfterimageAmt; j++) - { - Color extraAfterimageColor = altColor; - extraAfterimageColor = Color.Lerp(extraAfterimageColor, altColor, 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[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 mainDrawingColor = altColor; - mainDrawingColor = Color.Lerp(mainDrawingColor, altColor, lerpDrawTransition); - mainDrawingColor = NPC.GetAlpha(mainDrawingColor); - Vector2 drawLocation = NPC.Center - screenPos; - drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[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(altColor)), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - - if (phase2) - { - texture2D15 = GlowTexture.Value; - Color glowmaskColor = Color.Lerp(Color.White, Color.Red, 0.5f); - altColor = Color.Red; - - lerpDrawTransition = 1f; - extraAfterimageDampener = 0.5f; - afterimageScaler = 10f; - afterimageIncrement = 1; - - if (phaseSwitchPhase) - { - float glowmaskDampener = (phase3 ? calamityGlobalNPC.newAI[1] : calamityGlobalNPC.newAI[0]) - (float)newAITracker; - glowmaskDampener /= (float)buffColorDampener; - altColor *= glowmaskDampener; - glowmaskColor *= glowmaskDampener; - } - - if (CalamityClientConfig.Instance.Afterimages) - { - for (int k = 1; k < afterimageAmt; k += afterimageIncrement) - { - Color glowmaskAfterimageColor = glowmaskColor; - glowmaskAfterimageColor = Color.Lerp(glowmaskAfterimageColor, altColor, 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[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 l = 1; l < extraAfterimageAmt; l++) - { - Color extraGlowmaskAfterimageColor = glowmaskColor; - extraGlowmaskAfterimageColor = Color.Lerp(extraGlowmaskAfterimageColor, altColor, 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[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, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, 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) => potionType = ItemID.SuperHealingPotion; - - public override void ModifyNPCLoot(NPCLoot npcLoot) - { - npcLoot.Add(ItemDropRule.BossBag(ModContent.ItemType())); - - // Normal drops: Everything that would otherwise be in the bag - var normalOnly = npcLoot.DefineNormalOnlyDropSet(); - { - // Weapons - int[] items = new int[] - { - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() - }; - normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, items)); - normalOnly.Add(ModContent.ItemType(), 10); - - // Materials - normalOnly.Add(ModContent.ItemType(), 1, 25, 30); - - // Equipment - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); - normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); - - // Vanity - normalOnly.Add(ModContent.ItemType(), 7); - normalOnly.Add(ModContent.ItemType(), ThankYouPainting.DropInt); - } - - npcLoot.Add(ModContent.ItemType(), 10); - - // Relic - npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); - - // GFB Omega Healing Potion drop - npcLoot.DefineConditionalDropSet(DropHelper.GFB).Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 50, 100), true); - - // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedDragonfolly, ModContent.ItemType(), desc: DropHelper.FirstKillText); - } - - public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) - { - if (hurtInfo.Damage > 0) - target.AddBuff(ModContent.BuffType(), Main.zenithWorld ? 360 : 180); - } - - public override void OnKill() - { - // Don't bother running any of this in Boss Rush. - if (BossRushEvent.BossRushActive) - return; - - CalamityGlobalNPC.SetNewBossJustDowned(NPC); - - // Mark The Dragonfolly as dead - DownedBossSystem.downedDragonfolly = true; - CalamityNetcode.SyncWorld(); - - if (Main.zenithWorld) - { - int spacing = 40; - int amt = 7; - SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, NPC.Center - Vector2.UnitY * 300f); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - for (int i = 0; i < amt; i++) - { - Vector2 fireFrom = new Vector2(NPC.Center.X + (spacing * i) - (spacing * amt / 2), NPC.Center.Y - 900f); - Vector2 ai0 = NPC.Center - fireFrom; - float ai = Main.rand.Next(100); - Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), NPC.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai); - } - } - } - - } - - public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) - { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); - } - - public override void ModifyTypeName(ref string typeName) - { - if (Main.zenithWorld) - { - typeName = CalamityUtils.GetTextValue("NPCs.Bumblebirb"); - } - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0) - { - for (int k = 0; k < 50; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f); - } - if (!Main.dedServ) - { - for (int i = 0; i < 6; i++) // 1 head, 1 wing, 4 legs = 6. one wing due to them being chonky boyes now - { - string gore = "Bumble"; - float randomSpread = Main.rand.Next(-200, 201) / 100f; - gore += i == 0 ? "Head" : i > 1 ? "Leg" : "Wing"; - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find(gore).Type, 1f); - } - } - } - } - } -} diff --git a/NPCs/Bumblebirb/Bumblefuck2.cs b/NPCs/Bumblebirb/Bumblefuck2.cs deleted file mode 100644 index ef8f02eaf5..0000000000 --- a/NPCs/Bumblebirb/Bumblefuck2.cs +++ /dev/null @@ -1,153 +0,0 @@ -using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; -using CalamityMod.Projectiles.Boss; -using CalamityMod.Sounds; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.Bumblebirb -{ - public class Bumblefuck2 : ModNPC - { - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 5; - NPCID.Sets.TrailingMode[Type] = 1; - this.HideFromBestiary(); - } - - public override string Texture => "CalamityMod/NPCs/Bumblebirb/BumbleFolly"; - - public override void SetDefaults() - { - NPC.npcSlots = 1f; - NPC.aiStyle = -1; - AIType = -1; - NPC.GetNPCDamage(); - NPC.width = 120; - NPC.height = 80; - NPC.defense = 20; - NPC.LifeMaxNERB(9375, 11250, 5000); - NPC.knockBackResist = 0.15f; - NPC.lavaImmune = true; - NPC.noTileCollide = true; - NPC.noGravity = true; - NPC.HitSound = SoundID.NPCHit51; - NPC.DeathSound = SoundID.NPCDeath46; - NPC.Calamity().VulnerableToHeat = true; - NPC.Calamity().VulnerableToCold = true; - NPC.Calamity().VulnerableToSickness = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); - } - - public override void AI() - { - BumblebirbAI.VanillaBumblebirb2AI(NPC, Mod, true); - } - - public override void OnKill() - { - int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); - if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - - if (Main.zenithWorld) - { - SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, NPC.Center - Vector2.UnitY * 300f); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - for (int i = 0; i < 5; i++) - { - Vector2 fireFrom = new Vector2(NPC.Center.X + (40 * i) - 120, NPC.Center.Y - 900f); - Vector2 ai0 = NPC.Center - fireFrom; - float ai = Main.rand.Next(100); - Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), NPC.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai); - } - } - } - } - - public override void FindFrame(int frameHeight) - { - NPC.frameCounter += NPC.ai[0] == 2.1f ? 1.5 : 1D; - if (Main.zenithWorld) - { - NPC.frameCounter += 2D; - } - 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 bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - Texture2D texture2D15 = TextureAssets.Npc[Type].Value; - Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2); - int afterimageAmt = NPC.ai[0] == 2.1f ? 7 : 0; - - if (CalamityClientConfig.Instance.Afterimages) - { - for (int i = 1; i < afterimageAmt; i += 2) - { - 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[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 drawLocation = NPC.Center - screenPos; - drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[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; - } - - public override void ModifyTypeName(ref string typeName) - { - if (Main.zenithWorld) - { - typeName = CalamityUtils.GetTextValue("NPCs.Bumblebirb"); - } - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0) - { - for (int k = 0; k < 50; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f); - } - } - } - } -} diff --git a/NPCs/Bumblebirb/DraconicSwarmer.cs b/NPCs/Bumblebirb/DraconicSwarmer.cs new file mode 100644 index 0000000000..f2156037e7 --- /dev/null +++ b/NPCs/Bumblebirb/DraconicSwarmer.cs @@ -0,0 +1,369 @@ +using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; +using CalamityMod.Projectiles.Boss; +using CalamityMod.Sounds; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.Bumblebirb +{ + public class DraconicSwarmer : ModNPC + { + public override void SetStaticDefaults() + { + Main.npcFrameCount[Type] = 5; + NPCID.Sets.TrailingMode[Type] = 1; + this.HideFromBestiary(); + } + + public override string Texture => "CalamityMod/NPCs/Bumblebirb/BumbleFolly"; + + public override void SetDefaults() + { + NPC.npcSlots = 1f; + NPC.aiStyle = -1; + AIType = -1; + NPC.GetNPCDamage(); + NPC.width = 120; + NPC.height = 80; + NPC.defense = 20; + NPC.LifeMaxNERB(9375, 11250, 5000); + NPC.knockBackResist = 0.15f; + NPC.lavaImmune = true; + NPC.noTileCollide = true; + NPC.noGravity = true; + NPC.HitSound = SoundID.NPCHit51; + NPC.DeathSound = SoundID.NPCDeath46; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); + } + + public override void AI() + { + Player player = Main.player[NPC.target]; + + float rotationMult = 4f; + float rotationAmt = 0.04f; + + if (Vector2.Distance(player.Center, NPC.Center) > 5600f) + { + if (NPC.timeLeft > 5) + NPC.timeLeft = 5; + } + + NPC.rotation = (NPC.rotation * rotationMult + NPC.velocity.X * rotationAmt * 1.25f) / 10f; + + if (NPC.ai[0] == 0f || NPC.ai[0] == 1f) + { + for (int i = 0; i < Main.maxNPCs; i++) + { + if (i != NPC.whoAmI && Main.npc[i].active && Main.npc[i].type == NPC.type) + { + Vector2 otherSwarmerDirection = Main.npc[i].Center - NPC.Center; + if (otherSwarmerDirection.Length() < (NPC.width + NPC.height)) + { + otherSwarmerDirection.Normalize(); + otherSwarmerDirection *= -0.1f; + NPC.velocity += otherSwarmerDirection; + NPC nPC6 = Main.npc[i]; + nPC6.velocity -= otherSwarmerDirection; + } + } + } + } + + if (NPC.target < 0 || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + { + NPC.TargetClosest(true); + Vector2 swarmerTargetDist = Main.player[NPC.target].Center - NPC.Center; + if (Main.player[NPC.target].dead || swarmerTargetDist.Length() > 5600f) + NPC.ai[0] = -1f; + } + else + { + Vector2 swarmerCatchUpTargetDist = Main.player[NPC.target].Center - NPC.Center; + if (NPC.ai[0] > 1f && swarmerCatchUpTargetDist.Length() > 3600f) + NPC.ai[0] = 1f; + } + + if (NPC.ai[0] == -1f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + Vector2 swarmerDespawnVelMult = new Vector2(0f, -8f); + NPC.velocity = (NPC.velocity * 21f + swarmerDespawnVelMult) / 10f; + return; + } + + if (NPC.ai[0] == 0f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.TargetClosest(true); + NPC.spriteDirection = NPC.direction; + + Vector2 swarmerIdleTargetDist = Main.player[NPC.target].Center - NPC.Center; + if (swarmerIdleTargetDist.Length() > 2800f) + { + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + } + else if (swarmerIdleTargetDist.Length() > 400f) + { + float swarmerIdleSpeed = 9f + swarmerIdleTargetDist.Length() / 100f + NPC.ai[1] / 15f; + swarmerIdleTargetDist.Normalize(); + swarmerIdleTargetDist *= swarmerIdleSpeed; + NPC.velocity = (NPC.velocity * 29f + swarmerIdleTargetDist) / 30f; + if (Main.getGoodWorld && !Main.zenithWorld) + NPC.velocity *= 1.15f; + } + else if (NPC.velocity.Length() > 2f) + NPC.velocity *= 0.95f; + else if (NPC.velocity.Length() < 1f) + NPC.velocity *= 1.05f; + + NPC.ai[1] += 1f; + if (NPC.ai[1] >= 90f) + { + NPC.ai[1] = 0f; + NPC.ai[0] = 2f; + } + } + else + { + if (NPC.ai[0] == 1f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + if (NPC.target < 0 || !Main.player[NPC.target].active || Main.player[NPC.target].dead) + NPC.TargetClosest(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 swarmerChargeTargetDist = Main.player[NPC.target].Center - NPC.Center; + if (swarmerChargeTargetDist.Length() < 800f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + { + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + } + + NPC.ai[2] += 0.0166666675f; + float swarmerChargeSpeed = 12f + NPC.ai[2] + swarmerChargeTargetDist.Length() / 150f; + float swarmerChargeVelMult = 25f; + swarmerChargeTargetDist.Normalize(); + swarmerChargeTargetDist *= swarmerChargeSpeed; + NPC.velocity = (NPC.velocity * (swarmerChargeVelMult - 1f) + swarmerChargeTargetDist) / swarmerChargeVelMult; + if (Main.getGoodWorld && !Main.zenithWorld) + NPC.velocity *= 1.15f; + + NPC.ForceNetUpdate(); + + return; + } + + if (NPC.ai[0] == 2f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + 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 * 0.75f + NPC.velocity.X * rotationAmt * 1.25f) / 8f; + + Vector2 swarmerDecelerateTargetDist = Main.player[NPC.target].Center - NPC.Center; + swarmerDecelerateTargetDist.Y -= 8f; + float swarmerDecelerateSpeed = 18f; + float swarmerDecelerateVelMult = 8f; + swarmerDecelerateTargetDist.Normalize(); + swarmerDecelerateTargetDist *= swarmerDecelerateSpeed; + NPC.velocity = (NPC.velocity * (swarmerDecelerateVelMult - 1f) + swarmerDecelerateTargetDist) / swarmerDecelerateVelMult; + if (Main.getGoodWorld && !Main.zenithWorld) + NPC.velocity *= 1.15f; + + 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) + { + // Set damage + NPC.damage = NPC.defDamage; + + NPC.velocity = swarmerDecelerateTargetDist; + if (Main.getGoodWorld && !Main.zenithWorld) + NPC.velocity *= 1.15f; + + if (NPC.velocity.X < 0f) + NPC.direction = -1; + else + NPC.direction = 1; + + NPC.ai[0] = 2.1f; + NPC.ai[1] = 0f; + } + } + else if (NPC.ai[0] == 2.1f) + { + // Set damage + NPC.damage = NPC.defDamage; + + if (NPC.velocity.X < 0f) + NPC.direction = -1; + else if (NPC.velocity.X > 0f) + NPC.direction = 1; + + NPC.spriteDirection = NPC.direction; + + NPC.velocity *= 1.01f; + + NPC.ai[1] += 1f; + if (NPC.ai[1] > 30f) + { + if (!Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + { + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + return; + } + + if (NPC.ai[1] > 60f) + { + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + } + } + } + } + } + + public override void OnKill() + { + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); + if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); + + if (Main.zenithWorld) + { + SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, NPC.Center - Vector2.UnitY * 300f); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int i = 0; i < 5; i++) + { + Vector2 fireFrom = new Vector2(NPC.Center.X + (40 * i) - 120, NPC.Center.Y - 900f); + Vector2 ai0 = NPC.Center - fireFrom; + float ai = Main.rand.Next(100); + Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), NPC.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai); + } + } + } + } + + public override void FindFrame(int frameHeight) + { + NPC.frameCounter += NPC.ai[0] == 2.1f ? 1.5 : 1D; + if (Main.zenithWorld) + { + NPC.frameCounter += 2D; + } + 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 bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2); + int afterimageAmt = NPC.ai[0] == 2.1f ? 7 : 0; + + if (CalamityClientConfig.Instance.Afterimages) + { + for (int i = 1; i < afterimageAmt; i += 2) + { + 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[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 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[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; + } + + public override void ModifyTypeName(ref string typeName) + { + if (Main.zenithWorld) + { + typeName = CalamityUtils.GetTextValue("NPCs.Bumblebirb"); + } + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 50; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f); + } + } + } + } +} diff --git a/NPCs/Bumblebirb/Dragonfolly.cs b/NPCs/Bumblebirb/Dragonfolly.cs new file mode 100644 index 0000000000..268fadb66a --- /dev/null +++ b/NPCs/Bumblebirb/Dragonfolly.cs @@ -0,0 +1,1356 @@ +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Armor.Vanity; +using CalamityMod.Items.LoreItems; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Mounts; +using CalamityMod.Items.Placeables.Furniture.BossRelics; +using CalamityMod.Items.Placeables.Furniture.DevPaintings; +using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Items.Potions; +using CalamityMod.Items.TreasureBags; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Projectiles.Boss; +using CalamityMod.Sounds; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.Bumblebirb +{ + [AutoloadBossHead] + public class Dragonfolly : ModNPC + { + public static Asset GlowTexture; + public override void SetStaticDefaults() + { + Main.npcFrameCount[Type] = 6; + NPCID.Sets.TrailingMode[Type] = 1; + NPCID.Sets.BossBestiaryPriority.Add(Type); + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() + { + Scale = 0.5f, + PortraitScale = 0.85f, + PortraitPositionYOverride = 14f + }; + value.Position.X += 20f; + value.Position.Y += 8f; + NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request("CalamityMod/NPCs/Bumblebirb/BirbGlow", AssetRequestMode.AsyncLoad); + } + } + + public override string Texture => "CalamityMod/NPCs/Bumblebirb/Birb"; + public override string BossHeadTexture => "CalamityMod/NPCs/Bumblebirb/Birb_Head_Boss"; + + public override void SetDefaults() + { + NPC.Calamity().canBreakPlayerDefense = true; + NPC.npcSlots = 32f; + NPC.aiStyle = -1; + AIType = -1; + NPC.GetNPCDamage(); + NPC.width = 130; + NPC.height = 100; + NPC.defense = 40; + NPC.DR_NERD(0.1f); + NPC.LifeMaxNERB(187500, 225000, 300000); // Old HP - 227500, 252500 + NPC.knockBackResist = 0f; + NPC.boss = true; + NPC.noTileCollide = true; + NPC.lavaImmune = true; + NPC.noGravity = true; + NPC.value = Item.buyPrice(1, 0, 0, 0); + NPC.HitSound = SoundID.NPCHit51; + NPC.DeathSound = SoundID.NPCDeath46; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = false; + + // Scale HP in Master + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Jungle, + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Bumblefuck") + }); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(NPC.localAI[0]); + writer.Write(NPC.localAI[1]); + writer.Write(NPC.localAI[2]); + writer.Write(NPC.localAI[3]); + for (int i = 0; i < 4; i++) + writer.Write(NPC.Calamity().newAI[i]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + NPC.localAI[0] = reader.ReadSingle(); + NPC.localAI[1] = reader.ReadSingle(); + NPC.localAI[2] = reader.ReadSingle(); + NPC.localAI[3] = reader.ReadSingle(); + for (int i = 0; i < 4; i++) + NPC.Calamity().newAI[i] = reader.ReadSingle(); + } + + public override void AI() + { + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + + // Get a target + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); + + // Despawn safety, make sure to target another player if the current player target is too far away + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); + + Player player = Main.player[NPC.target]; + + // Variables + float rotationMult = 3f; + float rotationAmt = 0.03f; + bool bossRush = BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool death = CalamityWorld.death || bossRush; + + // Adjust slowing debuff immunity + bool immuneToSlowingDebuffs = NPC.ai[0] == 3f || NPC.ai[0] == 3.1f || NPC.ai[0] == 3.2f; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; + NPC.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; + + // If target is outside the jungle for more than 5 seconds, enrage + if (!player.ZoneJungle) + { + if (NPC.localAI[1] < CalamityGlobalNPC.biomeEnrageTimerMax) + NPC.localAI[1] += 1f; + } + else + NPC.localAI[1] = 0f; + + // If dragonfolly is off screen, enrage for the next couple attacks + if (Vector2.Distance(player.Center, NPC.Center) > 1200f) + NPC.localAI[2] = 2f; + + // Enrage scale + float enrageScale = death ? 1.5f : 1f; + if (NPC.localAI[1] >= CalamityGlobalNPC.biomeEnrageTimerMax || bossRush) + { + NPC.Calamity().CurrentlyEnraged = !bossRush; + enrageScale += 1f; + } + + if (NPC.localAI[2] > 0f || bossRush) + enrageScale += 1f; + + if (Main.getGoodWorld) + enrageScale += 0.5f; + + if (enrageScale > 3f) + enrageScale = 3f; + + // Despawn + if (!player.active || player.dead || Vector2.Distance(player.Center, NPC.Center) > 5600f) + { + NPC.TargetClosest(false); + player = Main.player[NPC.target]; + + if (!player.active || player.dead || Vector2.Distance(player.Center, NPC.Center) > 5600f) + { + NPC.rotation = (NPC.rotation * rotationMult + NPC.velocity.X * rotationAmt) / 10f; + + if (NPC.velocity.Y > 3f) + NPC.velocity.Y = 3f; + NPC.velocity.Y -= 0.2f; + if (NPC.velocity.Y < -12f) + NPC.velocity.Y = -12f; + + if (NPC.timeLeft > 60) + NPC.timeLeft = 60; + + if (NPC.ai[0] != 0f) + { + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + + NPC.ForceNetUpdate(false); + } + + return; + } + } + else if (NPC.timeLeft < 1800) + NPC.timeLeft = 1800; + + // Percent life remaining + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + // Phases + bool phase2 = lifeRatio < (revenge ? 0.75f : 0.5f); + bool phase3 = lifeRatio < (death ? 0.4f : revenge ? 0.25f : 0.1f) && expertMode; + + float birbSpawnPhaseTimer = 180f; + float newPhaseTimer = 180f; + bool phaseSwitchPhase = (phase2 && calamityGlobalNPC.newAI[0] < newPhaseTimer && calamityGlobalNPC.newAI[2] != 1f) || + (phase3 && calamityGlobalNPC.newAI[1] < newPhaseTimer && calamityGlobalNPC.newAI[3] != 1f); + + calamityGlobalNPC.DR = (phaseSwitchPhase || NPC.ai[0] == 5f || (enrageScale == 3f && !bossRush)) ? (bossRush ? 0.99f : 0.55f) : 0.1f; + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = phaseSwitchPhase || NPC.ai[0] == 5f || (enrageScale == 3f && !bossRush); + + int reducedSetDamage = (int)Math.Round(NPC.defDamage * 0.5); + + if (phaseSwitchPhase) + { + // Avoid cheap bullshit + NPC.damage = 0; + + 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) + { + float squawkpitch = Main.zenithWorld ? 1.3f : 0.25f; + SoundEngine.PlaySound(SoundID.DD2_BetsyScream with { Pitch = squawkpitch }, NPC.Center); + + if (Main.zenithWorld) + { + int spacing = 20; + int amt = 5; + SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, NPC.Center - Vector2.UnitY * 300f); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int i = 0; i < amt; i++) + { + Vector2 fireFrom = new Vector2(NPC.Center.X + (spacing * i) - (spacing * amt / 2), NPC.Center.Y - 900f); + Vector2 ai0 = NPC.Center - fireFrom; + float ai = Main.rand.Next(100); + Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), NPC.defDamage, 0f, Main.myPlayer, ai0.ToRotation(), ai); + } + } + } + } + + if (calamityGlobalNPC.newAI[1] >= newPhaseTimer) + { + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 1f; + calamityGlobalNPC.newAI[3] = 1f; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.SyncExtraAI(); + NPC.ForceNetUpdate(false); + } + } + else + { + calamityGlobalNPC.newAI[0] += 1f; + + // Sound + if (calamityGlobalNPC.newAI[0] == newPhaseTimer - 60f) + { + float squawkpitch = Main.zenithWorld ? 1.3f : 0.25f; + SoundEngine.PlaySound(SoundID.DD2_BetsyScream with { Pitch = squawkpitch }, NPC.Center); + + if (Main.zenithWorld) + { + int spacing = 20; + int amt = 3; + SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, NPC.Center - Vector2.UnitY * 300f); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int i = 0; i < amt; i++) + { + Vector2 fireFrom = new Vector2(NPC.Center.X + (spacing * i) - (spacing * amt / 2), NPC.Center.Y - 900f); + Vector2 ai0 = NPC.Center - fireFrom; + float ai = Main.rand.Next(100); + Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), NPC.defDamage, 0f, Main.myPlayer, ai0.ToRotation(), ai); + } + } + } + } + + 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.SyncExtraAI(); + NPC.ForceNetUpdate(false); + } + } + + Vector2 follyTargetDirection = player.Center - NPC.Center; + float follyTargetDistance = 4f + follyTargetDirection.Length() / 100f; + float follyVelocityMult = 25f; + follyTargetDirection.Normalize(); + follyTargetDirection *= follyTargetDistance; + NPC.velocity = (NPC.velocity * (follyVelocityMult - 1f) + follyTargetDirection) / follyVelocityMult; + return; + } + + // Max spawn amount + int maxBirbs = (CalamityWorld.LegendaryMode && revenge) ? 12 : revenge ? 3 : 2; + + // Variable for charging + float chargeDistance = 600f; + if (phase2) + chargeDistance -= 50f; + if (phase3) + chargeDistance -= 50f; + chargeDistance -= (enrageScale - 1f) * 100f; + + // Phase switch + if (NPC.ai[0] == 0f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + if (NPC.Center.X < player.Center.X - 2f) + NPC.direction = 1; + if (NPC.Center.X > player.Center.X + 2f) + NPC.direction = -1; + + // Direction and rotation + NPC.spriteDirection = NPC.direction; + NPC.rotation = (NPC.rotation * rotationMult + NPC.velocity.X * rotationAmt * 1.25f) / 10f; + + // Fly to target if target is too far away, otherwise get close to target and then slow down + Vector2 follyFlyTargetDirection = player.Center - NPC.Center; + follyFlyTargetDirection.Y -= 200f; + if (follyFlyTargetDirection.Length() > 2800f) + { + NPC.TargetClosest(); + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + } + else if (follyFlyTargetDirection.Length() > 240f) + { + float follyFlySpeed = 12f + (enrageScale - 1f) * 6f; + float follyFlyVelocityMult = 30f; + follyFlyTargetDirection.Normalize(); + follyFlyTargetDirection *= follyFlySpeed; + NPC.velocity = (NPC.velocity * (follyFlyVelocityMult - 1f) + follyFlyTargetDirection) / follyFlyVelocityMult; + } + else if (NPC.velocity.Length() > 2f) + NPC.velocity *= 0.95f; + else if (NPC.velocity.Length() < 1f) + NPC.velocity *= 1.05f; + + // Phase switch + NPC.ai[1] += 1f; + if (NPC.ai[1] >= 30f) + { + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + + while (NPC.ai[0] == 0f) + { + if (phase2) + NPC.localAI[0] += 1f; + + if (NPC.localAI[0] >= (phase3 ? 7 : 9)) + { + NPC.TargetClosest(); + NPC.ai[0] = 5f; + NPC.localAI[0] = 0f; + + // Decrease the feather variable, feathers can be used again if it's at 0 + if (NPC.ai[3] > 0f) + NPC.ai[3] -= 1f; + + // Decrease enraged attacks by 1 + if (NPC.localAI[2] > 0f) + NPC.localAI[2] -= 1f; + + // Decrease amount of attacks until able to spawn small birbs again + if (NPC.localAI[3] > 0f) + NPC.localAI[3] -= 1f; + } + else + { + int follyAttackPicker = phase2 ? Main.rand.Next(2) + 1 : Main.rand.Next(3); + if (phase3) + follyAttackPicker = 1; + + float featherVelocity = 2f + (enrageScale - 1f); + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + + if (follyAttackPicker == 0 && NPC.localAI[3] == 0f) + { + NPC.TargetClosest(); + NPC.ai[0] = 2f; + + // Decrease the feather variable, feathers can be used again if it's at 0 + if (NPC.ai[3] > 0f) + NPC.ai[3] -= 1f; + + // Decrease enraged attacks by 1 + if (NPC.localAI[2] > 0f) + NPC.localAI[2] -= 1f; + + // Birb will do at least 1 different attack before entering this phase again + NPC.localAI[3] = 1f; + } + else if (follyAttackPicker == 1) + { + NPC.TargetClosest(); + NPC.ai[0] = 3f; + + // Decrease enraged attacks by 1 + if (NPC.localAI[2] > 0f) + NPC.localAI[2] -= 1f; + + // Decrease amount of attacks until able to use other attacks again + if (NPC.localAI[3] > 0f) + NPC.localAI[3] -= 1f; + + if (phase2 && NPC.ai[3] == 0f) + { + NPC.ai[3] = 3f; + SoundEngine.PlaySound(SoundID.Item102, player.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int totalProjectiles = 40; + float radians = MathHelper.TwoPi / totalProjectiles; + int distance = 800; + bool spawnRight = player.velocity.X > 0f; + for (int i = 0; i < totalProjectiles; i++) + { + if (Main.getGoodWorld) + { + if (i >= (int)(totalProjectiles * 0.125) && i <= (int)(totalProjectiles * 0.375)) + { + Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; + Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; + Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); + } + if (i >= (int)(totalProjectiles * 0.625) && i <= (int)(totalProjectiles * 0.875)) + { + Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; + Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; + Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); + } + } + else + { + if (spawnRight) + { + if (i >= (int)(totalProjectiles * 0.125) && i <= (int)(totalProjectiles * 0.375)) + { + Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; + Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; + Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); + } + } + else + { + if (i >= (int)(totalProjectiles * 0.625) && i <= (int)(totalProjectiles * 0.875)) + { + Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; + Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; + Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); + } + } + } + } + } + } + else + { + // Decrease the feather variable, feathers can be used again if it's at 0 + if (NPC.ai[3] > 0f) + NPC.ai[3] -= 1f; + } + } + else if (NPC.CountNPCS(ModContent.NPCType()) < maxBirbs && NPC.localAI[3] == 0f) + { + NPC.TargetClosest(); + NPC.ai[0] = 4f; + + // Birb will do at least 2 different attacks before entering this phase again + NPC.localAI[3] = 2f; + + // Decrease enraged attacks by 1 + if (NPC.localAI[2] > 0f) + NPC.localAI[2] -= 1f; + + if (NPC.ai[3] == 0f) + { + NPC.ai[3] = 3f; + SoundEngine.PlaySound(SoundID.Item102, player.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int totalProjectiles = phase2 ? 40 : 48; + + if (Main.getGoodWorld) + totalProjectiles *= 2; + + float radians = MathHelper.TwoPi / totalProjectiles; + int distance = phase2 ? 1200 : 1320; + + if (Main.getGoodWorld) + distance *= 2; + + bool spawnRight = player.velocity.X > 0f; + for (int i = 0; i < totalProjectiles; i++) + { + if (spawnRight) + { + if (i >= totalProjectiles / 2) + break; + + Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; + Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; + Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); + } + else + { + if (i >= totalProjectiles / 2) + { + Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; + Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; + Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); + } + } + } + } + } + else + { + // Decrease the feather variable, feathers can be used again if it's at 0 + if (NPC.ai[3] > 0f) + NPC.ai[3] -= 1f; + } + } + } + } + + NPC.ForceNetUpdate(false); + NPC.SyncExtraAI(); + } + } + + // Fly to target + else if (NPC.ai[0] == 1f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + 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 follyTargetDirection = player.Center - NPC.Center; + if (follyTargetDirection.Length() < 800f) + { + NPC.TargetClosest(); + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + + NPC.ForceNetUpdate(false); + NPC.SyncExtraAI(); + } + + float velocity = 14f + (enrageScale - 1f) * 4f; + float follyTargetDistance = velocity + follyTargetDirection.Length() / 100f; + float follyVelocityMult = 25f; + follyTargetDirection.Normalize(); + follyTargetDirection *= follyTargetDistance; + NPC.velocity = (NPC.velocity * (follyVelocityMult - 1f) + follyTargetDirection) / follyVelocityMult; + } + + // Fly towards target quickly + else if (NPC.ai[0] == 2f) + { + // Set reduced damage + NPC.damage = reducedSetDamage; + + if (NPC.target < 0 || !player.active || player.dead) + { + NPC.TargetClosest(); + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + + NPC.ForceNetUpdate(false); + NPC.SyncExtraAI(); + } + + 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; + + Vector2 follyQuickFlyTargetDirection = player.Center - NPC.Center; + follyQuickFlyTargetDirection.Y -= 20f; + NPC.ai[2] += 0.0222222228f; + if (expertMode) + NPC.ai[2] += 0.0166666675f; + + float velocity = 8f + (enrageScale - 1f) * 2f; + float follyQuickFlySpeed = velocity + NPC.ai[2] + follyQuickFlyTargetDirection.Length() / 120f; + if (CalamityWorld.LegendaryMode && revenge) + follyQuickFlySpeed *= 2f; + + float follyQuickFlyVelMult = 20f; + follyQuickFlyTargetDirection.Normalize(); + follyQuickFlyTargetDirection *= follyQuickFlySpeed; + NPC.velocity = (NPC.velocity * (follyQuickFlyVelMult - 1f) + follyQuickFlyTargetDirection) / follyQuickFlyVelMult; + + NPC.ai[1] += 1f; + if (NPC.ai[1] >= ((CalamityWorld.LegendaryMode && revenge) ? 90f : 180f)) + { + NPC.TargetClosest(); + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + + NPC.ForceNetUpdate(false); + NPC.SyncExtraAI(); + } + } + + // Line up charge + else if (NPC.ai[0] == 3f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + 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 follyLineUpTargetDirection = player.Center - NPC.Center; + follyLineUpTargetDirection.Y -= 12f; + if (NPC.Center.X > player.Center.X) + follyLineUpTargetDirection.X += chargeDistance; + else + follyLineUpTargetDirection.X -= chargeDistance; + + float verticalDistanceGateValue = (phase3 ? 100f : 20f) + (enrageScale - 1f) * 20f; + if (Math.Abs(NPC.Center.X - player.Center.X) > chargeDistance - 50f && Math.Abs(NPC.Center.Y - player.Center.Y) < verticalDistanceGateValue) + { + NPC.ai[0] = 3.1f; + NPC.ai[1] = 0f; + + NPC.ForceNetUpdate(false); + NPC.SyncExtraAI(); + } + + NPC.ai[1] += 0.0333333351f; + float velocity = 16f + (enrageScale - 1f) * 4f; + float follyLineUpSpeed = velocity + NPC.ai[1]; + float follyLineUpVelMult = 4f; + follyLineUpTargetDirection.Normalize(); + follyLineUpTargetDirection *= follyLineUpSpeed; + NPC.velocity = (NPC.velocity * (follyLineUpVelMult - 1f) + follyLineUpTargetDirection) / follyLineUpVelMult; + } + + // Prepare to charge + else if (NPC.ai[0] == 3.1f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.rotation = (NPC.rotation * rotationMult * 0.5f + NPC.velocity.X * rotationAmt * 0.85f) / 5f; + + Vector2 follyChargePrepareTargetDirection = player.Center - NPC.Center; + follyChargePrepareTargetDirection.Y -= 12f; + float follyChargePrepareSpeed = 28f + (enrageScale - 1f) * 4f; + float follyChargePrepareVelMult = 8f; + follyChargePrepareTargetDirection.Normalize(); + follyChargePrepareTargetDirection *= follyChargePrepareSpeed; + NPC.velocity = (NPC.velocity * (follyChargePrepareVelMult - 1f) + follyChargePrepareTargetDirection) / follyChargePrepareVelMult; + + 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) + { + // Set damage + NPC.damage = NPC.defDamage; + + NPC.velocity = follyChargePrepareTargetDirection; + + if (NPC.velocity.X < 0f) + NPC.direction = -1; + else + NPC.direction = 1; + + NPC.ai[0] = 3.2f; + NPC.ai[1] = NPC.direction; + + NPC.ForceNetUpdate(false); + NPC.SyncExtraAI(); + } + } + + // Charge + else if (NPC.ai[0] == 3.2f) + { + // Set damage + NPC.damage = NPC.defDamage; + + NPC.ai[2] += 0.0333333351f; + float velocity = 28f + (enrageScale - 1f) * 4f; + NPC.velocity.X = (velocity + 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)) + { + NPC.TargetClosest(); + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ForceNetUpdate(false); + } + else if (Math.Abs(NPC.Center.X - player.Center.X) > chargeDistance + 200f) + { + NPC.TargetClosest(); + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ForceNetUpdate(false); + } + } + + NPC.rotation = (NPC.rotation * rotationMult * 0.5f + NPC.velocity.X * rotationAmt * 0.85f) / 5f; + } + + // Birb spawn + else if (NPC.ai[0] == 4f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + if (NPC.ai[1] == 0f) + { + Vector2 destination2 = player.Center + new Vector2(0f, -200f); + Vector2 desiredVelocity2 = NPC.SafeDirectionTo(destination2, -Vector2.UnitY) * 18f; + NPC.SimpleFlyMovement(desiredVelocity2, 1.5f); + + if (NPC.velocity.X < 0f) + NPC.direction = -1; + else + NPC.direction = 1; + + NPC.spriteDirection = NPC.direction; + + NPC.ai[2] += 1f; + if (NPC.Distance(player.Center) < 600f || NPC.ai[2] >= 180f) + { + NPC.ai[1] = 1f; + NPC.ForceNetUpdate(false); + } + } + else + { + if (NPC.ai[1] < 90f) + NPC.velocity *= 0.95f; + else + NPC.velocity *= 0.98f; + + if (NPC.ai[1] == 90f) + { + if (NPC.velocity.Y > 0f) + NPC.velocity.Y /= 3f; + + NPC.velocity.Y -= 3f; + } + + // Sound + if (NPC.ai[1] == birbSpawnPhaseTimer - 60f) + { + float squawkpitch = Main.zenithWorld ? 1.3f : 0.25f; + SoundEngine.PlaySound(SoundID.DD2_BetsyScream with { Pitch = squawkpitch }, NPC.Center); + + if (Main.zenithWorld) + { + int spacing = 30; + int amt = 3; + SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, NPC.Center - Vector2.UnitY * 300f); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int i = 0; i < amt; i++) + { + Vector2 fireFrom = new Vector2(NPC.Center.X + (spacing * i) - (spacing * amt / 2), NPC.Center.Y - 900f); + Vector2 ai0 = NPC.Center - fireFrom; + float ai = Main.rand.Next(100); + Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), NPC.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai); + } + } + } + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + bool gfbSpawnFlag = CalamityWorld.LegendaryMode && revenge && (NPC.ai[1] == 145f || NPC.ai[1] == 150f || NPC.ai[1] == 160f || NPC.ai[1] == 165f); + bool spawnFlag = NPC.CountNPCS(ModContent.NPCType()) < maxBirbs && (NPC.ai[1] == 140f || (revenge && NPC.ai[1] == 155f) || NPC.ai[1] == 170f || gfbSpawnFlag); + if (spawnFlag) + { + Vector2 follySpawnCenter = NPC.Center + (MathHelper.TwoPi * Main.rand.NextFloat()).ToRotationVector2() * new Vector2(2f, 1f) * 50f * (0.6f + Main.rand.NextFloat() * 0.4f); + if (Vector2.Distance(follySpawnCenter, player.Center) > 150f) + NPC.NewNPC(NPC.GetSource_FromAI(), (int)follySpawnCenter.X, (int)follySpawnCenter.Y, ModContent.NPCType(), NPC.whoAmI); + + NPC.ForceNetUpdate(false); + } + } + + NPC.ai[1] += 1f; + } + + if (NPC.ai[1] >= birbSpawnPhaseTimer) + { + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.TargetClosest(); + NPC.ForceNetUpdate(false); + } + } + + // Spit homing aura sphere + else if (NPC.ai[0] == 5f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + // 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) + { + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballShot, NPC.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 follySpawnCenter = NPC.rotation.ToRotationVector2() * (Vector2.UnitX * NPC.direction) * (NPC.width + 20) / 2f + NPC.Center; + float ai0 = (phase3 ? 2f : 0f) + (enrageScale - 1f); + if (ai0 > 3f) + ai0 = 3f; + + Projectile.NewProjectile(NPC.GetSource_FromAI(), follySpawnCenter.X, follySpawnCenter.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, ai0, NPC.target + 1); + NPC.ForceNetUpdate(false); + } + + if (Main.zenithWorld) + { + int spacing = 30; + int amt = 3; + SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, NPC.Center - Vector2.UnitY * 300f); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int i = 0; i < amt; i++) + { + Vector2 fireFrom = new Vector2(NPC.Center.X + (spacing * i) - (spacing * amt / 2), NPC.Center.Y - 900f); + Vector2 ai0 = NPC.Center - fireFrom; + float ai = Main.rand.Next(100); + Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), NPC.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai); + } + } + } + } + + NPC.ai[1] += 1f; + if (NPC.ai[1] >= aiGateValue) + { + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ForceNetUpdate(false); + } + } + } + + public override void FindFrame(int frameHeight) + { + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + + // Percent life remaining + float lifeRatio = 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); + bool birbSpawn = NPC.ai[0] == 4f && NPC.ai[1] > 0f; + + // Animation goes nyoom + if (Main.zenithWorld) + { + NPC.frameCounter += 4; + } + + 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 || birbSpawn) + { + float frameGateValue = birbSpawn ? NPC.ai[1] : phase3 ? calamityGlobalNPC.newAI[1] : calamityGlobalNPC.newAI[0]; + int frameTimer = 180; + if (frameGateValue < (frameTimer - 60) || frameGateValue > (frameTimer - 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 > (frameTimer - 50) && frameGateValue < (frameTimer - 25)) + { + NPC.frame.Y = frameHeight * 5; + } + } + } + else if (NPC.ai[0] == 5f) + { + int otherFrameTimer = 120; + if (NPC.ai[1] < (otherFrameTimer - 50) || NPC.ai[1] > (otherFrameTimer - 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] > (otherFrameTimer - 40) && NPC.ai[1] < (otherFrameTimer - 15)) + { + NPC.frame.Y = frameHeight * 5; + } + } + } + else + { + 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 + { + NPC.frameCounter = 0D; + NPC.frame.Y += frameHeight; + } + if (NPC.frame.Y >= frameHeight * 5) + { + NPC.frame.Y = 0; + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + + // Percent life remaining + float lifeRatio = 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 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2)); + Color color = drawColor; + Color altColor = Color.White; + + float lerpDrawTransition = 0f; + int newAITracker = 120; + int buffColorDampener = 60; + + if (phase3 && calamityGlobalNPC.newAI[3] == 1f) + { + color = CalamityGlobalNPC.buffColor(color, 0.9f, 0.6f, 0.2f, 1f); + } + else if (phase2 && calamityGlobalNPC.newAI[2] == 1f) + { + color = CalamityGlobalNPC.buffColor(color, 0.7f, 0.7f, 0.3f, 1f); + } + else if (phase2 && calamityGlobalNPC.newAI[0] > (float)newAITracker) + { + 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 afterimageAmt = 10; + int afterimageIncrement = 2; + if (NPC.ai[0] == 0f || NPC.ai[0] == 3.1f || NPC.ai[0] == 4f || NPC.ai[0] == 4.2f) + { + afterimageAmt = 4; + } + if (NPC.ai[0] == 1f || NPC.ai[0] == 3f || NPC.ai[0] == 4.1f) + { + afterimageAmt = 7; + } + if (NPC.ai[0] == 2f || NPC.ai[0] == 3.2f || (phase2 && calamityGlobalNPC.newAI[2] == 1f)) + { + altColor = Color.Yellow; + lerpDrawTransition = 0.5f; + } + else + { + color = altColor; + } + + if (CalamityClientConfig.Instance.Afterimages) + { + for (int i = 1; i < afterimageAmt; i += afterimageIncrement) + { + Color afterimageColor = color; + afterimageColor = Color.Lerp(afterimageColor, altColor, 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[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 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) + { + extraAfterimageAmt = 4; + } + + if (NPC.ai[0] == 5f) + { + if (NPC.ai[1] > 60f) + { + 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)newAITracker) + { + 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)newAITracker) + { + extraAfterimageAmt = 6; + extraAfterimageDampener = 1f - (float)Math.Cos((double)((calamityGlobalNPC.newAI[0] - (float)newAITracker) / (float)buffColorDampener * MathHelper.TwoPi)); + extraAfterimageDampener /= 3f; + afterimageScaler = 60f; + } + } + + if (CalamityClientConfig.Instance.Afterimages) + { + for (int j = 0; j < extraAfterimageAmt; j++) + { + Color extraAfterimageColor = altColor; + extraAfterimageColor = Color.Lerp(extraAfterimageColor, altColor, 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[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 mainDrawingColor = altColor; + mainDrawingColor = Color.Lerp(mainDrawingColor, altColor, lerpDrawTransition); + mainDrawingColor = NPC.GetAlpha(mainDrawingColor); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[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(altColor)), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + + if (phase2) + { + texture2D15 = GlowTexture.Value; + Color glowmaskColor = Color.Lerp(Color.White, Color.Red, 0.5f); + altColor = Color.Red; + + lerpDrawTransition = 1f; + extraAfterimageDampener = 0.5f; + afterimageScaler = 10f; + afterimageIncrement = 1; + + if (phaseSwitchPhase) + { + float glowmaskDampener = (phase3 ? calamityGlobalNPC.newAI[1] : calamityGlobalNPC.newAI[0]) - (float)newAITracker; + glowmaskDampener /= (float)buffColorDampener; + altColor *= glowmaskDampener; + glowmaskColor *= glowmaskDampener; + } + + if (CalamityClientConfig.Instance.Afterimages) + { + for (int k = 1; k < afterimageAmt; k += afterimageIncrement) + { + Color glowmaskAfterimageColor = glowmaskColor; + glowmaskAfterimageColor = Color.Lerp(glowmaskAfterimageColor, altColor, 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[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 l = 1; l < extraAfterimageAmt; l++) + { + Color extraGlowmaskAfterimageColor = glowmaskColor; + extraGlowmaskAfterimageColor = Color.Lerp(extraGlowmaskAfterimageColor, altColor, 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[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, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, 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) => potionType = ItemID.SuperHealingPotion; + + public override void ModifyNPCLoot(NPCLoot npcLoot) + { + npcLoot.Add(ItemDropRule.BossBag(ModContent.ItemType())); + + // Normal drops: Everything that would otherwise be in the bag + var normalOnly = npcLoot.DefineNormalOnlyDropSet(); + { + // Weapons + int[] items = new int[] + { + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + }; + normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, items)); + normalOnly.Add(ModContent.ItemType(), 10); + + // Materials + normalOnly.Add(ModContent.ItemType(), 1, 25, 30); + + // Equipment + normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); + + // Vanity + normalOnly.Add(ModContent.ItemType(), 7); + normalOnly.Add(ModContent.ItemType(), ThankYouPainting.DropInt); + } + + npcLoot.Add(ModContent.ItemType(), 10); + + // Relic + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); + + // GFB Omega Healing Potion drop + npcLoot.DefineConditionalDropSet(DropHelper.GFB).Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 50, 100), true); + + // Lore + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedDragonfolly, ModContent.ItemType(), desc: DropHelper.FirstKillText); + } + + public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) + { + if (hurtInfo.Damage > 0) + target.AddBuff(ModContent.BuffType(), Main.zenithWorld ? 360 : 180); + } + + public override void OnKill() + { + // Don't bother running any of this in Boss Rush. + if (BossRushEvent.BossRushActive) + return; + + CalamityGlobalNPC.SetNewBossJustDowned(NPC); + + // Mark The Dragonfolly as dead + DownedBossSystem.downedDragonfolly = true; + CalamityNetcode.SyncWorld(); + + if (Main.zenithWorld) + { + int spacing = 40; + int amt = 7; + SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, NPC.Center - Vector2.UnitY * 300f); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int i = 0; i < amt; i++) + { + Vector2 fireFrom = new Vector2(NPC.Center.X + (spacing * i) - (spacing * amt / 2), NPC.Center.Y - 900f); + Vector2 ai0 = NPC.Center - fireFrom; + float ai = Main.rand.Next(100); + Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), NPC.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai); + } + } + } + + } + + public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) + { + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); + NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); + } + + public override void ModifyTypeName(ref string typeName) + { + if (Main.zenithWorld) + { + typeName = CalamityUtils.GetTextValue("NPCs.Bumblebirb"); + } + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 50; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f); + } + if (!Main.dedServ) + { + for (int i = 0; i < 6; i++) // 1 head, 1 wing, 4 legs = 6. one wing due to them being chonky boyes now + { + string gore = "Bumble"; + float randomSpread = Main.rand.Next(-200, 201) / 100f; + gore += i == 0 ? "Head" : i > 1 ? "Leg" : "Wing"; + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find(gore).Type, 1f); + } + } + } + } + } +} diff --git a/NPCs/CalClone/CalamitasClone.cs b/NPCs/CalClone/CalamitasClone.cs index 86483769a4..e4571acd7a 100644 --- a/NPCs/CalClone/CalamitasClone.cs +++ b/NPCs/CalClone/CalamitasClone.cs @@ -14,14 +14,14 @@ using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Summon; -using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; using CalamityMod.NPCs.TownNPCs; -using CalamityMod.Sounds; +using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using ReLogic.Utilities; +using System; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -134,7 +134,719 @@ namespace CalamityMod.NPCs.CalClone public override void AI() { - CalamitasCloneAI.VanillaCalamitasCloneAI(NPC, BulletHellWarnSlot); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + + // Emit light + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 1f, 0f, 0f); + + // Variables for increasing difficulty + bool bossRush = BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool expertMode = Main.expertMode || bossRush; + + // Percent life remaining + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + // Phases + bool phase2 = lifeRatio < 0.7f || death; + bool phase3 = lifeRatio < 0.35f; + bool phase4 = lifeRatio <= 0.1f && death; + + // Don't take damage during bullet hells + NPC.dontTakeDamage = calamityGlobalNPC.newAI[2] > 0f; + + // Variable for live brothers + bool brotherAlive = false; + + // For seekers + CalamityGlobalNPC.calamitas = NPC.whoAmI; + + // Seeker ring + if (calamityGlobalNPC.newAI[1] == 0f && phase3 && expertMode) + { + SoundEngine.PlaySound(SoundID.Item72, NPC.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int seekerAmt = death ? 10 : 5; + int seekerSpread = 360 / seekerAmt; + int seekerDistance = death ? 180 : 150; + for (int i = 0; i < seekerAmt; i++) + { + int spawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + (Math.Sin(i * seekerSpread) * seekerDistance)), (int)(NPC.Center.Y + (Math.Cos(i * seekerSpread) * seekerDistance)), ModContent.NPCType(), NPC.whoAmI, 0, 0, 0, -1); + Main.npc[spawn].ai[0] = i * seekerSpread; + } + } + + string key = "Mods.CalamityMod.Status.Boss.CalamitasBossText3"; + Color messageColor = Color.Orange; + CalamityUtils.DisplayLocalizedText(key, messageColor); + + calamityGlobalNPC.newAI[1] = 1f; + } + + // CIT 14SEP2024: Fixed bug where her phases would get offset by dealing a large amount of damage in a single hit to take her into a new phase. + // newAI[0] now starts at 1 and has 0.3 subtracted from it for each phase, instead of it storing her current health when she enters a new phase. + + // Do bullet hell or spawn brothers + if (calamityGlobalNPC.newAI[0] == 0f && NPC.life > 0) + calamityGlobalNPC.newAI[0] = 1f; + + // Bullet hells at 70% and 10%, brothers at 40% + if (NPC.life > 0) + { + int calClonePhaseThreshold = (int)(NPC.lifeMax * 0.3); + if (((NPC.life + calClonePhaseThreshold) / (float)NPC.lifeMax) < calamityGlobalNPC.newAI[0]) + { + calamityGlobalNPC.newAI[0] -= 0.3f; + if (calamityGlobalNPC.newAI[0] <= 0.1f) + { + SoundEngine.PlaySound(SoundID.Item109, NPC.Center); + calamityGlobalNPC.newAI[2] = 2f; + + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + calamityGlobalNPC.newAI[3] = 0f; + + SpawnDust(); + } + else if (calamityGlobalNPC.newAI[0] <= 0.4f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.position.Y + NPC.height, ModContent.NPCType(), NPC.whoAmI); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.position.Y + NPC.height, ModContent.NPCType(), NPC.whoAmI); + } + + string key = "Mods.CalamityMod.Status.Boss.CalamitasBossText2"; + Color messageColor = Color.Orange; + CalamityUtils.DisplayLocalizedText(key, messageColor); + + SpawnDust(); + } + else + { + SoundEngine.PlaySound(SoundID.Item109, NPC.Center); + calamityGlobalNPC.newAI[2] = 1f; + + if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + calamityGlobalNPC.newAI[3] = 0f; + + SpawnDust(); + } + } + } + + // Immunity if brothers are alive + if (CalamityGlobalNPC.cataclysm != -1) + { + if (Main.npc[CalamityGlobalNPC.cataclysm].active) + brotherAlive = true; + } + if (CalamityGlobalNPC.catastrophe != -1) + { + if (Main.npc[CalamityGlobalNPC.catastrophe].active) + brotherAlive = true; + } + + if (brotherAlive) + NPC.dontTakeDamage = true; + + void SpawnDust() + { + int dustAmt = 50; + int random = 3; + + for (int j = 0; j < 10; j++) + { + random += j; + int dustAmtSpawned = 0; + int scale = random * 6; + float dustPositionX = NPC.Center.X - (scale / 2); + float dustPositionY = NPC.Center.Y - (scale / 2); + while (dustAmtSpawned < dustAmt) + { + float dustVelocityX = Main.rand.Next(-random, random); + float dustVelocityY = Main.rand.Next(-random, random); + float dustVelocityScalar = random * 2f; + float dustVelocity = (float)Math.Sqrt(dustVelocityX * dustVelocityX + dustVelocityY * dustVelocityY); + dustVelocity = dustVelocityScalar / dustVelocity; + dustVelocityX *= dustVelocity; + dustVelocityY *= dustVelocity; + int dust = Dust.NewDust(new Vector2(dustPositionX, dustPositionY), scale, scale, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + Main.dust[dust].noGravity = true; + Main.dust[dust].position.X = NPC.Center.X; + Main.dust[dust].position.Y = NPC.Center.Y; + Main.dust[dust].position.X += Main.rand.Next(-10, 11); + Main.dust[dust].position.Y += Main.rand.Next(-10, 11); + Main.dust[dust].velocity.X = dustVelocityX; + Main.dust[dust].velocity.Y = dustVelocityY; + dustAmtSpawned++; + } + } + } + + // Get a target + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); + + // Target variable + Player player = Main.player[NPC.target]; + + float enrageScale = bossRush ? 1f : 0f; + if (Main.IsItDay() || bossRush) + { + NPC.Calamity().CurrentlyEnraged = !bossRush; + enrageScale += 2f; + } + + // Rotation + Vector2 npcCenter = new Vector2(NPC.Center.X, NPC.position.Y + NPC.height - 59f); + Vector2 lookAt = new Vector2(player.position.X - (player.width / 2), player.position.Y - (player.height / 2)); + Vector2 rotationVector = npcCenter - lookAt; + + // Boss Rush predictive charge rotation + if (NPC.ai[1] == 4f && phase4 && bossRush) + { + // Velocity + float chargeVelocity = 30f; + chargeVelocity += 5f * enrageScale; + lookAt += Main.player[NPC.target].velocity * 20f; + rotationVector = Vector2.Normalize(npcCenter - lookAt) * chargeVelocity; + } + + float rotation = (float)Math.Atan2(rotationVector.Y, rotationVector.X) + MathHelper.PiOver2; + if (rotation < 0f) + rotation += MathHelper.TwoPi; + else if (rotation > MathHelper.TwoPi) + rotation -= MathHelper.TwoPi; + + float rotationAmt = 0.1f; + if (NPC.rotation < rotation) + { + if ((rotation - NPC.rotation) > MathHelper.Pi) + NPC.rotation -= rotationAmt; + else + NPC.rotation += rotationAmt; + } + else if (NPC.rotation > rotation) + { + if ((NPC.rotation - rotation) > MathHelper.Pi) + NPC.rotation += rotationAmt; + else + NPC.rotation -= rotationAmt; + } + + if (NPC.rotation > rotation - rotationAmt && NPC.rotation < rotation + rotationAmt) + NPC.rotation = rotation; + if (NPC.rotation < 0f) + NPC.rotation += MathHelper.TwoPi; + else if (NPC.rotation > MathHelper.TwoPi) + NPC.rotation -= MathHelper.TwoPi; + if (NPC.rotation > rotation - rotationAmt && NPC.rotation < rotation + rotationAmt) + NPC.rotation = rotation; + + // Despawn + if (!player.active || player.dead) + { + NPC.TargetClosest(false); + player = Main.player[NPC.target]; + if (!player.active || player.dead) + { + if (SoundEngine.TryGetActiveSound(BulletHellWarnSlot, out var warningSound) && warningSound.IsPlaying) + warningSound.Stop(); + + if (NPC.velocity.Y > 3f) + NPC.velocity.Y = 3f; + NPC.velocity.Y -= 0.1f; + if (NPC.velocity.Y < -12f) + NPC.velocity.Y = -12f; + + if (NPC.timeLeft > 60) + NPC.timeLeft = 60; + + if (NPC.ai[1] != 0f) + { + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + NPC.alpha = 0; + NPC.netUpdate = true; + } + return; + } + } + else if (NPC.timeLeft < 1800) + NPC.timeLeft = 1800; + + // Distance from destination where Cal Clone stops moving + float movementDistanceGateValue = 100f; + + // How fast Cal Clone moves to the destination + float baseVelocity = (expertMode ? 10f : 8.5f) * (NPC.ai[1] == 4f ? 1.4f : 1f); + float baseAcceleration = (expertMode ? 0.18f : 0.155f) * (NPC.ai[1] == 4f ? 1.4f : 1f); + baseVelocity += 4f * enrageScale; + baseAcceleration += 0.1f * enrageScale; + if (revenge) + { + baseVelocity += 1.5f * (1f - lifeRatio); + baseAcceleration += 0.03f * (1f - lifeRatio); + } + if (death) + { + baseVelocity += 1.5f * (1f - lifeRatio); + baseAcceleration += 0.03f * (1f - lifeRatio); + } + if (Main.getGoodWorld) + { + baseVelocity *= 1.15f; + baseAcceleration *= 1.15f; + } + + // What side Cal Clone should be on, relative to the target + int xPos = 1; + if (NPC.Center.X < player.Center.X) + xPos = -1; + + // How far Cal Clone should be from the target + float averageDistance = 500f; + float chargeDistance = phase4 ? 300f : 400f; + + // This is where Cal Clone should be + Vector2 destination = (calamityGlobalNPC.newAI[2] > 0f || NPC.ai[1] == 0f) ? new Vector2(player.Center.X, player.Center.Y - averageDistance) : + NPC.ai[1] == 1f ? new Vector2(player.Center.X + averageDistance * xPos, player.Center.Y) : + new Vector2(player.Center.X + chargeDistance * xPos, player.Center.Y); + + // Add some random distance to the destination after certain attacks + if (NPC.localAI[0] == 1f) + { + NPC.localAI[0] = 0f; + NPC.localAI[2] = Main.rand.Next(-50, 51); + NPC.localAI[3] = Main.rand.Next(-300, 301); + NPC.netUpdate = true; + } + + // Add a bit of randomness to the destination + if (death) + { + destination.X += NPC.ai[1] == 0f ? NPC.localAI[3] : NPC.localAI[2]; + destination.Y += NPC.ai[1] == 0f ? NPC.localAI[2] : NPC.localAI[3]; + } + + // How far Cal Clone is from where she's supposed to be + Vector2 distanceFromDestination = destination - NPC.Center; + + // Movement + if (NPC.ai[1] == 0f || NPC.ai[1] == 1f || NPC.ai[1] == 4f || calamityGlobalNPC.newAI[2] > 0f) + CalamityUtils.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity, baseAcceleration, true); + + // Bullet hell phase + if (calamityGlobalNPC.newAI[2] > 0f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + if (calamityGlobalNPC.newAI[3] < 900f) + { + calamityGlobalNPC.newAI[3] += 1f; + NPC.dontTakeDamage = true; + NPC.alpha = 255; + + float rotX = player.Center.X - NPC.Center.X; + float rotY = player.Center.Y - NPC.Center.Y; + NPC.rotation = (float)Math.Atan2(rotY, rotX) - MathHelper.PiOver2; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (calamityGlobalNPC.newAI[2] == 2f) + { + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + if (Main.zenithWorld) + type = ModContent.ProjectileType(); + + float gigaBlastFrequency = (Main.getGoodWorld ? 120f : expertMode ? 180f : 240f) - enrageScale * 15f; + float projSpeed = bossRush ? 6.25f : 5f; + if (calamityGlobalNPC.newAI[3] <= 300f) + { + if (calamityGlobalNPC.newAI[3] % gigaBlastFrequency == 0f) // Blasts from top + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed, type, damage, 0f, Main.myPlayer); + } + else if (calamityGlobalNPC.newAI[3] <= 600f && calamityGlobalNPC.newAI[3] > 300f) + { + if (calamityGlobalNPC.newAI[3] % gigaBlastFrequency == 0f) // Blasts from right + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -projSpeed, 0f, type, damage, 0f, Main.myPlayer); + } + else if (calamityGlobalNPC.newAI[3] > 600f) + { + if (calamityGlobalNPC.newAI[3] % gigaBlastFrequency == 0f) // Blasts from top + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed, type, damage, 0f, Main.myPlayer); + } + } + } + + NPC.ai[0] += 1f; + float hellblastGateValue = (expertMode ? 12f : 16f) - enrageScale; + if (NPC.ai[0] >= hellblastGateValue) + { + NPC.ai[0] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + float projSpeed = bossRush ? 4.5f : 4f; + // Blasts aimed directly at the player's horizontal position, does not spawn during the second bullet hell + if (calamityGlobalNPC.newAI[3] % (hellblastGateValue * 6f) == 0f && calamityGlobalNPC.newAI[2] != 2f) + { + float distance = Main.rand.NextBool() ? -1000f : 1000f; + float velocity = distance == -1000f ? projSpeed : -projSpeed; + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); + } + + if (calamityGlobalNPC.newAI[3] < 300f) // Blasts from above + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed, type, damage, 0f, Main.myPlayer, 2f, 0f); + } + else if (calamityGlobalNPC.newAI[3] < 600f) // Blasts from left and right + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -(projSpeed - 0.5f), 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), projSpeed - 0.5f, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); + } + else // Blasts from above, left, and right + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed - 1f, type, damage, 0f, Main.myPlayer, 2f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -(projSpeed - 1f), 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), projSpeed - 1f, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); + } + } + } + + if (calamityGlobalNPC.newAI[3] == 900f - 360f) + BulletHellWarnSlot = SoundEngine.PlaySound(CalamitasClone.BulletHellWarning, player.Center); + if (calamityGlobalNPC.newAI[3] > 900f - 360f) + { + if (SoundEngine.TryGetActiveSound(BulletHellWarnSlot, out var warningSound) && warningSound.IsPlaying) + warningSound.Position = player.Center; + } + } + else + { + NPC.ai[0] = 0f; + NPC.ai[3] = 0f; + NPC.localAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + SoundEngine.PlaySound(CalamitasClone.BulletHellEnd, player.Center); + + // Prevent bullshit charge hits when second bullet hell ends. + if (phase4) + { + NPC.ai[1] = 4f; + NPC.ai[2] = -105f; + NPC.TargetClosest(); + } + else + { + if (death) + { + int AIState = Main.rand.Next(3); + switch (AIState) + { + case 0: + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + break; + case 1: + NPC.ai[1] = 1f; + NPC.ai[2] = 0f; + break; + case 2: + NPC.ai[1] = 4f; + NPC.ai[2] = -105f; + NPC.TargetClosest(); + break; + } + } + else + { + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + } + + if (death) + NPC.localAI[0] = 1f; + } + + NPC.netUpdate = true; + + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active) + { + if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) + { + if (projectile.timeLeft > 60) + projectile.timeLeft = 60; + } + else if (projectile.type == ModContent.ProjectileType()) + { + projectile.ai[2] = 1f; + + if (projectile.timeLeft > 60) + projectile.timeLeft = 60; + } + } + } + } + + return; + } + else if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + { + if (calamityGlobalNPC.newAI[3] < 900f) + calamityGlobalNPC.newAI[3] += 1f; + else + calamityGlobalNPC.newAI[3] = 0f; + + NPC.ai[0] += 1f; + float hellblastGateValue = 30f - enrageScale; + if (NPC.ai[0] >= hellblastGateValue) + { + NPC.ai[0] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + float projSpeed = bossRush ? 5f : 4f; + if (calamityGlobalNPC.newAI[3] % (hellblastGateValue * 6f) == 0f) + { + float distance = Main.rand.NextBool() ? -1000f : 1000f; + float velocity = distance == -1000f ? projSpeed : -projSpeed; + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); + } + + if (calamityGlobalNPC.newAI[3] < 300f) // Blasts from above + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed, type, damage, 0f, Main.myPlayer, 2f, 0f); + } + else if (calamityGlobalNPC.newAI[3] < 600f) // Blasts from left and right + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -(projSpeed - 0.5f), 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), projSpeed - 0.5f, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); + } + else // Blasts from above, left, and right + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed - 1f, type, damage, 0f, Main.myPlayer, 2f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -(projSpeed - 1f), 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), projSpeed - 1f, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); + } + } + } + } + + NPC.alpha = NPC.dontTakeDamage ? 255 : 0; + + // Float above target and fire hellfireballs + if (NPC.ai[1] == 0f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.ai[2] += 1f; + float phaseTimer = 400f - (death ? 120f * (1f - lifeRatio) : 0f); + if (NPC.ai[2] >= phaseTimer || phase4) + { + if (death && !phase4 && Main.rand.NextBool() && !brotherAlive) + NPC.ai[1] = 4f; + else + NPC.ai[1] = 1f; + + NPC.ai[2] = 0f; + if (death) + NPC.localAI[0] = 1f; + + NPC.netUpdate = true; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.localAI[1] += 1f; + if (!brotherAlive) + { + if (expertMode) + NPC.localAI[1] += death ? 2f * (1f - lifeRatio) : 1f - lifeRatio; + if (revenge) + NPC.localAI[1] += 0.5f; + } + + if (NPC.localAI[1] >= (brotherAlive ? 180f : 120f)) + { + NPC.localAI[1] = 0f; + SoundEngine.PlaySound(BrimstoneElemental.BrimstoneElemental.HellfireballSound, NPC.Center); + + float projectileVelocity = expertMode ? 14f : 12.5f; + projectileVelocity += 3f * enrageScale; + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + bool shootPredictiveShot = CalamityWorld.LegendaryMode && CalamityWorld.revenge && Main.rand.NextBool(); + Vector2 predictionVector = shootPredictiveShot ? player.velocity * 20f : Vector2.Zero; + Vector2 fireballVelocity = Vector2.Normalize(player.Center + predictionVector - NPC.Center) * projectileVelocity; + Vector2 offset = Vector2.Normalize(fireballVelocity) * 40f; + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, fireballVelocity, type, damage, 0f, Main.myPlayer, player.position.X, player.position.Y); + Main.projectile[proj].netUpdate = true; + } + } + } + + // Float to the side of the target and fire + else if (NPC.ai[1] == 1f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.localAI[1] += 1f; + if (!brotherAlive) + { + if (revenge) + NPC.localAI[1] += 0.5f; + if (expertMode) + NPC.localAI[1] += 0.5f; + } + + if (NPC.localAI[1] >= (brotherAlive ? 75f : 50f) && Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) + { + NPC.localAI[1] = 0f; + + float projectileVelocity = expertMode ? 12.5f : 11f; + projectileVelocity += 3f * enrageScale; + int type = brotherAlive ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + Vector2 fireballVelocity = Vector2.Normalize(player.Center - NPC.Center) * projectileVelocity; + Vector2 offset = Vector2.Normalize(fireballVelocity) * 40f; + + if (!Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) + { + type = ModContent.ProjectileType(); + damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, fireballVelocity, type, damage, 0f, Main.myPlayer, player.position.X, player.position.Y); + } + else + { + float ai0 = type == ModContent.ProjectileType() ? 1f : player.position.X; + float ai1 = type == ModContent.ProjectileType() ? 0f : player.position.Y; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, fireballVelocity, type, damage, 0f, Main.myPlayer, ai0, ai1); + } + } + } + + NPC.ai[2] += 1f; + float phaseTimer = 240f - (death ? 60f * (1f - lifeRatio) : 0f); + if (NPC.ai[2] >= phaseTimer || phase4) + { + if (death && !phase4 && Main.rand.NextBool() && !brotherAlive) + NPC.ai[1] = 0f; + else + NPC.ai[1] = !brotherAlive && phase2 && revenge ? 4f : 0f; + + NPC.ai[2] = 0f; + if (death) + NPC.localAI[0] = 1f; + + NPC.netUpdate = true; + } + } + else if (NPC.ai[1] == 2f) + { + // Set damage + NPC.damage = NPC.defDamage; + SoundEngine.PlaySound(CalamitasClone.ChargeSound, NPC.Center); + NPC.rotation = rotation; + + float chargeVelocity = phase4 ? 30f : death ? 28f : 25f; + chargeVelocity += 5f * enrageScale; + + Vector2 vector = Vector2.Normalize(player.Center + (phase4 && bossRush ? player.velocity * 20f : Vector2.Zero) - NPC.Center); + NPC.velocity = vector * chargeVelocity; + + NPC.ai[1] = 3f; + NPC.netUpdate = true; + } + else if (NPC.ai[1] == 3f) + { + // Set damage + NPC.damage = NPC.defDamage; + + NPC.ai[2] += 1f; + + float chargeTime = phase4 ? 35f : death ? 40f : 45f; + if (NPC.ai[2] >= chargeTime) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.velocity *= 0.9f; + if (NPC.velocity.X > -0.1 && NPC.velocity.X < 0.1) + NPC.velocity.X = 0f; + if (NPC.velocity.Y > -0.1 && NPC.velocity.Y < 0.1) + NPC.velocity.Y = 0f; + } + else + { + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) - MathHelper.PiOver2; + + // Leave behind slow hellblasts in Death Mode + if (Main.netMode != NetmodeID.MultiplayerClient && death && phase3 && NPC.ai[2] % (phase4 ? 6f : 10f) == 0f) + { + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + Vector2 fireballVelocity = CalamityWorld.LegendaryMode ? Main.rand.NextVector2CircularEdge(0.02f, 0.02f) : NPC.velocity * 0.01f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, fireballVelocity, type, damage, 0f, Main.myPlayer, 1f, 0f); + } + } + + if (NPC.ai[2] >= chargeTime + 10f) + { + if (!phase4) + NPC.ai[3] += 1f; + + NPC.ai[2] = 0f; + + NPC.rotation = rotation; + NPC.netUpdate = true; + + if (NPC.ai[3] >= 2f) + { + NPC.TargetClosest(); + NPC.ai[1] = 0f; + NPC.ai[3] = 0f; + return; + } + + NPC.ai[1] = 4f; + } + } + else + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.ai[2] += 1f; + if (NPC.ai[2] >= (phase4 ? 15f : 30f)) + { + NPC.ai[1] = 2f; + NPC.ai[2] = 0f; + if (death) + NPC.localAI[0] = 1f; + + NPC.netUpdate = true; + } + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) diff --git a/NPCs/CalClone/Cataclysm.cs b/NPCs/CalClone/Cataclysm.cs index bec5c00aa9..a5cc956364 100644 --- a/NPCs/CalClone/Cataclysm.cs +++ b/NPCs/CalClone/Cataclysm.cs @@ -4,11 +4,12 @@ using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; +using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; +using System; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -109,7 +110,337 @@ namespace CalamityMod.NPCs.CalClone public override void AI() { - CalamitasCloneAI.VanillaCataclysmAI(NPC, Mod); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + + if (CalamityGlobalNPC.calamitas < 0 || !Main.npc[CalamityGlobalNPC.calamitas].active) + { + if (NPC.alpha < 255) + { + NPC.velocity *= 0.9f; + + NPC.alpha += 2; + if (NPC.alpha > 255) + NPC.alpha = 255; + + int dustAmount = (int)Math.Round(MathHelper.Lerp(1f, 5f, (255 - NPC.alpha) / 255f)); + for (int i = 0; i < dustAmount; i++) + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.LifeDrain, 0f, -1f, 90, default, Main.rand.NextFloat(0.5f, 2f)); + Main.dust[dust].noGravity = true; + Main.dust[dust].fadeIn = 1f; + } + } + else + NPC.active = false; + + NPC.active = false; + return; + } + + // Percent life remaining + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + CalamityGlobalNPC.cataclysm = NPC.whoAmI; + + // Emit light + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 1f, 0f, 0f); + + bool bossRush = BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool expertMode = Main.expertMode || bossRush; + + // Get a target + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); + + Player player = Main.player[NPC.target]; + + float enrageScale = bossRush ? 1f : 0f; + if (Main.IsItDay() || bossRush) + { + NPC.Calamity().CurrentlyEnraged = !bossRush; + enrageScale += 2f; + } + + float calCloneBroPlayerXDist = NPC.position.X + (NPC.width / 2) - player.position.X - (player.width / 2); + float calCloneBroPlayerYDist = NPC.position.Y + NPC.height - 59f - player.position.Y - (player.height / 2); + float calCloneBroRotation = (float)Math.Atan2(calCloneBroPlayerYDist, calCloneBroPlayerXDist) + MathHelper.PiOver2; + if (calCloneBroRotation < 0f) + calCloneBroRotation += MathHelper.TwoPi; + else if (calCloneBroRotation > MathHelper.TwoPi) + calCloneBroRotation -= MathHelper.TwoPi; + + float calCloneBroRotationSpeed = 0.15f; + if (NPC.rotation < calCloneBroRotation) + { + if ((calCloneBroRotation - NPC.rotation) > MathHelper.Pi) + NPC.rotation -= calCloneBroRotationSpeed; + else + NPC.rotation += calCloneBroRotationSpeed; + } + else if (NPC.rotation > calCloneBroRotation) + { + if ((NPC.rotation - calCloneBroRotation) > MathHelper.Pi) + NPC.rotation += calCloneBroRotationSpeed; + else + NPC.rotation -= calCloneBroRotationSpeed; + } + + if (NPC.rotation > calCloneBroRotation - calCloneBroRotationSpeed && NPC.rotation < calCloneBroRotation + calCloneBroRotationSpeed) + NPC.rotation = calCloneBroRotation; + if (NPC.rotation < 0f) + NPC.rotation += MathHelper.TwoPi; + else if (NPC.rotation > MathHelper.TwoPi) + NPC.rotation -= MathHelper.TwoPi; + if (NPC.rotation > calCloneBroRotation - calCloneBroRotationSpeed && NPC.rotation < calCloneBroRotation + calCloneBroRotationSpeed) + NPC.rotation = calCloneBroRotation; + + if (!player.active || player.dead) + { + NPC.TargetClosest(false); + player = Main.player[NPC.target]; + if (!player.active || player.dead) + { + if (NPC.velocity.Y > 3f) + NPC.velocity.Y = 3f; + NPC.velocity.Y -= 0.1f; + if (NPC.velocity.Y < -12f) + NPC.velocity.Y = -12f; + + if (NPC.timeLeft > 60) + NPC.timeLeft = 60; + + if (NPC.ai[1] != 0f) + { + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; + } + + return; + } + } + + if (NPC.ai[1] == 0f) + { + // Avoid cheap bullshit + NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); + + float calCloneBroProjAttackMaxSpeed = 5f; + float calCloneBroProjAttackAccel = 0.1f; + calCloneBroProjAttackMaxSpeed += 2f * enrageScale; + calCloneBroProjAttackAccel += 0.06f * enrageScale; + + if (Main.getGoodWorld) + { + calCloneBroProjAttackMaxSpeed *= 1.15f; + calCloneBroProjAttackAccel *= 1.15f; + } + + int calCloneBroProjAttackDirection = 1; + if (NPC.position.X + (NPC.width / 2) < player.position.X + player.width) + calCloneBroProjAttackDirection = -1; + + Vector2 calCloneBroProjLocation = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + float calCloneBroProjTargetX = player.position.X + (player.width / 2) + (calCloneBroProjAttackDirection * 180) - calCloneBroProjLocation.X; + float calCloneBroProjTargetY = player.position.Y + (player.height / 2) - calCloneBroProjLocation.Y; + float calCloneBroProjTargetDist = (float)Math.Sqrt(calCloneBroProjTargetX * calCloneBroProjTargetX + calCloneBroProjTargetY * calCloneBroProjTargetY); + + if (expertMode) + { + if (calCloneBroProjTargetDist > 300f) + calCloneBroProjAttackMaxSpeed += 0.5f; + if (calCloneBroProjTargetDist > 400f) + calCloneBroProjAttackMaxSpeed += 0.5f; + if (calCloneBroProjTargetDist > 500f) + calCloneBroProjAttackMaxSpeed += 0.55f; + if (calCloneBroProjTargetDist > 600f) + calCloneBroProjAttackMaxSpeed += 0.55f; + if (calCloneBroProjTargetDist > 700f) + calCloneBroProjAttackMaxSpeed += 0.6f; + if (calCloneBroProjTargetDist > 800f) + calCloneBroProjAttackMaxSpeed += 0.6f; + } + + calCloneBroProjTargetDist = calCloneBroProjAttackMaxSpeed / calCloneBroProjTargetDist; + calCloneBroProjTargetX *= calCloneBroProjTargetDist; + calCloneBroProjTargetY *= calCloneBroProjTargetDist; + + if (NPC.velocity.X < calCloneBroProjTargetX) + { + NPC.velocity.X += calCloneBroProjAttackAccel; + if (NPC.velocity.X < 0f && calCloneBroProjTargetX > 0f) + NPC.velocity.X += calCloneBroProjAttackAccel; + } + else if (NPC.velocity.X > calCloneBroProjTargetX) + { + NPC.velocity.X -= calCloneBroProjAttackAccel; + if (NPC.velocity.X > 0f && calCloneBroProjTargetX < 0f) + NPC.velocity.X -= calCloneBroProjAttackAccel; + } + if (NPC.velocity.Y < calCloneBroProjTargetY) + { + NPC.velocity.Y += calCloneBroProjAttackAccel; + if (NPC.velocity.Y < 0f && calCloneBroProjTargetY > 0f) + NPC.velocity.Y += calCloneBroProjAttackAccel; + } + else if (NPC.velocity.Y > calCloneBroProjTargetY) + { + NPC.velocity.Y -= calCloneBroProjAttackAccel; + if (NPC.velocity.Y > 0f && calCloneBroProjTargetY < 0f) + NPC.velocity.Y -= calCloneBroProjAttackAccel; + } + + NPC.ai[2] += 1f; + if (NPC.ai[2] >= (240f - (death ? 120f * (1f - lifeRatio) : 0f))) + { + NPC.ai[1] = 1f; + NPC.ai[2] = 0f; + NPC.target = 255; + NPC.netUpdate = true; + } + + bool fireDelay = NPC.ai[2] > 120f || NPC.life < NPC.lifeMax * 0.9; + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height) && fireDelay) + { + if (NPC.localAI[2] == 0f) + SoundEngine.PlaySound(Cataclysm.FlamethrowerStart, NPC.Center); + + NPC.localAI[2] += 1f; + if (NPC.localAI[2] > 30f) + { + NPC.localAI[2] = 1f; + SoundEngine.PlaySound(Cataclysm.FlamethrowerLoop, NPC.Center); + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.localAI[1] += 3f; + if (revenge) + NPC.localAI[1] += 1f; + + if (NPC.localAI[1] > 12f) + { + NPC.localAI[1] = 0f; + float calCloneBroProjSpeed = NPC.AnyNPCs(ModContent.NPCType()) ? 4f : 6f; + calCloneBroProjSpeed += enrageScale; + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + calCloneBroProjLocation = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + calCloneBroProjTargetX = player.position.X + (player.width / 2) - calCloneBroProjLocation.X; + calCloneBroProjTargetY = player.position.Y + (player.height / 2) - calCloneBroProjLocation.Y; + calCloneBroProjTargetDist = (float)Math.Sqrt(calCloneBroProjTargetX * calCloneBroProjTargetX + calCloneBroProjTargetY * calCloneBroProjTargetY); + calCloneBroProjTargetDist = calCloneBroProjSpeed / calCloneBroProjTargetDist; + calCloneBroProjTargetX *= calCloneBroProjTargetDist; + calCloneBroProjTargetY *= calCloneBroProjTargetDist; + calCloneBroProjTargetY += NPC.velocity.Y * 0.5f; + calCloneBroProjTargetX += NPC.velocity.X * 0.5f; + calCloneBroProjLocation.X -= calCloneBroProjTargetX; + calCloneBroProjLocation.Y -= calCloneBroProjTargetY; + Projectile.NewProjectile(NPC.GetSource_FromAI(), calCloneBroProjLocation.X, calCloneBroProjLocation.Y, calCloneBroProjTargetX, calCloneBroProjTargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + else + { + if (NPC.ai[1] == 1f) + { + // Set damage + NPC.damage = NPC.defDamage; + + SoundEngine.PlaySound(SoundID.Roar, NPC.Center); + NPC.rotation = calCloneBroRotation; + + float calCloneBroChargeSpeed = 14f + (death ? 4f * (1f - lifeRatio) : 0f); + calCloneBroChargeSpeed += 3f * enrageScale; + if (expertMode) + calCloneBroChargeSpeed += 2f; + if (revenge) + calCloneBroChargeSpeed += 2f; + if (Main.getGoodWorld) + calCloneBroChargeSpeed *= 1.25f; + + Vector2 calCloneBroChargeCenter = NPC.Center; + float calCloneBroChargeTargetXDist = player.Center.X - calCloneBroChargeCenter.X; + float calCloneBroChargeTargetYDist = player.Center.Y - calCloneBroChargeCenter.Y; + float calCloneBroChargeTargetDistance = (float)Math.Sqrt(calCloneBroChargeTargetXDist * calCloneBroChargeTargetXDist + calCloneBroChargeTargetYDist * calCloneBroChargeTargetYDist); + calCloneBroChargeTargetDistance = calCloneBroChargeSpeed / calCloneBroChargeTargetDistance; + NPC.velocity.X = calCloneBroChargeTargetXDist * calCloneBroChargeTargetDistance; + NPC.velocity.Y = calCloneBroChargeTargetYDist * calCloneBroChargeTargetDistance; + NPC.ai[1] = 2f; + + if (Main.zenithWorld) + { + SoundEngine.PlaySound(SupremeCalamitas.SupremeCalamitas.BrimstoneShotSound, NPC.Center); + + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(ModContent.ProjectileType()); + if (bossRush) + damage /= 2; + + int totalProjectiles = bossRush ? 12 : death ? 10 : revenge ? 8 : expertMode ? 6 : 4; + float radians = MathHelper.TwoPi / totalProjectiles; + float velocity = 5f; + Vector2 spinningPoint = new Vector2(0f, -velocity); + float projectileVelocityToPass = velocity * 3f; + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 0f, projectileVelocityToPass); + } + + for (int i = 0; i < 6; i++) + Dust.NewDust(NPC.position + NPC.velocity, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f); + } + return; + } + + if (NPC.ai[1] == 2f) + { + // Set damage + NPC.damage = NPC.defDamage; + + NPC.ai[2] += 1f + (death ? 0.5f * (1f - lifeRatio) : 0f); + if (expertMode) + NPC.ai[2] += 0.25f; + if (revenge) + NPC.ai[2] += 0.25f; + + if (NPC.ai[2] >= 75f) + { + // Avoid cheap bullshit + NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); + + NPC.velocity.X *= 0.93f; + NPC.velocity.Y *= 0.93f; + + if (NPC.velocity.X > -0.1 && NPC.velocity.X < 0.1) + NPC.velocity.X = 0f; + if (NPC.velocity.Y > -0.1 && NPC.velocity.Y < 0.1) + NPC.velocity.Y = 0f; + } + else + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) - MathHelper.PiOver2; + + if (NPC.ai[2] >= 105f) + { + NPC.ai[3] += 1f; + NPC.ai[2] = 0f; + NPC.target = 255; + NPC.rotation = calCloneBroRotation; + if (NPC.ai[3] >= 3f) + { + NPC.ai[1] = 0f; + NPC.ai[3] = 0f; + return; + } + NPC.ai[1] = 1f; + } + } + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) diff --git a/NPCs/CalClone/Catastrophe.cs b/NPCs/CalClone/Catastrophe.cs index dcae21a2da..73e07ab8e3 100644 --- a/NPCs/CalClone/Catastrophe.cs +++ b/NPCs/CalClone/Catastrophe.cs @@ -4,12 +4,14 @@ using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; +using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; +using System; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; @@ -103,7 +105,332 @@ namespace CalamityMod.NPCs.CalClone public override void AI() { - CalamitasCloneAI.VanillaCatastropheAI(NPC, Mod); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + + if (CalamityGlobalNPC.calamitas < 0 || !Main.npc[CalamityGlobalNPC.calamitas].active) + { + if (NPC.alpha < 255) + { + NPC.velocity *= 0.9f; + + NPC.alpha += 2; + if (NPC.alpha > 255) + NPC.alpha = 255; + + int dustAmount = (int)Math.Round(MathHelper.Lerp(1f, 5f, (255 - NPC.alpha) / 255f)); + for (int i = 0; i < dustAmount; i++) + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.LifeDrain, 0f, -1f, 90, default, Main.rand.NextFloat(0.5f, 2f)); + Main.dust[dust].noGravity = true; + Main.dust[dust].fadeIn = 1f; + } + } + else + NPC.active = false; + + return; + } + + // Percent life remaining + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + CalamityGlobalNPC.catastrophe = NPC.whoAmI; + + // Emit light + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 1f, 0f, 0f); + + bool bossRush = BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool expertMode = Main.expertMode || bossRush; + + // Get a target + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); + + Player player = Main.player[NPC.target]; + + float enrageScale = bossRush ? 1f : 0f; + if (Main.IsItDay() || bossRush) + { + NPC.Calamity().CurrentlyEnraged = !bossRush; + enrageScale += 2f; + } + + float calCloneBroPlayerXDist = NPC.position.X + (NPC.width / 2) - player.position.X - (player.width / 2); + float calCloneBroPlayerYDist = NPC.position.Y + NPC.height - 59f - player.position.Y - (player.height / 2); + float calCloneBroRotation = (float)Math.Atan2(calCloneBroPlayerYDist, calCloneBroPlayerXDist) + MathHelper.PiOver2; + if (calCloneBroRotation < 0f) + calCloneBroRotation += MathHelper.TwoPi; + else if (calCloneBroRotation > MathHelper.TwoPi) + calCloneBroRotation -= MathHelper.TwoPi; + + float calCloneBroRotationSpeed = 0.15f; + if (NPC.rotation < calCloneBroRotation) + { + if ((calCloneBroRotation - NPC.rotation) > MathHelper.Pi) + NPC.rotation -= calCloneBroRotationSpeed; + else + NPC.rotation += calCloneBroRotationSpeed; + } + else if (NPC.rotation > calCloneBroRotation) + { + if ((NPC.rotation - calCloneBroRotation) > MathHelper.Pi) + NPC.rotation += calCloneBroRotationSpeed; + else + NPC.rotation -= calCloneBroRotationSpeed; + } + + if (NPC.rotation > calCloneBroRotation - calCloneBroRotationSpeed && NPC.rotation < calCloneBroRotation + calCloneBroRotationSpeed) + NPC.rotation = calCloneBroRotation; + if (NPC.rotation < 0f) + NPC.rotation += MathHelper.TwoPi; + else if (NPC.rotation > MathHelper.TwoPi) + NPC.rotation -= MathHelper.TwoPi; + if (NPC.rotation > calCloneBroRotation - calCloneBroRotationSpeed && NPC.rotation < calCloneBroRotation + calCloneBroRotationSpeed) + NPC.rotation = calCloneBroRotation; + + if (!player.active || player.dead) + { + NPC.TargetClosest(false); + player = Main.player[NPC.target]; + if (!player.active || player.dead) + { + if (NPC.velocity.Y > 3f) + NPC.velocity.Y = 3f; + NPC.velocity.Y -= 0.1f; + if (NPC.velocity.Y < -12f) + NPC.velocity.Y = -12f; + + if (NPC.timeLeft > 60) + NPC.timeLeft = 60; + + if (NPC.ai[1] != 0f) + { + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; + } + + return; + } + } + + if (NPC.ai[1] == 0f) + { + // Avoid cheap bullshit + NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); + + float calCloneBroProjAttackMaxSpeed = 4.5f; + float calCloneBroProjAttackAccel = 0.2f; + calCloneBroProjAttackMaxSpeed += 2f * enrageScale; + calCloneBroProjAttackAccel += 0.1f * enrageScale; + + if (Main.getGoodWorld) + { + calCloneBroProjAttackMaxSpeed *= 1.15f; + calCloneBroProjAttackAccel *= 1.15f; + } + + int calCloneBroProjAttackDirection = 1; + if (NPC.Center.X < player.Center.X) + calCloneBroProjAttackDirection = -1; + + Vector2 calCloneBroProjLocation = NPC.Center; + float calCloneBroProjTargetX = player.Center.X + (calCloneBroProjAttackDirection * 180) - calCloneBroProjLocation.X; + float calCloneBroProjTargetY = player.Center.Y - calCloneBroProjLocation.Y; + float calCloneBroProjTargetDist = (float)Math.Sqrt(calCloneBroProjTargetX * calCloneBroProjTargetX + calCloneBroProjTargetY * calCloneBroProjTargetY); + + if (expertMode) + { + if (calCloneBroProjTargetDist > 300f) + calCloneBroProjAttackMaxSpeed += 0.5f; + if (calCloneBroProjTargetDist > 400f) + calCloneBroProjAttackMaxSpeed += 0.5f; + if (calCloneBroProjTargetDist > 500f) + calCloneBroProjAttackMaxSpeed += 0.55f; + if (calCloneBroProjTargetDist > 600f) + calCloneBroProjAttackMaxSpeed += 0.55f; + if (calCloneBroProjTargetDist > 700f) + calCloneBroProjAttackMaxSpeed += 0.6f; + if (calCloneBroProjTargetDist > 800f) + calCloneBroProjAttackMaxSpeed += 0.6f; + } + + calCloneBroProjTargetDist = calCloneBroProjAttackMaxSpeed / calCloneBroProjTargetDist; + calCloneBroProjTargetX *= calCloneBroProjTargetDist; + calCloneBroProjTargetY *= calCloneBroProjTargetDist; + + if (NPC.velocity.X < calCloneBroProjTargetX) + { + NPC.velocity.X += calCloneBroProjAttackAccel; + if (NPC.velocity.X < 0f && calCloneBroProjTargetX > 0f) + NPC.velocity.X += calCloneBroProjAttackAccel; + } + else if (NPC.velocity.X > calCloneBroProjTargetX) + { + NPC.velocity.X -= calCloneBroProjAttackAccel; + if (NPC.velocity.X > 0f && calCloneBroProjTargetX < 0f) + NPC.velocity.X -= calCloneBroProjAttackAccel; + } + if (NPC.velocity.Y < calCloneBroProjTargetY) + { + NPC.velocity.Y += calCloneBroProjAttackAccel; + if (NPC.velocity.Y < 0f && calCloneBroProjTargetY > 0f) + NPC.velocity.Y += calCloneBroProjAttackAccel; + } + else if (NPC.velocity.Y > calCloneBroProjTargetY) + { + NPC.velocity.Y -= calCloneBroProjAttackAccel; + if (NPC.velocity.Y > 0f && calCloneBroProjTargetY < 0f) + NPC.velocity.Y -= calCloneBroProjAttackAccel; + } + + NPC.ai[2] += 1f; + if (NPC.ai[2] >= (180f - (death ? 90f * (1f - lifeRatio) : 0f))) + { + NPC.ai[1] = 1f; + NPC.ai[2] = 0f; + NPC.target = 255; + NPC.netUpdate = true; + } + + bool fireDelay = NPC.ai[2] > 120f || lifeRatio < 0.9f; + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height) && fireDelay) + { + NPC.localAI[2] += 1f; + if (NPC.localAI[2] > 36f) + { + NPC.localAI[2] = 0f; + SoundEngine.PlaySound(SoundID.Item34, NPC.Center); + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.localAI[1] += 1f; + if (revenge) + NPC.localAI[1] += 0.5f; + + if (NPC.localAI[1] > 50f) + { + NPC.localAI[1] = 0f; + float calCloneBroProjSpeed = death ? 14f : 12f; + calCloneBroProjSpeed += 3f * enrageScale; + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + calCloneBroProjLocation = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + calCloneBroProjTargetX = player.position.X + (player.width / 2) - calCloneBroProjLocation.X; + calCloneBroProjTargetY = player.position.Y + (player.height / 2) - calCloneBroProjLocation.Y; + calCloneBroProjTargetDist = (float)Math.Sqrt(calCloneBroProjTargetX * calCloneBroProjTargetX + calCloneBroProjTargetY * calCloneBroProjTargetY); + calCloneBroProjTargetDist = calCloneBroProjSpeed / calCloneBroProjTargetDist; + calCloneBroProjTargetX *= calCloneBroProjTargetDist; + calCloneBroProjTargetY *= calCloneBroProjTargetDist; + calCloneBroProjTargetY += NPC.velocity.Y * 0.5f; + calCloneBroProjTargetX += NPC.velocity.X * 0.5f; + calCloneBroProjLocation.X -= calCloneBroProjTargetX; + calCloneBroProjLocation.Y -= calCloneBroProjTargetY; + Projectile.NewProjectile(NPC.GetSource_FromAI(), calCloneBroProjLocation.X, calCloneBroProjLocation.Y, calCloneBroProjTargetX, calCloneBroProjTargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + else + { + if (NPC.ai[1] == 1f) + { + // Set damage + NPC.damage = NPC.defDamage; + + SoundEngine.PlaySound(SoundID.Roar, NPC.Center); + NPC.rotation = calCloneBroRotation; + + float calCloneBroChargeSpeed = (NPC.AnyNPCs(ModContent.NPCType()) ? 12f : 16f) + (death ? 4f * (1f - lifeRatio) : 0f); + calCloneBroChargeSpeed += 4f * enrageScale; + if (expertMode) + calCloneBroChargeSpeed += 2f; + if (revenge) + calCloneBroChargeSpeed += 2f; + if (Main.getGoodWorld) + calCloneBroChargeSpeed *= 1.25f; + + Vector2 calCloneBroChargeCenter = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + float calCloneBroChargeTargetXDist = player.position.X + (player.width / 2) - calCloneBroChargeCenter.X; + float calCloneBroChargeTargetYDist = player.position.Y + (player.height / 2) - calCloneBroChargeCenter.Y; + float calCloneBroChargeTargetDistance = (float)Math.Sqrt(calCloneBroChargeTargetXDist * calCloneBroChargeTargetXDist + calCloneBroChargeTargetYDist * calCloneBroChargeTargetYDist); + calCloneBroChargeTargetDistance = calCloneBroChargeSpeed / calCloneBroChargeTargetDistance; + NPC.velocity.X = calCloneBroChargeTargetXDist * calCloneBroChargeTargetDistance; + NPC.velocity.Y = calCloneBroChargeTargetYDist * calCloneBroChargeTargetDistance; + NPC.ai[1] = 2f; + + if (Main.zenithWorld) + { + SoundEngine.PlaySound(SupremeCalamitas.SupremeCalamitas.BrimstoneShotSound, NPC.Center); + + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(ModContent.ProjectileType()); + if (bossRush) + damage /= 2; + + int totalProjectiles = bossRush ? 12 : death ? 10 : revenge ? 8 : expertMode ? 6 : 4; + float radians = MathHelper.TwoPi / totalProjectiles; + float velocity = 5f; + Vector2 spinningPoint = new Vector2(0f, -velocity); + float projectileVelocityToPass = velocity * 3f; + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 0f, projectileVelocityToPass); + } + + for (int i = 0; i < 6; i++) + Dust.NewDust(NPC.position + NPC.velocity, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f); + } + return; + } + + if (NPC.ai[1] == 2f) + { + // Set damage + NPC.damage = NPC.defDamage; + + NPC.ai[2] += 1f + (death ? 0.5f * (1f - lifeRatio) : 0f); + if (expertMode) + NPC.ai[2] += 0.25f; + if (revenge) + NPC.ai[2] += 0.25f; + + if (NPC.ai[2] >= 60f) //50 + { + // Avoid cheap bullshit + NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); + + NPC.velocity.X *= 0.93f; + NPC.velocity.Y *= 0.93f; + + if (NPC.velocity.X > -0.1 && NPC.velocity.X < 0.1) + NPC.velocity.X = 0f; + if (NPC.velocity.Y > -0.1 && NPC.velocity.Y < 0.1) + NPC.velocity.Y = 0f; + } + else + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) - MathHelper.PiOver2; + + if (NPC.ai[2] >= 90f) //80 + { + NPC.ai[3] += 1f; + NPC.ai[2] = 0f; + NPC.rotation = calCloneBroRotation; + if (NPC.ai[3] >= 4f) + { + NPC.ai[1] = 0f; + NPC.ai[3] = 0f; + return; + } + NPC.ai[1] = 1f; + } + } + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) diff --git a/NPCs/CalamityAIs/CalamityBossAIs/AstrumAureusAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/AstrumAureusAI.cs deleted file mode 100644 index e7e3f546bb..0000000000 --- a/NPCs/CalamityAIs/CalamityBossAIs/AstrumAureusAI.cs +++ /dev/null @@ -1,969 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.CalPlayer; -using CalamityMod.Dusts; -using CalamityMod.Events; -using CalamityMod.NPCs.Abyss; -using CalamityMod.NPCs.AquaticScourge; -using CalamityMod.NPCs.AstrumAureus; -using CalamityMod.NPCs.AstrumDeus; -using CalamityMod.NPCs.BrimstoneElemental; -using CalamityMod.NPCs.Bumblebirb; -using CalamityMod.NPCs.CalClone; -using CalamityMod.NPCs.CeaselessVoid; -using CalamityMod.NPCs.Crags; -using CalamityMod.NPCs.NormalNPCs; -using CalamityMod.NPCs.OldDuke; -using CalamityMod.NPCs.SulphurousSea; -using CalamityMod.NPCs.SunkenSea; -using CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies; -using CalamityMod.Projectiles.Boss; -using CalamityMod.Projectiles.Enemy; -using CalamityMod.Sounds; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs -{ - public static class AstrumAureusAI - { - public static void VanillaAstrumAureusAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - CalamityGlobalNPC.astrumAureus = npc.whoAmI; - - // Variables - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - // Phases - bool phase2 = lifeRatio < (revenge ? 0.85f : expertMode ? 0.8f : 0.75f); - bool phase3 = lifeRatio < (revenge ? 0.7f : expertMode ? 0.6f : 0.5f); - bool phase4 = lifeRatio < (revenge ? 0.5f : 0.4f) && expertMode; - bool phase5 = lifeRatio < 0.3f && revenge; - - // Exhaustion - bool exhausted = npc.ai[2] >= (phase3 ? 2f : 1f); - calamityGlobalNPC.DR = exhausted ? 0.2f : 0.4f; - npc.defense = exhausted ? npc.defDefense / 2 : npc.defDefense; - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); - - // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); - - Player player = Main.player[npc.target]; - - // Don't fire projectiles and don't increment phase timers for 4 seconds after the teleport phase to avoid cheap bullshit - float noProjectileOrPhaseIncrementTime = 240f; - - bool dontAttack = npc.localAI[3] > 0f; - if (dontAttack) - { - npc.localAI[3] -= 1f; - if (npc.Distance(player.Center) < 240f) - npc.localAI[3] -= death ? 4f : expertMode ? 2f : 1f; - } - - float enrageScale = bossRush ? 1f : 0f; - if ((Main.IsItDay() && !player.Calamity().ZoneAstral) || bossRush) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 1f; - } - - float astralFlameBarrageTimerIncrement = 1f; - if (expertMode) - astralFlameBarrageTimerIncrement += death ? (float)Math.Round(3f * (1f - lifeRatio)) : (float)Math.Round(2f * (1f - lifeRatio)); - - float walkingVelocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 6f : 5f; - walkingVelocity += 3f * enrageScale; - if (phase5) - walkingVelocity += 2f; - if (expertMode) - walkingVelocity += 1.5f * (1f - lifeRatio); - if (revenge) - walkingVelocity += Math.Abs(npc.Center.X - player.Center.X) * 0.0025f; - if (Main.getGoodWorld) - walkingVelocity *= 1.15f; - - float walkingProjectileVelocity = walkingVelocity * 0.8f; - - // Direction - npc.spriteDirection = (npc.direction > 0) ? 1 : -1; - - // Used to reduce Aureus' fall speed - bool reduceFallSpeed = npc.velocity.Y > 0f && Collision.SolidCollision(npc.position + Vector2.UnitY * 1.1f * npc.velocity.Y, npc.width, npc.height) && npc.ai[0] == 4f; - - // Despawn - bool despawnDistance = Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles; - if (!player.active || player.dead || despawnDistance) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead || despawnDistance) - { - npc.noTileCollide = true; - - if (npc.velocity.Y < -3f) - npc.velocity.Y = -3f; - npc.velocity.Y += 0.1f; - if (npc.velocity.Y > 12f) - npc.velocity.Y = 12f; - - if (npc.timeLeft > 60) - npc.timeLeft = 60; - - if (npc.ai[0] != 0f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.localAI[2] = 0f; - npc.localAI[3] = 0f; - calamityGlobalNPC.newAI[0] = 0f; - calamityGlobalNPC.newAI[1] = 0f; - npc.netUpdate = true; - } - return; - } - } - else if (npc.timeLeft < 1800) - npc.timeLeft = 1800; - - bool geldonPhase1 = lifeRatio > 0.6f && lifeRatio <= 0.7f; - bool geldonPhase2 = lifeRatio <= 0.1f; - if (Main.zenithWorld && (geldonPhase1 || geldonPhase2)) - { - AstrumAureus.AstrumAureus astrumAureus = npc.ModNPC(); - astrumAureus.slimeProjCounter++; - if (astrumAureus.slimeProjCounter % 180 == 0) - { - SoundEngine.PlaySound(SoundID.Item33, npc.Center); // Intentionally keeping the old laser sound in GFB - - if (astrumAureus.slimePhase == 1) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - int totalProjectiles = bossRush ? 14 : death ? 12 : revenge ? 10 : expertMode ? 8 : 6; - float radians = MathHelper.TwoPi / totalProjectiles; - float velocity = 10f; - Vector2 spinningPoint = new Vector2(0f, -velocity); - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 1f); - } - } - astrumAureus.slimePhase = 0; - } - else - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - float aureusLaserSpeed = 7f; - float aureusLaserTargetX = player.Center.X - npc.Center.X; - float aureusLaserTargetY = player.Center.Y - npc.Center.Y; - float aureusLaserTargetDist = (float)Math.Sqrt(aureusLaserTargetX * aureusLaserTargetX + aureusLaserTargetY * aureusLaserTargetY); - aureusLaserTargetDist = aureusLaserSpeed / aureusLaserTargetDist; - aureusLaserTargetX *= aureusLaserTargetDist; - aureusLaserTargetY *= aureusLaserTargetDist; - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, aureusLaserTargetX, aureusLaserTargetY, type, damage, 0f, Main.myPlayer); - for (int i = 0; i < 4; i++) - { - Vector2 offset = new Vector2(Main.rand.Next(-6, 7), Main.rand.Next(-6, 7)); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, aureusLaserTargetX + offset.X, aureusLaserTargetY + offset.Y, type, damage, 0f, Main.myPlayer); - } - } - astrumAureus.slimePhase = 1; - } - } - RevengeanceAndDeathAI.BuffedMimicAI(npc, mod); - npc.noGravity = false; - npc.noTileCollide = false; - return; - } - else - { - npc.noGravity = true; - } - - // Emit light when not Idle - if (npc.ai[0] != 1f) - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1.3f, 0.5f, 0f); - - // Fire projectiles while walking, teleporting, or falling - if (npc.ai[0] == 2f || npc.ai[0] >= 5f) - { - if (!dontAttack) - npc.localAI[0] += npc.ai[0] == 2f ? 1f : astralFlameBarrageTimerIncrement; - - float astralFlameBarrageGateValue = phase4 ? 30f : 60f; - if (npc.localAI[0] >= astralFlameBarrageGateValue) - { - // Fire astral flames while teleporting - if (npc.ai[0] >= 5f && npc.ai[0] != 7) - { - npc.localAI[0] = 0f; - SoundEngine.PlaySound(AstrumAureus.AstrumAureus.FlameCrystalSound, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float velocity = death ? (8f + npc.localAI[2] * 0.025f) : 7f; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - float spreadLimit = (phase4 ? 100f : 50f) + enrageScale * 50f; - float randomSpread = (Main.rand.NextFloat() - 0.5f) * spreadLimit; - Vector2 spawnVector = new Vector2(npc.Center.X, npc.Center.Y - 80f * npc.scale); - Vector2 destination = new Vector2(spawnVector.X + randomSpread, spawnVector.Y - 100f * npc.scale); - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, Vector2.Normalize(destination - spawnVector) * velocity, type, damage, 0f, Main.myPlayer); - } - } - } - - float laserBarrageGateValue = phase5 ? 160f : phase3 ? 120f : phase2 ? 80f : 60f; - if (npc.localAI[0] >= laserBarrageGateValue) - { - // Fire astral lasers while walking - if (npc.ai[0] == 2f) - { - npc.localAI[0] = 0f; - - SoundEngine.PlaySound(AstrumAureus.AstrumAureus.LaserSound, npc.Center); - - if (calamityGlobalNPC.newAI[2] == 0f) - { - calamityGlobalNPC.newAI[2] = 1f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int maxProjectiles = !phase2 ? (bossRush ? 5 : 3) : (bossRush ? 7 : 5); - int spread = !phase2 ? (bossRush ? 11 : 8) : (bossRush ? 12 : 10); - - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Vector2 projectileVelocity = Vector2.Normalize(player.Center - npc.Center) * walkingProjectileVelocity; - float rotation = MathHelper.ToRadians(spread); - for (int i = 0; i < maxProjectiles; i++) - { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1))); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, walkingProjectileVelocity * 2f); - } - - if (phase3) - { - float flameVelocity = walkingProjectileVelocity; - maxProjectiles = 2; - spread = 45; - - type = ModContent.ProjectileType(); - damage = npc.GetProjectileDamage(type); - projectileVelocity = Vector2.Normalize(player.Center - npc.Center) * flameVelocity; - rotation = MathHelper.ToRadians(spread); - for (int i = 0; i < maxProjectiles; i++) - { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1))); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer); - } - } - } - } - else - { - calamityGlobalNPC.newAI[2] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int maxProjectiles = !phase3 ? (bossRush ? 13 : death ? 11 : 9) : (bossRush ? 19 : death ? 17 : 15); - int spread = !phase3 ? (bossRush ? 20 : death ? 18 : 16) : (bossRush ? 24 : death ? 22 : 20); - - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - int centralLaser = maxProjectiles / 2; - int[] lasersToNotFire = new int[6] { centralLaser - 3, centralLaser - 2, centralLaser - 1, centralLaser + 1, centralLaser + 2, centralLaser + 3 }; - Vector2 projectileVelocity = Vector2.Normalize(player.Center - npc.Center) * walkingProjectileVelocity; - float rotation = MathHelper.ToRadians(spread); - for (int i = 0; i < maxProjectiles; i++) - { - if (i != lasersToNotFire[0] && i != lasersToNotFire[1] && i != lasersToNotFire[2] && i != lasersToNotFire[3] && i != lasersToNotFire[4] && i != lasersToNotFire[5]) - { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1))); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, walkingProjectileVelocity * 2f); - } - } - } - } - } - } - } - else - npc.localAI[0] = 0f; - - // Start up - if (npc.ai[0] == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.ai[0] = 1f; - npc.netUpdate = true; - CustomGravity(); - } - - // Idle - else if (npc.ai[0] == 1f) - { - // Avoid cheap bullshit - npc.damage = 0; - - // Slow down - npc.velocity.X *= 0.8f; - - // Stay vulnerable for 3 seconds - npc.ai[1] += 1f; - if (npc.Distance(player.Center) < 240f) - npc.ai[1] += death ? 4f : expertMode ? 2f : 1f; - - if (npc.ai[1] >= 180f || bossRush) - { - // Set AI to random state and reset other AI arrays - npc.TargetClosest(); - switch (Main.rand.Next(phase3 ? 3 : 2)) - { - case 0: - npc.ai[0] = 2f; - break; - - case 1: - npc.ai[0] = 3f; - break; - - case 2: - npc.ai[0] = 5f; - break; - - default: - break; - } - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - // Stop colliding with tiles if entering walking phase - npc.noTileCollide = npc.ai[0] == 2f; - - npc.netUpdate = true; - } - else - CustomGravity(); - } - - // Walk - else if (npc.ai[0] == 2f) - { - // Avoid cheap bullshit - npc.damage = 0; - - // Set walking direction - if (Math.Abs(npc.Center.X - player.Center.X) < 200f * npc.scale) - { - npc.velocity.X *= 0.8f; - if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) - npc.velocity.X = 0f; - } - else - { - float playerLocation = npc.Center.X - player.Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - - if (npc.direction > 0) - npc.velocity.X = (npc.velocity.X * 20f + walkingVelocity) / 21f; - if (npc.direction < 0) - npc.velocity.X = (npc.velocity.X * 20f - walkingVelocity) / 21f; - } - - if (Collision.CanHit(npc.position, npc.width, npc.height, player.Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height) && player.position.Y <= npc.position.Y + npc.height && !npc.collideX) - { - CustomGravity(); - npc.noTileCollide = false; - } - else - { - npc.noTileCollide = true; - - // Walk through tiles if colliding with tiles and player is out of reach - int aureusHitboxWidth = 80; - int aureusHitboxHeight = 20; - Vector2 aureusHitboxTileCollideSize = new Vector2(npc.Center.X - (aureusHitboxWidth / 2), npc.position.Y + npc.height - aureusHitboxHeight); - - bool nearPlayerWalkingThroughTiles = false; - if (npc.position.X < player.position.X && npc.position.X + npc.width > player.position.X + player.width && npc.position.Y + npc.height < player.position.Y + player.height - 16f) - nearPlayerWalkingThroughTiles = true; - - if (nearPlayerWalkingThroughTiles) - { - npc.velocity.Y += 0.5f; - } - else if (Collision.SolidCollision(aureusHitboxTileCollideSize, aureusHitboxWidth, aureusHitboxHeight)) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y = 0f; - - if (npc.velocity.Y > -0.2) - npc.velocity.Y -= 0.025f; - else - npc.velocity.Y -= 0.2f; - - if (npc.velocity.Y < -4f) - npc.velocity.Y = -4f; - } - else - { - if (npc.velocity.Y < 0f) - npc.velocity.Y = 0f; - - if (npc.velocity.Y < 0.1) - npc.velocity.Y += 0.025f; - else - npc.velocity.Y += 0.5f; - } - } - - // Walk for a maximum of 6 seconds - if (!dontAttack) - { - npc.ai[1] += 1f; - if (npc.Distance(player.Center) < 240f) - npc.ai[1] += death ? 4f : expertMode ? 2f : 1f; - } - - if (npc.ai[1] >= ((bossRush ? 270f : 360f) - (death ? 90f * (1f - lifeRatio) : 0f))) - { - // Collide with tiles again - npc.noTileCollide = false; - - // Set AI to next phase (Jump) and reset other AI - npc.TargetClosest(); - npc.ai[0] = exhausted ? 1f : 3f; - npc.ai[1] = 0f; - npc.ai[2] += 1f; - npc.netUpdate = true; - } - - // Limit downward velocity - if (npc.velocity.Y > 10f) - npc.velocity.Y = 10f; - } - - // Jump - else if (npc.ai[0] == 3f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.noTileCollide = false; - - if (npc.velocity.Y == 0f) - { - // Slow down - npc.velocity.X *= 0.8f; - - // Half second delay before jumping - if (!dontAttack) - npc.ai[1] += 1f; - - if (npc.ai[1] >= 30f) - { - npc.ai[1] = -20f; - } - else if (npc.ai[1] == -1f) - { - // Set damage - npc.damage = npc.defDamage; - - // Set jump velocity, reset and set AI to next phase (Stomp) - float distanceFromPlayerOnXAxis = npc.Center.X - player.Center.X; - npc.direction = distanceFromPlayerOnXAxis < 0 ? 1 : -1; - calamityGlobalNPC.newAI[3] = npc.direction; - - // The limit for how much Aureus can multiply its jump velocity - float speedMultLimit = 1f; - - // Maxes out when the player is a full 2000 pixels away from or above Aureus - float multiplier = 1f / 2000f; - - // Increase Aureus jump velocity X if it's far enough away from the player - float distanceAwayFromTarget = Math.Abs(distanceFromPlayerOnXAxis); - float distanceGateValue = 400f; - bool increaseJumpVelocityX = distanceAwayFromTarget > distanceGateValue && expertMode; - if (increaseJumpVelocityX) - { - calamityGlobalNPC.newAI[0] = (distanceAwayFromTarget - distanceGateValue) * multiplier; - if (calamityGlobalNPC.newAI[0] > speedMultLimit) - calamityGlobalNPC.newAI[0] = speedMultLimit; - } - - // Increase Aureus jump velocity Y if it's far enough above the player - float distanceBelowTarget = npc.position.Y - (player.position.Y + 80f); - bool increaseJumpVelocityY = distanceBelowTarget > 0f && revenge; - if (increaseJumpVelocityY) - { - calamityGlobalNPC.newAI[1] = distanceBelowTarget * multiplier; - if (calamityGlobalNPC.newAI[1] > speedMultLimit) - calamityGlobalNPC.newAI[1] = speedMultLimit; - } - - float velocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 27f : 20f; - velocity += 6f * enrageScale; - if (expertMode) - velocity += death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); - if (Main.getGoodWorld) - velocity *= 1.15f; - - npc.velocity = (new Vector2(player.Center.X, player.Center.Y - 500f) - npc.Center).SafeNormalize(Vector2.Zero) * velocity; - npc.velocity *= new Vector2(calamityGlobalNPC.newAI[0] + 1f, calamityGlobalNPC.newAI[1] + 1f); - - npc.noTileCollide = true; - - npc.ai[0] = 4f; - npc.ai[1] = 0f; - - SoundEngine.PlaySound(AstrumAureus.AstrumAureus.JumpSound, npc.Center); - - npc.netUpdate = true; - } - } - - // Don't run custom gravity when starting a jump - if (npc.ai[0] != 4f) - CustomGravity(); - } - - // Stomp - else if (npc.ai[0] == 4f) - { - if (npc.velocity.Y == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - // Play stomp sound. Gotta specify the filepath to avoid confusion between the namespace and npc - SoundStyle soundToPlay = Main.zenithWorld ? NPCs.ExoMechs.Ares.AresGaussNuke.NukeExplosionSound : NPCs.AstrumAureus.AstrumAureus.StompSound; - SoundEngine.PlaySound(soundToPlay, npc.Center); - - if (Main.zenithWorld) - { - float screenShakePower = 16 * Utils.GetLerpValue(1300f, 0f, npc.Distance(Main.LocalPlayer.Center), true); - if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < screenShakePower) - Main.LocalPlayer.Calamity().GeneralScreenShakePower = screenShakePower; - } - - // Stomp and jump again, if stomped twice then reset and set AI to next phase (Teleport or Idle) - npc.TargetClosest(); - npc.localAI[1] += 1f; - float maxStompAmt = phase5 ? 5f : phase3 ? 2f : 3f; - if (npc.localAI[1] >= maxStompAmt) - { - npc.ai[0] = exhausted ? 1f : (phase3 ? 5f : 2f); - npc.localAI[1] = 0f; - npc.ai[2] += 1f; - npc.ai[3] = 0f; - npc.noTileCollide = false; - npc.netUpdate = true; - } - else - { - float playerLocation = npc.Center.X - player.Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - npc.ai[0] = 3f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - calamityGlobalNPC.newAI[0] = 0f; - calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[3] = 0f; - - // Spawn dust for visual effect - for (int i = (int)npc.position.X - 20; i < (int)npc.position.X + npc.width + 40; i += 20) - { - for (int j = 0; j < 4; j++) - { - int stompDust = Dust.NewDust(new Vector2(npc.position.X - 20f, npc.position.Y + npc.height), npc.width + 20, 4, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); - Main.dust[stompDust].velocity *= 0.2f; - } - } - - // Fire lasers or flames on stomp - SoundEngine.PlaySound(AstrumAureus.AstrumAureus.LaserSound, npc.Center); - - if (Main.zenithWorld) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - int totalProjectiles = bossRush ? 14 : death ? 12 : revenge ? 10 : expertMode ? 8 : 6; - float radians = MathHelper.TwoPi / totalProjectiles; - float velocity = 10f; - Vector2 spinningPoint = new Vector2(0f, -velocity); - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 1f); - } - } - } - else if (calamityGlobalNPC.newAI[2] == 0f && phase2) - { - calamityGlobalNPC.newAI[2] = 1f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float flameVelocity = 6f; - int maxProjectiles = bossRush ? 4 : death ? 3 : 2; - int spread = bossRush ? 36 : death ? 28 : 20; - - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Vector2 spawnVector = new Vector2(npc.Center.X, npc.Center.Y - 80f * npc.scale); - Vector2 destination = new Vector2(spawnVector.X, spawnVector.Y + 100f * npc.scale); - Vector2 projectileVelocity = Vector2.Normalize(destination - spawnVector) * flameVelocity; - float rotation = MathHelper.ToRadians(spread); - for (int i = 0; i < maxProjectiles; i++) - { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1))); - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector + Vector2.Normalize(perturbedSpeed) * 100f, perturbedSpeed, type, damage, 0f, Main.myPlayer); - } - } - } - else - { - calamityGlobalNPC.newAI[2] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float laserVelocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 7f : death ? 6f : 5f; - int maxProjectiles = !phase3 ? (bossRush ? 13 : death ? 11 : 9) : (bossRush ? 17 : death ? 15 : 13); - int spread = !phase3 ? (bossRush ? 20 : death ? 18 : 16) : (bossRush ? 24 : death ? 22 : 20); - - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - int[] lasersToNotFire = new int[4] { 1, 3, maxProjectiles - 2, maxProjectiles - 4 }; - Vector2 projectileVelocity = Vector2.Normalize(player.Center - npc.Center) * laserVelocity; - float rotation = MathHelper.ToRadians(spread); - for (int i = 0; i < maxProjectiles; i++) - { - if (i != lasersToNotFire[0] && i != lasersToNotFire[1] && i != lasersToNotFire[2] && i != lasersToNotFire[3]) - { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1))); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, laserVelocity * 2f); - } - } - } - } - } - else - { - // Set damage - npc.damage = npc.defDamage; - - // Set velocities while falling, this happens before the stomp - // Fall through - if (!player.dead) - { - if ((player.position.Y > npc.Bottom.Y && npc.velocity.Y > 0f) || (player.position.Y < npc.Bottom.Y && npc.velocity.Y < 0f)) - npc.noTileCollide = true; - else if ((npc.velocity.Y > 0f && npc.Bottom.Y > Main.player[npc.target].Top.Y) || (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height))) - npc.noTileCollide = false; - } - - if (npc.position.X < player.position.X && npc.position.X + npc.width > player.position.X + player.width) - { - // Make sure Aureus falls quickly when directly on top of or below the player - if (npc.ai[3] < 30f) - npc.ai[3] = 30f; - - npc.velocity.X *= 0.8f; - - if (npc.Bottom.Y < player.position.Y) - { - // Make sure Aureus falls rather quickly - if (npc.velocity.Y < -3f) - npc.velocity.Y = -3f; - - float fallSpeed = 1.2f; - fallSpeed += 0.36f * enrageScale; - if (expertMode) - fallSpeed += death ? 0.36f * (1f - lifeRatio) : 0.24f * (1f - lifeRatio); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - fallSpeed += 0.5f; - - if (calamityGlobalNPC.newAI[1] > 0f) - fallSpeed *= calamityGlobalNPC.newAI[1] + 1f; - - npc.velocity.Y += fallSpeed; - } - } - else - { - // Push Aureus towards the player on the X axis if he's not directly on top of or below the player - float velocityXChange = 0.2f + Math.Abs(npc.Center.X - player.Center.X) * 0.0001f; - velocityXChange += 0.1f * enrageScale; - - if (calamityGlobalNPC.newAI[0] > 0f) - velocityXChange *= calamityGlobalNPC.newAI[0] + 1f; - - if (npc.direction < 0) - npc.velocity.X -= velocityXChange; - else if (npc.direction > 0) - npc.velocity.X += velocityXChange; - - float velocityXCap = 12f; - velocityXCap += 3.6f * enrageScale; - if (expertMode) - velocityXCap += death ? 3.6f * (1f - lifeRatio) : 2.4f * (1f - lifeRatio); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - velocityXCap += 5f; - - if (calamityGlobalNPC.newAI[0] > 0f) - velocityXCap *= calamityGlobalNPC.newAI[0] + 1f; - - float playerLocation = npc.Center.X - player.Center.X; - int directionRelativeToTarget = playerLocation < 0 ? 1 : -1; - bool slowDown = directionRelativeToTarget != calamityGlobalNPC.newAI[3]; - - if (slowDown) - velocityXCap *= 0.333f; - - if (npc.velocity.X < -velocityXCap) - npc.velocity.X = -velocityXCap; - if (npc.velocity.X > velocityXCap) - npc.velocity.X = velocityXCap; - } - - // Don't start falling quickly until half a second has passed - npc.ai[3] += 1f; - if (npc.ai[3] > 30f) - CustomGravity(); - } - } - - // Teleport - else if (npc.ai[0] == 5f) - { - // Avoid cheap bullshit - npc.damage = 0; - - // Slow down - npc.velocity.X *= 0.8f; - - // Start teleport - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - if (death) - npc.localAI[2] += 1.25f; - - if (phase4) - { - npc.localAI[1] += 1f; - if (death) - npc.localAI[2] += 1.25f; - } - - if (npc.localAI[1] >= (bossRush ? 60f : death ? 180f : 240f)) - { - // Reset localAI and find a teleport destination - npc.TargetClosest(); - npc.localAI[1] = 0f; - - Vector2 vectorAimedAheadOfTarget = Main.player[npc.target].Center + new Vector2((float)Math.Round(Main.player[npc.target].velocity.X), 0f).SafeNormalize(Vector2.Zero) * 1000f; - Point point4 = vectorAimedAheadOfTarget.ToTileCoordinates(); - int teleportTries = 0; - while (teleportTries < 100) - { - teleportTries++; - int teleportTileX = Main.rand.Next(point4.X - 5, point4.X + 6); - int teleportTileY = Main.rand.Next(point4.Y - 5, point4.Y); - - if (!Main.tile[teleportTileX, teleportTileY].HasUnactuatedTile) - { - npc.ai[1] = teleportTileX * 16 + 8; - npc.ai[3] = teleportTileY * 16 + 16; - break; - } - } - - // Default teleport if the above conditions aren't met in 100 iterations - if (teleportTries >= 100) - { - Vector2 bottom = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].Bottom; - npc.ai[1] = bottom.X; - npc.ai[3] = bottom.Y; - } - - // Set AI to next phase (Mid-teleport) - npc.ai[0] = 6f; - npc.netUpdate = true; - } - } - - CustomGravity(); - } - - // Mid-teleport - else if (npc.ai[0] == 6f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (death) - npc.localAI[2] += 1.25f; - - if (phase4) - { - if (death) - npc.localAI[2] += 1.25f; - } - - // Turn invisible - npc.alpha += 10; - if (npc.alpha >= 255) - { - // Set position to teleport destination - npc.Bottom = new Vector2(npc.ai[1], npc.ai[3]); - - // Reset alpha and set AI to next phase (End of teleport) - npc.alpha = 255; - npc.ai[0] = 7f; - npc.localAI[2] = 0f; - npc.netUpdate = true; - } - - // Play sound for cool effect - if (npc.soundDelay == 0) - { - npc.soundDelay = 15; - SoundEngine.PlaySound(AstrumAureus.AstrumAureus.TeleportSound, npc.Center); - } - - // Emit dust to make the teleport pretty - for (int i = 0; i < 10; i++) - { - int teleportDust = Dust.NewDust(npc.position, npc.width, npc.height, ModContent.DustType(), npc.velocity.X, npc.velocity.Y, 255, default, 2f); - Main.dust[teleportDust].noGravity = true; - Main.dust[teleportDust].velocity *= 0.5f; - } - - CustomGravity(); - } - - // End of teleport - else if (npc.ai[0] == 7f) - { - // Avoid cheap bullshit - npc.damage = 0; - - // Turn visible - npc.alpha -= 10; - if (npc.alpha <= 0) - { - // Spawn Aureus Spawns - bool spawnFlag = expertMode; - if (NPC.CountNPCS(ModContent.NPCType()) >= 2) - spawnFlag = false; - - if (spawnFlag && Main.netMode != NetmodeID.MultiplayerClient) - { - int aureusSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)(npc.Center.Y - 25f * npc.scale), ModContent.NPCType()); - Main.npc[aureusSpawn].velocity.Y = -10f; - Main.npc[aureusSpawn].netUpdate = true; - if (revenge) - { - aureusSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)(npc.Center.Y - 25f * npc.scale), ModContent.NPCType()); - Main.npc[aureusSpawn].velocity.Y = -15f; - Main.npc[aureusSpawn].netUpdate = true; - } - - if (death) - { - int damageAmt = npc.lifeMax / 50; - npc.life -= damageAmt; - if (npc.life < 1) - npc.life = 1; - - npc.DamageEffect(damageAmt); - } - } - - // Reset alpha and set AI to next phase (Idle) - npc.alpha = 0; - npc.ai[0] = exhausted ? 1f : 2f; - npc.ai[1] = 0f; - npc.ai[2] += 1f; - npc.localAI[3] = noProjectileOrPhaseIncrementTime; - - // Stop colliding with tiles if entering walking phase - npc.noTileCollide = npc.ai[0] == 2f; - - npc.netUpdate = true; - } - - // Play sound at teleport destination for cool effect - if (npc.soundDelay == 0) - { - npc.soundDelay = 15; - SoundEngine.PlaySound(SoundID.Item109, npc.Center); - } - - // Emit dust to make the teleport pretty - for (int i = 0; i < 10; i++) - { - int teleportDust = Dust.NewDust(npc.position, npc.width, npc.height, ModContent.DustType(), npc.velocity.X, npc.velocity.Y, 255, default, 2f); - Main.dust[teleportDust].noGravity = true; - Main.dust[teleportDust].velocity *= 0.5f; - } - - CustomGravity(); - } - - void CustomGravity() - { - float gravity = 0.36f + 0.12f * enrageScale; - float maxFallSpeed = reduceFallSpeed ? 12f : 12f + 4f * enrageScale; - - if (calamityGlobalNPC.newAI[1] > 0f && !reduceFallSpeed) - maxFallSpeed *= calamityGlobalNPC.newAI[1] + 1f; - - if (Main.getGoodWorld && !reduceFallSpeed) - { - gravity *= 1.15f; - maxFallSpeed *= 1.15f; - } - - npc.velocity.Y += gravity; - if (npc.velocity.Y > maxFallSpeed) - npc.velocity.Y = maxFallSpeed; - } - } - } -} diff --git a/NPCs/CalamityAIs/CalamityBossAIs/BrimstoneElementalAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/BrimstoneElementalAI.cs deleted file mode 100644 index 2134f154b2..0000000000 --- a/NPCs/CalamityAIs/CalamityBossAIs/BrimstoneElementalAI.cs +++ /dev/null @@ -1,734 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.CalPlayer; -using CalamityMod.Dusts; -using CalamityMod.Events; -using CalamityMod.NPCs.Abyss; -using CalamityMod.NPCs.BrimstoneElemental; -using CalamityMod.Projectiles.Boss; -using CalamityMod.Projectiles.Enemy; -using CalamityMod.Sounds; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs -{ - public static class BrimstoneElementalAI - { - public static void VanillaBrimstoneElementalAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - BrimstoneElemental.BrimstoneElemental brimmy = npc.ModNPC(); - - // Used for Brimling AI states - CalamityGlobalNPC.brimstoneElemental = npc.whoAmI; - - // Emit light - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1.2f, 0f, 0f); - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); - - Player player = Main.player[npc.target]; - - bool despawnDistance = Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles; - - if (!player.active || player.dead || despawnDistance) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead || despawnDistance) - { - npc.rotation = npc.velocity.X * 0.04f; - - if (npc.velocity.Y > 3f) - npc.velocity.Y = 3f; - npc.velocity.Y -= 0.1f; - if (npc.velocity.Y < -12f) - npc.velocity.Y = -12f; - - if (npc.timeLeft > 60) - npc.timeLeft = 60; - - if (npc.ai[0] != 0f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.localAI[0] = 0f; - npc.localAI[1] = 0f; - npc.netUpdate = true; - } - return; - } - } - else if (npc.timeLeft < 1800) - npc.timeLeft = 1800; - - CalamityPlayer modPlayer = player.Calamity(); - - // Reset defense - npc.defense = npc.defDefense; - calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = npc.ai[0] == 4f; - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - // Variables for buffing the AI - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; - - bool phase2 = lifeRatio < 0.5f && revenge; - bool phase3 = lifeRatio < 0.33f; - - // Enrage - if ((!player.ZoneUnderworldHeight || !modPlayer.ZoneCalamity) && !bossRush) - { - if (calamityGlobalNPC.newAI[3] > 0f) - calamityGlobalNPC.newAI[3] -= 1f; - } - else - calamityGlobalNPC.newAI[3] = CalamityGlobalNPC.biomeEnrageTimerMax; - - bool biomeEnraged = calamityGlobalNPC.newAI[3] <= 0f || bossRush; - - float enrageScale = bossRush ? 0.5f : 0f; - if (biomeEnraged && (!player.ZoneUnderworldHeight || bossRush)) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 0.5f; - } - if (biomeEnraged && (!modPlayer.ZoneCalamity || bossRush)) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 1f; - } - - npc.Calamity().DR = npc.ai[0] == 4f ? 0.6f : 0.2f; - - // Emit dust - int dustAmt = (npc.ai[0] == 2f) ? 2 : 1; - int size = (npc.ai[0] == 2f) ? 50 : 35; - if (npc.ai[0] != 1f) - { - for (int i = 0; i < 2; i++) - { - if (Main.rand.Next(3) < dustAmt) - { - int dust = Dust.NewDust(npc.Center - new Vector2(size), size * 2, size * 2, DustID.LifeDrain, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 1.5f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0.2f; - Main.dust[dust].fadeIn = 1f; - } - } - } - - // Distance from destination where Brimmy stops moving - float movementDistanceGateValue = 100f; - - // How fast Brimmy moves to the destination - float baseVelocity = (death ? 6f : revenge ? 5.5f : expertMode ? 5f : 4.5f) * (npc.ai[0] == 5f ? 0.05f : npc.ai[0] == 3f ? 1.5f : 1f); - baseVelocity += 3f * enrageScale; - if (expertMode) - baseVelocity += death ? 3f * (1f - lifeRatio) : 2f * (1f - lifeRatio); - - float baseAcceleration = (death ? 0.12f : 0.1f) * (npc.ai[0] == 5f ? 0.5f : npc.ai[0] == 3f ? 1.5f : 1f); - baseAcceleration += 0.06f * enrageScale; - if (expertMode) - baseAcceleration += 0.03f * (1f - lifeRatio); - - // This is where Brimmy should be - Vector2 destination = npc.ai[0] != 3f ? player.Center : new Vector2(player.Center.X, player.Center.Y - 300f); - - // How far Brimmy is from where she's supposed to be - Vector2 distanceFromDestination = destination - npc.Center; - - // Movement - if (npc.ai[0] != 4f) - CalamityUtils.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity, baseAcceleration, true); - - // Rotation and direction - if (npc.ai[0] <= 2f || npc.ai[0] == 5f) - { - npc.rotation = npc.velocity.X * 0.04f; - if (npc.ai[0] != 5 || (npc.ai[1] < 180f && npc.ai[0] == 5f)) - { - float playerLocation = npc.Center.X - player.Center.X; - npc.direction = playerLocation < 0f ? 1 : -1; - npc.spriteDirection = npc.direction; - } - } - - if (Main.zenithWorld) // in gfb, Brimmy channels the power of the other elementals. - { - int newMode; - if (lifeRatio <= 0.8f && lifeRatio > 0.6f) - { - newMode = 1; // Sand - } - else if (lifeRatio <= 0.6f && lifeRatio > 0.4f) - { - newMode = 2; // Rare Sand - } - else if (lifeRatio <= 0.4f && lifeRatio > 0.2f) - { - newMode = 3; // Cloud - } - else if (lifeRatio <= 0.2f) - { - newMode = 4; // Water - } - else - { - newMode = 0; // Brimstone, default - } - if (newMode != brimmy.currentMode) - { - SoundEngine.PlaySound(SoundID.Item29, npc.Center); - } - brimmy.currentMode = newMode; - } - - if (npc.ai[0] == -1f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int phase; - int random = phase2 ? 6 : 5; - do phase = Main.rand.Next(random); - while (phase == npc.ai[1] || (phase == 0 && phase3 && revenge) || phase == 1 || phase == 2 || (phase == 4 && npc.localAI[3] != 0f)); - - npc.ai[0] = phase; - npc.ai[1] = 0f; - - // Cocoon phase cooldown - if (npc.localAI[3] > 0f) - npc.localAI[3] -= 1f; - else if (phase == 4) - { - npc.localAI[3] = 3f; - SoundEngine.PlaySound(BrimstoneElemental.BrimstoneElemental.HideInShellSound, player.Center); - } - - // Prevent netUpdate from being blocked by the spam counter. - // A phase switch sync is a critical operation that must be synced. - npc.ForceNetUpdate(false); - } - } - - // Pick a location to teleport to - else if (npc.ai[0] == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.chaseable = true; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - if (npc.Distance(player.Center) < 160f) - npc.localAI[1] += death ? 4f : expertMode ? 2f : 1f; - - if (npc.localAI[1] >= (bossRush ? 90f : death ? 120f : 180f)) - { - npc.TargetClosest(); - npc.localAI[1] = 0f; - int timer = 0; - int playerPosX; - int playerPosY; - while (true) - { - timer++; - playerPosX = (int)player.Center.X / 16; - playerPosY = (int)player.Center.Y / 16; - - int min = 12; - int max = 16; - - if (Main.rand.NextBool()) - playerPosX += Main.rand.Next(min, max); - else - playerPosX -= Main.rand.Next(min, max); - - if (Main.rand.NextBool()) - playerPosY += Main.rand.Next(min, max); - else - playerPosY -= Main.rand.Next(min, max); - - if (!WorldGen.SolidTile(playerPosX, playerPosY)) - break; - - if (timer > 100) - return; - } - npc.ai[0] = 1f; - npc.ai[1] = playerPosX; - npc.ai[2] = playerPosY; - npc.netUpdate = true; - } - } - } - - // Teleport to location - else if (npc.ai[0] == 1f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.chaseable = true; - Vector2 position = new Vector2(npc.ai[1] * 16f - (npc.width / 2), npc.ai[2] * 16f - (npc.height / 2)); - for (int m = 0; m < 5; m++) - { - int dust = Dust.NewDust(position, npc.width, npc.height, DustID.LifeDrain, 0f, -1f, 90, default, 2f); - Main.dust[dust].noGravity = true; - Main.dust[dust].fadeIn = 1f; - } - npc.alpha += bossRush ? 8 : death ? 5 : revenge ? 4 : expertMode ? 3 : 2; - if (npc.alpha >= 255) - { - int spawnType = brimmy.currentMode == 3 ? NPCID.AngryNimbus : ModContent.NPCType(); - int enemyCount = brimmy.currentMode == 3 ? 3 : 1; // 3 angry nimbi if cloud, otherwise 1 brimling - if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(spawnType) < (death ? 1 : 2) && revenge && brimmy.currentMode != 2) // dont spawn anything if gfb rare sand - { - for (int i = 0; i < enemyCount; i++) - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, spawnType); - } - SoundEngine.PlaySound(BrimstoneElemental.BrimstoneElemental.TeleportSound, npc.Center); - npc.alpha = 255; - npc.position = position; - for (int n = 0; n < 15; n++) - { - int warpDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.LifeDrain, 0f, -1f, 90, default, 3f); - Main.dust[warpDust].noGravity = true; - } - npc.ai[0] = 2f; - npc.netUpdate = true; - } - } - - // Either teleport again or go to next AI state - else if (npc.ai[0] == 2f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (npc.alpha >= 255) - { - if (Main.zenithWorld) - { - SoundEngine.PlaySound(SoundID.Item68, npc.Center); - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Vector2 pos = npc.Center; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile(npc.GetSource_FromAI(), pos, new Vector2(0, 1), type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); - Projectile.NewProjectile(npc.GetSource_FromAI(), pos, new Vector2(0, -1), type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); - Projectile.NewProjectile(npc.GetSource_FromAI(), pos, new Vector2(1, 0), type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); - Projectile.NewProjectile(npc.GetSource_FromAI(), pos, new Vector2(-1, 0), type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); - } - if (brimmy.currentMode >= 1 && brimmy.currentMode <= 3) - { - int tornadoType = brimmy.currentMode == 3 ? ModContent.ProjectileType() : ProjectileID.SandnadoHostileMark; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile(npc.GetSource_FromAI(), pos, Vector2.Zero, tornadoType, damage, 0f, Main.myPlayer, 0f, 0f); - } - } - if (brimmy.currentMode == 2) - { - int healAmt = npc.lifeMax / 25; - if (healAmt > 0) - { - npc.life += healAmt; - npc.HealEffect(healAmt, true); - npc.netUpdate = true; - } - } - } - } - - npc.alpha -= 50; - if (npc.alpha <= 0) - { - npc.chaseable = true; - npc.ai[3] += 1f; - npc.alpha = 0; - if (npc.ai[3] >= 2f || phase2 || Main.getGoodWorld) - { - npc.ai[0] = -1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - else - { - npc.ai[0] = 0f; - } - npc.netUpdate = true; - } - } - - // Float above target and fire projectiles - else if (npc.ai[0] == 3f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.chaseable = true; - npc.rotation = npc.velocity.X * 0.04f; - - float playerLocation = npc.Center.X - player.Center.X; - npc.direction = playerLocation < 0f ? 1 : -1; - npc.spriteDirection = npc.direction; - - npc.ai[1] += 1f; - float divisor = expertMode ? (death ? 80f : revenge ? 45f : 50f) - (float)Math.Ceiling(10f * (1f - lifeRatio)) : 50f; - divisor -= 3f * enrageScale; - float divisor2 = divisor * 2f; - - if (npc.ai[1] % divisor == divisor - 1f) - { - float velocity = (death ? 7f : revenge ? 6f : 5f) + (2f * enrageScale) + (expertMode ? 3f * (1f - lifeRatio) : 0f); - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - if (brimmy.currentMode == 4) - { - type = ModContent.ProjectileType(); - SoundEngine.PlaySound(SoundID.Item30, player.Center); - } - else - { - SoundEngine.PlaySound(BrimstoneElemental.BrimstoneElemental.HellfireballSound, player.Center); - } - Vector2 projectileVelocity = (player.Center - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 5f, projectileVelocity, type, damage, 0f, Main.myPlayer, player.position.X, player.position.Y); - Main.projectile[proj].timeLeft = 240; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - Main.projectile[proj].extraUpdates += 1; - } - - if (npc.ai[1] % divisor2 == divisor2 - 1f) - { - velocity = (death ? 5f : 4f) + 2f * enrageScale; - type = ModContent.ProjectileType(); - damage = npc.GetProjectileDamage(type); - if (brimmy.currentMode == 4) - { - type = ModContent.ProjectileType(); - SoundEngine.PlaySound(SoundID.Item21, player.Center); - } - else - { - SoundEngine.PlaySound(BrimstoneElemental.BrimstoneElemental.DartSound, player.Center); - } - projectileVelocity = (player.Center - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; - int numProj = death ? 8 : 4; - int spread = death ? 90 : 45; - if (Main.getGoodWorld) - { - numProj *= 3; - spread *= 2; - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float rotation = MathHelper.ToRadians(spread); - float projectileVelocityToPass = velocity * 3f; - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - int proj2 = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 5f, perturbedSpeed, type, damage, 0f, Main.myPlayer, 1f, 0f, projectileVelocityToPass); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - Main.projectile[proj2].extraUpdates += 1; - } - } - } - } - - if (npc.ai[1] >= divisor * (death ? 5f : 10f)) - { - npc.TargetClosest(); - npc.ai[0] = -1f; - npc.ai[1] = 3f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - } - - // Cocoon bullet hell - else if (npc.ai[0] == 4f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.defense = npc.defDefense * 4; - - npc.chaseable = false; - npc.localAI[0] += 1f; - if (Main.getGoodWorld) - npc.localAI[0] += 2f; - if (expertMode) - npc.localAI[0] += 1f - lifeRatio; - npc.localAI[0] += enrageScale; - - if (npc.localAI[0] >= 120f) - { - npc.localAI[0] = 0f; - - float projectileSpeed = death ? 9f : revenge ? 8f : 6f; - projectileSpeed += 2f * enrageScale; - - Vector2 projectileVelocity = player.Center - npc.Center; - - float radialOffset = 0.2f; - float diameter = 80f; - - projectileVelocity = projectileVelocity.SafeNormalize(Vector2.UnitY) * projectileSpeed; - - Vector2 velocity = projectileVelocity; - velocity = velocity.SafeNormalize(Vector2.UnitY); - velocity *= diameter; - - int totalProjectiles = 6; - float offsetAngle = (float)Math.PI * radialOffset; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - for (int j = 0; j < totalProjectiles; j++) - { - float radians = j - (totalProjectiles - 1f) / 2f; - Vector2 offset = velocity.RotatedBy(offsetAngle * radians); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, projectileVelocity, type, damage, 0f, Main.myPlayer, 1f, 0f); - Main.projectile[proj].timeLeft = 300; - Main.projectile[proj].tileCollide = false; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - Main.projectile[proj].extraUpdates += 1; - } - } - - totalProjectiles = 12; - float radians2 = MathHelper.TwoPi / totalProjectiles; - type = ModContent.ProjectileType(); - damage = npc.GetProjectileDamage(type); - if (brimmy.currentMode == 4) - { - type = ModContent.ProjectileType(); - SoundEngine.PlaySound(SoundID.Item26, player.Center); - } - else - { - SoundEngine.PlaySound(BrimstoneElemental.BrimstoneElemental.ShellFireSound, player.Center); - } - double angleA = radians2 * 0.5; - double angleB = MathHelper.ToRadians(90f) - angleA; - float velocityX = (float)(projectileSpeed * Math.Sin(angleA) / Math.Sin(angleB)); - Vector2 spinningPoint = npc.localAI[2] % 2f == 0f ? new Vector2(0f, -projectileSpeed) : new Vector2(-velocityX, -projectileSpeed); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float projectileVelocityToPass = projectileSpeed * 3f; - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 vector255 = spinningPoint.RotatedBy(radians2 * k); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + vector255.SafeNormalize(Vector2.UnitY) * 5f, vector255, type, damage, 0f, Main.myPlayer, 1f, 0f, projectileVelocityToPass); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - Main.projectile[proj].extraUpdates += 1; - } - - if (death) - { - spinningPoint = npc.localAI[2] % 2f == 0f ? new Vector2(-velocityX, -projectileSpeed) : new Vector2(0f, -projectileSpeed); - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 vector255 = spinningPoint.RotatedBy(radians2 * k); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + vector255.SafeNormalize(Vector2.UnitY) * 5f, vector255 * 0.75f, type, damage, 0f, Main.myPlayer, 1f, 0f, projectileVelocityToPass); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - Main.projectile[proj].extraUpdates += 1; - } - } - } - - npc.localAI[2] += 1f; - } - - npc.velocity *= 0.95f; - npc.rotation = npc.velocity.X * 0.04f; - float playerLocation = npc.Center.X - player.Center.X; - npc.direction = playerLocation < 0f ? 1 : -1; - npc.spriteDirection = npc.direction; - - npc.ai[1] += 1f; - if (npc.ai[1] >= (death ? 240f : 300f)) - { - npc.TargetClosest(); - npc.ai[0] = -1f; - npc.ai[1] = 4f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.localAI[0] = 0f; - npc.netUpdate = true; - } - } - - // Laser beam attack - else if (npc.ai[0] == 5f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.chaseable = true; - - npc.defense = npc.defDefense * 2; - - Vector2 source = new Vector2(npc.Center.X + (npc.spriteDirection > 0 ? 34f : -34f), npc.Center.Y - 74f); - Vector2 aimAt = player.Center + player.velocity * 20f; - float aimResponsiveness = bossRush ? 0.05f : (npc.ai[2] == 1f || death) ? 0.1f : 0.25f; - - Vector2 aimVector = (aimAt - source).SafeNormalize(Vector2.UnitY); - if (aimVector.HasNaNs()) - aimVector = -Vector2.UnitY; - aimVector = (Vector2.Lerp(aimVector, npc.velocity.SafeNormalize(Vector2.UnitY), aimResponsiveness)).SafeNormalize(Vector2.UnitY); - aimVector *= 6f; - - Vector2 laserVelocity = aimVector.SafeNormalize(Vector2.UnitY); - if (laserVelocity.HasNaNs()) - laserVelocity = -Vector2.UnitY; - - calamityGlobalNPC.newAI[1] = laserVelocity.X; - calamityGlobalNPC.newAI[2] = laserVelocity.Y; - - // Rev = 190 + 165 = 355 - // Death = 165 - - npc.ai[1] += 1f; - if (npc.ai[1] >= 240f) - { - npc.TargetClosest(); - npc.ai[2] += 1f; - npc.localAI[0] = 0f; - npc.localAI[1] = 0f; - if (npc.ai[2] >= (death ? 1f : 2f)) - { - npc.ai[0] = -1f; - npc.ai[1] = 5f; - npc.ai[2] = 0f; - calamityGlobalNPC.newAI[0] = 0f; - } - else - { - npc.ai[1] = 0f; - calamityGlobalNPC.newAI[0] = 0f; - } - } - else if (npc.ai[1] >= 180f) - { - npc.velocity *= 0.95f; - if (npc.ai[1] == 180f) - { - SoundEngine.PlaySound(SoundID.Item68, source); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 laserVelocity2 = new Vector2(npc.localAI[0], npc.localAI[1]); - laserVelocity2 = laserVelocity2.SafeNormalize(Vector2.UnitY); - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - - Projectile.NewProjectile(npc.GetSource_FromAI(), source, laserVelocity2, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); - if (Main.getGoodWorld) - Projectile.NewProjectile(npc.GetSource_FromAI(), source, -laserVelocity2, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); - - if (Main.zenithWorld) - { - Projectile.NewProjectile(npc.GetSource_FromAI(), source, new Vector2(-laserVelocity2.X, laserVelocity2.Y), type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); - Projectile.NewProjectile(npc.GetSource_FromAI(), source, new Vector2(laserVelocity2.X, -laserVelocity2.Y), type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); - } - } - } - } - else - { - float playSoundTimer = 30f; - if (npc.ai[1] < 150f) - { - switch ((int)npc.ai[2]) - { - case 0: - npc.ai[1] += 0.5f; - break; - case 1: - npc.ai[1] += 1f; - playSoundTimer = 40f; - break; - } - if (death) - { - npc.ai[1] += 0.5f; - playSoundTimer += 10f; - } - } - - if (npc.ai[1] % playSoundTimer == 0f) - SoundEngine.PlaySound(SoundID.Item20, npc.Center); - - if (npc.ai[1] < 150f && calamityGlobalNPC.newAI[0] == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile(npc.GetSource_FromAI(), source, laserVelocity, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, npc.whoAmI); - if (Main.getGoodWorld) - Projectile.NewProjectile(npc.GetSource_FromAI(), source, -laserVelocity, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, npc.whoAmI); - - if (Main.zenithWorld) - { - Projectile.NewProjectile(npc.GetSource_FromAI(), source, new Vector2(-laserVelocity.X, laserVelocity.Y), ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, npc.whoAmI); - Projectile.NewProjectile(npc.GetSource_FromAI(), source, new Vector2(laserVelocity.X, -laserVelocity.Y), ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, npc.whoAmI); - } - } - - calamityGlobalNPC.newAI[0] = 1f; - } - else - { - if (npc.ai[1] == 150f) - { - npc.localAI[0] = laserVelocity.X; - npc.localAI[1] = laserVelocity.Y; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile(npc.GetSource_FromAI(), source.X, source.Y, npc.localAI[0], npc.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.whoAmI); - if (Main.getGoodWorld) - Projectile.NewProjectile(npc.GetSource_FromAI(), source.X, source.Y, -npc.localAI[0], -npc.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.whoAmI); - - if (Main.zenithWorld) - { - Projectile.NewProjectile(npc.GetSource_FromAI(), source.X, source.Y, -npc.localAI[0], npc.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.whoAmI); - Projectile.NewProjectile(npc.GetSource_FromAI(), source.X, source.Y, npc.localAI[0], -npc.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.whoAmI); - } - } - } - } - } - } - } - } -} diff --git a/NPCs/CalamityAIs/CalamityBossAIs/BumblebirbAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/BumblebirbAI.cs deleted file mode 100644 index 15d826ab41..0000000000 --- a/NPCs/CalamityAIs/CalamityBossAIs/BumblebirbAI.cs +++ /dev/null @@ -1,1077 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.CalPlayer; -using CalamityMod.Dusts; -using CalamityMod.Events; -using CalamityMod.NPCs.Abyss; -using CalamityMod.NPCs.AquaticScourge; -using CalamityMod.NPCs.AstrumAureus; -using CalamityMod.NPCs.AstrumDeus; -using CalamityMod.NPCs.BrimstoneElemental; -using CalamityMod.NPCs.Bumblebirb; -using CalamityMod.NPCs.CalClone; -using CalamityMod.NPCs.CeaselessVoid; -using CalamityMod.NPCs.Crags; -using CalamityMod.NPCs.NormalNPCs; -using CalamityMod.NPCs.OldDuke; -using CalamityMod.NPCs.SulphurousSea; -using CalamityMod.NPCs.SunkenSea; -using CalamityMod.Projectiles.Boss; -using CalamityMod.Projectiles.Enemy; -using CalamityMod.Sounds; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs -{ - public static class BumblebirbAI - { - public static void VanillaBumblebirbAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); - - // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); - - Player player = Main.player[npc.target]; - - // Variables - float rotationMult = 3f; - float rotationAmt = 0.03f; - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; - - // Adjust slowing debuff immunity - bool immuneToSlowingDebuffs = npc.ai[0] == 3f || npc.ai[0] == 3.1f || npc.ai[0] == 3.2f; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; - npc.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; - - // If target is outside the jungle for more than 5 seconds, enrage - if (!player.ZoneJungle) - { - if (npc.localAI[1] < CalamityGlobalNPC.biomeEnrageTimerMax) - npc.localAI[1] += 1f; - } - else - npc.localAI[1] = 0f; - - // If dragonfolly is off screen, enrage for the next couple attacks - if (Vector2.Distance(player.Center, npc.Center) > 1200f) - npc.localAI[2] = 2f; - - // Enrage scale - float enrageScale = death ? 1.5f : 1f; - if (npc.localAI[1] >= CalamityGlobalNPC.biomeEnrageTimerMax || bossRush) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 1f; - } - - if (npc.localAI[2] > 0f || bossRush) - enrageScale += 1f; - - if (Main.getGoodWorld) - enrageScale += 0.5f; - - if (enrageScale > 3f) - enrageScale = 3f; - - // Despawn - if (!player.active || player.dead || Vector2.Distance(player.Center, npc.Center) > 5600f) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - - if (!player.active || player.dead || Vector2.Distance(player.Center, npc.Center) > 5600f) - { - npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt) / 10f; - - if (npc.velocity.Y > 3f) - npc.velocity.Y = 3f; - npc.velocity.Y -= 0.2f; - if (npc.velocity.Y < -12f) - npc.velocity.Y = -12f; - - if (npc.timeLeft > 60) - npc.timeLeft = 60; - - if (npc.ai[0] != 0f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - npc.ForceNetUpdate(false); - } - - return; - } - } - else if (npc.timeLeft < 1800) - npc.timeLeft = 1800; - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - // Phases - bool phase2 = lifeRatio < (revenge ? 0.75f : 0.5f); - bool phase3 = lifeRatio < (death ? 0.4f : revenge ? 0.25f : 0.1f) && expertMode; - - float birbSpawnPhaseTimer = 180f; - float newPhaseTimer = 180f; - bool phaseSwitchPhase = (phase2 && calamityGlobalNPC.newAI[0] < newPhaseTimer && calamityGlobalNPC.newAI[2] != 1f) || - (phase3 && calamityGlobalNPC.newAI[1] < newPhaseTimer && calamityGlobalNPC.newAI[3] != 1f); - - calamityGlobalNPC.DR = (phaseSwitchPhase || npc.ai[0] == 5f || (enrageScale == 3f && !bossRush)) ? (bossRush ? 0.99f : 0.55f) : 0.1f; - calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = phaseSwitchPhase || npc.ai[0] == 5f || (enrageScale == 3f && !bossRush); - - int reducedSetDamage = (int)Math.Round(npc.defDamage * 0.5); - - if (phaseSwitchPhase) - { - // Avoid cheap bullshit - npc.damage = 0; - - 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) - { - float squawkpitch = Main.zenithWorld ? 1.3f : 0.25f; - SoundEngine.PlaySound(SoundID.DD2_BetsyScream with { Pitch = squawkpitch }, npc.Center); - - if (Main.zenithWorld) - { - int spacing = 20; - int amt = 5; - SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, npc.Center - Vector2.UnitY * 300f); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - for (int i = 0; i < amt; i++) - { - Vector2 fireFrom = new Vector2(npc.Center.X + (spacing * i) - (spacing * amt / 2), npc.Center.Y - 900f); - Vector2 ai0 = npc.Center - fireFrom; - float ai = Main.rand.Next(100); - Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; - Projectile.NewProjectile(npc.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), npc.defDamage, 0f, Main.myPlayer, ai0.ToRotation(), ai); - } - } - } - } - - if (calamityGlobalNPC.newAI[1] >= newPhaseTimer) - { - calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[2] = 1f; - calamityGlobalNPC.newAI[3] = 1f; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.SyncExtraAI(); - npc.ForceNetUpdate(false); - } - } - else - { - calamityGlobalNPC.newAI[0] += 1f; - - // Sound - if (calamityGlobalNPC.newAI[0] == newPhaseTimer - 60f) - { - float squawkpitch = Main.zenithWorld ? 1.3f : 0.25f; - SoundEngine.PlaySound(SoundID.DD2_BetsyScream with { Pitch = squawkpitch }, npc.Center); - - if (Main.zenithWorld) - { - int spacing = 20; - int amt = 3; - SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, npc.Center - Vector2.UnitY * 300f); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - for (int i = 0; i < amt; i++) - { - Vector2 fireFrom = new Vector2(npc.Center.X + (spacing * i) - (spacing * amt / 2), npc.Center.Y - 900f); - Vector2 ai0 = npc.Center - fireFrom; - float ai = Main.rand.Next(100); - Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; - Projectile.NewProjectile(npc.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), npc.defDamage, 0f, Main.myPlayer, ai0.ToRotation(), ai); - } - } - } - } - - 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.SyncExtraAI(); - npc.ForceNetUpdate(false); - } - } - - Vector2 follyTargetDirection = player.Center - npc.Center; - float follyTargetDistance = 4f + follyTargetDirection.Length() / 100f; - float follyVelocityMult = 25f; - follyTargetDirection.Normalize(); - follyTargetDirection *= follyTargetDistance; - npc.velocity = (npc.velocity * (follyVelocityMult - 1f) + follyTargetDirection) / follyVelocityMult; - return; - } - - // Max spawn amount - int maxBirbs = (CalamityWorld.LegendaryMode && revenge) ? 12 : revenge ? 3 : 2; - - // Variable for charging - float chargeDistance = 600f; - if (phase2) - chargeDistance -= 50f; - if (phase3) - chargeDistance -= 50f; - chargeDistance -= (enrageScale - 1f) * 100f; - - // Phase switch - if (npc.ai[0] == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (npc.Center.X < player.Center.X - 2f) - npc.direction = 1; - if (npc.Center.X > player.Center.X + 2f) - npc.direction = -1; - - // Direction and rotation - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt * 1.25f) / 10f; - - // Fly to target if target is too far away, otherwise get close to target and then slow down - Vector2 follyFlyTargetDirection = player.Center - npc.Center; - follyFlyTargetDirection.Y -= 200f; - if (follyFlyTargetDirection.Length() > 2800f) - { - npc.TargetClosest(); - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - else if (follyFlyTargetDirection.Length() > 240f) - { - float follyFlySpeed = 12f + (enrageScale - 1f) * 6f; - float follyFlyVelocityMult = 30f; - follyFlyTargetDirection.Normalize(); - follyFlyTargetDirection *= follyFlySpeed; - npc.velocity = (npc.velocity * (follyFlyVelocityMult - 1f) + follyFlyTargetDirection) / follyFlyVelocityMult; - } - else if (npc.velocity.Length() > 2f) - npc.velocity *= 0.95f; - else if (npc.velocity.Length() < 1f) - npc.velocity *= 1.05f; - - // Phase switch - npc.ai[1] += 1f; - if (npc.ai[1] >= 30f) - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - while (npc.ai[0] == 0f) - { - if (phase2) - npc.localAI[0] += 1f; - - if (npc.localAI[0] >= (phase3 ? 7 : 9)) - { - npc.TargetClosest(); - npc.ai[0] = 5f; - npc.localAI[0] = 0f; - - // Decrease the feather variable, feathers can be used again if it's at 0 - if (npc.ai[3] > 0f) - npc.ai[3] -= 1f; - - // Decrease enraged attacks by 1 - if (npc.localAI[2] > 0f) - npc.localAI[2] -= 1f; - - // Decrease amount of attacks until able to spawn small birbs again - if (npc.localAI[3] > 0f) - npc.localAI[3] -= 1f; - } - else - { - int follyAttackPicker = phase2 ? Main.rand.Next(2) + 1 : Main.rand.Next(3); - if (phase3) - follyAttackPicker = 1; - - float featherVelocity = 2f + (enrageScale - 1f); - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - - if (follyAttackPicker == 0 && npc.localAI[3] == 0f) - { - npc.TargetClosest(); - npc.ai[0] = 2f; - - // Decrease the feather variable, feathers can be used again if it's at 0 - if (npc.ai[3] > 0f) - npc.ai[3] -= 1f; - - // Decrease enraged attacks by 1 - if (npc.localAI[2] > 0f) - npc.localAI[2] -= 1f; - - // Birb will do at least 1 different attack before entering this phase again - npc.localAI[3] = 1f; - } - else if (follyAttackPicker == 1) - { - npc.TargetClosest(); - npc.ai[0] = 3f; - - // Decrease enraged attacks by 1 - if (npc.localAI[2] > 0f) - npc.localAI[2] -= 1f; - - // Decrease amount of attacks until able to use other attacks again - if (npc.localAI[3] > 0f) - npc.localAI[3] -= 1f; - - if (phase2 && npc.ai[3] == 0f) - { - npc.ai[3] = 3f; - SoundEngine.PlaySound(SoundID.Item102, player.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int totalProjectiles = 40; - float radians = MathHelper.TwoPi / totalProjectiles; - int distance = 800; - bool spawnRight = player.velocity.X > 0f; - for (int i = 0; i < totalProjectiles; i++) - { - if (Main.getGoodWorld) - { - if (i >= (int)(totalProjectiles * 0.125) && i <= (int)(totalProjectiles * 0.375)) - { - Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; - Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); - } - if (i >= (int)(totalProjectiles * 0.625) && i <= (int)(totalProjectiles * 0.875)) - { - Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; - Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); - } - } - else - { - if (spawnRight) - { - if (i >= (int)(totalProjectiles * 0.125) && i <= (int)(totalProjectiles * 0.375)) - { - Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; - Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); - } - } - else - { - if (i >= (int)(totalProjectiles * 0.625) && i <= (int)(totalProjectiles * 0.875)) - { - Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; - Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); - } - } - } - } - } - } - else - { - // Decrease the feather variable, feathers can be used again if it's at 0 - if (npc.ai[3] > 0f) - npc.ai[3] -= 1f; - } - } - else if (NPC.CountNPCS(ModContent.NPCType()) < maxBirbs && npc.localAI[3] == 0f) - { - npc.TargetClosest(); - npc.ai[0] = 4f; - - // Birb will do at least 2 different attacks before entering this phase again - npc.localAI[3] = 2f; - - // Decrease enraged attacks by 1 - if (npc.localAI[2] > 0f) - npc.localAI[2] -= 1f; - - if (npc.ai[3] == 0f) - { - npc.ai[3] = 3f; - SoundEngine.PlaySound(SoundID.Item102, player.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int totalProjectiles = phase2 ? 40 : 48; - - if (Main.getGoodWorld) - totalProjectiles *= 2; - - float radians = MathHelper.TwoPi / totalProjectiles; - int distance = phase2 ? 1200 : 1320; - - if (Main.getGoodWorld) - distance *= 2; - - bool spawnRight = player.velocity.X > 0f; - for (int i = 0; i < totalProjectiles; i++) - { - if (spawnRight) - { - if (i >= totalProjectiles / 2) - break; - - Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; - Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); - } - else - { - if (i >= totalProjectiles / 2) - { - Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; - Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); - } - } - } - } - } - else - { - // Decrease the feather variable, feathers can be used again if it's at 0 - if (npc.ai[3] > 0f) - npc.ai[3] -= 1f; - } - } - } - } - - npc.ForceNetUpdate(false); - npc.SyncExtraAI(); - } - } - - // Fly to target - else if (npc.ai[0] == 1f) - { - // Avoid cheap bullshit - npc.damage = 0; - - 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 follyTargetDirection = player.Center - npc.Center; - if (follyTargetDirection.Length() < 800f) - { - npc.TargetClosest(); - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - npc.ForceNetUpdate(false); - npc.SyncExtraAI(); - } - - float velocity = 14f + (enrageScale - 1f) * 4f; - float follyTargetDistance = velocity + follyTargetDirection.Length() / 100f; - float follyVelocityMult = 25f; - follyTargetDirection.Normalize(); - follyTargetDirection *= follyTargetDistance; - npc.velocity = (npc.velocity * (follyVelocityMult - 1f) + follyTargetDirection) / follyVelocityMult; - } - - // Fly towards target quickly - else if (npc.ai[0] == 2f) - { - // Set reduced damage - npc.damage = reducedSetDamage; - - if (npc.target < 0 || !player.active || player.dead) - { - npc.TargetClosest(); - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - npc.ForceNetUpdate(false); - npc.SyncExtraAI(); - } - - 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; - - Vector2 follyQuickFlyTargetDirection = player.Center - npc.Center; - follyQuickFlyTargetDirection.Y -= 20f; - npc.ai[2] += 0.0222222228f; - if (expertMode) - npc.ai[2] += 0.0166666675f; - - float velocity = 8f + (enrageScale - 1f) * 2f; - float follyQuickFlySpeed = velocity + npc.ai[2] + follyQuickFlyTargetDirection.Length() / 120f; - if (CalamityWorld.LegendaryMode && revenge) - follyQuickFlySpeed *= 2f; - - float follyQuickFlyVelMult = 20f; - follyQuickFlyTargetDirection.Normalize(); - follyQuickFlyTargetDirection *= follyQuickFlySpeed; - npc.velocity = (npc.velocity * (follyQuickFlyVelMult - 1f) + follyQuickFlyTargetDirection) / follyQuickFlyVelMult; - - npc.ai[1] += 1f; - if (npc.ai[1] >= ((CalamityWorld.LegendaryMode && revenge) ? 90f : 180f)) - { - npc.TargetClosest(); - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - npc.ForceNetUpdate(false); - npc.SyncExtraAI(); - } - } - - // Line up charge - else if (npc.ai[0] == 3f) - { - // Avoid cheap bullshit - npc.damage = 0; - - 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 follyLineUpTargetDirection = player.Center - npc.Center; - follyLineUpTargetDirection.Y -= 12f; - if (npc.Center.X > player.Center.X) - follyLineUpTargetDirection.X += chargeDistance; - else - follyLineUpTargetDirection.X -= chargeDistance; - - float verticalDistanceGateValue = (phase3 ? 100f : 20f) + (enrageScale - 1f) * 20f; - if (Math.Abs(npc.Center.X - player.Center.X) > chargeDistance - 50f && Math.Abs(npc.Center.Y - player.Center.Y) < verticalDistanceGateValue) - { - npc.ai[0] = 3.1f; - npc.ai[1] = 0f; - - npc.ForceNetUpdate(false); - npc.SyncExtraAI(); - } - - npc.ai[1] += 0.0333333351f; - float velocity = 16f + (enrageScale - 1f) * 4f; - float follyLineUpSpeed = velocity + npc.ai[1]; - float follyLineUpVelMult = 4f; - follyLineUpTargetDirection.Normalize(); - follyLineUpTargetDirection *= follyLineUpSpeed; - npc.velocity = (npc.velocity * (follyLineUpVelMult - 1f) + follyLineUpTargetDirection) / follyLineUpVelMult; - } - - // Prepare to charge - else if (npc.ai[0] == 3.1f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.rotation = (npc.rotation * rotationMult * 0.5f + npc.velocity.X * rotationAmt * 0.85f) / 5f; - - Vector2 follyChargePrepareTargetDirection = player.Center - npc.Center; - follyChargePrepareTargetDirection.Y -= 12f; - float follyChargePrepareSpeed = 28f + (enrageScale - 1f) * 4f; - float follyChargePrepareVelMult = 8f; - follyChargePrepareTargetDirection.Normalize(); - follyChargePrepareTargetDirection *= follyChargePrepareSpeed; - npc.velocity = (npc.velocity * (follyChargePrepareVelMult - 1f) + follyChargePrepareTargetDirection) / follyChargePrepareVelMult; - - 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) - { - // Set damage - npc.damage = npc.defDamage; - - npc.velocity = follyChargePrepareTargetDirection; - - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.ai[0] = 3.2f; - npc.ai[1] = npc.direction; - - npc.ForceNetUpdate(false); - npc.SyncExtraAI(); - } - } - - // Charge - else if (npc.ai[0] == 3.2f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.ai[2] += 0.0333333351f; - float velocity = 28f + (enrageScale - 1f) * 4f; - npc.velocity.X = (velocity + 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)) - { - npc.TargetClosest(); - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ForceNetUpdate(false); - } - else if (Math.Abs(npc.Center.X - player.Center.X) > chargeDistance + 200f) - { - npc.TargetClosest(); - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ForceNetUpdate(false); - } - } - - npc.rotation = (npc.rotation * rotationMult * 0.5f + npc.velocity.X * rotationAmt * 0.85f) / 5f; - } - - // Birb spawn - else if (npc.ai[0] == 4f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (npc.ai[1] == 0f) - { - Vector2 destination2 = player.Center + new Vector2(0f, -200f); - Vector2 desiredVelocity2 = npc.SafeDirectionTo(destination2, -Vector2.UnitY) * 18f; - npc.SimpleFlyMovement(desiredVelocity2, 1.5f); - - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.spriteDirection = npc.direction; - - npc.ai[2] += 1f; - if (npc.Distance(player.Center) < 600f || npc.ai[2] >= 180f) - { - npc.ai[1] = 1f; - npc.ForceNetUpdate(false); - } - } - else - { - if (npc.ai[1] < 90f) - npc.velocity *= 0.95f; - else - npc.velocity *= 0.98f; - - if (npc.ai[1] == 90f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y /= 3f; - - npc.velocity.Y -= 3f; - } - - // Sound - if (npc.ai[1] == birbSpawnPhaseTimer - 60f) - { - float squawkpitch = Main.zenithWorld ? 1.3f : 0.25f; - SoundEngine.PlaySound(SoundID.DD2_BetsyScream with { Pitch = squawkpitch }, npc.Center); - - if (Main.zenithWorld) - { - int spacing = 30; - int amt = 3; - SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, npc.Center - Vector2.UnitY * 300f); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - for (int i = 0; i < amt; i++) - { - Vector2 fireFrom = new Vector2(npc.Center.X + (spacing * i) - (spacing * amt / 2), npc.Center.Y - 900f); - Vector2 ai0 = npc.Center - fireFrom; - float ai = Main.rand.Next(100); - Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; - Projectile.NewProjectile(npc.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), npc.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai); - } - } - } - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - bool gfbSpawnFlag = CalamityWorld.LegendaryMode && revenge && (npc.ai[1] == 145f || npc.ai[1] == 150f || npc.ai[1] == 160f || npc.ai[1] == 165f); - bool spawnFlag = NPC.CountNPCS(ModContent.NPCType()) < maxBirbs && (npc.ai[1] == 140f || (revenge && npc.ai[1] == 155f) || npc.ai[1] == 170f || gfbSpawnFlag); - if (spawnFlag) - { - Vector2 follySpawnCenter = npc.Center + (MathHelper.TwoPi * Main.rand.NextFloat()).ToRotationVector2() * new Vector2(2f, 1f) * 50f * (0.6f + Main.rand.NextFloat() * 0.4f); - if (Vector2.Distance(follySpawnCenter, player.Center) > 150f) - NPC.NewNPC(npc.GetSource_FromAI(), (int)follySpawnCenter.X, (int)follySpawnCenter.Y, ModContent.NPCType(), npc.whoAmI); - - npc.ForceNetUpdate(false); - } - } - - npc.ai[1] += 1f; - } - - if (npc.ai[1] >= birbSpawnPhaseTimer) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.ForceNetUpdate(false); - } - } - - // Spit homing aura sphere - else if (npc.ai[0] == 5f) - { - // Avoid cheap bullshit - npc.damage = 0; - - // 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) - { - SoundEngine.PlaySound(SoundID.DD2_BetsyFireballShot, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 follySpawnCenter = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + npc.Center; - float ai0 = (phase3 ? 2f : 0f) + (enrageScale - 1f); - if (ai0 > 3f) - ai0 = 3f; - - Projectile.NewProjectile(npc.GetSource_FromAI(), follySpawnCenter.X, follySpawnCenter.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, ai0, npc.target + 1); - npc.ForceNetUpdate(false); - } - - if (Main.zenithWorld) - { - int spacing = 30; - int amt = 3; - SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, npc.Center - Vector2.UnitY * 300f); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - for (int i = 0; i < amt; i++) - { - Vector2 fireFrom = new Vector2(npc.Center.X + (spacing * i) - (spacing * amt / 2), npc.Center.Y - 900f); - Vector2 ai0 = npc.Center - fireFrom; - float ai = Main.rand.Next(100); - Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; - Projectile.NewProjectile(npc.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), npc.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai); - } - } - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= aiGateValue) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ForceNetUpdate(false); - } - } - } - - public static void VanillaBumblebirb2AI(NPC npc, Mod mod, bool bossMinion) - { - Player player = Main.player[npc.target]; - - float rotationMult = 4f; - float rotationAmt = 0.04f; - - if (Vector2.Distance(player.Center, npc.Center) > 5600f) - { - if (npc.timeLeft > 5) - npc.timeLeft = 5; - } - - npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt * 1.25f) / 10f; - - if (npc.ai[0] == 0f || npc.ai[0] == 1f) - { - for (int i = 0; i < Main.maxNPCs; i++) - { - if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type) - { - Vector2 otherSwarmerDirection = Main.npc[i].Center - npc.Center; - if (otherSwarmerDirection.Length() < (npc.width + npc.height)) - { - otherSwarmerDirection.Normalize(); - otherSwarmerDirection *= -0.1f; - npc.velocity += otherSwarmerDirection; - NPC nPC6 = Main.npc[i]; - nPC6.velocity -= otherSwarmerDirection; - } - } - } - } - - if (npc.target < 0 || Main.player[npc.target].dead || !Main.player[npc.target].active) - { - npc.TargetClosest(true); - Vector2 swarmerTargetDist = Main.player[npc.target].Center - npc.Center; - if (Main.player[npc.target].dead || swarmerTargetDist.Length() > (bossMinion ? 5600f : 2800f)) - npc.ai[0] = -1f; - } - else - { - Vector2 swarmerCatchUpTargetDist = Main.player[npc.target].Center - npc.Center; - if (npc.ai[0] > 1f && swarmerCatchUpTargetDist.Length() > 3600f) - npc.ai[0] = 1f; - } - - if (npc.ai[0] == -1f) - { - // Avoid cheap bullshit - npc.damage = 0; - - Vector2 swarmerDespawnVelMult = new Vector2(0f, -8f); - npc.velocity = (npc.velocity * 21f + swarmerDespawnVelMult) / 10f; - return; - } - - if (npc.ai[0] == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.TargetClosest(true); - npc.spriteDirection = npc.direction; - - Vector2 swarmerIdleTargetDist = Main.player[npc.target].Center - npc.Center; - if (swarmerIdleTargetDist.Length() > 2800f) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - else if (swarmerIdleTargetDist.Length() > 400f) - { - float swarmerIdleSpeed = (bossMinion ? 9f : 7f) + swarmerIdleTargetDist.Length() / 100f + npc.ai[1] / 15f; - swarmerIdleTargetDist.Normalize(); - swarmerIdleTargetDist *= swarmerIdleSpeed; - npc.velocity = (npc.velocity * 29f + swarmerIdleTargetDist) / 30f; - if (Main.getGoodWorld && !Main.zenithWorld) - npc.velocity *= 1.15f; - } - else if (npc.velocity.Length() > 2f) - npc.velocity *= 0.95f; - else if (npc.velocity.Length() < 1f) - npc.velocity *= 1.05f; - - npc.ai[1] += 1f; - if (npc.ai[1] >= (bossMinion ? 90f : 105f)) - { - npc.ai[1] = 0f; - npc.ai[0] = 2f; - } - } - else - { - if (npc.ai[0] == 1f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (npc.target < 0 || !Main.player[npc.target].active || Main.player[npc.target].dead) - npc.TargetClosest(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 swarmerChargeTargetDist = Main.player[npc.target].Center - npc.Center; - if (swarmerChargeTargetDist.Length() < 800f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - - npc.ai[2] += 0.0166666675f; - float swarmerChargeSpeed = (bossMinion ? 12f : 9f) + npc.ai[2] + swarmerChargeTargetDist.Length() / 150f; - float swarmerChargeVelMult = 25f; - swarmerChargeTargetDist.Normalize(); - swarmerChargeTargetDist *= swarmerChargeSpeed; - npc.velocity = (npc.velocity * (swarmerChargeVelMult - 1f) + swarmerChargeTargetDist) / swarmerChargeVelMult; - if (Main.getGoodWorld && !Main.zenithWorld) - npc.velocity *= 1.15f; - - npc.ForceNetUpdate(); - - return; - } - - if (npc.ai[0] == 2f) - { - // Avoid cheap bullshit - npc.damage = 0; - - 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 * 0.75f + npc.velocity.X * rotationAmt * 1.25f) / 8f; - - Vector2 swarmerDecelerateTargetDist = Main.player[npc.target].Center - npc.Center; - swarmerDecelerateTargetDist.Y -= 8f; - float swarmerDecelerateSpeed = bossMinion ? 18f : 14f; - float swarmerDecelerateVelMult = 8f; - swarmerDecelerateTargetDist.Normalize(); - swarmerDecelerateTargetDist *= swarmerDecelerateSpeed; - npc.velocity = (npc.velocity * (swarmerDecelerateVelMult - 1f) + swarmerDecelerateTargetDist) / swarmerDecelerateVelMult; - if (Main.getGoodWorld && !Main.zenithWorld) - npc.velocity *= 1.15f; - - 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) - { - // Set damage - npc.damage = npc.defDamage; - - npc.velocity = swarmerDecelerateTargetDist; - if (Main.getGoodWorld && !Main.zenithWorld) - npc.velocity *= 1.15f; - - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.ai[0] = 2.1f; - npc.ai[1] = 0f; - } - } - else if (npc.ai[0] == 2.1f) - { - // Set damage - npc.damage = npc.defDamage; - - if (npc.velocity.X < 0f) - npc.direction = -1; - else if (npc.velocity.X > 0f) - npc.direction = 1; - - npc.spriteDirection = npc.direction; - - npc.velocity *= 1.01f; - - npc.ai[1] += 1f; - if (npc.ai[1] > 30f) - { - if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - return; - } - - if (npc.ai[1] > 60f) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - } - } - } - } - } -} diff --git a/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs deleted file mode 100644 index 1f70165548..0000000000 --- a/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs +++ /dev/null @@ -1,1406 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.CalPlayer; -using CalamityMod.Dusts; -using CalamityMod.Events; -using CalamityMod.NPCs.Abyss; -using CalamityMod.NPCs.CalClone; -using CalamityMod.Projectiles.Boss; -using CalamityMod.Projectiles.Enemy; -using CalamityMod.Sounds; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using ReLogic.Utilities; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs -{ - public static class CalamitasCloneAI - { - public static void VanillaCalamitasCloneAI(NPC npc, SlotId warn) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - // Emit light - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1f, 0f, 0f); - - // Variables for increasing difficulty - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - // Phases - bool phase2 = lifeRatio < 0.7f || death; - bool phase3 = lifeRatio < 0.35f; - bool phase4 = lifeRatio <= 0.1f && death; - - // Don't take damage during bullet hells - npc.dontTakeDamage = calamityGlobalNPC.newAI[2] > 0f; - - // Variable for live brothers - bool brotherAlive = false; - - // For seekers - CalamityGlobalNPC.calamitas = npc.whoAmI; - - // Seeker ring - if (calamityGlobalNPC.newAI[1] == 0f && phase3 && expertMode) - { - SoundEngine.PlaySound(SoundID.Item72, npc.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int seekerAmt = death ? 10 : 5; - int seekerSpread = 360 / seekerAmt; - int seekerDistance = death ? 180 : 150; - for (int i = 0; i < seekerAmt; i++) - { - int spawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * seekerSpread) * seekerDistance)), (int)(npc.Center.Y + (Math.Cos(i * seekerSpread) * seekerDistance)), ModContent.NPCType(), npc.whoAmI, 0, 0, 0, -1); - Main.npc[spawn].ai[0] = i * seekerSpread; - } - } - - string key = "Mods.CalamityMod.Status.Boss.CalamitasBossText3"; - Color messageColor = Color.Orange; - CalamityUtils.DisplayLocalizedText(key, messageColor); - - calamityGlobalNPC.newAI[1] = 1f; - } - - // CIT 14SEP2024: Fixed bug where her phases would get offset by dealing a large amount of damage in a single hit to take her into a new phase. - // newAI[0] now starts at 1 and has 0.3 subtracted from it for each phase, instead of it storing her current health when she enters a new phase. - - // Do bullet hell or spawn brothers - if (calamityGlobalNPC.newAI[0] == 0f && npc.life > 0) - calamityGlobalNPC.newAI[0] = 1f; - - // Bullet hells at 70% and 10%, brothers at 40% - if (npc.life > 0) - { - int calClonePhaseThreshold = (int)(npc.lifeMax * 0.3); - if (((npc.life + calClonePhaseThreshold) / (float)npc.lifeMax) < calamityGlobalNPC.newAI[0]) - { - calamityGlobalNPC.newAI[0] -= 0.3f; - if (calamityGlobalNPC.newAI[0] <= 0.1f) - { - SoundEngine.PlaySound(SoundID.Item109, npc.Center); - calamityGlobalNPC.newAI[2] = 2f; - - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - calamityGlobalNPC.newAI[3] = 0f; - - SpawnDust(); - } - else if (calamityGlobalNPC.newAI[0] <= 0.4f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.position.Y + npc.height, ModContent.NPCType(), npc.whoAmI); - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.position.Y + npc.height, ModContent.NPCType(), npc.whoAmI); - } - - string key = "Mods.CalamityMod.Status.Boss.CalamitasBossText2"; - Color messageColor = Color.Orange; - CalamityUtils.DisplayLocalizedText(key, messageColor); - - SpawnDust(); - } - else - { - SoundEngine.PlaySound(SoundID.Item109, npc.Center); - calamityGlobalNPC.newAI[2] = 1f; - - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - calamityGlobalNPC.newAI[3] = 0f; - - SpawnDust(); - } - } - } - - // Immunity if brothers are alive - if (CalamityGlobalNPC.cataclysm != -1) - { - if (Main.npc[CalamityGlobalNPC.cataclysm].active) - brotherAlive = true; - } - if (CalamityGlobalNPC.catastrophe != -1) - { - if (Main.npc[CalamityGlobalNPC.catastrophe].active) - brotherAlive = true; - } - - if (brotherAlive) - npc.dontTakeDamage = true; - - void SpawnDust() - { - int dustAmt = 50; - int random = 3; - - for (int j = 0; j < 10; j++) - { - random += j; - int dustAmtSpawned = 0; - int scale = random * 6; - float dustPositionX = npc.Center.X - (scale / 2); - float dustPositionY = npc.Center.Y - (scale / 2); - while (dustAmtSpawned < dustAmt) - { - float dustVelocityX = Main.rand.Next(-random, random); - float dustVelocityY = Main.rand.Next(-random, random); - float dustVelocityScalar = random * 2f; - float dustVelocity = (float)Math.Sqrt(dustVelocityX * dustVelocityX + dustVelocityY * dustVelocityY); - dustVelocity = dustVelocityScalar / dustVelocity; - dustVelocityX *= dustVelocity; - dustVelocityY *= dustVelocity; - int dust = Dust.NewDust(new Vector2(dustPositionX, dustPositionY), scale, scale, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); - Main.dust[dust].noGravity = true; - Main.dust[dust].position.X = npc.Center.X; - Main.dust[dust].position.Y = npc.Center.Y; - Main.dust[dust].position.X += Main.rand.Next(-10, 11); - Main.dust[dust].position.Y += Main.rand.Next(-10, 11); - Main.dust[dust].velocity.X = dustVelocityX; - Main.dust[dust].velocity.Y = dustVelocityY; - dustAmtSpawned++; - } - } - } - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); - - // Target variable - Player player = Main.player[npc.target]; - - float enrageScale = bossRush ? 1f : 0f; - if (Main.IsItDay() || bossRush) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 2f; - } - - // Rotation - Vector2 npcCenter = new Vector2(npc.Center.X, npc.position.Y + npc.height - 59f); - Vector2 lookAt = new Vector2(player.position.X - (player.width / 2), player.position.Y - (player.height / 2)); - Vector2 rotationVector = npcCenter - lookAt; - - // Boss Rush predictive charge rotation - if (npc.ai[1] == 4f && phase4 && bossRush) - { - // Velocity - float chargeVelocity = 30f; - chargeVelocity += 5f * enrageScale; - lookAt += Main.player[npc.target].velocity * 20f; - rotationVector = Vector2.Normalize(npcCenter - lookAt) * chargeVelocity; - } - - float rotation = (float)Math.Atan2(rotationVector.Y, rotationVector.X) + MathHelper.PiOver2; - if (rotation < 0f) - rotation += MathHelper.TwoPi; - else if (rotation > MathHelper.TwoPi) - rotation -= MathHelper.TwoPi; - - float rotationAmt = 0.1f; - if (npc.rotation < rotation) - { - if ((rotation - npc.rotation) > MathHelper.Pi) - npc.rotation -= rotationAmt; - else - npc.rotation += rotationAmt; - } - else if (npc.rotation > rotation) - { - if ((npc.rotation - rotation) > MathHelper.Pi) - npc.rotation += rotationAmt; - else - npc.rotation -= rotationAmt; - } - - if (npc.rotation > rotation - rotationAmt && npc.rotation < rotation + rotationAmt) - npc.rotation = rotation; - if (npc.rotation < 0f) - npc.rotation += MathHelper.TwoPi; - else if (npc.rotation > MathHelper.TwoPi) - npc.rotation -= MathHelper.TwoPi; - if (npc.rotation > rotation - rotationAmt && npc.rotation < rotation + rotationAmt) - npc.rotation = rotation; - - // Despawn - if (!player.active || player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - if (SoundEngine.TryGetActiveSound(warn, out var warningSound) && warningSound.IsPlaying) - warningSound.Stop(); - - if (npc.velocity.Y > 3f) - npc.velocity.Y = 3f; - npc.velocity.Y -= 0.1f; - if (npc.velocity.Y < -12f) - npc.velocity.Y = -12f; - - if (npc.timeLeft > 60) - npc.timeLeft = 60; - - if (npc.ai[1] != 0f) - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - calamityGlobalNPC.newAI[3] = 0f; - npc.alpha = 0; - npc.netUpdate = true; - } - return; - } - } - else if (npc.timeLeft < 1800) - npc.timeLeft = 1800; - - // Distance from destination where Cal Clone stops moving - float movementDistanceGateValue = 100f; - - // How fast Cal Clone moves to the destination - float baseVelocity = (expertMode ? 10f : 8.5f) * (npc.ai[1] == 4f ? 1.4f : 1f); - float baseAcceleration = (expertMode ? 0.18f : 0.155f) * (npc.ai[1] == 4f ? 1.4f : 1f); - baseVelocity += 4f * enrageScale; - baseAcceleration += 0.1f * enrageScale; - if (revenge) - { - baseVelocity += 1.5f * (1f - lifeRatio); - baseAcceleration += 0.03f * (1f - lifeRatio); - } - if (death) - { - baseVelocity += 1.5f * (1f - lifeRatio); - baseAcceleration += 0.03f * (1f - lifeRatio); - } - if (Main.getGoodWorld) - { - baseVelocity *= 1.15f; - baseAcceleration *= 1.15f; - } - - // What side Cal Clone should be on, relative to the target - int xPos = 1; - if (npc.Center.X < player.Center.X) - xPos = -1; - - // How far Cal Clone should be from the target - float averageDistance = 500f; - float chargeDistance = phase4 ? 300f : 400f; - - // This is where Cal Clone should be - Vector2 destination = (calamityGlobalNPC.newAI[2] > 0f || npc.ai[1] == 0f) ? new Vector2(player.Center.X, player.Center.Y - averageDistance) : - npc.ai[1] == 1f ? new Vector2(player.Center.X + averageDistance * xPos, player.Center.Y) : - new Vector2(player.Center.X + chargeDistance * xPos, player.Center.Y); - - // Add some random distance to the destination after certain attacks - if (npc.localAI[0] == 1f) - { - npc.localAI[0] = 0f; - npc.localAI[2] = Main.rand.Next(-50, 51); - npc.localAI[3] = Main.rand.Next(-300, 301); - npc.netUpdate = true; - } - - // Add a bit of randomness to the destination - if (death) - { - destination.X += npc.ai[1] == 0f ? npc.localAI[3] : npc.localAI[2]; - destination.Y += npc.ai[1] == 0f ? npc.localAI[2] : npc.localAI[3]; - } - - // How far Cal Clone is from where she's supposed to be - Vector2 distanceFromDestination = destination - npc.Center; - - // Movement - if (npc.ai[1] == 0f || npc.ai[1] == 1f || npc.ai[1] == 4f || calamityGlobalNPC.newAI[2] > 0f) - CalamityUtils.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity, baseAcceleration, true); - - // Bullet hell phase - if (calamityGlobalNPC.newAI[2] > 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (calamityGlobalNPC.newAI[3] < 900f) - { - calamityGlobalNPC.newAI[3] += 1f; - npc.dontTakeDamage = true; - npc.alpha = 255; - - float rotX = player.Center.X - npc.Center.X; - float rotY = player.Center.Y - npc.Center.Y; - npc.rotation = (float)Math.Atan2(rotY, rotX) - MathHelper.PiOver2; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (calamityGlobalNPC.newAI[2] == 2f) - { - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - if (Main.zenithWorld) - type = ModContent.ProjectileType(); - - float gigaBlastFrequency = (Main.getGoodWorld ? 120f : expertMode ? 180f : 240f) - enrageScale * 15f; - float projSpeed = bossRush ? 6.25f : 5f; - if (calamityGlobalNPC.newAI[3] <= 300f) - { - if (calamityGlobalNPC.newAI[3] % gigaBlastFrequency == 0f) // Blasts from top - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed, type, damage, 0f, Main.myPlayer); - } - else if (calamityGlobalNPC.newAI[3] <= 600f && calamityGlobalNPC.newAI[3] > 300f) - { - if (calamityGlobalNPC.newAI[3] % gigaBlastFrequency == 0f) // Blasts from right - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -projSpeed, 0f, type, damage, 0f, Main.myPlayer); - } - else if (calamityGlobalNPC.newAI[3] > 600f) - { - if (calamityGlobalNPC.newAI[3] % gigaBlastFrequency == 0f) // Blasts from top - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed, type, damage, 0f, Main.myPlayer); - } - } - } - - npc.ai[0] += 1f; - float hellblastGateValue = (expertMode ? 12f : 16f) - enrageScale; - if (npc.ai[0] >= hellblastGateValue) - { - npc.ai[0] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - float projSpeed = bossRush ? 4.5f : 4f; - // Blasts aimed directly at the player's horizontal position, does not spawn during the second bullet hell - if (calamityGlobalNPC.newAI[3] % (hellblastGateValue * 6f) == 0f && calamityGlobalNPC.newAI[2] != 2f) - { - float distance = Main.rand.NextBool() ? -1000f : 1000f; - float velocity = distance == -1000f ? projSpeed : -projSpeed; - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); - } - - if (calamityGlobalNPC.newAI[3] < 300f) // Blasts from above - { - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed, type, damage, 0f, Main.myPlayer, 2f, 0f); - } - else if (calamityGlobalNPC.newAI[3] < 600f) // Blasts from left and right - { - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -(projSpeed - 0.5f), 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), projSpeed - 0.5f, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); - } - else // Blasts from above, left, and right - { - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed - 1f, type, damage, 0f, Main.myPlayer, 2f, 0f); - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -(projSpeed - 1f), 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), projSpeed - 1f, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); - } - } - } - - if (calamityGlobalNPC.newAI[3] == 900f - 360f) - warn = SoundEngine.PlaySound(CalamitasClone.BulletHellWarning, player.Center); - if (calamityGlobalNPC.newAI[3] > 900f - 360f) - { - if (SoundEngine.TryGetActiveSound(warn, out var warningSound) && warningSound.IsPlaying) - warningSound.Position = player.Center; - } - } - else - { - npc.ai[0] = 0f; - npc.ai[3] = 0f; - npc.localAI[1] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - calamityGlobalNPC.newAI[3] = 0f; - SoundEngine.PlaySound(CalamitasClone.BulletHellEnd, player.Center); - - // Prevent bullshit charge hits when second bullet hell ends. - if (phase4) - { - npc.ai[1] = 4f; - npc.ai[2] = -105f; - npc.TargetClosest(); - } - else - { - if (death) - { - int AIState = Main.rand.Next(3); - switch (AIState) - { - case 0: - npc.ai[1] = 0f; - npc.ai[2] = 0f; - break; - case 1: - npc.ai[1] = 1f; - npc.ai[2] = 0f; - break; - case 2: - npc.ai[1] = 4f; - npc.ai[2] = -105f; - npc.TargetClosest(); - break; - } - } - else - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - if (death) - npc.localAI[0] = 1f; - } - - npc.netUpdate = true; - - for (int x = 0; x < Main.maxProjectiles; x++) - { - Projectile projectile = Main.projectile[x]; - if (projectile.active) - { - if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) - { - if (projectile.timeLeft > 60) - projectile.timeLeft = 60; - } - else if (projectile.type == ModContent.ProjectileType()) - { - projectile.ai[2] = 1f; - - if (projectile.timeLeft > 60) - projectile.timeLeft = 60; - } - } - } - } - - return; - } - else if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - { - if (calamityGlobalNPC.newAI[3] < 900f) - calamityGlobalNPC.newAI[3] += 1f; - else - calamityGlobalNPC.newAI[3] = 0f; - - npc.ai[0] += 1f; - float hellblastGateValue = 30f - enrageScale; - if (npc.ai[0] >= hellblastGateValue) - { - npc.ai[0] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - float projSpeed = bossRush ? 5f : 4f; - if (calamityGlobalNPC.newAI[3] % (hellblastGateValue * 6f) == 0f) - { - float distance = Main.rand.NextBool() ? -1000f : 1000f; - float velocity = distance == -1000f ? projSpeed : -projSpeed; - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); - } - - if (calamityGlobalNPC.newAI[3] < 300f) // Blasts from above - { - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed, type, damage, 0f, Main.myPlayer, 2f, 0f); - } - else if (calamityGlobalNPC.newAI[3] < 600f) // Blasts from left and right - { - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -(projSpeed - 0.5f), 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), projSpeed - 0.5f, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); - } - else // Blasts from above, left, and right - { - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed - 1f, type, damage, 0f, Main.myPlayer, 2f, 0f); - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -(projSpeed - 1f), 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), projSpeed - 1f, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); - } - } - } - } - - npc.alpha = npc.dontTakeDamage ? 255 : 0; - - // Float above target and fire hellfireballs - if (npc.ai[1] == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.ai[2] += 1f; - float phaseTimer = 400f - (death ? 120f * (1f - lifeRatio) : 0f); - if (npc.ai[2] >= phaseTimer || phase4) - { - if (death && !phase4 && Main.rand.NextBool() && !brotherAlive) - npc.ai[1] = 4f; - else - npc.ai[1] = 1f; - - npc.ai[2] = 0f; - if (death) - npc.localAI[0] = 1f; - - npc.netUpdate = true; - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - if (!brotherAlive) - { - if (expertMode) - npc.localAI[1] += death ? 2f * (1f - lifeRatio) : 1f - lifeRatio; - if (revenge) - npc.localAI[1] += 0.5f; - } - - if (npc.localAI[1] >= (brotherAlive ? 180f : 120f)) - { - npc.localAI[1] = 0f; - SoundEngine.PlaySound(BrimstoneElemental.BrimstoneElemental.HellfireballSound, npc.Center); - - float projectileVelocity = expertMode ? 14f : 12.5f; - projectileVelocity += 3f * enrageScale; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - bool shootPredictiveShot = CalamityWorld.LegendaryMode && CalamityWorld.revenge && Main.rand.NextBool(); - Vector2 predictionVector = shootPredictiveShot ? player.velocity * 20f : Vector2.Zero; - Vector2 fireballVelocity = Vector2.Normalize(player.Center + predictionVector - npc.Center) * projectileVelocity; - Vector2 offset = Vector2.Normalize(fireballVelocity) * 40f; - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, fireballVelocity, type, damage, 0f, Main.myPlayer, player.position.X, player.position.Y); - Main.projectile[proj].netUpdate = true; - } - } - } - - // Float to the side of the target and fire - else if (npc.ai[1] == 1f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - if (!brotherAlive) - { - if (revenge) - npc.localAI[1] += 0.5f; - if (expertMode) - npc.localAI[1] += 0.5f; - } - - if (npc.localAI[1] >= (brotherAlive ? 75f : 50f) && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - npc.localAI[1] = 0f; - - float projectileVelocity = expertMode ? 12.5f : 11f; - projectileVelocity += 3f * enrageScale; - int type = brotherAlive ? ModContent.ProjectileType() : ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Vector2 fireballVelocity = Vector2.Normalize(player.Center - npc.Center) * projectileVelocity; - Vector2 offset = Vector2.Normalize(fireballVelocity) * 40f; - - if (!Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - type = ModContent.ProjectileType(); - damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, fireballVelocity, type, damage, 0f, Main.myPlayer, player.position.X, player.position.Y); - } - else - { - float ai0 = type == ModContent.ProjectileType() ? 1f : player.position.X; - float ai1 = type == ModContent.ProjectileType() ? 0f : player.position.Y; - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, fireballVelocity, type, damage, 0f, Main.myPlayer, ai0, ai1); - } - } - } - - npc.ai[2] += 1f; - float phaseTimer = 240f - (death ? 60f * (1f - lifeRatio) : 0f); - if (npc.ai[2] >= phaseTimer || phase4) - { - if (death && !phase4 && Main.rand.NextBool() && !brotherAlive) - npc.ai[1] = 0f; - else - npc.ai[1] = !brotherAlive && phase2 && revenge ? 4f : 0f; - - npc.ai[2] = 0f; - if (death) - npc.localAI[0] = 1f; - - npc.netUpdate = true; - } - } - else if (npc.ai[1] == 2f) - { - // Set damage - npc.damage = npc.defDamage; - SoundEngine.PlaySound(CalamitasClone.ChargeSound, npc.Center); - npc.rotation = rotation; - - float chargeVelocity = phase4 ? 30f : death ? 28f : 25f; - chargeVelocity += 5f * enrageScale; - - Vector2 vector = Vector2.Normalize(player.Center + (phase4 && bossRush ? player.velocity * 20f : Vector2.Zero) - npc.Center); - npc.velocity = vector * chargeVelocity; - - npc.ai[1] = 3f; - npc.netUpdate = true; - } - else if (npc.ai[1] == 3f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.ai[2] += 1f; - - float chargeTime = phase4 ? 35f : death ? 40f : 45f; - if (npc.ai[2] >= chargeTime) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.velocity *= 0.9f; - if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) - npc.velocity.X = 0f; - if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - { - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; - - // Leave behind slow hellblasts in Death Mode - if (Main.netMode != NetmodeID.MultiplayerClient && death && phase3 && npc.ai[2] % (phase4 ? 6f : 10f) == 0f) - { - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Vector2 fireballVelocity = CalamityWorld.LegendaryMode ? Main.rand.NextVector2CircularEdge(0.02f, 0.02f) : npc.velocity * 0.01f; - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, fireballVelocity, type, damage, 0f, Main.myPlayer, 1f, 0f); - } - } - - if (npc.ai[2] >= chargeTime + 10f) - { - if (!phase4) - npc.ai[3] += 1f; - - npc.ai[2] = 0f; - - npc.rotation = rotation; - npc.netUpdate = true; - - if (npc.ai[3] >= 2f) - { - npc.TargetClosest(); - npc.ai[1] = 0f; - npc.ai[3] = 0f; - return; - } - - npc.ai[1] = 4f; - } - } - else - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.ai[2] += 1f; - if (npc.ai[2] >= (phase4 ? 15f : 30f)) - { - npc.ai[1] = 2f; - npc.ai[2] = 0f; - if (death) - npc.localAI[0] = 1f; - - npc.netUpdate = true; - } - } - } - - public static void VanillaCataclysmAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - if (CalamityGlobalNPC.calamitas < 0 || !Main.npc[CalamityGlobalNPC.calamitas].active) - { - if (npc.alpha < 255) - { - npc.velocity *= 0.9f; - - npc.alpha += 2; - if (npc.alpha > 255) - npc.alpha = 255; - - int dustAmount = (int)Math.Round(MathHelper.Lerp(1f, 5f, (255 - npc.alpha) / 255f)); - for (int i = 0; i < dustAmount; i++) - { - int dust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.LifeDrain, 0f, -1f, 90, default, Main.rand.NextFloat(0.5f, 2f)); - Main.dust[dust].noGravity = true; - Main.dust[dust].fadeIn = 1f; - } - } - else - npc.active = false; - - npc.active = false; - return; - } - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - CalamityGlobalNPC.cataclysm = npc.whoAmI; - - // Emit light - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1f, 0f, 0f); - - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); - - Player player = Main.player[npc.target]; - - float enrageScale = bossRush ? 1f : 0f; - if (Main.IsItDay() || bossRush) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 2f; - } - - float calCloneBroPlayerXDist = npc.position.X + (npc.width / 2) - player.position.X - (player.width / 2); - float calCloneBroPlayerYDist = npc.position.Y + npc.height - 59f - player.position.Y - (player.height / 2); - float calCloneBroRotation = (float)Math.Atan2(calCloneBroPlayerYDist, calCloneBroPlayerXDist) + MathHelper.PiOver2; - if (calCloneBroRotation < 0f) - calCloneBroRotation += MathHelper.TwoPi; - else if (calCloneBroRotation > MathHelper.TwoPi) - calCloneBroRotation -= MathHelper.TwoPi; - - float calCloneBroRotationSpeed = 0.15f; - if (npc.rotation < calCloneBroRotation) - { - if ((calCloneBroRotation - npc.rotation) > MathHelper.Pi) - npc.rotation -= calCloneBroRotationSpeed; - else - npc.rotation += calCloneBroRotationSpeed; - } - else if (npc.rotation > calCloneBroRotation) - { - if ((npc.rotation - calCloneBroRotation) > MathHelper.Pi) - npc.rotation += calCloneBroRotationSpeed; - else - npc.rotation -= calCloneBroRotationSpeed; - } - - if (npc.rotation > calCloneBroRotation - calCloneBroRotationSpeed && npc.rotation < calCloneBroRotation + calCloneBroRotationSpeed) - npc.rotation = calCloneBroRotation; - if (npc.rotation < 0f) - npc.rotation += MathHelper.TwoPi; - else if (npc.rotation > MathHelper.TwoPi) - npc.rotation -= MathHelper.TwoPi; - if (npc.rotation > calCloneBroRotation - calCloneBroRotationSpeed && npc.rotation < calCloneBroRotation + calCloneBroRotationSpeed) - npc.rotation = calCloneBroRotation; - - if (!player.active || player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - if (npc.velocity.Y > 3f) - npc.velocity.Y = 3f; - npc.velocity.Y -= 0.1f; - if (npc.velocity.Y < -12f) - npc.velocity.Y = -12f; - - if (npc.timeLeft > 60) - npc.timeLeft = 60; - - if (npc.ai[1] != 0f) - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - return; - } - } - - if (npc.ai[1] == 0f) - { - // Avoid cheap bullshit - npc.damage = (int)Math.Round(npc.defDamage * 0.5); - - float calCloneBroProjAttackMaxSpeed = 5f; - float calCloneBroProjAttackAccel = 0.1f; - calCloneBroProjAttackMaxSpeed += 2f * enrageScale; - calCloneBroProjAttackAccel += 0.06f * enrageScale; - - if (Main.getGoodWorld) - { - calCloneBroProjAttackMaxSpeed *= 1.15f; - calCloneBroProjAttackAccel *= 1.15f; - } - - int calCloneBroProjAttackDirection = 1; - if (npc.position.X + (npc.width / 2) < player.position.X + player.width) - calCloneBroProjAttackDirection = -1; - - Vector2 calCloneBroProjLocation = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float calCloneBroProjTargetX = player.position.X + (player.width / 2) + (calCloneBroProjAttackDirection * 180) - calCloneBroProjLocation.X; - float calCloneBroProjTargetY = player.position.Y + (player.height / 2) - calCloneBroProjLocation.Y; - float calCloneBroProjTargetDist = (float)Math.Sqrt(calCloneBroProjTargetX * calCloneBroProjTargetX + calCloneBroProjTargetY * calCloneBroProjTargetY); - - if (expertMode) - { - if (calCloneBroProjTargetDist > 300f) - calCloneBroProjAttackMaxSpeed += 0.5f; - if (calCloneBroProjTargetDist > 400f) - calCloneBroProjAttackMaxSpeed += 0.5f; - if (calCloneBroProjTargetDist > 500f) - calCloneBroProjAttackMaxSpeed += 0.55f; - if (calCloneBroProjTargetDist > 600f) - calCloneBroProjAttackMaxSpeed += 0.55f; - if (calCloneBroProjTargetDist > 700f) - calCloneBroProjAttackMaxSpeed += 0.6f; - if (calCloneBroProjTargetDist > 800f) - calCloneBroProjAttackMaxSpeed += 0.6f; - } - - calCloneBroProjTargetDist = calCloneBroProjAttackMaxSpeed / calCloneBroProjTargetDist; - calCloneBroProjTargetX *= calCloneBroProjTargetDist; - calCloneBroProjTargetY *= calCloneBroProjTargetDist; - - if (npc.velocity.X < calCloneBroProjTargetX) - { - npc.velocity.X += calCloneBroProjAttackAccel; - if (npc.velocity.X < 0f && calCloneBroProjTargetX > 0f) - npc.velocity.X += calCloneBroProjAttackAccel; - } - else if (npc.velocity.X > calCloneBroProjTargetX) - { - npc.velocity.X -= calCloneBroProjAttackAccel; - if (npc.velocity.X > 0f && calCloneBroProjTargetX < 0f) - npc.velocity.X -= calCloneBroProjAttackAccel; - } - if (npc.velocity.Y < calCloneBroProjTargetY) - { - npc.velocity.Y += calCloneBroProjAttackAccel; - if (npc.velocity.Y < 0f && calCloneBroProjTargetY > 0f) - npc.velocity.Y += calCloneBroProjAttackAccel; - } - else if (npc.velocity.Y > calCloneBroProjTargetY) - { - npc.velocity.Y -= calCloneBroProjAttackAccel; - if (npc.velocity.Y > 0f && calCloneBroProjTargetY < 0f) - npc.velocity.Y -= calCloneBroProjAttackAccel; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= (240f - (death ? 120f * (1f - lifeRatio) : 0f))) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.target = 255; - npc.netUpdate = true; - } - - bool fireDelay = npc.ai[2] > 120f || npc.life < npc.lifeMax * 0.9; - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) && fireDelay) - { - if (npc.localAI[2] == 0f) - SoundEngine.PlaySound(Cataclysm.FlamethrowerStart, npc.Center); - - npc.localAI[2] += 1f; - if (npc.localAI[2] > 30f) - { - npc.localAI[2] = 1f; - SoundEngine.PlaySound(Cataclysm.FlamethrowerLoop, npc.Center); - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 3f; - if (revenge) - npc.localAI[1] += 1f; - - if (npc.localAI[1] > 12f) - { - npc.localAI[1] = 0f; - float calCloneBroProjSpeed = NPC.AnyNPCs(ModContent.NPCType()) ? 4f : 6f; - calCloneBroProjSpeed += enrageScale; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - calCloneBroProjLocation = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - calCloneBroProjTargetX = player.position.X + (player.width / 2) - calCloneBroProjLocation.X; - calCloneBroProjTargetY = player.position.Y + (player.height / 2) - calCloneBroProjLocation.Y; - calCloneBroProjTargetDist = (float)Math.Sqrt(calCloneBroProjTargetX * calCloneBroProjTargetX + calCloneBroProjTargetY * calCloneBroProjTargetY); - calCloneBroProjTargetDist = calCloneBroProjSpeed / calCloneBroProjTargetDist; - calCloneBroProjTargetX *= calCloneBroProjTargetDist; - calCloneBroProjTargetY *= calCloneBroProjTargetDist; - calCloneBroProjTargetY += npc.velocity.Y * 0.5f; - calCloneBroProjTargetX += npc.velocity.X * 0.5f; - calCloneBroProjLocation.X -= calCloneBroProjTargetX; - calCloneBroProjLocation.Y -= calCloneBroProjTargetY; - Projectile.NewProjectile(npc.GetSource_FromAI(), calCloneBroProjLocation.X, calCloneBroProjLocation.Y, calCloneBroProjTargetX, calCloneBroProjTargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - else - { - if (npc.ai[1] == 1f) - { - // Set damage - npc.damage = npc.defDamage; - - SoundEngine.PlaySound(SoundID.Roar, npc.Center); - npc.rotation = calCloneBroRotation; - - float calCloneBroChargeSpeed = 14f + (death ? 4f * (1f - lifeRatio) : 0f); - calCloneBroChargeSpeed += 3f * enrageScale; - if (expertMode) - calCloneBroChargeSpeed += 2f; - if (revenge) - calCloneBroChargeSpeed += 2f; - if (Main.getGoodWorld) - calCloneBroChargeSpeed *= 1.25f; - - Vector2 calCloneBroChargeCenter = npc.Center; - float calCloneBroChargeTargetXDist = player.Center.X - calCloneBroChargeCenter.X; - float calCloneBroChargeTargetYDist = player.Center.Y - calCloneBroChargeCenter.Y; - float calCloneBroChargeTargetDistance = (float)Math.Sqrt(calCloneBroChargeTargetXDist * calCloneBroChargeTargetXDist + calCloneBroChargeTargetYDist * calCloneBroChargeTargetYDist); - calCloneBroChargeTargetDistance = calCloneBroChargeSpeed / calCloneBroChargeTargetDistance; - npc.velocity.X = calCloneBroChargeTargetXDist * calCloneBroChargeTargetDistance; - npc.velocity.Y = calCloneBroChargeTargetYDist * calCloneBroChargeTargetDistance; - npc.ai[1] = 2f; - - if (Main.zenithWorld) - { - SoundEngine.PlaySound(SupremeCalamitas.SupremeCalamitas.BrimstoneShotSound, npc.Center); - - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(ModContent.ProjectileType()); - if (bossRush) - damage /= 2; - - int totalProjectiles = bossRush ? 12 : death ? 10 : revenge ? 8 : expertMode ? 6 : 4; - float radians = MathHelper.TwoPi / totalProjectiles; - float velocity = 5f; - Vector2 spinningPoint = new Vector2(0f, -velocity); - float projectileVelocityToPass = velocity * 3f; - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 0f, projectileVelocityToPass); - } - - for (int i = 0; i < 6; i++) - Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f); - } - return; - } - - if (npc.ai[1] == 2f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.ai[2] += 1f + (death ? 0.5f * (1f - lifeRatio) : 0f); - if (expertMode) - npc.ai[2] += 0.25f; - if (revenge) - npc.ai[2] += 0.25f; - - if (npc.ai[2] >= 75f) - { - // Avoid cheap bullshit - npc.damage = (int)Math.Round(npc.defDamage * 0.5); - - npc.velocity.X *= 0.93f; - npc.velocity.Y *= 0.93f; - - if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) - npc.velocity.X = 0f; - if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; - - if (npc.ai[2] >= 105f) - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.target = 255; - npc.rotation = calCloneBroRotation; - if (npc.ai[3] >= 3f) - { - npc.ai[1] = 0f; - npc.ai[3] = 0f; - return; - } - npc.ai[1] = 1f; - } - } - } - } - - public static void VanillaCatastropheAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - if (CalamityGlobalNPC.calamitas < 0 || !Main.npc[CalamityGlobalNPC.calamitas].active) - { - if (npc.alpha < 255) - { - npc.velocity *= 0.9f; - - npc.alpha += 2; - if (npc.alpha > 255) - npc.alpha = 255; - - int dustAmount = (int)Math.Round(MathHelper.Lerp(1f, 5f, (255 - npc.alpha) / 255f)); - for (int i = 0; i < dustAmount; i++) - { - int dust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.LifeDrain, 0f, -1f, 90, default, Main.rand.NextFloat(0.5f, 2f)); - Main.dust[dust].noGravity = true; - Main.dust[dust].fadeIn = 1f; - } - } - else - npc.active = false; - - return; - } - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - CalamityGlobalNPC.catastrophe = npc.whoAmI; - - // Emit light - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1f, 0f, 0f); - - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); - - Player player = Main.player[npc.target]; - - float enrageScale = bossRush ? 1f : 0f; - if (Main.IsItDay() || bossRush) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 2f; - } - - float calCloneBroPlayerXDist = npc.position.X + (npc.width / 2) - player.position.X - (player.width / 2); - float calCloneBroPlayerYDist = npc.position.Y + npc.height - 59f - player.position.Y - (player.height / 2); - float calCloneBroRotation = (float)Math.Atan2(calCloneBroPlayerYDist, calCloneBroPlayerXDist) + MathHelper.PiOver2; - if (calCloneBroRotation < 0f) - calCloneBroRotation += MathHelper.TwoPi; - else if (calCloneBroRotation > MathHelper.TwoPi) - calCloneBroRotation -= MathHelper.TwoPi; - - float calCloneBroRotationSpeed = 0.15f; - if (npc.rotation < calCloneBroRotation) - { - if ((calCloneBroRotation - npc.rotation) > MathHelper.Pi) - npc.rotation -= calCloneBroRotationSpeed; - else - npc.rotation += calCloneBroRotationSpeed; - } - else if (npc.rotation > calCloneBroRotation) - { - if ((npc.rotation - calCloneBroRotation) > MathHelper.Pi) - npc.rotation += calCloneBroRotationSpeed; - else - npc.rotation -= calCloneBroRotationSpeed; - } - - if (npc.rotation > calCloneBroRotation - calCloneBroRotationSpeed && npc.rotation < calCloneBroRotation + calCloneBroRotationSpeed) - npc.rotation = calCloneBroRotation; - if (npc.rotation < 0f) - npc.rotation += MathHelper.TwoPi; - else if (npc.rotation > MathHelper.TwoPi) - npc.rotation -= MathHelper.TwoPi; - if (npc.rotation > calCloneBroRotation - calCloneBroRotationSpeed && npc.rotation < calCloneBroRotation + calCloneBroRotationSpeed) - npc.rotation = calCloneBroRotation; - - if (!player.active || player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - if (npc.velocity.Y > 3f) - npc.velocity.Y = 3f; - npc.velocity.Y -= 0.1f; - if (npc.velocity.Y < -12f) - npc.velocity.Y = -12f; - - if (npc.timeLeft > 60) - npc.timeLeft = 60; - - if (npc.ai[1] != 0f) - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - return; - } - } - - if (npc.ai[1] == 0f) - { - // Avoid cheap bullshit - npc.damage = (int)Math.Round(npc.defDamage * 0.5); - - float calCloneBroProjAttackMaxSpeed = 4.5f; - float calCloneBroProjAttackAccel = 0.2f; - calCloneBroProjAttackMaxSpeed += 2f * enrageScale; - calCloneBroProjAttackAccel += 0.1f * enrageScale; - - if (Main.getGoodWorld) - { - calCloneBroProjAttackMaxSpeed *= 1.15f; - calCloneBroProjAttackAccel *= 1.15f; - } - - int calCloneBroProjAttackDirection = 1; - if (npc.Center.X < player.Center.X) - calCloneBroProjAttackDirection = -1; - - Vector2 calCloneBroProjLocation = npc.Center; - float calCloneBroProjTargetX = player.Center.X + (calCloneBroProjAttackDirection * 180) - calCloneBroProjLocation.X; - float calCloneBroProjTargetY = player.Center.Y - calCloneBroProjLocation.Y; - float calCloneBroProjTargetDist = (float)Math.Sqrt(calCloneBroProjTargetX * calCloneBroProjTargetX + calCloneBroProjTargetY * calCloneBroProjTargetY); - - if (expertMode) - { - if (calCloneBroProjTargetDist > 300f) - calCloneBroProjAttackMaxSpeed += 0.5f; - if (calCloneBroProjTargetDist > 400f) - calCloneBroProjAttackMaxSpeed += 0.5f; - if (calCloneBroProjTargetDist > 500f) - calCloneBroProjAttackMaxSpeed += 0.55f; - if (calCloneBroProjTargetDist > 600f) - calCloneBroProjAttackMaxSpeed += 0.55f; - if (calCloneBroProjTargetDist > 700f) - calCloneBroProjAttackMaxSpeed += 0.6f; - if (calCloneBroProjTargetDist > 800f) - calCloneBroProjAttackMaxSpeed += 0.6f; - } - - calCloneBroProjTargetDist = calCloneBroProjAttackMaxSpeed / calCloneBroProjTargetDist; - calCloneBroProjTargetX *= calCloneBroProjTargetDist; - calCloneBroProjTargetY *= calCloneBroProjTargetDist; - - if (npc.velocity.X < calCloneBroProjTargetX) - { - npc.velocity.X += calCloneBroProjAttackAccel; - if (npc.velocity.X < 0f && calCloneBroProjTargetX > 0f) - npc.velocity.X += calCloneBroProjAttackAccel; - } - else if (npc.velocity.X > calCloneBroProjTargetX) - { - npc.velocity.X -= calCloneBroProjAttackAccel; - if (npc.velocity.X > 0f && calCloneBroProjTargetX < 0f) - npc.velocity.X -= calCloneBroProjAttackAccel; - } - if (npc.velocity.Y < calCloneBroProjTargetY) - { - npc.velocity.Y += calCloneBroProjAttackAccel; - if (npc.velocity.Y < 0f && calCloneBroProjTargetY > 0f) - npc.velocity.Y += calCloneBroProjAttackAccel; - } - else if (npc.velocity.Y > calCloneBroProjTargetY) - { - npc.velocity.Y -= calCloneBroProjAttackAccel; - if (npc.velocity.Y > 0f && calCloneBroProjTargetY < 0f) - npc.velocity.Y -= calCloneBroProjAttackAccel; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= (180f - (death ? 90f * (1f - lifeRatio) : 0f))) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.target = 255; - npc.netUpdate = true; - } - - bool fireDelay = npc.ai[2] > 120f || lifeRatio < 0.9f; - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) && fireDelay) - { - npc.localAI[2] += 1f; - if (npc.localAI[2] > 36f) - { - npc.localAI[2] = 0f; - SoundEngine.PlaySound(SoundID.Item34, npc.Center); - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - if (revenge) - npc.localAI[1] += 0.5f; - - if (npc.localAI[1] > 50f) - { - npc.localAI[1] = 0f; - float calCloneBroProjSpeed = death ? 14f : 12f; - calCloneBroProjSpeed += 3f * enrageScale; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - calCloneBroProjLocation = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - calCloneBroProjTargetX = player.position.X + (player.width / 2) - calCloneBroProjLocation.X; - calCloneBroProjTargetY = player.position.Y + (player.height / 2) - calCloneBroProjLocation.Y; - calCloneBroProjTargetDist = (float)Math.Sqrt(calCloneBroProjTargetX * calCloneBroProjTargetX + calCloneBroProjTargetY * calCloneBroProjTargetY); - calCloneBroProjTargetDist = calCloneBroProjSpeed / calCloneBroProjTargetDist; - calCloneBroProjTargetX *= calCloneBroProjTargetDist; - calCloneBroProjTargetY *= calCloneBroProjTargetDist; - calCloneBroProjTargetY += npc.velocity.Y * 0.5f; - calCloneBroProjTargetX += npc.velocity.X * 0.5f; - calCloneBroProjLocation.X -= calCloneBroProjTargetX; - calCloneBroProjLocation.Y -= calCloneBroProjTargetY; - Projectile.NewProjectile(npc.GetSource_FromAI(), calCloneBroProjLocation.X, calCloneBroProjLocation.Y, calCloneBroProjTargetX, calCloneBroProjTargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - else - { - if (npc.ai[1] == 1f) - { - // Set damage - npc.damage = npc.defDamage; - - SoundEngine.PlaySound(SoundID.Roar, npc.Center); - npc.rotation = calCloneBroRotation; - - float calCloneBroChargeSpeed = (NPC.AnyNPCs(ModContent.NPCType()) ? 12f : 16f) + (death ? 4f * (1f - lifeRatio) : 0f); - calCloneBroChargeSpeed += 4f * enrageScale; - if (expertMode) - calCloneBroChargeSpeed += 2f; - if (revenge) - calCloneBroChargeSpeed += 2f; - if (Main.getGoodWorld) - calCloneBroChargeSpeed *= 1.25f; - - Vector2 calCloneBroChargeCenter = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float calCloneBroChargeTargetXDist = player.position.X + (player.width / 2) - calCloneBroChargeCenter.X; - float calCloneBroChargeTargetYDist = player.position.Y + (player.height / 2) - calCloneBroChargeCenter.Y; - float calCloneBroChargeTargetDistance = (float)Math.Sqrt(calCloneBroChargeTargetXDist * calCloneBroChargeTargetXDist + calCloneBroChargeTargetYDist * calCloneBroChargeTargetYDist); - calCloneBroChargeTargetDistance = calCloneBroChargeSpeed / calCloneBroChargeTargetDistance; - npc.velocity.X = calCloneBroChargeTargetXDist * calCloneBroChargeTargetDistance; - npc.velocity.Y = calCloneBroChargeTargetYDist * calCloneBroChargeTargetDistance; - npc.ai[1] = 2f; - - if (Main.zenithWorld) - { - SoundEngine.PlaySound(SupremeCalamitas.SupremeCalamitas.BrimstoneShotSound, npc.Center); - - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(ModContent.ProjectileType()); - if (bossRush) - damage /= 2; - - int totalProjectiles = bossRush ? 12 : death ? 10 : revenge ? 8 : expertMode ? 6 : 4; - float radians = MathHelper.TwoPi / totalProjectiles; - float velocity = 5f; - Vector2 spinningPoint = new Vector2(0f, -velocity); - float projectileVelocityToPass = velocity * 3f; - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 0f, projectileVelocityToPass); - } - - for (int i = 0; i < 6; i++) - Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f); - } - return; - } - - if (npc.ai[1] == 2f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.ai[2] += 1f + (death ? 0.5f * (1f - lifeRatio) : 0f); - if (expertMode) - npc.ai[2] += 0.25f; - if (revenge) - npc.ai[2] += 0.25f; - - if (npc.ai[2] >= 60f) //50 - { - // Avoid cheap bullshit - npc.damage = (int)Math.Round(npc.defDamage * 0.5); - - npc.velocity.X *= 0.93f; - npc.velocity.Y *= 0.93f; - - if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) - npc.velocity.X = 0f; - if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; - - if (npc.ai[2] >= 90f) //80 - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.rotation = calCloneBroRotation; - if (npc.ai[3] >= 4f) - { - npc.ai[1] = 0f; - npc.ai[3] = 0f; - return; - } - npc.ai[1] = 1f; - } - } - } - } - } -} diff --git a/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs deleted file mode 100644 index 281d6b94ab..0000000000 --- a/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs +++ /dev/null @@ -1,1702 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.CalPlayer; -using CalamityMod.Dusts; -using CalamityMod.Events; -using CalamityMod.NPCs.Abyss; -using CalamityMod.NPCs.AquaticScourge; -using CalamityMod.NPCs.AstrumAureus; -using CalamityMod.NPCs.AstrumDeus; -using CalamityMod.NPCs.BrimstoneElemental; -using CalamityMod.NPCs.Bumblebirb; -using CalamityMod.NPCs.CalClone; -using CalamityMod.NPCs.CeaselessVoid; -using CalamityMod.NPCs.Crags; -using CalamityMod.NPCs.NormalNPCs; -using CalamityMod.NPCs.OldDuke; -using CalamityMod.NPCs.SulphurousSea; -using CalamityMod.NPCs.SunkenSea; -using CalamityMod.Particles; -using CalamityMod.Projectiles.Boss; -using CalamityMod.Projectiles.Enemy; -using CalamityMod.Sounds; -using CalamityMod.Systems; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs -{ - public static class OldDukeAI - { - public static void VanillaOldDukeAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - OldDuke.OldDuke modNPC = npc.ModNPC(); - - npc.Calamity().canBreakPlayerDefense = true; - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - // Variables - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; - - float exhaustionGateValue = 360f; - if (Main.getGoodWorld) - exhaustionGateValue *= 0.5f; - - float numberOfAttacksBeforeExhaustion = 12f; - float exhaustionIncreasePerAttack = exhaustionGateValue * (1f / numberOfAttacksBeforeExhaustion); - bool exhausted = calamityGlobalNPC.newAI[1] == 1f; - bool phase2 = lifeRatio <= (death ? OldDuke.OldDuke.LifePercentagePhase2_Death : revenge ? OldDuke.OldDuke.LifePercentagePhase2_Revenge : OldDuke.OldDuke.LifePercentagePhase2_Normal); - bool phase3 = lifeRatio <= (death ? OldDuke.OldDuke.LifePercentagePhase3_Death : (revenge ? OldDuke.OldDuke.LifePercentagePhase3_Revenge : OldDuke.OldDuke.LifePercentagePhase3_Expert)) && expertMode; - bool phase2AI = npc.ai[0] > 4f; - bool phase3AI = npc.ai[0] > 9f; - - int phase = (npc.ModNPC as OldDuke.OldDuke).Phase; - - bool charging = npc.ai[3] < 10f; - float pie = (float)Math.PI; - - if (calamityGlobalNPC.newAI[0] >= exhaustionGateValue) - calamityGlobalNPC.newAI[1] = 1f; - - float alphaScale = (255 - npc.alpha) / 255f; - float redLight = (phase3AI ? 0.4f : phase2AI ? 0.64f : 0.88f) * alphaScale; - float greenLight = (phase3AI ? 1.2f : phase2AI ? 0.8f : 0.4f) * alphaScale; - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), redLight, greenLight, 0f); - - if (CalamityServerConfig.Instance.BossesStopWeather) - CalamityWorld.StopRain(); - else if (!Main.raining && !BossRushEvent.BossRushActive) - CalamityWorld.StartRain(); - - // Adjust stats - int setDamage = npc.defDamage; - calamityGlobalNPC.DR = exhausted ? 0f : 0.5f; - npc.defense = exhausted ? 0 : npc.defDefense; - if (phase3AI) - { - setDamage = (int)Math.Round(setDamage * 1.2); - npc.defense = exhausted ? 0 : npc.defDefense - 40; - } - else if (phase2AI) - { - setDamage = (int)Math.Round(setDamage * 1.1); - npc.defense = exhausted ? 0 : npc.defDefense - 20; - } - - int idlePhaseTimer = expertMode ? 55 : 60; - float idlePhaseAcceleration = expertMode ? 0.75f : 0.7f; - float idlePhaseVelocity = expertMode ? 14f : 13f; - if (phase3AI) - { - idlePhaseAcceleration = expertMode ? 0.6f : 0.55f; - idlePhaseVelocity = expertMode ? 12f : 11f; - } - else if (phase2AI & charging) - { - idlePhaseAcceleration = expertMode ? 0.8f : 0.75f; - idlePhaseVelocity = expertMode ? 15f : 14f; - } - - int chargeTime = expertMode ? 34 : 36; - float chargeVelocity = expertMode ? 20f : 19f; - if (phase3AI) - { - chargeTime = expertMode ? 28 : 30; - chargeVelocity = expertMode ? 26f : 25f; - } - else if (charging & phase2AI) - { - chargeTime = expertMode ? 31 : 33; - chargeVelocity = expertMode ? 24f : 23f; - } - - if (bossRush) - { - idlePhaseTimer = 35; - idlePhaseAcceleration *= 1.25f; - idlePhaseVelocity *= 1.2f; - chargeTime -= 3; - chargeVelocity *= 1.25f; - } - else if (death) - { - idlePhaseTimer = 51; - idlePhaseAcceleration *= 1.05f; - idlePhaseVelocity *= 1.05f; - chargeTime -= 2; - chargeVelocity *= 1.1f; - } - else if (revenge) - { - idlePhaseTimer = 53; - idlePhaseAcceleration *= 1.025f; - idlePhaseVelocity *= 1.025f; - chargeTime -= 1; - chargeVelocity *= 1.05f; - } - - // The dumbest thing to ever exist - if (CalamityWorld.LegendaryMode && revenge) - chargeVelocity *= 1.25f; - - if (exhausted) - idlePhaseVelocity *= 0.25f; - - // Variables - int maxToothBallBelches = bossRush ? 5 : death ? 4 : 3; - int toothBallBelchPhaseDivisor = bossRush ? 24 : death ? 30 : 40; - int toothBallBelchPhaseTimer = toothBallBelchPhaseDivisor * maxToothBallBelches; - float toothBallBelchPhaseAcceleration = bossRush ? 0.95f : death ? 0.6f : 0.55f; - float toothBallBelchPhaseVelocity = bossRush ? 14f : death ? 10f : 9f; - float toothBallFinalVelocity = death ? 14f : revenge ? 13f : 12f; - float goreVelocityX = death ? 8f : revenge ? 7.5f : expertMode ? 7f : 6f; - float goreVelocityY = death ? 10.5f : revenge ? 10f : expertMode ? 9.5f : 8f; - float sharkronVelocity = bossRush ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; - int attackTimer = 120; - int phaseTransitionTimer = 180; - int teleportPauseTimer = 30; - int toothBallSpinPhaseDivisor = bossRush ? 27 : death ? 32 : 45; - int toothBallSpinTimer = maxToothBallBelches * toothBallSpinPhaseDivisor; - float spinTime = toothBallSpinTimer / 2f; - float toothBallSpinToothBallVelocity = bossRush ? 14f : death ? 9.5f : 9f; - float spinAttackSpeed = Main.zenithWorld ? 44f : 22f; - float spinSpeed = MathHelper.TwoPi / spinTime; - - Player player = Main.player[npc.target]; - - // Get target - if (npc.target < 0 || npc.target == Main.maxPlayers || player.dead || !player.active) - { - npc.TargetClosest(); - player = Main.player[npc.target]; - npc.netUpdate = true; - } - - // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); - - // Despawn - if (player.dead || Vector2.Distance(player.Center, npc.Center) > 8800f) - { - npc.TargetClosest(); - - npc.velocity.Y -= 0.4f; - - if (npc.timeLeft > 10) - npc.timeLeft = 10; - - if (npc.timeLeft == 1) - { - AcidRainEvent.AccumulatedKillPoints = 0; - AcidRainEvent.HasTriedToSummonOldDuke = false; - AcidRainEvent.UpdateInvasion(false); - npc.timeLeft = 0; - } - - if (npc.ai[0] > 4f) - npc.ai[0] = 5f; - else - npc.ai[0] = 0f; - - npc.ai[2] = 0f; - } - - if (exhausted) - { - npc.Calamity().canBreakPlayerDefense = false; - - // Play exhausted sound - if (calamityGlobalNPC.newAI[0] % 60f == 0f && Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, npc.Center) < 2800f) - SoundEngine.PlaySound(OldDuke.OldDuke.HuffSound with { Volume = OldDuke.OldDuke.HuffSound.Volume * 1.25f }, Main.LocalPlayer.Center); - - if (Main.zenithWorld) - { - float screenShakePower = 10 * Utils.GetLerpValue(800f, 0f, npc.Distance(Main.LocalPlayer.Center), true); - if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < screenShakePower) - Main.LocalPlayer.Calamity().GeneralScreenShakePower = screenShakePower; - - if (calamityGlobalNPC.newAI[0] == exhaustionGateValue) - SoundEngine.PlaySound(SoundID.NPCDeath64 with { Pitch = SoundID.NPCDeath64.Pitch - 0.9f, Volume = SoundID.NPCDeath64.Volume + 0.4f }, player.Center); // fart - - if (Main.netMode != NetmodeID.MultiplayerClient && calamityGlobalNPC.newAI[0] % 5f == 0f) - { - Vector2 dist = player.Center - npc.Center; - dist.Normalize(); - dist *= 3; - dist.X += Main.rand.NextFloat(-0.5f, 0.5f); - dist.Y += Main.rand.NextFloat(-0.5f, 0.5f); - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, -dist, type, damage, 0, Main.myPlayer); - } - } - - calamityGlobalNPC.newAI[0] -= bossRush ? 1.5f : 1f; - if (calamityGlobalNPC.newAI[0] <= 0f) - { - calamityGlobalNPC.newAI[0] = 0f; - calamityGlobalNPC.newAI[1] = 0f; - } - } - - // Enrage variable - bool enrage = !bossRush && - (player.position.Y < 300f || player.position.Y > Main.worldSurface * 16.0 || - (player.position.X > 8000f && player.position.X < (Main.maxTilesX * 16 - 8000))); - - // Check for the flipped Abyss - if (Main.remixWorld) - { - enrage = !bossRush && - (player.position.Y < Main.UnderworldLayer * 16 * 0.8f || player.position.Y > Main.UnderworldLayer * 16 || - (player.position.X > 8000f && player.position.X < (Main.maxTilesX * 16 - 8000))); - } - - // Enrage - if (enrage) - { - if (npc.localAI[1] > 0f) - npc.localAI[1] -= 1f; - } - else - npc.localAI[1] = CalamityGlobalNPC.biomeEnrageTimerMax; - - bool biomeEnraged = npc.localAI[1] <= 0f; - - npc.Calamity().CurrentlyEnraged = biomeEnraged || bossRush; - - // Increased DR while transitioning phases and not exhausted - if (!exhausted) - calamityGlobalNPC.DR = (npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f) ? (bossRush ? 0.99f : 0.75f) : 0.5f; - - calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f; - - // Enrage - if (biomeEnraged) - { - toothBallBelchPhaseTimer = 60; - toothBallBelchPhaseDivisor = 20; - toothBallBelchPhaseAcceleration = 1f; - toothBallBelchPhaseVelocity = 15f; - goreVelocityX = 12f; - goreVelocityY = 16f; - sharkronVelocity = 20f; - idlePhaseTimer = 20; - idlePhaseAcceleration = 1.2f; - idlePhaseVelocity = 20f; - chargeTime = 25; - chargeVelocity += 8f; - toothBallSpinPhaseDivisor = 24; - toothBallSpinToothBallVelocity = 15f; - setDamage *= 2; - npc.defense = npc.defDefense * 3; - } - - // The dumbest thing to ever exist - if (CalamityWorld.LegendaryMode && revenge) - chargeTime *= 2; - - // Set variables for spawn effects - if (npc.localAI[0] == 0f) - { - npc.alpha = 255; - - npc.velocity.Y = -12f; - npc.velocity.X = Main.rand.NextFloat(-2f, 2f); - - npc.localAI[0] = 1f; - npc.rotation = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[0] = -1f; - npc.netUpdate = true; - } - } - - // Rotation - float rateOfRotation = 0.04f; - if (npc.ai[0] == 1f || npc.ai[0] == 6f || npc.ai[0] == 7f || npc.ai[0] == 14f) - rateOfRotation = 0f; - if (npc.ai[0] == 3f || npc.ai[0] == 4f) - rateOfRotation = 0.01f; - if (npc.ai[0] == 8f || npc.ai[0] == 13f) - rateOfRotation = 0.05f; - - Vector2 rotationVector = player.Center - npc.Center; - if (calamityGlobalNPC.newAI[1] != 1f && !player.dead) - { - // Rotate to show direction of predictive charge - if (npc.ai[0] == 0f && !phase2) - { - if (npc.ai[3] < 6f) - { - rateOfRotation = 0.1f; - rotationVector = Vector2.Normalize(player.Center + player.velocity * 20f - npc.Center) * chargeVelocity; - } - } - else if (npc.ai[0] == 5f && !phase3) - { - if (npc.ai[3] < 4f) - { - rateOfRotation = 0.1f; - rotationVector = Vector2.Normalize(player.Center + player.velocity * 20f - npc.Center) * chargeVelocity; - } - } - else if (npc.ai[0] == 10f) - { - if (npc.ai[3] < 8f && npc.ai[3] != 1f && npc.ai[3] != 4f) - { - rateOfRotation = 0.1f; - rotationVector = Vector2.Normalize(player.Center + player.velocity * 20f - npc.Center) * chargeVelocity; - } - } - } - - float dukeRotationSpeed = (float)Math.Atan2(rotationVector.Y, rotationVector.X); - if (npc.spriteDirection == 1) - dukeRotationSpeed += pie; - if (dukeRotationSpeed < 0f) - dukeRotationSpeed += MathHelper.TwoPi; - if (dukeRotationSpeed > MathHelper.TwoPi) - dukeRotationSpeed -= MathHelper.TwoPi; - if (npc.ai[0] == -1f || npc.ai[0] == 3f || npc.ai[0] == 4f) - dukeRotationSpeed = 0f; - if (npc.ai[0] == 8f || npc.ai[0] == 13f) - dukeRotationSpeed = pie * 0.1666666667f * npc.spriteDirection; - - if (npc.rotation < dukeRotationSpeed) - { - if (dukeRotationSpeed - npc.rotation > pie) - npc.rotation -= rateOfRotation; - else - npc.rotation += rateOfRotation; - } - if (npc.rotation > dukeRotationSpeed) - { - if (npc.rotation - dukeRotationSpeed > pie) - npc.rotation += rateOfRotation; - else - npc.rotation -= rateOfRotation; - } - - if ((npc.ai[0] != 8f && npc.ai[0] != 13f) || npc.spriteDirection == 1) - { - if (npc.rotation > dukeRotationSpeed - rateOfRotation && npc.rotation < dukeRotationSpeed + rateOfRotation) - npc.rotation = dukeRotationSpeed; - if (npc.rotation < 0f) - npc.rotation += MathHelper.TwoPi; - if (npc.rotation > MathHelper.TwoPi) - npc.rotation -= MathHelper.TwoPi; - if (npc.rotation > dukeRotationSpeed - rateOfRotation && npc.rotation < dukeRotationSpeed + rateOfRotation) - npc.rotation = dukeRotationSpeed; - } - - // Alpha adjustments - if (npc.ai[0] != -1f && (npc.ai[0] < 9f || npc.ai[0] > 12f)) - { - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - npc.alpha += 15; - else - npc.alpha -= 15; - - if (npc.alpha < 0) - npc.alpha = 0; - if (npc.alpha > 150) - npc.alpha = 150; - } - - // Spawn effects - if (npc.ai[0] == -1f) - { - npc.alpha = (int)MathHelper.Lerp(npc.alpha, 0, 0.2f); - - // Avoid cheap bullshit - npc.damage = 0; - - // Velocity - if (npc.Calamity().newAI[3] == 0f) - npc.velocity *= 0.98f; - - // Direction - int dukeFaceDirection = Math.Sign(player.Center.X - npc.Center.X); - if (dukeFaceDirection != 0) - { - npc.direction = dukeFaceDirection; - npc.spriteDirection = -npc.direction; - } - - // Alpha - if (npc.ai[2] > 20f) - { - npc.velocity *= 0.9f; - - npc.alpha -= 5; - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - npc.alpha += 15; - if (npc.alpha < 0) - npc.alpha = 0; - if (npc.alpha > 150) - npc.alpha = 150; - } - - if (npc.ai[2] == 75) - { - modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); - - CalamityUtils.AddScreenshakeAt(npc.Center, 14); - SoundEngine.PlaySound(SoundID.DD2_BetsyFlameBreath.WithPitchOffset(-0.5f), npc.Center); - SoundEngine.PlaySound(OldDuke.OldDuke.DashSoundP3, npc.Center); - } - - if (npc.ai[2] >= 75f) - { - float sd = player.Center.X > npc.Center.X ? -1f : 1f; - - (npc.ModNPC as OldDuke.OldDuke).shake = 2f; - npc.rotation = MathHelper.Lerp(MathHelper.WrapAngle(npc.rotation), MathHelper.ToRadians(sd == 1f ? 75f : -75f), 0.2f); - - if (npc.ai[2] % 5f == 1f) - { - Vector2 mouthCenter = npc.Center + new Vector2(-80 * sd, 0).RotatedBy(npc.rotation); - - float factor = (npc.ai[2] - 75f) / 50f; - - float a = MathHelper.Lerp(1f, 0f, factor); - - GeneralParticleHandler.SpawnParticle(new CustomPulse(mouthCenter, Vector2.Zero, new Color(55, 55, 55).MultiplyRGBA(new Color(a, a, a, a)), "CalamityMod/Particles/DustyCircleHardEdge", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.05f, 0.08f + (0.15f * factor), 10)); - } - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= 125f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - - // Phase 1 - else if (npc.ai[0] == 0f && !player.dead) - { - // Avoid cheap bullshit - npc.damage = 0; - - // Velocity - if (npc.ai[1] == 0f) - npc.ai[1] = 500 * Math.Sign((npc.Center - player.Center).X); - - Vector2 phase1IdleSpeed = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -300f) - npc.Center - npc.velocity) * idlePhaseVelocity; - npc.SimpleFlyMovement(phase1IdleSpeed, idlePhaseAcceleration); - - // Rotation and direction - int dukeLookAt = Math.Sign(player.Center.X - npc.Center.X); - if (dukeLookAt != 0) - { - if (npc.ai[2] == 0f && dukeLookAt != npc.direction) - npc.rotation += pie; - - npc.direction = dukeLookAt; - - if (npc.spriteDirection != -npc.direction) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - - // Phase switch - if (calamityGlobalNPC.newAI[1] != 1f || (phase2 && !phase2AI)) - { - npc.ai[2] += 1f; - if (npc.ai[2] >= idlePhaseTimer || (phase2 && !phase2AI)) - { - int oldDukeAttackPicker = 0; - switch ((int)npc.ai[3]) - { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - oldDukeAttackPicker = 1; - break; - case 6: - npc.ai[3] = 1f; - oldDukeAttackPicker = 2; - break; - case 7: - npc.ai[3] = 0f; - oldDukeAttackPicker = 3; - break; - } - - if (phase2) - oldDukeAttackPicker = 4; - - // Set velocity for charge - if (oldDukeAttackPicker == 1) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - // Velocity - Vector2 distanceVector = player.Center + player.velocity * 20f - npc.Center; - npc.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - - DoChargeBurst(npc, 0); - - // Direction - if (dukeLookAt != 0) - { - npc.direction = dukeLookAt; - - if (npc.spriteDirection == 1) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - } - - // Tooth Balls - else if (oldDukeAttackPicker == 2) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - // Call sharks from the sides of the screen - else if (oldDukeAttackPicker == 3) - { - npc.ai[0] = 3f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - // Go to phase 2 - else if (oldDukeAttackPicker == 4) - { - npc.ai[0] = 4f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - npc.netUpdate = true; - } - } - } - - // Charge - else if (npc.ai[0] == 1f) - { - // Set damage - npc.damage = setDamage; - - // The dumbest thing to ever exist - if (CalamityWorld.LegendaryMode && revenge && npc.ai[2] % 10f == 0f) - { - // Rotation and direction - int dir = Math.Sign(player.Center.X - npc.Center.X); - if (dir != 0) - { - if (npc.ai[2] == 0f && dir != npc.direction) - npc.rotation += pie; - - npc.direction = dir; - - if (npc.spriteDirection != -npc.direction) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - - Vector2 distanceVector = player.Center + player.velocity * 20f - npc.Center; - npc.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - - // Direction - if (dir != 0) - { - npc.direction = dir; - - if (npc.spriteDirection == 1) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - } - else - { - // Accelerate - npc.velocity *= 1.01f; - } - - // Spawn dust - Vector2 vel = npc.velocity; - vel.Normalize(); - vel *= 55f; - - DoChargeVisual(npc, phase); - - GeneralParticleHandler.SpawnParticle(new SparkParticle(npc.Center + vel + vel.RotatedBy(MathHelper.ToRadians(90)), vel / 7f, false, 20, 0.75f, new Color(155, 155, 155, 55), true)); - GeneralParticleHandler.SpawnParticle(new SparkParticle(npc.Center + vel + vel.RotatedBy(MathHelper.ToRadians(-90)), vel / 7f, false, 20, 0.75f, new Color(155, 155, 155, 55), true)); - - npc.ai[2] += 1f; - if (npc.ai[2] >= chargeTime) - { - calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Tooth Ball belch - else if (npc.ai[0] == 2f) - { - // Avoid cheap bullshit - npc.damage = 0; - - // Velocity - if (npc.ai[1] == 0f) - npc.ai[1] = 500 * Math.Sign((npc.Center - player.Center).X); - - Vector2 toothBallBelchPhaseSpeed = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -300f) - npc.Center - npc.velocity) * toothBallBelchPhaseVelocity; - npc.SimpleFlyMovement(toothBallBelchPhaseSpeed, toothBallBelchPhaseAcceleration); - - // Play sounds and spawn Tooth Balls - if (npc.ai[2] == 0f) - modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); - - if (npc.ai[2] % toothBallBelchPhaseDivisor == 0f) - { - if (npc.ai[2] != 0f) - SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.Center); - - Vector2 toothBallDirection = Vector2.Normalize(player.Center - npc.Center) * (npc.width + 20) / 2f + npc.Center; - Vector2 toothBallVelocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * toothBallFinalVelocity; - Vector2 toothBallSpawnPos = new Vector2(toothBallDirection.X, toothBallDirection.Y + 45f); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int toothBall = NPC.NewNPC(npc.GetSource_FromAI(), (int)toothBallSpawnPos.X, (int)toothBallSpawnPos.Y, ModContent.NPCType(), 0, toothBallVelocity.X, toothBallVelocity.Y); - Main.npc[toothBall].velocity = Vector2.Normalize(toothBallVelocity) * npc.velocity.Length(); - Main.npc[toothBall].netUpdate = true; - } - - for (int i = 0; i < 50; i++) - { - int dustID; - switch (Main.rand.Next(6)) - { - case 0: - case 1: - case 2: - case 3: - dustID = (int)CalamityDusts.SulphurousSeaAcid; - break; - default: - dustID = DustID.Blood; - break; - } - - // Choose a random speed and angle to belch out the vomit - float dustSpeed = Main.rand.NextFloat(3.0f, 12.0f); - float angleRandom = 0.06f; - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(toothBallVelocity.ToRotation()); - dustVel = dustVel.RotatedBy(-angleRandom); - dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - - // Pick a size for the vomit particles - float scale = Main.rand.NextFloat(1f, 2f); - - // Actually spawn the vomit - int idx = Dust.NewDust(toothBallSpawnPos, 40, 40, dustID, dustVel.X, dustVel.Y, 0, default, scale); - Main.dust[idx].noGravity = true; - } - } - - // Direction - int toothBallLookAt = Math.Sign(player.Center.X - npc.Center.X); - if (toothBallLookAt != 0) - { - npc.direction = toothBallLookAt; - if (npc.spriteDirection != -npc.direction) - npc.rotation += pie; - npc.spriteDirection = -npc.direction; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= toothBallBelchPhaseTimer) - { - calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Call sharks from the sides of the screen - else if (npc.ai[0] == 3f) - { - // Avoid cheap bullshit - npc.damage = 0; - - // Velocity - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - - // Play sound and spawn sharks - if (npc.ai[2] == attackTimer - 30) - SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.Center); - - if (npc.ai[2] >= attackTimer - 90) - { - if (npc.ai[2] % 18f == 0f) - { - calamityGlobalNPC.newAI[2] += 100f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + 900f), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - 900f), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - - if (Main.getGoodWorld) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + 1800f), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - 1800f), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - } - } - } - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= attackTimer) - { - calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; - calamityGlobalNPC.newAI[2] = 0f; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Transition to phase 2 and call sharks from below - else if (npc.ai[0] == 4f) - { - // Avoid cheap bullshit - npc.damage = 0; - - // Velocity - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - - // Sound - if (npc.ai[2] == phaseTransitionTimer - 60) - modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); - - if (npc.ai[2] >= phaseTransitionTimer - 60) - { - if (npc.ai[2] % 18f == 0f) - { - calamityGlobalNPC.newAI[2] += 150f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + 50f + calamityGlobalNPC.newAI[2]), (int)(npc.Center.Y + 540f), ModContent.NPCType(), 0, 0f, 0f, 1f, -sharkronVelocity, 255); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - 50f - calamityGlobalNPC.newAI[2]), (int)(npc.Center.Y + 540f), ModContent.NPCType(), 0, 0f, 0f, -1f, -sharkronVelocity, 255); - - if (Main.getGoodWorld) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + 50f + calamityGlobalNPC.newAI[2] * 0.5f), (int)(npc.Center.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, 1f, -sharkronVelocity, 255); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - 50f - calamityGlobalNPC.newAI[2] * 0.5f), (int)(npc.Center.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, -1f, -sharkronVelocity, 255); - } - } - } - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= phaseTransitionTimer) - { - calamityGlobalNPC.newAI[0] = 0f; - calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Phase 2 - else if (npc.ai[0] == 5f && !player.dead) - { - // Avoid cheap bullshit - npc.damage = 0; - - // Velocity - if (npc.ai[1] == 0f) - npc.ai[1] = 500 * Math.Sign((npc.Center - player.Center).X); - - Vector2 dukePhase2IdleSpeed = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -300f) - npc.Center - npc.velocity) * idlePhaseVelocity; - npc.SimpleFlyMovement(dukePhase2IdleSpeed, idlePhaseAcceleration); - - // Direction and rotation - int phase2FaceDirection = Math.Sign(player.Center.X - npc.Center.X); - if (phase2FaceDirection != 0) - { - if (npc.ai[2] == 0f && phase2FaceDirection != npc.direction) - npc.rotation += pie; - - npc.direction = phase2FaceDirection; - - if (npc.spriteDirection != -npc.direction) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - - // Phase switch - if (calamityGlobalNPC.newAI[1] != 1f || (phase3 && !phase3AI)) - { - npc.ai[2] += 1f; - if (npc.ai[2] >= idlePhaseTimer || (phase3 && !phase3AI)) - { - int phase2AttackPicker = 0; - switch ((int)npc.ai[3]) - { - case 0: - case 1: - case 2: - case 3: - phase2AttackPicker = 1; - break; - case 4: - npc.ai[3] = 1f; - phase2AttackPicker = 2; - break; - case 5: - npc.ai[3] = 0f; - phase2AttackPicker = 3; - break; - } - - if (phase3) - phase2AttackPicker = 4; - - // Set velocity for charge - if (phase2AttackPicker == 1) - { - npc.ai[0] = 6f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - // Velocity and rotation - Vector2 distanceVector = player.Center + player.velocity * 20f - npc.Center; - npc.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - - // Direction - if (phase2FaceDirection != 0) - { - npc.direction = phase2FaceDirection; - - if (npc.spriteDirection == 1) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - - DoChargeBurst(npc, 1); - } - - // Set velocity for spin - else if (phase2AttackPicker == 2) - { - // Velocity and rotation - npc.velocity = Vector2.Normalize(player.Center - npc.Center) * spinAttackSpeed; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - - // Direction - if (phase2FaceDirection != 0) - { - npc.direction = phase2FaceDirection; - - if (npc.spriteDirection == 1) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - - npc.ai[0] = 7f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - else if (phase2AttackPicker == 3) - { - npc.ai[0] = 8f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - // Go to next phase - else if (phase2AttackPicker == 4) - { - npc.ai[0] = 9f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - npc.netUpdate = true; - } - } - } - - // Charge - else if (npc.ai[0] == 6f) - { - // Set damage - npc.damage = setDamage; - - // The dumbest thing to ever exist - if (CalamityWorld.LegendaryMode && revenge && npc.ai[2] % 8f == 0f) - { - // Rotation and direction - int dir = Math.Sign(player.Center.X - npc.Center.X); - if (dir != 0) - { - if (npc.ai[2] == 0f && dir != npc.direction) - npc.rotation += pie; - - npc.direction = dir; - - if (npc.spriteDirection != -npc.direction) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - - Vector2 distanceVector = player.Center + player.velocity * 20f - npc.Center; - npc.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - - // Direction - if (dir != 0) - { - npc.direction = dir; - - if (npc.spriteDirection == 1) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - } - else - { - // Accelerate - npc.velocity *= 1.01f; - } - - DoChargeVisual(npc, phase); - - npc.ai[2] += 1f; - if (npc.ai[2] >= chargeTime) - { - calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Tooth Ball and Vortex spin - else if (npc.ai[0] == 7f) - { - // Set damage - npc.damage = 0; - - // Play sounds and spawn Tooth Balls and a Vortex - if (npc.ai[2] == 0f) - { - modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); - - SoundEngine.PlaySound(OldDuke.OldDuke.VortexSpawnSound, npc.Center); - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Vector2 vortexSpawn = npc.Center + npc.velocity.RotatedBy(MathHelper.PiOver2 * -npc.direction) * spinTime / MathHelper.TwoPi; - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), vortexSpawn, Vector2.Zero, type, damage, 0f, Main.myPlayer, vortexSpawn.X, vortexSpawn.Y); - } - - if (npc.ai[2] % toothBallSpinPhaseDivisor == 0f) - { - if (npc.ai[2] != 0f) - SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.Center); - - Vector2 phase2ToothBallDirection = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + npc.Center; - Vector2 toothBallVelocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * toothBallSpinToothBallVelocity; - Vector2 toothBallSpawnPos = new Vector2(phase2ToothBallDirection.X, phase2ToothBallDirection.Y + 45f); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int toothBall = NPC.NewNPC(npc.GetSource_FromAI(), (int)toothBallSpawnPos.X, (int)toothBallSpawnPos.Y, ModContent.NPCType(), 0, toothBallVelocity.X, toothBallVelocity.Y); - Main.npc[toothBall].target = npc.target; - Main.npc[toothBall].velocity = Vector2.Normalize(toothBallVelocity) * toothBallSpinToothBallVelocity * 0.5f; - Main.npc[toothBall].netUpdate = true; - Main.npc[toothBall].ai[3] = 30f; - } - - for (int i = 0; i < 50; i++) - { - int dustID; - switch (Main.rand.Next(6)) - { - case 0: - case 1: - case 2: - case 3: - dustID = (int)CalamityDusts.SulphurousSeaAcid; - break; - default: - dustID = DustID.Blood; - break; - } - - // Choose a random speed and angle to belch out the vomit - float dustSpeed = Main.rand.NextFloat(3.0f, 12.0f); - float angleRandom = 0.06f; - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(toothBallVelocity.ToRotation()); - dustVel = dustVel.RotatedBy(-angleRandom); - dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - - // Pick a size for the vomit particles - float scale = Main.rand.NextFloat(1f, 2f); - - // Actually spawn the vomit - int idx = Dust.NewDust(toothBallSpawnPos, 40, 40, dustID, dustVel.X, dustVel.Y, 0, default, scale); - Main.dust[idx].noGravity = true; - } - } - - // Velocity and rotation - npc.velocity = npc.velocity.RotatedBy(-(double)spinSpeed * (float)npc.direction); - npc.rotation -= spinSpeed * npc.direction; - - npc.ai[2] += 1f; - if (npc.ai[2] >= toothBallSpinTimer) - { - calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Vomit a huge amount of gore into the sky and call sharks from the sides of the screen - else if (npc.ai[0] == 8f) - { - // Avoid cheap bullshit - npc.damage = 0; - - // Velocity - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - - // Play sound - if (npc.ai[2] == attackTimer - 30) - { - SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 phase2GoreDirection = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + npc.Center; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - int totalGore = Main.getGoodWorld ? 40 : 20; - for (int i = 0; i < totalGore; i++) - { - float velocityX = npc.direction * goreVelocityX * (Main.rand.NextFloat(0.2f, 0.8f) + 0.5f); - float velocityY = goreVelocityY * (Main.rand.NextFloat(0.2f, 0.8f) + 0.5f); - - if (Main.getGoodWorld) - { - velocityX *= Main.rand.NextFloat() + 0.5f; - velocityY *= Main.rand.NextFloat() + 0.5f; - } - - Projectile.NewProjectile(npc.GetSource_FromAI(), phase2GoreDirection.X, phase2GoreDirection.Y, velocityX, -velocityY, type, damage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - - if (npc.ai[2] >= attackTimer - 90) - { - if (npc.ai[2] % 18f == 0f) - { - calamityGlobalNPC.newAI[2] += 100f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float x = 900f - calamityGlobalNPC.newAI[2]; - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + x), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - x), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - } - } - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= attackTimer) - { - calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; - calamityGlobalNPC.newAI[2] = 0f; - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Transition to phase 3 and summon sharks from above - else if (npc.ai[0] == 9f) - { - // Avoid cheap bullshit - npc.damage = 0; - - // Velocity - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - - // Sound - if (npc.ai[2] == phaseTransitionTimer - 60) - modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); - - if (npc.ai[2] >= phaseTransitionTimer - 60) - { - if (npc.ai[2] % 18f == 0f) - { - calamityGlobalNPC.newAI[2] += 200f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + 50f + calamityGlobalNPC.newAI[2]), (int)(npc.Center.Y - 540f), ModContent.NPCType(), 0, 0f, 0f, 1f, sharkronVelocity, 255); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - 50f - calamityGlobalNPC.newAI[2]), (int)(npc.Center.Y - 540f), ModContent.NPCType(), 0, 0f, 0f, -1f, sharkronVelocity, 255); - - if (Main.getGoodWorld) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + 50f + calamityGlobalNPC.newAI[2] * 0.5f), (int)(npc.Center.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, 1f, -sharkronVelocity, 255); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - 50f - calamityGlobalNPC.newAI[2] * 0.5f), (int)(npc.Center.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, -1f, -sharkronVelocity, 255); - } - } - } - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= phaseTransitionTimer) - { - calamityGlobalNPC.newAI[0] = 0f; - calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - npc.ai[0] = 10f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Phase 3 - else if (npc.ai[0] == 10f && !player.dead) - { - // Avoid cheap bullshit - npc.damage = 0; - - // Alpha - npc.alpha -= 25; - if (npc.alpha < 0) - npc.alpha = 0; - - // Movement location - if (npc.ai[1] == 0f) - npc.ai[1] = 500 * Math.Sign((npc.Center - player.Center).X); - - Vector2 desiredVelocity = Vector2.Normalize(player.Center + new Vector2(-npc.ai[1], -300f) - npc.Center - npc.velocity) * idlePhaseVelocity; - npc.SimpleFlyMovement(desiredVelocity, idlePhaseAcceleration); - - // Rotation and direction - int phase3FaceDirection = Math.Sign(player.Center.X - npc.Center.X); - if (phase3FaceDirection != 0) - { - if (npc.ai[2] == 0f && phase3FaceDirection != npc.direction) - { - npc.rotation += pie; - for (int l = 0; l < npc.oldPos.Length; l++) - npc.oldPos[l] = Vector2.Zero; - } - - npc.direction = phase3FaceDirection; - - if (npc.spriteDirection != -npc.direction) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - - // Phase switch - if (calamityGlobalNPC.newAI[1] != 1f) - { - npc.ai[2] += 1f; - if (npc.ai[2] >= idlePhaseTimer) - { - int phase3AttackPicker = 0; - switch ((int)npc.ai[3]) - { - case 0: - case 2: - case 3: - case 5: - case 6: - case 7: - phase3AttackPicker = 1; - break; - case 1: - case 8: - phase3AttackPicker = 2; - break; - case 4: - npc.ai[3] = 1f; - phase3AttackPicker = 3; - break; - case 9: - npc.ai[3] = 6f; - phase3AttackPicker = 4; - break; - } - - // Set velocity for charge - if (phase3AttackPicker == 1) - { - npc.ai[0] = 11f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - // Velocity and rotation - Vector2 distanceVector = player.Center + player.velocity * 20f - npc.Center; - npc.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - - // Direction - if (phase3FaceDirection != 0) - { - npc.direction = phase3FaceDirection; - - if (npc.spriteDirection == 1) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - - DoChargeBurst(npc, 2); - } - - // Pause - else if (phase3AttackPicker == 2) - { - npc.ai[0] = 12f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - else if (phase3AttackPicker == 3) - { - npc.ai[0] = 13f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - // Set velocity for spin - else if (phase3AttackPicker == 4) - { - // Velocity and rotation - npc.velocity = Vector2.Normalize(player.Center - npc.Center) * spinAttackSpeed; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - - // Direction - if (phase3FaceDirection != 0) - { - npc.direction = phase3FaceDirection; - - if (npc.spriteDirection == 1) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - - npc.ai[0] = 14f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - npc.netUpdate = true; - } - } - } - - // Charge - else if (npc.ai[0] == 11f) - { - // Set damage - npc.damage = setDamage; - - // The dumbest thing to ever exist - if (CalamityWorld.LegendaryMode && revenge && npc.ai[2] % 6f == 0f) - { - // Rotation and direction - int dir = Math.Sign(player.Center.X - npc.Center.X); - if (dir != 0) - { - if (npc.ai[2] == 0f && dir != npc.direction) - npc.rotation += pie; - - npc.direction = dir; - - if (npc.spriteDirection != -npc.direction) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - - Vector2 distanceVector = player.Center + player.velocity * 20f - npc.Center; - npc.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - - // Direction - if (dir != 0) - { - npc.direction = dir; - - if (npc.spriteDirection == 1) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - } - else - { - // Accelerate - npc.velocity *= 1.01f; - } - - DoChargeVisual(npc, phase); - - npc.ai[2] += 1f; - if (npc.ai[2] >= chargeTime) - { - calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; - npc.ai[0] = 10f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Pause before teleport - else if (npc.ai[0] == 12f) - { - // Avoid cheap bullshit - npc.damage = 0; - - // Alpha - if (npc.alpha < 255 && npc.ai[2] >= teleportPauseTimer - 15f) - { - npc.alpha += 17; - if (npc.alpha > 255) - npc.alpha = 255; - } - - // Velocity - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - - // Play sound - if (npc.ai[2] == teleportPauseTimer / 2) - modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == teleportPauseTimer - 1f) - { - // Teleport location - if (npc.ai[1] == 0f) - npc.ai[1] = 600 * Math.Sign((npc.Center - player.Center).X); - - // Rotation and direction - Vector2 center = player.Center + new Vector2(npc.ai[1], -300f); - Vector2 npcCenter = npc.Center = center; - int phase3TeleportFaceDirection = Math.Sign(player.Center.X - npcCenter.X); - if (phase3TeleportFaceDirection != 0) - { - if (npc.ai[2] == 0f && phase3TeleportFaceDirection != npc.direction) - { - npc.rotation += pie; - for (int n = 0; n < npc.oldPos.Length; n++) - npc.oldPos[n] = Vector2.Zero; - } - - npc.direction = phase3TeleportFaceDirection; - - if (npc.spriteDirection != -npc.direction) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= teleportPauseTimer) - { - npc.ai[0] = 10f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - npc.ai[3] += 2f; - if (npc.ai[3] >= 9f) - npc.ai[3] = 0f; - - npc.netUpdate = true; - } - } - - // Vomit a huge amount of gore into the sky and call sharks from the sides of the screen - else if (npc.ai[0] == 13f) - { - // Avoid cheap bullshit - npc.damage = 0; - - // Velocity - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - - // Play sound - if (npc.ai[2] == attackTimer - 30) - { - SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 phase3GoreDirection = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + npc.Center; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - int totalGore = Main.getGoodWorld ? 40 : 20; - for (int i = 0; i < totalGore; i++) - { - float velocityX = npc.direction * goreVelocityX * (Main.rand.NextFloat(0.2f, 0.8f) + 0.5f); - float velocityY = goreVelocityY * (Main.rand.NextFloat(0.2f, 0.8f) + 0.5f); - - if (Main.getGoodWorld) - { - velocityX *= Main.rand.NextFloat() + 0.5f; - velocityY *= Main.rand.NextFloat() + 0.5f; - } - - Projectile.NewProjectile(npc.GetSource_FromAI(), phase3GoreDirection.X, phase3GoreDirection.Y, velocityX, -velocityY, type, damage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - - if (npc.ai[2] >= attackTimer - 90) - { - if (npc.ai[2] % 18f == 0f) - { - calamityGlobalNPC.newAI[2] += 150f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float x = 900f - calamityGlobalNPC.newAI[2]; - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + x), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - x), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - - if (Main.getGoodWorld) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + x), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2] * 0.5f), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - x), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2] * 0.5f), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - } - } - } - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= attackTimer) - { - calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; - calamityGlobalNPC.newAI[2] = 0f; - npc.ai[0] = 10f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Tooth Ball and Vortex spin - else if (npc.ai[0] == 14f) - { - // Set damage - npc.damage = 0; - - // Play sounds and spawn Tooth Balls and a Vortex - if (npc.ai[2] == 0f) - { - modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); - - SoundEngine.PlaySound(OldDuke.OldDuke.VortexSpawnSound, npc.Center); - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Vector2 vortexSpawn = npc.Center + npc.velocity.RotatedBy(MathHelper.PiOver2 * -npc.direction) * spinTime / MathHelper.TwoPi; - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), vortexSpawn, Vector2.Zero, type, damage, 0f, Main.myPlayer, vortexSpawn.X, vortexSpawn.Y); - } - - if (npc.ai[2] % toothBallSpinPhaseDivisor == 0f) - { - if (npc.ai[2] != 0f) - SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.Center); - - Vector2 phase3ToothBallDirection = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + npc.Center; - Vector2 toothBallVelocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * toothBallSpinToothBallVelocity; - Vector2 toothBallSpawnPos = new Vector2(phase3ToothBallDirection.X, phase3ToothBallDirection.Y + 45f); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int toothBall = NPC.NewNPC(npc.GetSource_FromAI(), (int)toothBallSpawnPos.X, (int)toothBallSpawnPos.Y, ModContent.NPCType(), 0, toothBallVelocity.X, toothBallVelocity.Y); - Main.npc[toothBall].target = npc.target; - Main.npc[toothBall].velocity = Vector2.Normalize(toothBallVelocity) * toothBallSpinToothBallVelocity * 0.5f; - Main.npc[toothBall].netUpdate = true; - Main.npc[toothBall].ai[3] = 60f; - } - - for (int i = 0; i < 50; i++) - { - int dustID; - switch (Main.rand.Next(6)) - { - case 0: - case 1: - case 2: - case 3: - dustID = (int)CalamityDusts.SulphurousSeaAcid; - break; - default: - dustID = DustID.Blood; - break; - } - - // Choose a random speed and angle to belch out the vomit - float dustSpeed = Main.rand.NextFloat(3.0f, 12.0f); - float angleRandom = 0.06f; - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(toothBallVelocity.ToRotation()); - dustVel = dustVel.RotatedBy(-angleRandom); - dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - - // Pick a size for the vomit particles - float scale = Main.rand.NextFloat(1f, 2f); - - // Actually spawn the vomit - int idx = Dust.NewDust(toothBallSpawnPos, 40, 40, dustID, dustVel.X, dustVel.Y, 0, default, scale); - Main.dust[idx].noGravity = true; - } - } - - // Velocity and rotation - npc.velocity = npc.velocity.RotatedBy(-(double)spinSpeed * npc.direction); - npc.rotation -= spinSpeed * npc.direction; - - npc.ai[2] += 1f; - if (npc.ai[2] >= toothBallSpinTimer) - { - calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; - npc.ai[0] = 10f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - if (SoundEngine.TryGetActiveSound(modNPC.RoarSoundSlot, out var roarSound) && roarSound.IsPlaying) - roarSound.Position = npc.Center; - } - - static Color FireGreen = new Color(155, 255, 55); - - static void DoChargeBurst(NPC npc, int phase) - { - SoundEngine.PlaySound(phase > 1 ? OldDuke.OldDuke.DashSoundP3 : OldDuke.OldDuke.DashSound, npc.Center); - - if (phase > 1) - { - for (int i = 0; i < 30; i++) - { - float fl = Main.rand.NextFloat(-60f, 60f); - GeneralParticleHandler.SpawnParticle(new SparkParticle(npc.Center + (Vector2.Zero.DirectionTo(npc.velocity) * 20f) + new Vector2(0f, fl).RotatedBy(Vector2.Zero.AngleTo(npc.velocity)), (-npc.velocity * Main.rand.NextFloat(2f)).RotatedBy(MathHelper.ToRadians(fl)), false, 25, Main.rand.NextFloat(0.3f, 1.2f), FireGreen)); - } - - CalamityUtils.AddScreenshakeAt(npc.Center, 10f, 3000f); - - SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact, npc.Center); - SoundEngine.PlaySound(SoundID.DD2_BetsyFireballShot, npc.Center); - GeneralParticleHandler.SpawnParticle(new CustomPulse(npc.Center, -npc.velocity / 3f, FireGreen, "CalamityMod/Particles/DustyCircleHardEdge", new Vector2(0.4f, 1.2f), Vector2.Zero.AngleTo(npc.velocity) + (Main.rand.NextBool() ? 0 : -MathHelper.Pi), 0.05f, 0.2f, 20)); - GeneralParticleHandler.SpawnParticle(new CustomPulse(npc.Center, -npc.velocity / 2f, FireGreen, "CalamityMod/Particles/FlameExplosion", new Vector2(0.4f, 1.2f), Vector2.Zero.AngleTo(npc.velocity) + (Main.rand.NextBool() ? 0 : -MathHelper.Pi), 0.1f, 0.4f, 20)); - } - } - - static void DoChargeVisual(NPC npc, int phase) - { - float progress = npc.ai[2]; - - int chargeTime = 36; - - Color col = Color.Lerp(phase > 0 ? FireGreen : new Color(100, 100, 100, 55), new Color(55, 55, 55, 55), progress / chargeTime); - - if (phase > 1) - { - if (Math.Floor(VisualTimerSystem.GlobalVisualTimer % 6f) < 1f) - GeneralParticleHandler.SpawnParticle(new CustomPulse(npc.Center, npc.velocity / 3f, col, "CalamityMod/Particles/DustyCircleHardEdge", new Vector2(0.4f, 1f), Vector2.Zero.AngleTo(npc.velocity) + (Main.rand.NextBool() ? 0 : -MathHelper.Pi), 0.04f, 0.1f, 20)); - - (npc.ModNPC as OldDuke.OldDuke).NuclearOverlayVisual = 1f; - } - - if (Main.rand.NextBool()) - GeneralParticleHandler.SpawnParticle(new CustomSpark(npc.Center - (npc.velocity * 2f), npc.velocity / 2f, "CalamityMod/Particles/ForwardSmear", false, 10, Main.rand.NextFloat(0.3f, 0.5f), col, new Vector2(1f, Main.rand.NextFloat(1.45f, 1.6f)), fadeIn: true, extraRotation: MathHelper.ToRadians(180f))); - } - } -} diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 2a620e8b76..05ce02c117 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -1614,7 +1614,7 @@ namespace CalamityMod.NPCs { NPCType(), 10800 }, // 3:00 (180 seconds) { NPCType(), 10800 }, // 3:00 (180 seconds) { NPCType(), 5400 }, // 1:30 (90 seconds) - { NPCType(), 7200 }, // 2:00 (120 seconds) + { NPCType(), 7200 }, // 2:00 (120 seconds) { NPCType(), 14400 }, // 4:00 (240 seconds) { NPCType(), 10800 }, // 3:00 (180 seconds) { NPCType(), 1200 }, // 0:20 (20 seconds) @@ -9002,7 +9002,7 @@ namespace CalamityMod.NPCs { return DownedBossSystem.downedGuardians; } - else if (type == NPCType()) + else if (type == NPCType()) { return DownedBossSystem.downedDragonfolly; } diff --git a/NPCs/NormalNPCs/WildBumblebirb.cs b/NPCs/NormalNPCs/WildBumblebirb.cs new file mode 100644 index 0000000000..7ffe5fe3a8 --- /dev/null +++ b/NPCs/NormalNPCs/WildBumblebirb.cs @@ -0,0 +1,389 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; +using CalamityMod.Projectiles.Boss; +using CalamityMod.Sounds; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.GameContent.Bestiary; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; + +namespace CalamityMod.NPCs.NormalNPCs +{ + public class WildBumblebirb : ModNPC + { + public override void SetStaticDefaults() + { + Main.npcFrameCount[Type] = 5; + NPCID.Sets.TrailingMode[Type] = 1; + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() + { + Position = Vector2.UnitX * 36f + }; + NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + } + + public override string Texture => "CalamityMod/NPCs/Bumblebirb/BumbleFolly"; + + public override void SetDefaults() + { + NPC.npcSlots = 1f; + NPC.aiStyle = -1; + AIType = -1; + NPC.damage = 90; + NPC.width = 120; + NPC.height = 80; + NPC.defense = 20; + NPC.LifeMaxNERB(9375, 11250, 5000); // Old HP - 12000, 15000 + NPC.knockBackResist = 0.15f; + NPC.lavaImmune = true; + NPC.noTileCollide = true; + NPC.noGravity = true; + NPC.HitSound = SoundID.NPCHit51; + NPC.DeathSound = SoundID.NPCDeath46; + Banner = NPC.type; + BannerItem = ModContent.ItemType(); + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; + + // Scale stats in Expert and Master + CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); + CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Jungle, + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.WildBumblefuck") + }); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.PlayerSafe || !NPC.downedMoonlord || spawnInfo.Player.Calamity().ZoneSunkenSea || !spawnInfo.Player.ZoneJungle) + return 0f; + + // Keep this as a separate if check, because it's a loop and we don't want to be checking it constantly. + if (NPC.AnyNPCs(NPC.type)) + return 0f; + + return SpawnCondition.SurfaceJungle.Chance * 0.14f; + } + + public override void AI() + { + Player player = Main.player[NPC.target]; + + float rotationMult = 4f; + float rotationAmt = 0.04f; + + if (Vector2.Distance(player.Center, NPC.Center) > 5600f) + { + if (NPC.timeLeft > 5) + NPC.timeLeft = 5; + } + + NPC.rotation = (NPC.rotation * rotationMult + NPC.velocity.X * rotationAmt * 1.25f) / 10f; + + if (NPC.ai[0] == 0f || NPC.ai[0] == 1f) + { + for (int i = 0; i < Main.maxNPCs; i++) + { + if (i != NPC.whoAmI && Main.npc[i].active && Main.npc[i].type == NPC.type) + { + Vector2 otherSwarmerDirection = Main.npc[i].Center - NPC.Center; + if (otherSwarmerDirection.Length() < (NPC.width + NPC.height)) + { + otherSwarmerDirection.Normalize(); + otherSwarmerDirection *= -0.1f; + NPC.velocity += otherSwarmerDirection; + NPC nPC6 = Main.npc[i]; + nPC6.velocity -= otherSwarmerDirection; + } + } + } + } + + if (NPC.target < 0 || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + { + NPC.TargetClosest(true); + Vector2 swarmerTargetDist = Main.player[NPC.target].Center - NPC.Center; + if (Main.player[NPC.target].dead || swarmerTargetDist.Length() > 2800f) + NPC.ai[0] = -1f; + } + else + { + Vector2 swarmerCatchUpTargetDist = Main.player[NPC.target].Center - NPC.Center; + if (NPC.ai[0] > 1f && swarmerCatchUpTargetDist.Length() > 3600f) + NPC.ai[0] = 1f; + } + + if (NPC.ai[0] == -1f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + Vector2 swarmerDespawnVelMult = new Vector2(0f, -8f); + NPC.velocity = (NPC.velocity * 21f + swarmerDespawnVelMult) / 10f; + return; + } + + if (NPC.ai[0] == 0f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.TargetClosest(true); + NPC.spriteDirection = NPC.direction; + + Vector2 swarmerIdleTargetDist = Main.player[NPC.target].Center - NPC.Center; + if (swarmerIdleTargetDist.Length() > 2800f) + { + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + } + else if (swarmerIdleTargetDist.Length() > 400f) + { + float swarmerIdleSpeed = 7f + swarmerIdleTargetDist.Length() / 100f + NPC.ai[1] / 15f; + swarmerIdleTargetDist.Normalize(); + swarmerIdleTargetDist *= swarmerIdleSpeed; + NPC.velocity = (NPC.velocity * 29f + swarmerIdleTargetDist) / 30f; + if (Main.getGoodWorld && !Main.zenithWorld) + NPC.velocity *= 1.15f; + } + else if (NPC.velocity.Length() > 2f) + NPC.velocity *= 0.95f; + else if (NPC.velocity.Length() < 1f) + NPC.velocity *= 1.05f; + + NPC.ai[1] += 1f; + if (NPC.ai[1] >= 105f) + { + NPC.ai[1] = 0f; + NPC.ai[0] = 2f; + } + } + else + { + if (NPC.ai[0] == 1f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + if (NPC.target < 0 || !Main.player[NPC.target].active || Main.player[NPC.target].dead) + NPC.TargetClosest(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 swarmerChargeTargetDist = Main.player[NPC.target].Center - NPC.Center; + if (swarmerChargeTargetDist.Length() < 800f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + { + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + } + + NPC.ai[2] += 0.0166666675f; + float swarmerChargeSpeed = 9f + NPC.ai[2] + swarmerChargeTargetDist.Length() / 150f; + float swarmerChargeVelMult = 25f; + swarmerChargeTargetDist.Normalize(); + swarmerChargeTargetDist *= swarmerChargeSpeed; + NPC.velocity = (NPC.velocity * (swarmerChargeVelMult - 1f) + swarmerChargeTargetDist) / swarmerChargeVelMult; + if (Main.getGoodWorld && !Main.zenithWorld) + NPC.velocity *= 1.15f; + + NPC.ForceNetUpdate(); + + return; + } + + if (NPC.ai[0] == 2f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + 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 * 0.75f + NPC.velocity.X * rotationAmt * 1.25f) / 8f; + + Vector2 swarmerDecelerateTargetDist = Main.player[NPC.target].Center - NPC.Center; + swarmerDecelerateTargetDist.Y -= 8f; + float swarmerDecelerateSpeed = 14f; + float swarmerDecelerateVelMult = 8f; + swarmerDecelerateTargetDist.Normalize(); + swarmerDecelerateTargetDist *= swarmerDecelerateSpeed; + NPC.velocity = (NPC.velocity * (swarmerDecelerateVelMult - 1f) + swarmerDecelerateTargetDist) / swarmerDecelerateVelMult; + if (Main.getGoodWorld && !Main.zenithWorld) + NPC.velocity *= 1.15f; + + 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) + { + // Set damage + NPC.damage = NPC.defDamage; + + NPC.velocity = swarmerDecelerateTargetDist; + if (Main.getGoodWorld && !Main.zenithWorld) + NPC.velocity *= 1.15f; + + if (NPC.velocity.X < 0f) + NPC.direction = -1; + else + NPC.direction = 1; + + NPC.ai[0] = 2.1f; + NPC.ai[1] = 0f; + } + } + else if (NPC.ai[0] == 2.1f) + { + // Set damage + NPC.damage = NPC.defDamage; + + if (NPC.velocity.X < 0f) + NPC.direction = -1; + else if (NPC.velocity.X > 0f) + NPC.direction = 1; + + NPC.spriteDirection = NPC.direction; + + NPC.velocity *= 1.01f; + + NPC.ai[1] += 1f; + if (NPC.ai[1] > 30f) + { + if (!Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + { + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + return; + } + + if (NPC.ai[1] > 60f) + { + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + } + } + } + } + } + + public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 1, 5, 7); + public override void OnKill() + { + if (Main.zenithWorld) + { + SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, NPC.Center - Vector2.UnitY * 300f); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int i = 0; i < 5; i++) + { + Vector2 fireFrom = new Vector2(NPC.Center.X + (40 * i) - 120, NPC.Center.Y - 900f); + Vector2 ai0 = NPC.Center - fireFrom; + float ai = Main.rand.Next(100); + Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), NPC.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai); + } + } + } + } + + public override void FindFrame(int frameHeight) + { + NPC.frameCounter += NPC.ai[0] == 2.1f ? 1.5 : 1D; + if (Main.zenithWorld) + { + NPC.frameCounter += 2D; + } + 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 bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2); + int afterimageAmt = NPC.ai[0] == 2.1f ? 7 : 0; + + if (CalamityClientConfig.Instance.Afterimages) + { + for (int i = 1; i < afterimageAmt; i += 2) + { + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, Color.Gold, 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[Type]) * NPC.scale / 2f; + afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + } + } + + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[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; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 50; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f); + } + } + } + } +} diff --git a/NPCs/NormalNPCs/WildBumblefuck.cs b/NPCs/NormalNPCs/WildBumblefuck.cs deleted file mode 100644 index b0be162495..0000000000 --- a/NPCs/NormalNPCs/WildBumblefuck.cs +++ /dev/null @@ -1,173 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; -using CalamityMod.Projectiles.Boss; -using CalamityMod.Sounds; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; - -namespace CalamityMod.NPCs.NormalNPCs -{ - public class WildBumblefuck : ModNPC - { - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 5; - NPCID.Sets.TrailingMode[Type] = 1; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() - { - Position = Vector2.UnitX * 36f - }; - NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - } - - public override string Texture => "CalamityMod/NPCs/Bumblebirb/BumbleFolly"; - - public override void SetDefaults() - { - NPC.npcSlots = 1f; - NPC.aiStyle = -1; - AIType = -1; - NPC.damage = 90; - NPC.width = 120; - NPC.height = 80; - NPC.defense = 20; - NPC.LifeMaxNERB(9375, 11250, 5000); // Old HP - 12000, 15000 - NPC.knockBackResist = 0.15f; - NPC.lavaImmune = true; - NPC.noTileCollide = true; - NPC.noGravity = true; - NPC.HitSound = SoundID.NPCHit51; - NPC.DeathSound = SoundID.NPCDeath46; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = true; - NPC.Calamity().VulnerableToCold = true; - NPC.Calamity().VulnerableToSickness = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Jungle, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.WildBumblefuck") - }); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.PlayerSafe || !NPC.downedMoonlord || spawnInfo.Player.Calamity().ZoneSunkenSea || !spawnInfo.Player.ZoneJungle) - return 0f; - - // Keep this as a separate if check, because it's a loop and we don't want to be checking it constantly. - if (NPC.AnyNPCs(NPC.type)) - return 0f; - - return SpawnCondition.SurfaceJungle.Chance * 0.14f; - } - - public override void AI() - { - BumblebirbAI.VanillaBumblebirb2AI(NPC, Mod, false); - } - - public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 1, 5, 7); - public override void OnKill() - { - if (Main.zenithWorld) - { - SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, NPC.Center - Vector2.UnitY * 300f); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - for (int i = 0; i < 5; i++) - { - Vector2 fireFrom = new Vector2(NPC.Center.X + (40 * i) - 120, NPC.Center.Y - 900f); - Vector2 ai0 = NPC.Center - fireFrom; - float ai = Main.rand.Next(100); - Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), NPC.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai); - } - } - } - } - - public override void FindFrame(int frameHeight) - { - NPC.frameCounter += NPC.ai[0] == 2.1f ? 1.5 : 1D; - if (Main.zenithWorld) - { - NPC.frameCounter += 2D; - } - 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 bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - Texture2D texture2D15 = TextureAssets.Npc[Type].Value; - Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2); - int afterimageAmt = NPC.ai[0] == 2.1f ? 7 : 0; - - if (CalamityClientConfig.Instance.Afterimages) - { - for (int i = 1; i < afterimageAmt; i += 2) - { - Color afterimageColor = drawColor; - afterimageColor = Color.Lerp(afterimageColor, Color.Gold, 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[Type]) * NPC.scale / 2f; - afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - } - } - - Vector2 drawLocation = NPC.Center - screenPos; - drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[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; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0) - { - for (int k = 0; k < 50; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f); - } - } - } - } -} diff --git a/NPCs/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index 88e48e8dbe..1d6b35bf42 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -18,9 +18,9 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; -using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; using CalamityMod.NPCs.TownNPCs; using CalamityMod.Particles; +using CalamityMod.Projectiles.Boss; using CalamityMod.Systems; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -59,8 +59,8 @@ namespace CalamityMod.NPCs.OldDuke public static readonly SoundStyle VortexSpawnSound = new("CalamityMod/Sounds/Custom/OldDukeVortexSpawn"); public static readonly SoundStyle DashSound = new("CalamityMod/Sounds/Custom/OldDukeDash"); public static readonly SoundStyle DashSoundP3 = new("CalamityMod/Sounds/Custom/OldDukeDashP3"); - - public SlotId RoarSoundSlot; + private static Color FireGreen = new Color(155, 255, 55); + private SlotId RoarSoundSlot; public static Asset GlowTexture; @@ -143,24 +143,1667 @@ namespace CalamityMod.NPCs.OldDuke NPC.Calamity().newAI[i] = reader.ReadSingle(); } + #region Visual Helper Methods + static void DoChargeBurst(NPC npc, int phase) + { + SoundEngine.PlaySound(phase > 1 ? DashSoundP3 : DashSound, npc.Center); + + if (phase > 1) + { + for (int i = 0; i < 30; i++) + { + float fl = Main.rand.NextFloat(-60f, 60f); + GeneralParticleHandler.SpawnParticle(new SparkParticle(npc.Center + (Vector2.Zero.DirectionTo(npc.velocity) * 20f) + new Vector2(0f, fl).RotatedBy(Vector2.Zero.AngleTo(npc.velocity)), (-npc.velocity * Main.rand.NextFloat(2f)).RotatedBy(MathHelper.ToRadians(fl)), false, 25, Main.rand.NextFloat(0.3f, 1.2f), FireGreen)); + } + + CalamityUtils.AddScreenshakeAt(npc.Center, 10f, 3000f); + + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact, npc.Center); + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballShot, npc.Center); + GeneralParticleHandler.SpawnParticle(new CustomPulse(npc.Center, -npc.velocity / 3f, FireGreen, "CalamityMod/Particles/DustyCircleHardEdge", new Vector2(0.4f, 1.2f), Vector2.Zero.AngleTo(npc.velocity) + (Main.rand.NextBool() ? 0 : -MathHelper.Pi), 0.05f, 0.2f, 20)); + GeneralParticleHandler.SpawnParticle(new CustomPulse(npc.Center, -npc.velocity / 2f, FireGreen, "CalamityMod/Particles/FlameExplosion", new Vector2(0.4f, 1.2f), Vector2.Zero.AngleTo(npc.velocity) + (Main.rand.NextBool() ? 0 : -MathHelper.Pi), 0.1f, 0.4f, 20)); + } + } + static void DoChargeVisual(NPC npc, int phase) + { + float progress = npc.ai[2]; + int chargeTime = 36; + + Color col = Color.Lerp(phase > 0 ? FireGreen : new Color(100, 100, 100, 55), new Color(55, 55, 55, 55), progress / chargeTime); + + if (phase > 1) + { + if (Math.Floor(VisualTimerSystem.GlobalVisualTimer % 6f) < 1f) + GeneralParticleHandler.SpawnParticle(new CustomPulse(npc.Center, npc.velocity / 3f, col, "CalamityMod/Particles/DustyCircleHardEdge", new Vector2(0.4f, 1f), Vector2.Zero.AngleTo(npc.velocity) + (Main.rand.NextBool() ? 0 : -MathHelper.Pi), 0.04f, 0.1f, 20)); + + (npc.ModNPC as OldDuke).NuclearOverlayVisual = 1f; + } + + if (Main.rand.NextBool()) + GeneralParticleHandler.SpawnParticle(new CustomSpark(npc.Center - (npc.velocity * 2f), npc.velocity / 2f, "CalamityMod/Particles/ForwardSmear", false, 10, Main.rand.NextFloat(0.3f, 0.5f), col, new Vector2(1f, Main.rand.NextFloat(1.45f, 1.6f)), fadeIn: true, extraRotation: MathHelper.ToRadians(180f))); + } + #endregion + public override void AI() { + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); shake = MathHelper.Lerp(shake, 0f, 0.1f); + // Percent life remaining float lifeRatio = NPC.life / (float)NPC.lifeMax; + // Variables bool bossRush = BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || bossRush; bool revenge = CalamityWorld.revenge || bossRush; bool death = CalamityWorld.death || bossRush; + float exhaustionGateValue = 360f; + if (Main.getGoodWorld) + exhaustionGateValue *= 0.5f; + + float numberOfAttacksBeforeExhaustion = 12f; + float exhaustionIncreasePerAttack = exhaustionGateValue * (1f / numberOfAttacksBeforeExhaustion); + bool exhausted = calamityGlobalNPC.newAI[1] == 1f; bool phase2 = lifeRatio <= (death ? LifePercentagePhase2_Death : revenge ? LifePercentagePhase2_Revenge : LifePercentagePhase2_Normal); bool phase3 = lifeRatio <= (death ? LifePercentagePhase3_Death : (revenge ? LifePercentagePhase3_Revenge : LifePercentagePhase3_Expert)) && expertMode; - + bool phase2AI = NPC.ai[0] > 4f; + bool phase3AI = NPC.ai[0] > 9f; + Phase = phase3 ? 2 : phase2 ? 1 : 0; NuclearOverlayVisual = (Phase == 2 && NPC.Calamity().newAI[1] != 1) ? MathHelper.Lerp(NuclearOverlayVisual, 0.2f, 0.2f) : MathHelper.Lerp(NuclearOverlayVisual, 0f, 0.1f); - OldDukeAI.VanillaOldDukeAI(NPC, Mod); + NPC.Calamity().canBreakPlayerDefense = true; + + bool charging = NPC.ai[3] < 10f; + if (calamityGlobalNPC.newAI[0] >= exhaustionGateValue) + calamityGlobalNPC.newAI[1] = 1f; + + float alphaScale = (255 - NPC.alpha) / 255f; + float redLight = (phase3AI ? 0.4f : phase2AI ? 0.64f : 0.88f) * alphaScale; + float greenLight = (phase3AI ? 1.2f : phase2AI ? 0.8f : 0.4f) * alphaScale; + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), redLight, greenLight, 0f); + + if (CalamityServerConfig.Instance.BossesStopWeather) + CalamityWorld.StopRain(); + else if (!Main.raining && !BossRushEvent.BossRushActive) + CalamityWorld.StartRain(); + + // Adjust stats + int setDamage = NPC.defDamage; + calamityGlobalNPC.DR = exhausted ? 0f : 0.5f; + NPC.defense = exhausted ? 0 : NPC.defDefense; + if (phase3AI) + { + setDamage = (int)Math.Round(setDamage * 1.2); + NPC.defense = exhausted ? 0 : NPC.defDefense - 40; + } + else if (phase2AI) + { + setDamage = (int)Math.Round(setDamage * 1.1); + NPC.defense = exhausted ? 0 : NPC.defDefense - 20; + } + + int idlePhaseTimer = expertMode ? 55 : 60; + float idlePhaseAcceleration = expertMode ? 0.75f : 0.7f; + float idlePhaseVelocity = expertMode ? 14f : 13f; + if (phase3AI) + { + idlePhaseAcceleration = expertMode ? 0.6f : 0.55f; + idlePhaseVelocity = expertMode ? 12f : 11f; + } + else if (phase2AI & charging) + { + idlePhaseAcceleration = expertMode ? 0.8f : 0.75f; + idlePhaseVelocity = expertMode ? 15f : 14f; + } + + int chargeTime = expertMode ? 34 : 36; + float chargeVelocity = expertMode ? 20f : 19f; + if (phase3AI) + { + chargeTime = expertMode ? 28 : 30; + chargeVelocity = expertMode ? 26f : 25f; + } + else if (charging & phase2AI) + { + chargeTime = expertMode ? 31 : 33; + chargeVelocity = expertMode ? 24f : 23f; + } + + if (bossRush) + { + idlePhaseTimer = 35; + idlePhaseAcceleration *= 1.25f; + idlePhaseVelocity *= 1.2f; + chargeTime -= 3; + chargeVelocity *= 1.25f; + } + else if (death) + { + idlePhaseTimer = 51; + idlePhaseAcceleration *= 1.05f; + idlePhaseVelocity *= 1.05f; + chargeTime -= 2; + chargeVelocity *= 1.1f; + } + else if (revenge) + { + idlePhaseTimer = 53; + idlePhaseAcceleration *= 1.025f; + idlePhaseVelocity *= 1.025f; + chargeTime -= 1; + chargeVelocity *= 1.05f; + } + + // The dumbest thing to ever exist + if (CalamityWorld.LegendaryMode && revenge) + chargeVelocity *= 1.25f; + + if (exhausted) + idlePhaseVelocity *= 0.25f; + + // Variables + int maxToothBallBelches = bossRush ? 5 : death ? 4 : 3; + int toothBallBelchPhaseDivisor = bossRush ? 24 : death ? 30 : 40; + int toothBallBelchPhaseTimer = toothBallBelchPhaseDivisor * maxToothBallBelches; + float toothBallBelchPhaseAcceleration = bossRush ? 0.95f : death ? 0.6f : 0.55f; + float toothBallBelchPhaseVelocity = bossRush ? 14f : death ? 10f : 9f; + float toothBallFinalVelocity = death ? 14f : revenge ? 13f : 12f; + float goreVelocityX = death ? 8f : revenge ? 7.5f : expertMode ? 7f : 6f; + float goreVelocityY = death ? 10.5f : revenge ? 10f : expertMode ? 9.5f : 8f; + float sharkronVelocity = bossRush ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; + int attackTimer = 120; + int phaseTransitionTimer = 180; + int teleportPauseTimer = 30; + int toothBallSpinPhaseDivisor = bossRush ? 27 : death ? 32 : 45; + int toothBallSpinTimer = maxToothBallBelches * toothBallSpinPhaseDivisor; + float spinTime = toothBallSpinTimer / 2f; + float toothBallSpinToothBallVelocity = bossRush ? 14f : death ? 9.5f : 9f; + float spinAttackSpeed = Main.zenithWorld ? 44f : 22f; + float spinSpeed = MathHelper.TwoPi / spinTime; + + Player player = Main.player[NPC.target]; + + // Get target + if (NPC.target < 0 || NPC.target == Main.maxPlayers || player.dead || !player.active) + { + NPC.TargetClosest(); + player = Main.player[NPC.target]; + NPC.netUpdate = true; + } + + // Despawn safety, make sure to target another player if the current player target is too far away + if (Vector2.Distance(player.Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); + + // Despawn + if (player.dead || Vector2.Distance(player.Center, NPC.Center) > 8800f) + { + NPC.TargetClosest(); + + NPC.velocity.Y -= 0.4f; + + if (NPC.timeLeft > 10) + NPC.timeLeft = 10; + + if (NPC.timeLeft == 1) + { + AcidRainEvent.AccumulatedKillPoints = 0; + AcidRainEvent.HasTriedToSummonOldDuke = false; + AcidRainEvent.UpdateInvasion(false); + NPC.timeLeft = 0; + } + + if (NPC.ai[0] > 4f) + NPC.ai[0] = 5f; + else + NPC.ai[0] = 0f; + + NPC.ai[2] = 0f; + } + + if (exhausted) + { + NPC.Calamity().canBreakPlayerDefense = false; + + // Play exhausted sound + if (calamityGlobalNPC.newAI[0] % 60f == 0f && Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < 2800f) + SoundEngine.PlaySound(HuffSound with { Volume = HuffSound.Volume * 1.25f }, Main.LocalPlayer.Center); + + if (Main.zenithWorld) + { + float screenShakePower = 10 * Utils.GetLerpValue(800f, 0f, NPC.Distance(Main.LocalPlayer.Center), true); + if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < screenShakePower) + Main.LocalPlayer.Calamity().GeneralScreenShakePower = screenShakePower; + + if (calamityGlobalNPC.newAI[0] == exhaustionGateValue) + SoundEngine.PlaySound(SoundID.NPCDeath64 with { Pitch = SoundID.NPCDeath64.Pitch - 0.9f, Volume = SoundID.NPCDeath64.Volume + 0.4f }, player.Center); // fart + + if (Main.netMode != NetmodeID.MultiplayerClient && calamityGlobalNPC.newAI[0] % 5f == 0f) + { + Vector2 dist = player.Center - NPC.Center; + dist.Normalize(); + dist *= 3; + dist.X += Main.rand.NextFloat(-0.5f, 0.5f); + dist.Y += Main.rand.NextFloat(-0.5f, 0.5f); + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, -dist, type, damage, 0, Main.myPlayer); + } + } + + calamityGlobalNPC.newAI[0] -= bossRush ? 1.5f : 1f; + if (calamityGlobalNPC.newAI[0] <= 0f) + { + calamityGlobalNPC.newAI[0] = 0f; + calamityGlobalNPC.newAI[1] = 0f; + } + } + + // Enrage variable + bool enrage = !bossRush && + (player.position.Y < 300f || player.position.Y > Main.worldSurface * 16.0 || + (player.position.X > 8000f && player.position.X < (Main.maxTilesX * 16 - 8000))); + + // Check for the flipped Abyss + if (Main.remixWorld) + { + enrage = !bossRush && + (player.position.Y < Main.UnderworldLayer * 16 * 0.8f || player.position.Y > Main.UnderworldLayer * 16 || + (player.position.X > 8000f && player.position.X < (Main.maxTilesX * 16 - 8000))); + } + + // Enrage + if (enrage) + { + if (NPC.localAI[1] > 0f) + NPC.localAI[1] -= 1f; + } + else + NPC.localAI[1] = CalamityGlobalNPC.biomeEnrageTimerMax; + + bool biomeEnraged = NPC.localAI[1] <= 0f; + + NPC.Calamity().CurrentlyEnraged = biomeEnraged || bossRush; + + // Increased DR while transitioning phases and not exhausted + if (!exhausted) + calamityGlobalNPC.DR = (NPC.ai[0] == -1f || NPC.ai[0] == 4f || NPC.ai[0] == 9f) ? (bossRush ? 0.99f : 0.75f) : 0.5f; + + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = NPC.ai[0] == -1f || NPC.ai[0] == 4f || NPC.ai[0] == 9f; + + // Enrage + if (biomeEnraged) + { + toothBallBelchPhaseTimer = 60; + toothBallBelchPhaseDivisor = 20; + toothBallBelchPhaseAcceleration = 1f; + toothBallBelchPhaseVelocity = 15f; + goreVelocityX = 12f; + goreVelocityY = 16f; + sharkronVelocity = 20f; + idlePhaseTimer = 20; + idlePhaseAcceleration = 1.2f; + idlePhaseVelocity = 20f; + chargeTime = 25; + chargeVelocity += 8f; + toothBallSpinPhaseDivisor = 24; + toothBallSpinToothBallVelocity = 15f; + setDamage *= 2; + NPC.defense = NPC.defDefense * 3; + } + + // The dumbest thing to ever exist + if (CalamityWorld.LegendaryMode && revenge) + chargeTime *= 2; + + // Set variables for spawn effects + if (NPC.localAI[0] == 0f) + { + NPC.alpha = 255; + + NPC.velocity.Y = -12f; + NPC.velocity.X = Main.rand.NextFloat(-2f, 2f); + + NPC.localAI[0] = 1f; + NPC.rotation = 0f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.ai[0] = -1f; + NPC.netUpdate = true; + } + } + + // Rotation + float rateOfRotation = 0.04f; + if (NPC.ai[0] == 1f || NPC.ai[0] == 6f || NPC.ai[0] == 7f || NPC.ai[0] == 14f) + rateOfRotation = 0f; + if (NPC.ai[0] == 3f || NPC.ai[0] == 4f) + rateOfRotation = 0.01f; + if (NPC.ai[0] == 8f || NPC.ai[0] == 13f) + rateOfRotation = 0.05f; + + Vector2 rotationVector = player.Center - NPC.Center; + if (calamityGlobalNPC.newAI[1] != 1f && !player.dead) + { + // Rotate to show direction of predictive charge + if (NPC.ai[0] == 0f && !phase2) + { + if (NPC.ai[3] < 6f) + { + rateOfRotation = 0.1f; + rotationVector = Vector2.Normalize(player.Center + player.velocity * 20f - NPC.Center) * chargeVelocity; + } + } + else if (NPC.ai[0] == 5f && !phase3) + { + if (NPC.ai[3] < 4f) + { + rateOfRotation = 0.1f; + rotationVector = Vector2.Normalize(player.Center + player.velocity * 20f - NPC.Center) * chargeVelocity; + } + } + else if (NPC.ai[0] == 10f) + { + if (NPC.ai[3] < 8f && NPC.ai[3] != 1f && NPC.ai[3] != 4f) + { + rateOfRotation = 0.1f; + rotationVector = Vector2.Normalize(player.Center + player.velocity * 20f - NPC.Center) * chargeVelocity; + } + } + } + + float dukeRotationSpeed = (float)Math.Atan2(rotationVector.Y, rotationVector.X); + if (NPC.spriteDirection == 1) + dukeRotationSpeed += MathHelper.Pi; + if (dukeRotationSpeed < 0f) + dukeRotationSpeed += MathHelper.TwoPi; + if (dukeRotationSpeed > MathHelper.TwoPi) + dukeRotationSpeed -= MathHelper.TwoPi; + if (NPC.ai[0] == -1f || NPC.ai[0] == 3f || NPC.ai[0] == 4f) + dukeRotationSpeed = 0f; + if (NPC.ai[0] == 8f || NPC.ai[0] == 13f) + dukeRotationSpeed = MathHelper.Pi * 0.1666666667f * NPC.spriteDirection; + + if (NPC.rotation < dukeRotationSpeed) + { + if (dukeRotationSpeed - NPC.rotation > MathHelper.Pi) + NPC.rotation -= rateOfRotation; + else + NPC.rotation += rateOfRotation; + } + if (NPC.rotation > dukeRotationSpeed) + { + if (NPC.rotation - dukeRotationSpeed > MathHelper.Pi) + NPC.rotation += rateOfRotation; + else + NPC.rotation -= rateOfRotation; + } + + if ((NPC.ai[0] != 8f && NPC.ai[0] != 13f) || NPC.spriteDirection == 1) + { + if (NPC.rotation > dukeRotationSpeed - rateOfRotation && NPC.rotation < dukeRotationSpeed + rateOfRotation) + NPC.rotation = dukeRotationSpeed; + if (NPC.rotation < 0f) + NPC.rotation += MathHelper.TwoPi; + if (NPC.rotation > MathHelper.TwoPi) + NPC.rotation -= MathHelper.TwoPi; + if (NPC.rotation > dukeRotationSpeed - rateOfRotation && NPC.rotation < dukeRotationSpeed + rateOfRotation) + NPC.rotation = dukeRotationSpeed; + } + + // Alpha adjustments + if (NPC.ai[0] != -1f && (NPC.ai[0] < 9f || NPC.ai[0] > 12f)) + { + if (Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + NPC.alpha += 15; + else + NPC.alpha -= 15; + + if (NPC.alpha < 0) + NPC.alpha = 0; + if (NPC.alpha > 150) + NPC.alpha = 150; + } + + // Spawn effects + if (NPC.ai[0] == -1f) + { + NPC.alpha = (int)MathHelper.Lerp(NPC.alpha, 0, 0.2f); + + // Avoid cheap bullshit + NPC.damage = 0; + + // Velocity + if (NPC.Calamity().newAI[3] == 0f) + NPC.velocity *= 0.98f; + + // Direction + int dukeFaceDirection = Math.Sign(player.Center.X - NPC.Center.X); + if (dukeFaceDirection != 0) + { + NPC.direction = dukeFaceDirection; + NPC.spriteDirection = -NPC.direction; + } + + // Alpha + if (NPC.ai[2] > 20f) + { + NPC.velocity *= 0.9f; + + NPC.alpha -= 5; + if (Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + NPC.alpha += 15; + if (NPC.alpha < 0) + NPC.alpha = 0; + if (NPC.alpha > 150) + NPC.alpha = 150; + } + + if (NPC.ai[2] == 75) + { + RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center); + + CalamityUtils.AddScreenshakeAt(NPC.Center, 14); + SoundEngine.PlaySound(SoundID.DD2_BetsyFlameBreath.WithPitchOffset(-0.5f), NPC.Center); + SoundEngine.PlaySound(DashSoundP3, NPC.Center); + } + + if (NPC.ai[2] >= 75f) + { + float sd = player.Center.X > NPC.Center.X ? -1f : 1f; + + shake = 2f; + NPC.rotation = MathHelper.Lerp(MathHelper.WrapAngle(NPC.rotation), MathHelper.ToRadians(sd == 1f ? 75f : -75f), 0.2f); + + if (NPC.ai[2] % 5f == 1f) + { + Vector2 mouthCenter = NPC.Center + new Vector2(-80 * sd, 0).RotatedBy(NPC.rotation); + + float factor = (NPC.ai[2] - 75f) / 50f; + + float a = MathHelper.Lerp(1f, 0f, factor); + + GeneralParticleHandler.SpawnParticle(new CustomPulse(mouthCenter, Vector2.Zero, new Color(55, 55, 55).MultiplyRGBA(new Color(a, a, a, a)), "CalamityMod/Particles/DustyCircleHardEdge", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.05f, 0.08f + (0.15f * factor), 10)); + } + } + + NPC.ai[2] += 1f; + if (NPC.ai[2] >= 125f) + { + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.netUpdate = true; + } + } + + // Phase 1 + else if (NPC.ai[0] == 0f && !player.dead) + { + // Avoid cheap bullshit + NPC.damage = 0; + + // Velocity + if (NPC.ai[1] == 0f) + NPC.ai[1] = 500 * Math.Sign((NPC.Center - player.Center).X); + + Vector2 phase1IdleSpeed = Vector2.Normalize(player.Center + new Vector2(NPC.ai[1], -300f) - NPC.Center - NPC.velocity) * idlePhaseVelocity; + NPC.SimpleFlyMovement(phase1IdleSpeed, idlePhaseAcceleration); + + // Rotation and direction + int dukeLookAt = Math.Sign(player.Center.X - NPC.Center.X); + if (dukeLookAt != 0) + { + if (NPC.ai[2] == 0f && dukeLookAt != NPC.direction) + NPC.rotation += MathHelper.Pi; + + NPC.direction = dukeLookAt; + + if (NPC.spriteDirection != -NPC.direction) + NPC.rotation += MathHelper.Pi; + + NPC.spriteDirection = -NPC.direction; + } + + // Phase switch + if (calamityGlobalNPC.newAI[1] != 1f || (phase2 && !phase2AI)) + { + NPC.ai[2] += 1f; + if (NPC.ai[2] >= idlePhaseTimer || (phase2 && !phase2AI)) + { + int oldDukeAttackPicker = 0; + switch ((int)NPC.ai[3]) + { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + oldDukeAttackPicker = 1; + break; + case 6: + NPC.ai[3] = 1f; + oldDukeAttackPicker = 2; + break; + case 7: + NPC.ai[3] = 0f; + oldDukeAttackPicker = 3; + break; + } + + if (phase2) + oldDukeAttackPicker = 4; + + // Set velocity for charge + if (oldDukeAttackPicker == 1) + { + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + + // Velocity + Vector2 distanceVector = player.Center + player.velocity * 20f - NPC.Center; + NPC.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); + + DoChargeBurst(NPC, 0); + + // Direction + if (dukeLookAt != 0) + { + NPC.direction = dukeLookAt; + + if (NPC.spriteDirection == 1) + NPC.rotation += MathHelper.Pi; + + NPC.spriteDirection = -NPC.direction; + } + } + + // Tooth Balls + else if (oldDukeAttackPicker == 2) + { + NPC.ai[0] = 2f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + } + + // Call sharks from the sides of the screen + else if (oldDukeAttackPicker == 3) + { + NPC.ai[0] = 3f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + } + + // Go to phase 2 + else if (oldDukeAttackPicker == 4) + { + NPC.ai[0] = 4f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + } + + NPC.netUpdate = true; + } + } + } + + // Charge + else if (NPC.ai[0] == 1f) + { + // Set damage + NPC.damage = setDamage; + + // The dumbest thing to ever exist + if (CalamityWorld.LegendaryMode && revenge && NPC.ai[2] % 10f == 0f) + { + // Rotation and direction + int dir = Math.Sign(player.Center.X - NPC.Center.X); + if (dir != 0) + { + if (NPC.ai[2] == 0f && dir != NPC.direction) + NPC.rotation += MathHelper.Pi; + + NPC.direction = dir; + + if (NPC.spriteDirection != -NPC.direction) + NPC.rotation += MathHelper.Pi; + + NPC.spriteDirection = -NPC.direction; + } + + Vector2 distanceVector = player.Center + player.velocity * 20f - NPC.Center; + NPC.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); + + // Direction + if (dir != 0) + { + NPC.direction = dir; + + if (NPC.spriteDirection == 1) + NPC.rotation += MathHelper.Pi; + + NPC.spriteDirection = -NPC.direction; + } + } + else + { + // Accelerate + NPC.velocity *= 1.01f; + } + + // Spawn dust + Vector2 vel = NPC.velocity; + vel.Normalize(); + vel *= 55f; + + DoChargeVisual(NPC, Phase); + + GeneralParticleHandler.SpawnParticle(new SparkParticle(NPC.Center + vel + vel.RotatedBy(MathHelper.ToRadians(90)), vel / 7f, false, 20, 0.75f, new Color(155, 155, 155, 55), true)); + GeneralParticleHandler.SpawnParticle(new SparkParticle(NPC.Center + vel + vel.RotatedBy(MathHelper.ToRadians(-90)), vel / 7f, false, 20, 0.75f, new Color(155, 155, 155, 55), true)); + + NPC.ai[2] += 1f; + if (NPC.ai[2] >= chargeTime) + { + calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] += 2f; + NPC.TargetClosest(); + NPC.netUpdate = true; + } + } + + // Tooth Ball belch + else if (NPC.ai[0] == 2f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + // Velocity + if (NPC.ai[1] == 0f) + NPC.ai[1] = 500 * Math.Sign((NPC.Center - player.Center).X); + + Vector2 toothBallBelchPhaseSpeed = Vector2.Normalize(player.Center + new Vector2(NPC.ai[1], -300f) - NPC.Center - NPC.velocity) * toothBallBelchPhaseVelocity; + NPC.SimpleFlyMovement(toothBallBelchPhaseSpeed, toothBallBelchPhaseAcceleration); + + // Play sounds and spawn Tooth Balls + if (NPC.ai[2] == 0f) + RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center); + + if (NPC.ai[2] % toothBallBelchPhaseDivisor == 0f) + { + if (NPC.ai[2] != 0f) + SoundEngine.PlaySound(VomitSound, NPC.Center); + + Vector2 toothBallDirection = Vector2.Normalize(player.Center - NPC.Center) * (NPC.width + 20) / 2f + NPC.Center; + Vector2 toothBallVelocity = Vector2.Normalize(Main.player[NPC.target].Center - NPC.Center) * toothBallFinalVelocity; + Vector2 toothBallSpawnPos = new Vector2(toothBallDirection.X, toothBallDirection.Y + 45f); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int toothBall = NPC.NewNPC(NPC.GetSource_FromAI(), (int)toothBallSpawnPos.X, (int)toothBallSpawnPos.Y, ModContent.NPCType(), 0, toothBallVelocity.X, toothBallVelocity.Y); + Main.npc[toothBall].velocity = Vector2.Normalize(toothBallVelocity) * NPC.velocity.Length(); + Main.npc[toothBall].netUpdate = true; + } + + for (int i = 0; i < 50; i++) + { + int dustID; + switch (Main.rand.Next(6)) + { + case 0: + case 1: + case 2: + case 3: + dustID = (int)CalamityDusts.SulphurousSeaAcid; + break; + default: + dustID = DustID.Blood; + break; + } + + // Choose a random speed and angle to belch out the vomit + float dustSpeed = Main.rand.NextFloat(3.0f, 12.0f); + float angleRandom = 0.06f; + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(toothBallVelocity.ToRotation()); + dustVel = dustVel.RotatedBy(-angleRandom); + dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); + + // Pick a size for the vomit particles + float scale = Main.rand.NextFloat(1f, 2f); + + // Actually spawn the vomit + int idx = Dust.NewDust(toothBallSpawnPos, 40, 40, dustID, dustVel.X, dustVel.Y, 0, default, scale); + Main.dust[idx].noGravity = true; + } + } + + // Direction + int toothBallLookAt = Math.Sign(player.Center.X - NPC.Center.X); + if (toothBallLookAt != 0) + { + NPC.direction = toothBallLookAt; + if (NPC.spriteDirection != -NPC.direction) + NPC.rotation += MathHelper.Pi; + NPC.spriteDirection = -NPC.direction; + } + + NPC.ai[2] += 1f; + if (NPC.ai[2] >= toothBallBelchPhaseTimer) + { + calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.TargetClosest(); + NPC.netUpdate = true; + } + } + + // Call sharks from the sides of the screen + else if (NPC.ai[0] == 3f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + // Velocity + NPC.velocity *= 0.98f; + NPC.velocity.Y = MathHelper.Lerp(NPC.velocity.Y, 0f, 0.02f); + + // Play sound and spawn sharks + if (NPC.ai[2] == attackTimer - 30) + SoundEngine.PlaySound(VomitSound, NPC.Center); + + if (NPC.ai[2] >= attackTimer - 90) + { + if (NPC.ai[2] % 18f == 0f) + { + calamityGlobalNPC.newAI[2] += 100f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + 900f), (int)(NPC.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, NPC.whoAmI, 0f, 255); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X - 900f), (int)(NPC.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, NPC.whoAmI, 0f, 255); + + if (Main.getGoodWorld) + { + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + 1800f), (int)(NPC.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, NPC.whoAmI, 0f, 255); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X - 1800f), (int)(NPC.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, NPC.whoAmI, 0f, 255); + } + } + } + } + + NPC.ai[2] += 1f; + if (NPC.ai[2] >= attackTimer) + { + calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; + calamityGlobalNPC.newAI[2] = 0f; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.TargetClosest(); + NPC.netUpdate = true; + } + } + + // Transition to phase 2 and call sharks from below + else if (NPC.ai[0] == 4f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + // Velocity + NPC.velocity *= 0.98f; + NPC.velocity.Y = MathHelper.Lerp(NPC.velocity.Y, 0f, 0.02f); + + // Sound + if (NPC.ai[2] == phaseTransitionTimer - 60) + RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center); + + if (NPC.ai[2] >= phaseTransitionTimer - 60) + { + if (NPC.ai[2] % 18f == 0f) + { + calamityGlobalNPC.newAI[2] += 150f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + 50f + calamityGlobalNPC.newAI[2]), (int)(NPC.Center.Y + 540f), ModContent.NPCType(), 0, 0f, 0f, 1f, -sharkronVelocity, 255); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X - 50f - calamityGlobalNPC.newAI[2]), (int)(NPC.Center.Y + 540f), ModContent.NPCType(), 0, 0f, 0f, -1f, -sharkronVelocity, 255); + + if (Main.getGoodWorld) + { + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + 50f + calamityGlobalNPC.newAI[2] * 0.5f), (int)(NPC.Center.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, 1f, -sharkronVelocity, 255); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X - 50f - calamityGlobalNPC.newAI[2] * 0.5f), (int)(NPC.Center.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, -1f, -sharkronVelocity, 255); + } + } + } + } + + NPC.ai[2] += 1f; + if (NPC.ai[2] >= phaseTransitionTimer) + { + calamityGlobalNPC.newAI[0] = 0f; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + NPC.ai[0] = 5f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.TargetClosest(); + NPC.netUpdate = true; + } + } + + // Phase 2 + else if (NPC.ai[0] == 5f && !player.dead) + { + // Avoid cheap bullshit + NPC.damage = 0; + + // Velocity + if (NPC.ai[1] == 0f) + NPC.ai[1] = 500 * Math.Sign((NPC.Center - player.Center).X); + + Vector2 dukePhase2IdleSpeed = Vector2.Normalize(player.Center + new Vector2(NPC.ai[1], -300f) - NPC.Center - NPC.velocity) * idlePhaseVelocity; + NPC.SimpleFlyMovement(dukePhase2IdleSpeed, idlePhaseAcceleration); + + // Direction and rotation + int phase2FaceDirection = Math.Sign(player.Center.X - NPC.Center.X); + if (phase2FaceDirection != 0) + { + if (NPC.ai[2] == 0f && phase2FaceDirection != NPC.direction) + NPC.rotation += MathHelper.Pi; + + NPC.direction = phase2FaceDirection; + + if (NPC.spriteDirection != -NPC.direction) + NPC.rotation += MathHelper.Pi; + + NPC.spriteDirection = -NPC.direction; + } + + // Phase switch + if (calamityGlobalNPC.newAI[1] != 1f || (phase3 && !phase3AI)) + { + NPC.ai[2] += 1f; + if (NPC.ai[2] >= idlePhaseTimer || (phase3 && !phase3AI)) + { + int phase2AttackPicker = 0; + switch ((int)NPC.ai[3]) + { + case 0: + case 1: + case 2: + case 3: + phase2AttackPicker = 1; + break; + case 4: + NPC.ai[3] = 1f; + phase2AttackPicker = 2; + break; + case 5: + NPC.ai[3] = 0f; + phase2AttackPicker = 3; + break; + } + + if (phase3) + phase2AttackPicker = 4; + + // Set velocity for charge + if (phase2AttackPicker == 1) + { + NPC.ai[0] = 6f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + + // Velocity and rotation + Vector2 distanceVector = player.Center + player.velocity * 20f - NPC.Center; + NPC.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); + + // Direction + if (phase2FaceDirection != 0) + { + NPC.direction = phase2FaceDirection; + + if (NPC.spriteDirection == 1) + NPC.rotation += MathHelper.Pi; + + NPC.spriteDirection = -NPC.direction; + } + + DoChargeBurst(NPC, 1); + } + + // Set velocity for spin + else if (phase2AttackPicker == 2) + { + // Velocity and rotation + NPC.velocity = Vector2.Normalize(player.Center - NPC.Center) * spinAttackSpeed; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); + + // Direction + if (phase2FaceDirection != 0) + { + NPC.direction = phase2FaceDirection; + + if (NPC.spriteDirection == 1) + NPC.rotation += MathHelper.Pi; + + NPC.spriteDirection = -NPC.direction; + } + + NPC.ai[0] = 7f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + } + + else if (phase2AttackPicker == 3) + { + NPC.ai[0] = 8f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + } + + // Go to next phase + else if (phase2AttackPicker == 4) + { + NPC.ai[0] = 9f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + } + + NPC.netUpdate = true; + } + } + } + + // Charge + else if (NPC.ai[0] == 6f) + { + // Set damage + NPC.damage = setDamage; + + // The dumbest thing to ever exist + if (CalamityWorld.LegendaryMode && revenge && NPC.ai[2] % 8f == 0f) + { + // Rotation and direction + int dir = Math.Sign(player.Center.X - NPC.Center.X); + if (dir != 0) + { + if (NPC.ai[2] == 0f && dir != NPC.direction) + NPC.rotation += MathHelper.Pi; + + NPC.direction = dir; + + if (NPC.spriteDirection != -NPC.direction) + NPC.rotation += MathHelper.Pi; + + NPC.spriteDirection = -NPC.direction; + } + + Vector2 distanceVector = player.Center + player.velocity * 20f - NPC.Center; + NPC.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); + + // Direction + if (dir != 0) + { + NPC.direction = dir; + + if (NPC.spriteDirection == 1) + NPC.rotation += MathHelper.Pi; + + NPC.spriteDirection = -NPC.direction; + } + } + else + { + // Accelerate + NPC.velocity *= 1.01f; + } + + DoChargeVisual(NPC, Phase); + + NPC.ai[2] += 1f; + if (NPC.ai[2] >= chargeTime) + { + calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; + NPC.ai[0] = 5f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] += 2f; + NPC.TargetClosest(); + NPC.netUpdate = true; + } + } + + // Tooth Ball and Vortex spin + else if (NPC.ai[0] == 7f) + { + // Set damage + NPC.damage = 0; + + // Play sounds and spawn Tooth Balls and a Vortex + if (NPC.ai[2] == 0f) + { + RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center); + + SoundEngine.PlaySound(VortexSpawnSound, NPC.Center); + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + Vector2 vortexSpawn = NPC.Center + NPC.velocity.RotatedBy(MathHelper.PiOver2 * -NPC.direction) * spinTime / MathHelper.TwoPi; + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(NPC.GetSource_FromAI(), vortexSpawn, Vector2.Zero, type, damage, 0f, Main.myPlayer, vortexSpawn.X, vortexSpawn.Y); + } + + if (NPC.ai[2] % toothBallSpinPhaseDivisor == 0f) + { + if (NPC.ai[2] != 0f) + SoundEngine.PlaySound(VomitSound, NPC.Center); + + Vector2 phase2ToothBallDirection = Vector2.Normalize(NPC.velocity) * (NPC.width + 20) / 2f + NPC.Center; + Vector2 toothBallVelocity = Vector2.Normalize(NPC.velocity).RotatedBy(MathHelper.PiOver2 * NPC.direction) * toothBallSpinToothBallVelocity; + Vector2 toothBallSpawnPos = new Vector2(phase2ToothBallDirection.X, phase2ToothBallDirection.Y + 45f); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int toothBall = NPC.NewNPC(NPC.GetSource_FromAI(), (int)toothBallSpawnPos.X, (int)toothBallSpawnPos.Y, ModContent.NPCType(), 0, toothBallVelocity.X, toothBallVelocity.Y); + Main.npc[toothBall].target = NPC.target; + Main.npc[toothBall].velocity = Vector2.Normalize(toothBallVelocity) * toothBallSpinToothBallVelocity * 0.5f; + Main.npc[toothBall].netUpdate = true; + Main.npc[toothBall].ai[3] = 30f; + } + + for (int i = 0; i < 50; i++) + { + int dustID; + switch (Main.rand.Next(6)) + { + case 0: + case 1: + case 2: + case 3: + dustID = (int)CalamityDusts.SulphurousSeaAcid; + break; + default: + dustID = DustID.Blood; + break; + } + + // Choose a random speed and angle to belch out the vomit + float dustSpeed = Main.rand.NextFloat(3.0f, 12.0f); + float angleRandom = 0.06f; + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(toothBallVelocity.ToRotation()); + dustVel = dustVel.RotatedBy(-angleRandom); + dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); + + // Pick a size for the vomit particles + float scale = Main.rand.NextFloat(1f, 2f); + + // Actually spawn the vomit + int idx = Dust.NewDust(toothBallSpawnPos, 40, 40, dustID, dustVel.X, dustVel.Y, 0, default, scale); + Main.dust[idx].noGravity = true; + } + } + + // Velocity and rotation + NPC.velocity = NPC.velocity.RotatedBy(-(double)spinSpeed * (float)NPC.direction); + NPC.rotation -= spinSpeed * NPC.direction; + + NPC.ai[2] += 1f; + if (NPC.ai[2] >= toothBallSpinTimer) + { + calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; + NPC.ai[0] = 5f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.TargetClosest(); + NPC.netUpdate = true; + } + } + + // Vomit a huge amount of gore into the sky and call sharks from the sides of the screen + else if (NPC.ai[0] == 8f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + // Velocity + NPC.velocity *= 0.98f; + NPC.velocity.Y = MathHelper.Lerp(NPC.velocity.Y, 0f, 0.02f); + + // Play sound + if (NPC.ai[2] == attackTimer - 30) + { + SoundEngine.PlaySound(VomitSound, NPC.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 phase2GoreDirection = NPC.rotation.ToRotationVector2() * (Vector2.UnitX * NPC.direction) * (NPC.width + 20) / 2f + NPC.Center; + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + int totalGore = Main.getGoodWorld ? 40 : 20; + for (int i = 0; i < totalGore; i++) + { + float velocityX = NPC.direction * goreVelocityX * (Main.rand.NextFloat(0.2f, 0.8f) + 0.5f); + float velocityY = goreVelocityY * (Main.rand.NextFloat(0.2f, 0.8f) + 0.5f); + + if (Main.getGoodWorld) + { + velocityX *= Main.rand.NextFloat() + 0.5f; + velocityY *= Main.rand.NextFloat() + 0.5f; + } + + Projectile.NewProjectile(NPC.GetSource_FromAI(), phase2GoreDirection.X, phase2GoreDirection.Y, velocityX, -velocityY, type, damage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + + if (NPC.ai[2] >= attackTimer - 90) + { + if (NPC.ai[2] % 18f == 0f) + { + calamityGlobalNPC.newAI[2] += 100f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float x = 900f - calamityGlobalNPC.newAI[2]; + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + x), (int)(NPC.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, NPC.whoAmI, 0f, 255); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X - x), (int)(NPC.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, NPC.whoAmI, 0f, 255); + } + } + } + + NPC.ai[2] += 1f; + if (NPC.ai[2] >= attackTimer) + { + calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; + calamityGlobalNPC.newAI[2] = 0f; + NPC.ai[0] = 5f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.TargetClosest(); + NPC.netUpdate = true; + } + } + + // Transition to phase 3 and summon sharks from above + else if (NPC.ai[0] == 9f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + // Velocity + NPC.velocity *= 0.98f; + NPC.velocity.Y = MathHelper.Lerp(NPC.velocity.Y, 0f, 0.02f); + + // Sound + if (NPC.ai[2] == phaseTransitionTimer - 60) + RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center); + + if (NPC.ai[2] >= phaseTransitionTimer - 60) + { + if (NPC.ai[2] % 18f == 0f) + { + calamityGlobalNPC.newAI[2] += 200f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + 50f + calamityGlobalNPC.newAI[2]), (int)(NPC.Center.Y - 540f), ModContent.NPCType(), 0, 0f, 0f, 1f, sharkronVelocity, 255); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X - 50f - calamityGlobalNPC.newAI[2]), (int)(NPC.Center.Y - 540f), ModContent.NPCType(), 0, 0f, 0f, -1f, sharkronVelocity, 255); + + if (Main.getGoodWorld) + { + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + 50f + calamityGlobalNPC.newAI[2] * 0.5f), (int)(NPC.Center.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, 1f, -sharkronVelocity, 255); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X - 50f - calamityGlobalNPC.newAI[2] * 0.5f), (int)(NPC.Center.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, -1f, -sharkronVelocity, 255); + } + } + } + } + + NPC.ai[2] += 1f; + if (NPC.ai[2] >= phaseTransitionTimer) + { + calamityGlobalNPC.newAI[0] = 0f; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + NPC.ai[0] = 10f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.TargetClosest(); + NPC.netUpdate = true; + } + } + + // Phase 3 + else if (NPC.ai[0] == 10f && !player.dead) + { + // Avoid cheap bullshit + NPC.damage = 0; + + // Alpha + NPC.alpha -= 25; + if (NPC.alpha < 0) + NPC.alpha = 0; + + // Movement location + if (NPC.ai[1] == 0f) + NPC.ai[1] = 500 * Math.Sign((NPC.Center - player.Center).X); + + Vector2 desiredVelocity = Vector2.Normalize(player.Center + new Vector2(-NPC.ai[1], -300f) - NPC.Center - NPC.velocity) * idlePhaseVelocity; + NPC.SimpleFlyMovement(desiredVelocity, idlePhaseAcceleration); + + // Rotation and direction + int phase3FaceDirection = Math.Sign(player.Center.X - NPC.Center.X); + if (phase3FaceDirection != 0) + { + if (NPC.ai[2] == 0f && phase3FaceDirection != NPC.direction) + { + NPC.rotation += MathHelper.Pi; + for (int l = 0; l < NPC.oldPos.Length; l++) + NPC.oldPos[l] = Vector2.Zero; + } + + NPC.direction = phase3FaceDirection; + + if (NPC.spriteDirection != -NPC.direction) + NPC.rotation += MathHelper.Pi; + + NPC.spriteDirection = -NPC.direction; + } + + // Phase switch + if (calamityGlobalNPC.newAI[1] != 1f) + { + NPC.ai[2] += 1f; + if (NPC.ai[2] >= idlePhaseTimer) + { + int phase3AttackPicker = 0; + switch ((int)NPC.ai[3]) + { + case 0: + case 2: + case 3: + case 5: + case 6: + case 7: + phase3AttackPicker = 1; + break; + case 1: + case 8: + phase3AttackPicker = 2; + break; + case 4: + NPC.ai[3] = 1f; + phase3AttackPicker = 3; + break; + case 9: + NPC.ai[3] = 6f; + phase3AttackPicker = 4; + break; + } + + // Set velocity for charge + if (phase3AttackPicker == 1) + { + NPC.ai[0] = 11f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + + // Velocity and rotation + Vector2 distanceVector = player.Center + player.velocity * 20f - NPC.Center; + NPC.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); + + // Direction + if (phase3FaceDirection != 0) + { + NPC.direction = phase3FaceDirection; + + if (NPC.spriteDirection == 1) + NPC.rotation += MathHelper.Pi; + + NPC.spriteDirection = -NPC.direction; + } + + DoChargeBurst(NPC, 2); + } + + // Pause + else if (phase3AttackPicker == 2) + { + NPC.ai[0] = 12f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + } + + else if (phase3AttackPicker == 3) + { + NPC.ai[0] = 13f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + } + + // Set velocity for spin + else if (phase3AttackPicker == 4) + { + // Velocity and rotation + NPC.velocity = Vector2.Normalize(player.Center - NPC.Center) * spinAttackSpeed; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); + + // Direction + if (phase3FaceDirection != 0) + { + NPC.direction = phase3FaceDirection; + + if (NPC.spriteDirection == 1) + NPC.rotation += MathHelper.Pi; + + NPC.spriteDirection = -NPC.direction; + } + + NPC.ai[0] = 14f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + } + + NPC.netUpdate = true; + } + } + } + + // Charge + else if (NPC.ai[0] == 11f) + { + // Set damage + NPC.damage = setDamage; + + // The dumbest thing to ever exist + if (CalamityWorld.LegendaryMode && revenge && NPC.ai[2] % 6f == 0f) + { + // Rotation and direction + int dir = Math.Sign(player.Center.X - NPC.Center.X); + if (dir != 0) + { + if (NPC.ai[2] == 0f && dir != NPC.direction) + NPC.rotation += MathHelper.Pi; + + NPC.direction = dir; + + if (NPC.spriteDirection != -NPC.direction) + NPC.rotation += MathHelper.Pi; + + NPC.spriteDirection = -NPC.direction; + } + + Vector2 distanceVector = player.Center + player.velocity * 20f - NPC.Center; + NPC.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); + + // Direction + if (dir != 0) + { + NPC.direction = dir; + + if (NPC.spriteDirection == 1) + NPC.rotation += MathHelper.Pi; + + NPC.spriteDirection = -NPC.direction; + } + } + else + { + // Accelerate + NPC.velocity *= 1.01f; + } + + DoChargeVisual(NPC, Phase); + + NPC.ai[2] += 1f; + if (NPC.ai[2] >= chargeTime) + { + calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; + NPC.ai[0] = 10f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] += 2f; + NPC.TargetClosest(); + NPC.netUpdate = true; + } + } + + // Pause before teleport + else if (NPC.ai[0] == 12f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + // Alpha + if (NPC.alpha < 255 && NPC.ai[2] >= teleportPauseTimer - 15f) + { + NPC.alpha += 17; + if (NPC.alpha > 255) + NPC.alpha = 255; + } + + // Velocity + NPC.velocity *= 0.98f; + NPC.velocity.Y = MathHelper.Lerp(NPC.velocity.Y, 0f, 0.02f); + + // Play sound + if (NPC.ai[2] == teleportPauseTimer / 2) + RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.ai[2] == teleportPauseTimer - 1f) + { + // Teleport location + if (NPC.ai[1] == 0f) + NPC.ai[1] = 600 * Math.Sign((NPC.Center - player.Center).X); + + // Rotation and direction + Vector2 center = player.Center + new Vector2(NPC.ai[1], -300f); + Vector2 npcCenter = NPC.Center = center; + int phase3TeleportFaceDirection = Math.Sign(player.Center.X - npcCenter.X); + if (phase3TeleportFaceDirection != 0) + { + if (NPC.ai[2] == 0f && phase3TeleportFaceDirection != NPC.direction) + { + NPC.rotation += MathHelper.Pi; + for (int n = 0; n < NPC.oldPos.Length; n++) + NPC.oldPos[n] = Vector2.Zero; + } + + NPC.direction = phase3TeleportFaceDirection; + + if (NPC.spriteDirection != -NPC.direction) + NPC.rotation += MathHelper.Pi; + + NPC.spriteDirection = -NPC.direction; + } + } + + NPC.ai[2] += 1f; + if (NPC.ai[2] >= teleportPauseTimer) + { + NPC.ai[0] = 10f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + + NPC.ai[3] += 2f; + if (NPC.ai[3] >= 9f) + NPC.ai[3] = 0f; + + NPC.netUpdate = true; + } + } + + // Vomit a huge amount of gore into the sky and call sharks from the sides of the screen + else if (NPC.ai[0] == 13f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + // Velocity + NPC.velocity *= 0.98f; + NPC.velocity.Y = MathHelper.Lerp(NPC.velocity.Y, 0f, 0.02f); + + // Play sound + if (NPC.ai[2] == attackTimer - 30) + { + SoundEngine.PlaySound(VomitSound, NPC.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 phase3GoreDirection = NPC.rotation.ToRotationVector2() * (Vector2.UnitX * NPC.direction) * (NPC.width + 20) / 2f + NPC.Center; + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + int totalGore = Main.getGoodWorld ? 40 : 20; + for (int i = 0; i < totalGore; i++) + { + float velocityX = NPC.direction * goreVelocityX * (Main.rand.NextFloat(0.2f, 0.8f) + 0.5f); + float velocityY = goreVelocityY * (Main.rand.NextFloat(0.2f, 0.8f) + 0.5f); + + if (Main.getGoodWorld) + { + velocityX *= Main.rand.NextFloat() + 0.5f; + velocityY *= Main.rand.NextFloat() + 0.5f; + } + + Projectile.NewProjectile(NPC.GetSource_FromAI(), phase3GoreDirection.X, phase3GoreDirection.Y, velocityX, -velocityY, type, damage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + + if (NPC.ai[2] >= attackTimer - 90) + { + if (NPC.ai[2] % 18f == 0f) + { + calamityGlobalNPC.newAI[2] += 150f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float x = 900f - calamityGlobalNPC.newAI[2]; + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + x), (int)(NPC.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, NPC.whoAmI, 0f, 255); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X - x), (int)(NPC.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, NPC.whoAmI, 0f, 255); + + if (Main.getGoodWorld) + { + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + x), (int)(NPC.Center.Y - calamityGlobalNPC.newAI[2] * 0.5f), ModContent.NPCType(), 0, 0f, 0f, NPC.whoAmI, 0f, 255); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X - x), (int)(NPC.Center.Y - calamityGlobalNPC.newAI[2] * 0.5f), ModContent.NPCType(), 0, 0f, 0f, NPC.whoAmI, 0f, 255); + } + } + } + } + + NPC.ai[2] += 1f; + if (NPC.ai[2] >= attackTimer) + { + calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; + calamityGlobalNPC.newAI[2] = 0f; + NPC.ai[0] = 10f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.TargetClosest(); + NPC.netUpdate = true; + } + } + + // Tooth Ball and Vortex spin + else if (NPC.ai[0] == 14f) + { + // Set damage + NPC.damage = 0; + + // Play sounds and spawn Tooth Balls and a Vortex + if (NPC.ai[2] == 0f) + { + RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center); + + SoundEngine.PlaySound(VortexSpawnSound, NPC.Center); + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + Vector2 vortexSpawn = NPC.Center + NPC.velocity.RotatedBy(MathHelper.PiOver2 * -NPC.direction) * spinTime / MathHelper.TwoPi; + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(NPC.GetSource_FromAI(), vortexSpawn, Vector2.Zero, type, damage, 0f, Main.myPlayer, vortexSpawn.X, vortexSpawn.Y); + } + + if (NPC.ai[2] % toothBallSpinPhaseDivisor == 0f) + { + if (NPC.ai[2] != 0f) + SoundEngine.PlaySound(VomitSound, NPC.Center); + + Vector2 phase3ToothBallDirection = Vector2.Normalize(NPC.velocity) * (NPC.width + 20) / 2f + NPC.Center; + Vector2 toothBallVelocity = Vector2.Normalize(NPC.velocity).RotatedBy(MathHelper.PiOver2 * NPC.direction) * toothBallSpinToothBallVelocity; + Vector2 toothBallSpawnPos = new Vector2(phase3ToothBallDirection.X, phase3ToothBallDirection.Y + 45f); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int toothBall = NPC.NewNPC(NPC.GetSource_FromAI(), (int)toothBallSpawnPos.X, (int)toothBallSpawnPos.Y, ModContent.NPCType(), 0, toothBallVelocity.X, toothBallVelocity.Y); + Main.npc[toothBall].target = NPC.target; + Main.npc[toothBall].velocity = Vector2.Normalize(toothBallVelocity) * toothBallSpinToothBallVelocity * 0.5f; + Main.npc[toothBall].netUpdate = true; + Main.npc[toothBall].ai[3] = 60f; + } + + for (int i = 0; i < 50; i++) + { + int dustID; + switch (Main.rand.Next(6)) + { + case 0: + case 1: + case 2: + case 3: + dustID = (int)CalamityDusts.SulphurousSeaAcid; + break; + default: + dustID = DustID.Blood; + break; + } + + // Choose a random speed and angle to belch out the vomit + float dustSpeed = Main.rand.NextFloat(3.0f, 12.0f); + float angleRandom = 0.06f; + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(toothBallVelocity.ToRotation()); + dustVel = dustVel.RotatedBy(-angleRandom); + dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); + + // Pick a size for the vomit particles + float scale = Main.rand.NextFloat(1f, 2f); + + // Actually spawn the vomit + int idx = Dust.NewDust(toothBallSpawnPos, 40, 40, dustID, dustVel.X, dustVel.Y, 0, default, scale); + Main.dust[idx].noGravity = true; + } + } + + // Velocity and rotation + NPC.velocity = NPC.velocity.RotatedBy(-(double)spinSpeed * NPC.direction); + NPC.rotation -= spinSpeed * NPC.direction; + + NPC.ai[2] += 1f; + if (NPC.ai[2] >= toothBallSpinTimer) + { + calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; + NPC.ai[0] = 10f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.TargetClosest(); + NPC.netUpdate = true; + } + } + + if (SoundEngine.TryGetActiveSound(RoarSoundSlot, out var roarSound) && roarSound.IsPlaying) + roarSound.Position = NPC.Center; } public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index bf97d47107..a9f4887dc0 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -3180,10 +3180,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas { for (int x = 0; x < 5; x++) { - NPC.NewNPC(NPC.GetSource_FromAI(), spawnX + 50, tempSpawnY, ModContent.NPCType()); + NPC.NewNPC(NPC.GetSource_FromAI(), spawnX + 50, tempSpawnY, ModContent.NPCType()); spawnX += spawnXAdd; - NPC.NewNPC(NPC.GetSource_FromAI(), spawnX2 - 50, tempSpawnY, ModContent.NPCType()); + NPC.NewNPC(NPC.GetSource_FromAI(), spawnX2 - 50, tempSpawnY, ModContent.NPCType()); spawnX2 -= spawnXAdd; tempSpawnY += spawnYAdd; } diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index 12220297eb..2fa1d38708 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -2026,8 +2026,8 @@ namespace CalamityMod.NPCs.Yharon { if (CalamityWorld.LegendaryMode && revenge) { - if (!NPC.AnyNPCs(ModContent.NPCType())) - NPC.SpawnOnPlayer(NPC.FindClosestPlayer(), ModContent.NPCType()); + if (!NPC.AnyNPCs(ModContent.NPCType())) + NPC.SpawnOnPlayer(NPC.FindClosestPlayer(), ModContent.NPCType()); } float bulletHellTeleportLocationDistance = 540f; diff --git a/Projectiles/Boss/BirbAuraFlare.cs b/Projectiles/Boss/BirbAuraFlare.cs index cb17ddd3fd..9c8cf55d24 100644 --- a/Projectiles/Boss/BirbAuraFlare.cs +++ b/Projectiles/Boss/BirbAuraFlare.cs @@ -114,7 +114,7 @@ namespace CalamityMod.Projectiles.Boss float y = projTileX * 16 + 900; Vector2 laserVelocity = new Vector2(x, 160f) - new Vector2(x, y); int type = ModContent.ProjectileType(); - int damage = Projectile.GetProjectileDamage(ModContent.NPCType()); + int damage = Projectile.GetProjectileDamage(ModContent.NPCType()); if (Projectile.ai[0] >= 2f) { x += 1000f; diff --git a/Scenes/MusicScenes/DragonfollyMusicScene.cs b/Scenes/MusicScenes/DragonfollyMusicScene.cs index b005c124a8..ae42983e18 100644 --- a/Scenes/MusicScenes/DragonfollyMusicScene.cs +++ b/Scenes/MusicScenes/DragonfollyMusicScene.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Systems { public override SceneEffectPriority Priority => SceneEffectPriority.BossMedium; - public override int NPCType => ModContent.NPCType(); + public override int NPCType => ModContent.NPCType(); public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("Dragonfolly"); public override int VanillaMusic => MusicID.Boss4; public override int OtherworldMusic => MusicID.OtherworldlyBoss2; diff --git a/Systems/Collections/NPCs/BossHPScalingList.cs b/Systems/Collections/NPCs/BossHPScalingList.cs index 5912dbbc55..8527fc2b5e 100644 --- a/Systems/Collections/NPCs/BossHPScalingList.cs +++ b/Systems/Collections/NPCs/BossHPScalingList.cs @@ -80,7 +80,7 @@ namespace CalamityMod.Systems.Collections NPCType(), NPCType(), NPCType(), - NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), diff --git a/Systems/Collections/NPCs/BossTypeDict.cs b/Systems/Collections/NPCs/BossTypeDict.cs index 20ddc6d87e..c04456463f 100644 --- a/Systems/Collections/NPCs/BossTypeDict.cs +++ b/Systems/Collections/NPCs/BossTypeDict.cs @@ -78,7 +78,7 @@ namespace CalamityMod.Systems.Collections { NPCType(), 28 }, { NPCID.MoonLordCore, 29 }, { NPCType(), 30 }, - { NPCType(), 31 }, + { NPCType(), 31 }, { NPCType(), 32 }, { NPCType(), 33 }, { NPCType(), 34 }, diff --git a/Systems/Collections/NPCs/EnemyImmunitiesList.cs b/Systems/Collections/NPCs/EnemyImmunitiesList.cs index 60d1d76aa7..f6f625b1d2 100644 --- a/Systems/Collections/NPCs/EnemyImmunitiesList.cs +++ b/Systems/Collections/NPCs/EnemyImmunitiesList.cs @@ -162,7 +162,7 @@ namespace CalamityMod.Systems.Collections NPCType(), NPCType(), NPCType(), - NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), diff --git a/Tiles/MonsterBanner.cs b/Tiles/MonsterBanner.cs index a62018f05a..7ec43cdd31 100644 --- a/Tiles/MonsterBanner.cs +++ b/Tiles/MonsterBanner.cs @@ -108,7 +108,7 @@ namespace CalamityMod.Tiles npc = NPCType(); break; case 11: - npc = NPCType(); // There's also the boss variant but I dont think we want banners to affect them? + npc = NPCType(); // There's also the boss variant but I dont think we want banners to affect them? break; /*case 12: npc = NPCType(); - Formerly Sea Urchin diff --git a/UI/SpeedrunTimerUI.cs b/UI/SpeedrunTimerUI.cs index 19eb113455..5e7d334499 100644 --- a/UI/SpeedrunTimerUI.cs +++ b/UI/SpeedrunTimerUI.cs @@ -118,7 +118,7 @@ namespace CalamityMod.UI 28 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]].Value, 29 => TextureAssets.NpcHeadBoss[8].Value, // Moon Lord 30 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]].Value, - 31 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]].Value, + 31 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]].Value, 32 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]].Value, 33 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]].Value, 34 => ModContent.Request("CalamityMod/NPCs/StormWeaver/StormWeaverHeadNaked_Head_Boss").Value, diff --git a/Utilities/NPCDebuffs.cs b/Utilities/NPCDebuffs.cs index cdea134597..9f0f06c931 100644 --- a/Utilities/NPCDebuffs.cs +++ b/Utilities/NPCDebuffs.cs @@ -249,9 +249,9 @@ namespace CalamityMod { ModContent.NPCType(), holy }, { ModContent.NPCType(), holy }, - { ModContent.NPCType(), new(GeneralImmunityStatus.None, new int[] { ModContent.BuffType() }) }, - { ModContent.NPCType(), new(GeneralImmunityStatus.None, new int[] { ModContent.BuffType() }) }, - { ModContent.NPCType(), new(GeneralImmunityStatus.None, new int[] { ModContent.BuffType() }) }, + { ModContent.NPCType(), new(GeneralImmunityStatus.None, new int[] { ModContent.BuffType() }) }, + { ModContent.NPCType(), new(GeneralImmunityStatus.None, new int[] { ModContent.BuffType() }) }, + { ModContent.NPCType(), new(GeneralImmunityStatus.None, new int[] { ModContent.BuffType() }) }, { ModContent.NPCType(), holy }, { ModContent.NPCType(), holy }, From 21fc78b5b63c938092ebcf1721d0152e5f9627ef Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Fri, 6 Jun 2025 15:19:36 -0400 Subject: [PATCH 37/47] Moved Aquatic Scourge and Astrum Deus AIs from CalamityAIs to files Deleted the CalamityAIs folder, and moved CalamityRegularEnemyAI into the NormalNPCs folder --- NPCs/Abyss/Laserfish.cs | 2 +- NPCs/Abyss/MorayEel.cs | 2 +- NPCs/Abyss/ToxicMinnow.cs | 2 +- NPCs/Abyss/Viperfish.cs | 2 +- NPCs/AquaticScourge/AquaticScourgeBody.cs | 249 ++++- NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs | 221 ++++- NPCs/AquaticScourge/AquaticScourgeHead.cs | 468 ++++++++- NPCs/AquaticScourge/AquaticScourgeTail.cs | 219 ++++- NPCs/AstrumDeus/AstrumDeusBody.cs | 333 ++++++- NPCs/AstrumDeus/AstrumDeusHead.cs | 657 ++++++++++++- NPCs/AstrumDeus/AstrumDeusTail.cs | 226 ++++- NPCs/BrimstoneElemental/BrimstoneElemental.cs | 1 - NPCs/Bumblebirb/DraconicSwarmer.cs | 3 +- .../CalamityBossAIs/AquaticScourgeAI.cs | 628 ------------ .../CalamityBossAIs/AstrumDeusAI.cs | 915 ------------------ NPCs/Crags/DespairStone.cs | 2 +- NPCs/NormalNPCs/Bohldohr.cs | 1 - .../CalamityRegularEnemyAI.cs | 257 +++-- NPCs/NormalNPCs/CrawlerAmber.cs | 1 - NPCs/NormalNPCs/CrawlerAmethyst.cs | 1 - NPCs/NormalNPCs/CrawlerCrystal.cs | 1 - NPCs/NormalNPCs/CrawlerDiamond.cs | 1 - NPCs/NormalNPCs/CrawlerEmerald.cs | 1 - NPCs/NormalNPCs/CrawlerRuby.cs | 1 - NPCs/NormalNPCs/CrawlerSapphire.cs | 1 - NPCs/NormalNPCs/CrawlerTopaz.cs | 1 - NPCs/NormalNPCs/Cryon.cs | 1 - NPCs/NormalNPCs/Frogfish.cs | 1 - NPCs/NormalNPCs/PhantomSpirit.cs | 1 - NPCs/NormalNPCs/PhantomSpiritL.cs | 1 - NPCs/NormalNPCs/PhantomSpiritM.cs | 1 - NPCs/NormalNPCs/PhantomSpiritS.cs | 1 - NPCs/NormalNPCs/Rimehound.cs | 1 - NPCs/NormalNPCs/WildBumblebirb.cs | 1 - NPCs/Signus/CosmicLantern.cs | 2 +- NPCs/SulphurousSea/Gnasher.cs | 2 +- NPCs/SulphurousSea/Sulflounder.cs | 2 +- NPCs/SulphurousSea/Toxicatfish.cs | 2 +- NPCs/SunkenSea/AlphaSeaMinnow.cs | 1 - NPCs/SunkenSea/PodobooKoi.cs | 1 - NPCs/SunkenSea/SeaMinnow.cs | 2 +- 41 files changed, 2481 insertions(+), 1735 deletions(-) delete mode 100644 NPCs/CalamityAIs/CalamityBossAIs/AquaticScourgeAI.cs delete mode 100644 NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs rename NPCs/{CalamityAIs/CalamityRegularEnemyAIs => NormalNPCs}/CalamityRegularEnemyAI.cs (65%) diff --git a/NPCs/Abyss/Laserfish.cs b/NPCs/Abyss/Laserfish.cs index e15e91f222..04906775dd 100644 --- a/NPCs/Abyss/Laserfish.cs +++ b/NPCs/Abyss/Laserfish.cs @@ -2,7 +2,7 @@ using CalamityMod.BiomeManagers; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; +using CalamityMod.NPCs.NormalNPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; diff --git a/NPCs/Abyss/MorayEel.cs b/NPCs/Abyss/MorayEel.cs index 69c7dc7c72..4cbaa373e4 100644 --- a/NPCs/Abyss/MorayEel.cs +++ b/NPCs/Abyss/MorayEel.cs @@ -2,7 +2,7 @@ using CalamityMod.BiomeManagers; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Melee; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; +using CalamityMod.NPCs.NormalNPCs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; diff --git a/NPCs/Abyss/ToxicMinnow.cs b/NPCs/Abyss/ToxicMinnow.cs index 3fbf5c0ef8..5f54401431 100644 --- a/NPCs/Abyss/ToxicMinnow.cs +++ b/NPCs/Abyss/ToxicMinnow.cs @@ -3,7 +3,7 @@ using System.IO; using CalamityMod.BiomeManagers; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; +using CalamityMod.NPCs.NormalNPCs; using CalamityMod.Projectiles.Enemy; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; diff --git a/NPCs/Abyss/Viperfish.cs b/NPCs/Abyss/Viperfish.cs index 2fed796aaa..8e5d0c06e6 100644 --- a/NPCs/Abyss/Viperfish.cs +++ b/NPCs/Abyss/Viperfish.cs @@ -4,7 +4,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Melee; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; +using CalamityMod.NPCs.NormalNPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; diff --git a/NPCs/AquaticScourge/AquaticScourgeBody.cs b/NPCs/AquaticScourge/AquaticScourgeBody.cs index b0db3298e4..c7a580569b 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBody.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBody.cs @@ -1,15 +1,19 @@ using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; -using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; +using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.NPCs.AquaticScourge { @@ -89,7 +93,248 @@ namespace CalamityMod.NPCs.AquaticScourge public override void AI() { - AquaticScourgeAI.VanillaAquaticScourgeAI(NPC, Mod, false); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + bool bossRush = BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool death = CalamityWorld.death || bossRush; + + bool getFuckedAI = Main.zenithWorld; + + // Adjust hostility and stats + bool nonHostile = calamityGlobalNPC.newAI[0] == 0f; + if (NPC.justHit || NPC.life <= NPC.lifeMax * 0.999 || bossRush || Main.getGoodWorld) + { + if (nonHostile) + { + // Kiss my motherfucking ass you piece of shit game + NPC.timeLeft *= 20; + NPC.npcSlots = 16f; + CalamityGlobalNPC.BossKillTimes.TryGetValue(NPC.type, out int revKillTime); + calamityGlobalNPC.KillTime = revKillTime; + calamityGlobalNPC.newAI[0] = 1f; + nonHostile = false; + NPC.chaseable = true; + NPC.netUpdate = true; + } + } + else + NPC.damage = 0; + + // Percent life remaining + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + // Phases + bool phase2 = lifeRatio < 0.75f; + bool phase3 = lifeRatio < 0.5f; + bool phase4 = lifeRatio < 0.25f; + + // Set worm variable + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; + if (NPC.life > Main.npc[(int)NPC.ai[1]].life) + NPC.life = Main.npc[(int)NPC.ai[1]].life; + + // Get a target + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); + + Player player = Main.player[NPC.target]; + + bool notOcean = player.position.Y < 300f || + player.position.Y > Main.worldSurface * 16.0 || + (player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680)); + + // Check for the flipped Abyss + if (Main.remixWorld) + { + notOcean = player.position.Y < Main.UnderworldLayer * 0.8f || player.position.Y > Main.UnderworldLayer || + (player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680)); + } + + bool biomeEnraged = NPC.localAI[2] <= 0f || bossRush; + float enrageScale = bossRush ? 1f : 0f; + if (biomeEnraged) + { + NPC.Calamity().CurrentlyEnraged = !bossRush; + enrageScale += 2f; + } + + // Adjust slowing debuff immunity + bool immuneToSlowingDebuffs = getFuckedAI; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; + NPC.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; + + // Fire teeth + if (calamityGlobalNPC.newAI[0] == 1f && (!phase3 || phase4)) + { + NPC.localAI[0] += 1f; + float shootProjectile = 300; + float timer = NPC.ai[0] + 15f; + float divisor = timer + shootProjectile; + + if (NPC.localAI[0] % divisor == 0f && (NPC.ai[0] % 3f == 0f || getFuckedAI || !death)) + { + NPC.TargetClosest(); + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) + { + SoundEngine.PlaySound(SoundID.Item17, NPC.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float toothVelocity = death ? 9f : 8f; + Vector2 projectileVelocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY); + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + float accelerate = phase4 ? 1f : 0f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + projectileVelocity * 5f, projectileVelocity * toothVelocity, type, damage, 0f, Main.myPlayer, accelerate, 0f); + } + + NPC.netUpdate = true; + } + } + } + + // Kill body and tail + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (NPC.ai[1] <= 0f) + shouldDespawn = true; + else if (Main.npc[(int)NPC.ai[1]].life <= 0) + shouldDespawn = true; + } + if (shouldDespawn) + { + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; + } + + float maxDistance = calamityGlobalNPC.newAI[0] == 1f ? 12800f : 6400f; + if (player.dead || Vector2.Distance(NPC.Center, player.Center) > maxDistance || (nonHostile && biomeEnraged)) + { + calamityGlobalNPC.newAI[1] = 1f; + NPC.TargetClosest(false); + NPC.velocity.Y += 2f; + + if (NPC.position.Y > Main.worldSurface * 16D) + NPC.velocity.Y += 2f; + + if (NPC.position.Y > Main.worldSurface * 16D) + { + for (int a = 0; a < Main.npc.Length; a++) + { + int type = Main.npc[a].type; + if (AquaticScourgeIDList.Includes(type)) + Main.npc[a].active = false; + } + } + } + else + calamityGlobalNPC.newAI[1] = 0f; + + // Change direction + if (NPC.velocity.X < 0f) + NPC.spriteDirection = -1; + else if (NPC.velocity.X > 0f) + NPC.spriteDirection = 1; + + // Alpha changes + if (Main.npc[(int)NPC.ai[1]].alpha < 128) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } + + Vector2 scourgePosition = NPC.Center; + Vector2 predictionVector = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? Main.player[NPC.target].velocity * 20f : Vector2.Zero; + float scourgeTargetX = player.Center.X + predictionVector.X; + float scourgeTargetY = player.Center.Y + predictionVector.Y; + + // Velocity and movement + float scourgeMaxSpeed = 5f; + if (calamityGlobalNPC.newAI[0] == 1f) + { + scourgeMaxSpeed = revenge ? 14.4f : 12f; + if (expertMode) + scourgeMaxSpeed += 2.4f * (1f - lifeRatio); + scourgeMaxSpeed += 3f * enrageScale; + if (death || getFuckedAI) + { + scourgeMaxSpeed += 5f; + scourgeMaxSpeed += Vector2.Distance(player.Center, NPC.Center) * 0.001f; + } + + if (Main.getGoodWorld) + scourgeMaxSpeed *= 1.15f; + } + + scourgeTargetX = (int)(scourgeTargetX / 16f) * 16; + scourgeTargetY = (int)(scourgeTargetY / 16f) * 16; + scourgePosition.X = (int)(scourgePosition.X / 16f) * 16; + scourgePosition.Y = (int)(scourgePosition.Y / 16f) * 16; + scourgeTargetX -= scourgePosition.X; + scourgeTargetY -= scourgePosition.Y; + + if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) + { + try + { + scourgePosition = NPC.Center; + scourgeTargetX = Main.npc[(int)NPC.ai[1]].Center.X - scourgePosition.X; + scourgeTargetY = Main.npc[(int)NPC.ai[1]].Center.Y - scourgePosition.Y; + } + catch + { + } + + NPC.rotation = (float)Math.Atan2(scourgeTargetY, scourgeTargetX) + MathHelper.PiOver2; + float scourgeTargetDist = (float)Math.Sqrt(scourgeTargetX * scourgeTargetX + scourgeTargetY * scourgeTargetY); + int scourgeWidth = NPC.width; + scourgeTargetDist = (scourgeTargetDist - scourgeWidth) / scourgeTargetDist; + scourgeTargetX *= scourgeTargetDist; + scourgeTargetY *= scourgeTargetDist; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + scourgeTargetX; + NPC.position.Y = NPC.position.Y + scourgeTargetY; + + if (scourgeTargetX < 0f) + NPC.spriteDirection = -1; + else if (scourgeTargetX > 0f) + NPC.spriteDirection = 1; + } + + // Calculate contact damage based on velocity + if (!nonHostile) + { + float minimalContactDamageVelocity = scourgeMaxSpeed * 0.25f; + float minimalDamageVelocity = scourgeMaxSpeed * 0.5f; + float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageVelocity) + NPC.damage = 0; + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); + } + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) diff --git a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs index ae65703e57..66ec3f5969 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs @@ -1,11 +1,15 @@ -using System.IO; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; -using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; +using CalamityMod.Projectiles.Boss; +using CalamityMod.Systems.Collections; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.ID; using Terraria.Localization; @@ -88,7 +92,218 @@ namespace CalamityMod.NPCs.AquaticScourge public override void AI() { - AquaticScourgeAI.VanillaAquaticScourgeAI(NPC, Mod, false); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + bool bossRush = BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool death = CalamityWorld.death || bossRush; + + bool getFuckedAI = Main.zenithWorld; + + // Adjust hostility and stats + bool nonHostile = calamityGlobalNPC.newAI[0] == 0f; + if (NPC.justHit || NPC.life <= NPC.lifeMax * 0.999 || bossRush || Main.getGoodWorld) + { + if (nonHostile) + { + // Kiss my motherfucking ass you piece of shit game + NPC.timeLeft *= 20; + NPC.npcSlots = 16f; + CalamityGlobalNPC.BossKillTimes.TryGetValue(NPC.type, out int revKillTime); + calamityGlobalNPC.KillTime = revKillTime; + calamityGlobalNPC.newAI[0] = 1f; + nonHostile = false; + NPC.chaseable = true; + NPC.netUpdate = true; + } + } + else + NPC.damage = 0; + + // Percent life remaining + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + // Phases + bool phase2 = lifeRatio < 0.75f; + bool phase3 = lifeRatio < 0.5f; + bool phase4 = lifeRatio < 0.25f; + + // Set worm variable + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; + if (NPC.life > Main.npc[(int)NPC.ai[1]].life) + NPC.life = Main.npc[(int)NPC.ai[1]].life; + + // Get a target + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); + + Player player = Main.player[NPC.target]; + + bool notOcean = player.position.Y < 300f || + player.position.Y > Main.worldSurface * 16.0 || + (player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680)); + + // Check for the flipped Abyss + if (Main.remixWorld) + { + notOcean = player.position.Y < Main.UnderworldLayer * 0.8f || player.position.Y > Main.UnderworldLayer || + (player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680)); + } + + bool biomeEnraged = NPC.localAI[2] <= 0f || bossRush; + float enrageScale = bossRush ? 1f : 0f; + if (biomeEnraged) + { + NPC.Calamity().CurrentlyEnraged = !bossRush; + enrageScale += 2f; + } + + // Adjust slowing debuff immunity + bool immuneToSlowingDebuffs = getFuckedAI; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; + NPC.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; + + // Kill body and tail + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (NPC.ai[1] <= 0f) + shouldDespawn = true; + else if (Main.npc[(int)NPC.ai[1]].life <= 0) + shouldDespawn = true; + } + if (shouldDespawn) + { + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; + } + + float maxDistance = calamityGlobalNPC.newAI[0] == 1f ? 12800f : 6400f; + if (player.dead || Vector2.Distance(NPC.Center, player.Center) > maxDistance || (nonHostile && biomeEnraged)) + { + calamityGlobalNPC.newAI[1] = 1f; + NPC.TargetClosest(false); + NPC.velocity.Y += 2f; + + if (NPC.position.Y > Main.worldSurface * 16D) + NPC.velocity.Y += 2f; + + if (NPC.position.Y > Main.worldSurface * 16D) + { + for (int a = 0; a < Main.npc.Length; a++) + { + int type = Main.npc[a].type; + if (AquaticScourgeIDList.Includes(type)) + Main.npc[a].active = false; + } + } + } + else + calamityGlobalNPC.newAI[1] = 0f; + + // Change direction + if (NPC.velocity.X < 0f) + NPC.spriteDirection = -1; + else if (NPC.velocity.X > 0f) + NPC.spriteDirection = 1; + + // Alpha changes + if (Main.npc[(int)NPC.ai[1]].alpha < 128) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } + + Vector2 scourgePosition = NPC.Center; + Vector2 predictionVector = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? Main.player[NPC.target].velocity * 20f : Vector2.Zero; + float scourgeTargetX = player.Center.X + predictionVector.X; + float scourgeTargetY = player.Center.Y + predictionVector.Y; + + // Velocity and movement + float scourgeMaxSpeed = 5f; + if (calamityGlobalNPC.newAI[0] == 1f) + { + scourgeMaxSpeed = revenge ? 14.4f : 12f; + if (expertMode) + scourgeMaxSpeed += 2.4f * (1f - lifeRatio); + scourgeMaxSpeed += 3f * enrageScale; + if (death || getFuckedAI) + { + scourgeMaxSpeed += 5f; + scourgeMaxSpeed += Vector2.Distance(player.Center, NPC.Center) * 0.001f; + } + + if (Main.getGoodWorld) + scourgeMaxSpeed *= 1.15f; + } + + scourgeTargetX = (int)(scourgeTargetX / 16f) * 16; + scourgeTargetY = (int)(scourgeTargetY / 16f) * 16; + scourgePosition.X = (int)(scourgePosition.X / 16f) * 16; + scourgePosition.Y = (int)(scourgePosition.Y / 16f) * 16; + scourgeTargetX -= scourgePosition.X; + scourgeTargetY -= scourgePosition.Y; + + if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) + { + try + { + scourgePosition = NPC.Center; + scourgeTargetX = Main.npc[(int)NPC.ai[1]].Center.X - scourgePosition.X; + scourgeTargetY = Main.npc[(int)NPC.ai[1]].Center.Y - scourgePosition.Y; + } + catch + { + } + + NPC.rotation = (float)Math.Atan2(scourgeTargetY, scourgeTargetX) + MathHelper.PiOver2; + float scourgeTargetDist = (float)Math.Sqrt(scourgeTargetX * scourgeTargetX + scourgeTargetY * scourgeTargetY); + int scourgeWidth = NPC.width; + scourgeTargetDist = (scourgeTargetDist - scourgeWidth) / scourgeTargetDist; + scourgeTargetX *= scourgeTargetDist; + scourgeTargetY *= scourgeTargetDist; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + scourgeTargetX; + NPC.position.Y = NPC.position.Y + scourgeTargetY; + + if (scourgeTargetX < 0f) + NPC.spriteDirection = -1; + else if (scourgeTargetX > 0f) + NPC.spriteDirection = 1; + } + + // Calculate contact damage based on velocity + if (!nonHostile) + { + float minimalContactDamageVelocity = scourgeMaxSpeed * 0.25f; + float minimalDamageVelocity = scourgeMaxSpeed * 0.5f; + float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageVelocity) + NPC.damage = 0; + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); + } + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) diff --git a/NPCs/AquaticScourge/AquaticScourgeHead.cs b/NPCs/AquaticScourge/AquaticScourgeHead.cs index 4acad4c1dc..bb2ce5cee8 100644 --- a/NPCs/AquaticScourge/AquaticScourgeHead.cs +++ b/NPCs/AquaticScourge/AquaticScourgeHead.cs @@ -1,5 +1,6 @@ using System.IO; using CalamityMod.BiomeManagers; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; using CalamityMod.Items.Accessories; @@ -16,13 +17,13 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; -using CalamityMod.NPCs.Abyss; using CalamityMod.NPCs.AcidRain; -using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; -using CalamityMod.NPCs.TownNPCs; +using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.Enemy; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -30,6 +31,7 @@ using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.NPCs.AquaticScourge { @@ -131,7 +133,465 @@ namespace CalamityMod.NPCs.AquaticScourge public override void AI() { - AquaticScourgeAI.VanillaAquaticScourgeAI(NPC, Mod, true); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + bool bossRush = BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool death = CalamityWorld.death || bossRush; + + bool getFuckedAI = Main.zenithWorld; + CalamityGlobalNPC.aquaticScourge = NPC.whoAmI; + + // Adjust hostility and stats + bool nonHostile = calamityGlobalNPC.newAI[0] == 0f; + if (NPC.justHit || NPC.life <= NPC.lifeMax * 0.999 || bossRush || Main.getGoodWorld) + { + if (nonHostile) + { + // Kiss my motherfucking ass you piece of shit game + NPC.timeLeft *= 20; + NPC.npcSlots = 16f; + CalamityGlobalNPC.BossKillTimes.TryGetValue(NPC.type, out int revKillTime); + calamityGlobalNPC.KillTime = revKillTime; + calamityGlobalNPC.newAI[0] = 1f; + nonHostile = false; + NPC.boss = true; + NPC.chaseable = true; + NPC.netUpdate = true; + } + } + else + NPC.damage = 0; + + // Percent life remaining + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + // Phases + bool phase2 = lifeRatio < 0.75f; + bool phase3 = lifeRatio < 0.5f; + bool phase4 = lifeRatio < 0.25f; + + // Set worm variable + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; + + // Get a target + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); + + Player player = Main.player[NPC.target]; + + bool notOcean = player.position.Y < 300f || + player.position.Y > Main.worldSurface * 16.0 || + (player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680)); + + // Check for the flipped Abyss + if (Main.remixWorld) + { + notOcean = player.position.Y < Main.UnderworldLayer * 0.8f || player.position.Y > Main.UnderworldLayer || + (player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680)); + } + + // Enrage + if (notOcean && !player.Calamity().ZoneSulphur && !bossRush) + { + if (NPC.localAI[2] > 0f) + NPC.localAI[2] -= 1f; + } + else + NPC.localAI[2] = CalamityGlobalNPC.biomeEnrageTimerMax; + + bool biomeEnraged = NPC.localAI[2] <= 0f || bossRush; + + float enrageScale = bossRush ? 1f : 0f; + if (biomeEnraged) + { + NPC.Calamity().CurrentlyEnraged = !bossRush; + enrageScale += 2f; + } + + // Circular movement + float colorFadeTimeAfterSpiral = 90f; + float spiralGateValue = 480f; + bool doSpiral = false; + if (calamityGlobalNPC.newAI[0] == 1f && calamityGlobalNPC.newAI[2] == 1f && (revenge || getFuckedAI)) + { + doSpiral = calamityGlobalNPC.newAI[1] == 0f && calamityGlobalNPC.newAI[3] >= spiralGateValue; + if (Vector2.Distance(NPC.Center, player.Center) < (getFuckedAI ? 1600f : 1000f) || doSpiral) + calamityGlobalNPC.newAI[3] += 1f; + + if (doSpiral) + { + NPC.localAI[3] = colorFadeTimeAfterSpiral; + + // Vomit acid mist + float acidMistBarfDivisor = getFuckedAI ? 2f : ((float)Math.Floor(bossRush ? 4f : death ? 5f : 6f) * (phase3 ? 1.5f : 1f)); + if (calamityGlobalNPC.newAI[3] % acidMistBarfDivisor == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float mistVelocity = death ? 10f : 8f; + Vector2 projectileVelocity = (NPC.Center + NPC.velocity * 10f - NPC.Center).SafeNormalize(Vector2.UnitY); + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + projectileVelocity * 5f, projectileVelocity * mistVelocity, type, damage, 0f, Main.myPlayer); + Main.projectile[proj].tileCollide = false; + Main.projectile[proj].timeLeft = getFuckedAI ? 240 : 600; + } + } + + // Vomit circular spreads of acid clouds while in phase 3 + float toxicCloudBarfDivisor = bossRush ? 20f : death ? 30f : 40f; + if (calamityGlobalNPC.newAI[3] % toxicCloudBarfDivisor == 0f && phase3) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + int totalProjectiles = (phase4 ? 6 : 9) + (getFuckedAI ? Main.rand.Next(-2, 3) : (int)((calamityGlobalNPC.newAI[3] - spiralGateValue) / toxicCloudBarfDivisor) * (phase4 ? 2 : 3)); + float radians = MathHelper.TwoPi / totalProjectiles; + float cloudVelocity = 1f + enrageScale; + Vector2 spinningPoint = new Vector2(0f, -cloudVelocity); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 vector255 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + vector255.SafeNormalize(Vector2.UnitY) * 5f, vector255, type, damage, 0f, Main.myPlayer); + } + } + } + + // Velocity boost + if (calamityGlobalNPC.newAI[3] == spiralGateValue) + { + NPC.velocity = NPC.velocity.SafeNormalize(Vector2.UnitY); + NPC.velocity *= 24f; + } + + // Spin velocity + float velocity = (float)(MathHelper.Pi * 2D) / 120f; + // In GFB, contracts the radius as the fight progresses + if (getFuckedAI) + velocity *= phase3 ? 1.5f : phase2 ? 1.25f : 1f; + NPC.velocity = NPC.velocity.RotatedBy(-(double)velocity * NPC.localAI[1]); + // Speed up even more in GFB for more radius + if (getFuckedAI && NPC.velocity.Length() <= 32f) + NPC.velocity *= 1.1f; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2; + + // Reset and charge at target + // Don't reset in GFB + if (!getFuckedAI && calamityGlobalNPC.newAI[3] >= spiralGateValue + 120f) + { + calamityGlobalNPC.newAI[3] = 0f; + NPC.TargetClosest(); + } + } + else + { + if (!Collision.CanHit(NPC.Center, 1, 1, player.position, player.width, player.height) && calamityGlobalNPC.newAI[3] > 300f) + calamityGlobalNPC.newAI[3] -= 2f; + + if (NPC.localAI[3] > 0f) + NPC.localAI[3] -= 1f; + + NPC.localAI[1] = NPC.Center.X - player.Center.X < 0 ? 1f : -1f; + } + } + + // Adjust slowing debuff immunity + bool immuneToSlowingDebuffs = doSpiral || getFuckedAI; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; + NPC.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; + + // Spawn segments + if (calamityGlobalNPC.newAI[2] == 0f && NPC.ai[0] == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int maxLength = getFuckedAI ? 24 : death ? 80 : revenge ? 40 : expertMode ? 35 : 30; + int Previous = NPC.whoAmI; + for (int segments = 0; segments < maxLength; segments++) + { + int lol; + if (segments >= 0 && segments < maxLength - 1) + { + if (segments % 2 == 0) + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); + else + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); + } + else + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); + + Main.npc[lol].realLife = NPC.whoAmI; + Main.npc[lol].ai[2] = NPC.whoAmI; + Main.npc[lol].ai[1] = Previous; + Main.npc[Previous].ai[0] = lol; + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol); + Previous = lol; + } + } + + calamityGlobalNPC.newAI[2] = 1f; + } + + // Big barf attack + if (calamityGlobalNPC.newAI[0] == 1f && (!doSpiral && phase2) || (getFuckedAI && !phase3)) + { + NPC.localAI[0] += 1f; + if (NPC.localAI[0] >= (revenge ? 360f : 420f)) + { + if (Vector2.Distance(player.Center, NPC.Center) > 320f) + { + NPC.localAI[0] = 0f; + NPC.netUpdate = true; + SoundEngine.PlaySound(SoundID.NPCDeath13, NPC.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int totalProjectiles = bossRush ? 10 : expertMode ? 8 : 6; + if (phase3) + totalProjectiles *= 2; + + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + for (int i = 0; i < totalProjectiles; i++) + { + Vector2 velocity = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); + velocity = velocity.SafeNormalize(Vector2.UnitY); + velocity *= Main.rand.Next(phase3 ? 300 : 100, 401) * 0.01f; + + float maximumVelocityMult = death ? 0.75f : 0.5f; + if (expertMode) + velocity *= 1f + (maximumVelocityMult * (0.5f - lifeRatio)); + + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + velocity.SafeNormalize(Vector2.UnitY) * 5f, velocity, type, damage, 0f, Main.myPlayer); + } + } + } + } + } + + if (NPC.life > Main.npc[(int)NPC.ai[0]].life) + NPC.life = Main.npc[(int)NPC.ai[0]].life; + + float maxDistance = calamityGlobalNPC.newAI[0] == 1f ? 12800f : 6400f; + if (player.dead || Vector2.Distance(NPC.Center, player.Center) > maxDistance || (nonHostile && biomeEnraged)) + { + calamityGlobalNPC.newAI[1] = 1f; + NPC.TargetClosest(false); + NPC.velocity.Y += 2f; + + if (NPC.position.Y > Main.worldSurface * 16D) + NPC.velocity.Y += 2f; + + if (NPC.position.Y > Main.worldSurface * 16D) + { + for (int a = 0; a < Main.npc.Length; a++) + { + int type = Main.npc[a].type; + if (AquaticScourgeIDList.Includes(type)) + Main.npc[a].active = false; + } + } + } + else + calamityGlobalNPC.newAI[1] = 0f; + + // Change direction + if (NPC.velocity.X < 0f) + NPC.spriteDirection = -1; + else if (NPC.velocity.X > 0f) + NPC.spriteDirection = 1; + + // Alpha changes + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + + Vector2 scourgePosition = NPC.Center; + Vector2 predictionVector = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? Main.player[NPC.target].velocity * 20f : Vector2.Zero; + float scourgeTargetX = player.Center.X + predictionVector.X; + float scourgeTargetY = player.Center.Y + predictionVector.Y; + + // Velocity and movement + float scourgeMaxSpeed = 5f; + float scourgeAcceleration = 0.08f; + if (calamityGlobalNPC.newAI[0] == 1f) + { + scourgeMaxSpeed = revenge ? 14.4f : 12f; + scourgeAcceleration = revenge ? 0.18f : 0.15f; + if (expertMode) + { + scourgeMaxSpeed += 2.4f * (1f - lifeRatio); + scourgeAcceleration += 0.03f * (1f - lifeRatio); + } + scourgeMaxSpeed += 3f * enrageScale; + scourgeAcceleration += 0.06f * enrageScale; + if (death || getFuckedAI) + { + scourgeMaxSpeed += 5f; + scourgeAcceleration -= getFuckedAI ? 0f : 0.03f; + scourgeMaxSpeed += Vector2.Distance(player.Center, NPC.Center) * 0.001f; + scourgeAcceleration += Vector2.Distance(player.Center, NPC.Center) * 0.000045f; + } + + // Increase acceleration after spiral attack + if (NPC.localAI[3] > 0f) + { + float accelerationMultiplier = MathHelper.Lerp(1f, 2f, NPC.localAI[3] / colorFadeTimeAfterSpiral); + scourgeAcceleration *= accelerationMultiplier; + } + + if (Main.getGoodWorld) + { + scourgeMaxSpeed *= 1.15f; + scourgeAcceleration *= 1.15f; + } + } + + if (!doSpiral) + { + if (calamityGlobalNPC.newAI[0] != 1f) + { + scourgeTargetY += 400; + if (Math.Abs(NPC.Center.X - player.Center.X) < 500f) + { + if (NPC.velocity.X > 0f) + scourgeTargetX = player.Center.X + 600f; + else + scourgeTargetX = player.Center.X - 600f; + } + } + + float scourgeHigherSpeed = scourgeMaxSpeed * 1.3f; + float scourgeLowerSpeed = scourgeMaxSpeed * 0.7f; + float scourgeSpeed = NPC.velocity.Length(); + if (scourgeSpeed > 0f) + { + if (scourgeSpeed > scourgeHigherSpeed) + { + NPC.velocity = NPC.velocity.SafeNormalize(Vector2.UnitY); + NPC.velocity *= scourgeHigherSpeed; + } + else if (scourgeSpeed < scourgeLowerSpeed) + { + NPC.velocity = NPC.velocity.SafeNormalize(Vector2.UnitY); + NPC.velocity *= scourgeLowerSpeed; + } + } + } + + scourgeTargetX = (int)(scourgeTargetX / 16f) * 16; + scourgeTargetY = (int)(scourgeTargetY / 16f) * 16; + scourgePosition.X = (int)(scourgePosition.X / 16f) * 16; + scourgePosition.Y = (int)(scourgePosition.Y / 16f) * 16; + scourgeTargetX -= scourgePosition.X; + scourgeTargetY -= scourgePosition.Y; + float scourgeTargetDist = (float)Math.Sqrt(scourgeTargetX * scourgeTargetX + scourgeTargetY * scourgeTargetY); + + if (!doSpiral) + { + float scourgeAbsoluteTargetX = Math.Abs(scourgeTargetX); + float scourgeAbsoluteTargetY = Math.Abs(scourgeTargetY); + float scourgeTimeToReachTarget = scourgeMaxSpeed / scourgeTargetDist; + scourgeTargetX *= scourgeTimeToReachTarget; + scourgeTargetY *= scourgeTimeToReachTarget; + + if ((NPC.velocity.X > 0f && scourgeTargetX > 0f) || (NPC.velocity.X < 0f && scourgeTargetX < 0f) || (NPC.velocity.Y > 0f && scourgeTargetY > 0f) || (NPC.velocity.Y < 0f && scourgeTargetY < 0f)) + { + if (NPC.velocity.X < scourgeTargetX) + { + NPC.velocity.X += scourgeAcceleration; + } + else + { + if (NPC.velocity.X > scourgeTargetX) + NPC.velocity.X -= scourgeAcceleration; + } + + if (NPC.velocity.Y < scourgeTargetY) + { + NPC.velocity.Y += scourgeAcceleration; + } + else + { + if (NPC.velocity.Y > scourgeTargetY) + NPC.velocity.Y -= scourgeAcceleration; + } + + if (Math.Abs(scourgeTargetY) < scourgeMaxSpeed * 0.2 && ((NPC.velocity.X > 0f && scourgeTargetX < 0f) || (NPC.velocity.X < 0f && scourgeTargetX > 0f))) + { + if (NPC.velocity.Y > 0f) + NPC.velocity.Y += scourgeAcceleration * 2f; + else + NPC.velocity.Y -= scourgeAcceleration * 2f; + } + + if (Math.Abs(scourgeTargetX) < scourgeMaxSpeed * 0.2 && ((NPC.velocity.Y > 0f && scourgeTargetY < 0f) || (NPC.velocity.Y < 0f && scourgeTargetY > 0f))) + { + if (NPC.velocity.X > 0f) + NPC.velocity.X += scourgeAcceleration * 2f; + else + NPC.velocity.X -= scourgeAcceleration * 2f; + } + } + else + { + if (scourgeAbsoluteTargetX > scourgeAbsoluteTargetY) + { + if (NPC.velocity.X < scourgeTargetX) + NPC.velocity.X += scourgeAcceleration * 1.1f; + else if (NPC.velocity.X > scourgeTargetX) + NPC.velocity.X -= scourgeAcceleration * 1.1f; + + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < scourgeMaxSpeed * 0.5) + { + if (NPC.velocity.Y > 0f) + NPC.velocity.Y += scourgeAcceleration; + else + NPC.velocity.Y -= scourgeAcceleration; + } + } + else + { + if (NPC.velocity.Y < scourgeTargetY) + NPC.velocity.Y += scourgeAcceleration * 1.1f; + else if (NPC.velocity.Y > scourgeTargetY) + NPC.velocity.Y -= scourgeAcceleration * 1.1f; + + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < scourgeMaxSpeed * 0.5) + { + if (NPC.velocity.X > 0f) + NPC.velocity.X += scourgeAcceleration; + else + NPC.velocity.X -= scourgeAcceleration; + } + } + } + + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2; + } + + // Calculate contact damage based on velocity + if (!nonHostile) + { + float minimalContactDamageVelocity = scourgeMaxSpeed * 0.25f; + float minimalDamageVelocity = scourgeMaxSpeed * 0.5f; + if (NPC.velocity.Length() <= minimalContactDamageVelocity) + NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); + else + { + float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); + } + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) diff --git a/NPCs/AquaticScourge/AquaticScourgeTail.cs b/NPCs/AquaticScourge/AquaticScourgeTail.cs index 989e090678..75cdc27014 100644 --- a/NPCs/AquaticScourge/AquaticScourgeTail.cs +++ b/NPCs/AquaticScourge/AquaticScourgeTail.cs @@ -1,7 +1,9 @@ -using System.IO; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; -using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; +using CalamityMod.Systems.Collections; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -88,7 +90,218 @@ namespace CalamityMod.NPCs.AquaticScourge public override void AI() { - AquaticScourgeAI.VanillaAquaticScourgeAI(NPC, Mod, false); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + bool bossRush = BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool death = CalamityWorld.death || bossRush; + + bool getFuckedAI = Main.zenithWorld; + + // Adjust hostility and stats + bool nonHostile = calamityGlobalNPC.newAI[0] == 0f; + if (NPC.justHit || NPC.life <= NPC.lifeMax * 0.999 || bossRush || Main.getGoodWorld) + { + if (nonHostile) + { + // Kiss my motherfucking ass you piece of shit game + NPC.timeLeft *= 20; + NPC.npcSlots = 16f; + CalamityGlobalNPC.BossKillTimes.TryGetValue(NPC.type, out int revKillTime); + calamityGlobalNPC.KillTime = revKillTime; + calamityGlobalNPC.newAI[0] = 1f; + nonHostile = false; + NPC.chaseable = true; + NPC.netUpdate = true; + } + } + else + NPC.damage = 0; + + // Percent life remaining + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + // Phases + bool phase2 = lifeRatio < 0.75f; + bool phase3 = lifeRatio < 0.5f; + bool phase4 = lifeRatio < 0.25f; + + // Set worm variable + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; + if (NPC.life > Main.npc[(int)NPC.ai[1]].life) + NPC.life = Main.npc[(int)NPC.ai[1]].life; + + // Get a target + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); + + Player player = Main.player[NPC.target]; + + bool notOcean = player.position.Y < 300f || + player.position.Y > Main.worldSurface * 16.0 || + (player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680)); + + // Check for the flipped Abyss + if (Main.remixWorld) + { + notOcean = player.position.Y < Main.UnderworldLayer * 0.8f || player.position.Y > Main.UnderworldLayer || + (player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680)); + } + + bool biomeEnraged = NPC.localAI[2] <= 0f || bossRush; + float enrageScale = bossRush ? 1f : 0f; + if (biomeEnraged) + { + NPC.Calamity().CurrentlyEnraged = !bossRush; + enrageScale += 2f; + } + + // Adjust slowing debuff immunity + bool immuneToSlowingDebuffs = getFuckedAI; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; + NPC.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; + + // Kill body and tail + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (NPC.ai[1] <= 0f) + shouldDespawn = true; + else if (Main.npc[(int)NPC.ai[1]].life <= 0) + shouldDespawn = true; + } + if (shouldDespawn) + { + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; + } + + float maxDistance = calamityGlobalNPC.newAI[0] == 1f ? 12800f : 6400f; + if (player.dead || Vector2.Distance(NPC.Center, player.Center) > maxDistance || (nonHostile && biomeEnraged)) + { + calamityGlobalNPC.newAI[1] = 1f; + NPC.TargetClosest(false); + NPC.velocity.Y += 2f; + + if (NPC.position.Y > Main.worldSurface * 16D) + NPC.velocity.Y += 2f; + + if (NPC.position.Y > Main.worldSurface * 16D) + { + for (int a = 0; a < Main.npc.Length; a++) + { + int type = Main.npc[a].type; + if (AquaticScourgeIDList.Includes(type)) + Main.npc[a].active = false; + } + } + } + else + calamityGlobalNPC.newAI[1] = 0f; + + // Change direction + if (NPC.velocity.X < 0f) + NPC.spriteDirection = -1; + else if (NPC.velocity.X > 0f) + NPC.spriteDirection = 1; + + // Alpha changes + if (Main.npc[(int)NPC.ai[1]].alpha < 128) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } + + Vector2 scourgePosition = NPC.Center; + Vector2 predictionVector = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? Main.player[NPC.target].velocity * 20f : Vector2.Zero; + float scourgeTargetX = player.Center.X + predictionVector.X; + float scourgeTargetY = player.Center.Y + predictionVector.Y; + + // Velocity and movement + float scourgeMaxSpeed = 5f; + if (calamityGlobalNPC.newAI[0] == 1f) + { + scourgeMaxSpeed = revenge ? 14.4f : 12f; + if (expertMode) + scourgeMaxSpeed += 2.4f * (1f - lifeRatio); + scourgeMaxSpeed += 3f * enrageScale; + if (death || getFuckedAI) + { + scourgeMaxSpeed += 5f; + scourgeMaxSpeed += Vector2.Distance(player.Center, NPC.Center) * 0.001f; + } + + if (Main.getGoodWorld) + scourgeMaxSpeed *= 1.15f; + } + + scourgeTargetX = (int)(scourgeTargetX / 16f) * 16; + scourgeTargetY = (int)(scourgeTargetY / 16f) * 16; + scourgePosition.X = (int)(scourgePosition.X / 16f) * 16; + scourgePosition.Y = (int)(scourgePosition.Y / 16f) * 16; + scourgeTargetX -= scourgePosition.X; + scourgeTargetY -= scourgePosition.Y; + + if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) + { + try + { + scourgePosition = NPC.Center; + scourgeTargetX = Main.npc[(int)NPC.ai[1]].Center.X - scourgePosition.X; + scourgeTargetY = Main.npc[(int)NPC.ai[1]].Center.Y - scourgePosition.Y; + } + catch + { + } + + NPC.rotation = (float)Math.Atan2(scourgeTargetY, scourgeTargetX) + MathHelper.PiOver2; + float scourgeTargetDist = (float)Math.Sqrt(scourgeTargetX * scourgeTargetX + scourgeTargetY * scourgeTargetY); + int scourgeWidth = NPC.width; + scourgeTargetDist = (scourgeTargetDist - scourgeWidth) / scourgeTargetDist; + scourgeTargetX *= scourgeTargetDist; + scourgeTargetY *= scourgeTargetDist; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + scourgeTargetX; + NPC.position.Y = NPC.position.Y + scourgeTargetY; + + if (scourgeTargetX < 0f) + NPC.spriteDirection = -1; + else if (scourgeTargetX > 0f) + NPC.spriteDirection = 1; + } + + // Calculate contact damage based on velocity + if (!nonHostile) + { + float minimalContactDamageVelocity = scourgeMaxSpeed * 0.25f; + float minimalDamageVelocity = scourgeMaxSpeed * 0.5f; + float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageVelocity) + NPC.damage = 0; + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); + } + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) diff --git a/NPCs/AstrumDeus/AstrumDeusBody.cs b/NPCs/AstrumDeus/AstrumDeusBody.cs index ecfa2a3a11..53a82bf6cd 100644 --- a/NPCs/AstrumDeus/AstrumDeusBody.cs +++ b/NPCs/AstrumDeus/AstrumDeusBody.cs @@ -1,13 +1,16 @@ -using System.IO; +using System; +using System.IO; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Events; -using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; +using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.ID; using Terraria.Localization; @@ -112,7 +115,331 @@ namespace CalamityMod.NPCs.AstrumDeus public override void AI() { - AstrumDeusAI.VanillaAstrumDeusAI(NPC, Mod, false); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + + // Difficulty variables + bool bossRush = BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool death = CalamityWorld.death || bossRush; + + float enrageScale = bossRush ? 0.5f : 0f; + if (Main.IsItDay() || bossRush) + { + NPC.Calamity().CurrentlyEnraged = !bossRush; + enrageScale += 1.5f; + } + + // Deus cannot hit for 3 seconds or while invulnerable + bool doNotDealDamage = calamityGlobalNPC.newAI[1] < 180f || NPC.dontTakeDamage; + if (doNotDealDamage) + NPC.damage = 0; + + // Get a target + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); + + Player player = Main.player[NPC.target]; + + bool increaseSpeed = Vector2.Distance(player.Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles; + bool increaseSpeedMore = Vector2.Distance(player.Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles; + + // Inflict Extreme Gravity to nearby players + if (revenge) + { + if (!Main.dedServ) + { + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) + Main.LocalPlayer.AddBuff(ModContent.BuffType(), 2); + } + } + + // Life + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + // Phases based on life percentage + bool halfHealth = lifeRatio < 0.5f; + bool doubleWormPhase = calamityGlobalNPC.newAI[0] != 0f; + bool startFlightPhase = lifeRatio < 0.8f || death || doubleWormPhase; + bool phase2 = lifeRatio < 0.5f && doubleWormPhase && expertMode; + bool phase3 = lifeRatio < 0.2f && doubleWormPhase && expertMode; + bool splittingMines = lifeRatio < 0.7f; + bool movingMines = lifeRatio < 0.3f && doubleWormPhase && expertMode; + bool deathModeEnragePhase_Head = calamityGlobalNPC.newAI[0] == 3f; + bool deathModeEnragePhase_BodyAndTail = false; + + // 5 seconds of resistance in phase 2, 10 seconds in phase 1, to prevent spawn killing + float resistanceTime = doubleWormPhase ? 300f : 600f; + + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = calamityGlobalNPC.newAI[1] < resistanceTime; + + // Flight timer + float aiSwitchTimer = doubleWormPhase ? (Main.getGoodWorld ? 600f : 1200f) : (Main.getGoodWorld ? 900f : 1800f); + + calamityGlobalNPC.newAI[3] += 1f; + if (calamityGlobalNPC.newAI[3] >= aiSwitchTimer) + calamityGlobalNPC.newAI[3] = 0f; + // Sound effect for swapping between attack behaviors in phase 2 + if (doubleWormPhase && calamityGlobalNPC.newAI[3] % aiSwitchTimer == 0f && !(deathModeEnragePhase_Head || deathModeEnragePhase_BodyAndTail)) + SoundEngine.PlaySound(AstrumDeusHead.SplitSound with { Pitch = -0.2f, Volume = 0.9f }, player.Center); + + // Phase for flying at the player + bool flyAtTarget = calamityGlobalNPC.newAI[3] >= (aiSwitchTimer * 0.5f) && startFlightPhase; + + // Length of worms + int phase1Length = death ? 80 : revenge ? 70 : expertMode ? 60 : 50; + int phase2Length = death ? 40 : revenge ? 35 : expertMode ? 30 : 25; + int gfbLength = death ? 8 : revenge ? 7 : expertMode ? 6 : 5; + int maxLength = Main.zenithWorld && doubleWormPhase ? gfbLength : doubleWormPhase ? phase2Length : phase1Length; + + // Become gradually more pissed as more worms are killed + int gfbMaxWormCount = 10; + int gfbWormCount = 0; + if (CalamityWorld.LegendaryMode && revenge) + gfbWormCount = NPC.CountNPCS(ModContent.NPCType()); + if (gfbWormCount > gfbMaxWormCount) + gfbWormCount = gfbMaxWormCount; + if (gfbWormCount > 0) + enrageScale += (gfbMaxWormCount - gfbWormCount) * 0.111f; + + // Copy dontTakeDamage and Opacity from head + NPC.dontTakeDamage = Main.npc[(int)NPC.ai[2]].dontTakeDamage; + NPC.Opacity = Main.npc[(int)NPC.ai[2]].Opacity; + deathModeEnragePhase_BodyAndTail = Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] == 3f; + if (deathModeEnragePhase_BodyAndTail) + { + NPC.defense = 25; + calamityGlobalNPC.DR = 0.15f; + } + + // Set worm variable + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; + + // Alpha effects + if (Main.npc[(int)NPC.ai[1]].alpha < 128 && !NPC.dontTakeDamage) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } + + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + int headType = ModContent.NPCType(); + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].type != headType || !Main.npc[i].active) + continue; + shouldDespawn = false; + break; + } + if (shouldDespawn) + { + if (Main.npc.IndexInRange((int)NPC.ai[1]) && Main.npc[(int)NPC.ai[1]].active && Main.npc[(int)NPC.ai[1]].life > 0) + shouldDespawn = false; + } + if (shouldDespawn) + { + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; + NPC.ForceNetUpdate(false); + } + + // Direction + if (NPC.velocity.X < 0f) + NPC.spriteDirection = -1; + else if (NPC.velocity.X > 0f) + NPC.spriteDirection = 1; + + if (NPC.life > Main.npc[(int)NPC.ai[1]].life) + NPC.life = Main.npc[(int)NPC.ai[1]].life; + + bool hasJustSpawned = calamityGlobalNPC.newAI[1] < resistanceTime * 0.4f && !doubleWormPhase; // Speed boost for the first 4 seconds after spawning + float segmentVelocity = hasJustSpawned ? 25f : deathModeEnragePhase_Head ? 19f : death ? 17.5f : 16f; + + float segmentVelocityBoost = 5f * (1f - lifeRatio); + segmentVelocity += segmentVelocityBoost; + segmentVelocity += 4f * enrageScale; + + if (revenge) + { + float revMultiplier = 1.1f; + segmentVelocity *= revMultiplier; + } + + // Shoot lasers + NPC.localAI[0] += 1f; + + int shootTime = (doubleWormPhase && expertMode) ? 2 : 1; + float shootProjectile = (doubleWormPhase && expertMode) ? 200 : 400; + float timer = NPC.ai[0] + 15f; + float divisor = timer + shootProjectile; + bool canFireProjectiles = NPC.Opacity >= 1f; + bool shootGodRays = phase2 || deathModeEnragePhase_BodyAndTail; + + if (canFireProjectiles) + { + if (!flyAtTarget || deathModeEnragePhase_BodyAndTail) + { + float laserDivisor = (phase2 && !deathModeEnragePhase_BodyAndTail) ? 4f : 2f; + if (NPC.localAI[0] % divisor == 0f && NPC.ai[0] % laserDivisor == 0f) + { + NPC.TargetClosest(); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (deathModeEnragePhase_BodyAndTail) + { + Vector2 velocity = Vector2.Zero; + if (movingMines) + { + Vector2 randomMineMovement = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); + randomMineMovement.Normalize(); + randomMineMovement *= Main.rand.Next(90, 121) * 0.01f; + velocity = randomMineMovement; + } + + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + float split = (splittingMines && NPC.ai[0] % 3f == 0f) ? 1f : 0f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, damage, 0f, Main.myPlayer, split, 0f); + } + } + + if (Vector2.Distance(player.Center, NPC.Center) > 80f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float deusLaserSpeed = (death ? 16f : revenge ? 14f : 13f) + enrageScale * 4f; + + Vector2 deusLaserCenter = NPC.Center; + float deusLaserTargetX = player.Center.X - deusLaserCenter.X; + float deusLaserTargetY = player.Center.Y - deusLaserCenter.Y; + float deusLaserTargetDist = (float)Math.Sqrt(deusLaserTargetX * deusLaserTargetX + deusLaserTargetY * deusLaserTargetY); + deusLaserTargetDist = deusLaserSpeed / deusLaserTargetDist; + deusLaserTargetX *= deusLaserTargetDist; + deusLaserTargetY *= deusLaserTargetDist; + deusLaserCenter.X += deusLaserTargetX * 5f; + deusLaserCenter.Y += deusLaserTargetY * 5f; + + Vector2 shootDirection = new Vector2(deusLaserTargetX, deusLaserTargetY).SafeNormalize(Vector2.UnitY); + Vector2 laserVelocity = shootDirection * deusLaserSpeed; + + int type = shootGodRays ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + if (shootGodRays) + { + SoundEngine.PlaySound(AstrumDeusHead.GodRaySound, NPC.Center); + // Waving beams need to start offset so they cross each other neatly. + float waveSideOffset = Main.rand.NextFloat(9f, 14f); + Vector2 perp = shootDirection.RotatedBy(-MathHelper.PiOver2) * waveSideOffset; + + for (int i = -1; i <= 1; i += 2) + { + Vector2 laserStartPos = deusLaserCenter + i * perp + Main.rand.NextVector2CircularEdge(6f, 6f); + Projectile godRay = Projectile.NewProjectileDirect(NPC.GetSource_FromAI(), laserStartPos, laserVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); + + // Tell this Phased God Ray exactly which way it should be waving. + godRay.localAI[1] = i * 0.5f; + } + } + else + { + SoundEngine.PlaySound(AstrumDeusHead.LaserSound, NPC.Center); + Projectile.NewProjectile(NPC.GetSource_FromAI(), deusLaserCenter, laserVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); + } + } + } + } + } + else + { + if (NPC.localAI[0] % divisor == 0f && NPC.ai[0] % 2f == 0f) + { + Vector2 velocity = Vector2.Zero; + if (movingMines) + { + Vector2 randomMineMovement = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); + randomMineMovement.Normalize(); + randomMineMovement *= Main.rand.Next(30, 121) * 0.01f; + velocity = randomMineMovement; + } + + int type = ModContent.ProjectileType(); + int damage = NPC.GetProjectileDamage(type); + float split = (splittingMines && NPC.ai[0] % 3f == 0f) ? 1f : 0f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, damage, 0f, Main.myPlayer, split, 0f); + } + } + } + + // Follow the head + Vector2 segmentCenter = NPC.Center; + float segmentTargetX = player.Center.X; + float segmentTargetY = player.Center.Y; + segmentTargetX = (int)(segmentTargetX / 16f) * 16; + segmentTargetY = (int)(segmentTargetY / 16f) * 16; + segmentCenter.X = (int)(segmentCenter.X / 16f) * 16; + segmentCenter.Y = (int)(segmentCenter.Y / 16f) * 16; + segmentTargetX -= segmentCenter.X; + segmentTargetY -= segmentCenter.Y; + + if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) + { + try + { + segmentCenter = NPC.Center; + segmentTargetX = Main.npc[(int)NPC.ai[1]].Center.X - segmentCenter.X; + segmentTargetY = Main.npc[(int)NPC.ai[1]].Center.Y - segmentCenter.Y; + } + catch + { + } + + NPC.rotation = (float)Math.Atan2(segmentTargetY, segmentTargetX) + MathHelper.PiOver2; + float segmentTargetDist = (float)Math.Sqrt(segmentTargetX * segmentTargetX + segmentTargetY * segmentTargetY); + int segmentWidth = NPC.width; + segmentTargetDist = (segmentTargetDist - segmentWidth) / segmentTargetDist; + segmentTargetX *= segmentTargetDist; + segmentTargetY *= segmentTargetDist; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + segmentTargetX; + NPC.position.Y = NPC.position.Y + segmentTargetY; + + if (segmentTargetX < 0f) + NPC.spriteDirection = -1; + else if (segmentTargetX > 0f) + NPC.spriteDirection = 1; + } + + // Play spawn sound on Deus on the first frame because otherwise the sound wouldn't play properly in multiplayer + if (calamityGlobalNPC.newAI[1] == 0f && !doubleWormPhase) + { + SoundEngine.PlaySound(AstrumDeusHead.SpawnSound, NPC.Center); + calamityGlobalNPC.newAI[1] = 1f; + } + + // 5 seconds of resistance in phase 2, 10 seconds in phase 1, to prevent spawn killing + if (calamityGlobalNPC.newAI[1] < resistanceTime && ((NPC.position - NPC.oldPosition).Length() > 2f || calamityGlobalNPC.newAI[1] > 1f)) + calamityGlobalNPC.newAI[1] += 1f; + + // Calculate contact damage based on velocity + if (!doNotDealDamage) + { + float minimalContactDamageVelocity = segmentVelocity * 0.25f; + float minimalDamageVelocity = segmentVelocity * 0.5f; + float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageVelocity) + NPC.damage = 0; + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); + } + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) diff --git a/NPCs/AstrumDeus/AstrumDeusHead.cs b/NPCs/AstrumDeus/AstrumDeusHead.cs index eb5c436317..f590b2477c 100644 --- a/NPCs/AstrumDeus/AstrumDeusHead.cs +++ b/NPCs/AstrumDeus/AstrumDeusHead.cs @@ -1,6 +1,7 @@ -using System.IO; -using CalamityMod.BiomeManagers; +using System; +using System.IO; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Items.Accessories; @@ -17,8 +18,7 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; -using CalamityMod.NPCs.Abyss; -using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; +using CalamityMod.Packets; using CalamityMod.UI.VanillaBossBars; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -149,7 +149,652 @@ namespace CalamityMod.NPCs.AstrumDeus public override void AI() { - AstrumDeusAI.VanillaAstrumDeusAI(NPC, Mod, true); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + + // Difficulty variables + bool bossRush = BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool death = CalamityWorld.death || bossRush; + + float enrageScale = bossRush ? 0.5f : 0f; + if (Main.IsItDay() || bossRush) + { + NPC.Calamity().CurrentlyEnraged = !bossRush; + enrageScale += 1.5f; + } + + // Deus cannot hit for 3 seconds or while invulnerable + bool doNotDealDamage = calamityGlobalNPC.newAI[1] < 180f || NPC.dontTakeDamage; + if (doNotDealDamage) + NPC.damage = 0; + + // Get a target + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); + + Player player = Main.player[NPC.target]; + + bool increaseSpeed = Vector2.Distance(player.Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles; + bool increaseSpeedMore = Vector2.Distance(player.Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles; + + // Despawn safety, make sure to target another player if the current player target is too far away + if (increaseSpeedMore) + NPC.TargetClosest(); + + // Inflict Extreme Gravity to nearby players + if (revenge) + { + if (!Main.dedServ) + { + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) + Main.LocalPlayer.AddBuff(ModContent.BuffType(), 2); + } + } + + // Life + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + // Phases based on life percentage + bool halfHealth = lifeRatio < 0.5f; + bool doubleWormPhase = calamityGlobalNPC.newAI[0] != 0f; + bool startFlightPhase = lifeRatio < 0.8f || death || doubleWormPhase; + bool phase2 = lifeRatio < 0.5f && doubleWormPhase && expertMode; + bool phase3 = lifeRatio < 0.2f && doubleWormPhase && expertMode; + bool splittingMines = lifeRatio < 0.7f; + bool movingMines = lifeRatio < 0.3f && doubleWormPhase && expertMode; + bool deathModeEnragePhase_Head = calamityGlobalNPC.newAI[0] == 3f; + bool deathModeEnragePhase_BodyAndTail = false; + + // 5 seconds of resistance in phase 2, 10 seconds in phase 1, to prevent spawn killing + float resistanceTime = doubleWormPhase ? 300f : 600f; + + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = calamityGlobalNPC.newAI[1] < resistanceTime; + + // Flight timer + float aiSwitchTimer = doubleWormPhase ? (Main.getGoodWorld ? 600f : 1200f) : (Main.getGoodWorld ? 900f : 1800f); + + calamityGlobalNPC.newAI[3] += 1f; + if (calamityGlobalNPC.newAI[3] >= aiSwitchTimer) + calamityGlobalNPC.newAI[3] = 0f; + // Sound effect for swapping between attack behaviors in phase 2 + if (doubleWormPhase && calamityGlobalNPC.newAI[3] % aiSwitchTimer == 0f && !(deathModeEnragePhase_Head || deathModeEnragePhase_BodyAndTail)) + SoundEngine.PlaySound(SplitSound with { Pitch = -0.2f, Volume = 0.9f }, player.Center); + + // Phase for flying at the player + bool flyAtTarget = calamityGlobalNPC.newAI[3] >= (aiSwitchTimer * 0.5f) && startFlightPhase; + + // Length of worms + int phase1Length = death ? 80 : revenge ? 70 : expertMode ? 60 : 50; + int phase2Length = death ? 40 : revenge ? 35 : expertMode ? 30 : 25; + int gfbLength = death ? 8 : revenge ? 7 : expertMode ? 6 : 5; + int maxLength = Main.zenithWorld && doubleWormPhase ? gfbLength : doubleWormPhase ? phase2Length : phase1Length; + + // Become gradually more pissed as more worms are killed + int gfbMaxWormCount = 10; + int gfbWormCount = 0; + if (CalamityWorld.LegendaryMode && revenge) + gfbWormCount = NPC.CountNPCS(ModContent.NPCType()); + if (gfbWormCount > gfbMaxWormCount) + gfbWormCount = gfbMaxWormCount; + if (gfbWormCount > 0) + enrageScale += (gfbMaxWormCount - gfbWormCount) * 0.111f; + + // Split into two worms + float splitAnimationTime = 180f; + bool oneWormAlive = NPC.CountNPCS(ModContent.NPCType()) < 2; + bool deathModeFinalWormEnrage = death && doubleWormPhase && oneWormAlive && calamityGlobalNPC.newAI[1] >= resistanceTime; + if (deathModeFinalWormEnrage) + { + if (calamityGlobalNPC.newAI[0] != 3f) + { + SoundEngine.PlaySound(SplitSound, player.Center); + calamityGlobalNPC.newAI[0] = 3f; + NPC.defense = 12; + calamityGlobalNPC.DR = 0.075f; + + // Despawns the other deus worm segments + int bodyID = ModContent.NPCType(); + int tailID = ModContent.NPCType(); + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC wormseg = Main.npc[i]; + if (!wormseg.active) + continue; + + if ((wormseg.type == bodyID || wormseg.type == tailID) && Main.npc[(int)wormseg.ai[2]].Calamity().newAI[0] != 3f) + { + wormseg.life = 0; + wormseg.active = false; + } + } + } + + calamityGlobalNPC.newAI[2] += 10f; + if (calamityGlobalNPC.newAI[2] > 162f) + calamityGlobalNPC.newAI[2] = 162f; + + NPC.Opacity = MathHelper.Clamp(1f - (calamityGlobalNPC.newAI[2] / splitAnimationTime), 0f, 1f); + } + + bool despawnRemainingWorm = doubleWormPhase && oneWormAlive && !death; + if ((halfHealth && calamityGlobalNPC.newAI[0] == 0f) || despawnRemainingWorm) + { + NPC.dontTakeDamage = true; + + calamityGlobalNPC.newAI[2] += despawnRemainingWorm ? 10f : 1f; + NPC.Opacity = MathHelper.Clamp(1f - (calamityGlobalNPC.newAI[2] / splitAnimationTime), 0f, 1f); + + bool despawning = calamityGlobalNPC.newAI[2] == splitAnimationTime; + + // + // CODE TWEAKED BY: OZZATRON + // September 20th, 2020 + // reason: fixing Astrum Deus death mode NPC cap bug + // + + // Despawn the unsplit Astrum Deus and spawn two half-size Astrum Deus worms. + if (despawning) + { + // If this is already a split worm (newAI[0] != 0f) then don't do anything. At all. + if (doubleWormPhase) + return; + + // Mark all existing body and tail segments as inactive. This instantly frees up their NPC slots for the freshly spawned worms. + int bodyID = ModContent.NPCType(); + int tailID = ModContent.NPCType(); + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC wormseg = Main.npc[i]; + if (!wormseg.active) + continue; + if (wormseg.type == bodyID || wormseg.type == tailID) + { + wormseg.life = 0; + wormseg.active = false; + } + } + + // The unsplit Astrum Deus worm head will die next frame. + NPC.life = 0; + + // Do not spawn worms client side. The server handles this. + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int wormamt = Main.zenithWorld ? 5 : 1; + for (int i = 0; i < wormamt; i++) + { + // Now that the original worm doesn't exist, startCount can be zero. + // int startCount = NPC.whoAmI + phase1Length + 1; + int startIndexHeadOne = 1; + int headOneID = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, NPC.type, startIndexHeadOne); + Main.npc[headOneID].Calamity().newAI[0] = 1f; + Main.npc[headOneID].velocity = Vector2.Normalize(player.Center - Main.npc[headOneID].Center) * 16f; + Main.npc[headOneID].timeLeft *= 20; + Main.npc[headOneID].ForceNetUpdate(); + + // On server, immediately send the correct extra AI of this head to clients. + if (Main.dedServ) + { + SyncCalamityNPCAIArrayPacket.Send(Main.npc[headOneID]); + } + + // Make sure the second split worm is also contiguous. + int startIndexHeadTwo = startIndexHeadOne + phase2Length + 1; + int headTwoID = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, NPC.type, startIndexHeadTwo); + Main.npc[headTwoID].Calamity().newAI[0] = 2f; + Main.npc[headTwoID].Calamity().newAI[3] = Main.getGoodWorld ? 300f : 600f; + Main.npc[headTwoID].velocity = Vector2.Normalize(player.Center - Main.npc[headTwoID].Center) * 16f; + Main.npc[headTwoID].timeLeft *= 20; + Main.npc[headTwoID].ForceNetUpdate(); + + // On server, immediately send the correct extra AI of this head to clients. + if (Main.dedServ) + { + SyncCalamityNPCAIArrayPacket.Send(Main.npc[headTwoID]); + } + } + + SoundEngine.PlaySound(AstrumDeusHead.SplitSound, player.Center); + } + return; + } + } + + if (Main.zenithWorld && calamityGlobalNPC.newAI[1] < 10f) // desync the deuses + { + float pushForce = 0.25f; + for (int k = 0; k < Main.maxNPCs; k++) + { + NPC otherDeus = Main.npc[k]; + // Short circuits to make the loop as fast as possible + if (!otherDeus.active || k == NPC.whoAmI) + continue; + + // If the other projectile is indeed the same owned by the same player and they're too close, nudge them away. + bool sameProjType = otherDeus.type == NPC.type; + float taxicabDist = Vector2.Distance(NPC.Center, otherDeus.Center); + float distancegate = 320f; + if (sameProjType && taxicabDist < distancegate) + { + if (NPC.position.X < otherDeus.position.X) + NPC.velocity.X -= pushForce; + else + NPC.velocity.X += pushForce; + + if (NPC.position.Y < otherDeus.position.Y) + NPC.velocity.Y -= pushForce; + else + NPC.velocity.Y += pushForce; + } + } + } + + // Set worm variable + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; + + // Alpha effects + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + + // Direction + if (NPC.velocity.X < 0f) + NPC.spriteDirection = -1; + else if (NPC.velocity.X > 0f) + NPC.spriteDirection = 1; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (NPC.ai[0] == 0f) + { + int Previous = NPC.whoAmI; + int bodyType = ModContent.NPCType(); + int tailType = ModContent.NPCType(); + for (int segments = 0; segments < maxLength; segments++) + { + int lol; + if (segments >= 0 && segments < maxLength - 1) + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, bodyType, NPC.whoAmI); + else + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, tailType, NPC.whoAmI); + + if (segments % 2 == 0) + Main.npc[lol].localAI[3] = 1f; + + Main.npc[lol].realLife = NPC.whoAmI; + Main.npc[lol].Calamity().newAI[0] = Main.npc[Previous].Calamity().newAI[0]; + Main.npc[lol].Calamity().newAI[3] = Main.npc[Previous].Calamity().newAI[3]; + + if (Main.dedServ) + { + SyncCalamityNPCAIArrayPacket.Send(Main.npc[lol]); + } + + Main.npc[lol].ai[3] = segments + 1; + Main.npc[lol].ai[2] = NPC.whoAmI; + Main.npc[lol].ai[1] = Previous; + Main.npc[Previous].ai[0] = lol; + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol); + Previous = lol; + } + } + } + + if (NPC.life > Main.npc[(int)NPC.ai[0]].life) + NPC.life = Main.npc[(int)NPC.ai[0]].life; + + bool hasJustSpawned = calamityGlobalNPC.newAI[1] < resistanceTime * 0.4f && !doubleWormPhase; // Speed boost for the first 4 seconds after spawning + float segmentVelocity = hasJustSpawned ? 25f : deathModeEnragePhase_Head ? 19f : death ? 17.5f : 16f; + + float segmentVelocityBoost = 5f * (1f - lifeRatio); + segmentVelocity += segmentVelocityBoost; + segmentVelocity += 4f * enrageScale; + + if (revenge) + { + float revMultiplier = 1.1f; + segmentVelocity *= revMultiplier; + } + + int headTilePositionX = (int)(NPC.position.X / 16f) - 1; + int headTileWidthPosX = (int)((NPC.position.X + NPC.width) / 16f) + 2; + int headTilePositionY = (int)(NPC.position.Y / 16f) - 1; + int headTileWidthPosY = (int)((NPC.position.Y + NPC.height) / 16f) + 2; + + if (headTilePositionX < 0) + headTilePositionX = 0; + if (headTileWidthPosX > Main.maxTilesX) + headTileWidthPosX = Main.maxTilesX; + if (headTilePositionY < 0) + headTilePositionY = 0; + if (headTileWidthPosY > Main.maxTilesY) + headTileWidthPosY = Main.maxTilesY; + + // Fly or not + bool shouldFly = flyAtTarget; + if (!shouldFly) + { + for (int k = headTilePositionX; k < headTileWidthPosX; k++) + { + for (int l = headTilePositionY; l < headTileWidthPosY; l++) + { + if (Main.tile[k, l] != null && ((Main.tile[k, l].HasUnactuatedTile && (Main.tileSolid[Main.tile[k, l].TileType] || (Main.tileSolidTop[Main.tile[k, l].TileType] && Main.tile[k, l].TileFrameY == 0))) || Main.tile[k, l].LiquidAmount > 64)) + { + Vector2 vector2; + vector2.X = k * 16f; + vector2.Y = l * 16f; + if (NPC.position.X + NPC.width > vector2.X && NPC.position.X < vector2.X + 16f && NPC.position.Y + NPC.height > vector2.Y && NPC.position.Y < vector2.Y + 16f) + { + shouldFly = true; + break; + } + } + } + } + } + + // Start flying if target is not within a certain distance + if (!shouldFly) + { + NPC.localAI[1] = 1f; + + Rectangle rectangle = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height); + int noFlyZone = 200; + int heightReduction = death ? 130 : (int)(130f * (1f - lifeRatio)); + int height = 400 - heightReduction; + bool outsideNoFlyZone = true; + + if (NPC.position.Y > player.position.Y) + { + for (int m = 0; m < Main.maxPlayers; m++) + { + if (Main.player[m].active) + { + Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - noFlyZone, (int)Main.player[m].position.Y - noFlyZone, noFlyZone * 2, height); + if (rectangle.Intersects(rectangle2)) + { + outsideNoFlyZone = false; + break; + } + } + } + + if (outsideNoFlyZone) + shouldFly = true; + } + } + else + NPC.localAI[1] = 0f; + + // Despawn + if (player.dead) + { + shouldFly = false; + float velocity = 2f; + NPC.velocity.Y -= velocity; + if ((double)NPC.position.Y < Main.topWorld + 16f) + { + segmentVelocity *= 2f; + NPC.velocity.Y -= velocity; + } + + int headType = ModContent.NPCType(); + int bodyType = ModContent.NPCType(); + int tailType = ModContent.NPCType(); + if ((double)NPC.position.Y < Main.topWorld + 16f) + { + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].type == headType || Main.npc[i].type == bodyType || Main.npc[i].type == tailType) + { + Main.npc[i].active = false; + Main.npc[i].ForceNetUpdate(false); + } + } + } + } + + // Speed and movement + float speedBoost = death ? (0.1f * (1f - lifeRatio)) : (0.13f * (1f - lifeRatio)); + float turnSpeedBoost = death ? (0.18f * (1f - lifeRatio)) : (0.2f * (1f - lifeRatio)); + float speed = (hasJustSpawned ? 0.26f : deathModeEnragePhase_Head ? 0.2f : death ? 0.18f : 0.13f) + speedBoost; + float turnSpeed = (hasJustSpawned ? 0.3f : deathModeEnragePhase_Head ? 0.27f : death ? 0.25f : 0.2f) + turnSpeedBoost; + speed += 0.05f * enrageScale; + turnSpeed += 0.08f * enrageScale; + + if (flyAtTarget) + { + float speedMultiplier = deathModeEnragePhase_Head ? 1.25f : doubleWormPhase ? (phase3 ? 1.25f : phase2 ? 1.2f : 1.15f) : 1f; + speed *= speedMultiplier; + } + + if (revenge) + { + float revMultiplier = 1.1f; + speed *= revMultiplier; + turnSpeed *= revMultiplier; + } + + speed *= increaseSpeedMore ? 2f : increaseSpeed ? 1.5f : 1f; + turnSpeed *= increaseSpeedMore ? 2f : increaseSpeed ? 1.5f : 1f; + + if (Main.getGoodWorld) + { + speed *= 1.15f; + turnSpeed *= 1.15f; + } + + Vector2 deusCenter = NPC.Center; + float deusTargetX = player.Center.X; + float deusTargetY = player.Center.Y; + deusTargetX = (int)(deusTargetX / 16f) * 16; + deusTargetY = (int)(deusTargetY / 16f) * 16; + deusCenter.X = (int)(deusCenter.X / 16f) * 16; + deusCenter.Y = (int)(deusCenter.Y / 16f) * 16; + deusTargetX -= deusCenter.X; + deusTargetY -= deusCenter.Y; + + if (!shouldFly) + { + NPC.velocity.Y += 0.15f; + if (NPC.velocity.Y > segmentVelocity) + NPC.velocity.Y = segmentVelocity; + + // This bool exists to stop the strange wiggle behavior when worms are falling down + bool slowXVelocity = Math.Abs(NPC.velocity.X) > speed; + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < segmentVelocity * 0.4) + { + if (NPC.velocity.X < 0f) + NPC.velocity.X -= speed * 1.1f; + else + NPC.velocity.X += speed * 1.1f; + } + else if (NPC.velocity.Y == segmentVelocity) + { + if (slowXVelocity) + { + if (NPC.velocity.X < deusTargetX) + NPC.velocity.X += speed; + else if (NPC.velocity.X > deusTargetX) + NPC.velocity.X -= speed; + } + else + NPC.velocity.X = 0f; + } + else if (NPC.velocity.Y > 4f) + { + if (slowXVelocity) + { + if (NPC.velocity.X < 0f) + NPC.velocity.X += speed * 0.9f; + else + NPC.velocity.X -= speed * 0.9f; + } + else + NPC.velocity.X = 0f; + } + } + else + { + float deusTargetDist = (float)Math.Sqrt(deusTargetX * deusTargetX + deusTargetY * deusTargetY); + float deusAbsoluteTargetX = Math.Abs(deusTargetX); + float deusAbsoluteTargetY = Math.Abs(deusTargetY); + float deusTimeToReachTarget = segmentVelocity / deusTargetDist; + deusTargetX *= deusTimeToReachTarget; + deusTargetY *= deusTimeToReachTarget; + + bool speedUpWhileFlying = false; + if (flyAtTarget) + { + if (((NPC.velocity.X > 0f && deusTargetX < 0f) || (NPC.velocity.X < 0f && deusTargetX > 0f) || (NPC.velocity.Y > 0f && deusTargetY < 0f) || (NPC.velocity.Y < 0f && deusTargetY > 0f)) && Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y) > speed / 2f && deusTargetDist < 400f) + { + speedUpWhileFlying = true; + + if (Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y) < segmentVelocity) + NPC.velocity *= 1.1f; + } + + if (NPC.position.Y > player.position.Y) + { + speedUpWhileFlying = true; + + if (Math.Abs(NPC.velocity.X) < segmentVelocity / 2f) + { + if (NPC.velocity.X == 0f) + NPC.velocity.X -= NPC.direction; + + NPC.velocity.X *= 1.1f; + } + else if (NPC.velocity.Y > -segmentVelocity) + NPC.velocity.Y -= speed; + } + } + + if (!speedUpWhileFlying) + { + if (!flyAtTarget) + { + if (((NPC.velocity.X > 0f && deusTargetX > 0f) || (NPC.velocity.X < 0f && deusTargetX < 0f)) && ((NPC.velocity.Y > 0f && deusTargetY > 0f) || (NPC.velocity.Y < 0f && deusTargetY < 0f))) + { + if (NPC.velocity.X < deusTargetX) + NPC.velocity.X += turnSpeed; + else if (NPC.velocity.X > deusTargetX) + NPC.velocity.X -= turnSpeed; + + if (NPC.velocity.Y < deusTargetY) + NPC.velocity.Y += turnSpeed; + else if (NPC.velocity.Y > deusTargetY) + NPC.velocity.Y -= turnSpeed; + } + } + + if ((NPC.velocity.X > 0f && deusTargetX > 0f) || (NPC.velocity.X < 0f && deusTargetX < 0f) || (NPC.velocity.Y > 0f && deusTargetY > 0f) || (NPC.velocity.Y < 0f && deusTargetY < 0f)) + { + if (NPC.velocity.X < deusTargetX) + NPC.velocity.X += speed; + else if (NPC.velocity.X > deusTargetX) + NPC.velocity.X -= speed; + + if (NPC.velocity.Y < deusTargetY) + NPC.velocity.Y += speed; + else if (NPC.velocity.Y > deusTargetY) + NPC.velocity.Y -= speed; + + if (Math.Abs(deusTargetY) < segmentVelocity * 0.2 && ((NPC.velocity.X > 0f && deusTargetX < 0f) || (NPC.velocity.X < 0f && deusTargetX > 0f))) + { + if (NPC.velocity.Y > 0f) + NPC.velocity.Y += speed * 2f; + else + NPC.velocity.Y -= speed * 2f; + } + + if (Math.Abs(deusTargetX) < segmentVelocity * 0.2 && ((NPC.velocity.Y > 0f && deusTargetY < 0f) || (NPC.velocity.Y < 0f && deusTargetY > 0f))) + { + if (NPC.velocity.X > 0f) + NPC.velocity.X += speed * 2f; + else + NPC.velocity.X -= speed * 2f; + } + } + else if (deusAbsoluteTargetX > deusAbsoluteTargetY) + { + if (NPC.velocity.X < deusTargetX) + NPC.velocity.X += speed * 1.1f; + else if (NPC.velocity.X > deusTargetX) + NPC.velocity.X -= speed * 1.1f; + + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < segmentVelocity * 0.5) + { + if (NPC.velocity.Y > 0f) + NPC.velocity.Y += speed; + else + NPC.velocity.Y -= speed; + } + } + else + { + if (NPC.velocity.Y < deusTargetY) + NPC.velocity.Y += speed * 1.1f; + else if (NPC.velocity.Y > deusTargetY) + NPC.velocity.Y -= speed * 1.1f; + + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < segmentVelocity * 0.5) + { + if (NPC.velocity.X > 0f) + NPC.velocity.X += speed; + else + NPC.velocity.X -= speed; + } + } + } + } + + if (shouldFly) + { + if (NPC.localAI[0] != 1f) + NPC.ForceNetUpdate(false); + + NPC.localAI[0] = 1f; + } + else + { + if (NPC.localAI[0] != 0f) + NPC.ForceNetUpdate(false); + + NPC.localAI[0] = 0f; + } + + if (((NPC.velocity.X > 0f && NPC.oldVelocity.X < 0f) || (NPC.velocity.X < 0f && NPC.oldVelocity.X > 0f) || (NPC.velocity.Y > 0f && NPC.oldVelocity.Y < 0f) || (NPC.velocity.Y < 0f && NPC.oldVelocity.Y > 0f)) && !NPC.justHit) + NPC.ForceNetUpdate(false); + + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2; + + // Play spawn sound on Deus on the first frame because otherwise the sound wouldn't play properly in multiplayer + if (calamityGlobalNPC.newAI[1] == 0f && !doubleWormPhase) + { + SoundEngine.PlaySound(SpawnSound, NPC.Center); + calamityGlobalNPC.newAI[1] = 1f; + } + + // 5 seconds of resistance in phase 2, 10 seconds in phase 1, to prevent spawn killing + if (calamityGlobalNPC.newAI[1] < resistanceTime && ((NPC.position - NPC.oldPosition).Length() > 2f || calamityGlobalNPC.newAI[1] > 1f)) + calamityGlobalNPC.newAI[1] += 1f; + + // Calculate contact damage based on velocity + if (!doNotDealDamage) + { + float minimalContactDamageVelocity = segmentVelocity * 0.25f; + float minimalDamageVelocity = segmentVelocity * 0.5f; + if (NPC.velocity.Length() <= minimalContactDamageVelocity) + NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); + else + { + float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); + } + } } public override bool CheckActive() @@ -274,7 +919,7 @@ namespace CalamityMod.NPCs.AstrumDeus public override void BossLoot(ref string name, ref int potionType) => potionType = ModContent.ItemType(); - public static bool ShouldNotDropThings(NPC npc) => npc.Calamity().newAI[0] == 0f || ((CalamityWorld.death || BossRushEvent.BossRushActive) && npc.Calamity().newAI[0] != 3f); + public static bool ShouldNotDropThings(NPC NPC) => NPC.Calamity().newAI[0] == 0f || ((CalamityWorld.death || BossRushEvent.BossRushActive) && NPC.Calamity().newAI[0] != 3f); public override bool SpecialOnKill() { diff --git a/NPCs/AstrumDeus/AstrumDeusTail.cs b/NPCs/AstrumDeus/AstrumDeusTail.cs index 127a782e6c..2e12004722 100644 --- a/NPCs/AstrumDeus/AstrumDeusTail.cs +++ b/NPCs/AstrumDeus/AstrumDeusTail.cs @@ -1,13 +1,15 @@ -using System.IO; +using System; +using System.IO; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Events; -using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.ID; using Terraria.Localization; @@ -96,7 +98,225 @@ namespace CalamityMod.NPCs.AstrumDeus public override void AI() { - AstrumDeusAI.VanillaAstrumDeusAI(NPC, Mod, false); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + + // Difficulty variables + bool bossRush = BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || bossRush; + bool revenge = CalamityWorld.revenge || bossRush; + bool death = CalamityWorld.death || bossRush; + + float enrageScale = bossRush ? 0.5f : 0f; + if (Main.IsItDay() || bossRush) + { + NPC.Calamity().CurrentlyEnraged = !bossRush; + enrageScale += 1.5f; + } + + // Deus cannot hit for 3 seconds or while invulnerable + bool doNotDealDamage = calamityGlobalNPC.newAI[1] < 180f || NPC.dontTakeDamage; + if (doNotDealDamage) + NPC.damage = 0; + + // Get a target + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); + + Player player = Main.player[NPC.target]; + + bool increaseSpeed = Vector2.Distance(player.Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles; + bool increaseSpeedMore = Vector2.Distance(player.Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles; + + // Inflict Extreme Gravity to nearby players + if (revenge) + { + if (!Main.dedServ) + { + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) + Main.LocalPlayer.AddBuff(ModContent.BuffType(), 2); + } + } + + // Life + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + // Phases based on life percentage + bool halfHealth = lifeRatio < 0.5f; + bool doubleWormPhase = calamityGlobalNPC.newAI[0] != 0f; + bool startFlightPhase = lifeRatio < 0.8f || death || doubleWormPhase; + bool phase2 = lifeRatio < 0.5f && doubleWormPhase && expertMode; + bool phase3 = lifeRatio < 0.2f && doubleWormPhase && expertMode; + bool splittingMines = lifeRatio < 0.7f; + bool movingMines = lifeRatio < 0.3f && doubleWormPhase && expertMode; + bool deathModeEnragePhase_Head = calamityGlobalNPC.newAI[0] == 3f; + bool deathModeEnragePhase_BodyAndTail = false; + + // 5 seconds of resistance in phase 2, 10 seconds in phase 1, to prevent spawn killing + float resistanceTime = doubleWormPhase ? 300f : 600f; + + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = calamityGlobalNPC.newAI[1] < resistanceTime; + + // Flight timer + float aiSwitchTimer = doubleWormPhase ? (Main.getGoodWorld ? 600f : 1200f) : (Main.getGoodWorld ? 900f : 1800f); + + calamityGlobalNPC.newAI[3] += 1f; + if (calamityGlobalNPC.newAI[3] >= aiSwitchTimer) + calamityGlobalNPC.newAI[3] = 0f; + // Sound effect for swapping between attack behaviors in phase 2 + if (doubleWormPhase && calamityGlobalNPC.newAI[3] % aiSwitchTimer == 0f && !(deathModeEnragePhase_Head || deathModeEnragePhase_BodyAndTail)) + SoundEngine.PlaySound(AstrumDeusHead.SplitSound with { Pitch = -0.2f, Volume = 0.9f }, player.Center); + + // Phase for flying at the player + bool flyAtTarget = calamityGlobalNPC.newAI[3] >= (aiSwitchTimer * 0.5f) && startFlightPhase; + + // Length of worms + int phase1Length = death ? 80 : revenge ? 70 : expertMode ? 60 : 50; + int phase2Length = death ? 40 : revenge ? 35 : expertMode ? 30 : 25; + int gfbLength = death ? 8 : revenge ? 7 : expertMode ? 6 : 5; + int maxLength = Main.zenithWorld && doubleWormPhase ? gfbLength : doubleWormPhase ? phase2Length : phase1Length; + + // Become gradually more pissed as more worms are killed + int gfbMaxWormCount = 10; + int gfbWormCount = 0; + if (CalamityWorld.LegendaryMode && revenge) + gfbWormCount = NPC.CountNPCS(ModContent.NPCType()); + if (gfbWormCount > gfbMaxWormCount) + gfbWormCount = gfbMaxWormCount; + if (gfbWormCount > 0) + enrageScale += (gfbMaxWormCount - gfbWormCount) * 0.111f; + + // Copy dontTakeDamage and Opacity from head + NPC.dontTakeDamage = Main.npc[(int)NPC.ai[2]].dontTakeDamage; + NPC.Opacity = Main.npc[(int)NPC.ai[2]].Opacity; + deathModeEnragePhase_BodyAndTail = Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] == 3f; + if (deathModeEnragePhase_BodyAndTail) + { + NPC.defense = 25; + calamityGlobalNPC.DR = 0.15f; + } + + // Set worm variable + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; + + // Alpha effects + if (Main.npc[(int)NPC.ai[1]].alpha < 128 && !NPC.dontTakeDamage) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } + + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + int headType = ModContent.NPCType(); + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].type != headType || !Main.npc[i].active) + continue; + shouldDespawn = false; + break; + } + if (shouldDespawn) + { + if (Main.npc.IndexInRange((int)NPC.ai[1]) && Main.npc[(int)NPC.ai[1]].active && Main.npc[(int)NPC.ai[1]].life > 0) + shouldDespawn = false; + } + if (shouldDespawn) + { + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; + NPC.ForceNetUpdate(false); + } + + // Direction + if (NPC.velocity.X < 0f) + NPC.spriteDirection = -1; + else if (NPC.velocity.X > 0f) + NPC.spriteDirection = 1; + + if (NPC.life > Main.npc[(int)NPC.ai[1]].life) + NPC.life = Main.npc[(int)NPC.ai[1]].life; + + bool hasJustSpawned = calamityGlobalNPC.newAI[1] < resistanceTime * 0.4f && !doubleWormPhase; // Speed boost for the first 4 seconds after spawning + float segmentVelocity = hasJustSpawned ? 25f : deathModeEnragePhase_Head ? 19f : death ? 17.5f : 16f; + + float segmentVelocityBoost = 5f * (1f - lifeRatio); + segmentVelocity += segmentVelocityBoost; + segmentVelocity += 4f * enrageScale; + + if (revenge) + { + float revMultiplier = 1.1f; + segmentVelocity *= revMultiplier; + } + + // Follow the head + Vector2 segmentCenter = NPC.Center; + float segmentTargetX = player.Center.X; + float segmentTargetY = player.Center.Y; + segmentTargetX = (int)(segmentTargetX / 16f) * 16; + segmentTargetY = (int)(segmentTargetY / 16f) * 16; + segmentCenter.X = (int)(segmentCenter.X / 16f) * 16; + segmentCenter.Y = (int)(segmentCenter.Y / 16f) * 16; + segmentTargetX -= segmentCenter.X; + segmentTargetY -= segmentCenter.Y; + + if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) + { + try + { + segmentCenter = NPC.Center; + segmentTargetX = Main.npc[(int)NPC.ai[1]].Center.X - segmentCenter.X; + segmentTargetY = Main.npc[(int)NPC.ai[1]].Center.Y - segmentCenter.Y; + } + catch + { + } + + NPC.rotation = (float)Math.Atan2(segmentTargetY, segmentTargetX) + MathHelper.PiOver2; + float segmentTargetDist = (float)Math.Sqrt(segmentTargetX * segmentTargetX + segmentTargetY * segmentTargetY); + int segmentWidth = NPC.width; + segmentTargetDist = (segmentTargetDist - segmentWidth) / segmentTargetDist; + segmentTargetX *= segmentTargetDist; + segmentTargetY *= segmentTargetDist; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + segmentTargetX; + NPC.position.Y = NPC.position.Y + segmentTargetY; + + if (segmentTargetX < 0f) + NPC.spriteDirection = -1; + else if (segmentTargetX > 0f) + NPC.spriteDirection = 1; + } + + // Play spawn sound on Deus on the first frame because otherwise the sound wouldn't play properly in multiplayer + if (calamityGlobalNPC.newAI[1] == 0f && !doubleWormPhase) + { + SoundEngine.PlaySound(AstrumDeusHead.SpawnSound, NPC.Center); + calamityGlobalNPC.newAI[1] = 1f; + } + + // 5 seconds of resistance in phase 2, 10 seconds in phase 1, to prevent spawn killing + if (calamityGlobalNPC.newAI[1] < resistanceTime && ((NPC.position - NPC.oldPosition).Length() > 2f || calamityGlobalNPC.newAI[1] > 1f)) + calamityGlobalNPC.newAI[1] += 1f; + + // Calculate contact damage based on velocity + if (!doNotDealDamage) + { + float minimalContactDamageVelocity = segmentVelocity * 0.25f; + float minimalDamageVelocity = segmentVelocity * 0.5f; + float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); + if (bodyAndTailVelocity <= minimalContactDamageVelocity) + NPC.damage = 0; + else + { + float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); + NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); + } + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) diff --git a/NPCs/BrimstoneElemental/BrimstoneElemental.cs b/NPCs/BrimstoneElemental/BrimstoneElemental.cs index 7bec19de5f..82f36a3842 100644 --- a/NPCs/BrimstoneElemental/BrimstoneElemental.cs +++ b/NPCs/BrimstoneElemental/BrimstoneElemental.cs @@ -15,7 +15,6 @@ using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Summon; -using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Enemy; using CalamityMod.World; diff --git a/NPCs/Bumblebirb/DraconicSwarmer.cs b/NPCs/Bumblebirb/DraconicSwarmer.cs index f2156037e7..803380b88f 100644 --- a/NPCs/Bumblebirb/DraconicSwarmer.cs +++ b/NPCs/Bumblebirb/DraconicSwarmer.cs @@ -1,5 +1,4 @@ -using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; -using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.Boss; using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; diff --git a/NPCs/CalamityAIs/CalamityBossAIs/AquaticScourgeAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/AquaticScourgeAI.cs deleted file mode 100644 index a8f6e79f8c..0000000000 --- a/NPCs/CalamityAIs/CalamityBossAIs/AquaticScourgeAI.cs +++ /dev/null @@ -1,628 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.CalPlayer; -using CalamityMod.Dusts; -using CalamityMod.Events; -using CalamityMod.NPCs.Abyss; -using CalamityMod.NPCs.AquaticScourge; -using CalamityMod.NPCs.AstrumAureus; -using CalamityMod.NPCs.AstrumDeus; -using CalamityMod.NPCs.BrimstoneElemental; -using CalamityMod.NPCs.Bumblebirb; -using CalamityMod.NPCs.CalClone; -using CalamityMod.NPCs.CeaselessVoid; -using CalamityMod.NPCs.Crags; -using CalamityMod.NPCs.NormalNPCs; -using CalamityMod.NPCs.OldDuke; -using CalamityMod.NPCs.SulphurousSea; -using CalamityMod.NPCs.SunkenSea; -using CalamityMod.Projectiles.Boss; -using CalamityMod.Projectiles.Enemy; -using CalamityMod.Sounds; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs -{ - public static class AquaticScourgeAI - { - public static void VanillaAquaticScourgeAI(NPC npc, Mod mod, bool head) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; - - bool getFuckedAI = Main.zenithWorld; - - if (head) - CalamityGlobalNPC.aquaticScourge = npc.whoAmI; - - // Adjust hostility and stats - bool nonHostile = calamityGlobalNPC.newAI[0] == 0f; - if (npc.justHit || npc.life <= npc.lifeMax * 0.999 || bossRush || Main.getGoodWorld) - { - if (nonHostile) - { - // Kiss my motherfucking ass you piece of shit game - npc.timeLeft *= 20; - npc.npcSlots = 16f; - CalamityGlobalNPC.BossKillTimes.TryGetValue(npc.type, out int revKillTime); - calamityGlobalNPC.KillTime = revKillTime; - calamityGlobalNPC.newAI[0] = 1f; - nonHostile = false; - npc.boss = head; - npc.chaseable = true; - npc.netUpdate = true; - } - } - else - npc.damage = 0; - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - // Phases - bool phase2 = lifeRatio < 0.75f; - bool phase3 = lifeRatio < 0.5f; - bool phase4 = lifeRatio < 0.25f; - - // Set worm variable - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; - - if (!head) - { - if (npc.life > Main.npc[(int)npc.ai[1]].life) - npc.life = Main.npc[(int)npc.ai[1]].life; - } - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); - - Player player = Main.player[npc.target]; - - bool notOcean = player.position.Y < 300f || - player.position.Y > Main.worldSurface * 16.0 || - (player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680)); - - // Check for the flipped Abyss - if (Main.remixWorld) - { - notOcean = player.position.Y < Main.UnderworldLayer * 0.8f || player.position.Y > Main.UnderworldLayer || - (player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680)); - } - - // Enrage - if (head) - { - if (notOcean && !player.Calamity().ZoneSulphur && !bossRush) - { - if (npc.localAI[2] > 0f) - npc.localAI[2] -= 1f; - } - else - npc.localAI[2] = CalamityGlobalNPC.biomeEnrageTimerMax; - } - - bool biomeEnraged = npc.localAI[2] <= 0f || bossRush; - - float enrageScale = bossRush ? 1f : 0f; - if (biomeEnraged) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 2f; - } - - // Circular movement - float colorFadeTimeAfterSpiral = 90f; - float spiralGateValue = 480f; - bool doSpiral = false; - if (head && calamityGlobalNPC.newAI[0] == 1f && calamityGlobalNPC.newAI[2] == 1f && (revenge || getFuckedAI)) - { - doSpiral = calamityGlobalNPC.newAI[1] == 0f && calamityGlobalNPC.newAI[3] >= spiralGateValue; - if (Vector2.Distance(npc.Center, player.Center) < (getFuckedAI ? 1600f : 1000f) || doSpiral) - calamityGlobalNPC.newAI[3] += 1f; - - if (doSpiral) - { - npc.localAI[3] = colorFadeTimeAfterSpiral; - - // Vomit acid mist - float acidMistBarfDivisor = getFuckedAI ? 2f : ((float)Math.Floor(bossRush ? 4f : death ? 5f : 6f) * (phase3 ? 1.5f : 1f)); - if (calamityGlobalNPC.newAI[3] % acidMistBarfDivisor == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float mistVelocity = death ? 10f : 8f; - Vector2 projectileVelocity = (npc.Center + npc.velocity * 10f - npc.Center).SafeNormalize(Vector2.UnitY); - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity * 5f, projectileVelocity * mistVelocity, type, damage, 0f, Main.myPlayer); - Main.projectile[proj].tileCollide = false; - Main.projectile[proj].timeLeft = getFuckedAI ? 240 : 600; - } - } - - // Vomit circular spreads of acid clouds while in phase 3 - float toxicCloudBarfDivisor = bossRush ? 20f : death ? 30f : 40f; - if (calamityGlobalNPC.newAI[3] % toxicCloudBarfDivisor == 0f && phase3) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - int totalProjectiles = (phase4 ? 6 : 9) + (getFuckedAI ? Main.rand.Next(-2, 3) : (int)((calamityGlobalNPC.newAI[3] - spiralGateValue) / toxicCloudBarfDivisor) * (phase4 ? 2 : 3)); - float radians = MathHelper.TwoPi / totalProjectiles; - float cloudVelocity = 1f + enrageScale; - Vector2 spinningPoint = new Vector2(0f, -cloudVelocity); - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + vector255.SafeNormalize(Vector2.UnitY) * 5f, vector255, type, damage, 0f, Main.myPlayer); - } - } - } - - // Velocity boost - if (calamityGlobalNPC.newAI[3] == spiralGateValue) - { - npc.velocity = npc.velocity.SafeNormalize(Vector2.UnitY); - npc.velocity *= 24f; - } - - // Spin velocity - float velocity = (float)(Math.PI * 2D) / 120f; - // In GFB, contracts the radius as the fight progresses - if (getFuckedAI) - velocity *= phase3 ? 1.5f : phase2 ? 1.25f : 1f; - npc.velocity = npc.velocity.RotatedBy(-(double)velocity * npc.localAI[1]); - // Speed up even more in GFB for more radius - if (getFuckedAI && npc.velocity.Length() <= 32f) - npc.velocity *= 1.1f; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; - - // Reset and charge at target - // Don't reset in GFB - if (!getFuckedAI && calamityGlobalNPC.newAI[3] >= spiralGateValue + 120f) - { - calamityGlobalNPC.newAI[3] = 0f; - npc.TargetClosest(); - } - } - else - { - if (!Collision.CanHit(npc.Center, 1, 1, player.position, player.width, player.height) && calamityGlobalNPC.newAI[3] > 300f) - calamityGlobalNPC.newAI[3] -= 2f; - - if (npc.localAI[3] > 0f) - npc.localAI[3] -= 1f; - - npc.localAI[1] = npc.Center.X - player.Center.X < 0 ? 1f : -1f; - } - } - - // Adjust slowing debuff immunity - bool immuneToSlowingDebuffs = doSpiral || getFuckedAI; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; - npc.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; - - if (head) - { - // Spawn segments - if (calamityGlobalNPC.newAI[2] == 0f && npc.ai[0] == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int maxLength = getFuckedAI ? 24 : death ? 80 : revenge ? 40 : expertMode ? 35 : 30; - int Previous = npc.whoAmI; - for (int segments = 0; segments < maxLength; segments++) - { - int lol; - if (segments >= 0 && segments < maxLength - 1) - { - if (segments % 2 == 0) - lol = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType(), npc.whoAmI); - else - lol = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType(), npc.whoAmI); - } - else - lol = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType(), npc.whoAmI); - - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = npc.whoAmI; - Main.npc[lol].ai[1] = Previous; - Main.npc[Previous].ai[0] = lol; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol); - Previous = lol; - } - } - - calamityGlobalNPC.newAI[2] = 1f; - } - - // Big barf attack - if (calamityGlobalNPC.newAI[0] == 1f && (!doSpiral && phase2) || (getFuckedAI && !phase3)) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= (revenge ? 360f : 420f)) - { - if (Vector2.Distance(player.Center, npc.Center) > 320f) - { - npc.localAI[0] = 0f; - npc.netUpdate = true; - SoundEngine.PlaySound(SoundID.NPCDeath13, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int totalProjectiles = bossRush ? 10 : expertMode ? 8 : 6; - if (phase3) - totalProjectiles *= 2; - - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - for (int i = 0; i < totalProjectiles; i++) - { - Vector2 velocity = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); - velocity = velocity.SafeNormalize(Vector2.UnitY); - velocity *= Main.rand.Next(phase3 ? 300 : 100, 401) * 0.01f; - - float maximumVelocityMult = death ? 0.75f : 0.5f; - if (expertMode) - velocity *= 1f + (maximumVelocityMult * (0.5f - lifeRatio)); - - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + velocity.SafeNormalize(Vector2.UnitY) * 5f, velocity, type, damage, 0f, Main.myPlayer); - } - } - } - } - } - } - - // Fire teeth depending on body type - else - { - if (calamityGlobalNPC.newAI[0] == 1f && (!phase3 || phase4)) - { - npc.localAI[0] += 1f; - float shootProjectile = 300; - float timer = npc.ai[0] + 15f; - float divisor = timer + shootProjectile; - - if (npc.type == ModContent.NPCType()) - { - if (npc.localAI[0] % divisor == 0f && (npc.ai[0] % 3f == 0f || getFuckedAI || !death)) - { - npc.TargetClosest(); - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - SoundEngine.PlaySound(SoundID.Item17, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float toothVelocity = death ? 9f : 8f; - Vector2 projectileVelocity = (player.Center - npc.Center).SafeNormalize(Vector2.UnitY); - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - float accelerate = phase4 ? 1f : 0f; - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity * 5f, projectileVelocity * toothVelocity, type, damage, 0f, Main.myPlayer, accelerate, 0f); - } - - npc.netUpdate = true; - } - } - } - } - } - - // Kill body and tail - if (!head) - { - bool shouldDespawn = true; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) - { - shouldDespawn = false; - break; - } - } - if (!shouldDespawn) - { - if (npc.ai[1] <= 0f) - shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) - shouldDespawn = true; - } - if (shouldDespawn) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; - } - } - else - { - if (npc.life > Main.npc[(int)npc.ai[0]].life) - npc.life = Main.npc[(int)npc.ai[0]].life; - } - - float maxDistance = calamityGlobalNPC.newAI[0] == 1f ? 12800f : 6400f; - if (player.dead || Vector2.Distance(npc.Center, player.Center) > maxDistance || (nonHostile && biomeEnraged)) - { - calamityGlobalNPC.newAI[1] = 1f; - npc.TargetClosest(false); - npc.velocity.Y += 2f; - - if (npc.position.Y > Main.worldSurface * 16D) - npc.velocity.Y += 2f; - - if (npc.position.Y > Main.worldSurface * 16D) - { - for (int a = 0; a < Main.npc.Length; a++) - { - int type = Main.npc[a].type; - if (type == ModContent.NPCType() || type == ModContent.NPCType() || type == ModContent.NPCType() || type == ModContent.NPCType()) - Main.npc[a].active = false; - } - } - } - else - calamityGlobalNPC.newAI[1] = 0f; - - // Change direction - if (npc.velocity.X < 0f) - npc.spriteDirection = -1; - else if (npc.velocity.X > 0f) - npc.spriteDirection = 1; - - // Alpha changes - if (head || Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; - } - - Vector2 scourgePosition = npc.Center; - Vector2 predictionVector = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? Main.player[npc.target].velocity * 20f : Vector2.Zero; - float scourgeTargetX = player.Center.X + predictionVector.X; - float scourgeTargetY = player.Center.Y + predictionVector.Y; - - // Velocity and movement - float scourgeMaxSpeed = 5f; - float scourgeAcceleration = 0.08f; - if (calamityGlobalNPC.newAI[0] == 1f) - { - scourgeMaxSpeed = revenge ? 14.4f : 12f; - scourgeAcceleration = revenge ? 0.18f : 0.15f; - if (expertMode) - { - scourgeMaxSpeed += 2.4f * (1f - lifeRatio); - scourgeAcceleration += 0.03f * (1f - lifeRatio); - } - scourgeMaxSpeed += 3f * enrageScale; - scourgeAcceleration += 0.06f * enrageScale; - if (death || getFuckedAI) - { - scourgeMaxSpeed += 5f; - scourgeAcceleration -= getFuckedAI ? 0f : 0.03f; - scourgeMaxSpeed += Vector2.Distance(player.Center, npc.Center) * 0.001f; - scourgeAcceleration += Vector2.Distance(player.Center, npc.Center) * 0.000045f; - } - - // Increase acceleration after spiral attack - if (npc.localAI[3] > 0f) - { - float accelerationMultiplier = MathHelper.Lerp(1f, 2f, npc.localAI[3] / colorFadeTimeAfterSpiral); - scourgeAcceleration *= accelerationMultiplier; - } - - if (Main.getGoodWorld) - { - scourgeMaxSpeed *= 1.15f; - scourgeAcceleration *= 1.15f; - } - } - - if (head && !doSpiral) - { - if (calamityGlobalNPC.newAI[0] != 1f) - { - scourgeTargetY += 400; - if (Math.Abs(npc.Center.X - player.Center.X) < 500f) - { - if (npc.velocity.X > 0f) - scourgeTargetX = player.Center.X + 600f; - else - scourgeTargetX = player.Center.X - 600f; - } - } - - float scourgeHigherSpeed = scourgeMaxSpeed * 1.3f; - float scourgeLowerSpeed = scourgeMaxSpeed * 0.7f; - float scourgeSpeed = npc.velocity.Length(); - if (scourgeSpeed > 0f) - { - if (scourgeSpeed > scourgeHigherSpeed) - { - npc.velocity = npc.velocity.SafeNormalize(Vector2.UnitY); - npc.velocity *= scourgeHigherSpeed; - } - else if (scourgeSpeed < scourgeLowerSpeed) - { - npc.velocity = npc.velocity.SafeNormalize(Vector2.UnitY); - npc.velocity *= scourgeLowerSpeed; - } - } - } - - scourgeTargetX = (int)(scourgeTargetX / 16f) * 16; - scourgeTargetY = (int)(scourgeTargetY / 16f) * 16; - scourgePosition.X = (int)(scourgePosition.X / 16f) * 16; - scourgePosition.Y = (int)(scourgePosition.Y / 16f) * 16; - scourgeTargetX -= scourgePosition.X; - scourgeTargetY -= scourgePosition.Y; - float scourgeTargetDist = (float)Math.Sqrt(scourgeTargetX * scourgeTargetX + scourgeTargetY * scourgeTargetY); - - if (!head) - { - if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) - { - try - { - scourgePosition = npc.Center; - scourgeTargetX = Main.npc[(int)npc.ai[1]].Center.X - scourgePosition.X; - scourgeTargetY = Main.npc[(int)npc.ai[1]].Center.Y - scourgePosition.Y; - } - catch - { - } - - npc.rotation = (float)Math.Atan2(scourgeTargetY, scourgeTargetX) + MathHelper.PiOver2; - scourgeTargetDist = (float)Math.Sqrt(scourgeTargetX * scourgeTargetX + scourgeTargetY * scourgeTargetY); - int scourgeWidth = npc.width; - scourgeTargetDist = (scourgeTargetDist - scourgeWidth) / scourgeTargetDist; - scourgeTargetX *= scourgeTargetDist; - scourgeTargetY *= scourgeTargetDist; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + scourgeTargetX; - npc.position.Y = npc.position.Y + scourgeTargetY; - - if (scourgeTargetX < 0f) - npc.spriteDirection = -1; - else if (scourgeTargetX > 0f) - npc.spriteDirection = 1; - } - } - else if (!doSpiral) - { - float scourgeAbsoluteTargetX = Math.Abs(scourgeTargetX); - float scourgeAbsoluteTargetY = Math.Abs(scourgeTargetY); - float scourgeTimeToReachTarget = scourgeMaxSpeed / scourgeTargetDist; - scourgeTargetX *= scourgeTimeToReachTarget; - scourgeTargetY *= scourgeTimeToReachTarget; - - if ((npc.velocity.X > 0f && scourgeTargetX > 0f) || (npc.velocity.X < 0f && scourgeTargetX < 0f) || (npc.velocity.Y > 0f && scourgeTargetY > 0f) || (npc.velocity.Y < 0f && scourgeTargetY < 0f)) - { - if (npc.velocity.X < scourgeTargetX) - { - npc.velocity.X += scourgeAcceleration; - } - else - { - if (npc.velocity.X > scourgeTargetX) - npc.velocity.X -= scourgeAcceleration; - } - - if (npc.velocity.Y < scourgeTargetY) - { - npc.velocity.Y += scourgeAcceleration; - } - else - { - if (npc.velocity.Y > scourgeTargetY) - npc.velocity.Y -= scourgeAcceleration; - } - - if (Math.Abs(scourgeTargetY) < scourgeMaxSpeed * 0.2 && ((npc.velocity.X > 0f && scourgeTargetX < 0f) || (npc.velocity.X < 0f && scourgeTargetX > 0f))) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y += scourgeAcceleration * 2f; - else - npc.velocity.Y -= scourgeAcceleration * 2f; - } - - if (Math.Abs(scourgeTargetX) < scourgeMaxSpeed * 0.2 && ((npc.velocity.Y > 0f && scourgeTargetY < 0f) || (npc.velocity.Y < 0f && scourgeTargetY > 0f))) - { - if (npc.velocity.X > 0f) - npc.velocity.X += scourgeAcceleration * 2f; - else - npc.velocity.X -= scourgeAcceleration * 2f; - } - } - else - { - if (scourgeAbsoluteTargetX > scourgeAbsoluteTargetY) - { - if (npc.velocity.X < scourgeTargetX) - npc.velocity.X += scourgeAcceleration * 1.1f; - else if (npc.velocity.X > scourgeTargetX) - npc.velocity.X -= scourgeAcceleration * 1.1f; - - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < scourgeMaxSpeed * 0.5) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y += scourgeAcceleration; - else - npc.velocity.Y -= scourgeAcceleration; - } - } - else - { - if (npc.velocity.Y < scourgeTargetY) - npc.velocity.Y += scourgeAcceleration * 1.1f; - else if (npc.velocity.Y > scourgeTargetY) - npc.velocity.Y -= scourgeAcceleration * 1.1f; - - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < scourgeMaxSpeed * 0.5) - { - if (npc.velocity.X > 0f) - npc.velocity.X += scourgeAcceleration; - else - npc.velocity.X -= scourgeAcceleration; - } - } - } - - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; - } - - // Calculate contact damage based on velocity - if (!nonHostile) - { - float minimalContactDamageVelocity = scourgeMaxSpeed * 0.25f; - float minimalDamageVelocity = scourgeMaxSpeed * 0.5f; - if (head) - { - if (npc.velocity.Length() <= minimalContactDamageVelocity) - { - npc.damage = (int)Math.Round(npc.defDamage * 0.5); - } - else - { - float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - npc.damage = (int)MathHelper.Lerp((float)Math.Round(npc.defDamage * 0.5), npc.defDamage, velocityDamageScalar); - } - } - else - { - float bodyAndTailVelocity = (npc.position - npc.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageVelocity) - { - npc.damage = 0; - } - else - { - float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - npc.damage = (int)MathHelper.Lerp(0f, npc.defDamage, velocityDamageScalar); - } - } - } - } - } -} diff --git a/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs deleted file mode 100644 index c7bc0300cc..0000000000 --- a/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs +++ /dev/null @@ -1,915 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.CalPlayer; -using CalamityMod.Dusts; -using CalamityMod.Events; -using CalamityMod.NPCs.Abyss; -using CalamityMod.NPCs.AquaticScourge; -using CalamityMod.NPCs.AstrumAureus; -using CalamityMod.NPCs.AstrumDeus; -using CalamityMod.NPCs.BrimstoneElemental; -using CalamityMod.NPCs.Bumblebirb; -using CalamityMod.NPCs.CalClone; -using CalamityMod.NPCs.CeaselessVoid; -using CalamityMod.NPCs.Crags; -using CalamityMod.NPCs.NormalNPCs; -using CalamityMod.NPCs.OldDuke; -using CalamityMod.NPCs.SulphurousSea; -using CalamityMod.NPCs.SunkenSea; -using CalamityMod.Packets; -using CalamityMod.Projectiles.Boss; -using CalamityMod.Projectiles.Enemy; -using CalamityMod.Sounds; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs -{ - public static class AstrumDeusAI - { - public static void VanillaAstrumDeusAI(NPC npc, Mod mod, bool head) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - // Difficulty variables - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; - - float enrageScale = bossRush ? 0.5f : 0f; - if (Main.IsItDay() || bossRush) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 1.5f; - } - - // Deus cannot hit for 3 seconds or while invulnerable - bool doNotDealDamage = calamityGlobalNPC.newAI[1] < 180f || npc.dontTakeDamage; - if (doNotDealDamage) - npc.damage = 0; - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); - - Player player = Main.player[npc.target]; - - bool increaseSpeed = Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles; - bool increaseSpeedMore = Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles; - - // Despawn safety, make sure to target another player if the current player target is too far away - if (increaseSpeedMore && head) - npc.TargetClosest(); - - // Inflict Extreme Gravity to nearby players - if (revenge) - { - if (!Main.dedServ) - { - if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && Vector2.Distance(Main.LocalPlayer.Center, npc.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) - Main.LocalPlayer.AddBuff(ModContent.BuffType(), 2); - } - } - - // Life - float lifeRatio = npc.life / (float)npc.lifeMax; - - // Phases based on life percentage - bool halfHealth = lifeRatio < 0.5f; - bool doubleWormPhase = calamityGlobalNPC.newAI[0] != 0f; - bool startFlightPhase = lifeRatio < 0.8f || death || doubleWormPhase; - bool phase2 = lifeRatio < 0.5f && doubleWormPhase && expertMode; - bool phase3 = lifeRatio < 0.2f && doubleWormPhase && expertMode; - bool splittingMines = lifeRatio < 0.7f; - bool movingMines = lifeRatio < 0.3f && doubleWormPhase && expertMode; - bool deathModeEnragePhase_Head = calamityGlobalNPC.newAI[0] == 3f; - bool deathModeEnragePhase_BodyAndTail = false; - - // 5 seconds of resistance in phase 2, 10 seconds in phase 1, to prevent spawn killing - float resistanceTime = doubleWormPhase ? 300f : 600f; - - calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = calamityGlobalNPC.newAI[1] < resistanceTime; - - // Flight timer - float aiSwitchTimer = doubleWormPhase ? (Main.getGoodWorld ? 600f : 1200f) : (Main.getGoodWorld ? 900f : 1800f); - - calamityGlobalNPC.newAI[3] += 1f; - if (calamityGlobalNPC.newAI[3] >= aiSwitchTimer) - calamityGlobalNPC.newAI[3] = 0f; - // Sound effect for swapping between attack behaviors in phase 2 - if (doubleWormPhase && calamityGlobalNPC.newAI[3] % aiSwitchTimer == 0f && !(deathModeEnragePhase_Head || deathModeEnragePhase_BodyAndTail)) - SoundEngine.PlaySound(AstrumDeusHead.SplitSound with { Pitch = -0.2f, Volume = 0.9f }, player.Center); - - // Phase for flying at the player - bool flyAtTarget = calamityGlobalNPC.newAI[3] >= (aiSwitchTimer * 0.5f) && startFlightPhase; - - // Length of worms - int phase1Length = death ? 80 : revenge ? 70 : expertMode ? 60 : 50; - int phase2Length = death ? 40 : revenge ? 35 : expertMode ? 30 : 25; - int gfbLength = death ? 8 : revenge ? 7 : expertMode ? 6 : 5; - int maxLength = Main.zenithWorld && doubleWormPhase ? gfbLength : doubleWormPhase ? phase2Length : phase1Length; - - // Become gradually more pissed as more worms are killed - int gfbMaxWormCount = 10; - int gfbWormCount = 0; - if (CalamityWorld.LegendaryMode && revenge) - gfbWormCount = NPC.CountNPCS(ModContent.NPCType()); - if (gfbWormCount > gfbMaxWormCount) - gfbWormCount = gfbMaxWormCount; - if (gfbWormCount > 0) - enrageScale += (gfbMaxWormCount - gfbWormCount) * 0.111f; - - // Split into two worms - if (head) - { - float splitAnimationTime = 180f; - bool oneWormAlive = NPC.CountNPCS(ModContent.NPCType()) < 2; - bool deathModeFinalWormEnrage = death && doubleWormPhase && oneWormAlive && calamityGlobalNPC.newAI[1] >= resistanceTime; - if (deathModeFinalWormEnrage) - { - if (calamityGlobalNPC.newAI[0] != 3f) - { - SoundEngine.PlaySound(AstrumDeusHead.SplitSound, player.Center); - calamityGlobalNPC.newAI[0] = 3f; - npc.defense = 12; - calamityGlobalNPC.DR = 0.075f; - - // Despawns the other deus worm segments - int bodyID = ModContent.NPCType(); - int tailID = ModContent.NPCType(); - for (int i = 0; i < Main.maxNPCs; i++) - { - NPC wormseg = Main.npc[i]; - if (!wormseg.active) - continue; - - if ((wormseg.type == bodyID || wormseg.type == tailID) && Main.npc[(int)wormseg.ai[2]].Calamity().newAI[0] != 3f) - { - wormseg.life = 0; - wormseg.active = false; - } - } - } - - calamityGlobalNPC.newAI[2] += 10f; - if (calamityGlobalNPC.newAI[2] > 162f) - calamityGlobalNPC.newAI[2] = 162f; - - npc.Opacity = MathHelper.Clamp(1f - (calamityGlobalNPC.newAI[2] / splitAnimationTime), 0f, 1f); - } - - bool despawnRemainingWorm = doubleWormPhase && oneWormAlive && !death; - if ((halfHealth && calamityGlobalNPC.newAI[0] == 0f) || despawnRemainingWorm) - { - npc.dontTakeDamage = true; - - calamityGlobalNPC.newAI[2] += despawnRemainingWorm ? 10f : 1f; - npc.Opacity = MathHelper.Clamp(1f - (calamityGlobalNPC.newAI[2] / splitAnimationTime), 0f, 1f); - - bool despawning = calamityGlobalNPC.newAI[2] == splitAnimationTime; - - // - // CODE TWEAKED BY: OZZATRON - // September 20th, 2020 - // reason: fixing Astrum Deus death mode NPC cap bug - // - - // Despawn the unsplit Astrum Deus and spawn two half-size Astrum Deus worms. - if (despawning) - { - // If this is already a split worm (newAI[0] != 0f) then don't do anything. At all. - if (doubleWormPhase) - return; - - // Mark all existing body and tail segments as inactive. This instantly frees up their NPC slots for the freshly spawned worms. - int bodyID = ModContent.NPCType(); - int tailID = ModContent.NPCType(); - for (int i = 0; i < Main.maxNPCs; i++) - { - NPC wormseg = Main.npc[i]; - if (!wormseg.active) - continue; - if (wormseg.type == bodyID || wormseg.type == tailID) - { - wormseg.life = 0; - wormseg.active = false; - } - } - - // The unsplit Astrum Deus worm head will die next frame. - npc.life = 0; - - // Do not spawn worms client side. The server handles this. - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int wormamt = Main.zenithWorld ? 5 : 1; - for (int i = 0; i < wormamt; i++) - { - // Now that the original worm doesn't exist, startCount can be zero. - // int startCount = npc.whoAmI + phase1Length + 1; - int startIndexHeadOne = 1; - int headOneID = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, npc.type, startIndexHeadOne); - Main.npc[headOneID].Calamity().newAI[0] = 1f; - Main.npc[headOneID].velocity = Vector2.Normalize(player.Center - Main.npc[headOneID].Center) * 16f; - Main.npc[headOneID].timeLeft *= 20; - Main.npc[headOneID].ForceNetUpdate(); - - // On server, immediately send the correct extra AI of this head to clients. - if (Main.dedServ) - { - SyncCalamityNPCAIArrayPacket.Send(Main.npc[headOneID]); - } - - // Make sure the second split worm is also contiguous. - int startIndexHeadTwo = startIndexHeadOne + phase2Length + 1; - int headTwoID = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, npc.type, startIndexHeadTwo); - Main.npc[headTwoID].Calamity().newAI[0] = 2f; - Main.npc[headTwoID].Calamity().newAI[3] = Main.getGoodWorld ? 300f : 600f; - Main.npc[headTwoID].velocity = Vector2.Normalize(player.Center - Main.npc[headTwoID].Center) * 16f; - Main.npc[headTwoID].timeLeft *= 20; - Main.npc[headTwoID].ForceNetUpdate(); - - // On server, immediately send the correct extra AI of this head to clients. - if (Main.dedServ) - { - SyncCalamityNPCAIArrayPacket.Send(Main.npc[headTwoID]); - } - } - - SoundEngine.PlaySound(AstrumDeusHead.SplitSound, player.Center); - } - return; - } - } - - if (Main.zenithWorld && calamityGlobalNPC.newAI[1] < 10f) // desync the deuses - { - float pushForce = 0.25f; - for (int k = 0; k < Main.maxNPCs; k++) - { - NPC otherDeus = Main.npc[k]; - // Short circuits to make the loop as fast as possible - if (!otherDeus.active || k == npc.whoAmI) - continue; - - // If the other projectile is indeed the same owned by the same player and they're too close, nudge them away. - bool sameProjType = otherDeus.type == npc.type; - float taxicabDist = Vector2.Distance(npc.Center, otherDeus.Center); - float distancegate = 320f; - if (sameProjType && taxicabDist < distancegate) - { - if (npc.position.X < otherDeus.position.X) - npc.velocity.X -= pushForce; - else - npc.velocity.X += pushForce; - - if (npc.position.Y < otherDeus.position.Y) - npc.velocity.Y -= pushForce; - else - npc.velocity.Y += pushForce; - } - } - } - } - - // Copy dontTakeDamage and Opacity from head - else - { - npc.dontTakeDamage = Main.npc[(int)npc.ai[2]].dontTakeDamage; - npc.Opacity = Main.npc[(int)npc.ai[2]].Opacity; - deathModeEnragePhase_BodyAndTail = Main.npc[(int)npc.ai[2]].Calamity().newAI[0] == 3f; - - if (deathModeEnragePhase_BodyAndTail) - { - npc.defense = 25; - calamityGlobalNPC.DR = 0.15f; - } - } - - // Set worm variable - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; - - // Alpha effects - if ((head || Main.npc[(int)npc.ai[1]].alpha < 128) && !npc.dontTakeDamage) - { - // Alpha changes - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; - } - - // Check if other segments are still alive, if not, die - if (!head) - { - bool shouldDespawn = true; - int headType = ModContent.NPCType(); - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].type != headType || !Main.npc[i].active) - continue; - shouldDespawn = false; - break; - } - if (shouldDespawn) - { - if (Main.npc.IndexInRange((int)npc.ai[1]) && Main.npc[(int)npc.ai[1]].active && Main.npc[(int)npc.ai[1]].life > 0) - shouldDespawn = false; - } - if (shouldDespawn) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; - npc.ForceNetUpdate(false); - } - } - - // Direction - if (npc.velocity.X < 0f) - npc.spriteDirection = -1; - else if (npc.velocity.X > 0f) - npc.spriteDirection = 1; - - // Head code - if (head) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (npc.ai[0] == 0f) - { - int Previous = npc.whoAmI; - int bodyType = ModContent.NPCType(); - int tailType = ModContent.NPCType(); - for (int segments = 0; segments < maxLength; segments++) - { - int lol; - if (segments >= 0 && segments < maxLength - 1) - lol = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, bodyType, npc.whoAmI); - else - lol = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, tailType, npc.whoAmI); - - if (segments % 2 == 0) - Main.npc[lol].localAI[3] = 1f; - - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].Calamity().newAI[0] = Main.npc[Previous].Calamity().newAI[0]; - Main.npc[lol].Calamity().newAI[3] = Main.npc[Previous].Calamity().newAI[3]; - - if (Main.dedServ) - { - SyncCalamityNPCAIArrayPacket.Send(Main.npc[lol]); - } - - Main.npc[lol].ai[3] = segments + 1; - Main.npc[lol].ai[2] = npc.whoAmI; - Main.npc[lol].ai[1] = Previous; - Main.npc[Previous].ai[0] = lol; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol); - Previous = lol; - } - } - } - - if (npc.life > Main.npc[(int)npc.ai[0]].life) - npc.life = Main.npc[(int)npc.ai[0]].life; - } - else - { - if (npc.life > Main.npc[(int)npc.ai[1]].life) - npc.life = Main.npc[(int)npc.ai[1]].life; - } - - bool hasJustSpawned = calamityGlobalNPC.newAI[1] < resistanceTime * 0.4f && !doubleWormPhase; // Speed boost for the first 4 seconds after spawning - float segmentVelocity = hasJustSpawned ? 25f : deathModeEnragePhase_Head ? 19f : death ? 17.5f : 16f; - - float segmentVelocityBoost = 5f * (1f - lifeRatio); - segmentVelocity += segmentVelocityBoost; - segmentVelocity += 4f * enrageScale; - - if (revenge) - { - float revMultiplier = 1.1f; - segmentVelocity *= revMultiplier; - } - - if (head) - { - int headTilePositionX = (int)(npc.position.X / 16f) - 1; - int headTileWidthPosX = (int)((npc.position.X + npc.width) / 16f) + 2; - int headTilePositionY = (int)(npc.position.Y / 16f) - 1; - int headTileWidthPosY = (int)((npc.position.Y + npc.height) / 16f) + 2; - - if (headTilePositionX < 0) - headTilePositionX = 0; - if (headTileWidthPosX > Main.maxTilesX) - headTileWidthPosX = Main.maxTilesX; - if (headTilePositionY < 0) - headTilePositionY = 0; - if (headTileWidthPosY > Main.maxTilesY) - headTileWidthPosY = Main.maxTilesY; - - // Fly or not - bool shouldFly = flyAtTarget; - if (!shouldFly) - { - for (int k = headTilePositionX; k < headTileWidthPosX; k++) - { - for (int l = headTilePositionY; l < headTileWidthPosY; l++) - { - if (Main.tile[k, l] != null && ((Main.tile[k, l].HasUnactuatedTile && (Main.tileSolid[Main.tile[k, l].TileType] || (Main.tileSolidTop[Main.tile[k, l].TileType] && Main.tile[k, l].TileFrameY == 0))) || Main.tile[k, l].LiquidAmount > 64)) - { - Vector2 vector2; - vector2.X = k * 16f; - vector2.Y = l * 16f; - if (npc.position.X + npc.width > vector2.X && npc.position.X < vector2.X + 16f && npc.position.Y + npc.height > vector2.Y && npc.position.Y < vector2.Y + 16f) - { - shouldFly = true; - break; - } - } - } - } - } - - // Start flying if target is not within a certain distance - if (!shouldFly) - { - npc.localAI[1] = 1f; - - Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int noFlyZone = 200; - int heightReduction = death ? 130 : (int)(130f * (1f - lifeRatio)); - int height = 400 - heightReduction; - bool outsideNoFlyZone = true; - - if (npc.position.Y > player.position.Y) - { - for (int m = 0; m < Main.maxPlayers; m++) - { - if (Main.player[m].active) - { - Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - noFlyZone, (int)Main.player[m].position.Y - noFlyZone, noFlyZone * 2, height); - if (rectangle.Intersects(rectangle2)) - { - outsideNoFlyZone = false; - break; - } - } - } - - if (outsideNoFlyZone) - shouldFly = true; - } - } - else - npc.localAI[1] = 0f; - - // Despawn - if (player.dead) - { - shouldFly = false; - float velocity = 2f; - npc.velocity.Y -= velocity; - if ((double)npc.position.Y < Main.topWorld + 16f) - { - segmentVelocity *= 2f; - npc.velocity.Y -= velocity; - } - - int headType = ModContent.NPCType(); - int bodyType = ModContent.NPCType(); - int tailType = ModContent.NPCType(); - if ((double)npc.position.Y < Main.topWorld + 16f) - { - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].type == headType || Main.npc[i].type == bodyType || Main.npc[i].type == tailType) - { - Main.npc[i].active = false; - Main.npc[i].ForceNetUpdate(false); - } - } - } - } - - // Speed and movement - float speedBoost = death ? (0.1f * (1f - lifeRatio)) : (0.13f * (1f - lifeRatio)); - float turnSpeedBoost = death ? (0.18f * (1f - lifeRatio)) : (0.2f * (1f - lifeRatio)); - float speed = (hasJustSpawned ? 0.26f : deathModeEnragePhase_Head ? 0.2f : death ? 0.18f : 0.13f) + speedBoost; - float turnSpeed = (hasJustSpawned ? 0.3f : deathModeEnragePhase_Head ? 0.27f : death ? 0.25f : 0.2f) + turnSpeedBoost; - speed += 0.05f * enrageScale; - turnSpeed += 0.08f * enrageScale; - - if (flyAtTarget) - { - float speedMultiplier = deathModeEnragePhase_Head ? 1.25f : doubleWormPhase ? (phase3 ? 1.25f : phase2 ? 1.2f : 1.15f) : 1f; - speed *= speedMultiplier; - } - - if (revenge) - { - float revMultiplier = 1.1f; - speed *= revMultiplier; - turnSpeed *= revMultiplier; - } - - speed *= increaseSpeedMore ? 2f : increaseSpeed ? 1.5f : 1f; - turnSpeed *= increaseSpeedMore ? 2f : increaseSpeed ? 1.5f : 1f; - - if (Main.getGoodWorld) - { - speed *= 1.15f; - turnSpeed *= 1.15f; - } - - Vector2 deusCenter = npc.Center; - float deusTargetX = player.Center.X; - float deusTargetY = player.Center.Y; - deusTargetX = (int)(deusTargetX / 16f) * 16; - deusTargetY = (int)(deusTargetY / 16f) * 16; - deusCenter.X = (int)(deusCenter.X / 16f) * 16; - deusCenter.Y = (int)(deusCenter.Y / 16f) * 16; - deusTargetX -= deusCenter.X; - deusTargetY -= deusCenter.Y; - - if (!shouldFly) - { - npc.velocity.Y += 0.15f; - if (npc.velocity.Y > segmentVelocity) - npc.velocity.Y = segmentVelocity; - - // This bool exists to stop the strange wiggle behavior when worms are falling down - bool slowXVelocity = Math.Abs(npc.velocity.X) > speed; - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < segmentVelocity * 0.4) - { - if (npc.velocity.X < 0f) - npc.velocity.X -= speed * 1.1f; - else - npc.velocity.X += speed * 1.1f; - } - else if (npc.velocity.Y == segmentVelocity) - { - if (slowXVelocity) - { - if (npc.velocity.X < deusTargetX) - npc.velocity.X += speed; - else if (npc.velocity.X > deusTargetX) - npc.velocity.X -= speed; - } - else - npc.velocity.X = 0f; - } - else if (npc.velocity.Y > 4f) - { - if (slowXVelocity) - { - if (npc.velocity.X < 0f) - npc.velocity.X += speed * 0.9f; - else - npc.velocity.X -= speed * 0.9f; - } - else - npc.velocity.X = 0f; - } - } - else - { - float deusTargetDist = (float)Math.Sqrt(deusTargetX * deusTargetX + deusTargetY * deusTargetY); - float deusAbsoluteTargetX = Math.Abs(deusTargetX); - float deusAbsoluteTargetY = Math.Abs(deusTargetY); - float deusTimeToReachTarget = segmentVelocity / deusTargetDist; - deusTargetX *= deusTimeToReachTarget; - deusTargetY *= deusTimeToReachTarget; - - bool speedUpWhileFlying = false; - if (flyAtTarget) - { - if (((npc.velocity.X > 0f && deusTargetX < 0f) || (npc.velocity.X < 0f && deusTargetX > 0f) || (npc.velocity.Y > 0f && deusTargetY < 0f) || (npc.velocity.Y < 0f && deusTargetY > 0f)) && Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) > speed / 2f && deusTargetDist < 400f) - { - speedUpWhileFlying = true; - - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < segmentVelocity) - npc.velocity *= 1.1f; - } - - if (npc.position.Y > player.position.Y) - { - speedUpWhileFlying = true; - - if (Math.Abs(npc.velocity.X) < segmentVelocity / 2f) - { - if (npc.velocity.X == 0f) - npc.velocity.X -= npc.direction; - - npc.velocity.X *= 1.1f; - } - else if (npc.velocity.Y > -segmentVelocity) - npc.velocity.Y -= speed; - } - } - - if (!speedUpWhileFlying) - { - if (!flyAtTarget) - { - if (((npc.velocity.X > 0f && deusTargetX > 0f) || (npc.velocity.X < 0f && deusTargetX < 0f)) && ((npc.velocity.Y > 0f && deusTargetY > 0f) || (npc.velocity.Y < 0f && deusTargetY < 0f))) - { - if (npc.velocity.X < deusTargetX) - npc.velocity.X += turnSpeed; - else if (npc.velocity.X > deusTargetX) - npc.velocity.X -= turnSpeed; - - if (npc.velocity.Y < deusTargetY) - npc.velocity.Y += turnSpeed; - else if (npc.velocity.Y > deusTargetY) - npc.velocity.Y -= turnSpeed; - } - } - - if ((npc.velocity.X > 0f && deusTargetX > 0f) || (npc.velocity.X < 0f && deusTargetX < 0f) || (npc.velocity.Y > 0f && deusTargetY > 0f) || (npc.velocity.Y < 0f && deusTargetY < 0f)) - { - if (npc.velocity.X < deusTargetX) - npc.velocity.X += speed; - else if (npc.velocity.X > deusTargetX) - npc.velocity.X -= speed; - - if (npc.velocity.Y < deusTargetY) - npc.velocity.Y += speed; - else if (npc.velocity.Y > deusTargetY) - npc.velocity.Y -= speed; - - if (Math.Abs(deusTargetY) < segmentVelocity * 0.2 && ((npc.velocity.X > 0f && deusTargetX < 0f) || (npc.velocity.X < 0f && deusTargetX > 0f))) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y += speed * 2f; - else - npc.velocity.Y -= speed * 2f; - } - - if (Math.Abs(deusTargetX) < segmentVelocity * 0.2 && ((npc.velocity.Y > 0f && deusTargetY < 0f) || (npc.velocity.Y < 0f && deusTargetY > 0f))) - { - if (npc.velocity.X > 0f) - npc.velocity.X += speed * 2f; - else - npc.velocity.X -= speed * 2f; - } - } - else if (deusAbsoluteTargetX > deusAbsoluteTargetY) - { - if (npc.velocity.X < deusTargetX) - npc.velocity.X += speed * 1.1f; - else if (npc.velocity.X > deusTargetX) - npc.velocity.X -= speed * 1.1f; - - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < segmentVelocity * 0.5) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y += speed; - else - npc.velocity.Y -= speed; - } - } - else - { - if (npc.velocity.Y < deusTargetY) - npc.velocity.Y += speed * 1.1f; - else if (npc.velocity.Y > deusTargetY) - npc.velocity.Y -= speed * 1.1f; - - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < segmentVelocity * 0.5) - { - if (npc.velocity.X > 0f) - npc.velocity.X += speed; - else - npc.velocity.X -= speed; - } - } - } - } - - if (shouldFly) - { - if (npc.localAI[0] != 1f) - npc.ForceNetUpdate(false); - - npc.localAI[0] = 1f; - } - else - { - if (npc.localAI[0] != 0f) - npc.ForceNetUpdate(false); - - npc.localAI[0] = 0f; - } - - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - npc.ForceNetUpdate(false); - - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; - } - - // Only the main worm body and tail use this code - else - { - // Shoot lasers - if (npc.type == ModContent.NPCType()) - { - npc.localAI[0] += 1f; - - int shootTime = (doubleWormPhase && expertMode) ? 2 : 1; - float shootProjectile = (doubleWormPhase && expertMode) ? 200 : 400; - float timer = npc.ai[0] + 15f; - float divisor = timer + shootProjectile; - bool canFireProjectiles = npc.Opacity >= 1f; - bool shootGodRays = phase2 || deathModeEnragePhase_BodyAndTail; - - if (canFireProjectiles) - { - if (!flyAtTarget || deathModeEnragePhase_BodyAndTail) - { - float laserDivisor = (phase2 && !deathModeEnragePhase_BodyAndTail) ? 4f : 2f; - if (npc.localAI[0] % divisor == 0f && npc.ai[0] % laserDivisor == 0f) - { - npc.TargetClosest(); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (deathModeEnragePhase_BodyAndTail) - { - Vector2 velocity = Vector2.Zero; - if (movingMines) - { - Vector2 randomMineMovement = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); - randomMineMovement.Normalize(); - randomMineMovement *= Main.rand.Next(90, 121) * 0.01f; - velocity = randomMineMovement; - } - - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - float split = (splittingMines && npc.ai[0] % 3f == 0f) ? 1f : 0f; - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity, type, damage, 0f, Main.myPlayer, split, 0f); - } - } - - if (Vector2.Distance(player.Center, npc.Center) > 80f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float deusLaserSpeed = (death ? 16f : revenge ? 14f : 13f) + enrageScale * 4f; - - Vector2 deusLaserCenter = npc.Center; - float deusLaserTargetX = player.Center.X - deusLaserCenter.X; - float deusLaserTargetY = player.Center.Y - deusLaserCenter.Y; - float deusLaserTargetDist = (float)Math.Sqrt(deusLaserTargetX * deusLaserTargetX + deusLaserTargetY * deusLaserTargetY); - deusLaserTargetDist = deusLaserSpeed / deusLaserTargetDist; - deusLaserTargetX *= deusLaserTargetDist; - deusLaserTargetY *= deusLaserTargetDist; - deusLaserCenter.X += deusLaserTargetX * 5f; - deusLaserCenter.Y += deusLaserTargetY * 5f; - - Vector2 shootDirection = new Vector2(deusLaserTargetX, deusLaserTargetY).SafeNormalize(Vector2.UnitY); - Vector2 laserVelocity = shootDirection * deusLaserSpeed; - - int type = shootGodRays ? ModContent.ProjectileType() : ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - if (shootGodRays) - { - SoundEngine.PlaySound(AstrumDeusHead.GodRaySound, npc.Center); - // Waving beams need to start offset so they cross each other neatly. - float waveSideOffset = Main.rand.NextFloat(9f, 14f); - Vector2 perp = shootDirection.RotatedBy(-MathHelper.PiOver2) * waveSideOffset; - - for (int i = -1; i <= 1; i += 2) - { - Vector2 laserStartPos = deusLaserCenter + i * perp + Main.rand.NextVector2CircularEdge(6f, 6f); - Projectile godRay = Projectile.NewProjectileDirect(npc.GetSource_FromAI(), laserStartPos, laserVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); - - // Tell this Phased God Ray exactly which way it should be waving. - godRay.localAI[1] = i * 0.5f; - } - } - else - { - SoundEngine.PlaySound(AstrumDeusHead.LaserSound, npc.Center); - Projectile.NewProjectile(npc.GetSource_FromAI(), deusLaserCenter, laserVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); - } - } - } - } - } - else - { - if (npc.localAI[0] % divisor == 0f && npc.ai[0] % 2f == 0f) - { - Vector2 velocity = Vector2.Zero; - if (movingMines) - { - Vector2 randomMineMovement = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); - randomMineMovement.Normalize(); - randomMineMovement *= Main.rand.Next(30, 121) * 0.01f; - velocity = randomMineMovement; - } - - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - float split = (splittingMines && npc.ai[0] % 3f == 0f) ? 1f : 0f; - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity, type, damage, 0f, Main.myPlayer, split, 0f); - } - } - } - } - - // Follow the head - Vector2 segmentCenter = npc.Center; - float segmentTargetX = player.Center.X; - float segmentTargetY = player.Center.Y; - segmentTargetX = (int)(segmentTargetX / 16f) * 16; - segmentTargetY = (int)(segmentTargetY / 16f) * 16; - segmentCenter.X = (int)(segmentCenter.X / 16f) * 16; - segmentCenter.Y = (int)(segmentCenter.Y / 16f) * 16; - segmentTargetX -= segmentCenter.X; - segmentTargetY -= segmentCenter.Y; - - if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) - { - try - { - segmentCenter = npc.Center; - segmentTargetX = Main.npc[(int)npc.ai[1]].Center.X - segmentCenter.X; - segmentTargetY = Main.npc[(int)npc.ai[1]].Center.Y - segmentCenter.Y; - } - catch - { - } - - npc.rotation = (float)Math.Atan2(segmentTargetY, segmentTargetX) + MathHelper.PiOver2; - float segmentTargetDist = (float)Math.Sqrt(segmentTargetX * segmentTargetX + segmentTargetY * segmentTargetY); - int segmentWidth = npc.width; - segmentTargetDist = (segmentTargetDist - segmentWidth) / segmentTargetDist; - segmentTargetX *= segmentTargetDist; - segmentTargetY *= segmentTargetDist; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + segmentTargetX; - npc.position.Y = npc.position.Y + segmentTargetY; - - if (segmentTargetX < 0f) - npc.spriteDirection = -1; - else if (segmentTargetX > 0f) - npc.spriteDirection = 1; - } - } - - // Play spawn sound on Deus on the first frame because otherwise the sound wouldn't play properly in multiplayer - if (calamityGlobalNPC.newAI[1] == 0f && !doubleWormPhase) - { - SoundEngine.PlaySound(AstrumDeusHead.SpawnSound, npc.Center); - calamityGlobalNPC.newAI[1] = 1f; - } - - // 5 seconds of resistance in phase 2, 10 seconds in phase 1, to prevent spawn killing - if (calamityGlobalNPC.newAI[1] < resistanceTime && ((npc.position - npc.oldPosition).Length() > 2f || calamityGlobalNPC.newAI[1] > 1f)) - calamityGlobalNPC.newAI[1] += 1f; - - // Calculate contact damage based on velocity - if (!doNotDealDamage) - { - float minimalContactDamageVelocity = segmentVelocity * 0.25f; - float minimalDamageVelocity = segmentVelocity * 0.5f; - if (head) - { - if (npc.velocity.Length() <= minimalContactDamageVelocity) - { - npc.damage = (int)Math.Round(npc.defDamage * 0.5); - } - else - { - float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - npc.damage = (int)MathHelper.Lerp((float)Math.Round(npc.defDamage * 0.5), npc.defDamage, velocityDamageScalar); - } - } - else - { - float bodyAndTailVelocity = (npc.position - npc.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageVelocity) - { - npc.damage = 0; - } - else - { - float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - npc.damage = (int)MathHelper.Lerp(0f, npc.defDamage, velocityDamageScalar); - } - } - } - } - } -} diff --git a/NPCs/Crags/DespairStone.cs b/NPCs/Crags/DespairStone.cs index a386dfd7fa..b9db14ce14 100644 --- a/NPCs/Crags/DespairStone.cs +++ b/NPCs/Crags/DespairStone.cs @@ -5,7 +5,7 @@ using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Placeables.Crags; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; +using CalamityMod.NPCs.NormalNPCs; using CalamityMod.Particles; using CalamityMod.World; using Microsoft.Xna.Framework; diff --git a/NPCs/NormalNPCs/Bohldohr.cs b/NPCs/NormalNPCs/Bohldohr.cs index a6a4b88510..00d2b1d8b3 100644 --- a/NPCs/NormalNPCs/Bohldohr.cs +++ b/NPCs/NormalNPCs/Bohldohr.cs @@ -1,7 +1,6 @@ using CalamityMod.Items.Placeables; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.SummonItems; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.NPCs.Other; using CalamityMod.World; using Terraria; diff --git a/NPCs/CalamityAIs/CalamityRegularEnemyAIs/CalamityRegularEnemyAI.cs b/NPCs/NormalNPCs/CalamityRegularEnemyAI.cs similarity index 65% rename from NPCs/CalamityAIs/CalamityRegularEnemyAIs/CalamityRegularEnemyAI.cs rename to NPCs/NormalNPCs/CalamityRegularEnemyAI.cs index f0ec92c278..14ee15c69d 100644 --- a/NPCs/CalamityAIs/CalamityRegularEnemyAIs/CalamityRegularEnemyAI.cs +++ b/NPCs/NormalNPCs/CalamityRegularEnemyAI.cs @@ -1,25 +1,10 @@ using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.CalPlayer; using CalamityMod.Dusts; -using CalamityMod.Events; using CalamityMod.NPCs.Abyss; -using CalamityMod.NPCs.AquaticScourge; -using CalamityMod.NPCs.AstrumAureus; -using CalamityMod.NPCs.AstrumDeus; -using CalamityMod.NPCs.BrimstoneElemental; -using CalamityMod.NPCs.Bumblebirb; -using CalamityMod.NPCs.CalClone; -using CalamityMod.NPCs.CeaselessVoid; using CalamityMod.NPCs.Crags; -using CalamityMod.NPCs.NormalNPCs; -using CalamityMod.NPCs.OldDuke; using CalamityMod.NPCs.SulphurousSea; using CalamityMod.NPCs.SunkenSea; -using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Enemy; -using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -27,23 +12,23 @@ using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs +namespace CalamityMod.NPCs.NormalNPCs { public static class CalamityRegularEnemyAI { #region Gem Crawler AI public static void GemCrawlerAI(NPC npc, Mod mod, float speedDetect, float speedAdditive) { - int turnAroundDelay = 30; - bool unusedFlag = false; - bool isRunning = false; - bool shouldTurnAround = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) + var turnAroundDelay = 30; + var unusedFlag = false; + var isRunning = false; + var shouldTurnAround = false; + if (npc.velocity.Y == 0f && (npc.velocity.X > 0f && npc.direction > 0 || npc.velocity.X < 0f && npc.direction < 0)) { isRunning = true; npc.ai[3] += 1f; } - if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)turnAroundDelay) | isRunning) + if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= turnAroundDelay) | isRunning) { npc.ai[3] += 1f; shouldTurnAround = true; @@ -52,7 +37,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs { npc.ai[3] -= 1f; } - if (npc.ai[3] > (float)(turnAroundDelay * 10)) + if (npc.ai[3] > turnAroundDelay * 10) { npc.ai[3] = 0f; } @@ -60,19 +45,19 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs { npc.ai[3] = 0f; } - if (npc.ai[3] == (float)turnAroundDelay) + if (npc.ai[3] == turnAroundDelay) { npc.netUpdate = true; } - Vector2 npcPos = new Vector2(npc.Center.X, npc.Center.Y); - float xDist = Main.player[npc.target].Center.X - npcPos.X; - float yDist = Main.player[npc.target].Center.Y - npcPos.Y; - float targetDist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); + var npcPos = new Vector2(npc.Center.X, npc.Center.Y); + var xDist = Main.player[npc.target].Center.X - npcPos.X; + var yDist = Main.player[npc.target].Center.Y - npcPos.Y; + var targetDist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); if (targetDist < 200f && !shouldTurnAround) { npc.ai[3] = 0f; } - if (npc.ai[3] < (float)turnAroundDelay) + if (npc.ai[3] < turnAroundDelay) { npc.TargetClosest(true); } @@ -101,9 +86,9 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs npc.direction = 1; } } - float maxVelocity = speedDetect; //5 - float acceleration = speedAdditive; //0.05 - if (!unusedFlag && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) + var maxVelocity = speedDetect; //5 + var acceleration = speedAdditive; //0.05 + if (!unusedFlag && (npc.velocity.Y == 0f || npc.wet || npc.velocity.X <= 0f && npc.direction > 0 || npc.velocity.X >= 0f && npc.direction < 0)) { if (npc.velocity.X < -maxVelocity || npc.velocity.X > maxVelocity) { @@ -131,7 +116,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs } if (npc.velocity.Y >= 0f) { - int faceDirection = 0; + var faceDirection = 0; if (npc.velocity.X < 0f) { faceDirection = -1; @@ -140,13 +125,13 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs { faceDirection = 1; } - Vector2 position = npc.position; + var position = npc.position; position.X += npc.velocity.X; - int x = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * faceDirection)) / 16f); - int y = (int)((position.Y + (float)npc.height - 1f) / 16f); - if ((float)(x * 16) < position.X + (float)npc.width && (float)(x * 16 + 16) > position.X && ((Main.tile[x, y].HasUnactuatedTile && !Main.tile[x, y].TopSlope && !Main.tile[x, y - 1].TopSlope && Main.tileSolid[(int)Main.tile[x, y].TileType] && !Main.tileSolidTop[(int)Main.tile[x, y].TileType]) || (Main.tile[x, y - 1].IsHalfBlock && Main.tile[x, y - 1].HasUnactuatedTile)) && (!Main.tile[x, y - 1].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x, y - 1].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 1].TileType] || (Main.tile[x, y - 1].IsHalfBlock && (!Main.tile[x, y - 4].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x, y - 4].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 4].TileType]))) && (!Main.tile[x, y - 2].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x, y - 2].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 2].TileType]) && (!Main.tile[x, y - 3].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x, y - 3].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 3].TileType]) && (!Main.tile[x - faceDirection, y - 3].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x - faceDirection, y - 3].TileType])) + var x = (int)((position.X + npc.width / 2 + (npc.width / 2 + 1) * faceDirection) / 16f); + var y = (int)((position.Y + npc.height - 1f) / 16f); + if (x * 16 < position.X + npc.width && x * 16 + 16 > position.X && (Main.tile[x, y].HasUnactuatedTile && !Main.tile[x, y].TopSlope && !Main.tile[x, y - 1].TopSlope && Main.tileSolid[Main.tile[x, y].TileType] && !Main.tileSolidTop[Main.tile[x, y].TileType] || Main.tile[x, y - 1].IsHalfBlock && Main.tile[x, y - 1].HasUnactuatedTile) && (!Main.tile[x, y - 1].HasUnactuatedTile || !Main.tileSolid[Main.tile[x, y - 1].TileType] || Main.tileSolidTop[Main.tile[x, y - 1].TileType] || Main.tile[x, y - 1].IsHalfBlock && (!Main.tile[x, y - 4].HasUnactuatedTile || !Main.tileSolid[Main.tile[x, y - 4].TileType] || Main.tileSolidTop[Main.tile[x, y - 4].TileType])) && (!Main.tile[x, y - 2].HasUnactuatedTile || !Main.tileSolid[Main.tile[x, y - 2].TileType] || Main.tileSolidTop[Main.tile[x, y - 2].TileType]) && (!Main.tile[x, y - 3].HasUnactuatedTile || !Main.tileSolid[Main.tile[x, y - 3].TileType] || Main.tileSolidTop[Main.tile[x, y - 3].TileType]) && (!Main.tile[x - faceDirection, y - 3].HasUnactuatedTile || !Main.tileSolid[Main.tile[x - faceDirection, y - 3].TileType])) { - float npcBottom = (float)(y * 16); + var npcBottom = (float)(y * 16); if (Main.tile[x, y].IsHalfBlock) { npcBottom += 8f; @@ -155,13 +140,13 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs { npcBottom -= 8f; } - if (npcBottom < position.Y + (float)npc.height) + if (npcBottom < position.Y + npc.height) { - float percentageTileRisen = position.Y + (float)npc.height - npcBottom; + var percentageTileRisen = position.Y + npc.height - npcBottom; if (percentageTileRisen <= 16.1f) { - npc.gfxOffY += npc.position.Y + (float)npc.height - npcBottom; - npc.position.Y = npcBottom - (float)npc.height; + npc.gfxOffY += npc.position.Y + npc.height - npcBottom; + npc.position.Y = npcBottom - npc.height; if (percentageTileRisen < 9f) { npc.stepSpeed = 1f; @@ -181,11 +166,11 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs public static void DungeonSpiritAI(NPC npc, Mod mod, float speed, float rotation, bool lantern = false) { npc.TargetClosest(true); - Vector2 npcPos = new Vector2(npc.Center.X, npc.Center.Y); - float xDist = Main.player[npc.target].Center.X - npcPos.X; - float yDist = Main.player[npc.target].Center.Y - npcPos.Y; - float targetDist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); - float homingSpeed = speed; + var npcPos = new Vector2(npc.Center.X, npc.Center.Y); + var xDist = Main.player[npc.target].Center.X - npcPos.X; + var yDist = Main.player[npc.target].Center.Y - npcPos.Y; + var targetDist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); + var homingSpeed = speed; if (lantern) { @@ -212,7 +197,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs if (lantern) { npc.rotation = npc.velocity.X * 0.08f; - npc.spriteDirection = (npc.direction > 0) ? 1 : -1; + npc.spriteDirection = npc.direction > 0 ? 1 : -1; } else npc.rotation = (float)Math.Atan2((double)yDist, (double)xDist) + rotation; @@ -222,23 +207,23 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs #region Unicorn AI public static void UnicornAI(NPC npc, Mod mod, bool spin, float bounciness, float speedDetect, float speedAdditive, float bouncy1 = -8.5f, float bouncy2 = -7.5f, float bouncy3 = -7f, float bouncy4 = -6f, float bouncy5 = -8f) { - bool DogPhase1 = npc.type == ModContent.NPCType() && npc.life > npc.lifeMax * (CalamityWorld.death ? 0.9 : CalamityWorld.revenge ? 0.7 : 0.5); - bool DogPhase2 = npc.type == ModContent.NPCType() && npc.life <= npc.lifeMax * (CalamityWorld.death ? 0.9 : CalamityWorld.revenge ? 0.7 : 0.5); - int turnAroundDelay = 30; - bool isRunning = false; - bool shouldTurnAround = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) + var DogPhase1 = npc.type == ModContent.NPCType() && npc.life > npc.lifeMax * (CalamityWorld.death ? 0.9 : CalamityWorld.revenge ? 0.7 : 0.5); + var DogPhase2 = npc.type == ModContent.NPCType() && npc.life <= npc.lifeMax * (CalamityWorld.death ? 0.9 : CalamityWorld.revenge ? 0.7 : 0.5); + var turnAroundDelay = 30; + var isRunning = false; + var shouldTurnAround = false; + if (npc.velocity.Y == 0f && (npc.velocity.X > 0f && npc.direction < 0 || npc.velocity.X < 0f && npc.direction > 0)) { isRunning = true; npc.ai[3] += 1f; } - int turnAroundDelayMult = DogPhase1 ? 10 : 4; + var turnAroundDelayMult = DogPhase1 ? 10 : 4; if (!DogPhase1) { - bool noYVelocity = npc.velocity.Y == 0f; - for (int i = 0; i < Main.maxNPCs; i++) + var noYVelocity = npc.velocity.Y == 0f; + for (var i = 0; i < Main.maxNPCs; i++) { - if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type && Math.Abs(npc.position.X - Main.npc[i].position.X) + Math.Abs(npc.position.Y - Main.npc[i].position.Y) < (float)npc.width) + if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type && Math.Abs(npc.position.X - Main.npc[i].position.X) + Math.Abs(npc.position.Y - Main.npc[i].position.Y) < npc.width) { if (npc.position.X < Main.npc[i].position.X) { @@ -263,7 +248,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs npc.velocity.Y = 0f; } } - if (npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)turnAroundDelay || isRunning) + if (npc.position.X == npc.oldPosition.X || npc.ai[3] >= turnAroundDelay || isRunning) { npc.ai[3] += 1f; shouldTurnAround = true; @@ -272,7 +257,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs { npc.ai[3] -= 1f; } - if (npc.ai[3] > (float)(turnAroundDelay * turnAroundDelayMult)) + if (npc.ai[3] > turnAroundDelay * turnAroundDelayMult) { npc.ai[3] = 0f; } @@ -280,33 +265,33 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs { npc.ai[3] = 0f; } - if (npc.ai[3] == (float)turnAroundDelay) + if (npc.ai[3] == turnAroundDelay) { npc.netUpdate = true; } - Vector2 npcPos = new Vector2(npc.Center.X, npc.Center.Y); - float xDist = Main.player[npc.target].Center.X - npcPos.X; - float yDist = Main.player[npc.target].Center.Y - npcPos.Y; - float targetDist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); + var npcPos = new Vector2(npc.Center.X, npc.Center.Y); + var xDist = Main.player[npc.target].Center.X - npcPos.X; + var yDist = Main.player[npc.target].Center.Y - npcPos.Y; + var targetDist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); if (targetDist < 200f && !shouldTurnAround) { npc.ai[3] = 0f; } if (!DogPhase1) { - if (npc.velocity.Y == 0f && Math.Abs(npc.velocity.X) > 3f && ((npc.Center.X < Main.player[npc.target].Center.X && npc.velocity.X > 0f) || (npc.Center.X > Main.player[npc.target].Center.X && npc.velocity.X < 0f))) + if (npc.velocity.Y == 0f && Math.Abs(npc.velocity.X) > 3f && (npc.Center.X < Main.player[npc.target].Center.X && npc.velocity.X > 0f || npc.Center.X > Main.player[npc.target].Center.X && npc.velocity.X < 0f)) { npc.velocity.Y -= bounciness; if (npc.type == ModContent.NPCType()) { SoundEngine.PlaySound(SoundID.Item14, npc.Center); - for (int k = 0; k < 10; k++) + for (var k = 0; k < 10; k++) { Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, -1f, 0, default, 1f); } if (Main.zenithWorld) { - float screenShakePower = 2 * Utils.GetLerpValue(1300f, 0f, npc.Distance(Main.LocalPlayer.Center), true); + var screenShakePower = 2 * Utils.GetLerpValue(1300f, 0f, npc.Distance(Main.LocalPlayer.Center), true); if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < screenShakePower) Main.LocalPlayer.Calamity().GeneralScreenShakePower = screenShakePower; } @@ -317,21 +302,21 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs } if (DogPhase2) { - for (int k = 0; k < 5; k++) + for (var k = 0; k < 5; k++) { Dust.NewDust(npc.position, npc.width, npc.height, DustID.Water, 0f, -1f, 0, default, 1f); } } if (npc.type == ModContent.NPCType()) { - for (int k = 0; k < 5; k++) + for (var k = 0; k < 5; k++) { Dust.NewDust(npc.position, npc.width, npc.height, DustID.Water, 0f, -1f, 0, default, 1f); } } } } - if (npc.ai[3] < (float)turnAroundDelay) + if (npc.ai[3] < turnAroundDelay) { npc.TargetClosest(true); } @@ -361,19 +346,19 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs } } - if (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction < 0) || (npc.velocity.X >= 0f && npc.direction > 0)) + if (npc.velocity.Y == 0f || npc.wet || npc.velocity.X <= 0f && npc.direction < 0 || npc.velocity.X >= 0f && npc.direction > 0) { if (Math.Sign(npc.velocity.X) != npc.direction && !DogPhase1) { npc.velocity.X *= 0.92f; } - float sandstormPush = MathHelper.Lerp(0.6f, 1f, Math.Abs(Main.windSpeedCurrent)) * (float)Math.Sign(Main.windSpeedCurrent); + var sandstormPush = MathHelper.Lerp(0.6f, 1f, Math.Abs(Main.windSpeedCurrent)) * Math.Sign(Main.windSpeedCurrent); if (!Main.player[npc.target].ZoneSandstorm) { sandstormPush = 0f; } - float maxVelocity = speedDetect; - float acceleration = speedAdditive; + var maxVelocity = speedDetect; + var acceleration = speedAdditive; if (npc.velocity.X < -maxVelocity || npc.velocity.X > maxVelocity) { if (npc.velocity.Y == 0f) @@ -400,7 +385,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs } if (npc.velocity.Y >= 0f) { - int faceDirection = 0; + var faceDirection = 0; if (npc.velocity.X < 0f) { faceDirection = -1; @@ -409,30 +394,30 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs { faceDirection = 1; } - Vector2 position = npc.position; + var position = npc.position; position.X += npc.velocity.X; - int x = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * faceDirection)) / 16f); - int y = (int)((position.Y + (float)npc.height - 1f) / 16f); + var x = (int)((position.X + npc.width / 2 + (npc.width / 2 + 1) * faceDirection) / 16f); + var y = (int)((position.Y + npc.height - 1f) / 16f); // 21JAN2023: Ozzatron -- this is probably the single most unmaintainable if statement I've ever seen // I have broken all the individual statements out even though I do not fully understand the code. - Tile t_xy = CalamityUtils.ParanoidTileRetrieval(x, y); - Tile t_xy1 = CalamityUtils.ParanoidTileRetrieval(x, y - 1); - Tile t_xy2 = CalamityUtils.ParanoidTileRetrieval(x, y - 2); - Tile t_xy3 = CalamityUtils.ParanoidTileRetrieval(x, y - 3); - Tile t_xOffY3 = CalamityUtils.ParanoidTileRetrieval(x - faceDirection, y - 3); // 3 down, offset 1 in the direction of the NPC's movement - Tile t_xy4 = CalamityUtils.ParanoidTileRetrieval(x, y - 4); - bool positionCheck = (float)(x * 16) < position.X + (float)npc.width && (float)(x * 16 + 16) > position.X; - bool tileSolidityCheck1 = t_xy.HasUnactuatedTile && !t_xy.TopSlope && !t_xy1.TopSlope && Main.tileSolid[t_xy.TileType] && !Main.tileSolidTop[t_xy.TileType]; - bool oneBelowIsSolidHalf = t_xy1.IsHalfBlock && t_xy1.HasUnactuatedTile; - bool canFallThrough = !t_xy1.HasUnactuatedTile || !Main.tileSolid[t_xy1.TileType] || Main.tileSolidTop[t_xy1.TileType] || (t_xy1.IsHalfBlock && (!t_xy4.HasUnactuatedTile || !Main.tileSolid[t_xy4.TileType] || Main.tileSolidTop[t_xy4.TileType])); - bool twoDownIsNonSolid = !t_xy2.HasUnactuatedTile || !Main.tileSolid[t_xy2.TileType] || Main.tileSolidTop[t_xy2.TileType]; - bool threeDownIsNonSolid = !t_xy3.HasUnactuatedTile || !Main.tileSolid[t_xy3.TileType] || Main.tileSolidTop[t_xy3.TileType]; + var t_xy = CalamityUtils.ParanoidTileRetrieval(x, y); + var t_xy1 = CalamityUtils.ParanoidTileRetrieval(x, y - 1); + var t_xy2 = CalamityUtils.ParanoidTileRetrieval(x, y - 2); + var t_xy3 = CalamityUtils.ParanoidTileRetrieval(x, y - 3); + var t_xOffY3 = CalamityUtils.ParanoidTileRetrieval(x - faceDirection, y - 3); // 3 down, offset 1 in the direction of the NPC's movement + var t_xy4 = CalamityUtils.ParanoidTileRetrieval(x, y - 4); + var positionCheck = x * 16 < position.X + npc.width && x * 16 + 16 > position.X; + var tileSolidityCheck1 = t_xy.HasUnactuatedTile && !t_xy.TopSlope && !t_xy1.TopSlope && Main.tileSolid[t_xy.TileType] && !Main.tileSolidTop[t_xy.TileType]; + var oneBelowIsSolidHalf = t_xy1.IsHalfBlock && t_xy1.HasUnactuatedTile; + var canFallThrough = !t_xy1.HasUnactuatedTile || !Main.tileSolid[t_xy1.TileType] || Main.tileSolidTop[t_xy1.TileType] || t_xy1.IsHalfBlock && (!t_xy4.HasUnactuatedTile || !Main.tileSolid[t_xy4.TileType] || Main.tileSolidTop[t_xy4.TileType]); + var twoDownIsNonSolid = !t_xy2.HasUnactuatedTile || !Main.tileSolid[t_xy2.TileType] || Main.tileSolidTop[t_xy2.TileType]; + var threeDownIsNonSolid = !t_xy3.HasUnactuatedTile || !Main.tileSolid[t_xy3.TileType] || Main.tileSolidTop[t_xy3.TileType]; // Notice it doesn't check for platforms in ther offset position. This is why walking AIs twirl on 1-wide platforms in hellevators. They have to turn around before this check succeeds. - bool threeDownOffsetIsNonSolid = !t_xOffY3.HasUnactuatedTile || !Main.tileSolid[t_xOffY3.TileType]; + var threeDownOffsetIsNonSolid = !t_xOffY3.HasUnactuatedTile || !Main.tileSolid[t_xOffY3.TileType]; if (positionCheck && (tileSolidityCheck1 || oneBelowIsSolidHalf) && canFallThrough && twoDownIsNonSolid && threeDownIsNonSolid && threeDownOffsetIsNonSolid) { - float tilePixelPosition = (float)(y * 16); + var tilePixelPosition = (float)(y * 16); if (Main.tile[x, y].IsHalfBlock) { tilePixelPosition += 8f; @@ -441,13 +426,13 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs { tilePixelPosition -= 8f; } - if (tilePixelPosition < position.Y + (float)npc.height) + if (tilePixelPosition < position.Y + npc.height) { - float percentageTileRisen = position.Y + (float)npc.height - tilePixelPosition; + var percentageTileRisen = position.Y + npc.height - tilePixelPosition; if ((double)percentageTileRisen <= 16.1) { - npc.gfxOffY += npc.position.Y + (float)npc.height - tilePixelPosition; - npc.position.Y = tilePixelPosition - (float)npc.height; + npc.gfxOffY += npc.position.Y + npc.height - tilePixelPosition; + npc.position.Y = tilePixelPosition - npc.height; if (percentageTileRisen < 9f) { npc.stepSpeed = 1f; @@ -462,15 +447,15 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs } if (npc.velocity.Y == 0f) { - int npcTileX = (int)((npc.position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 2) * npc.direction) + npc.velocity.X * 5f) / 16f); - int npcTileY = (int)((npc.position.Y + (float)npc.height - 15f) / 16f); - int spriteDirection = npc.spriteDirection; + var npcTileX = (int)((npc.position.X + npc.width / 2 + (npc.width / 2 + 2) * npc.direction + npc.velocity.X * 5f) / 16f); + var npcTileY = (int)((npc.position.Y + npc.height - 15f) / 16f); + var spriteDirection = npc.spriteDirection; spriteDirection *= -1; - if ((npc.velocity.X < 0f && spriteDirection == -1) || (npc.velocity.X > 0f && spriteDirection == 1)) + if (npc.velocity.X < 0f && spriteDirection == -1 || npc.velocity.X > 0f && spriteDirection == 1) { - if (Main.tile[npcTileX, npcTileY - 2].HasUnactuatedTile && Main.tileSolid[(int)Main.tile[npcTileX, npcTileY - 2].TileType]) + if (Main.tile[npcTileX, npcTileY - 2].HasUnactuatedTile && Main.tileSolid[Main.tile[npcTileX, npcTileY - 2].TileType]) { - if (Main.tile[npcTileX, npcTileY - 3].HasUnactuatedTile && Main.tileSolid[(int)Main.tile[npcTileX, npcTileY - 3].TileType]) + if (Main.tile[npcTileX, npcTileY - 3].HasUnactuatedTile && Main.tileSolid[Main.tile[npcTileX, npcTileY - 3].TileType]) { npc.velocity.Y = bouncy1; npc.netUpdate = true; @@ -481,17 +466,17 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs npc.netUpdate = true; } } - else if (Main.tile[npcTileX, npcTileY - 1].HasUnactuatedTile && !Main.tile[npcTileX, npcTileY - 1].TopSlope && Main.tileSolid[(int)Main.tile[npcTileX, npcTileY - 1].TileType]) + else if (Main.tile[npcTileX, npcTileY - 1].HasUnactuatedTile && !Main.tile[npcTileX, npcTileY - 1].TopSlope && Main.tileSolid[Main.tile[npcTileX, npcTileY - 1].TileType]) { npc.velocity.Y = bouncy3; npc.netUpdate = true; } - else if (npc.position.Y + (float)npc.height - (float)(npcTileY * 16) > 20f && Main.tile[npcTileX, npcTileY].HasUnactuatedTile && !Main.tile[npcTileX, npcTileY].TopSlope && Main.tileSolid[(int)Main.tile[npcTileX, npcTileY].TileType]) + else if (npc.position.Y + npc.height - npcTileY * 16 > 20f && Main.tile[npcTileX, npcTileY].HasUnactuatedTile && !Main.tile[npcTileX, npcTileY].TopSlope && Main.tileSolid[Main.tile[npcTileX, npcTileY].TileType]) { npc.velocity.Y = bouncy4; npc.netUpdate = true; } - else if ((npc.directionY < 0 || Math.Abs(npc.velocity.X) > 3f) && (!Main.tile[npcTileX, npcTileY + 1].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[npcTileX, npcTileY + 1].TileType]) && (!Main.tile[npcTileX, npcTileY + 2].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[npcTileX, npcTileY + 2].TileType]) && (!Main.tile[npcTileX + npc.direction, npcTileY + 3].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[npcTileX + npc.direction, npcTileY + 3].TileType])) + else if ((npc.directionY < 0 || Math.Abs(npc.velocity.X) > 3f) && (!Main.tile[npcTileX, npcTileY + 1].HasUnactuatedTile || !Main.tileSolid[Main.tile[npcTileX, npcTileY + 1].TileType]) && (!Main.tile[npcTileX, npcTileY + 2].HasUnactuatedTile || !Main.tileSolid[Main.tile[npcTileX, npcTileY + 2].TileType]) && (!Main.tile[npcTileX + npc.direction, npcTileY + 3].HasUnactuatedTile || !Main.tileSolid[Main.tile[npcTileX + npc.direction, npcTileY + 3].TileType])) { npc.velocity.Y = bouncy5; npc.netUpdate = true; @@ -515,21 +500,21 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs public static void PassiveSwimmingAI(NPC npc, Mod mod, int passiveness, float detectRange, float xSpeed, float ySpeed, float speedLimitX, float speedLimitY, float rotation, bool spriteFacesLeft = true) { if (spriteFacesLeft) - npc.spriteDirection = (npc.direction > 0) ? 1 : -1; + npc.spriteDirection = npc.direction > 0 ? 1 : -1; else - npc.spriteDirection = (npc.direction > 0) ? -1 : 1; + npc.spriteDirection = npc.direction > 0 ? -1 : 1; npc.noGravity = true; if (npc.direction == 0) npc.TargetClosest(); - Player target = Main.player[npc.target]; + var target = Main.player[npc.target]; if (npc.justHit && passiveness != 3) npc.chaseable = true; if (npc.wet) { - bool hasWetTarget = npc.chaseable; + var hasWetTarget = npc.chaseable; npc.TargetClosest(false); target = Main.player[npc.target]; @@ -610,18 +595,18 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs // Swim away from the player if (passiveness == 3) { - npc.velocity.X = npc.velocity.X - (float)npc.direction * xSpeed; - npc.velocity.Y = npc.velocity.Y - (float)npc.directionY * ySpeed; + npc.velocity.X = npc.velocity.X - npc.direction * xSpeed; + npc.velocity.Y = npc.velocity.Y - npc.directionY * ySpeed; } // Swim toward the player else { - npc.velocity.X = npc.velocity.X + (float)npc.direction * (CalamityWorld.death ? 2f * xSpeed : CalamityWorld.revenge ? 1.5f * xSpeed : xSpeed); - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * (CalamityWorld.death ? 2f * ySpeed : CalamityWorld.revenge ? 1.5f * ySpeed : ySpeed); + npc.velocity.X = npc.velocity.X + npc.direction * (CalamityWorld.death ? 2f * xSpeed : CalamityWorld.revenge ? 1.5f * xSpeed : xSpeed); + npc.velocity.Y = npc.velocity.Y + npc.directionY * (CalamityWorld.death ? 2f * ySpeed : CalamityWorld.revenge ? 1.5f * ySpeed : ySpeed); } - float velocityCapX = CalamityWorld.death && passiveness != 3 ? 2f * speedLimitX : CalamityWorld.revenge ? 1.5f * speedLimitX : speedLimitX; - float velocityCapY = CalamityWorld.death && passiveness != 3 ? 2f * speedLimitY : CalamityWorld.revenge ? 1.5f * speedLimitY : speedLimitY; + var velocityCapX = CalamityWorld.death && passiveness != 3 ? 2f * speedLimitX : CalamityWorld.revenge ? 1.5f * speedLimitX : speedLimitX; + var velocityCapY = CalamityWorld.death && passiveness != 3 ? 2f * speedLimitY : CalamityWorld.revenge ? 1.5f * speedLimitY : speedLimitY; npc.velocity.X = MathHelper.Clamp(npc.velocity.X, -velocityCapX, velocityCapX); npc.velocity.Y = MathHelper.Clamp(npc.velocity.Y, -velocityCapY, velocityCapY); @@ -631,22 +616,22 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs // Laserfish shoot the player if (npc.type == ModContent.NPCType()) { - npc.localAI[0] += (CalamityWorld.death ? 2f : CalamityWorld.revenge ? 1.5f : 1f); + npc.localAI[0] += CalamityWorld.death ? 2f : CalamityWorld.revenge ? 1.5f : 1f; if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 120f) { npc.localAI[0] = 0f; if (Collision.CanHit(npc.position, npc.width, npc.height, target.position, target.width, target.height)) { - float speed = 5f; - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float velX = target.Center.X - vector.X + Main.rand.NextFloat(-20f, 20f); - float velY = target.Center.Y - vector.Y + Main.rand.NextFloat(-20f, 20f); - float dist = (float)Math.Sqrt((double)(velX * velX + velY * velY)); + var speed = 5f; + var vector = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height / 2); + var velX = target.Center.X - vector.X + Main.rand.NextFloat(-20f, 20f); + var velY = target.Center.Y - vector.Y + Main.rand.NextFloat(-20f, 20f); + var dist = (float)Math.Sqrt((double)(velX * velX + velY * velY)); dist = speed / dist; velX *= dist; velY *= dist; - int damage = Main.masterMode ? 34 : Main.expertMode ? 40 : 50; - int beam = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + (npc.spriteDirection == 1 ? 25f : -25f), npc.Center.Y + (target.position.Y > npc.Center.Y ? 5f : -5f), velX, velY, ProjectileID.EyeBeam, damage, 0f, Main.myPlayer); + var damage = Main.masterMode ? 34 : Main.expertMode ? 40 : 50; + var beam = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + (npc.spriteDirection == 1 ? 25f : -25f), npc.Center.Y + (target.position.Y > npc.Center.Y ? 5f : -5f), velX, velY, ProjectileID.EyeBeam, damage, 0f, Main.myPlayer); Main.projectile[beam].tileCollide = true; } } @@ -657,21 +642,21 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs { if ((target.Center - npc.Center).Length() < 350f) { - npc.localAI[0] += (CalamityWorld.death ? 3f : CalamityWorld.revenge ? 2f : 1f); + npc.localAI[0] += CalamityWorld.death ? 3f : CalamityWorld.revenge ? 2f : 1f; if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 180f) { npc.localAI[0] = 0f; if (Collision.CanHit(npc.position, npc.width, npc.height, target.position, target.width, target.height)) { - float speed = 4f; - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float velX = target.Center.X - vector.X + Main.rand.NextFloat(-20f, 20f); - float velY = target.Center.Y - vector.Y + Main.rand.NextFloat(-20f, 20f); - float dist = (float)Math.Sqrt((double)(velX * velX + velY * velY)); + var speed = 4f; + var vector = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height / 2); + var velX = target.Center.X - vector.X + Main.rand.NextFloat(-20f, 20f); + var velY = target.Center.Y - vector.Y + Main.rand.NextFloat(-20f, 20f); + var dist = (float)Math.Sqrt((double)(velX * velX + velY * velY)); dist = speed / dist; velX *= dist; velY *= dist; - int damage = Main.masterMode ? 21 : Main.expertMode ? 25 : 35; + var damage = Main.masterMode ? 21 : Main.expertMode ? 25 : 35; Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + (npc.spriteDirection == 1 ? 10f : -10f), npc.Center.Y, velX, velY, ModContent.ProjectileType(), damage, 0f, Main.myPlayer); } } @@ -685,7 +670,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs else { // No target behavior - npc.velocity.X += (float)npc.direction * 0.1f; + npc.velocity.X += npc.direction * 0.1f; if (npc.velocity.X < -2.5f || npc.velocity.X > 2.5f) npc.velocity.X *= 0.95f; @@ -703,8 +688,8 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs } } - int npcTileX = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int npcTileY = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + var npcTileX = (int)(npc.position.X + npc.width / 2) / 16; + var npcTileY = (int)(npc.position.Y + npc.height / 2) / 16; if (Main.tile[npcTileX, npcTileY - 1].LiquidAmount > 128) { if (Main.tile[npcTileX, npcTileY + 1].HasTile) @@ -733,8 +718,8 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs npc.ai[0] = 1f; } - npc.rotation = npc.velocity.Y * (float)npc.direction * rotation; - float rotationLimit = 2f * rotation; + npc.rotation = npc.velocity.Y * npc.direction * rotation; + var rotationLimit = 2f * rotation; npc.rotation = MathHelper.Clamp(npc.rotation, -rotationLimit, rotationLimit); } #endregion diff --git a/NPCs/NormalNPCs/CrawlerAmber.cs b/NPCs/NormalNPCs/CrawlerAmber.cs index f954995ab2..a72c027c29 100644 --- a/NPCs/NormalNPCs/CrawlerAmber.cs +++ b/NPCs/NormalNPCs/CrawlerAmber.cs @@ -2,7 +2,6 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; diff --git a/NPCs/NormalNPCs/CrawlerAmethyst.cs b/NPCs/NormalNPCs/CrawlerAmethyst.cs index a4e87c0b90..ef1ba06395 100644 --- a/NPCs/NormalNPCs/CrawlerAmethyst.cs +++ b/NPCs/NormalNPCs/CrawlerAmethyst.cs @@ -2,7 +2,6 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; diff --git a/NPCs/NormalNPCs/CrawlerCrystal.cs b/NPCs/NormalNPCs/CrawlerCrystal.cs index e1a0792b18..52bf6243b8 100644 --- a/NPCs/NormalNPCs/CrawlerCrystal.cs +++ b/NPCs/NormalNPCs/CrawlerCrystal.cs @@ -3,7 +3,6 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Melee; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; diff --git a/NPCs/NormalNPCs/CrawlerDiamond.cs b/NPCs/NormalNPCs/CrawlerDiamond.cs index 09e32974f5..2d5c45ced0 100644 --- a/NPCs/NormalNPCs/CrawlerDiamond.cs +++ b/NPCs/NormalNPCs/CrawlerDiamond.cs @@ -2,7 +2,6 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; diff --git a/NPCs/NormalNPCs/CrawlerEmerald.cs b/NPCs/NormalNPCs/CrawlerEmerald.cs index 83098672ad..57203f5712 100644 --- a/NPCs/NormalNPCs/CrawlerEmerald.cs +++ b/NPCs/NormalNPCs/CrawlerEmerald.cs @@ -2,7 +2,6 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; diff --git a/NPCs/NormalNPCs/CrawlerRuby.cs b/NPCs/NormalNPCs/CrawlerRuby.cs index 85e11808ee..661e93c8b7 100644 --- a/NPCs/NormalNPCs/CrawlerRuby.cs +++ b/NPCs/NormalNPCs/CrawlerRuby.cs @@ -2,7 +2,6 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; diff --git a/NPCs/NormalNPCs/CrawlerSapphire.cs b/NPCs/NormalNPCs/CrawlerSapphire.cs index 82e676db37..acc838a377 100644 --- a/NPCs/NormalNPCs/CrawlerSapphire.cs +++ b/NPCs/NormalNPCs/CrawlerSapphire.cs @@ -2,7 +2,6 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; diff --git a/NPCs/NormalNPCs/CrawlerTopaz.cs b/NPCs/NormalNPCs/CrawlerTopaz.cs index 3ce4c15784..ee69820a97 100644 --- a/NPCs/NormalNPCs/CrawlerTopaz.cs +++ b/NPCs/NormalNPCs/CrawlerTopaz.cs @@ -2,7 +2,6 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; diff --git a/NPCs/NormalNPCs/Cryon.cs b/NPCs/NormalNPCs/Cryon.cs index b82920a32c..2ebe973bfc 100644 --- a/NPCs/NormalNPCs/Cryon.cs +++ b/NPCs/NormalNPCs/Cryon.cs @@ -1,6 +1,5 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.World; using Terraria; using Terraria.GameContent.Bestiary; diff --git a/NPCs/NormalNPCs/Frogfish.cs b/NPCs/NormalNPCs/Frogfish.cs index 3c4fe4c6f8..f0d28063b9 100644 --- a/NPCs/NormalNPCs/Frogfish.cs +++ b/NPCs/NormalNPCs/Frogfish.cs @@ -1,6 +1,5 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Potions; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; diff --git a/NPCs/NormalNPCs/PhantomSpirit.cs b/NPCs/NormalNPCs/PhantomSpirit.cs index 1f94654c10..29e9400b94 100644 --- a/NPCs/NormalNPCs/PhantomSpirit.cs +++ b/NPCs/NormalNPCs/PhantomSpirit.cs @@ -1,7 +1,6 @@ using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; diff --git a/NPCs/NormalNPCs/PhantomSpiritL.cs b/NPCs/NormalNPCs/PhantomSpiritL.cs index 2f7849b747..c666e97af9 100644 --- a/NPCs/NormalNPCs/PhantomSpiritL.cs +++ b/NPCs/NormalNPCs/PhantomSpiritL.cs @@ -3,7 +3,6 @@ using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; diff --git a/NPCs/NormalNPCs/PhantomSpiritM.cs b/NPCs/NormalNPCs/PhantomSpiritM.cs index 5d35236eba..6beacd3fc0 100644 --- a/NPCs/NormalNPCs/PhantomSpiritM.cs +++ b/NPCs/NormalNPCs/PhantomSpiritM.cs @@ -1,7 +1,6 @@ using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; diff --git a/NPCs/NormalNPCs/PhantomSpiritS.cs b/NPCs/NormalNPCs/PhantomSpiritS.cs index 9608b72321..41b8e24088 100644 --- a/NPCs/NormalNPCs/PhantomSpiritS.cs +++ b/NPCs/NormalNPCs/PhantomSpiritS.cs @@ -1,7 +1,6 @@ using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; diff --git a/NPCs/NormalNPCs/Rimehound.cs b/NPCs/NormalNPCs/Rimehound.cs index 4fb5748983..6c1e55ff38 100644 --- a/NPCs/NormalNPCs/Rimehound.cs +++ b/NPCs/NormalNPCs/Rimehound.cs @@ -1,7 +1,6 @@ using System.IO; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.World; using Terraria; using Terraria.Audio; diff --git a/NPCs/NormalNPCs/WildBumblebirb.cs b/NPCs/NormalNPCs/WildBumblebirb.cs index 7ffe5fe3a8..360d470790 100644 --- a/NPCs/NormalNPCs/WildBumblebirb.cs +++ b/NPCs/NormalNPCs/WildBumblebirb.cs @@ -1,6 +1,5 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; using CalamityMod.Projectiles.Boss; using CalamityMod.Sounds; using CalamityMod.World; diff --git a/NPCs/Signus/CosmicLantern.cs b/NPCs/Signus/CosmicLantern.cs index dc5150c594..fbb89d335d 100644 --- a/NPCs/Signus/CosmicLantern.cs +++ b/NPCs/Signus/CosmicLantern.cs @@ -1,7 +1,7 @@ using System.IO; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; +using CalamityMod.NPCs.NormalNPCs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; diff --git a/NPCs/SulphurousSea/Gnasher.cs b/NPCs/SulphurousSea/Gnasher.cs index 3a06c588b5..828b72422d 100644 --- a/NPCs/SulphurousSea/Gnasher.cs +++ b/NPCs/SulphurousSea/Gnasher.cs @@ -3,7 +3,7 @@ using CalamityMod.BiomeManagers; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; +using CalamityMod.NPCs.NormalNPCs; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; diff --git a/NPCs/SulphurousSea/Sulflounder.cs b/NPCs/SulphurousSea/Sulflounder.cs index fcf3f4e3d8..52d003d45a 100644 --- a/NPCs/SulphurousSea/Sulflounder.cs +++ b/NPCs/SulphurousSea/Sulflounder.cs @@ -2,7 +2,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Potions; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; +using CalamityMod.NPCs.NormalNPCs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; diff --git a/NPCs/SulphurousSea/Toxicatfish.cs b/NPCs/SulphurousSea/Toxicatfish.cs index 70e1136ec5..8e3d11ea47 100644 --- a/NPCs/SulphurousSea/Toxicatfish.cs +++ b/NPCs/SulphurousSea/Toxicatfish.cs @@ -2,7 +2,7 @@ using CalamityMod.BiomeManagers; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; +using CalamityMod.NPCs.NormalNPCs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; diff --git a/NPCs/SunkenSea/AlphaSeaMinnow.cs b/NPCs/SunkenSea/AlphaSeaMinnow.cs index 6bc7d9c2be..58c72af262 100644 --- a/NPCs/SunkenSea/AlphaSeaMinnow.cs +++ b/NPCs/SunkenSea/AlphaSeaMinnow.cs @@ -8,7 +8,6 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; using Terraria.DataStructures; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.Enums; using System.Collections.Generic; using Steamworks; diff --git a/NPCs/SunkenSea/PodobooKoi.cs b/NPCs/SunkenSea/PodobooKoi.cs index a390f864b8..0b6dcdb2e2 100644 --- a/NPCs/SunkenSea/PodobooKoi.cs +++ b/NPCs/SunkenSea/PodobooKoi.cs @@ -8,7 +8,6 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; using Terraria.DataStructures; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.Enums; using System.Collections.Generic; using Steamworks; diff --git a/NPCs/SunkenSea/SeaMinnow.cs b/NPCs/SunkenSea/SeaMinnow.cs index 7c841a74a1..d5e4c0c4ee 100644 --- a/NPCs/SunkenSea/SeaMinnow.cs +++ b/NPCs/SunkenSea/SeaMinnow.cs @@ -5,7 +5,7 @@ using CalamityMod.BiomeManagers; using CalamityMod.Enums; using CalamityMod.Items.Critters; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; +using CalamityMod.NPCs.NormalNPCs; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; From 14f9bf3edfbb888df85872f7b5f22824a64363e5 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Fri, 6 Jun 2025 16:39:20 -0400 Subject: [PATCH 38/47] Fixed Ultimus Cleaver firing projectiles with Tainted enchantment Also refactored its code a bit --- Items/Weapons/Melee/UltimusCleaver.cs | 108 +++++++++----------------- 1 file changed, 37 insertions(+), 71 deletions(-) diff --git a/Items/Weapons/Melee/UltimusCleaver.cs b/Items/Weapons/Melee/UltimusCleaver.cs index f9128f195b..d910cee78b 100644 --- a/Items/Weapons/Melee/UltimusCleaver.cs +++ b/Items/Weapons/Melee/UltimusCleaver.cs @@ -36,51 +36,34 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.OnFire3, 360); + SoundEngine.PlaySound(SoundID.Item14, target.Center); int onHitDamage = player.CalcIntDamage(Item.damage); Projectile blast = Projectile.NewProjectileDirect(Item.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), onHitDamage, 0f, player.whoAmI, target.whoAmI); blast.DamageType = Item.DamageType; - float firstDustScale = 1.7f; - float secondDustScale = 0.8f; - float thirdDustScale = 2f; - Vector2 dustRotation = (target.rotation - 1.57079637f).ToRotationVector2(); + + Vector2 dustRotation = (target.rotation - MathHelper.PiOver2).ToRotationVector2(); Vector2 dustVelocity = dustRotation * target.velocity.Length(); - SoundEngine.PlaySound(SoundID.Item14, target.Center); - int increment; - for (int i = 0; i < 40; i = increment + 1) + for (int i = 0; i < 40; i++) { - int swingDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.InfernoFork, 0f, 0f, 200, default, firstDustScale); - Dust dust = Main.dust[swingDust]; - dust.position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; - dust.noGravity = true; - dust.velocity.Y -= 6f; - dust.velocity *= 3f; - dust.velocity += dustVelocity * Main.rand.NextFloat(); - swingDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.InfernoFork, 0f, 0f, 100, default, secondDustScale); - dust.position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; - dust.velocity.Y -= 6f; - dust.velocity *= 2f; - dust.noGravity = true; - dust.fadeIn = 1f; - dust.color = Color.Crimson * 0.5f; - dust.velocity += dustVelocity * Main.rand.NextFloat(); - increment = i; + Vector2 mainDustPos = target.Center + Main.rand.NextVector2Circular(target.width / 2, target.width / 2); + Dust swingDust = Dust.NewDustPerfect(mainDustPos, DustID.InfernoFork, dustVelocity * Main.rand.NextFloat() - Vector2.UnitY * 18f, 200, Scale: 1.7f); + swingDust.noGravity = true; + + Dust swingDust2 = Dust.NewDustPerfect(mainDustPos, DustID.InfernoFork, dustVelocity * Main.rand.NextFloat() - Vector2.UnitY * 12f, 100, Color.Crimson * 0.5f, 0.8f); + swingDust2.noGravity = true; + swingDust2.fadeIn = 1f; } - for (int j = 0; j < 20; j = increment + 1) + for (int j = 0; j < 20; j++) { - int swingDust2 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.InfernoFork, 0f, 0f, 0, default, thirdDustScale); - Dust dust = Main.dust[swingDust2]; - dust.position = target.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)target.velocity.ToRotation(), default) * (float)target.width / 3f; - dust.noGravity = true; - dust.velocity.Y -= 6f; - dust.velocity *= 0.5f; - dust.velocity += dustVelocity * (0.6f + 0.6f * Main.rand.NextFloat()); - increment = j; + Vector2 dustPos = target.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(target.velocity.ToRotation()) * (target.width / 3f); + Dust moreDust = Dust.NewDustPerfect(dustPos, DustID.InfernoFork, dustVelocity * (0.6f + 0.6f * Main.rand.NextFloat()) - Vector2.UnitY * 3f, Scale: 2f); + moreDust.noGravity = true; } } public override void MeleeEffects(Player player, Rectangle hitbox) { - if (player.whoAmI == Main.myPlayer) + if (player.whoAmI == Main.myPlayer && !player.Calamity().bladeArmEnchant) { if (player.itemAnimation == (int)(player.itemAnimationMax * 0.1) || player.itemAnimation == (int)(player.itemAnimationMax * 0.3) || @@ -88,65 +71,48 @@ namespace CalamityMod.Items.Weapons.Melee player.itemAnimation == (int)(player.itemAnimationMax * 0.7) || player.itemAnimation == (int)(player.itemAnimationMax * 0.9)) { - float sparkYVel = 0f; float sparkXVel = 0f; - float sparkYSpawn = 0f; + float sparkYVel = 0f; float sparkXSpawn = 0f; + float sparkYSpawn = 0f; + if (player.itemAnimation == (int)(player.itemAnimationMax * 0.9)) { - sparkYVel = -7f; + sparkYVel = -10.5f; + if (player.direction == -1) + sparkXSpawn = -8f; } if (player.itemAnimation == (int)(player.itemAnimationMax * 0.7)) { - sparkYVel = -6f; - sparkXVel = 2f; + sparkYVel = -9f; + sparkXVel = 3f; + sparkXSpawn = player.direction == -1 ? 20f : 26f; } if (player.itemAnimation == (int)(player.itemAnimationMax * 0.5)) { - sparkYVel = -4f; - sparkXVel = 4f; - } - if (player.itemAnimation == (int)(player.itemAnimationMax * 0.3)) - { - sparkYVel = -2f; + sparkYVel = -6f; sparkXVel = 6f; } - if (player.itemAnimation == (int)(player.itemAnimationMax * 0.1)) - { - sparkXVel = 7f; - } - if (player.itemAnimation == (int)(player.itemAnimationMax * 0.7)) - { - sparkXSpawn = 26f; - } if (player.itemAnimation == (int)(player.itemAnimationMax * 0.3)) { - sparkXSpawn -= 4f; - sparkYSpawn -= 20f; + sparkXVel = 9f; + sparkYVel = -3f; + sparkXSpawn = -4f; + sparkYSpawn = -20f; } if (player.itemAnimation == (int)(player.itemAnimationMax * 0.1)) { - sparkYSpawn += 6f; + sparkXVel = 10.5f; + sparkYSpawn = 6f; } - if (player.direction == -1) - { - if (player.itemAnimation == (int)(player.itemAnimationMax * 0.9)) - { - sparkXSpawn -= 8f; - } - if (player.itemAnimation == (int)(player.itemAnimationMax * 0.7)) - { - sparkXSpawn -= 6f; - } - } - sparkYVel *= 1.5f; - sparkXVel *= 1.5f; - sparkXSpawn *= (float)player.direction; + + sparkXVel *= player.direction; + sparkYVel *= player.gravDir; + sparkXSpawn *= player.direction; sparkYSpawn *= player.gravDir; var source = player.GetSource_ItemUse(Item); int damage = (int)player.GetTotalDamage().ApplyTo(Item.damage * 0.1f); - Projectile.NewProjectile(source, (float)(hitbox.X + hitbox.Width / 2) + sparkXSpawn, (float)(hitbox.Y + hitbox.Height / 2) + sparkYSpawn, - (float)player.direction * sparkXVel, sparkYVel * player.gravDir, ModContent.ProjectileType(), damage, 0f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, hitbox.X + hitbox.Width / 2 + sparkXSpawn, hitbox.Y + hitbox.Height / 2 + sparkYSpawn, sparkXVel, sparkYVel, ModContent.ProjectileType(), damage, 0f, player.whoAmI); } } } From 64590c8b3976417163ce5c100bb2a7da8dd0ed32 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Fri, 6 Jun 2025 22:31:12 -0400 Subject: [PATCH 39/47] There goes CIT making boss tweaks again 1 - Death Mode Retinazer now only fires lasers when entering phase 2, and now fires single lasers around it as it spins instead of laser spreads directly at the player 2 - Foveanator now only fires energy bombs when entering phase 2 3 - Death Mode Detonating Bubbles now have health instead of being invincible, and they no longer have increased speed 4 - Decreased size of Death Mode Sharkrons 5 - Increased free Ravager head to match the health of the attached head --- ILEditing/ILChangesLoading.cs | 1 + ILEditing/VanillaStupidityFixingILChanges.cs | 38 ++++++++- NPCs/CalamityGlobalNPC.cs | 5 +- NPCs/NormalNPCs/Foveanator.cs | 77 ++++++++----------- NPCs/Ravager/RavagerHead2.cs | 4 +- .../Bosses/DukeFishronAI.cs | 2 +- NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs | 16 +--- Projectiles/Boss/FoveanatorEnergyBomb.cs | 13 ---- Projectiles/CalamityGlobalProjectile.cs | 2 +- 9 files changed, 82 insertions(+), 76 deletions(-) diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index e8dd980253..f972954fa5 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -192,6 +192,7 @@ namespace CalamityMod.ILEditing // Removal of vanilla stupidity IL_Player.StatusFromNPC += RemoveExpertBrainRandomDebuffs; + IL_NPC.StrikeNPC_HitInfo_bool_bool += LetDetonatingBubblesTakeDamage; IL_Player.ItemCheck_EmitUseVisuals += MakeMagmaStoneFireGauntletDustToggleable; IL_Projectile.EmitEnchantmentVisualsAt += MakeMagmaStoneFireGauntletProjectileDustToggleable; IL_Sandstorm.HasSufficientWind += DecreaseSandstormWindSpeedRequirement; diff --git a/ILEditing/VanillaStupidityFixingILChanges.cs b/ILEditing/VanillaStupidityFixingILChanges.cs index 80c15173f8..d3f3c0cc40 100644 --- a/ILEditing/VanillaStupidityFixingILChanges.cs +++ b/ILEditing/VanillaStupidityFixingILChanges.cs @@ -9,6 +9,7 @@ using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.TownNPCs; using CalamityMod.Walls; +using CalamityMod.World; using Microsoft.Xna.Framework; using Mono.Cecil.Cil; using MonoMod.Cil; @@ -174,12 +175,47 @@ namespace CalamityMod.ILEditing } // Remove the Expert Mode check, and in its place put a check for the Zenith seed (Get fixed boi). - // Note from CIT: I originally removed these entirely; cursor.Emit(OpCodes.Pop); cursor.Emit(OpCodes.Ldsfld, typeof(Main).GetField("zenithWorld")); } #endregion + #region Disable Detonating Bubble StrikeNPC Hardcoded Override + private static void LetDetonatingBubblesTakeDamage(ILContext il) + { + // In vanilla's StrikeNPC function, Detonating Bubbles have a hardcoded type check which sets the damage of the strike to 0. + // This IL edit disables that type check in Death Mode. + var cursor = new ILCursor(il); + + // Go to the point after the check for the Detonating Bubble NPC ID. + if (!cursor.TryGotoNext(MoveType.AfterLabel, i => i.MatchLdcR8(0.0))) + { + LogFailure("Let Detonating Bubbles Take Damage in Death", "Could not move after the NPC type check."); + return; + } + + // Define the label. + var label = il.DefineLabel(); + + // Add a branch if it is Death Mode. + cursor.Emit(OpCodes.Ldsfld, typeof(CalamityWorld).GetField("death")); + cursor.Emit(OpCodes.Brtrue, label); + + // Move to the point after Detonating Bubble changes are implemented to place the branch label. + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchStfld("dontTakeDamage"))) + { + LogFailure("Let Detonating Bubbles Take Damage in Death", "Could not move to after the Detonating Bubble logic."); + return; + } + if (!cursor.TryGotoNext(MoveType.AfterLabel, i => i.MatchLdarg0())) + { + LogFailure("Let Detonating Bubbles Take Damage in Death", "Could not move to after the Detonating Bubble logic."); + return; + } + cursor.MarkLabel(label); + } + #endregion + #region Make Meteorite Explodable private static void MakeMeteoriteExplodable(ILContext il) { diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 05ce02c117..5b2d25d5cf 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -2923,9 +2923,10 @@ namespace CalamityMod.NPCs npc.dontTakeDamage = true; break; - // Make Fishron and Anahita Bubbles immune to damage in Death Mode + // Make Fishron and Anahita Bubbles have actual health in Death Mode case NPCID.DetonatingBubble: - npc.dontTakeDamage = CalamityWorld.death; + if (CalamityWorld.death) + npc.lifeMax = 300; break; default: diff --git a/NPCs/NormalNPCs/Foveanator.cs b/NPCs/NormalNPCs/Foveanator.cs index 30d5b09bca..64f358dc1c 100644 --- a/NPCs/NormalNPCs/Foveanator.cs +++ b/NPCs/NormalNPCs/Foveanator.cs @@ -108,7 +108,6 @@ namespace CalamityMod.NPCs.NormalNPCs CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; // Get a target if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) @@ -241,11 +240,8 @@ namespace CalamityMod.NPCs.NormalNPCs maxVelocity += 4.5f * enrageScale; acceleration += 0.06f * enrageScale; - if (death) - { - maxVelocity += phase1MaxSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); - acceleration += phase1MaxAccelerationIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); - } + maxVelocity += phase1MaxSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); + acceleration += phase1MaxAccelerationIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); if (Main.getGoodWorld) { @@ -278,7 +274,7 @@ namespace CalamityMod.NPCs.NormalNPCs // Foveanator stays in this phase longer than Retinazer (Foveanator time is 450, Retinazer time is 300) // Foveanator has longer cooldown between firing projectiles than Retinazer (Foveanator cooldown is 60, Retinazer cooldown is 30) - float phaseGateValue = 450f - (death ? phase1MaxLaserPhaseDurationDecrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); + float phaseGateValue = 450f - (phase1MaxLaserPhaseDurationDecrease * ((1f - lifeRatio) / (1f - phase2LifeRatio))); float laserGateValue = 60f; if (NPC.IsMechQueenUp) { @@ -297,7 +293,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.netUpdate = true; } - else if (distanceFromDestination < (death ? 960f : 800f)) + else if (distanceFromDestination < 960f) { if (!Main.player[NPC.target].dead) { @@ -344,8 +340,7 @@ namespace CalamityMod.NPCs.NormalNPCs float chargeSpeed = 4f; chargeSpeed += 1f * enrageScale; - if (death) - chargeSpeed += phase1MaxChargeSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); + chargeSpeed += phase1MaxChargeSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); if (Main.getGoodWorld) chargeSpeed += 1f; @@ -359,13 +354,13 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.damage = NPC.defDamage; NPC.ai[2] += 1f; - float decelerateGateValue = 72f + (death ? 12f * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); + float decelerateGateValue = 72f + (12f * ((1f - lifeRatio) / (1f - phase2LifeRatio))); if (NPC.ai[2] >= decelerateGateValue) { // Avoid cheap bullshit NPC.damage = 0; - float decelerationMultiplier = 0.8f - (death ? 0.2f * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); + float decelerationMultiplier = 0.8f - (0.2f * ((1f - lifeRatio) / (1f - phase2LifeRatio))); NPC.velocity *= decelerationMultiplier; if (Math.Abs(NPC.velocity.X) < 0.1) @@ -378,8 +373,7 @@ namespace CalamityMod.NPCs.NormalNPCs // Accelerative charge float maxVelocity = 24f; maxVelocity += 6f * enrageScale; - if (death) - maxVelocity += (phase1MaxChargeSpeedIncrease * 6f) * ((1f - lifeRatio) / (1f - phase2LifeRatio)); + maxVelocity += (phase1MaxChargeSpeedIncrease * 6f) * ((1f - lifeRatio) / (1f - phase2LifeRatio)); if (Main.getGoodWorld) maxVelocity += 6f; @@ -396,7 +390,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.rotation = NPC.velocity.ToRotation() - MathHelper.PiOver2; } - float delayBeforeChargingAgain = 96f - (death ? 6f * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); + float delayBeforeChargingAgain = 96f - (6f * ((1f - lifeRatio) / (1f - phase2LifeRatio))); if (NPC.ai[2] >= delayBeforeChargingAgain) { NPC.ai[3] += 1f; @@ -404,7 +398,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.rotation = hoverRotation; - float totalCharges = death ? 3f : 2f; + float totalCharges = 3f; if (NPC.ai[3] >= totalCharges) { NPC.ai[1] = 0f; @@ -457,14 +451,12 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.ai[1] += 1f; if (NPC.ai[2] >= 0.2f) { - if (NPC.ai[1] % 10f == 0f) + if (NPC.ai[1] % 20f == 0f) { SoundEngine.PlaySound(AstrumDeusHead.LaserSound, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - bool shootLaser = NPC.ai[1] % 20f == 0f; - - int type = shootLaser ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes @@ -478,16 +470,14 @@ namespace CalamityMod.NPCs.NormalNPCs damage = (int)(damage * secondMechMultiplier); } - float projectileSpeed = shootLaser ? (6f + 1.5f * enrageScale) : 16f; - float ai0 = shootLaser ? 0f : (death ? 1f : 0f); + float projectileSpeed = 16f; Vector2 projectileVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * projectileSpeed; - int numProj = shootLaser ? 4 : 2; - int spread = shootLaser ? 15 : 30; + int spread = 30; float rotation = MathHelper.ToRadians(spread); - for (int i = 0; i < numProj; i++) + for (int i = 0; i < 2; i++) { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 60f, perturbedSpeed, type, damage, 0f, Main.myPlayer, ai0); + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i)); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 60f, perturbedSpeed, type, damage, 0f, Main.myPlayer, 1f); } } } @@ -560,8 +550,8 @@ namespace CalamityMod.NPCs.NormalNPCs // Avoid cheap bullshit NPC.damage = 0; - float maxVelocity = 4f + (death ? 1.2f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); - float acceleration = 0.06f + (death ? 0.02f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float maxVelocity = 4f + (1.2f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio)); + float acceleration = 0.06f + (0.02f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio)); maxVelocity += 2f * enrageScale; acceleration += 0.04f * enrageScale; @@ -587,7 +577,7 @@ namespace CalamityMod.NPCs.NormalNPCs // Fire flamethrower for x seconds NPC.ai[2] += (retAlive && spazAlive) ? 1f : 2f; - float phaseGateValue = NPC.IsMechQueenUp ? 1350f : 360f - (death ? 90f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float phaseGateValue = NPC.IsMechQueenUp ? 1350f : 360f - (90f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio)); if (NPC.ai[2] >= phaseGateValue) { // Go to charge phase or fire large barrage of lasers and energy bombs if in final phase @@ -673,7 +663,7 @@ namespace CalamityMod.NPCs.NormalNPCs // Set rotation and velocity NPC.rotation = hoverRotation; - float chargeSpeed = 4.5f + (death ? 1.25f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float chargeSpeed = 4.5f + (1.25f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio)); chargeSpeed += 4f * enrageScale; if (Main.getGoodWorld) chargeSpeed *= 1.2f; @@ -691,7 +681,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.ai[2] += 1f; - float chargeTime = 60f - (death ? 20f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float chargeTime = 60f - (20f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio)); // Slow down if (NPC.ai[2] >= chargeTime) @@ -699,7 +689,7 @@ namespace CalamityMod.NPCs.NormalNPCs // Avoid cheap bullshit NPC.damage = 0; - float deceleration = 0.8f - (death ? 0.15f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float deceleration = 0.8f - (0.15f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio)); NPC.velocity *= deceleration; if (Math.Abs(NPC.velocity.X) < 0.1) @@ -712,8 +702,7 @@ namespace CalamityMod.NPCs.NormalNPCs // Accelerative charge float maxVelocity = 27f; maxVelocity += 6f * enrageScale; - if (death) - maxVelocity += 7.5f * ((1f - lifeRatio) / (1f - phase2LifeRatio)); + maxVelocity += 7.5f * ((1f - lifeRatio) / (1f - phase2LifeRatio)); if (Main.getGoodWorld) maxVelocity *= 1.2f; @@ -738,7 +727,7 @@ namespace CalamityMod.NPCs.NormalNPCs damage = (int)(damage * secondMechMultiplier); } - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + NPC.velocity.SafeNormalize(Vector2.UnitY) * 60f, Vector2.Zero, type, damage, 0f, Main.myPlayer, death ? 2f : 1f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + NPC.velocity.SafeNormalize(Vector2.UnitY) * 60f, Vector2.Zero, type, damage, 0f, Main.myPlayer, 1f); } } @@ -777,8 +766,8 @@ namespace CalamityMod.NPCs.NormalNPCs // Laser and energy bomb barrage else if (NPC.ai[1] == 3f) { - float maxVelocity = 12f + (death ? 2.4f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); - float acceleration = 0.16f + (death ? 0.32f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float maxVelocity = 12f + (2.4f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio)); + float acceleration = 0.16f + (0.32f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio)); maxVelocity += 6f * enrageScale; acceleration += 0.08f * enrageScale; @@ -802,8 +791,8 @@ namespace CalamityMod.NPCs.NormalNPCs { NPC.SimpleFlyMovement(idealVelocity * maxVelocity * 0.5f, acceleration * 0.5f); - // Fire 2 spreads (3 in Death Mode) of energy bombs and lasers - int totalSpreads = death ? 6 : 4; + // Fire 3 spreads of energy bombs and lasers + int totalSpreads = 6; // Fire rates float laserBarrageFireRate = 45f; @@ -838,7 +827,7 @@ namespace CalamityMod.NPCs.NormalNPCs for (int i = 0; i < numProj; i++) { Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 60f, perturbedSpeed, type, damage, 0f, Main.myPlayer, death ? 1f : 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 60f, perturbedSpeed, type, damage, 0f, Main.myPlayer, 1f); } } @@ -940,16 +929,16 @@ namespace CalamityMod.NPCs.NormalNPCs for (int i = 0; i < 10; i++) { - int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 31, 0f, 0f, 100, default, 1.5f); + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Smoke, 0f, 0f, 100, default, 1.5f); Main.dust[dust].velocity *= 1.4f; } for (int i = 0; i < 5; i++) { - int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 6, 0f, 0f, 100, default, 2.5f); + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, 0f, 0f, 100, default, 2.5f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 5f; - dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 6, 0f, 0f, 100, default, 1.5f); + dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, 0f, 0f, 100, default, 1.5f); Main.dust[dust].velocity *= 3f; } diff --git a/NPCs/Ravager/RavagerHead2.cs b/NPCs/Ravager/RavagerHead2.cs index 0fa43d2d62..b2aaf4dd89 100644 --- a/NPCs/Ravager/RavagerHead2.cs +++ b/NPCs/Ravager/RavagerHead2.cs @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.Ravager NPC.height = 80; NPC.defense = 40; NPC.DR_NERD(0.15f); - NPC.lifeMax = 10000; + NPC.lifeMax = 20000; NPC.knockBackResist = 0f; AIType = -1; NPC.netAlways = true; @@ -39,7 +39,7 @@ namespace CalamityMod.NPCs.Ravager if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) { NPC.defense *= 2; - NPC.lifeMax *= 4; + NPC.lifeMax *= 3; } if (BossRushEvent.BossRushActive) { diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/DukeFishronAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/DukeFishronAI.cs index 05ba82522b..db6cf34ce5 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/DukeFishronAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/DukeFishronAI.cs @@ -1147,7 +1147,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 velocityVector = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY); float inertia = 30f; - float velocity = 23f; + float velocity = 20f; npc.velocity = (npc.velocity * inertia + velocityVector * velocity) / (inertia + 1f); npc.scale = npc.ai[3]; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs index aedd0dc065..d7d83bb2d8 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs @@ -347,8 +347,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses SoundEngine.PlaySound(SoundID.Item33, npc.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - bool shootLaser = npc.ai[1] % 20f == 0f; - int type = shootLaser ? ProjectileID.DeathLaser : ModContent.ProjectileType(); + int type = ProjectileID.DeathLaser; int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes @@ -362,16 +361,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses damage = (int)(damage * secondMechMultiplier); } - Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * 7f; - int numProj = shootLaser ? 6 : 2; - int spread = shootLaser ? 20 : 80; - float rotation = MathHelper.ToRadians(spread); - float offset = shootLaser ? 90f : 50f; - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * offset, perturbedSpeed, type, damage, 0f, Main.myPlayer); - } + Vector2 projectileVelocity = npc.rotation.ToRotationVector2() * 7f; + float offset = 90f; + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(projectileVelocity) * offset, projectileVelocity, type, damage, 0f, Main.myPlayer); } } } diff --git a/Projectiles/Boss/FoveanatorEnergyBomb.cs b/Projectiles/Boss/FoveanatorEnergyBomb.cs index 246e80bfb4..9928e7ce90 100644 --- a/Projectiles/Boss/FoveanatorEnergyBomb.cs +++ b/Projectiles/Boss/FoveanatorEnergyBomb.cs @@ -106,19 +106,6 @@ namespace CalamityMod.Projectiles.Boss int damage = (int)Math.Round(Projectile.damage * 0.85); Vector2 laserVelocity = (Main.player[target].Center - Projectile.Center).SafeNormalize(Vector2.UnitY) * laserSpeed; Projectile.NewProjectile(Projectile.GetSource_FromAI(), Projectile.Center + laserVelocity.SafeNormalize(Vector2.UnitY) * 16f, laserVelocity, type, damage, 0f, Main.myPlayer); - - if (Projectile.ai[0] == 2f) - { - Vector2 projectileVelocity = (Main.player[target].Center - Projectile.Center).SafeNormalize(Vector2.UnitY) * laserSpeed * 0.75f; - int numProj = 2; - int spread = 30; - float rotation = MathHelper.ToRadians(spread); - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(Projectile.GetSource_FromAI(), Projectile.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 16f, perturbedSpeed, type, damage, 0f, Main.myPlayer); - } - } } } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index da046e41d1..be27bca4f6 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1212,7 +1212,7 @@ namespace CalamityMod.Projectiles { int sharkron = NPC.NewNPC(projectile.GetSource_FromAI(), (int)center.X, (int)center.Y, NPCID.Sharkron2); Main.npc[sharkron].velocity = projectile.velocity; - Main.npc[sharkron].scale = death ? 2f : 1.5f; + Main.npc[sharkron].scale = 1.5f; Main.npc[sharkron].netUpdate = true; Main.npc[sharkron].ai[2] = projectile.width; Main.npc[sharkron].ai[3] = -1.5f; From f8057a682c4208cf41e27f155a8e6b1ce5c3cd5a Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Fri, 6 Jun 2025 23:44:12 -0400 Subject: [PATCH 40/47] Rock Pillars can deal contact damage again --- NPCs/Ravager/RockPillar.cs | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/NPCs/Ravager/RockPillar.cs b/NPCs/Ravager/RockPillar.cs index ff8adfd193..08344e4ead 100644 --- a/NPCs/Ravager/RockPillar.cs +++ b/NPCs/Ravager/RockPillar.cs @@ -57,18 +57,25 @@ namespace CalamityMod.NPCs.Ravager if (NPC.alpha > 0) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.alpha -= 10; if (NPC.alpha < 0) NPC.alpha = 0; } + else + { + if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) + NPC.damage = (int)(NPC.defDamage * 1.5); + else + NPC.damage = NPC.defDamage; + } if (NPC.ai[0] == 0f) { if (NPC.velocity.Y == 0f) { - // Avoid cheap bullshit - NPC.damage = 0; - if (NPC.ai[1] == -1f) { SoundEngine.PlaySound(SoundID.Item62, NPC.Center); @@ -92,12 +99,6 @@ namespace CalamityMod.NPCs.Ravager Main.dust[rockDust2].velocity *= 2f; } - // Set damage - if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) - NPC.damage = (int)Math.Round(NPC.defDamage * 1.5); - else - NPC.damage = NPC.defDamage; - NPC.noTileCollide = true; NPC.velocity.X = (BossRushEvent.BossRushActive ? 15 : 12) * NPC.direction; NPC.velocity.Y = -28.5f; @@ -108,12 +109,6 @@ namespace CalamityMod.NPCs.Ravager } else { - // Set damage - if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) - NPC.damage = (int)Math.Round(NPC.defDamage * 1.5); - else - NPC.damage = NPC.defDamage; - if (NPC.velocity.Y == 0f || Vector2.Distance(NPC.Center, Main.npc[CalamityGlobalNPC.scavenger].Center) > 2800f) { SoundEngine.PlaySound(SoundID.Item14, NPC.Center); From eab25543090c7c0ae99fef0910da20ba5924031f Mon Sep 17 00:00:00 2001 From: Xyk Date: Fri, 6 Jun 2025 23:25:19 -0700 Subject: [PATCH 41/47] Disgusting Meat new sprite? Funny story, I coded my own version of degusting meat that was about 70% done before deltarune came out, and had it sitting on my computer, only to find that shark did it first when I got back! Anyways I like my sprite edit more :) --- Items/DisgustingMeat.png | Bin 434 -> 3147 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/Items/DisgustingMeat.png b/Items/DisgustingMeat.png index 32e4aad4d2f8cb1940efd06e396ca278c4c7c196..6d743191e2a1ae931ecad48a2f4fcebc90db80c3 100644 GIT binary patch delta 3123 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 From c4ef63b1d35c3aec0ef6c1cf4bb34e19cd07c8fb Mon Sep 17 00:00:00 2001 From: GinYuH <72181395+GinYuH@users.noreply.github.com> Date: Sat, 7 Jun 2025 00:30:39 -0700 Subject: [PATCH 42/47] account for CalamityAI deprecation --- NPCs/AquaticScourge/AquaticScourgeBody.cs | 4 ++-- NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs | 4 ++-- NPCs/AquaticScourge/AquaticScourgeHead.cs | 4 ++-- NPCs/AquaticScourge/AquaticScourgeTail.cs | 4 ++-- NPCs/AstrumAureus/AstrumAureus.cs | 6 +++--- NPCs/AstrumDeus/AstrumDeusBody.cs | 2 +- NPCs/AstrumDeus/AstrumDeusHead.cs | 6 +++--- NPCs/AstrumDeus/AstrumDeusTail.cs | 2 +- NPCs/BrimstoneElemental/BrimstoneElemental.cs | 12 ++++++------ NPCs/Bumblebirb/DraconicSwarmer.cs | 8 ++++---- NPCs/Bumblebirb/Dragonfolly.cs | 8 ++++---- NPCs/CalClone/CalamitasClone.cs | 4 ++-- NPCs/CalClone/Cataclysm.cs | 4 ++-- NPCs/CalClone/Catastrophe.cs | 4 ++-- NPCs/CeaselessVoid/CeaselessVoid.cs | 12 ++++++------ NPCs/Crabulon/Crabulon.cs | 2 +- NPCs/NormalNPCs/Foveanator.cs | 2 +- NPCs/NormalNPCs/WildBumblebirb.cs | 8 ++++---- NPCs/OldDuke/OldDuke.cs | 18 +++++++++--------- 19 files changed, 57 insertions(+), 57 deletions(-) diff --git a/NPCs/AquaticScourge/AquaticScourgeBody.cs b/NPCs/AquaticScourge/AquaticScourgeBody.cs index 39b1151c66..b7f421f08c 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBody.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBody.cs @@ -103,7 +103,7 @@ namespace CalamityMod.NPCs.AquaticScourge // Adjust hostility and stats bool nonHostile = calamityGlobalNPC.newAI[0] == 0f; - if (NPC.justHit || NPC.life <= NPC.lifeMax * 0.999 || bossRush || Main.getGoodWorld) + if (NPC.justHit || NPC.life <= NPC.lifeMax * 0.999 || bossRush || CalamityWorld.LegendaryMode) { if (nonHostile) { @@ -282,7 +282,7 @@ namespace CalamityMod.NPCs.AquaticScourge scourgeMaxSpeed += Vector2.Distance(player.Center, NPC.Center) * 0.001f; } - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) scourgeMaxSpeed *= 1.15f; } diff --git a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs index e08fe0ecea..39a070170d 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs @@ -102,7 +102,7 @@ namespace CalamityMod.NPCs.AquaticScourge // Adjust hostility and stats bool nonHostile = calamityGlobalNPC.newAI[0] == 0f; - if (NPC.justHit || NPC.life <= NPC.lifeMax * 0.999 || bossRush || Main.getGoodWorld) + if (NPC.justHit || NPC.life <= NPC.lifeMax * 0.999 || bossRush || CalamityWorld.LegendaryMode) { if (nonHostile) { @@ -251,7 +251,7 @@ namespace CalamityMod.NPCs.AquaticScourge scourgeMaxSpeed += Vector2.Distance(player.Center, NPC.Center) * 0.001f; } - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) scourgeMaxSpeed *= 1.15f; } diff --git a/NPCs/AquaticScourge/AquaticScourgeHead.cs b/NPCs/AquaticScourge/AquaticScourgeHead.cs index 5d0426a607..37f7762972 100644 --- a/NPCs/AquaticScourge/AquaticScourgeHead.cs +++ b/NPCs/AquaticScourge/AquaticScourgeHead.cs @@ -144,7 +144,7 @@ namespace CalamityMod.NPCs.AquaticScourge // Adjust hostility and stats bool nonHostile = calamityGlobalNPC.newAI[0] == 0f; - if (NPC.justHit || NPC.life <= NPC.lifeMax * 0.999 || bossRush || Main.getGoodWorld) + if (NPC.justHit || NPC.life <= NPC.lifeMax * 0.999 || bossRush || CalamityWorld.LegendaryMode) { if (nonHostile) { @@ -449,7 +449,7 @@ namespace CalamityMod.NPCs.AquaticScourge scourgeAcceleration *= accelerationMultiplier; } - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { scourgeMaxSpeed *= 1.15f; scourgeAcceleration *= 1.15f; diff --git a/NPCs/AquaticScourge/AquaticScourgeTail.cs b/NPCs/AquaticScourge/AquaticScourgeTail.cs index 96c890b5b0..2b49366863 100644 --- a/NPCs/AquaticScourge/AquaticScourgeTail.cs +++ b/NPCs/AquaticScourge/AquaticScourgeTail.cs @@ -100,7 +100,7 @@ namespace CalamityMod.NPCs.AquaticScourge // Adjust hostility and stats bool nonHostile = calamityGlobalNPC.newAI[0] == 0f; - if (NPC.justHit || NPC.life <= NPC.lifeMax * 0.999 || bossRush || Main.getGoodWorld) + if (NPC.justHit || NPC.life <= NPC.lifeMax * 0.999 || bossRush || CalamityWorld.LegendaryMode) { if (nonHostile) { @@ -249,7 +249,7 @@ namespace CalamityMod.NPCs.AquaticScourge scourgeMaxSpeed += Vector2.Distance(player.Center, NPC.Center) * 0.001f; } - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) scourgeMaxSpeed *= 1.15f; } diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index fe3a35f073..1dff906636 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -217,7 +217,7 @@ namespace CalamityMod.NPCs.AstrumAureus walkingVelocity += 1.5f * (1f - lifeRatio); if (revenge) walkingVelocity += Math.Abs(NPC.Center.X - player.Center.X) * 0.0025f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) walkingVelocity *= 1.15f; float walkingProjectileVelocity = walkingVelocity * 0.8f; @@ -653,7 +653,7 @@ namespace CalamityMod.NPCs.AstrumAureus velocity += 6f * enrageScale; if (expertMode) velocity += death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) velocity *= 1.15f; NPC.velocity = (new Vector2(player.Center.X, player.Center.Y - 500f) - NPC.Center).SafeNormalize(Vector2.Zero) * velocity; @@ -1072,7 +1072,7 @@ namespace CalamityMod.NPCs.AstrumAureus if (calamityGlobalNPC.newAI[1] > 0f && !reduceFallSpeed) maxFallSpeed *= calamityGlobalNPC.newAI[1] + 1f; - if (Main.getGoodWorld && !reduceFallSpeed) + if (CalamityWorld.LegendaryMode && !reduceFallSpeed) { gravity *= 1.15f; maxFallSpeed *= 1.15f; diff --git a/NPCs/AstrumDeus/AstrumDeusBody.cs b/NPCs/AstrumDeus/AstrumDeusBody.cs index 1870a9c39c..06ee233b40 100644 --- a/NPCs/AstrumDeus/AstrumDeusBody.cs +++ b/NPCs/AstrumDeus/AstrumDeusBody.cs @@ -174,7 +174,7 @@ namespace CalamityMod.NPCs.AstrumDeus calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = calamityGlobalNPC.newAI[1] < resistanceTime; // Flight timer - float aiSwitchTimer = doubleWormPhase ? (Main.getGoodWorld ? 600f : 1200f) : (Main.getGoodWorld ? 900f : 1800f); + float aiSwitchTimer = doubleWormPhase ? (CalamityWorld.LegendaryMode ? 600f : 1200f) : (CalamityWorld.LegendaryMode ? 900f : 1800f); calamityGlobalNPC.newAI[3] += 1f; if (calamityGlobalNPC.newAI[3] >= aiSwitchTimer) diff --git a/NPCs/AstrumDeus/AstrumDeusHead.cs b/NPCs/AstrumDeus/AstrumDeusHead.cs index 4d78a2c84f..7c6cdb8e61 100644 --- a/NPCs/AstrumDeus/AstrumDeusHead.cs +++ b/NPCs/AstrumDeus/AstrumDeusHead.cs @@ -212,7 +212,7 @@ namespace CalamityMod.NPCs.AstrumDeus calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = calamityGlobalNPC.newAI[1] < resistanceTime; // Flight timer - float aiSwitchTimer = doubleWormPhase ? (Main.getGoodWorld ? 600f : 1200f) : (Main.getGoodWorld ? 900f : 1800f); + float aiSwitchTimer = doubleWormPhase ? (CalamityWorld.LegendaryMode ? 600f : 1200f) : (CalamityWorld.LegendaryMode ? 900f : 1800f); calamityGlobalNPC.newAI[3] += 1f; if (calamityGlobalNPC.newAI[3] >= aiSwitchTimer) @@ -343,7 +343,7 @@ namespace CalamityMod.NPCs.AstrumDeus int startIndexHeadTwo = startIndexHeadOne + phase2Length + 1; int headTwoID = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, NPC.type, startIndexHeadTwo); Main.npc[headTwoID].Calamity().newAI[0] = 2f; - Main.npc[headTwoID].Calamity().newAI[3] = Main.getGoodWorld ? 300f : 600f; + Main.npc[headTwoID].Calamity().newAI[3] = CalamityWorld.LegendaryMode ? 300f : 600f; Main.npc[headTwoID].velocity = Vector2.Normalize(player.Center - Main.npc[headTwoID].Center) * 16f; Main.npc[headTwoID].timeLeft *= 20; Main.npc[headTwoID].ForceNetUpdate(); @@ -580,7 +580,7 @@ namespace CalamityMod.NPCs.AstrumDeus speed *= increaseSpeedMore ? 2f : increaseSpeed ? 1.5f : 1f; turnSpeed *= increaseSpeedMore ? 2f : increaseSpeed ? 1.5f : 1f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { speed *= 1.15f; turnSpeed *= 1.15f; diff --git a/NPCs/AstrumDeus/AstrumDeusTail.cs b/NPCs/AstrumDeus/AstrumDeusTail.cs index 36acea7e26..bb252b80ae 100644 --- a/NPCs/AstrumDeus/AstrumDeusTail.cs +++ b/NPCs/AstrumDeus/AstrumDeusTail.cs @@ -157,7 +157,7 @@ namespace CalamityMod.NPCs.AstrumDeus calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = calamityGlobalNPC.newAI[1] < resistanceTime; // Flight timer - float aiSwitchTimer = doubleWormPhase ? (Main.getGoodWorld ? 600f : 1200f) : (Main.getGoodWorld ? 900f : 1800f); + float aiSwitchTimer = doubleWormPhase ? (CalamityWorld.LegendaryMode ? 600f : 1200f) : (CalamityWorld.LegendaryMode ? 900f : 1800f); calamityGlobalNPC.newAI[3] += 1f; if (calamityGlobalNPC.newAI[3] >= aiSwitchTimer) diff --git a/NPCs/BrimstoneElemental/BrimstoneElemental.cs b/NPCs/BrimstoneElemental/BrimstoneElemental.cs index 82f36a3842..4034b028a6 100644 --- a/NPCs/BrimstoneElemental/BrimstoneElemental.cs +++ b/NPCs/BrimstoneElemental/BrimstoneElemental.cs @@ -466,7 +466,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental NPC.chaseable = true; NPC.ai[3] += 1f; NPC.alpha = 0; - if (NPC.ai[3] >= 2f || phase2 || Main.getGoodWorld) + if (NPC.ai[3] >= 2f || phase2 || CalamityWorld.LegendaryMode) { NPC.ai[0] = -1f; NPC.ai[1] = 0f; @@ -540,7 +540,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental projectileVelocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * velocity; int numProj = death ? 8 : 4; int spread = death ? 90 : 45; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { numProj *= 3; spread *= 2; @@ -582,7 +582,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental NPC.chaseable = false; NPC.localAI[0] += 1f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) NPC.localAI[0] += 2f; if (expertMode) NPC.localAI[0] += 1f - lifeRatio; @@ -753,7 +753,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental int damage = NPC.GetProjectileDamage(type); Projectile.NewProjectile(NPC.GetSource_FromAI(), source, laserVelocity2, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) Projectile.NewProjectile(NPC.GetSource_FromAI(), source, -laserVelocity2, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); if (Main.zenithWorld) @@ -794,7 +794,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental if (Main.netMode != NetmodeID.MultiplayerClient) { Projectile.NewProjectile(NPC.GetSource_FromAI(), source, laserVelocity, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, NPC.whoAmI); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) Projectile.NewProjectile(NPC.GetSource_FromAI(), source, -laserVelocity, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, NPC.whoAmI); if (Main.zenithWorld) @@ -816,7 +816,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental if (Main.netMode != NetmodeID.MultiplayerClient) { Projectile.NewProjectile(NPC.GetSource_FromAI(), source.X, source.Y, NPC.localAI[0], NPC.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, NPC.whoAmI); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) Projectile.NewProjectile(NPC.GetSource_FromAI(), source.X, source.Y, -NPC.localAI[0], -NPC.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, NPC.whoAmI); if (Main.zenithWorld) diff --git a/NPCs/Bumblebirb/DraconicSwarmer.cs b/NPCs/Bumblebirb/DraconicSwarmer.cs index 803380b88f..f486b0a453 100644 --- a/NPCs/Bumblebirb/DraconicSwarmer.cs +++ b/NPCs/Bumblebirb/DraconicSwarmer.cs @@ -127,7 +127,7 @@ namespace CalamityMod.NPCs.Bumblebirb swarmerIdleTargetDist.Normalize(); swarmerIdleTargetDist *= swarmerIdleSpeed; NPC.velocity = (NPC.velocity * 29f + swarmerIdleTargetDist) / 30f; - if (Main.getGoodWorld && !Main.zenithWorld) + if (CalamityWorld.LegendaryMode && !Main.zenithWorld) NPC.velocity *= 1.15f; } else if (NPC.velocity.Length() > 2f) @@ -175,7 +175,7 @@ namespace CalamityMod.NPCs.Bumblebirb swarmerChargeTargetDist.Normalize(); swarmerChargeTargetDist *= swarmerChargeSpeed; NPC.velocity = (NPC.velocity * (swarmerChargeVelMult - 1f) + swarmerChargeTargetDist) / swarmerChargeVelMult; - if (Main.getGoodWorld && !Main.zenithWorld) + if (CalamityWorld.LegendaryMode && !Main.zenithWorld) NPC.velocity *= 1.15f; NPC.ForceNetUpdate(); @@ -203,7 +203,7 @@ namespace CalamityMod.NPCs.Bumblebirb swarmerDecelerateTargetDist.Normalize(); swarmerDecelerateTargetDist *= swarmerDecelerateSpeed; NPC.velocity = (NPC.velocity * (swarmerDecelerateVelMult - 1f) + swarmerDecelerateTargetDist) / swarmerDecelerateVelMult; - if (Main.getGoodWorld && !Main.zenithWorld) + if (CalamityWorld.LegendaryMode && !Main.zenithWorld) NPC.velocity *= 1.15f; if (NPC.velocity.X < 0f) @@ -220,7 +220,7 @@ namespace CalamityMod.NPCs.Bumblebirb NPC.damage = NPC.defDamage; NPC.velocity = swarmerDecelerateTargetDist; - if (Main.getGoodWorld && !Main.zenithWorld) + if (CalamityWorld.LegendaryMode && !Main.zenithWorld) NPC.velocity *= 1.15f; if (NPC.velocity.X < 0f) diff --git a/NPCs/Bumblebirb/Dragonfolly.cs b/NPCs/Bumblebirb/Dragonfolly.cs index 268fadb66a..e7953a25ee 100644 --- a/NPCs/Bumblebirb/Dragonfolly.cs +++ b/NPCs/Bumblebirb/Dragonfolly.cs @@ -175,7 +175,7 @@ namespace CalamityMod.NPCs.Bumblebirb if (NPC.localAI[2] > 0f || bossRush) enrageScale += 1f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) enrageScale += 0.5f; if (enrageScale > 3f) @@ -469,7 +469,7 @@ namespace CalamityMod.NPCs.Bumblebirb bool spawnRight = player.velocity.X > 0f; for (int i = 0; i < totalProjectiles; i++) { - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { if (i >= (int)(totalProjectiles * 0.125) && i <= (int)(totalProjectiles * 0.375)) { @@ -536,13 +536,13 @@ namespace CalamityMod.NPCs.Bumblebirb { int totalProjectiles = phase2 ? 40 : 48; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) totalProjectiles *= 2; float radians = MathHelper.TwoPi / totalProjectiles; int distance = phase2 ? 1200 : 1320; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) distance *= 2; bool spawnRight = player.velocity.X > 0f; diff --git a/NPCs/CalClone/CalamitasClone.cs b/NPCs/CalClone/CalamitasClone.cs index e4571acd7a..8804fae061 100644 --- a/NPCs/CalClone/CalamitasClone.cs +++ b/NPCs/CalClone/CalamitasClone.cs @@ -398,7 +398,7 @@ namespace CalamityMod.NPCs.CalClone baseVelocity += 1.5f * (1f - lifeRatio); baseAcceleration += 0.03f * (1f - lifeRatio); } - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { baseVelocity *= 1.15f; baseAcceleration *= 1.15f; @@ -466,7 +466,7 @@ namespace CalamityMod.NPCs.CalClone if (Main.zenithWorld) type = ModContent.ProjectileType(); - float gigaBlastFrequency = (Main.getGoodWorld ? 120f : expertMode ? 180f : 240f) - enrageScale * 15f; + float gigaBlastFrequency = (CalamityWorld.LegendaryMode ? 120f : expertMode ? 180f : 240f) - enrageScale * 15f; float projSpeed = bossRush ? 6.25f : 5f; if (calamityGlobalNPC.newAI[3] <= 300f) { diff --git a/NPCs/CalClone/Cataclysm.cs b/NPCs/CalClone/Cataclysm.cs index a5cc956364..0645bfce1f 100644 --- a/NPCs/CalClone/Cataclysm.cs +++ b/NPCs/CalClone/Cataclysm.cs @@ -233,7 +233,7 @@ namespace CalamityMod.NPCs.CalClone calCloneBroProjAttackMaxSpeed += 2f * enrageScale; calCloneBroProjAttackAccel += 0.06f * enrageScale; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { calCloneBroProjAttackMaxSpeed *= 1.15f; calCloneBroProjAttackAccel *= 1.15f; @@ -360,7 +360,7 @@ namespace CalamityMod.NPCs.CalClone calCloneBroChargeSpeed += 2f; if (revenge) calCloneBroChargeSpeed += 2f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) calCloneBroChargeSpeed *= 1.25f; Vector2 calCloneBroChargeCenter = NPC.Center; diff --git a/NPCs/CalClone/Catastrophe.cs b/NPCs/CalClone/Catastrophe.cs index 73e07ab8e3..09bd00a219 100644 --- a/NPCs/CalClone/Catastrophe.cs +++ b/NPCs/CalClone/Catastrophe.cs @@ -227,7 +227,7 @@ namespace CalamityMod.NPCs.CalClone calCloneBroProjAttackMaxSpeed += 2f * enrageScale; calCloneBroProjAttackAccel += 0.1f * enrageScale; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { calCloneBroProjAttackMaxSpeed *= 1.15f; calCloneBroProjAttackAccel *= 1.15f; @@ -351,7 +351,7 @@ namespace CalamityMod.NPCs.CalClone calCloneBroChargeSpeed += 2f; if (revenge) calCloneBroChargeSpeed += 2f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) calCloneBroChargeSpeed *= 1.25f; Vector2 calCloneBroChargeCenter = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index cc077b9f94..fafff6489f 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -154,7 +154,7 @@ namespace CalamityMod.NPCs.CeaselessVoid if (phase4) darkEnergyAmt += 1; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) darkEnergyAmt *= 2; // Spawn a few Dark Energies as soon as the fight starts @@ -222,7 +222,7 @@ namespace CalamityMod.NPCs.CeaselessVoid float projectileFireRateMultiplier = MathHelper.Lerp(0.5f, 1.5f, 1f - ((tileEnrageMult - 1f) / 0.5f)); // Decides whether Ceaseless moves closer to its target or not - float distanceRequiredToMove = (Main.getGoodWorld || !anyDarkEnergies) ? 320f : bossRush ? 600f : 720f; + float distanceRequiredToMove = (CalamityWorld.LegendaryMode || !anyDarkEnergies) ? 320f : bossRush ? 600f : 720f; bool move = Vector2.Distance(NPC.Center, player.Center) > distanceRequiredToMove || !Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1); // Succ attack @@ -540,7 +540,7 @@ namespace CalamityMod.NPCs.CeaselessVoid acceleration *= 2f; } - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { velocity *= 1.15f; acceleration *= 1.15f; @@ -550,8 +550,8 @@ namespace CalamityMod.NPCs.CeaselessVoid // Move between 8 different positions around the player, in order float maxDistance = 320f; - Vector2 moveToOffset = succ ? Vector2.Zero : Main.getGoodWorld ? new Vector2(0f, -maxDistance) : Vector2.Zero; - if (!succ && Main.getGoodWorld) + Vector2 moveToOffset = succ ? Vector2.Zero : CalamityWorld.LegendaryMode ? new Vector2(0f, -maxDistance) : Vector2.Zero; + if (!succ && CalamityWorld.LegendaryMode) { // Move to a new location every few seconds calamityGlobalNPC.newAI[2] += 1f; @@ -603,7 +603,7 @@ namespace CalamityMod.NPCs.CeaselessVoid Vector2 distanceFromDestination = destination - NPC.Center; // Movement - if (NPC.Distance(destination) > maxDistance || succ || !Main.getGoodWorld) + if (NPC.Distance(destination) > maxDistance || succ || !CalamityWorld.LegendaryMode) CalamityUtils.SmoothMovement(NPC, 0f, distanceFromDestination, velocity, acceleration, true); } diff --git a/NPCs/Crabulon/Crabulon.cs b/NPCs/Crabulon/Crabulon.cs index d7b8c63f86..4e6a2a0bc7 100644 --- a/NPCs/Crabulon/Crabulon.cs +++ b/NPCs/Crabulon/Crabulon.cs @@ -982,7 +982,7 @@ namespace CalamityMod.NPCs.Crabulon { if (Main.netMode != NetmodeID.MultiplayerClient) { - int crabShroomSpawnFreq = (int)(NPC.lifeMax * (CalamityWorld.LegendaryMode ? 0.01 : CalamityWorld.LegendaryMode ? 0.02 : 0.05)); + int crabShroomSpawnFreq = (int)(NPC.lifeMax * (CalamityWorld.LegendaryMode ? 0.02 : 0.05)); if ((NPC.life + crabShroomSpawnFreq) < NPC.localAI[0]) { NPC.localAI[0] = NPC.life; diff --git a/NPCs/NormalNPCs/Foveanator.cs b/NPCs/NormalNPCs/Foveanator.cs index ea49eba333..963e8d7f0f 100644 --- a/NPCs/NormalNPCs/Foveanator.cs +++ b/NPCs/NormalNPCs/Foveanator.cs @@ -342,7 +342,7 @@ namespace CalamityMod.NPCs.NormalNPCs chargeSpeed += 1f * enrageScale; if (CalamityWorld.LegendaryMode) chargeSpeed += phase1MaxChargeSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) chargeSpeed += 1f; NPC.velocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * chargeSpeed; diff --git a/NPCs/NormalNPCs/WildBumblebirb.cs b/NPCs/NormalNPCs/WildBumblebirb.cs index 360d470790..7bd9d5b4b3 100644 --- a/NPCs/NormalNPCs/WildBumblebirb.cs +++ b/NPCs/NormalNPCs/WildBumblebirb.cs @@ -158,7 +158,7 @@ namespace CalamityMod.NPCs.NormalNPCs swarmerIdleTargetDist.Normalize(); swarmerIdleTargetDist *= swarmerIdleSpeed; NPC.velocity = (NPC.velocity * 29f + swarmerIdleTargetDist) / 30f; - if (Main.getGoodWorld && !Main.zenithWorld) + if (CalamityWorld.LegendaryMode && !Main.zenithWorld) NPC.velocity *= 1.15f; } else if (NPC.velocity.Length() > 2f) @@ -206,7 +206,7 @@ namespace CalamityMod.NPCs.NormalNPCs swarmerChargeTargetDist.Normalize(); swarmerChargeTargetDist *= swarmerChargeSpeed; NPC.velocity = (NPC.velocity * (swarmerChargeVelMult - 1f) + swarmerChargeTargetDist) / swarmerChargeVelMult; - if (Main.getGoodWorld && !Main.zenithWorld) + if (CalamityWorld.LegendaryMode && !Main.zenithWorld) NPC.velocity *= 1.15f; NPC.ForceNetUpdate(); @@ -234,7 +234,7 @@ namespace CalamityMod.NPCs.NormalNPCs swarmerDecelerateTargetDist.Normalize(); swarmerDecelerateTargetDist *= swarmerDecelerateSpeed; NPC.velocity = (NPC.velocity * (swarmerDecelerateVelMult - 1f) + swarmerDecelerateTargetDist) / swarmerDecelerateVelMult; - if (Main.getGoodWorld && !Main.zenithWorld) + if (CalamityWorld.LegendaryMode && !Main.zenithWorld) NPC.velocity *= 1.15f; if (NPC.velocity.X < 0f) @@ -251,7 +251,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.damage = NPC.defDamage; NPC.velocity = swarmerDecelerateTargetDist; - if (Main.getGoodWorld && !Main.zenithWorld) + if (CalamityWorld.LegendaryMode && !Main.zenithWorld) NPC.velocity *= 1.15f; if (NPC.velocity.X < 0f) diff --git a/NPCs/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index 1d6b35bf42..622e9dd92c 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -199,7 +199,7 @@ namespace CalamityMod.NPCs.OldDuke bool death = CalamityWorld.death || bossRush; float exhaustionGateValue = 360f; - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) exhaustionGateValue *= 0.5f; float numberOfAttacksBeforeExhaustion = 12f; @@ -931,7 +931,7 @@ namespace CalamityMod.NPCs.OldDuke NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + 900f), (int)(NPC.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, NPC.whoAmI, 0f, 255); NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X - 900f), (int)(NPC.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, NPC.whoAmI, 0f, 255); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + 1800f), (int)(NPC.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, NPC.whoAmI, 0f, 255); NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X - 1800f), (int)(NPC.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, NPC.whoAmI, 0f, 255); @@ -978,7 +978,7 @@ namespace CalamityMod.NPCs.OldDuke NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + 50f + calamityGlobalNPC.newAI[2]), (int)(NPC.Center.Y + 540f), ModContent.NPCType(), 0, 0f, 0f, 1f, -sharkronVelocity, 255); NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X - 50f - calamityGlobalNPC.newAI[2]), (int)(NPC.Center.Y + 540f), ModContent.NPCType(), 0, 0f, 0f, -1f, -sharkronVelocity, 255); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + 50f + calamityGlobalNPC.newAI[2] * 0.5f), (int)(NPC.Center.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, 1f, -sharkronVelocity, 255); NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X - 50f - calamityGlobalNPC.newAI[2] * 0.5f), (int)(NPC.Center.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, -1f, -sharkronVelocity, 255); @@ -1291,13 +1291,13 @@ namespace CalamityMod.NPCs.OldDuke Vector2 phase2GoreDirection = NPC.rotation.ToRotationVector2() * (Vector2.UnitX * NPC.direction) * (NPC.width + 20) / 2f + NPC.Center; int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - int totalGore = Main.getGoodWorld ? 40 : 20; + int totalGore = CalamityWorld.LegendaryMode ? 40 : 20; for (int i = 0; i < totalGore; i++) { float velocityX = NPC.direction * goreVelocityX * (Main.rand.NextFloat(0.2f, 0.8f) + 0.5f); float velocityY = goreVelocityY * (Main.rand.NextFloat(0.2f, 0.8f) + 0.5f); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { velocityX *= Main.rand.NextFloat() + 0.5f; velocityY *= Main.rand.NextFloat() + 0.5f; @@ -1361,7 +1361,7 @@ namespace CalamityMod.NPCs.OldDuke NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + 50f + calamityGlobalNPC.newAI[2]), (int)(NPC.Center.Y - 540f), ModContent.NPCType(), 0, 0f, 0f, 1f, sharkronVelocity, 255); NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X - 50f - calamityGlobalNPC.newAI[2]), (int)(NPC.Center.Y - 540f), ModContent.NPCType(), 0, 0f, 0f, -1f, sharkronVelocity, 255); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + 50f + calamityGlobalNPC.newAI[2] * 0.5f), (int)(NPC.Center.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, 1f, -sharkronVelocity, 255); NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X - 50f - calamityGlobalNPC.newAI[2] * 0.5f), (int)(NPC.Center.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, -1f, -sharkronVelocity, 255); @@ -1667,13 +1667,13 @@ namespace CalamityMod.NPCs.OldDuke Vector2 phase3GoreDirection = NPC.rotation.ToRotationVector2() * (Vector2.UnitX * NPC.direction) * (NPC.width + 20) / 2f + NPC.Center; int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - int totalGore = Main.getGoodWorld ? 40 : 20; + int totalGore = CalamityWorld.LegendaryMode ? 40 : 20; for (int i = 0; i < totalGore; i++) { float velocityX = NPC.direction * goreVelocityX * (Main.rand.NextFloat(0.2f, 0.8f) + 0.5f); float velocityY = goreVelocityY * (Main.rand.NextFloat(0.2f, 0.8f) + 0.5f); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { velocityX *= Main.rand.NextFloat() + 0.5f; velocityY *= Main.rand.NextFloat() + 0.5f; @@ -1696,7 +1696,7 @@ namespace CalamityMod.NPCs.OldDuke NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + x), (int)(NPC.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, NPC.whoAmI, 0f, 255); NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X - x), (int)(NPC.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, NPC.whoAmI, 0f, 255); - if (Main.getGoodWorld) + if (CalamityWorld.LegendaryMode) { NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + x), (int)(NPC.Center.Y - calamityGlobalNPC.newAI[2] * 0.5f), ModContent.NPCType(), 0, 0f, 0f, NPC.whoAmI, 0f, 255); NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X - x), (int)(NPC.Center.Y - calamityGlobalNPC.newAI[2] * 0.5f), ModContent.NPCType(), 0, 0f, 0f, NPC.whoAmI, 0f, 255); From 20905ba003accda0b22547e7b4c0add769ad91bc Mon Sep 17 00:00:00 2001 From: GinYuH <72181395+GinYuH@users.noreply.github.com> Date: Sat, 7 Jun 2025 00:34:35 -0700 Subject: [PATCH 43/47] PR comment revisions --- NPCs/Other/THELORDE.cs | 2 +- NPCs/SlimeGod/CrimulanPaladin.cs | 2 +- NPCs/SlimeGod/EbonianPaladin.cs | 2 +- NPCs/SlimeGod/SplitCrimulanPaladin.cs | 2 +- NPCs/SlimeGod/SplitEbonianPaladin.cs | 2 +- NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs | 2 +- NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs | 2 +- NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs | 2 +- .../RegularEnemies/RevengeanceAndDeathAI.cs | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/NPCs/Other/THELORDE.cs b/NPCs/Other/THELORDE.cs index 3262a9b565..a01ab4802f 100644 --- a/NPCs/Other/THELORDE.cs +++ b/NPCs/Other/THELORDE.cs @@ -584,7 +584,7 @@ namespace CalamityMod.NPCs.Other public override void ModifyNPCLoot(NPCLoot npcLoot) { double pisquaredover6 = Math.Pow(MathHelper.Pi, 2) / 6; - npcLoot.AddIf(() => CalamityWorld.LegendaryMode, ModContent.ItemType()); // guaranteed in legendarev mode + npcLoot.AddIf(() => CalamityWorld.LegendaryMode, ModContent.ItemType()); // guaranteed in Legendary mode npcLoot.AddIf(() => !CalamityWorld.LegendaryMode, ModContent.ItemType(), 27); // otherwise 1 in 27 npcLoot.Add(ModContent.ItemType(), 1, 22, (int)(pisquaredover6 * 100)); } diff --git a/NPCs/SlimeGod/CrimulanPaladin.cs b/NPCs/SlimeGod/CrimulanPaladin.cs index 6909ef9f42..f461f3d54c 100644 --- a/NPCs/SlimeGod/CrimulanPaladin.cs +++ b/NPCs/SlimeGod/CrimulanPaladin.cs @@ -112,7 +112,7 @@ namespace CalamityMod.NPCs.SlimeGod addedStretch = -landingRecoil; // Used for teleporting - float scale = CalamityWorld.LegendaryMode ? 0.6f : CalamityWorld.LegendaryMode ? 0.8f : 1f; + float scale = CalamityWorld.LegendaryMode ? 0.6f : 1f; // How fast the slime slams down float slamVelocity = bossRush ? 20f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; diff --git a/NPCs/SlimeGod/EbonianPaladin.cs b/NPCs/SlimeGod/EbonianPaladin.cs index 6cd7be29a6..a49d3555ce 100644 --- a/NPCs/SlimeGod/EbonianPaladin.cs +++ b/NPCs/SlimeGod/EbonianPaladin.cs @@ -101,7 +101,7 @@ namespace CalamityMod.NPCs.SlimeGod setDamage += 22; } - float scale = CalamityWorld.LegendaryMode ? 0.6f : CalamityWorld.LegendaryMode ? 0.8f : 1f; + float scale = CalamityWorld.LegendaryMode ? 0.6f : 1f; NPC.aiAction = 0; // Get a target diff --git a/NPCs/SlimeGod/SplitCrimulanPaladin.cs b/NPCs/SlimeGod/SplitCrimulanPaladin.cs index b588ad49fd..6bf583da4e 100644 --- a/NPCs/SlimeGod/SplitCrimulanPaladin.cs +++ b/NPCs/SlimeGod/SplitCrimulanPaladin.cs @@ -127,7 +127,7 @@ namespace CalamityMod.NPCs.SlimeGod addedStretch = -landingRecoil; // Used for teleporting - float scale = CalamityWorld.LegendaryMode ? 0.6f : CalamityWorld.LegendaryMode ? 0.8f : 1f; + float scale = CalamityWorld.LegendaryMode ? 0.6f : 1f; // How fast the slime slams down float slamVelocity = bossRush ? 22.25f : death ? 18.25f : revenge ? 16.5f : expertMode ? 15.5f : 13.5f; diff --git a/NPCs/SlimeGod/SplitEbonianPaladin.cs b/NPCs/SlimeGod/SplitEbonianPaladin.cs index 16c55de137..64344a009e 100644 --- a/NPCs/SlimeGod/SplitEbonianPaladin.cs +++ b/NPCs/SlimeGod/SplitEbonianPaladin.cs @@ -123,7 +123,7 @@ namespace CalamityMod.NPCs.SlimeGod addedStretch = -landingRecoil; - float scale = CalamityWorld.LegendaryMode ? 0.6f : CalamityWorld.LegendaryMode ? 0.8f : 1f; + float scale = CalamityWorld.LegendaryMode ? 0.6f : 1f; // How fast the slime slams down float slamVelocity = bossRush ? 20f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs index 47a935b86b..fabcacbcb3 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs @@ -1052,7 +1052,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses public static int GetBrainOfCthuluCreepersCountRevDeath() { - return CalamityWorld.LegendaryMode ? 40 : CalamityWorld.LegendaryMode ? 35 : (CalamityWorld.death || BossRushEvent.BossRushActive) ? 30 : 20; + return CalamityWorld.LegendaryMode ? 40 : (CalamityWorld.death || BossRushEvent.BossRushActive) ? 30 : 20; } private static float GetCrimsonBossKnockBack(NPC npc, int numPlayers, float lifeScale, float baseKnockBackResist) diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs index 8d6bc39693..fde22e50e2 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs @@ -554,7 +554,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; // Adjust size based on HP - float maxScale = death ? (CalamityWorld.LegendaryMode ? 6f : 2.5f) : (CalamityWorld.LegendaryMode ? 3f : 1.5f); + float maxScale = CalamityWorld.LegendaryMode ? 3f : death ? 2.5f : 1.5f; float minScale = death ? 0.5f : 0.75f; float maxScaledValue = maxScale - minScale; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs index 380f498762..74f818940d 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs @@ -48,7 +48,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } if (CalamityWorld.LegendaryMode) - enrageScale += (CalamityWorld.LegendaryMode ? 1f : 0.5f); + enrageScale += 1f; if (bossRush) enrageScale = 2f; diff --git a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs index 97af54642c..16c8b29ac6 100644 --- a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs +++ b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs @@ -6790,7 +6790,7 @@ PrepareToShoot: int projType = ProjectileID.SandBallFalling; - // If FTW is enabled, can fire 8 to 13 sand balls (random chance for 10x the amount) + // If Legendary is enabled, can fire 8 to 13 sand balls (random chance for 10x the amount) int projAmt = 1; if (CalamityWorld.LegendaryMode) { From 7f76416eb41148281e1dafb58600807f4e16470e Mon Sep 17 00:00:00 2001 From: GinYuH <72181395+GinYuH@users.noreply.github.com> Date: Sat, 7 Jun 2025 00:38:51 -0700 Subject: [PATCH 44/47] this comment was always inaccurate --- CalPlayer/CalamityPlayerHitHurt.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index 51a94a1d11..fa96a6410f 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -885,7 +885,7 @@ namespace CalamityMod.CalPlayer contactDamageReduction *= (double)Crumbling.MultiplicativeDamageReductionPlayer; // Contact damage reduction is reduced by DR Damage, which itself is proportional to defense damage - // In GFB, as defense damage is uncapped, DR damage is also uncapped. + // In FTW, as defense damage is uncapped, DR damage is also uncapped. int currentDefense = Player.GetCurrentDefense(false); if (totalDefenseDamage > 0 && currentDefense > 0) { From f56e9a6c921ccedc0e021172b4ae6198bd694a2f Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sat, 7 Jun 2025 15:59:13 -0400 Subject: [PATCH 45/47] Added Dryad name Kanna for donor (reference to Blaster Master Zero Trilogy, apparently) --- NPCs/CalamityGlobalTownNPC.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index 2e8c0548e0..fbbd2dc3f0 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -110,6 +110,7 @@ namespace CalamityMod.NPCs "Jasmine", // <@!430532867479699456> (phantasmagoria.) "Cybil", // <@!486507232666845185> (Captain Doofus#????) "Ruth", // <@!1001307586068492388> (briny_coffee) + "Kanna", // <@!730203712898859018> (cosmoredeathwish) }; private static readonly string[] DyeTraderNames = null; private static readonly string[] GoblinTinkererNames = From c3b73ff025510aca9d22502418a13ddb06213253 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Sat, 7 Jun 2025 16:01:00 -0400 Subject: [PATCH 46/47] Fixed Buzzkill firing multiple projectiles in MP We probably should get a hotfix for stuff like this --- Projectiles/Ranged/BuzzkillHoldout.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Projectiles/Ranged/BuzzkillHoldout.cs b/Projectiles/Ranged/BuzzkillHoldout.cs index 04c8fdb96e..c10454ba39 100644 --- a/Projectiles/Ranged/BuzzkillHoldout.cs +++ b/Projectiles/Ranged/BuzzkillHoldout.cs @@ -82,13 +82,16 @@ namespace CalamityMod.Projectiles.Ranged SoundStyle ShootSound = new("CalamityMod/Sounds/Item/SawShot", 2) { PitchVariance = 0.1f, Volume = 0.4f + SawPower * 0.5f }; SoundEngine.PlaySound(ShootSound, GunTipPosition); - float sawDamageMult = MathHelper.Lerp(1f, 5f, SawPower) / 1.5f; // The damage must be divided by 1.5 to offset the holdout having 1.5x base damage. - int sawPierce = (int)MathHelper.Lerp(2f, 6f, SawPower); int sawLevel = (SawPower >= 1f).ToInt() + (SawPower >= 0.25f).ToInt(); + if (Main.myPlayer == Projectile.owner) + { + float sawDamageMult = MathHelper.Lerp(1f, 5f, SawPower) / 1.5f; // The damage must be divided by 1.5 to offset the holdout having 1.5x base damage. + int sawPierce = (int)MathHelper.Lerp(2f, 6f, SawPower); - Projectile buzzsaw = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * Owner.ActiveItem().shootSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * sawDamageMult), (int)(Projectile.knockBack * (sawDamageMult / 2)), Main.myPlayer, sawLevel); - buzzsaw.penetrate = sawPierce; - buzzsaw.rotation = Main.rand.NextFloat(0f, MathHelper.TwoPi); + Projectile buzzsaw = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * Owner.ActiveItem().shootSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * sawDamageMult), (int)(Projectile.knockBack * (sawDamageMult / 2)), Main.myPlayer, sawLevel); + buzzsaw.penetrate = sawPierce; + buzzsaw.rotation = Main.rand.NextFloat(0f, MathHelper.TwoPi); + } NoSawOnHoldout = true; OffsetLengthFromArm -= 4f + 12f * SawPower; From e01a24cc13232dcf4c7ea07ae59a7373837b5d27 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sat, 7 Jun 2025 18:00:23 -0400 Subject: [PATCH 47/47] Added Orange Tabby Town Cat name Dali for donor --- NPCs/CalamityGlobalTownNPC.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index fbbd2dc3f0..dbf3e92fce 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -343,6 +343,7 @@ namespace CalamityMod.NPCs { "Felix", // <@!183424826407518208> (lilac_vrt_olligoci) "Tardo", // <@!739343546867384391> (midnight295) + "Dali", // <@!460238880436781061> (darthlego) }; private static readonly string[] TownCatRussianBlueNames = null; private static readonly string[] TownCatSilverNames =