From 34a3b90807323c61d614209371a5918cfcc03546 Mon Sep 17 00:00:00 2001 From: mochi-angel Date: Thu, 19 Sep 2024 02:17:27 -0700 Subject: [PATCH 001/118] Missing firing effects and cluster behavior --- Items/Weapons/Ranged/SulphuricAcidCannon.cs | 54 +++++- ...ods.CalamityMod.Items.Weapons.Ranged.hjson | 6 +- .../Mods.CalamityMod.Projectiles.Ranged.hjson | 1 + .../Magic/SulphuricAcidCannonExplosion.cs | 62 +++++++ Projectiles/Ranged/SulphuricBlast.cs | 155 ++++++++++++++---- Projectiles/Ranged/SulphuricBlast.png | Bin 19177 -> 817 bytes 6 files changed, 244 insertions(+), 34 deletions(-) create mode 100644 Projectiles/Magic/SulphuricAcidCannonExplosion.cs diff --git a/Items/Weapons/Ranged/SulphuricAcidCannon.cs b/Items/Weapons/Ranged/SulphuricAcidCannon.cs index 36c41d54c0..5cf78b145f 100644 --- a/Items/Weapons/Ranged/SulphuricAcidCannon.cs +++ b/Items/Weapons/Ranged/SulphuricAcidCannon.cs @@ -1,8 +1,11 @@ using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using Microsoft.Xna.Framework; +using Terraria.DataStructures; +using Terraria; using Terraria.ID; using Terraria.ModLoader; +using System; namespace CalamityMod.Items.Weapons.Ranged { @@ -18,21 +21,64 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 90; Item.height = 30; - Item.damage = 144; + Item.damage = 550; Item.DamageType = DamageClass.Ranged; - Item.useTime = 18; - Item.useAnimation = 18; + Item.useTime = 35; + Item.useAnimation = 35; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6f; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; - Item.UseSound = SoundID.Item95; + Item.UseSound = SoundID.Item73; + Item.useAmmo = AmmoID.Rocket; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; Item.rare = ModContent.RarityType(); } public override Vector2? HoldoutOffset() => Vector2.UnitX * -15f; + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + //Slight randomization + float SpeedX = velocity.X + (float)Main.rand.Next(-40, 41) * 0.05f; + float SpeedY = velocity.Y + (float)Main.rand.Next(-40, 41) * 0.05f; + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, Item.shoot, damage, knockback, player.whoAmI); + return false; + } + + public override void UseStyle(Player player, Rectangle heldItemFrame) + { + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); + float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; + + float pullback = 7f; + + float animProgress = 0.5f - player.itemTime / (float)player.itemTimeMax; + float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; + if (animProgress < 0.4f) + pullback -= (2.75f) * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2); + + Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * pullback; + Vector2 itemSize = new Vector2(52, 28); + Vector2 itemOrigin = new Vector2(-24, 4); + + CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); + + base.UseStyle(player, heldItemFrame); + } + + public override void UseItemFrame(Player player) + { + player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X)); + + float animProgress = 0.5f - player.itemTime / (float)player.itemTimeMax; + float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; + if (animProgress < 0.4f) + rotation += (player.altFunctionUse == 2 ? -0.15f : 0) * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2) * player.direction; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); + } } } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index b11bd92b13..1f62455286 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -1240,7 +1240,11 @@ StormSurge: { SulphuricAcidCannon: { DisplayName: Sulphuric Acid Cannon - Tooltip: Fires an acidic shot that sticks to enemies and dissolves them + Tooltip: + ''' + Fires homing Acid Rockets + Acid Rockets stick to enemies and explode into toxic mist after a short delay + ''' } SuperradiantSlaughterer: { diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson index 11209f6fc1..443d84e351 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson @@ -252,3 +252,4 @@ HellbornProj.DisplayName: Hell-born Gunblast HellbornShell.DisplayName: Hell's Shell RubicoPrimeMag.DisplayName: Rubico Prime Mag MegalodonShot.DisplayName: Megalodon Shot +SulphuricAcidCannonExplosion.DisplayName: Sulphuric Acid Cannon Explosion diff --git a/Projectiles/Magic/SulphuricAcidCannonExplosion.cs b/Projectiles/Magic/SulphuricAcidCannonExplosion.cs new file mode 100644 index 0000000000..fb34a3ae23 --- /dev/null +++ b/Projectiles/Magic/SulphuricAcidCannonExplosion.cs @@ -0,0 +1,62 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class SulphuricAcidCannonExplosion : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = 400; + Projectile.height = 365; + Projectile.friendly = true; + Projectile.ignoreWater = false; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 20; + Projectile.DamageType = DamageClass.Ranged; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.75f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.01f / 255f); + } + + public override void OnSpawn(IEntitySource source) + { + base.OnSpawn(source); + int dustAmount = Main.rand.Next(14, 20 + 1); + for (int i = 0; i <= 28; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 278, new Vector2(7, 7).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1.3f), 0, default, Main.rand.NextFloat(0.7f, 1.3f)); + dust.noGravity = false; + dust.color = Color.SeaGreen; + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 120); + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.8f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.5f * Projectile.scale, targetHitbox); + } +} diff --git a/Projectiles/Ranged/SulphuricBlast.cs b/Projectiles/Ranged/SulphuricBlast.cs index fba65d999f..f7c40082a9 100644 --- a/Projectiles/Ranged/SulphuricBlast.cs +++ b/Projectiles/Ranged/SulphuricBlast.cs @@ -1,8 +1,14 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Graphics.Primitives; using CalamityMod.Particles; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -11,10 +17,19 @@ namespace CalamityMod.Projectiles.Ranged public class SulphuricBlast : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; - public const int TotalSecondsToStick = 8; + public NPC chosenTarget; + public bool stuckInTarget = false; + public bool stuckInGround = false; + public int stuckTimer = 200; + public bool canDamage = true; + public bool canStick = true; + public Vector2 vibrate = Vector2.Zero; + public Vector2 placementCenter; + float placementDistance; + public Vector2 storedVelocity; + Vector2 placementVelocity; public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 20; ProjectileID.Sets.CultistIsResistantTo[Type] = true; } @@ -29,48 +44,130 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = -1; Projectile.alpha = 255; Projectile.MaxUpdates = 3; + Projectile.timeLeft = 600; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 11; } public override void AI() { - if (Projectile.FinalExtraUpdate()) - Projectile.frameCounter++; - Projectile.frame = Projectile.frameCounter / 4 % Main.projFrames[Projectile.type]; - - Projectile.StickyProjAI(8); - Projectile.Opacity = Utils.GetLerpValue(CalamityUtils.SecondsToFrames(TotalSecondsToStick), CalamityUtils.SecondsToFrames(TotalSecondsToStick * 0.5f), Projectile.localAI[0], true); - - // Emit sulpuric gas. - if (Main.netMode != NetmodeID.Server && Projectile.FinalExtraUpdate() && Projectile.velocity.Length() > 3f) - { - Color color = new Color(136, 211, 113, 127); - Color fadeColor = new Color(165, 165, 86); - Vector2 gasSpawnPosition = Projectile.Center + Main.rand.NextVector2Circular(8f, 8f); - Vector2 gasVelocity = Projectile.velocity * 1.2f + Projectile.velocity.RotatedBy(0.75f) * 0.3f; - gasVelocity *= Main.rand.NextFloat(0.24f, 0.6f); - - Particle gas = new MediumMistParticle(gasSpawnPosition, gasVelocity, color, fadeColor, Main.rand.NextFloat(0.5f, 1f), 205 - Main.rand.Next(50), 0.02f); - GeneralParticleHandler.SpawnParticle(gas); - } - + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + float power = 4; + vibrate = Main.rand.NextVector2Circular(power, power); // Home in on enemies if not sticking to anything. - if (Projectile.ai[0] != 1f) + if (!stuckInTarget) { CalamityUtils.HomeInOnNPC(Projectile, true, 720f, 16f, Projectile.MaxUpdates * 20f); - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + // Trailing effects, only applied when homing + if (Main.netMode != NetmodeID.Server && Projectile.FinalExtraUpdate() && Projectile.velocity.Length() > 3f) + { + Color color = new Color(136, 211, 113, 127); + Color fadeColor = new Color(165, 165, 86); + Vector2 gasSpawnPosition = Projectile.Center + Main.rand.NextVector2Circular(8f, 8f); + Vector2 gasVelocity = Projectile.velocity * 1.2f + Projectile.velocity.RotatedBy(0.75f) * 0.3f; + gasVelocity *= Main.rand.NextFloat(0.24f, 0.6f); + + Particle gas = new MediumMistParticle(gasSpawnPosition, gasVelocity, color, fadeColor, Main.rand.NextFloat(0.5f, 1f), 205 - Main.rand.Next(50), 0.02f); + GeneralParticleHandler.SpawnParticle(gas); + if (Projectile.timeLeft <= 590) + { + for (int i = 0; i < 2; i++) + { + Particle spark = new GlowSparkParticle(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10, -Projectile.velocity, false, 8, 0.13f * (i == 0 ? 0.2f : 0.5f), Color.Lerp(Color.SeaGreen, Color.PaleGreen, 0.25f) * 0.5f, new Vector2(0.3f, 1f), false, false, 0.8f); + GeneralParticleHandler.SpawnParticle(spark); + } + for (int i = 0; i < 2; i++) + { + Color bubbleColor = Main.rand.NextBool() ? Color.SeaGreen : Color.YellowGreen; + Vector2 bubbleSpawnPos = Projectile.Center + Main.rand.NextVector2Circular(50, 50); + Vector2 bubbleVelocity = -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.8f); + Particle bubble = new DirectionalPulseRing(bubbleSpawnPos, bubbleVelocity, bubbleColor, new Vector2(0.8f, 1), 0, 0.1f, 0f, 75); + GeneralParticleHandler.SpawnParticle(bubble); + } + } + //Firing Effects + if (Projectile.timeLeft <= 595) + { + Particle pulse = new DirectionalPulseRing(Projectile.Center, Projectile.velocity / 100f, Color.Aqua, new Vector2(1f, 2.5f), Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2, 0.2f, 0.03f, 20); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse2 = new DirectionalPulseRing(Projectile.Center, Projectile.velocity / 90f, Color.DodgerBlue, new Vector2(1f, 2.5f), Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2, 0.1f, 0.025f, 35); + GeneralParticleHandler.SpawnParticle(pulse2); + } + } + } + else if (stuckInTarget) + { + placementCenter = chosenTarget.Center + placementVelocity * placementDistance + storedVelocity; + + Projectile.Center = placementCenter; + Projectile.rotation = (storedVelocity).SafeNormalize(Vector2.UnitX).ToRotation() + MathHelper.PiOver2; + stuckTimer--; + if (chosenTarget.life <= 0 || chosenTarget == null) + stuckTimer = 0; + if (stuckTimer == 0) + { + Projectile.Kill(); + } + if (stuckTimer == 40) + { + SoundStyle Primed = new("CalamityMod/Sounds/Custom/PlagueSounds/PBGAttackSwitchShort"); + SoundEngine.PlaySound(Primed with { Volume = 0.5f }, Projectile.Center); + } + } + Projectile.Opacity = 1f; + } + public override bool? CanDamage() => canDamage ? null : false; + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (target == chosenTarget) + target.AddBuff(ModContent.BuffType(), 180); + if (!stuckInTarget && canStick) + { + canDamage = false; + Projectile.rotation = (Projectile.velocity).SafeNormalize(Vector2.UnitX).ToRotation() + MathHelper.PiOver2; + placementDistance = -Vector2.Distance(target.Center, Projectile.Center); + placementVelocity = (target.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); + placementCenter = placementVelocity * (placementDistance * 0.01f); + chosenTarget = target; + stuckInTarget = true; + storedVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 8; + Projectile.velocity = Vector2.Zero; } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => Projectile.ModifyHitNPCSticky(2); + public override void OnKill(int timeLeft) + { + SoundStyle fire = new("CalamityMod/Sounds/Custom/PlagueSounds/PlagueBoom", 4); + SoundEngine.PlaySound(fire with { Volume = 0.9f, Pitch = -0.3f }, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item107, Projectile.Center); + if (Projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 2), Projectile.knockBack, Projectile.owner, ai1: 160f); + } + // Circular spread of clouds and bubbles for impact + for (int i = 0; i < 35; i++) + { + Vector2 smokeVel = Main.rand.NextVector2Unit() * Main.rand.NextVector2Circular(32f, 32f); + Color smokeColor = Main.rand.NextBool() ? Color.SeaGreen : Color.PaleGreen; + Particle smoke = new MediumMistParticle(Projectile.Center, smokeVel, smokeColor, Color.Black, Main.rand.NextFloat(1.4f, 4f), 200 - Main.rand.Next(60), 0.08f); + GeneralParticleHandler.SpawnParticle(smoke); + } + for (int i = 0; i < 8; i++) + { + Vector2 bubbleVel = Main.rand.NextVector2Circular(26f, 26f); + Color bubbleColor = Main.rand.NextBool() ? Color.OliveDrab : Color.SeaGreen; + DirectionalPulseRing pulse = new DirectionalPulseRing(Projectile.Center, bubbleVel, bubbleColor, new Vector2(0.8f, 1), 0, 0.21f, 0f, 50); + GeneralParticleHandler.SpawnParticle(pulse); + } + //Explosion effect + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.SeaGreen, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.2f, 20, true, 1f); + GeneralParticleHandler.SpawnParticle(blastRing); + } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { + { if (targetHitbox.Width > 8 && targetHitbox.Height > 8) { targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8); @@ -83,7 +180,7 @@ namespace CalamityMod.Projectiles.Ranged Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; int projFrame = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; int y6 = projFrame * Projectile.frame; - Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, projFrame)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)projFrame / 2f), Projectile.scale, SpriteEffects.None, 0); + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + vibrate, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, projFrame)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)projFrame / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } } diff --git a/Projectiles/Ranged/SulphuricBlast.png b/Projectiles/Ranged/SulphuricBlast.png index 3d5a42c1ee65055fe0648ef81939e2fa7f136b45..4887726b1ba5d2a9db4c13b67f97f99314ffeee2 100644 GIT binary patch delta 809 zcmV+^1J?ZMl>xB^kQRRcEC>bw004VwsD1zd00DDSM?wIu&K&6g000DMK}|sb0I`n? z{9y$E00O~DL_t(oN6nYbPg7A4#S4Uf+4h0dS|bv)lmdzo4AE*6G>Br4@1b`jJ}4Zo=2d2-_eCo5bE`6(9L`f zj`H{WkrU}ibJ>6Jtn_jYxpY=JN7wp8(3RWHL^{kYq@i?@ zK3Tl0e|tI#EugsTPIq*amc>~Y2%bg4*(J}DWOXbIKw{`vW6;Vuk~qC} z=$1^p_^+HhC345|^Ae?wO3U(S$2`zI{FQvd(} n4rL)&NoGw=04e|g00;m8000000Mb*F00000NkvXXu0mjf_q2!o literal 19177 zcmbTeS5#AN*R~x*K@mX&h0vuVAWb?62ojLqk&g7vjr0T}h@h0vt5gX!H0ix4z4s2G z_ugB8FW&F_eBU$1zxQutjkS?6R@PeAHRmypGeN4#vQG#o2><}VllOA()UltG0092r zLp+xz1)d3 zynp|UHSp}8r>!*Z&o%D5^t+_G^q-4&{KlvAaeM$c zhP=S}Rhk7_bVJui%7k5m01|coG_K#^U4S+|Q-?nRC21vYkpP*f^H^$TL~rP^_OZm!!3pkSbL z%OP|ClVbi^9JT?v$M1&zC{s%SeSxuN0PES>ah%+_8ZMkX%Fj1{ydL?oe!ewZhIGFx zfi8Ll}ga+P4e^!R2{1#4hBX$o9u9lQC?}@%k{!g+)Geq484Wl27kcUZ;o` zo#q1h`otFj9|0JZf0Mlv6{&Um*q>RRFE-A3;=_%nbT9ryQAB!ks{C;>iHIH%z9 zcue<#_euY~^QgAAT#4O67~+G$wM6$j#^E%HlNm4_87(7C+Zg;AyVFq4#OmL~o4a{PE1JN~)Y}1!r&@1v$r-Bo_r5fr$cS~Az2hZw2ONw}L z{&9>wiJuPdS>LA0qd)Fer`i!;Dkb3s7F+O)$vL*H*QJNGOpG@U*HnJ5_+lFmVyk38h5$~ZjY4|@)Ygggh2Ryj zj!vx&dI!w?y}|U?JhA9=&6EtazD#+IRy0JUY)<4GBaR!2HROPTrmIUJBRRcu<)x;6 z-gj`(V*-8Wd>6mUB~f_j7u%5M?hSF)h<+ILj(K@~M#Udbqg?rS|rU!Usj7dOkssMC2$Jk5%m9Phiio$4S37&loziZC_J zAF)>|**YFwTby9LQF5wX4oR&nb#CE?F9Ld#-aPP)ovEC3S#Q5wJii!T>%?K>eD%QO z^EKG4eX8|6!z@tH)lKx&%=Ot-1ObJKaNfIT(_fNa7t76eF@*a8<4YN zcY9|JS*7rgEbP+BwN;8$*9ilXm7qpcytb=Q^g|^bIG(Z=sc0!^XwfsBF^3^L`pujp z_ch+cQ@YrVashT;Ej0YXZ(anjpZNI&;PZ#W+QT(kMZ(q&h~D&z7qlJ#qdAFYHm$e& zG&IQFxzbWIm2(mR(R0mi&y?^#+Ms4Gjc*jerz^M&BY7+n(d1oJKHf`DU9|kNRJ10I zM32;#NGU$%^{o++AjZEBk>ap%6!Xb5#zA_B7h!lXP#Sd8&2i^o(F1{--dpQ8S9UCY z5lZA9gu2WU>V2VsOfRgnrSa_=%a~GcudU=H{bQx6bDe#=owwz^R6M`}KzrRX0}MW2 zjt%R3ViqNdgZn3@NbD$|McAs1FlY_Py}Ak|g*#;sO5FH`U$TF~W&Z~muIVtzwNJ{; z=|-qV79`moQ zKJMI%*cC6c*T?nP`DzqAJy>(ZNK;C=x2W{&PG;g;%EGPA%ywU^%463rFNP~@%ymhl z?e3hC1)lo`v^{|MJVM!)j@ec^3V1^XJt~J31xq927`d{KWm)s5)RW;j<{0}G{HD+n z!Hgc>+=nRH3eXp0pODub3&ZfOoi7Ym)c##S?)Z$CnTu(GBt6`2d?xtz~8X#nvW8=bVNUpMKrAJ^z> z*4aF|#a*dHe)QN}7O?^QqdDB)xATZ` zXz}HYJk8tm0H1wL>0t6A{;n3zy`DNv8?+vrC2ymgqhK}g4*+g3VQvr+mq`5(tVi8w z^{Y$+ROSwfP$!yJC3f~SejL%Qi}X^<&}Ym})Q&TNB2r`paCjVBAL5%_)E^@rNAGH^ z$}w(-+0s?u=bf@+W{2RqDD>pZOHHA<3$-x&@NSR3Clu18D0ZCKP|_3njiLcZiHDe8z1)Lc(n(U zXjyyTp^mA2d-^G?V#Z?~8i<-f6(GsvD_K~0*L-~HsrIDlSRH<4xhOzEjJc{D8oc3< zxlCMkgpb4H5a`jbtbgva`6Ym;`R5;kmh2(^T3CKLcP+up0BLeW*<3(M2+x(ekazAI z;VUYRXctzkp4`}^0expFcXgcySM9#t384>cR8+05pC7k}=&iBtgM>yJXnb`$vcjoB zi~-}(<)Pj1SJng1s8f!#e-8DGrwk{h8i0OB`<=14KK~tS*6Kf*`0@D=|DU7o3Pc@^ z@2VS2T;Tk0Q)!YevoIc@p0zjaA^*np=FbB_fm4LDgCTp=qaj{f+o{LRN*)Q9YWjM; z@Zkuf&E9FF8RC-RJZKon<))^CRxSfH1(l+6desvR)4`rG`?20i>~7g3adRqyzmP|s zD%c+~3-JT`xa|r8wq~Xg4>cz?Eu_5lKD4nTAw64PN;{Vdmrr^S?tH}Z5icdK??(NV z33BHBOVMH>2aEb&;8kmv(Y1@Pb%TXVFV{#EA25!)ECRny@7`s_$4f?4+chKxbZmr4%o8_fXJ_AU&MCSkjDRk$qIYS z;Vv%tVt|?RPHPt>FOjD#$l#33q7IzNa@Ly1C{}4Ph^k`RYnblt{QQ&V=K^ZG#C9FV zl+p`GdQBGFGAj6`4}DwiFV#hMG#F_5ng=EV7D`<+Xw;1j&E4Jc``TTe)R<)Rj#KlL@N+Qvph#d$2z z>R#S(+$L~nMlKOE!3nJpZkfK5XZWoh&(yDv_<-103!+T#lq+GG3qkd?QJD8bfCz4w=d>iy+UJLu zn%)L#akxkZ+#i8dEVtm~JgM~K8>D@?cZk|8721^WS+Tv6@(lfvWMP?KP{4-6j@KXI z_e{FlW&L8;Y7-(Ns!URYNY1gf_}W;eVen--WiKs@3^HoL zgK9N`bDHM@(+b=1RB3iMBOqU7_%;TDc-}V$B9c5Gk_LoQyy|%*N)(jr@cZI$s1*&A zt%?cST?V_&S%p?R?J;#_8)_~1^jz?$PlEf~qiV>LvYZDXW?^HDa(x*)cF(e|U_A|tnldMXrH2O5<|ee-^mc!UXsw+AuQ{vA7NE-~ zq{^+RQ5<&ef-FU=RDXuXP)r#A;t2=gVVN3bX>B^TkzLZ1HfdVTQ9h<}E+^TxWI%V% zj1+^eBr^RJr3ar`&T@b$^hz6Rk{JWB>?^K0Rp2dr`*n-Z=_{BfJ8un>@?dv8R%LFe&`b?Cv6JZUSB0 zfX9-%&f0_Fqm>HkWeM%)iydy2Ya|>}V?Yc2vAo_GwSHfJqGny`<6-XbW`56Hk?T>4 z85ej}t!N#xqk*bu<65?Rhb9F5Nb+sb3h^sCT?-yg3Ii*Hi8(Ia7sp3|_ej{B`1`-p zh|@RROR-Q(PXFx@nH?0$at8hhQfEQYB#OHS=O~XA>Ck>pJbIxpmbV*e_&Fxg@M_1Z zmD{pNkA%baQIPWqn7-#LcV#p+SnL-Owbv`RVftlfz62&;E>{QMJ~sF zZ!E5@C4@%UIVB3QQD4PJ#V@6875}_*KJxMsu(C?T7qcg5?_+ymcX!h$mxSc;PCh#j z+>4#9)Ti7QH+$6J;mUZK7?G{=Abqd7to_ucOb_ zKNPR*qvu(iKdv1Ax}jwrSL3AlTwRS~7<4-{%hdbWw5%w6!}7M2Sk&hJL|%6LZYZ`@ zdxeMx6wnjuGp z9}g<%?lBwYs5*Xom1l_|Q)1VDzlZqBsQ)%VqBg6tj-R0?8Lh1AB5E@;=FX34xPI*^<{6v)dUVoP_whZs-i5hd}~9W(2p+M3MviVzmJ76Huc%PS4lpjul?W?-#T-pHB&g;SedMDuWz`nO0ELQy* za|}fOd8RwV=Xh>}Z=zGSW0#oyO9{X^e}=ydu@QNQGik{#!059utBkq;_*7%4p`_uQpastR7=b% z2XtqfKW4Awd=e_W>xP>5IU~V0>Hm=DWVhvUX7`l?99nKf*jfArT>Sbp4FBdS2)SD~ zE(Rbqbn1JA3?ucUc;)2dhN^%ueH*#KF6VzCij`}(zC;S@$(YcbBMZqty zhvH?3D+`0L0aO)#ca}wpX5uXVcyyj6)!ZCpt%LZ+=kO&G_^?*47Wd?JDhQ2hB@iVX13;Rr1^%gDCPu;vQP zc>L$h%S)jbpM?ic|FR4d#em+77}4P}81gNdTG=ZLuH(j55&)%#g7HN7#}l-E;+sA6 z%WHbBY6{&svl3xMdp5;rATH*KtSW$j;oGBTAdsWL9sV@ z;vP@7>6hPfK3)wo-jD}*xwaoVb zZ|~nV0DGqp=)Ri8*K12XWBd7RRZG$hH$bq6qn)}bs{Up;ZO;u5*PDvltY9}m;k5U= zRnnUxFFZ+;i9@EcqDP*jkb7|1i>72KuhCs|{H2>~i1Mik`e9I?5843K94k=DahR~U z_M^GPKeOr?n31L~QPqH;d4?tBV+@0j3sq%&n0L&@eaHvfvcr}YgiBB6=xVGMWuwY| zq|G}C3^Wr|E+qt2<8Ej{(DXN)&;TYmjCN8}=>Ax_t}J{62-@>L-=usXAn-;Quo^pT zrPa>JVOF{95T&Ld{b^-LW31+^LWdOK@?k{RipxJ8a9Ciy67%2I%0VARSpXZAHcV z8@AW97S#AM7>dnV<6Xh7&LyGwt#226M`Hb7M~XfFC7RE4wX9y~*1MS(knZbVok|K_ zwJ;lR9ba#lIa!qE?hpdv1e!KQENiic9XGTGRxfCfbgbqq?vqApcHsKkn)}VtXsXj z_%O4Atq{$gJbl18i>@^G=`v@e(rfy@i%}cATKP7@?Hihgz?j5CB=iG2a;vg5Zh<1R z7gFp*9_#sHZ8u39QIy%PFU;gcO4)C_jcK>DK$&=cYCi`c)xeLGl%ta1Nq8qt?Y-Hq-|eEv%jXrKZ-; zw0zIUrO;|(G6B9VnP(~I7dmyt$^zk%Y&$lah66UP%?b% zc6re58v_SFt$o_5i(1@+4(V;b+A7->EW=g9HxKJQIg5V@CEsjjF?-~BuAr|gp? zh!Zksnfc1gqT>ZnZLz_(DO`ifQMd6mPTr&;2?&W1pVHC&Y-aIkjVXv(+lgNmF(Us{ zk{YjPws&=iUv%wk9B2U%S!NAtUx_<6jNe2PHD@e8bHVcBpQrB>hAJ8Y{^B7~U2!?> z-FFgE^QF?`-Uw>r%`Qn8sZLnZ9>72sge%AUiv+~Dlbmw;jJXh9+OOe4mxlg&^Ly{K z)F{I=(9?m-ZRE8Cv7A@1L&XfW@2*(o1E{KNsHi>@Q>VEDv%uhuhN>HV?yHs4_QS7_ zna+xQ&_+&Mhz;PBwXNellU-=y;_%^vCUr|jc<5Q}-wyNT-@SkAfkk9MP_x?~6}lMq zRE<{XA0agC0^8MfL-#rV$hIHW-ZH?0-&$luZlKq)CE-dP$^z&R`&+iIPL;O2hJPeL z{vht{oFhWx0aZ7@mF~%SVG6m}xc32;{Mgs=xr7_P><+f{*qer?DgFY!;vbU=oS;?W zj?zliM=5~jcg%lgoi@MfdiBgUZ#$lWF*jS`=kn?y0?6m}u<1C%D)W>+I)mLB6cQGR zom~WHLX|#dwLDIX?0eTCU;Hwm(0-Dz#q5pebOQK1Q@(EtHZQr|qw&z+`BG-jvwEkC z-#YnX@ZdRR^jHjr zUWqgcrNN&2^1n7n@YTfPou6g5dY}0~j8H0e(iGNVw#}YzaQZ|Z;}7hD4=Y!_2`Q#j zi4WS&-=7U7ao5f6k0z{`=;Q_$eDqBmn^3{egpP-+h;{hI6ql{{Vw?G`=pQsBAu-IK z#Ag^S(of%?7F0z2!+GT#NNth9g-px-0AyPKIA=CiX88k%{n?RX%>J#hW2MtdK+dlC z4Qp3qLCx$QskC(ra+xf0rt@-5uS=-DGz+bYCSs$u96eaRCcfHi@EiRwn4B2p&%^fs z78WN+)orrSd2fsomlYzBNLCg6@DuXVIw-t?nkUS`C#A6ZRNA||wVE*cN>jniG+s(; zaT41<<^82MDh@~~vykB}`6(Bx9P6f0{QsdhGGk_djf@VqfK}zjR|25}6}L|kSrW~V z;a~U)Zw5e~vp5@~uLyE+mJ;t>|HlQmtRZSXENXe=`*P$}Mo&+O#(Nj6KuA@jTh*SB|GkmcCXd7Iod|4PX5H(oA2fanJSX&V z2;oM)abpD-8X5xXG1CfxLg#flCqP#Fi%qTPw#X^|H92i{9T^9HwN@0Z2;f?bnRF+g zBMt~;)=W8zJxXA6!W~%oT)4>#=$4IDXrF9|Qd{C!-6wFp*D zTw+X2XSI~w_FMlh!;rp$m%;i*f)lUeV>$^Xu_x)b8lV;e( z_X)T6Y$Fo%y2Nn}_56!y?u>#U+a&&u?h7}^*iiau#S?_XMT$qYGK5KIqOMHn&a5~Y zN5nR1?6lPE#83;J#laS{$aQMWYyX@U8Ch8B)H>P5$d_!(pkXtr4)d&7dHS$;)MxRy zRCcMV>3H)l79Vp=4hOV~TYf+H_cp^j?S>o81n!FLr~^UB^n+tR!9V%3=a@Y>pb`Ne zvHljT>DN>&q*eP;@Q&@NFMf5 zc z>5!M{cidl|&DV$|8FJV)Zy9jvbhXl{I~f}7GKrHQd_cK;{g)8g4_{|#vJiyfsPcg) ze$82Q^fu(WyUK&>4_j8rJ9|iIj7~yn@yKdvPZ>r_hsXGIcQi|>E~(BYo9azC361R(|rjKfINx- zU|lFSSbUg%!6WLPWjAlVRGVg!)FW%nsq4u>Rl55@35X4G|HhBecF~y2XI`&swdF^S zWcxx*{{km1=b*%09TG4ShvT>*wyF;A-mlYed}`kZ^FT-MV#RWyQrITR0DfDs(9c0A zvXWX)uo*{q)c)*Sql?wM8c`n@X%KJeGBltr9`iG@bp3bZA}mYR`jmw%h!>Qxm(03V zG1$@I-&;umR)%>>R|OOAc=31e#|^?{g`(0PZ7si9L)Q+>d9`pQ+bD{Y&_S|f&1a#d zt0Z`j)<;*k5VdtBO z=B(Eav;D$E!54hfr8N)aHfg^w1cuJKx9w!QCLkZ-pMV}1c-R^l%tOv~hL0?Zv;PO-| zK&a1nj+FNb+LMjhA zKIPoP3bH`#Wol^C4;0+Ykk1zPo)-OUAJys1{s6F1Ex!}*n5f^Wo?L5SjgM5}b!n`> zE*UGs%12?wnW!uUhpZ0x`prrst6A;Yd>~!4;zMrB4VoFL{mHmya?aHr;C9Tq|CLYM zdxo4U`A-D2Mj4k1SN+Y;U{uV&slhlb)-K)F$Uc_t#nojMNsLKs)K#5iRxKV_H&{MC z0IoK2UMiMn^)}7>FwT>GVHve6)_0ygzJ3ZE3*R}uFX2?^RMgw?dEbJ*&EB|Q6n~-F zhu@EfQOf~GfPk_do=jqv-&YPVr=8{q&iRRa29T(k>XkzE%9Bdd`10e+u@g$1-HsXW z;iU^S$yna(3vK`IXk-Qdvm2&E;~V(gQ9FgmW|&g&J?&58IW2t25JniYHW8*E`Ml}f z!hI(FNk5HN{@#KJtBHoj0UY7VtT$K{Ny6pU_rByZu@;1jf3W-AP(${pFj3l2Zg6G| zwXZ>Bj%oMkvnjC-%sdT>JLUXp?m|`e3J( zH2Z2STR@EWj8{kd*=6WO8@lOkb%aQAh|{a;OeicZLsZKlJUEa%Ax%YM;g)>I5NTEJ zRFP|L*}w1VFyt_4{`ER6Q9g-56mk`qWd8PL@f@dG=p6b4$Grol{~S`N`X=|VOn^H#8Ih}00YWia(p)MF?q)j74YRm3d|+mhRCETe%|twuH< z2%0m3LlAKFsoSC9Z6lUbdlT5(d+NO>=*93Ad=PJ82fpN7B?!PY{=ECq?t|0`_NA7M zvGyiFUQM7I2a{Cc54JUjS7f{IC!X!A=X_Vm)4()p*=v5_M4sAHP`NjgD3)h3*YNfy*&O_YJS6KmIcguMvN?4mo6P+tTuBaixmPP9a z!F*aL4gFO~C;*{F!?=X>gCAvSDtFsA(~BYgYIAMM#KgY?4cFgj%Vw5d{n z`M(@aLUW@(LvB<5TOPA=f75N@`IGYUX&1O4_A8FBtN};cRzTwo1H&$@sLKtr< zBCl{kPT2wyNkU>7mq^m`R`$7M>MAfpS!6P62g*t=Z)D||<~(U4AFM(G2X!ZL)sE5# zamP);&yPpzQJZ6T|LkjIu)E9P7A8Fle1c3{E?e&mkA07h^6O&^1)4QM&FmN+hpeFK zQmEr=j#lJz^U(mw8Logi_*Cr}?`4!mVTpovJhn<6OM!Vjj#PUdmUA>d9+3anN;;M$ zha{_v{c9zqZ$_37HHSKvlHZi;%05|}nXWVY^Bw-mX+Ze3=+DTYk7upwim_Ga^LM{+ zRo#jvGxlWoS%2V@;$ml2U`Gs3koW}6Y&_s%#jvPR%u#fVRDLeb%;Vmmv#Pen{s4Jf zVcK6YNh?|w80;p4y?0o?CM@Ne9j`=T6T_gNhWgdux`J$F<@qx_)<>=Sy5@dIH~r8; zDKc=sW!U=iB?f9O zu*yW7h15kTUa?A%(&1>nySP>?fDH-*0hssaSb!IBA@)K4CFGW(^gVGmRBEKAIgpjF z|B$`qNTmSRWFu2qB?a|I#gB>(LLeq;`&oWTgbNX@A)8~%=&=O9(a}uan;ckhV?ggG z+7wX-Nid#zx%(VSdv`RH5fj|J)%7vdHjZ!I)Tu8c?gq2{rQso*Xi>iLAeDk!w{)tT zjzqd0EGWa)iz~e(!}`W^B|ZE*A}(JywzNGuJ^ks**g6{S9ySjVC0@hq*9CQBLF>4w zLKiDPu-=PK#g3AI_1BZ=*KTNsWO6X0g?c*$;D?QCMYs-L?T|X{g9YmjIsAo^l+tNU zhZk_z8^1ijXz5gRP-DpxkjfqW)4I>>P=%Nx=W7gA;@%9`M`&HcwLW^$M2A*jBchCgLQLcdU?eh3G90S3if4xZ?1 zvnu9>f*~TqbAhS6_wy(FO-ED!JVUOWORvil7_RW%y~w}XQ@t9>FtWHfRl`%Am_VZF zdhzD&Ni&s`{8>2f3qr#dFYZ#UJ+63i^^8YZh zc%5MC!fZ`>8?GcjHnaVvN(_!~Vt_OuOO;~;M#5=3WdR_5%Zil?PuXs0pCW0E`*EKb zW`w%_~_j~PpL0L8>YS#x( zSs~|*OmzYUUC~2arw@tYGL~^z*W;woN{PyT>%%#nGl14QqQdHMlWte$jB7&ulxMgU zeVLUhHAfvk`5G9PCgzQmI8;a)5U!Yyi;~VXNGo@*FiBJ)*)n+#yyr=gt&#&}1H!gD ztIen4{mRf?*ybZLO6lAu9`&8@34Dbpfmz+~6Y!o zx1n|U^)H`=lD{U^d>qNzx)v#O{E2MQIa);Y$ALk z|6#t)lX&N48+aZV*WDbxI5VNpO`fFd8Tvv3^AvzzHP&O_wO)j)?o>d?_uDeJx1XJg z_9$ViKz!=b^x9(GvvI0RN@06iiEjnV+Y|r=SF<^|h7nlVD&cyL4&WU2|FB#0fHd2e z@v;pH_UK!w29Ia_y)6g8DMh_hZyB&hIR8|4U>{Gby^~9}=N1K7Hz6HF&v;LYB9w~3 zw2-ULyyEw-_fd4r;t=WXXg(l*I!wQT7RFa@cE61~yHoBi7?;oSHkv(qjYAybj>+P^ z4G3LvUGc z4u1fg_cMcEmq<4C9jmFNpsi&(bQ*KX|;^WUtH&kZ|3O{#d(-E)|**Q8=s zLj%PHuY#uFq$zfSFo=Nc4?V=PIrTcj^CaVmb^kx%nji+v0A9y)FS{g*IHis#^R~FLxOOMPf`aU@{oP@tQLZn7YbsVEm=2kP~zq2hp<#pn54~`U^D6rNQ z60FE#S7 zD?1Ccq7`J9TI4=n3sZfD4NnIzPm4^F*F^zfr3Bc;cMqKJa(|Vw==6=Ui!HQR7G}7af!a z>DjMG^p)1099mA{vxsBo<+M(5DL=qk;}SB_h)m_qxgQ{JEh~6Zj7Rto3LKgDCRG&G zf6L&iwZ3_tURAKA*=n3aNp?7r_c|HWhvRvD^*nWXN{^UtjQ_88WoM7&Y1uChBcp z-Y-yK-wy6$6wbv^Mo8#D%Q+#fZ9h11$^|}RkYczFa8fcqxnZ<$Z+RX9ph)08mLB1d zCkz~c{y=OC(!>y&3bZI{>79hSLhO&>i4~)|FWMeadXw9{8u)%RF-6BlIu_RZLv&mt z2POYR!m?G_D~+TwK$2x!Z9DgLe%`nXMs(ZNmTZujo9w_RuyZI1#4Ln#5TX z(Q2j>qOcsiMonE%%34F zv{cWO^lwY*$&pgp$>4pzh}0cTD)T9f2iJ7&piO@)aR?&e{r2q3%n*yqR*gt0WBZ~} z7m%m%LuuR1@+G>Cj}1HTQDlkj-s!INL6>nv%lFWn!PP`K0?fR?^Zvrf!xpIZn&nP7be zV1%s8h<8-oRB-uBv#_DoyS+ya5m8yPpGz)eP)KmWt>+3y_s4^>H(T2$l{2a%g;#yYTtsDwBK zRL5+jVR>cw_G7$c({_v1XoD1Fry|S#^E-EP7U|w})#3)1*eX2iekw~veB$*bt!i9I zXUz%?e;r{OCnQ%IA&7A#eQKGB;!20S{U($sl00guCox@1EDUJ#dhp0s%&~E%`X?Wi zs4C=&8z>0;&T!VaK0u87k88pTu6&#*Ii*6uY~_1PE$!}eP|C21?IaT{+UT%2?cRb( zvAK?cxF^$7na4>&YDf1F6kH`91ENDeT%GpiBvI`;16&G#(bvTSj+u&NG*oB6j=v6h zwL4YJHjT3NO$m_g_C)0luesVI*~Xg|jN~BbJta8@zq$@YP#W$6LY*Cuo||nsp~vyb z93qJo=#LH~82~8#0 z^9<)x8(3JMd3D^YZYjYCFFEIi-$vl7iXaJm15e#@a+S5VW%>`^uB}IBpKZS#;$}hI(Nz*&i-CRTL^xw*Ey%p1l2uV&OyYLHJyvQ_+qU8UdOebIa7(Nd5smQ zq`|#ndoCoOIh87oaa@BX_<&-QZS;VVuSs+}%7rundaTxB(d+7zBl6!VyN7Qgq|Kd- z9FCuZj{E*6VFw*Z7cNye)6j<42;!vsGvli$@{5DA-q;@KXa7m^vSmxM7sk_%~=gME{TqC06Vr=g#(~75>5;67beBvW=&v;Q8Z~2rZKhZoPFPSJa zWS!wB^YWdI6LAT?fv44@tIt=Vw8qA6MH8E>^#A3WHK+cpGhEXeW8837ZH?{fO`0<%fyx`;r|fM^KXrOtyF{`2#zu z-^`-)3;N$gonK#6&PSMkm65<-Gp*b;Pl>Fu@nv3y?&-VUQXsZtX|!h7n6w2-tOgp_ zlcyjs_R)_-A#Z-^qCui5s9R){!)HcSne1Wm#-qxUUp$mNRfET^=_qB1uTIDc;(~{n z^@xANbiqw14FOc5rcLnV3|r1WalPg=k8?FZx?ejsKJ2C6&#ZS+#bz2%g_`f^CLRP7 zR*%(4>O0d&K;Blg5!4w4c33YgBC&D0aGr|htE8MhSK#2V?ZD;K!|zT5qEoeA+;c+gakgqUe<4TMFMtE4b#26LhJ@l(l)tQN?>P`ON?4K<+gE`2N6 zXbVu#xGST=Rf0&Hb!oy?1b9sym*mV*ZYOmBNrDcbTL7{$7{3k|dA{pI_ z(8+ug`ACl4S!>RHi`^;Y+xLFQ56Y2+jX`-wXI4#@{h37W6x{GI+U4x181cZr!cuw0D=ZS9f{`srdZ)%J4YngLrOKu! z0m}diSeAKM;b&L7b4wG%nAgdtY@WQV5f}~TBlZ1qh!)ifNV_M59Z|cx zmao?s{#Cw~Mu+mIJByXW!h32ZJa*OxS%y9n7Y60(z=s7HT0|dF9nzflgV|2-El%CA ztm;_~Ha`VsyH02N_bu_F6^(apoCiAYFvkl#~4&kd1hypo?#BPM2P{ zbk_)S5gOBF?U8kziarBZgbTVBd0+T_EDguTnj~Xdr2 zz>sm8F|aMM`nJYJ4f3W`b9b&*)_eZ04qZK{oyE+5r@|KMexqirivm<*8pyFB>mkmT z7w+RiGTx;ZS0C-lJeS`y%2IiK??_oj3Dm6`dKAo2hI2Lofj5VV>o~bovknCmYM>Tf zI`41gxn-|ewYrLl$zZ@@J&2mKKIm98K6{~ z7t&fqt@m)VSD|5&)6>zVE?IAAxw?4mu}zX|meU;Vl+|T6hWW2IRXmSba+j9K{GK|L zZVE7v28TC@{Y}$F%^pfpQ?Qq( zW?E>TX}pDvcWuN}5g?3+b~XU&Tl`ehNrPJVwU*zV+E@i@VW+N1?{&=L&EMOLT6-Jm zRMGf)gcolfzr}{&^|^5}@DL_@#jh`TTVeD`o_o$F znY`xz^l|S0O#cfUA36z@6R9-OMN%$f`cjN>WG<0QEJUiWn3*WoxojkgOt*!#Y;sAt z2GT?O`wLFYggUQdjgNeCn>e(Po|CiTb>X6_OatblHyaGYx*@|L zXKDWb@#$uAs@{|R5_f>?ua>NeYDExXlePMS@p8KobS``iqjHh1C??lcLg!Xes&IdG zctwM@Z6H5}mTR2eK9`4?2K?rLN z%=NQq;@y!MxY&@TYf3K+h#c$YKJD`2O}lECSTRHb*3v~IdMq~{WJrQ?008UXLyw=% zVyCq$SXZvnwU=FX1(Z!ZsZ-q6s(zK2QJ1Caq-Ysdu(`(mX)E|#?jG|#!H<0~L{o+1b_AzY1mwErsjIKxkB4qR1XcMl(jnvEz**FxW)=?fj` zq7@vze_}?M4Lkh|Od+7pzLLT`H!c>Pd{<9*p8RGHr$V1Kv5$*{N&dZME);i{ehPB* zn0hPSjr@eELfHiOklb`rYiaPWj{W@BFzuyj9vWmPezDqaWYBDaU|>)uVP(D?pUFY` zPKU+U0BaBhtHLa!K=JYy=hRd~%jx@7^sh>gGPPZ(lRSqE(2U@w_3)ze5Tk0{P z(6J+hRrbE$(=~FIeIwcV(_9Owkk?{aTSB0?`&P*&r{0JMdB1EP5{}`dnfgJS-nN-g zPJ>-YxfI3GM*sAahY6 znPb|$gMTL_W8|M|T^En@mtrSUCrsWB_&bf2VgZCB;KEHRVI6?9+flk(_J;vH`XT>j z5y9I`br$(AR7*@(!v#n(sQ%yb-@wcfn$Fj9j7HC`Pq#GYz29ifm4oN!dX<_Y%?B5n zNWq~Pns|d?ATaF}REeSa=Tl-uh5)P`IsznG-W;T#%PlEz&TUla(2Dbl`AKmTZzwXY=Ggdfum*qhv3UK37mx=lZARNb*Od+PY4of?Q5%nsBhn?}d6jzi0ul0({ z+8EVVQIb<#(B`>Yf&&9CyzMAl6Sr69kF}_SYsb6SGt1;pKU&TIhta~25o}%E<-`Jl zaF@S%Y>HgOs7Q|x3k^mh=1vC08*2hE~7J&s=;R z!$f3*^Kr`0F_i3TcUFI}Czsp7#imW<+7GLn;za|=Zz@~~G!BI6I__B4{i-tp@Id)+ zk05;PpFcpmat`@?Mz@f-)sTrnlwbXNY9-|sI8L$0v{No?w(-V zuuFW4#(4))1+QUiGQBrQXZXYnre9C_-3e@YR@dgS*u4MJ`r@Scp#zd456|Do;223L zOxG$4P~^9OAeJJxw*rxKo%;zkDk)WLQx$NGtr70fmndiUoCvekq8b5I*%|%%?4kaH zTQQ(v_F!Q;_L~a{Tu;(X#oEac5-Kn|zg`yqZUZ!1$X^aq&gdVP%^hp=i(7}Y3@H2C z2`6tngd^ihPT8ND<{HMQ-FDTumrUG(&NSOiOI>HP3@A|Jpt8;fQ>~kIYwKs3Aq7;32HYG29=kArj#e zXNn=OvJ#x-;SI!IYUo9Bt zG<%P_AarMO>CHA{8T+X>rlh(wgatrst(K)u#jC&(UI&>;n!#@;%oOe=bvYi0cyQFrvFiGSg Date: Tue, 24 Sep 2024 02:49:01 -0700 Subject: [PATCH 002/118] Supports different rockets(cluster is placeholder) --- Balancing/BalancingChangesManager.cs | 3 + Items/Weapons/Ranged/SulphuricAcidCannon.cs | 13 +-- Projectiles/Ranged/SulphuricBlast.cs | 89 ++++++++++++++------- 3 files changed, 70 insertions(+), 35 deletions(-) diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index 3e10e83716..6434ff0ae9 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -350,6 +350,9 @@ namespace CalamityMod.Balancing // 35% resist to Venusian Trident. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); + // 35% resist to Sulphuric Acid Cannon's Explosions. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); + // 25% resist to Corinth Prime's Grenades. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); diff --git a/Items/Weapons/Ranged/SulphuricAcidCannon.cs b/Items/Weapons/Ranged/SulphuricAcidCannon.cs index 5cf78b145f..2980c5bb23 100644 --- a/Items/Weapons/Ranged/SulphuricAcidCannon.cs +++ b/Items/Weapons/Ranged/SulphuricAcidCannon.cs @@ -41,10 +41,13 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - //Slight randomization - float SpeedX = velocity.X + (float)Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = velocity.Y + (float)Main.rand.Next(-40, 41) * 0.05f; - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, Item.shoot, damage, knockback, player.whoAmI); + // Reposition to the gun's tip + add some inaccuracy + Vector2 newPos = position + new Vector2(78f, player.direction * (Math.Abs(velocity.SafeNormalize(Vector2.Zero).X) < 0.02f ? -2f : -8f)).RotatedBy(velocity.ToRotation()); + Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(10f)); + + //Find which rocket type the player will be using. + player.PickAmmo(player.HeldItem, out _, out _, out _, out _, out int rocketType); + Projectile.NewProjectile(source, newPos, newVel, Item.shoot, damage, knockback, player.whoAmI,rocketType); return false; } @@ -75,8 +78,6 @@ namespace CalamityMod.Items.Weapons.Ranged float animProgress = 0.5f - player.itemTime / (float)player.itemTimeMax; float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; - if (animProgress < 0.4f) - rotation += (player.altFunctionUse == 2 ? -0.15f : 0) * (float)Math.Pow((0.6f - animProgress) / 0.6f, 2) * player.direction; player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); } diff --git a/Projectiles/Ranged/SulphuricBlast.cs b/Projectiles/Ranged/SulphuricBlast.cs index f7c40082a9..9463eb3539 100644 --- a/Projectiles/Ranged/SulphuricBlast.cs +++ b/Projectiles/Ranged/SulphuricBlast.cs @@ -1,12 +1,15 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Graphics.Primitives; using CalamityMod.Particles; using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; using Terraria.GameContent; using Terraria.Graphics.Shaders; using Terraria.ID; @@ -28,6 +31,8 @@ namespace CalamityMod.Projectiles.Ranged float placementDistance; public Vector2 storedVelocity; Vector2 placementVelocity; + + public ref float RocketID => ref Projectile.ai[0]; public override void SetStaticDefaults() { ProjectileID.Sets.CultistIsResistantTo[Type] = true; @@ -52,7 +57,7 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - float power = 4; + float power = 3; vibrate = Main.rand.NextVector2Circular(power, power); // Home in on enemies if not sticking to anything. if (!stuckInTarget) @@ -69,29 +74,18 @@ namespace CalamityMod.Projectiles.Ranged Particle gas = new MediumMistParticle(gasSpawnPosition, gasVelocity, color, fadeColor, Main.rand.NextFloat(0.5f, 1f), 205 - Main.rand.Next(50), 0.02f); GeneralParticleHandler.SpawnParticle(gas); - if (Projectile.timeLeft <= 590) + for (int i = 0; i < 2; i++) { - for (int i = 0; i < 2; i++) - { - Particle spark = new GlowSparkParticle(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10, -Projectile.velocity, false, 8, 0.13f * (i == 0 ? 0.2f : 0.5f), Color.Lerp(Color.SeaGreen, Color.PaleGreen, 0.25f) * 0.5f, new Vector2(0.3f, 1f), false, false, 0.8f); - GeneralParticleHandler.SpawnParticle(spark); - } - for (int i = 0; i < 2; i++) - { - Color bubbleColor = Main.rand.NextBool() ? Color.SeaGreen : Color.YellowGreen; - Vector2 bubbleSpawnPos = Projectile.Center + Main.rand.NextVector2Circular(50, 50); - Vector2 bubbleVelocity = -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.8f); - Particle bubble = new DirectionalPulseRing(bubbleSpawnPos, bubbleVelocity, bubbleColor, new Vector2(0.8f, 1), 0, 0.1f, 0f, 75); - GeneralParticleHandler.SpawnParticle(bubble); - } - } - //Firing Effects - if (Projectile.timeLeft <= 595) + Particle spark = new GlowSparkParticle(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10, -Projectile.velocity, false, 8, 0.13f * (i == 0 ? 0.2f : 0.5f), Color.Lerp(Color.SeaGreen, Color.PaleGreen, 0.25f) * 0.5f, new Vector2(0.3f, 1f), false, false, 0.8f); + GeneralParticleHandler.SpawnParticle(spark); + } + for (int i = 0; i < 2; i++) { - Particle pulse = new DirectionalPulseRing(Projectile.Center, Projectile.velocity / 100f, Color.Aqua, new Vector2(1f, 2.5f), Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2, 0.2f, 0.03f, 20); - GeneralParticleHandler.SpawnParticle(pulse); - Particle pulse2 = new DirectionalPulseRing(Projectile.Center, Projectile.velocity / 90f, Color.DodgerBlue, new Vector2(1f, 2.5f), Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2, 0.1f, 0.025f, 35); - GeneralParticleHandler.SpawnParticle(pulse2); + Color bubbleColor = Main.rand.NextBool() ? Color.SeaGreen : Color.YellowGreen; + Vector2 bubbleSpawnPos = Projectile.Center + Main.rand.NextVector2Circular(50, 50); + Vector2 bubbleVelocity = -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.8f); + Particle bubble = new DirectionalPulseRing(bubbleSpawnPos, bubbleVelocity, bubbleColor, new Vector2(0.8f, 1), 0, 0.1f, 0f, 75); + GeneralParticleHandler.SpawnParticle(bubble); } } } @@ -137,21 +131,44 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); + public override void OnSpawn(IEntitySource source) + { + float rotation = Projectile.velocity.ToRotation(); + Particle pulse = new DirectionalPulseRing(Projectile.Center, Projectile.velocity / 2, Color.Gray, new Vector2(1f, 3f), rotation, 0.08f, 0.2f, 15); + GeneralParticleHandler.SpawnParticle(pulse); + } + public override void OnKill(int timeLeft) { SoundStyle fire = new("CalamityMod/Sounds/Custom/PlagueSounds/PlagueBoom", 4); + var info = new CalamityUtils.RocketBehaviorInfo((int)RocketID) + { + // Since we use our own spawning method for the cluster rockets, we don't need them to shoot anything, + // we'll do it ourselves. + clusterProjectileID = ProjectileID.None, + destructiveClusterProjectileID = ProjectileID.None, + }; + bool isClusterRocket = (RocketID == ItemID.ClusterRocketI || RocketID == ItemID.ClusterRocketII); SoundEngine.PlaySound(fire with { Volume = 0.9f, Pitch = -0.3f }, Projectile.Center); SoundEngine.PlaySound(SoundID.Item107, Projectile.Center); if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 2), Projectile.knockBack, Projectile.owner, ai1: 160f); + //The explosion has a different damage scaling depending on which rocket type you have. Left is Cluster Rocket, right is Non-Cluster. + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * (isClusterRocket ? 1.5f : 2)), Projectile.knockBack, Projectile.owner); + if (isClusterRocket) + { + for (int k = 0; k < 3; k++) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 2), Projectile.knockBack, Projectile.owner, RocketID); + } + } } // Circular spread of clouds and bubbles for impact for (int i = 0; i < 35; i++) { Vector2 smokeVel = Main.rand.NextVector2Unit() * Main.rand.NextVector2Circular(32f, 32f); Color smokeColor = Main.rand.NextBool() ? Color.SeaGreen : Color.PaleGreen; - Particle smoke = new MediumMistParticle(Projectile.Center, smokeVel, smokeColor, Color.Black, Main.rand.NextFloat(1.4f, 4f), 200 - Main.rand.Next(60), 0.08f); + Particle smoke = new MediumMistParticle(Projectile.Center, smokeVel, smokeColor, Color.Black, Main.rand.NextFloat(1.4f, 4f), (200 - Main.rand.Next(60)), 0.08f); GeneralParticleHandler.SpawnParticle(smoke); } for (int i = 0; i < 8; i++) @@ -177,10 +194,24 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - int projFrame = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type]; - int y6 = projFrame * Projectile.frame; - Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + vibrate, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, projFrame)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)projFrame / 2f), Projectile.scale, SpriteEffects.None, 0); + float glowOutwardness = MathHelper.SmoothStep(3f, 0f, Utils.GetLerpValue(90f, 270f, stuckTimer, true)); + Texture2D Texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Rectangle frame = Texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Vector2 drawPosition; + Vector2 origin = frame.Size() * 0.5f; + Color glowColor = Color.Lerp(Color.YellowGreen, Color.Lime, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 5f) * 0.5f + 0.5f); + glowColor.A = 0; + + if (stuckInTarget) + { + for (int i = 0; i < 8; i++) + { + drawPosition = Projectile.Center + (MathHelper.TwoPi * i / 8f + Main.GlobalTimeWrappedHourly * 4f).ToRotationVector2() * glowOutwardness - Main.screenPosition; + Main.EntitySpriteDraw(Texture, drawPosition, frame, Projectile.GetAlpha(glowColor), Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + } + } + drawPosition = Projectile.Center - Main.screenPosition; + Main.EntitySpriteDraw(Texture, drawPosition + vibrate, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); return false; } } From d3d911b12bcd510e5178013a1c469e7d6503ce41 Mon Sep 17 00:00:00 2001 From: mochi-angel Date: Sat, 19 Oct 2024 15:36:06 -0700 Subject: [PATCH 003/118] Cluster Behavior + Cleanup --- CalamityLists.cs | 2 +- Items/Weapons/Ranged/SulphuricAcidCannon.cs | 2 +- .../Mods.CalamityMod.Projectiles.Ranged.hjson | 5 +- .../{SulphuricBlast.cs => AcidRocket.cs} | 9 +- .../{SulphuricBlast.png => AcidRocket.png} | Bin .../SulphuricAcidCannonExplosion.cs | 2 +- Projectiles/Ranged/SulphuricDrop.cs | 104 ++++++++++++++++++ 7 files changed, 114 insertions(+), 10 deletions(-) rename Projectiles/Ranged/{SulphuricBlast.cs => AcidRocket.cs} (96%) rename Projectiles/Ranged/{SulphuricBlast.png => AcidRocket.png} (100%) rename Projectiles/{Magic => Ranged}/SulphuricAcidCannonExplosion.cs (98%) create mode 100644 Projectiles/Ranged/SulphuricDrop.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index 0382433fbd..d629fbb863 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -2036,7 +2036,7 @@ namespace CalamityMod ProjectileType(), ProjectileType(), ProjectileType(), - ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), diff --git a/Items/Weapons/Ranged/SulphuricAcidCannon.cs b/Items/Weapons/Ranged/SulphuricAcidCannon.cs index 6c39a65a8c..0b06d218fa 100644 --- a/Items/Weapons/Ranged/SulphuricAcidCannon.cs +++ b/Items/Weapons/Ranged/SulphuricAcidCannon.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.UseSound = SoundID.Item73; Item.useAmmo = AmmoID.Rocket; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; Item.rare = ModContent.RarityType(); } diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson index 6f35f6a584..0b2dc8750d 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson @@ -256,7 +256,8 @@ HellbornShell.DisplayName: Hell's Shell RubicoPrimeMag.DisplayName: Rubico Prime Mag MegalodonShot.DisplayName: Megalodon Shot SulphuricAcidCannonExplosion.DisplayName: Sulphuric Acid Cannon Explosion -SulphuricAcidCannonExplosion.DisplayName: Sulphuric Acid Cannon Explosion LeviatitanAberration.DisplayName: Leviatitan Aberration LeviatitanMeteor.DisplayName: Leviatitan Meteor -LeviatitanExplosion.DisplayName: Leviatitan Explosion \ No newline at end of file +LeviatitanExplosion.DisplayName: Leviatitan Explosion +SulphuricDrop.DisplayName: Sulphuric Drop +AcidRocket.DisplayName: Acid Rocket diff --git a/Projectiles/Ranged/SulphuricBlast.cs b/Projectiles/Ranged/AcidRocket.cs similarity index 96% rename from Projectiles/Ranged/SulphuricBlast.cs rename to Projectiles/Ranged/AcidRocket.cs index 9463eb3539..dd0e6c6f0c 100644 --- a/Projectiles/Ranged/SulphuricBlast.cs +++ b/Projectiles/Ranged/AcidRocket.cs @@ -2,9 +2,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Graphics.Primitives; using CalamityMod.Particles; -using CalamityMod.Projectiles.Magic; -using CalamityMod.Projectiles.Rogue; -using CalamityMod.Projectiles.Typeless; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -17,7 +15,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { - public class SulphuricBlast : ModProjectile, ILocalizedModType + public class AcidRocket : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; public NPC chosenTarget; @@ -159,7 +157,8 @@ namespace CalamityMod.Projectiles.Ranged { for (int k = 0; k < 3; k++) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 2), Projectile.knockBack, Projectile.owner, RocketID); + Vector2 acidVelocity = (Vector2.UnitY * (-12f + Main.rand.NextFloat(-3f, 4f))).RotatedByRandom((double)MathHelper.ToRadians(40f)); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity + acidVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.15f), Projectile.knockBack, Projectile.owner, RocketID); } } } diff --git a/Projectiles/Ranged/SulphuricBlast.png b/Projectiles/Ranged/AcidRocket.png similarity index 100% rename from Projectiles/Ranged/SulphuricBlast.png rename to Projectiles/Ranged/AcidRocket.png diff --git a/Projectiles/Magic/SulphuricAcidCannonExplosion.cs b/Projectiles/Ranged/SulphuricAcidCannonExplosion.cs similarity index 98% rename from Projectiles/Magic/SulphuricAcidCannonExplosion.cs rename to Projectiles/Ranged/SulphuricAcidCannonExplosion.cs index fb34a3ae23..7f30d0aa99 100644 --- a/Projectiles/Magic/SulphuricAcidCannonExplosion.cs +++ b/Projectiles/Ranged/SulphuricAcidCannonExplosion.cs @@ -8,7 +8,7 @@ using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic +namespace CalamityMod.Projectiles.Ranged { public class SulphuricAcidCannonExplosion : ModProjectile, ILocalizedModType { diff --git a/Projectiles/Ranged/SulphuricDrop.cs b/Projectiles/Ranged/SulphuricDrop.cs new file mode 100644 index 0000000000..f987c5725a --- /dev/null +++ b/Projectiles/Ranged/SulphuricDrop.cs @@ -0,0 +1,104 @@ +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class SulphuricDrop : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/Environment/AcidDrop"; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 14; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.tileCollide = true; + Projectile.ignoreWater = false; + Projectile.penetrate = 3; + Projectile.timeLeft = 840; + Projectile.extraUpdates = 1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; + Projectile.DamageType = DamageClass.Ranged; + } + public override void AI() + { + if (Main.rand.NextBool(3)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, 278); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.4f, 0.65f); + dust.velocity = -Projectile.velocity * 0.4f; + dust.color = Color.SeaGreen; + } + if (Projectile.velocity.Y < 0f) + { + Projectile.velocity.Y *= 0.97f; + } + else + { + Projectile.velocity.Y *= 1.03f; + if (Projectile.velocity.Y > 16f) + { + Projectile.velocity.Y = 16f; + } + } + if (Projectile.velocity.Y > -1f && Projectile.localAI[1] == 0f) + { + Projectile.localAI[1] = 1f; + Projectile.velocity.Y = 1f; + } + Projectile.velocity.X *= 0.995f; + if (Projectile.ai[0] >= 2f) + { + Projectile.alpha -= 25; + if (Projectile.alpha < 0) + { + Projectile.alpha = 0; + } + } + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 120); + } + public override void OnKill(int timeLeft) + { + for (int i = 0; i < 5; ++i) + { + int bloodLifetime = Main.rand.Next(22, 25); + float bloodScale = Main.rand.NextFloat(0.6f, 0.8f); + Color bloodColor = Color.Lerp(Color.SeaGreen, Color.Lime, Main.rand.NextFloat()); + bloodColor = Color.Lerp(bloodColor, new Color(51, 22, 94), Main.rand.NextFloat(0.65f)); + + if (Main.rand.NextBool(20)) + bloodScale *= 2f; + + float randomSpeedMultiplier = Main.rand.NextFloat(1.25f, 2.25f); + Vector2 bloodVelocity = Main.rand.NextVector2Unit() * 2 * randomSpeedMultiplier; + bloodVelocity.Y -= 5f; + BloodParticle blood = new BloodParticle(Projectile.Center, bloodVelocity, bloodLifetime, bloodScale, bloodColor); + GeneralParticleHandler.SpawnParticle(blood); + } + } + public override bool PreDraw(ref Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], new Color(255, 255, 255, 127), 2); + return false; + } + } +} + From b33831a15c801cb3720a06c2561ada186ebdb2c8 Mon Sep 17 00:00:00 2001 From: Xyk Date: Fri, 8 Nov 2024 12:31:18 -0800 Subject: [PATCH 004/118] Some Entropic Claymore balancing --- Items/Weapons/Melee/EntropicClaymore.cs | 4 ++-- Projectiles/Melee/EntropicFlechette.cs | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Items/Weapons/Melee/EntropicClaymore.cs b/Items/Weapons/Melee/EntropicClaymore.cs index 6f8573c102..125028b0c0 100644 --- a/Items/Weapons/Melee/EntropicClaymore.cs +++ b/Items/Weapons/Melee/EntropicClaymore.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 130; Item.height = 130; - Item.damage = 92; + Item.damage = 110; Item.DamageType = DamageClass.Melee; Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Swing; @@ -52,7 +52,7 @@ 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) { - for (int i = 0; i < 6; i++) + for (int i = 0; i < 5; i++) { Projectile.NewProjectile(source, position, velocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.7f, 1.1f), type, damage / 2, knockback * 0.5f, player.whoAmI); } diff --git a/Projectiles/Melee/EntropicFlechette.cs b/Projectiles/Melee/EntropicFlechette.cs index 1f9ddeab73..4c7c836849 100644 --- a/Projectiles/Melee/EntropicFlechette.cs +++ b/Projectiles/Melee/EntropicFlechette.cs @@ -37,6 +37,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = 600; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; + Projectile.ArmorPenetration = 15; } public override void AI() @@ -57,7 +58,7 @@ namespace CalamityMod.Projectiles.Melee sizeVariance = Utils.GetLerpValue(-5, 60, Projectile.timeLeft, true); - if (time > 5) + if (time > 65) { Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.4f, "CalamityMod/Particles/GlowSpark2", false, (int)MathHelper.Clamp(9 * sizeVariance, 3, 9), MathHelper.Clamp(0.03f * sizeVariance, 0.01f, 0.03f), Color.Black * 0.6f, new Vector2(1.2f, 0.5f), false, shrinkSpeed: 1.1f); GeneralParticleHandler.SpawnParticle(spark2); @@ -69,9 +70,10 @@ namespace CalamityMod.Projectiles.Melee dust.velocity = -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 0.7f); dust.noGravity = true; dust.color = Color.LightGreen; + dust.noLightEmittence = true; } } - if (time >= 5) + if (time >= 35) { if (Projectile.numHits < 1) { @@ -94,7 +96,7 @@ namespace CalamityMod.Projectiles.Melee { Vector2 moveToEnemy = (target.Center - Projectile.Center).SafeNormalize(Vector2.UnitX); if (Projectile.velocity.Length() < 14 - 9 * Utils.GetLerpValue(280, 60, Projectile.timeLeft, true)) - Projectile.velocity += moveToEnemy * 0.55f; + Projectile.velocity = Projectile.velocity * 0.95f + moveToEnemy * 0.9f; else Projectile.velocity *= 0.95f; } From 256f92b035996b3a50c6a4ffdec513a5a4afc148 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Fri, 8 Nov 2024 16:53:23 -0500 Subject: [PATCH 005/118] Malachite legendary tooltip --- Items/Weapons/Rogue/Malachite.cs | 8 +++++++- .../Mods.CalamityMod.Items.Weapons.Rogue.hjson | 17 +++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/Items/Weapons/Rogue/Malachite.cs b/Items/Weapons/Rogue/Malachite.cs index 63e63fc0cd..e67860842d 100644 --- a/Items/Weapons/Rogue/Malachite.cs +++ b/Items/Weapons/Rogue/Malachite.cs @@ -7,8 +7,14 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Rogue { - public class Malachite : RogueWeapon + // Have to directly implement the interface instead of extending LegendaryItem since it already extends RogueWeapon + public class Malachite : RogueWeapon, IHoldShiftTooltipItem { + public string ExtensionIndicatorKey => "Items.Misc.LegendaryShortTooltip"; + public Color? ExtensionIndicatorColor => null; + public string TooltipExtensionKey => "LegendaryText"; + public Color? TooltipExtensionColor => Color.Lime; + public override void SetStaticDefaults() { ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index c4034eb974..9885348364 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -699,6 +699,23 @@ Malachite: { Press to throw a single kunai that pierces, after piercing an enemy it emits a massive explosion on the next enemy hit Stealth strikes fire three kunai that home in, stick to enemies, and explode ''' + LegendaryText: + ''' + > STATUS_ + Extensive hull damage. Repairs initiated. + Sensor arrays offline. Repairs scheduled T+2200. + + > UPDATE_DIRECTIVE_ + Error 0x00017F80. Device sector unreadable. + Initializing search for external directive. + Searching... (383526 more) + Directive found. + New directive compiled. Rebooting... + + > PLAGUE UNIT 194-QB-03d ONLINE. + Directive summary: + Continue propagation of unified frequency band and lead satellite units. + ''' } MangroveChakram: { From f598bf6e8f49dbd05bf7f19c3b5817a076e237c8 Mon Sep 17 00:00:00 2001 From: Xyk Date: Sat, 9 Nov 2024 13:38:08 -0800 Subject: [PATCH 006/118] Sword and Gun holdouts now update their damage continuously --- Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs | 1 + Projectiles/BaseProjectiles/BaseGunHoldoutProjectile.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs b/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs index 3181a98c18..06eb494b75 100644 --- a/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs @@ -25,6 +25,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles Projectile.tileCollide = false; Projectile.penetrate = -1; Projectile.noEnchantmentVisuals = true; + Projectile.ContinuouslyUpdateDamageStats = true; } public override void OnSpawn(IEntitySource source) diff --git a/Projectiles/BaseProjectiles/BaseGunHoldoutProjectile.cs b/Projectiles/BaseProjectiles/BaseGunHoldoutProjectile.cs index e5af9a2e09..2c643a030f 100644 --- a/Projectiles/BaseProjectiles/BaseGunHoldoutProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseGunHoldoutProjectile.cs @@ -150,6 +150,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles Projectile.width = Projectile.height = ItemTexture is null ? 1 : ItemTexture.Width(); Projectile.tileCollide = false; Projectile.netImportant = true; + Projectile.ContinuouslyUpdateDamageStats = true; } public override void OnSpawn(IEntitySource source) => OffsetLengthFromArm = MaxOffsetLengthFromArm; From 73e599aeeb9f53878b2618002778f7fc47181cb2 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Sat, 9 Nov 2024 22:40:11 -0500 Subject: [PATCH 007/118] Profaned enemies can no longer spawn during Eclipse, Pumpkin Moon, or Frost Moon --- NPCs/NormalNPCs/ImpiousImmolator.cs | 2 +- NPCs/NormalNPCs/ProfanedEnergyBody.cs | 2 +- NPCs/NormalNPCs/ScornEater.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/NPCs/NormalNPCs/ImpiousImmolator.cs b/NPCs/NormalNPCs/ImpiousImmolator.cs index 4d87a1dcc2..ab77e707d2 100644 --- a/NPCs/NormalNPCs/ImpiousImmolator.cs +++ b/NPCs/NormalNPCs/ImpiousImmolator.cs @@ -255,7 +255,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.PlayerSafe || !NPC.downedMoonlord || spawnInfo.Player.Calamity().ZoneCalamity) + if (spawnInfo.PlayerSafe || !NPC.downedMoonlord || spawnInfo.Player.Calamity().ZoneCalamity || Main.pumpkinMoon || Main.snowMoon || Main.eclipse) { return 0f; } diff --git a/NPCs/NormalNPCs/ProfanedEnergyBody.cs b/NPCs/NormalNPCs/ProfanedEnergyBody.cs index d5f8bfb1e1..1f848d4090 100644 --- a/NPCs/NormalNPCs/ProfanedEnergyBody.cs +++ b/NPCs/NormalNPCs/ProfanedEnergyBody.cs @@ -80,7 +80,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.PlayerSafe || !NPC.downedMoonlord || spawnInfo.Player.Calamity().ZoneCalamity || (!spawnInfo.Player.ZoneUnderworldHeight && !spawnInfo.Player.ZoneHallow)) + if (spawnInfo.PlayerSafe || !NPC.downedMoonlord || spawnInfo.Player.Calamity().ZoneCalamity || (!spawnInfo.Player.ZoneUnderworldHeight && !spawnInfo.Player.ZoneHallow) || Main.pumpkinMoon || Main.snowMoon || Main.eclipse) return 0f; // Keep this as a separate if check, because it's a loop and we don't want to be checking it constantly. diff --git a/NPCs/NormalNPCs/ScornEater.cs b/NPCs/NormalNPCs/ScornEater.cs index 0e7eb4dfae..6e34f798d6 100644 --- a/NPCs/NormalNPCs/ScornEater.cs +++ b/NPCs/NormalNPCs/ScornEater.cs @@ -189,7 +189,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.PlayerSafe || !NPC.downedMoonlord || spawnInfo.Player.Calamity().ZoneCalamity) + if (spawnInfo.PlayerSafe || !NPC.downedMoonlord || spawnInfo.Player.Calamity().ZoneCalamity || Main.pumpkinMoon || Main.snowMoon || Main.eclipse) { return 0f; } From e25901ef12b35e39a737ab267d151639b209d0d4 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Sat, 9 Nov 2024 22:58:08 -0500 Subject: [PATCH 008/118] Made Ravager's GFB gaster blasters more visible --- Projectiles/Boss/RavagerBlaster.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Projectiles/Boss/RavagerBlaster.cs b/Projectiles/Boss/RavagerBlaster.cs index a8b5432bab..1c56038a6d 100644 --- a/Projectiles/Boss/RavagerBlaster.cs +++ b/Projectiles/Boss/RavagerBlaster.cs @@ -26,6 +26,8 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + Lighting.AddLight(Projectile.Center, 1f, 1f, 1f); + //ai0 = timer, ai1 = laser size if (Projectile.ai[0] < 90f) //Before the laser { @@ -65,5 +67,11 @@ namespace CalamityMod.Projectiles.Boss // Does no contact damage public override bool? CanDamage() => false; + + public override bool PreDraw(ref Color lightColor) + { + CalamityUtils.DrawProjectileWithBackglow(Projectile, Color.LightGray, lightColor, 5f); + return false; + } } } From bc3752ed804ae6ec868ef8a65f78ae2c3f554d1d Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Sat, 9 Nov 2024 23:41:51 -0500 Subject: [PATCH 009/118] Slick Cane stealth nerf --- CalPlayer/CalamityPlayerLifeRegen.cs | 2 +- Items/Weapons/Rogue/SlickCane.cs | 2 +- Projectiles/Rogue/SlickCaneProjectile.cs | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 374e09843d..92cd348b65 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -557,7 +557,7 @@ namespace CalamityMod.CalPlayer // Yes, really, there's a list of conditions under which life regen doesn't work // even if it's life regen that normally works during a damage over time debuff. // - // 1. No life regen bool (Blood Boiler usage or wearing Omega Blue armor) + // 1. No life regen bool (Omega Blue armor) // 2. Being too far from Providence cocoon ("Holy Inferno") // 3. Air drowning in the Abyss // diff --git a/Items/Weapons/Rogue/SlickCane.cs b/Items/Weapons/Rogue/SlickCane.cs index 22ee59fe16..66108a171d 100644 --- a/Items/Weapons/Rogue/SlickCane.cs +++ b/Items/Weapons/Rogue/SlickCane.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 42; Item.height = 36; - Item.damage = 27; + Item.damage = 50; Item.noMelee = true; Item.noUseGraphic = true; Item.channel = true; diff --git a/Projectiles/Rogue/SlickCaneProjectile.cs b/Projectiles/Rogue/SlickCaneProjectile.cs index 85c60db307..7fd494e41f 100644 --- a/Projectiles/Rogue/SlickCaneProjectile.cs +++ b/Projectiles/Rogue/SlickCaneProjectile.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ownerHitCheck = true; Projectile.hide = true; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 2; + Projectile.localNPCHitCooldown = 5; Projectile.alpha = 180; Projectile.scale = 1.25f; } @@ -149,11 +149,11 @@ namespace CalamityMod.Projectiles.Rogue { Player player = Main.player[Projectile.owner]; double money = Utils.CoinsCount(out bool overflow, player.inventory); - if (money >= 5000000 && !Main.zenithWorld) - money = 5000000; + if (money >= 3000000 && !Main.zenithWorld) + money = 3000000; if (money != 0) { - modifiers.SourceDamage *= (float)(money / 1250000 + 1); + modifiers.SourceDamage *= (float)(money / 1500000 + 1); SoundEngine.PlaySound(TheSevensStriker.JackpotSound, Projectile.Center); for (int j = 0; j < 8; j++) { From 2fe9b369096ac6f49822560dd98513f4092aed2c Mon Sep 17 00:00:00 2001 From: Shade Date: Sun, 10 Nov 2024 11:04:04 -0600 Subject: [PATCH 010/118] Reverted the second scaling nerf to slick cane, the first nerf already cut it by more than half. The other changes are reasonable --- Projectiles/Rogue/SlickCaneProjectile.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Projectiles/Rogue/SlickCaneProjectile.cs b/Projectiles/Rogue/SlickCaneProjectile.cs index 7fd494e41f..8c0adbc6fe 100644 --- a/Projectiles/Rogue/SlickCaneProjectile.cs +++ b/Projectiles/Rogue/SlickCaneProjectile.cs @@ -144,7 +144,7 @@ namespace CalamityMod.Projectiles.Rogue } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - // Boost dmg in proportion to money, caps at 5 plat. Unless in Gfb cuz it would be funny + // Boost dmg in proportion to money, caps at 3 plat. Unless in Gfb cuz it would be funny if (Projectile.Calamity().stealthStrike) { Player player = Main.player[Projectile.owner]; @@ -153,7 +153,7 @@ namespace CalamityMod.Projectiles.Rogue money = 3000000; if (money != 0) { - modifiers.SourceDamage *= (float)(money / 1500000 + 1); + modifiers.SourceDamage *= (float)(money / 1250000 + 1); SoundEngine.PlaySound(TheSevensStriker.JackpotSound, Projectile.Center); for (int j = 0; j < 8; j++) { From 8439024bf6bfc86cd7cefdabdf1e53046caeb989 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Sun, 10 Nov 2024 12:51:39 -0500 Subject: [PATCH 011/118] Rotten Brain 5% damage actually --- Items/Accessories/RottenBrain.cs | 2 +- Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Items/Accessories/RottenBrain.cs b/Items/Accessories/RottenBrain.cs index f83fe3c9fe..8f2dd3ad50 100644 --- a/Items/Accessories/RottenBrain.cs +++ b/Items/Accessories/RottenBrain.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.rBrain = true; - player.GetDamage() += 0.06f; + player.GetDamage() += 0.05f; } public override void AddRecipes() diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 9b793ae884..9ad5edf804 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -1411,7 +1411,7 @@ RottenBrain: { DisplayName: Rotten Brain Tooltip: ''' - 6% increased damage + 5% increased damage Taking damage spawns a dank creeper The dank creeper flies above you, exploding into several shaderain clouds ''' From 112a66557f3c087180944ae2cc3cf7f26eaca64e Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Sun, 10 Nov 2024 22:21:48 -0500 Subject: [PATCH 012/118] Moon Lord drops Celestial Onion in Master Mode Due to the change I gave it --- Items/CalamityGlobalItemLoot.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/CalamityGlobalItemLoot.cs b/Items/CalamityGlobalItemLoot.cs index 2189dc89de..c28b888622 100644 --- a/Items/CalamityGlobalItemLoot.cs +++ b/Items/CalamityGlobalItemLoot.cs @@ -270,7 +270,7 @@ namespace CalamityMod.Items loot.Add(ModContent.ItemType(), ThankYouPainting.DropInt); // The Celestial Onion only drops if the player hasn't used one, or if the world is not in Master Mode. - loot.AddIf((info) => !info.player.Calamity().extraAccessoryML && !Main.masterMode, ModContent.ItemType()); + loot.AddIf((info) => !info.player.Calamity().extraAccessoryML, ModContent.ItemType()); break; #endregion From e87dcba07427c47c74307d5509798b57de5c63b4 Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Mon, 11 Nov 2024 11:41:42 +0700 Subject: [PATCH 013/118] mount balance edit 2 --- Items/Mounts/BUMBLEDOGE.cs | 4 ++-- Items/Mounts/Crysthamyr.cs | 2 +- Items/Mounts/OnyxExcavator.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Items/Mounts/BUMBLEDOGE.cs b/Items/Mounts/BUMBLEDOGE.cs index 28a68213b8..942e640030 100644 --- a/Items/Mounts/BUMBLEDOGE.cs +++ b/Items/Mounts/BUMBLEDOGE.cs @@ -17,12 +17,12 @@ namespace CalamityMod.Items.Mounts MountData.buff = ModContent.BuffType(); // Attack - MountData.abilityCooldown = 15; + MountData.abilityCooldown = 12; // Horizontal movement MountData.runSpeed = 10f; MountData.dashSpeed = 14.15f; - MountData.acceleration = 0.16f; + MountData.acceleration = 0.2f; // Vertical movement MountData.fallDamage = 0f; diff --git a/Items/Mounts/Crysthamyr.cs b/Items/Mounts/Crysthamyr.cs index 070aa55703..e050a1a7ed 100644 --- a/Items/Mounts/Crysthamyr.cs +++ b/Items/Mounts/Crysthamyr.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Mounts MountData.runSpeed = 5f; MountData.dashSpeed = 10f; MountData.swimSpeed = 6f; - MountData.acceleration = 0.6f; + MountData.acceleration = 1f; // Vertical movement MountData.fallDamage = 0f; diff --git a/Items/Mounts/OnyxExcavator.cs b/Items/Mounts/OnyxExcavator.cs index 21f9cc0a13..4a9ba4a65d 100644 --- a/Items/Mounts/OnyxExcavator.cs +++ b/Items/Mounts/OnyxExcavator.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Mounts MountData.buff = ModContent.BuffType(); // Horizontal movement - MountData.runSpeed = 6.5f; + MountData.runSpeed = 5.5f; MountData.swimSpeed = 0.5f; MountData.acceleration = 0.2f; From d58c7422df44a8a3ccb5a860297e83d13b3166f2 Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Mon, 11 Nov 2024 12:07:33 +0700 Subject: [PATCH 014/118] abyss loot edits fixed a bug where the bestiary report on eidolon underwent mitosis --- NPCs/Abyss/DevilFish.cs | 1 - NPCs/Abyss/EidolonWyrmHead.cs | 4 ++-- NPCs/Abyss/GiantSquid.cs | 1 - NPCs/Abyss/GulperEelHead.cs | 1 - NPCs/Abyss/Laserfish.cs | 3 ++- NPCs/Abyss/Viperfish.cs | 1 - NPCs/PrimordialWyrm/PrimordialWyrmHead.cs | 6 ++---- 7 files changed, 6 insertions(+), 11 deletions(-) diff --git a/NPCs/Abyss/DevilFish.cs b/NPCs/Abyss/DevilFish.cs index dd11f84852..86f0a98418 100644 --- a/NPCs/Abyss/DevilFish.cs +++ b/NPCs/Abyss/DevilFish.cs @@ -318,7 +318,6 @@ namespace CalamityMod.NPCs.Abyss { var postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 1, 2, 2, 3)); - postLevi.Add(ModContent.ItemType(), 2); npcLoot.AddIf(() => NPC.downedGolemBoss, ModContent.ItemType(), 1, 3, 9); npcLoot.Add(ModContent.ItemType(), 1, 10, 20); } diff --git a/NPCs/Abyss/EidolonWyrmHead.cs b/NPCs/Abyss/EidolonWyrmHead.cs index 7058346888..37e26cc9b0 100644 --- a/NPCs/Abyss/EidolonWyrmHead.cs +++ b/NPCs/Abyss/EidolonWyrmHead.cs @@ -466,14 +466,14 @@ namespace CalamityMod.NPCs.Abyss aewMinionCondition.Add(ModContent.ItemType(), 50); // Post-Polterghast: Soul Edge, Eidolic Wail, Stardust Staff - LeadingConditionRule postPolter = npcLoot.DefineConditionalDropSet(DropHelper.PostPolter()); + LeadingConditionRule postPolter = new LeadingConditionRule(DropHelper.If(() => DownedBossSystem.downedPolterghast)); aewMinionCondition.Add(postPolter); postPolter.Add(ModContent.ItemType(), 3); postPolter.Add(ModContent.ItemType(), 3); postPolter.Add(ModContent.ItemType(), 3); // Post-Leviathan: 6-8 Lumenyl (8-11 on Expert) - LeadingConditionRule postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); + LeadingConditionRule postLevi = new LeadingConditionRule(DropHelper.If(() => DownedBossSystem.downedLeviathan)); aewMinionCondition.Add(postLevi); postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 6, 8, 8, 11)); diff --git a/NPCs/Abyss/GiantSquid.cs b/NPCs/Abyss/GiantSquid.cs index 837864953c..4b4373e7a6 100644 --- a/NPCs/Abyss/GiantSquid.cs +++ b/NPCs/Abyss/GiantSquid.cs @@ -256,7 +256,6 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { var postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); - postLevi.Add(ModContent.ItemType(), 2); postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 2, 4, 3, 6)); } diff --git a/NPCs/Abyss/GulperEelHead.cs b/NPCs/Abyss/GulperEelHead.cs index 113d4a54f1..64130aad7f 100644 --- a/NPCs/Abyss/GulperEelHead.cs +++ b/NPCs/Abyss/GulperEelHead.cs @@ -381,7 +381,6 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { var postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); - postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 2, 3, 3, 4)); postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 6, 8, 8, 11)); } diff --git a/NPCs/Abyss/Laserfish.cs b/NPCs/Abyss/Laserfish.cs index c5d30564ce..9671f0d830 100644 --- a/NPCs/Abyss/Laserfish.cs +++ b/NPCs/Abyss/Laserfish.cs @@ -127,7 +127,8 @@ namespace CalamityMod.NPCs.Abyss public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.AddIf(DropHelper.PostLevi(), ModContent.ItemType(), 2); + var postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); + postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 1, 2, 2, 3)); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/Abyss/Viperfish.cs b/NPCs/Abyss/Viperfish.cs index d6a26f7d9d..6eda808819 100644 --- a/NPCs/Abyss/Viperfish.cs +++ b/NPCs/Abyss/Viperfish.cs @@ -159,7 +159,6 @@ namespace CalamityMod.NPCs.Abyss { var postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 1, 2, 2, 3)); - postLevi.Add(ModContent.ItemType(), 4); npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 10, 6)); } diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs b/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs index 46a69cacc6..6314210647 100644 --- a/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs +++ b/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs @@ -1462,10 +1462,8 @@ namespace CalamityMod.NPCs.PrimordialWyrm npcLoot.Add(ModContent.ItemType()); npcLoot.Add(ModContent.ItemType(), 1, 80, 100); npcLoot.Add(ModContent.ItemType(), ThankYouPainting.DropInt); - - var postLevi = npcLoot.DefineConditionalDropSet(() => DownedBossSystem.downedLeviathan); - postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 50, 108, 65, 135)); - postLevi.Add(ItemID.Ectoplasm, 1, 21, 32); + npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 50, 108, 65, 135)); + npcLoot.Add(ItemID.Ectoplasm, 1, 21, 32); } public override void HitEffect(NPC.HitInfo hit) From fa1418e9f06990f820e4044629f9c64b987e9299 Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Mon, 11 Nov 2024 19:38:00 +0700 Subject: [PATCH 015/118] Moon Lord Celestial Onion condition edit 2 Due to the change CIT gave it --- Items/CalamityGlobalItemLoot.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Items/CalamityGlobalItemLoot.cs b/Items/CalamityGlobalItemLoot.cs index c28b888622..7b41779c8a 100644 --- a/Items/CalamityGlobalItemLoot.cs +++ b/Items/CalamityGlobalItemLoot.cs @@ -269,8 +269,8 @@ namespace CalamityMod.Items loot.AddRevBagAccessories(); loot.Add(ModContent.ItemType(), ThankYouPainting.DropInt); - // The Celestial Onion only drops if the player hasn't used one, or if the world is not in Master Mode. - loot.AddIf((info) => !info.player.Calamity().extraAccessoryML, ModContent.ItemType()); + // The Celestial Onion only drops if the player hasn't used one (or has not used Demon Heart in Master Mode as it alternatively functions as that there) + loot.AddIf((info) => (!info.player.Calamity().extraAccessoryML && !Main.masterMode) || (!info.player.extraAccessory && Main.masterMode), ModContent.ItemType()); break; #endregion From 10ed9ee04972e74d606fb59427151ab82ac3304b Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Mon, 11 Nov 2024 19:53:45 +0700 Subject: [PATCH 016/118] Added Ice Mimic to the debuff system one day this thing just popped into its own ID like that's awesome --- NPCs/CalamityGlobalNPC.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 89c970057d..085ef83ead 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -2475,6 +2475,7 @@ namespace CalamityMod.NPCs case NPCID.IceSlime: case NPCID.SpikedIceSlime: case NPCID.IceGolem: + case NPCID.IceMimic: case NPCID.MisterStabby: case NPCID.SnowBalla: case NPCID.SnowmanGangsta: From 12835b9339fdf9f12e4178c29590a44ae72e12a6 Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Mon, 11 Nov 2024 20:05:46 +0700 Subject: [PATCH 017/118] the fucking dandelion and torch zombies and golden slime ig --- NPCs/CalamityGlobalNPC.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 085ef83ead..47ce1ef0e1 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -1941,6 +1941,7 @@ namespace CalamityMod.NPCs case NPCID.BlackSlime: case NPCID.BlueSlime: case NPCID.CorruptSlime: + case NPCID.GoldenSlime: case NPCID.GreenSlime: case NPCID.IlluminantSlime: case NPCID.JungleSlime: @@ -2130,6 +2131,7 @@ namespace CalamityMod.NPCs // Organic enemies. case NPCID.HallowBoss: + case NPCID.Dandelion: case NPCID.Gnome: case NPCID.BloodEelHead: case NPCID.BloodEelBody: @@ -2210,6 +2212,7 @@ namespace CalamityMod.NPCs case NPCID.ArmedZombiePincussion: case NPCID.ArmedZombieSwamp: case NPCID.ArmedZombieTwiggy: + case NPCID.ArmedTorchZombie: case NPCID.BaldZombie: case NPCID.BigBaldZombie: case NPCID.BigFemaleZombie: @@ -2230,6 +2233,7 @@ namespace CalamityMod.NPCs case NPCID.SmallTwiggyZombie: case NPCID.SmallZombie: case NPCID.SwampZombie: + case NPCID.TorchZombie: case NPCID.TwiggyZombie: case NPCID.Zombie: case NPCID.ZombieDoctor: From cc23ba79fb0579f5d55852c116f72f35270ba632 Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Mon, 11 Nov 2024 20:38:55 +0700 Subject: [PATCH 018/118] illuminant coating on multivariant walls --- Utilities/TileUtils.cs | 2 +- Walls/VoidstoneWall.cs | 2 +- Walls/VoidstoneWallUnsafe.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Utilities/TileUtils.cs b/Utilities/TileUtils.cs index 50442427ef..f81ef79558 100644 --- a/Utilities/TileUtils.cs +++ b/Utilities/TileUtils.cs @@ -297,7 +297,7 @@ namespace CalamityMod Texture2D sprite = TextureAssets.Wall[type].Value; Vector2 offset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + (Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange)) - Vector2.One * 8f; Rectangle frame = new Rectangle(sheetOffset[0] + tile.WallFrameX, sheetOffset[1] + tile.WallFrameY, 32, 32); - Color lightColor = Lighting.GetColor(i, j); + Color lightColor = tile.IsWallFullbright ? Color.White : Lighting.GetColor(i, j); spriteBatch.Draw(sprite, offset, frame, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); }); diff --git a/Walls/VoidstoneWall.cs b/Walls/VoidstoneWall.cs index 3f9290c465..3b1b90726f 100644 --- a/Walls/VoidstoneWall.cs +++ b/Walls/VoidstoneWall.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Walls int yPos = tile.WallFrameY; int xPos = tile.WallFrameX; Rectangle frame = new Rectangle(xPos, yPos, 32, 32); - Color lightColor = Lighting.GetColor(i, j); + Color lightColor = tile.IsWallFullbright ? Color.White : Lighting.GetColor(i, j); spriteBatch.Draw(sprite, offset, frame, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); diff --git a/Walls/VoidstoneWallUnsafe.cs b/Walls/VoidstoneWallUnsafe.cs index deee028dc4..b67cd4a7ae 100644 --- a/Walls/VoidstoneWallUnsafe.cs +++ b/Walls/VoidstoneWallUnsafe.cs @@ -67,7 +67,7 @@ namespace CalamityMod.Walls int yPos = tile.WallFrameY; int xPos = tile.WallFrameX; Rectangle frame = new Rectangle(xPos, yPos, 32, 32); - Color lightColor = Lighting.GetColor(i, j); + Color lightColor = tile.IsWallFullbright ? Color.White : Lighting.GetColor(i, j); spriteBatch.Draw(sprite, offset, frame, lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); From 1d07cfc68c8b615e967ad8c654477b162d387895 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Mon, 11 Nov 2024 09:41:21 -0500 Subject: [PATCH 019/118] Shimmer Slime too, trollface --- NPCs/CalamityGlobalNPC.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 47ce1ef0e1..4f9d40fdd2 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -1267,7 +1267,7 @@ namespace CalamityMod.NPCs { NPCID.BigMimicCorruption, 0.3f }, { NPCID.BigMimicCrimson, 0.3f }, { NPCID.BigMimicHallow, 0.3f }, - { NPCID.BigMimicJungle, 0.3f }, // unused vanilla enemy + { NPCID.BigMimicJungle, 0.3f }, { NPCID.BlueArmoredBones, 0.2f }, { NPCID.BlueArmoredBonesMace, 0.2f }, { NPCID.BlueArmoredBonesNoPants, 0.2f }, @@ -1950,6 +1950,7 @@ namespace CalamityMod.NPCs case NPCID.PurpleSlime: case NPCID.RainbowSlime: case NPCID.RedSlime: + case NPCID.ShimmerSlime: case NPCID.Slimeling: case NPCID.SlimeMasked: case NPCID.Slimer: From 83d48353c830e777ead66f448790aa0cc08a4b88 Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Mon, 11 Nov 2024 21:44:21 +0700 Subject: [PATCH 020/118] Fixed placed Cosmilite Bar being invisible?? and some glowmasks drawing while invisible under Echo Coating You can now Echo Coat Spine Trees and Draedon's stuffery and Wulfrum Pipes --- Tiles/BaseTiles/BaseMonolith.cs | 3 +++ Tiles/BaseTiles/DynamicallyGrownTree.cs | 3 +++ Tiles/CosmiliteBarTile.cs | 5 ----- Tiles/Crags/Tree/SpineTree.cs | 3 +++ Tiles/DraedonStructures/LabHologramProjector.cs | 3 +++ Tiles/DraedonStructures/PowerCellFactory.cs | 2 ++ Tiles/DraedonSummoner/CodebreakerTile.cs | 2 ++ Tiles/Furniture/BabyFlakCrabCageTile.cs | 3 +++ Tiles/Furniture/PiggyCageTile.cs | 3 +++ Tiles/Furniture/RepairUnitCageTile.cs | 3 +++ Tiles/FurnitureAshen/AshenAccentSlab.cs | 3 +++ Tiles/FurnitureAshen/AshenSlab.cs | 3 +++ Tiles/FurnitureMonolith/MonolithBathtub.cs | 3 +++ Tiles/FurnitureMonolith/MonolithBed.cs | 3 +++ Tiles/FurnitureMonolith/MonolithBench.cs | 3 +++ Tiles/FurnitureMonolith/MonolithBookcase.cs | 3 +++ Tiles/FurnitureMonolith/MonolithCandelabra.cs | 3 +++ Tiles/FurnitureOtherworldly/OtherworldlyStone.cs | 3 +++ Tiles/SunkenSea/EutrophicGlass.cs | 3 +++ Tiles/WulfrumPipes.cs | 2 ++ Utilities/TileUtils.cs | 12 +++++++++++- 21 files changed, 65 insertions(+), 6 deletions(-) diff --git a/Tiles/BaseTiles/BaseMonolith.cs b/Tiles/BaseTiles/BaseMonolith.cs index 39221e8685..f1a8684edb 100644 --- a/Tiles/BaseTiles/BaseMonolith.cs +++ b/Tiles/BaseTiles/BaseMonolith.cs @@ -116,6 +116,9 @@ namespace CalamityMod.Tiles.BaseTiles public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return false; + var tile = Main.tile[i, j]; var texture = TextureAssets.Tile[Type].Value; diff --git a/Tiles/BaseTiles/DynamicallyGrownTree.cs b/Tiles/BaseTiles/DynamicallyGrownTree.cs index e4a3882f33..a4f4a23084 100644 --- a/Tiles/BaseTiles/DynamicallyGrownTree.cs +++ b/Tiles/BaseTiles/DynamicallyGrownTree.cs @@ -132,6 +132,9 @@ namespace CalamityMod.Tiles.BaseTiles public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return false; + Tile t = CalamityUtils.ParanoidTileRetrieval(i, j); if (t.TileFrameX != 0 || t.TileFrameY != ((int)Math.Ceiling(DistanceUsedForTrunk / 16) - 1) * 18) return false; diff --git a/Tiles/CosmiliteBarTile.cs b/Tiles/CosmiliteBarTile.cs index 7ecfadf556..d37e1f19b5 100644 --- a/Tiles/CosmiliteBarTile.cs +++ b/Tiles/CosmiliteBarTile.cs @@ -19,10 +19,5 @@ namespace CalamityMod.Tiles type = ModContent.DustType(); return true; } - - public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) - { - return false; - } } } diff --git a/Tiles/Crags/Tree/SpineTree.cs b/Tiles/Crags/Tree/SpineTree.cs index 0d7628d3f2..11adee04ed 100644 --- a/Tiles/Crags/Tree/SpineTree.cs +++ b/Tiles/Crags/Tree/SpineTree.cs @@ -293,6 +293,9 @@ namespace CalamityMod.Tiles.Crags.Tree public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return false; + Tile tile = Framing.GetTileSafely(i, j); float xOff = (float)Math.Sin((j * 19) * 0.04f) * 1.2f; diff --git a/Tiles/DraedonStructures/LabHologramProjector.cs b/Tiles/DraedonStructures/LabHologramProjector.cs index 2e1da5d040..450338bc2d 100644 --- a/Tiles/DraedonStructures/LabHologramProjector.cs +++ b/Tiles/DraedonStructures/LabHologramProjector.cs @@ -101,6 +101,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { Tile trackTile = Main.tile[i, j]; + if (trackTile.IsTileActuallyInvisible()) + return false; + int time = (int)(Main.GlobalTimeWrappedHourly * 60); TELabHologramProjector hologramTileEntity = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); diff --git a/Tiles/DraedonStructures/PowerCellFactory.cs b/Tiles/DraedonStructures/PowerCellFactory.cs index 810360ee0b..0f57ac7693 100644 --- a/Tiles/DraedonStructures/PowerCellFactory.cs +++ b/Tiles/DraedonStructures/PowerCellFactory.cs @@ -121,6 +121,8 @@ namespace CalamityMod.Tiles.DraedonStructures { // These offsets start as the tile offsets, i.e. which sub-tile of the FrameImportant structure this specific location is. Tile t = Main.tile[i, j]; + if (t.IsTileActuallyInvisible()) + return false; int frameXPos = t.TileFrameX; int frameYPos = t.TileFrameY; diff --git a/Tiles/DraedonSummoner/CodebreakerTile.cs b/Tiles/DraedonSummoner/CodebreakerTile.cs index 013cdf7b8b..ae7a7c97f0 100644 --- a/Tiles/DraedonSummoner/CodebreakerTile.cs +++ b/Tiles/DraedonSummoner/CodebreakerTile.cs @@ -171,6 +171,8 @@ namespace CalamityMod.Tiles.DraedonSummoner { // These offsets start as the tile offsets, i.e. which sub-tile of the FrameImportant structure this specific location is. Tile t = Main.tile[i, j]; + if (t.IsTileActuallyInvisible()) + return false; int left = i - t.TileFrameX % (Width * SheetSquare) / SheetSquare; int frameXPos = t.TileFrameX; int frameYPos = t.TileFrameY + Height * SheetSquare * (int)((Main.GlobalTimeWrappedHourly * 12f + left) % 8); diff --git a/Tiles/Furniture/BabyFlakCrabCageTile.cs b/Tiles/Furniture/BabyFlakCrabCageTile.cs index a5130a5078..b1d2596cd8 100644 --- a/Tiles/Furniture/BabyFlakCrabCageTile.cs +++ b/Tiles/Furniture/BabyFlakCrabCageTile.cs @@ -72,6 +72,9 @@ namespace CalamityMod.Tiles.Furniture // Since this uses a custom top sprite, all drawing must be redone public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return false; + Tile tile = Main.tile[i, j]; var zero = Main.drawToScreen ? Vector2.Zero : new(Main.offScreenRange, Main.offScreenRange); var drawPos = new Vector2(i * 16, j * 16) - Main.screenPosition + zero + CalamityUtils.TileDrawOffset + Vector2.UnitY * 2; diff --git a/Tiles/Furniture/PiggyCageTile.cs b/Tiles/Furniture/PiggyCageTile.cs index 66dfb336a4..3bb7fd1f87 100644 --- a/Tiles/Furniture/PiggyCageTile.cs +++ b/Tiles/Furniture/PiggyCageTile.cs @@ -65,6 +65,9 @@ namespace CalamityMod.Tiles.Furniture // Since this uses a custom top sprite, all drawing must be redone public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return false; + Tile tile = Main.tile[i, j]; var zero = Main.drawToScreen ? Vector2.Zero : new(Main.offScreenRange, Main.offScreenRange); var drawPos = new Vector2(i * 16, j * 16) - Main.screenPosition + zero + CalamityUtils.TileDrawOffset + Vector2.UnitY * 2; diff --git a/Tiles/Furniture/RepairUnitCageTile.cs b/Tiles/Furniture/RepairUnitCageTile.cs index 5785665977..7f7a6c2d3f 100644 --- a/Tiles/Furniture/RepairUnitCageTile.cs +++ b/Tiles/Furniture/RepairUnitCageTile.cs @@ -64,6 +64,9 @@ namespace CalamityMod.Tiles.Furniture // Since this uses a custom top sprite, all drawing must be redone public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return false; + Tile tile = Main.tile[i, j]; var zero = Main.drawToScreen ? Vector2.Zero : new(Main.offScreenRange, Main.offScreenRange); var drawPos = new Vector2(i * 16, j * 16) - Main.screenPosition + zero + CalamityUtils.TileDrawOffset + Vector2.UnitY * 2; diff --git a/Tiles/FurnitureAshen/AshenAccentSlab.cs b/Tiles/FurnitureAshen/AshenAccentSlab.cs index 97dc53aba5..6fa77bdb6f 100644 --- a/Tiles/FurnitureAshen/AshenAccentSlab.cs +++ b/Tiles/FurnitureAshen/AshenAccentSlab.cs @@ -272,6 +272,9 @@ namespace CalamityMod.Tiles.FurnitureAshen public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int uniqueAnimationFrameX = 0; int uniqueAnimationFrameY = 0; int xPos = i % 2; diff --git a/Tiles/FurnitureAshen/AshenSlab.cs b/Tiles/FurnitureAshen/AshenSlab.cs index 182a094973..440542777f 100644 --- a/Tiles/FurnitureAshen/AshenSlab.cs +++ b/Tiles/FurnitureAshen/AshenSlab.cs @@ -272,6 +272,9 @@ namespace CalamityMod.Tiles.FurnitureAshen public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int uniqueAnimationFrameX = 0; int uniqueAnimationFrameY = 0; int xPos = i % 2; diff --git a/Tiles/FurnitureMonolith/MonolithBathtub.cs b/Tiles/FurnitureMonolith/MonolithBathtub.cs index 3ce05394fc..b73e969cec 100644 --- a/Tiles/FurnitureMonolith/MonolithBathtub.cs +++ b/Tiles/FurnitureMonolith/MonolithBathtub.cs @@ -22,6 +22,9 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithBathtubGlow").Value; diff --git a/Tiles/FurnitureMonolith/MonolithBed.cs b/Tiles/FurnitureMonolith/MonolithBed.cs index 49e88eb271..12feb19543 100644 --- a/Tiles/FurnitureMonolith/MonolithBed.cs +++ b/Tiles/FurnitureMonolith/MonolithBed.cs @@ -24,6 +24,9 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithBedGlow").Value; diff --git a/Tiles/FurnitureMonolith/MonolithBench.cs b/Tiles/FurnitureMonolith/MonolithBench.cs index 624f9e10f4..ed8dfb3702 100644 --- a/Tiles/FurnitureMonolith/MonolithBench.cs +++ b/Tiles/FurnitureMonolith/MonolithBench.cs @@ -25,6 +25,9 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithBenchGlow").Value; diff --git a/Tiles/FurnitureMonolith/MonolithBookcase.cs b/Tiles/FurnitureMonolith/MonolithBookcase.cs index 573af1ad49..f0f2539b8a 100644 --- a/Tiles/FurnitureMonolith/MonolithBookcase.cs +++ b/Tiles/FurnitureMonolith/MonolithBookcase.cs @@ -23,6 +23,9 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithBookcaseGlow").Value; diff --git a/Tiles/FurnitureMonolith/MonolithCandelabra.cs b/Tiles/FurnitureMonolith/MonolithCandelabra.cs index f917cbbb59..f473367d54 100644 --- a/Tiles/FurnitureMonolith/MonolithCandelabra.cs +++ b/Tiles/FurnitureMonolith/MonolithCandelabra.cs @@ -23,6 +23,9 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithCandelabraGlow").Value; diff --git a/Tiles/FurnitureOtherworldly/OtherworldlyStone.cs b/Tiles/FurnitureOtherworldly/OtherworldlyStone.cs index 016733d5de..3948395809 100644 --- a/Tiles/FurnitureOtherworldly/OtherworldlyStone.cs +++ b/Tiles/FurnitureOtherworldly/OtherworldlyStone.cs @@ -51,6 +51,9 @@ namespace CalamityMod.Tiles.FurnitureOtherworldly public override void SpecialDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, Lighting.GetColor(i, j), false); diff --git a/Tiles/SunkenSea/EutrophicGlass.cs b/Tiles/SunkenSea/EutrophicGlass.cs index a11f188fe4..77f47816d1 100644 --- a/Tiles/SunkenSea/EutrophicGlass.cs +++ b/Tiles/SunkenSea/EutrophicGlass.cs @@ -42,6 +42,9 @@ namespace CalamityMod.Tiles.SunkenSea public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + float transparency = 0.6f; // Must be set here diff --git a/Tiles/WulfrumPipes.cs b/Tiles/WulfrumPipes.cs index d2c6485691..70dd1b9f4a 100644 --- a/Tiles/WulfrumPipes.cs +++ b/Tiles/WulfrumPipes.cs @@ -59,6 +59,8 @@ namespace CalamityMod.Tiles { Point pos = new Point(i, j); Tile tile = Main.tile[pos]; + if (tile.IsTileActuallyInvisible()) + return; float timeToGo = pos.GetTileRNG(2) * 22; float animProgress = (float)Math.Pow(MathHelper.Clamp((TempTilesManagerSystem.GetTemporaryTileTime(pos) - (WulfrumScaffoldKit.TileTime - timeToGo)) / timeToGo, 0, 1), 2); diff --git a/Utilities/TileUtils.cs b/Utilities/TileUtils.cs index f81ef79558..14cbf48b07 100644 --- a/Utilities/TileUtils.cs +++ b/Utilities/TileUtils.cs @@ -115,6 +115,9 @@ namespace CalamityMod public static void DrawFlameEffect(Texture2D flameTexture, int i, int j, int offsetX = 0, int offsetY = 0) { Tile tile = Main.tile[i, j]; + if (tile.IsTileActuallyInvisible()) + return; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); int width = 16; @@ -152,7 +155,7 @@ namespace CalamityMod public static void DrawFlameSparks(int dustType, int rarity, int i, int j) { - if (!Main.gamePaused && Main.instance.IsActive && (!Lighting.UpdateEveryFrame || Main.rand.NextBool(4))) + if (!Main.gamePaused && Main.instance.IsActive && !Main.tile[i,j].IsTileActuallyInvisible() && (!Lighting.UpdateEveryFrame || Main.rand.NextBool(4))) { if (Main.rand.NextBool(rarity)) { @@ -227,6 +230,13 @@ namespace CalamityMod return uniqueAnimationFrame * animationFrameLength; } + /// + /// Checks whether or not the tile is actually able to be seen. + /// + /// The tile being checked. + /// Whether + public static bool IsTileActuallyInvisible(this Tile tile) => tile.IsTileInvisible && !Main.ShouldShowInvisibleWalls(); + /// /// Gets the color of a tile/wall after paint is applied /// From 5c7e48dd996e2a1525ea6e192fc60245df088faa Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Mon, 11 Nov 2024 22:07:35 +0700 Subject: [PATCH 021/118] more postdraw echo fixes there's still more left! --- Tiles/Astral/AstralMonolith.cs | 2 ++ Tiles/Crags/Lily/LavaLily1.cs | 3 +++ Tiles/Crags/Lily/LavaLily2.cs | 3 +++ Tiles/Crags/Lily/LavaLily3.cs | 3 +++ Tiles/Crags/Lily/LavaLily4.cs | 3 +++ Tiles/Crags/Lily/LavaLily5.cs | 3 +++ Tiles/Crags/Lily/LavaLily6.cs | 3 +++ Tiles/DraedonStructures/AgedLaboratoryConsole.cs | 3 +++ Tiles/DraedonStructures/AgedLaboratoryDisplay.cs | 3 +++ Tiles/DraedonStructures/AgedLaboratoryScreen.cs | 3 +++ Tiles/DraedonStructures/AgedLaboratoryServer.cs | 3 +++ Tiles/DraedonStructures/AgedReinforcedCrate.cs | 3 +++ Tiles/DraedonStructures/ChargingStation.cs | 3 +++ Tiles/DraedonStructures/DraedonLabTurret.cs | 2 +- Tiles/DraedonStructures/HostileFireTurret .cs | 2 +- Tiles/DraedonStructures/HostileIceTurret .cs | 2 +- Tiles/DraedonStructures/HostileLaserTurret .cs | 2 +- Tiles/DraedonStructures/HostileOnyxTurret.cs | 2 +- Tiles/DraedonStructures/HostilePlagueTurret.cs | 2 +- Tiles/DraedonStructures/HostileWaterTurret.cs | 2 +- Tiles/DraedonStructures/LaboratoryConsole.cs | 3 +++ Tiles/DraedonStructures/LaboratoryDisplay.cs | 3 +++ Tiles/DraedonStructures/LaboratoryScreen.cs | 3 +++ Tiles/DraedonStructures/LaboratoryServer.cs | 3 +++ Tiles/DraedonStructures/LaboratoryTerminal.cs | 3 +++ Tiles/DraedonStructures/ReinforcedCrate.cs | 3 +++ Tiles/Furniture/CraftingStations/MonolithAmalgam.cs | 3 +++ Tiles/Furniture/CraftingStations/WulfrumLabstation.cs | 3 +++ Tiles/FurnitureAshen/AshenMonolith.cs | 3 +++ Tiles/FurnitureAuric/AuricAbsorberTile.cs | 2 ++ Tiles/FurnitureAuric/AuricConsoleTile.cs | 3 +++ Tiles/FurnitureAuric/AuricDisplayTile.cs | 3 +++ Tiles/FurnitureAuric/AuricPlatformTile.cs | 2 ++ Tiles/FurnitureAuric/AuricReinforcedCrateTile.cs | 3 +++ Tiles/FurnitureAuric/AuricScreenTile.cs | 3 +++ Tiles/FurnitureAuric/AuricServerTile.cs | 3 +++ Tiles/FurnitureAuric/AuricTerminalTile.cs | 3 +++ Utilities/TileUtils.cs | 3 +++ 38 files changed, 97 insertions(+), 7 deletions(-) diff --git a/Tiles/Astral/AstralMonolith.cs b/Tiles/Astral/AstralMonolith.cs index 1ff2ad9606..5dd4bb0a03 100644 --- a/Tiles/Astral/AstralMonolith.cs +++ b/Tiles/Astral/AstralMonolith.cs @@ -61,6 +61,8 @@ namespace CalamityMod.Tiles.Astral public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Main.tile[i, j]; + if (tile.IsTileActuallyInvisible()) + return; int xOffset = i % 4; int yOffset = j % 4; diff --git a/Tiles/Crags/Lily/LavaLily1.cs b/Tiles/Crags/Lily/LavaLily1.cs index e541a9a434..9ce7428ca5 100644 --- a/Tiles/Crags/Lily/LavaLily1.cs +++ b/Tiles/Crags/Lily/LavaLily1.cs @@ -57,6 +57,9 @@ namespace CalamityMod.Tiles.Crags.Lily { //draw the glowmask on the lily base Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily1Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); diff --git a/Tiles/Crags/Lily/LavaLily2.cs b/Tiles/Crags/Lily/LavaLily2.cs index d392bcc01c..2e09e90016 100644 --- a/Tiles/Crags/Lily/LavaLily2.cs +++ b/Tiles/Crags/Lily/LavaLily2.cs @@ -57,6 +57,9 @@ namespace CalamityMod.Tiles.Crags.Lily { //draw the glowmask on the lily base Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily2Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); diff --git a/Tiles/Crags/Lily/LavaLily3.cs b/Tiles/Crags/Lily/LavaLily3.cs index e33eac3bb7..1b32b892e4 100644 --- a/Tiles/Crags/Lily/LavaLily3.cs +++ b/Tiles/Crags/Lily/LavaLily3.cs @@ -57,6 +57,9 @@ namespace CalamityMod.Tiles.Crags.Lily { //draw the glowmask on the lily base Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily3Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); diff --git a/Tiles/Crags/Lily/LavaLily4.cs b/Tiles/Crags/Lily/LavaLily4.cs index e922e4efea..8950207004 100644 --- a/Tiles/Crags/Lily/LavaLily4.cs +++ b/Tiles/Crags/Lily/LavaLily4.cs @@ -57,6 +57,9 @@ namespace CalamityMod.Tiles.Crags.Lily { //draw the glowmask on the lily base Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily4Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); diff --git a/Tiles/Crags/Lily/LavaLily5.cs b/Tiles/Crags/Lily/LavaLily5.cs index 57c72e2661..6397483d8d 100644 --- a/Tiles/Crags/Lily/LavaLily5.cs +++ b/Tiles/Crags/Lily/LavaLily5.cs @@ -57,6 +57,9 @@ namespace CalamityMod.Tiles.Crags.Lily { //draw the glowmask on the lily base Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily5Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); diff --git a/Tiles/Crags/Lily/LavaLily6.cs b/Tiles/Crags/Lily/LavaLily6.cs index bc8fa2c1bd..0aafb69d5d 100644 --- a/Tiles/Crags/Lily/LavaLily6.cs +++ b/Tiles/Crags/Lily/LavaLily6.cs @@ -57,6 +57,9 @@ namespace CalamityMod.Tiles.Crags.Lily { //draw the glowmask on the lily base Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Crags/Lily/LavaLily6Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); diff --git a/Tiles/DraedonStructures/AgedLaboratoryConsole.cs b/Tiles/DraedonStructures/AgedLaboratoryConsole.cs index 1e9d88b4dc..8df5cec10d 100644 --- a/Tiles/DraedonStructures/AgedLaboratoryConsole.cs +++ b/Tiles/DraedonStructures/AgedLaboratoryConsole.cs @@ -53,6 +53,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/DraedonStructures/AgedLaboratoryConsoleGlow").Value; diff --git a/Tiles/DraedonStructures/AgedLaboratoryDisplay.cs b/Tiles/DraedonStructures/AgedLaboratoryDisplay.cs index 6d596e755e..4363f7433b 100644 --- a/Tiles/DraedonStructures/AgedLaboratoryDisplay.cs +++ b/Tiles/DraedonStructures/AgedLaboratoryDisplay.cs @@ -46,6 +46,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/DraedonStructures/AgedLaboratoryDisplayGlow").Value; diff --git a/Tiles/DraedonStructures/AgedLaboratoryScreen.cs b/Tiles/DraedonStructures/AgedLaboratoryScreen.cs index 92586a8eef..6df4e7fae9 100644 --- a/Tiles/DraedonStructures/AgedLaboratoryScreen.cs +++ b/Tiles/DraedonStructures/AgedLaboratoryScreen.cs @@ -36,6 +36,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/DraedonStructures/AgedLaboratoryScreenGlow").Value; diff --git a/Tiles/DraedonStructures/AgedLaboratoryServer.cs b/Tiles/DraedonStructures/AgedLaboratoryServer.cs index 0edb6b3758..78e5f00ba1 100644 --- a/Tiles/DraedonStructures/AgedLaboratoryServer.cs +++ b/Tiles/DraedonStructures/AgedLaboratoryServer.cs @@ -53,6 +53,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/DraedonStructures/AgedLaboratoryServerGlow").Value; diff --git a/Tiles/DraedonStructures/AgedReinforcedCrate.cs b/Tiles/DraedonStructures/AgedReinforcedCrate.cs index 826777407f..09b2154712 100644 --- a/Tiles/DraedonStructures/AgedReinforcedCrate.cs +++ b/Tiles/DraedonStructures/AgedReinforcedCrate.cs @@ -42,6 +42,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/DraedonStructures/AgedReinforcedCrateGlow").Value; diff --git a/Tiles/DraedonStructures/ChargingStation.cs b/Tiles/DraedonStructures/ChargingStation.cs index 6de7c06905..f86bca3642 100644 --- a/Tiles/DraedonStructures/ChargingStation.cs +++ b/Tiles/DraedonStructures/ChargingStation.cs @@ -111,6 +111,9 @@ namespace CalamityMod.Tiles.DraedonStructures // Draws the charger's glowing light on top of it. public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + Tile t = Main.tile[i, j]; int xFrame = t.TileFrameX; int yFrame = t.TileFrameY; diff --git a/Tiles/DraedonStructures/DraedonLabTurret.cs b/Tiles/DraedonStructures/DraedonLabTurret.cs index cc879d63a3..f43c7b4568 100644 --- a/Tiles/DraedonStructures/DraedonLabTurret.cs +++ b/Tiles/DraedonStructures/DraedonLabTurret.cs @@ -77,7 +77,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile t = Main.tile[i, j]; - if (t.TileFrameX != 36 || t.TileFrameY != 0) + if (t.TileFrameX != 36 || t.TileFrameY != 0 || t.IsTileActuallyInvisible()) return; TEHostileLabTurret te = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); diff --git a/Tiles/DraedonStructures/HostileFireTurret .cs b/Tiles/DraedonStructures/HostileFireTurret .cs index e9fe453828..5a07e876a0 100644 --- a/Tiles/DraedonStructures/HostileFireTurret .cs +++ b/Tiles/DraedonStructures/HostileFireTurret .cs @@ -72,7 +72,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile t = Main.tile[i, j]; - if (t.TileFrameX != 36 || t.TileFrameY != 0) + if (t.TileFrameX != 36 || t.TileFrameY != 0 || t.IsTileActuallyInvisible()) return; TEHostileFireTurret te = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); diff --git a/Tiles/DraedonStructures/HostileIceTurret .cs b/Tiles/DraedonStructures/HostileIceTurret .cs index 2b1b476c2b..d5b2ed5af2 100644 --- a/Tiles/DraedonStructures/HostileIceTurret .cs +++ b/Tiles/DraedonStructures/HostileIceTurret .cs @@ -72,7 +72,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile t = Main.tile[i, j]; - if (t.TileFrameX != 36 || t.TileFrameY != 0) + if (t.TileFrameX != 36 || t.TileFrameY != 0 || t.IsTileActuallyInvisible()) return; TEHostileIceTurret te = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); diff --git a/Tiles/DraedonStructures/HostileLaserTurret .cs b/Tiles/DraedonStructures/HostileLaserTurret .cs index 149e0a7410..39765b670d 100644 --- a/Tiles/DraedonStructures/HostileLaserTurret .cs +++ b/Tiles/DraedonStructures/HostileLaserTurret .cs @@ -72,7 +72,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile t = Main.tile[i, j]; - if (t.TileFrameX != 36 || t.TileFrameY != 0) + if (t.TileFrameX != 36 || t.TileFrameY != 0 || t.IsTileActuallyInvisible()) return; TEHostileLaserTurret te = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); diff --git a/Tiles/DraedonStructures/HostileOnyxTurret.cs b/Tiles/DraedonStructures/HostileOnyxTurret.cs index 48773b95b1..0412860bb6 100644 --- a/Tiles/DraedonStructures/HostileOnyxTurret.cs +++ b/Tiles/DraedonStructures/HostileOnyxTurret.cs @@ -72,7 +72,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile t = Main.tile[i, j]; - if (t.TileFrameX != 36 || t.TileFrameY != 0) + if (t.TileFrameX != 36 || t.TileFrameY != 0 || t.IsTileActuallyInvisible()) return; TEHostileOnyxTurret te = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); diff --git a/Tiles/DraedonStructures/HostilePlagueTurret.cs b/Tiles/DraedonStructures/HostilePlagueTurret.cs index 50ac6e3aa3..68934114c7 100644 --- a/Tiles/DraedonStructures/HostilePlagueTurret.cs +++ b/Tiles/DraedonStructures/HostilePlagueTurret.cs @@ -72,7 +72,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile t = Main.tile[i, j]; - if (t.TileFrameX != 36 || t.TileFrameY != 0) + if (t.TileFrameX != 36 || t.TileFrameY != 0 || t.IsTileActuallyInvisible()) return; TEHostilePlagueTurret te = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); diff --git a/Tiles/DraedonStructures/HostileWaterTurret.cs b/Tiles/DraedonStructures/HostileWaterTurret.cs index 15231ede6f..0f47a29ea4 100644 --- a/Tiles/DraedonStructures/HostileWaterTurret.cs +++ b/Tiles/DraedonStructures/HostileWaterTurret.cs @@ -72,7 +72,7 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile t = Main.tile[i, j]; - if (t.TileFrameX != 36 || t.TileFrameY != 0) + if (t.TileFrameX != 36 || t.TileFrameY != 0 || t.IsTileActuallyInvisible()) return; TEHostileWaterTurret te = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); diff --git a/Tiles/DraedonStructures/LaboratoryConsole.cs b/Tiles/DraedonStructures/LaboratoryConsole.cs index 832e50ae21..c04d63edf0 100644 --- a/Tiles/DraedonStructures/LaboratoryConsole.cs +++ b/Tiles/DraedonStructures/LaboratoryConsole.cs @@ -53,6 +53,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/DraedonStructures/LaboratoryConsoleGlow").Value; diff --git a/Tiles/DraedonStructures/LaboratoryDisplay.cs b/Tiles/DraedonStructures/LaboratoryDisplay.cs index 4df308e759..cc2513cecc 100644 --- a/Tiles/DraedonStructures/LaboratoryDisplay.cs +++ b/Tiles/DraedonStructures/LaboratoryDisplay.cs @@ -56,6 +56,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/DraedonStructures/LaboratoryDisplayGlow").Value; diff --git a/Tiles/DraedonStructures/LaboratoryScreen.cs b/Tiles/DraedonStructures/LaboratoryScreen.cs index 2867c26119..2672f89918 100644 --- a/Tiles/DraedonStructures/LaboratoryScreen.cs +++ b/Tiles/DraedonStructures/LaboratoryScreen.cs @@ -36,6 +36,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/DraedonStructures/LaboratoryScreenGlow").Value; diff --git a/Tiles/DraedonStructures/LaboratoryServer.cs b/Tiles/DraedonStructures/LaboratoryServer.cs index d10bd2a433..0d658c83fb 100644 --- a/Tiles/DraedonStructures/LaboratoryServer.cs +++ b/Tiles/DraedonStructures/LaboratoryServer.cs @@ -53,6 +53,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/DraedonStructures/LaboratoryServerGlow").Value; diff --git a/Tiles/DraedonStructures/LaboratoryTerminal.cs b/Tiles/DraedonStructures/LaboratoryTerminal.cs index 94ff84121a..cd75e06802 100644 --- a/Tiles/DraedonStructures/LaboratoryTerminal.cs +++ b/Tiles/DraedonStructures/LaboratoryTerminal.cs @@ -56,6 +56,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/DraedonStructures/LaboratoryTerminalGlow").Value; diff --git a/Tiles/DraedonStructures/ReinforcedCrate.cs b/Tiles/DraedonStructures/ReinforcedCrate.cs index 06b9c32ffe..dfe34a429e 100644 --- a/Tiles/DraedonStructures/ReinforcedCrate.cs +++ b/Tiles/DraedonStructures/ReinforcedCrate.cs @@ -42,6 +42,9 @@ namespace CalamityMod.Tiles.DraedonStructures public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/DraedonStructures/ReinforcedCrateGlow").Value; diff --git a/Tiles/Furniture/CraftingStations/MonolithAmalgam.cs b/Tiles/Furniture/CraftingStations/MonolithAmalgam.cs index 5bdeda2d2b..8d19243ab9 100644 --- a/Tiles/Furniture/CraftingStations/MonolithAmalgam.cs +++ b/Tiles/Furniture/CraftingStations/MonolithAmalgam.cs @@ -28,6 +28,9 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/Furniture/CraftingStations/MonolithAmalgamGlow").Value; diff --git a/Tiles/Furniture/CraftingStations/WulfrumLabstation.cs b/Tiles/Furniture/CraftingStations/WulfrumLabstation.cs index e673581d99..8b1cfe6971 100644 --- a/Tiles/Furniture/CraftingStations/WulfrumLabstation.cs +++ b/Tiles/Furniture/CraftingStations/WulfrumLabstation.cs @@ -33,6 +33,9 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/Furniture/CraftingStations/WulfrumLabstationGlow").Value; diff --git a/Tiles/FurnitureAshen/AshenMonolith.cs b/Tiles/FurnitureAshen/AshenMonolith.cs index 6e0d5e1ca3..d1dbbae53f 100644 --- a/Tiles/FurnitureAshen/AshenMonolith.cs +++ b/Tiles/FurnitureAshen/AshenMonolith.cs @@ -53,6 +53,9 @@ namespace CalamityMod.Tiles.FurnitureAshen { //This is used to draw the eye, where the frame is changed depending on the player's position relative to the eye's centre. Tile currentTile = Main.tile[i, j]; + if (currentTile.IsTileActuallyInvisible()) + return; + Vector2 eyeCentre = new Vector2(i * 16, j * 16); if (currentTile.TileFrameX == 0) { eyeCentre += new Vector2(16f, 0f); } diff --git a/Tiles/FurnitureAuric/AuricAbsorberTile.cs b/Tiles/FurnitureAuric/AuricAbsorberTile.cs index 133cbee19f..35db8b1f40 100644 --- a/Tiles/FurnitureAuric/AuricAbsorberTile.cs +++ b/Tiles/FurnitureAuric/AuricAbsorberTile.cs @@ -24,6 +24,8 @@ namespace CalamityMod.Tiles.FurnitureAuric public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { var tileCache = Main.tile[i, j]; + if (tileCache.IsTileActuallyInvisible()) + return; TileFramingSystem.SlopedGlowmask(in tileCache, i, j, TextureAssets.Tile[Type].Value, null, CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, Color.White), default); } diff --git a/Tiles/FurnitureAuric/AuricConsoleTile.cs b/Tiles/FurnitureAuric/AuricConsoleTile.cs index e991ae4be9..c63214c960 100644 --- a/Tiles/FurnitureAuric/AuricConsoleTile.cs +++ b/Tiles/FurnitureAuric/AuricConsoleTile.cs @@ -50,6 +50,9 @@ namespace CalamityMod.Tiles.FurnitureAuric public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAuric/AuricConsoleTile_Glow").Value; diff --git a/Tiles/FurnitureAuric/AuricDisplayTile.cs b/Tiles/FurnitureAuric/AuricDisplayTile.cs index 857f4a8a8c..3bee285bc0 100644 --- a/Tiles/FurnitureAuric/AuricDisplayTile.cs +++ b/Tiles/FurnitureAuric/AuricDisplayTile.cs @@ -54,6 +54,9 @@ namespace CalamityMod.Tiles.FurnitureAuric public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAuric/AuricDisplayTile_Glow").Value; diff --git a/Tiles/FurnitureAuric/AuricPlatformTile.cs b/Tiles/FurnitureAuric/AuricPlatformTile.cs index 8e47dbe7b8..6374210994 100644 --- a/Tiles/FurnitureAuric/AuricPlatformTile.cs +++ b/Tiles/FurnitureAuric/AuricPlatformTile.cs @@ -45,6 +45,8 @@ namespace CalamityMod.Tiles.FurnitureAuric return; Tile tile = CalamityUtils.ParanoidTileRetrieval(i, j); + if (tile.IsTileActuallyInvisible()) + return; int xPos = tile.TileFrameX; int yPos = tile.TileFrameY; Vector2 drawOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); diff --git a/Tiles/FurnitureAuric/AuricReinforcedCrateTile.cs b/Tiles/FurnitureAuric/AuricReinforcedCrateTile.cs index 6fcdd98125..b12a59811b 100644 --- a/Tiles/FurnitureAuric/AuricReinforcedCrateTile.cs +++ b/Tiles/FurnitureAuric/AuricReinforcedCrateTile.cs @@ -39,6 +39,9 @@ namespace CalamityMod.Tiles.FurnitureAuric public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAuric/AuricReinforcedCrateTile_Glow").Value; diff --git a/Tiles/FurnitureAuric/AuricScreenTile.cs b/Tiles/FurnitureAuric/AuricScreenTile.cs index 612876ee9e..57d785b261 100644 --- a/Tiles/FurnitureAuric/AuricScreenTile.cs +++ b/Tiles/FurnitureAuric/AuricScreenTile.cs @@ -34,6 +34,9 @@ namespace CalamityMod.Tiles.FurnitureAuric public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAuric/AuricScreenTile_Glow").Value; diff --git a/Tiles/FurnitureAuric/AuricServerTile.cs b/Tiles/FurnitureAuric/AuricServerTile.cs index 1574f7ed8c..859f124c91 100644 --- a/Tiles/FurnitureAuric/AuricServerTile.cs +++ b/Tiles/FurnitureAuric/AuricServerTile.cs @@ -53,6 +53,9 @@ namespace CalamityMod.Tiles.FurnitureAuric public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAuric/AuricServerTile_Glow").Value; diff --git a/Tiles/FurnitureAuric/AuricTerminalTile.cs b/Tiles/FurnitureAuric/AuricTerminalTile.cs index 081c67e195..b4870a0fe5 100644 --- a/Tiles/FurnitureAuric/AuricTerminalTile.cs +++ b/Tiles/FurnitureAuric/AuricTerminalTile.cs @@ -54,6 +54,9 @@ namespace CalamityMod.Tiles.FurnitureAuric public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureAuric/AuricTerminalTile_Glow").Value; diff --git a/Utilities/TileUtils.cs b/Utilities/TileUtils.cs index 14cbf48b07..e358ebf68a 100644 --- a/Utilities/TileUtils.cs +++ b/Utilities/TileUtils.cs @@ -137,6 +137,9 @@ namespace CalamityMod public static void DrawStaticFlameEffect(Texture2D flameTexture, int i, int j, int offsetX = 0, int offsetY = 0) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Color drawColour = new Color(100, 100, 100, 0); From 8c89b795d7b352d311486d8f516d93f5f7ea2e80 Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Mon, 11 Nov 2024 23:20:49 +0700 Subject: [PATCH 022/118] Fixed Exo and Monolith Chest glowmasks not following chest frames more echo fixes again --- Tiles/FurnitureExo/ExoBathtubTile.cs | 3 +++ Tiles/FurnitureExo/ExoBedTile.cs | 3 +++ Tiles/FurnitureExo/ExoBookcaseTile.cs | 3 +++ Tiles/FurnitureExo/ExoChairTile.cs | 3 +++ Tiles/FurnitureExo/ExoChestGlow.png | Bin 1540 -> 963 bytes Tiles/FurnitureExo/ExoChestTile.cs | 15 ++++++++++--- Tiles/FurnitureExo/ExoClockTile.cs | 3 +++ Tiles/FurnitureExo/ExoConsoleTile.cs | 3 +++ Tiles/FurnitureExo/ExoDisplayTile.cs | 3 +++ Tiles/FurnitureExo/ExoDresserTile.cs | 3 +++ Tiles/FurnitureExo/ExoKeyboardTile.cs | 3 +++ Tiles/FurnitureExo/ExoPrismPlatformTile.cs | 3 +++ Tiles/FurnitureExo/ExoScreenTile.cs | 3 +++ Tiles/FurnitureExo/ExoServerTile.cs | 3 +++ Tiles/FurnitureExo/ExoSinkTile.cs | 3 +++ Tiles/FurnitureExo/ExoSofaTile.cs | 3 +++ Tiles/FurnitureExo/ExoTableTile.cs | 3 +++ Tiles/FurnitureExo/ExoTerminalTile.cs | 3 +++ Tiles/FurnitureExo/ExoToiletTile.cs | 3 +++ Tiles/FurnitureExo/ExoWorkBenchTile.cs | 3 +++ Tiles/FurnitureMonolith/MonolithCandle.cs | 3 +++ Tiles/FurnitureMonolith/MonolithChair.cs | 3 +++ Tiles/FurnitureMonolith/MonolithChandelier.cs | 3 +++ Tiles/FurnitureMonolith/MonolithChest.cs | 20 +++++++++++++----- Tiles/FurnitureMonolith/MonolithClock.cs | 3 +++ Tiles/FurnitureMonolith/MonolithDoorClosed.cs | 3 +++ Tiles/FurnitureMonolith/MonolithDoorOpen.cs | 3 +++ Tiles/FurnitureMonolith/MonolithDresser.cs | 3 +++ Tiles/FurnitureMonolith/MonolithLamp.cs | 3 +++ Tiles/FurnitureMonolith/MonolithLantern.cs | 3 +++ Tiles/FurnitureMonolith/MonolithPiano.cs | 3 +++ Tiles/FurnitureMonolith/MonolithSink.cs | 3 +++ Tiles/FurnitureMonolith/MonolithTable.cs | 3 +++ Tiles/FurnitureMonolith/MonolithWorkbench.cs | 3 +++ .../MonolithOfTheAccursedTile.cs | 2 +- .../SacrilegiousChestTile.cs | 2 ++ .../SacrilegiousClockTile.cs | 2 ++ Tiles/FurnitureStratus/StratusPlatform.cs | 3 +++ Tiles/FurnitureStratus/StratusStarPlatform.cs | 3 +++ Tiles/FurnitureWulfrum/WulfrumBathtub.cs | 3 +++ Tiles/FurnitureWulfrum/WulfrumBed.cs | 3 +++ Tiles/FurnitureWulfrum/WulfrumBookcase.cs | 3 +++ Tiles/FurnitureWulfrum/WulfrumChair.cs | 3 +++ Tiles/FurnitureWulfrum/WulfrumClock.cs | 3 +++ Tiles/FurnitureWulfrum/WulfrumDresser.cs | 3 +++ Tiles/FurnitureWulfrum/WulfrumPiano.cs | 3 +++ Tiles/FurnitureWulfrum/WulfrumSink.cs | 3 +++ Tiles/FurnitureWulfrum/WulfrumSofa.cs | 3 +++ Tiles/FurnitureWulfrum/WulfrumTable.cs | 3 +++ Tiles/FurnitureWulfrum/WulfrumToilet.cs | 3 +++ .../FurnitureWulfrum/WulfrumWorkBenchTile.cs | 3 +++ 51 files changed, 167 insertions(+), 9 deletions(-) diff --git a/Tiles/FurnitureExo/ExoBathtubTile.cs b/Tiles/FurnitureExo/ExoBathtubTile.cs index 4253625413..bc6774561f 100644 --- a/Tiles/FurnitureExo/ExoBathtubTile.cs +++ b/Tiles/FurnitureExo/ExoBathtubTile.cs @@ -26,6 +26,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoBathtubGlow").Value; diff --git a/Tiles/FurnitureExo/ExoBedTile.cs b/Tiles/FurnitureExo/ExoBedTile.cs index 59f35b3e58..5eac86fb0d 100644 --- a/Tiles/FurnitureExo/ExoBedTile.cs +++ b/Tiles/FurnitureExo/ExoBedTile.cs @@ -33,6 +33,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoBedGlow").Value; diff --git a/Tiles/FurnitureExo/ExoBookcaseTile.cs b/Tiles/FurnitureExo/ExoBookcaseTile.cs index a5bb51442c..ad3ea4978f 100644 --- a/Tiles/FurnitureExo/ExoBookcaseTile.cs +++ b/Tiles/FurnitureExo/ExoBookcaseTile.cs @@ -26,6 +26,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoBookcaseGlow").Value; diff --git a/Tiles/FurnitureExo/ExoChairTile.cs b/Tiles/FurnitureExo/ExoChairTile.cs index e263dcb120..d04b7a3554 100644 --- a/Tiles/FurnitureExo/ExoChairTile.cs +++ b/Tiles/FurnitureExo/ExoChairTile.cs @@ -61,6 +61,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoChairGlow").Value; diff --git a/Tiles/FurnitureExo/ExoChestGlow.png b/Tiles/FurnitureExo/ExoChestGlow.png index afd5dcd8d6a2cfa8f44b0cf3722c6229736ec82c..a4ffe528e6a340bc8e76823092fc47ea3aad3ece 100644 GIT binary patch delta 954 zcmV;r14aCV48sSI7k_XF1^@s6b|2Dt000AuNklG_p1LE4+KA346dvt$WzV3gNtNZKj!(V)&9{!(q`r)6lcq;7U zrogB$)D={}U7yMKqm`IJZ>$xz*wX>~G4vXCZ{;%BY%Kuma5yokL?VvFzmbM=f`mfql_26JLw_I8MpZeh+*5aAQJ+d)KqFPAtpo-pyHfEOo$>t#W{zV z5JiBBa}HTXXq)dazQb;ZYC&0UQv;jD(_S*$1noTI28rv3Iw4+sa&Ib}fl21>u7JPq z$}L=XuYcn+{NkHk?oW{;2`MMYY(};%nKFVz(Lt`DrJ6%>1x-{%Qr>0C38Hp`RdI5c zSvByOmrPVy53DXlpNctd*yC+s*cR_B*y*d*!^$K+Eb?!+s z{Gv)L3o{T>PS99OdU^A*F**5N*86@C{*2ccGk+#1(@9L`5DStBsQ(<|CF3PaF$XxQ zDPT;92~h;7IOh-(q6koN&LJj55uoB}=a4w-A)oyaZE9e%_&+G9$EBZ~%8w@Zxq=qe^tw?_@Gk6|g5|I)TWWL|!{;9_A1pvqer}BrQcjS(mUgx2=TL@~ zrG0EruJD^x?5Ub1xyz^Z!n{hj}Op*`~Uy|07*qoM6N<$f>3?H#Q*>R delta 1535 zcmVPx)q)9|URA_ z)fory-%SgY3Vp$q^4hKwg)v%OheM2j$xs3cdozo$nZ-0Q!v*7HTW}^D*#{slZYE^z z(_%IaFta5J(aDqr>1+oQ5a>`4*HPXIb!$tN^48w_aQaklUVqy!+k@W!FHf&?u5;bj z`9Ifv`dt4UQlvS}QG#kv?qJ}@ z4lu2wHW6p~mMvFIXh7d{|KA|D4?c0vX9R-|42|LDEsMd4CwKX{-M09>g#U%>uZC-q zp~TJxR$mwK5q}c}caPI!C+2Ow^!lqI>lo_I{?7ZBgR?DX!azwL=<0E~zoG@)H0V?! zz|p({F#7b##Q6TR`QX{c5|EQArIyoRP|0BM>bm8Lby>$yZw*bUngn+3-W$UQd&7&v*6#e$A3hSJESm%Gk z+qf?(NR00rP}rw<^}C-;*jdL=iWDhQq)3q>#it$p>bqgl{AGReTeD$Rzmp*ge=%N` zp_(VE6Lx7!=*P-WRe{%=j>qto@gpMGbl^k`vwzA;BRH798yqj$m5B4(AMdzgLRrU9 zzZJC89}b9N#oS7;W@qTxGxm$y-VgrypAZG@qO3FhS$+)KF*f$Ot+|k4)%8u2M@`$53y!Cm)#$Rtrj6_lQy8y`0dqPaYOD$I61B z9hMCV8sW%srJ(sxV5+GzXq0tFPJq9+b%u54LM;`a4;teVdqKfde@-Nnbqw{^P)03X zQV}%9A68BV4~z;Y_Rn749PCMh!0=hK!GE9D{w;!UE}Rj=h}T~MEB|>8;z1 z4+dtcrUylCcYS#4CLV8&V9w4-F?^>-_r4HW$56i&w4%b~9*T={Kx%h7KIZRHof)hEBl{_%XjlOYR#FI7{@l=qjky)9oZ6a<`}uuWOz0Y7=p!T)u!`o^7?w5!1~)t!diJFa zqrvGP>W?0ryo01#Q%= z6C-#nH_Yd}u?Upa?gve8d>u5_*2XY9e_8~k+un&`-HxE3)fBy%d0u$n1%DSmvzMXz z?WHk%{}+3}FIR<~bkx*37b0^qX z)T15T6;zL3|ETiXxM9_s-BXLc1`5uc2d7Fa!0^GLhK`Ra2ZiH;&fJz8$Sp1jidt*S zSx|I7tZzRQbnee}90Dz!p?HRdwKRfb=K>dxta%}kP}VWjTSI?nxFPdr_-^0Lu-Dx4 zT{kCA-i&_j?c|Ak2|c=JeQu9^;}uWttYaueiWDhQq)3tC(~kcFE$p{g2$so90000E lWmrjOO-%qQ00008000000002eQ("CalamityMod/Tiles/FurnitureExo/ExoChestGlow").Value; - Vector2 drawOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); - Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y + yOffset) + drawOffset; Color drawColour = Color.White; - Main.spriteBatch.Draw(glowmask, drawPosition, new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16), drawColour, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y + yOffset) + (Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange)); + Rectangle frame = new Rectangle(xPos, yPos + Main.chest[chestIndex].frame * 38, 18, 18); + Main.spriteBatch.Draw(glowmask, drawPosition, frame, drawColour, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); } } } diff --git a/Tiles/FurnitureExo/ExoClockTile.cs b/Tiles/FurnitureExo/ExoClockTile.cs index f060ed0f9e..aa0b55400a 100644 --- a/Tiles/FurnitureExo/ExoClockTile.cs +++ b/Tiles/FurnitureExo/ExoClockTile.cs @@ -41,6 +41,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoClockGlow").Value; diff --git a/Tiles/FurnitureExo/ExoConsoleTile.cs b/Tiles/FurnitureExo/ExoConsoleTile.cs index bc17227112..b0ee83fc8f 100644 --- a/Tiles/FurnitureExo/ExoConsoleTile.cs +++ b/Tiles/FurnitureExo/ExoConsoleTile.cs @@ -53,6 +53,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoConsoleGlow").Value; diff --git a/Tiles/FurnitureExo/ExoDisplayTile.cs b/Tiles/FurnitureExo/ExoDisplayTile.cs index 0e34ea42af..864d84c0dd 100644 --- a/Tiles/FurnitureExo/ExoDisplayTile.cs +++ b/Tiles/FurnitureExo/ExoDisplayTile.cs @@ -56,6 +56,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoDisplayGlow").Value; diff --git a/Tiles/FurnitureExo/ExoDresserTile.cs b/Tiles/FurnitureExo/ExoDresserTile.cs index 17bd4a2633..2b0807917f 100644 --- a/Tiles/FurnitureExo/ExoDresserTile.cs +++ b/Tiles/FurnitureExo/ExoDresserTile.cs @@ -34,6 +34,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoDresserGlow").Value; diff --git a/Tiles/FurnitureExo/ExoKeyboardTile.cs b/Tiles/FurnitureExo/ExoKeyboardTile.cs index a58cffd87d..b54456e596 100644 --- a/Tiles/FurnitureExo/ExoKeyboardTile.cs +++ b/Tiles/FurnitureExo/ExoKeyboardTile.cs @@ -26,6 +26,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoKeyboardGlow").Value; diff --git a/Tiles/FurnitureExo/ExoPrismPlatformTile.cs b/Tiles/FurnitureExo/ExoPrismPlatformTile.cs index b3bbe480e9..aee4df9a8e 100644 --- a/Tiles/FurnitureExo/ExoPrismPlatformTile.cs +++ b/Tiles/FurnitureExo/ExoPrismPlatformTile.cs @@ -54,6 +54,9 @@ namespace CalamityMod.Tiles.FurnitureExo return; Tile tile = CalamityUtils.ParanoidTileRetrieval(i, j); + if (tile.IsTileActuallyInvisible()) + return; + int xPos = tile.TileFrameX; int frameOffset = (i + j) % 6 * AnimationFrameHeight; int yPos = tile.TileFrameY + frameOffset; diff --git a/Tiles/FurnitureExo/ExoScreenTile.cs b/Tiles/FurnitureExo/ExoScreenTile.cs index 0293c537a7..21b0def587 100644 --- a/Tiles/FurnitureExo/ExoScreenTile.cs +++ b/Tiles/FurnitureExo/ExoScreenTile.cs @@ -56,6 +56,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Main.tile[i, j]; + if (tile.IsTileActuallyInvisible()) + return; + int yOffset = TileObjectData.GetTileData(tile).DrawYOffset; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoScreenGlow").Value; Vector2 drawOffset = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); diff --git a/Tiles/FurnitureExo/ExoServerTile.cs b/Tiles/FurnitureExo/ExoServerTile.cs index 45c3fb4f38..cdc835ff58 100644 --- a/Tiles/FurnitureExo/ExoServerTile.cs +++ b/Tiles/FurnitureExo/ExoServerTile.cs @@ -53,6 +53,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoServerGlow").Value; diff --git a/Tiles/FurnitureExo/ExoSinkTile.cs b/Tiles/FurnitureExo/ExoSinkTile.cs index f20935c0a2..9e6d293bf6 100644 --- a/Tiles/FurnitureExo/ExoSinkTile.cs +++ b/Tiles/FurnitureExo/ExoSinkTile.cs @@ -26,6 +26,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoSinkGlow").Value; diff --git a/Tiles/FurnitureExo/ExoSofaTile.cs b/Tiles/FurnitureExo/ExoSofaTile.cs index 5236a75055..a89b2721e2 100644 --- a/Tiles/FurnitureExo/ExoSofaTile.cs +++ b/Tiles/FurnitureExo/ExoSofaTile.cs @@ -40,6 +40,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoSofaGlow").Value; diff --git a/Tiles/FurnitureExo/ExoTableTile.cs b/Tiles/FurnitureExo/ExoTableTile.cs index 4b2240b6fe..922949b560 100644 --- a/Tiles/FurnitureExo/ExoTableTile.cs +++ b/Tiles/FurnitureExo/ExoTableTile.cs @@ -26,6 +26,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoTableGlow").Value; diff --git a/Tiles/FurnitureExo/ExoTerminalTile.cs b/Tiles/FurnitureExo/ExoTerminalTile.cs index fa0aa1edd5..d180bf0769 100644 --- a/Tiles/FurnitureExo/ExoTerminalTile.cs +++ b/Tiles/FurnitureExo/ExoTerminalTile.cs @@ -56,6 +56,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoTerminalGlow").Value; diff --git a/Tiles/FurnitureExo/ExoToiletTile.cs b/Tiles/FurnitureExo/ExoToiletTile.cs index 2dd9722b43..253033f2ca 100644 --- a/Tiles/FurnitureExo/ExoToiletTile.cs +++ b/Tiles/FurnitureExo/ExoToiletTile.cs @@ -62,6 +62,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoToiletGlow").Value; diff --git a/Tiles/FurnitureExo/ExoWorkBenchTile.cs b/Tiles/FurnitureExo/ExoWorkBenchTile.cs index 9347c89993..1696283777 100644 --- a/Tiles/FurnitureExo/ExoWorkBenchTile.cs +++ b/Tiles/FurnitureExo/ExoWorkBenchTile.cs @@ -33,6 +33,9 @@ namespace CalamityMod.Tiles.FurnitureExo public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request(Texture + "Glow").Value; diff --git a/Tiles/FurnitureMonolith/MonolithCandle.cs b/Tiles/FurnitureMonolith/MonolithCandle.cs index bfff448231..de740ac133 100644 --- a/Tiles/FurnitureMonolith/MonolithCandle.cs +++ b/Tiles/FurnitureMonolith/MonolithCandle.cs @@ -23,6 +23,9 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithCandleGlow").Value; diff --git a/Tiles/FurnitureMonolith/MonolithChair.cs b/Tiles/FurnitureMonolith/MonolithChair.cs index ac8524312b..db53d4f6a4 100644 --- a/Tiles/FurnitureMonolith/MonolithChair.cs +++ b/Tiles/FurnitureMonolith/MonolithChair.cs @@ -26,6 +26,9 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithChairGlow").Value; diff --git a/Tiles/FurnitureMonolith/MonolithChandelier.cs b/Tiles/FurnitureMonolith/MonolithChandelier.cs index b6776a0b44..b0ffa854c5 100644 --- a/Tiles/FurnitureMonolith/MonolithChandelier.cs +++ b/Tiles/FurnitureMonolith/MonolithChandelier.cs @@ -23,6 +23,9 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithChandelierGlow").Value; diff --git a/Tiles/FurnitureMonolith/MonolithChest.cs b/Tiles/FurnitureMonolith/MonolithChest.cs index 47cba4785d..1f294cf3d9 100644 --- a/Tiles/FurnitureMonolith/MonolithChest.cs +++ b/Tiles/FurnitureMonolith/MonolithChest.cs @@ -7,6 +7,7 @@ using Terraria.GameContent.ObjectInteractions; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureMonolith { @@ -63,13 +64,22 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - int xPos = Main.tile[i, j].TileFrameX; - int yPos = Main.tile[i, j].TileFrameY; + Tile tile = Main.tile[i, j]; + if (tile.IsTileActuallyInvisible()) + return; + + int xPos = tile.TileFrameX; + int yPos = tile.TileFrameY; + int chestIndex = Chest.FindChest(i - (xPos / 18), j - (yPos / 18)); + if (chestIndex == -1) + return; + + int yOffset = TileObjectData.GetTileData(tile).DrawYOffset; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithChestGlow").Value; Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); - Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y + yOffset) + (Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange)); + Rectangle frame = new Rectangle(xPos, yPos + Main.chest[chestIndex].frame * 38, 18, 18); + Main.spriteBatch.Draw(glowmask, drawOffset, frame, drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } } diff --git a/Tiles/FurnitureMonolith/MonolithClock.cs b/Tiles/FurnitureMonolith/MonolithClock.cs index 7cc3d76d67..6dae46ac7d 100644 --- a/Tiles/FurnitureMonolith/MonolithClock.cs +++ b/Tiles/FurnitureMonolith/MonolithClock.cs @@ -26,6 +26,9 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithClockGlow").Value; diff --git a/Tiles/FurnitureMonolith/MonolithDoorClosed.cs b/Tiles/FurnitureMonolith/MonolithDoorClosed.cs index 9190b4cc09..52b85d4d81 100644 --- a/Tiles/FurnitureMonolith/MonolithDoorClosed.cs +++ b/Tiles/FurnitureMonolith/MonolithDoorClosed.cs @@ -29,6 +29,9 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithDoorClosedGlow").Value; diff --git a/Tiles/FurnitureMonolith/MonolithDoorOpen.cs b/Tiles/FurnitureMonolith/MonolithDoorOpen.cs index a229126bb3..782985f901 100644 --- a/Tiles/FurnitureMonolith/MonolithDoorOpen.cs +++ b/Tiles/FurnitureMonolith/MonolithDoorOpen.cs @@ -30,6 +30,9 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithDoorOpenGlow").Value; diff --git a/Tiles/FurnitureMonolith/MonolithDresser.cs b/Tiles/FurnitureMonolith/MonolithDresser.cs index 7449085189..fb8af48ee6 100644 --- a/Tiles/FurnitureMonolith/MonolithDresser.cs +++ b/Tiles/FurnitureMonolith/MonolithDresser.cs @@ -32,6 +32,9 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithDresserGlow").Value; diff --git a/Tiles/FurnitureMonolith/MonolithLamp.cs b/Tiles/FurnitureMonolith/MonolithLamp.cs index c169899dab..eb49dc8399 100644 --- a/Tiles/FurnitureMonolith/MonolithLamp.cs +++ b/Tiles/FurnitureMonolith/MonolithLamp.cs @@ -23,6 +23,9 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithLampGlow").Value; diff --git a/Tiles/FurnitureMonolith/MonolithLantern.cs b/Tiles/FurnitureMonolith/MonolithLantern.cs index e03c7077b2..c77208df7e 100644 --- a/Tiles/FurnitureMonolith/MonolithLantern.cs +++ b/Tiles/FurnitureMonolith/MonolithLantern.cs @@ -24,6 +24,9 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithLanternGlow").Value; diff --git a/Tiles/FurnitureMonolith/MonolithPiano.cs b/Tiles/FurnitureMonolith/MonolithPiano.cs index 14385c7fb0..707a910882 100644 --- a/Tiles/FurnitureMonolith/MonolithPiano.cs +++ b/Tiles/FurnitureMonolith/MonolithPiano.cs @@ -25,6 +25,9 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithPianoGlow").Value; diff --git a/Tiles/FurnitureMonolith/MonolithSink.cs b/Tiles/FurnitureMonolith/MonolithSink.cs index 3009c01574..3af8655a3e 100644 --- a/Tiles/FurnitureMonolith/MonolithSink.cs +++ b/Tiles/FurnitureMonolith/MonolithSink.cs @@ -23,6 +23,9 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithSinkGlow").Value; diff --git a/Tiles/FurnitureMonolith/MonolithTable.cs b/Tiles/FurnitureMonolith/MonolithTable.cs index 6a3a0d4c69..183aa97e60 100644 --- a/Tiles/FurnitureMonolith/MonolithTable.cs +++ b/Tiles/FurnitureMonolith/MonolithTable.cs @@ -23,6 +23,9 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithTableGlow").Value; diff --git a/Tiles/FurnitureMonolith/MonolithWorkbench.cs b/Tiles/FurnitureMonolith/MonolithWorkbench.cs index cd69fd30d2..4e27709e66 100644 --- a/Tiles/FurnitureMonolith/MonolithWorkbench.cs +++ b/Tiles/FurnitureMonolith/MonolithWorkbench.cs @@ -23,6 +23,9 @@ namespace CalamityMod.Tiles.FurnitureMonolith public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithWorkBenchGlow").Value; diff --git a/Tiles/FurnitureSacrilegious/MonolithOfTheAccursedTile.cs b/Tiles/FurnitureSacrilegious/MonolithOfTheAccursedTile.cs index dd0865adf2..84314f6124 100644 --- a/Tiles/FurnitureSacrilegious/MonolithOfTheAccursedTile.cs +++ b/Tiles/FurnitureSacrilegious/MonolithOfTheAccursedTile.cs @@ -139,7 +139,7 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious // For drawing the floating icon public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - if (Main.tile[i, j].TileFrameX < 36) + if (Main.tile[i, j].TileFrameX < 36 || Main.tile[i, j].IsTileActuallyInvisible()) return; Texture2D texture = ModContent.Request("CalamityMod/Tiles/FurnitureSacrilegious/MonolithOfTheAccursedTile_IconRight").Value; diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousChestTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousChestTile.cs index ec62598f02..6623d83277 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousChestTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousChestTile.cs @@ -42,6 +42,8 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious itemAmt = CountItems(Main.chest[index]); Tile tile = Main.tile[i, j]; + if (tile.IsTileActuallyInvisible()) + return; Texture2D texture = ModContent.Request("CalamityMod/Tiles/FurnitureSacrilegious/SacrilegiousChestTileGlow").Value; int x = i; diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousClockTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousClockTile.cs index 94b8795431..baf4ba6e2e 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousClockTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousClockTile.cs @@ -58,6 +58,8 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious { Texture2D texture = ModContent.Request("CalamityMod/Tiles/FurnitureSacrilegious/SacrilegiousClockTile_Icon").Value; Tile tile = Main.tile[i, j]; + if (tile.IsTileActuallyInvisible()) + return; int xPos = tile.TileFrameX; int yPos = tile.TileFrameY; diff --git a/Tiles/FurnitureStratus/StratusPlatform.cs b/Tiles/FurnitureStratus/StratusPlatform.cs index 30d7e3c11e..fbe4bab57c 100644 --- a/Tiles/FurnitureStratus/StratusPlatform.cs +++ b/Tiles/FurnitureStratus/StratusPlatform.cs @@ -24,6 +24,9 @@ namespace CalamityMod.Tiles.FurnitureStratus public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureStratus/StratusPlatformGlow").Value; diff --git a/Tiles/FurnitureStratus/StratusStarPlatform.cs b/Tiles/FurnitureStratus/StratusStarPlatform.cs index ba79bc569f..ff5228198c 100644 --- a/Tiles/FurnitureStratus/StratusStarPlatform.cs +++ b/Tiles/FurnitureStratus/StratusStarPlatform.cs @@ -25,6 +25,9 @@ namespace CalamityMod.Tiles.FurnitureStratus public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureStratus/StratusStarPlatformGlow").Value; diff --git a/Tiles/FurnitureWulfrum/WulfrumBathtub.cs b/Tiles/FurnitureWulfrum/WulfrumBathtub.cs index 269e53f673..b3c983a646 100644 --- a/Tiles/FurnitureWulfrum/WulfrumBathtub.cs +++ b/Tiles/FurnitureWulfrum/WulfrumBathtub.cs @@ -25,6 +25,9 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumBathtubGlow").Value; diff --git a/Tiles/FurnitureWulfrum/WulfrumBed.cs b/Tiles/FurnitureWulfrum/WulfrumBed.cs index 76db64317d..9c10c99de0 100644 --- a/Tiles/FurnitureWulfrum/WulfrumBed.cs +++ b/Tiles/FurnitureWulfrum/WulfrumBed.cs @@ -32,6 +32,9 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumBedGlow").Value; diff --git a/Tiles/FurnitureWulfrum/WulfrumBookcase.cs b/Tiles/FurnitureWulfrum/WulfrumBookcase.cs index 236092fa3f..e54e9c83a4 100644 --- a/Tiles/FurnitureWulfrum/WulfrumBookcase.cs +++ b/Tiles/FurnitureWulfrum/WulfrumBookcase.cs @@ -25,6 +25,9 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumBookcaseGlow").Value; diff --git a/Tiles/FurnitureWulfrum/WulfrumChair.cs b/Tiles/FurnitureWulfrum/WulfrumChair.cs index 7be469fa87..107952e5a7 100644 --- a/Tiles/FurnitureWulfrum/WulfrumChair.cs +++ b/Tiles/FurnitureWulfrum/WulfrumChair.cs @@ -60,6 +60,9 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumChairGlow").Value; diff --git a/Tiles/FurnitureWulfrum/WulfrumClock.cs b/Tiles/FurnitureWulfrum/WulfrumClock.cs index 208d0620c1..459a59ed7a 100644 --- a/Tiles/FurnitureWulfrum/WulfrumClock.cs +++ b/Tiles/FurnitureWulfrum/WulfrumClock.cs @@ -40,6 +40,9 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumClockGlow").Value; diff --git a/Tiles/FurnitureWulfrum/WulfrumDresser.cs b/Tiles/FurnitureWulfrum/WulfrumDresser.cs index 32f7df8139..813b797955 100644 --- a/Tiles/FurnitureWulfrum/WulfrumDresser.cs +++ b/Tiles/FurnitureWulfrum/WulfrumDresser.cs @@ -33,6 +33,9 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumDresserGlow").Value; diff --git a/Tiles/FurnitureWulfrum/WulfrumPiano.cs b/Tiles/FurnitureWulfrum/WulfrumPiano.cs index 0cc9b3b7aa..6c695135ba 100644 --- a/Tiles/FurnitureWulfrum/WulfrumPiano.cs +++ b/Tiles/FurnitureWulfrum/WulfrumPiano.cs @@ -23,6 +23,9 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumPianoGlow").Value; diff --git a/Tiles/FurnitureWulfrum/WulfrumSink.cs b/Tiles/FurnitureWulfrum/WulfrumSink.cs index fccf48585d..57bb0247c1 100644 --- a/Tiles/FurnitureWulfrum/WulfrumSink.cs +++ b/Tiles/FurnitureWulfrum/WulfrumSink.cs @@ -25,6 +25,9 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumSinkGlow").Value; diff --git a/Tiles/FurnitureWulfrum/WulfrumSofa.cs b/Tiles/FurnitureWulfrum/WulfrumSofa.cs index fd7f798acb..33bfbecd49 100644 --- a/Tiles/FurnitureWulfrum/WulfrumSofa.cs +++ b/Tiles/FurnitureWulfrum/WulfrumSofa.cs @@ -39,6 +39,9 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumSofaGlow").Value; diff --git a/Tiles/FurnitureWulfrum/WulfrumTable.cs b/Tiles/FurnitureWulfrum/WulfrumTable.cs index cf8885358f..a24280edb6 100644 --- a/Tiles/FurnitureWulfrum/WulfrumTable.cs +++ b/Tiles/FurnitureWulfrum/WulfrumTable.cs @@ -25,6 +25,9 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumTableGlow").Value; diff --git a/Tiles/FurnitureWulfrum/WulfrumToilet.cs b/Tiles/FurnitureWulfrum/WulfrumToilet.cs index f5a3836d52..81e68d00a2 100644 --- a/Tiles/FurnitureWulfrum/WulfrumToilet.cs +++ b/Tiles/FurnitureWulfrum/WulfrumToilet.cs @@ -61,6 +61,9 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumToiletGlow").Value; diff --git a/Tiles/FurnitureWulfrum/WulfrumWorkBenchTile.cs b/Tiles/FurnitureWulfrum/WulfrumWorkBenchTile.cs index 8a1c0f64e5..9d88b5b592 100644 --- a/Tiles/FurnitureWulfrum/WulfrumWorkBenchTile.cs +++ b/Tiles/FurnitureWulfrum/WulfrumWorkBenchTile.cs @@ -29,6 +29,9 @@ namespace CalamityMod.Tiles.FurnitureWulfrum public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + int xFrameOffset = Main.tile[i, j].TileFrameX; int yFrameOffset = Main.tile[i, j].TileFrameY; Texture2D glowmask = ModContent.Request(Texture + "Glow").Value; From 42d3366cd02fc98dd780d770efbef74f66af3fb8 Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Mon, 11 Nov 2024 23:30:43 +0700 Subject: [PATCH 023/118] the rest of the postdraws --- Tiles/Ores/AerialiteOre.cs | 3 +++ Tiles/PlayerTurrets/PlayerFireTurret .cs | 2 +- Tiles/PlayerTurrets/PlayerIceTurret .cs | 2 +- Tiles/PlayerTurrets/PlayerLabTurret.cs | 2 +- Tiles/PlayerTurrets/PlayerLaserTurret .cs | 2 +- Tiles/PlayerTurrets/PlayerOnyxTurret.cs | 2 +- Tiles/PlayerTurrets/PlayerPlagueTurret.cs | 2 +- Tiles/PlayerTurrets/PlayerWaterTurret.cs | 2 +- Tiles/Rubblemaker/Abyss/AbyssGiantKelp1Echo.cs | 6 ++++++ Tiles/Rubblemaker/Abyss/AbyssGiantKelp3Echo.cs | 3 +++ Tiles/Rubblemaker/Abyss/AbyssGiantKelp4Echo.cs | 3 +++ Tiles/Rubblemaker/Abyss/BulbTreeEcho.cs | 9 +++++++++ Tiles/Rubblemaker/Abyss/SpiderCoralEcho.cs | 15 +++++++++++++++ Tiles/Rubblemaker/Abyss/SulphurPireCoralEcho.cs | 9 +++++++++ 14 files changed, 55 insertions(+), 7 deletions(-) diff --git a/Tiles/Ores/AerialiteOre.cs b/Tiles/Ores/AerialiteOre.cs index eb926362b8..29a95d6be6 100644 --- a/Tiles/Ores/AerialiteOre.cs +++ b/Tiles/Ores/AerialiteOre.cs @@ -76,6 +76,9 @@ namespace CalamityMod.Tiles.Ores return; var tile = Main.tile[i, j]; + if (tile.IsTileActuallyInvisible()) + return; + int xPos = tile.TileFrameX; int yPos = tile.TileFrameY; int xOffset = animationFrameWidth * TileFramingSystem.GetVariation4x4_012_Low0(i, j); diff --git a/Tiles/PlayerTurrets/PlayerFireTurret .cs b/Tiles/PlayerTurrets/PlayerFireTurret .cs index 96f89dbf1e..06db0d1d71 100644 --- a/Tiles/PlayerTurrets/PlayerFireTurret .cs +++ b/Tiles/PlayerTurrets/PlayerFireTurret .cs @@ -70,7 +70,7 @@ namespace CalamityMod.Tiles.PlayerTurrets public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile t = Main.tile[i, j]; - if (t.TileFrameX != 36 || t.TileFrameY != 0) + if (t.TileFrameX != 36 || t.TileFrameY != 0 || t.IsTileActuallyInvisible()) return; TEPlayerFireTurret te = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); diff --git a/Tiles/PlayerTurrets/PlayerIceTurret .cs b/Tiles/PlayerTurrets/PlayerIceTurret .cs index f8923b34cb..07d2742c46 100644 --- a/Tiles/PlayerTurrets/PlayerIceTurret .cs +++ b/Tiles/PlayerTurrets/PlayerIceTurret .cs @@ -70,7 +70,7 @@ namespace CalamityMod.Tiles.PlayerTurrets public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile t = Main.tile[i, j]; - if (t.TileFrameX != 36 || t.TileFrameY != 0) + if (t.TileFrameX != 36 || t.TileFrameY != 0 || t.IsTileActuallyInvisible()) return; TEPlayerIceTurret te = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); diff --git a/Tiles/PlayerTurrets/PlayerLabTurret.cs b/Tiles/PlayerTurrets/PlayerLabTurret.cs index 3948900ebf..b2d28deb5b 100644 --- a/Tiles/PlayerTurrets/PlayerLabTurret.cs +++ b/Tiles/PlayerTurrets/PlayerLabTurret.cs @@ -70,7 +70,7 @@ namespace CalamityMod.Tiles.PlayerTurrets public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile t = Main.tile[i, j]; - if (t.TileFrameX != 36 || t.TileFrameY != 0) + if (t.TileFrameX != 36 || t.TileFrameY != 0 || t.IsTileActuallyInvisible()) return; TEPlayerLabTurret te = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); diff --git a/Tiles/PlayerTurrets/PlayerLaserTurret .cs b/Tiles/PlayerTurrets/PlayerLaserTurret .cs index 314a27c5e1..6c6421a2eb 100644 --- a/Tiles/PlayerTurrets/PlayerLaserTurret .cs +++ b/Tiles/PlayerTurrets/PlayerLaserTurret .cs @@ -70,7 +70,7 @@ namespace CalamityMod.Tiles.PlayerTurrets public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile t = Main.tile[i, j]; - if (t.TileFrameX != 36 || t.TileFrameY != 0) + if (t.TileFrameX != 36 || t.TileFrameY != 0 || t.IsTileActuallyInvisible()) return; TEPlayerLaserTurret te = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); diff --git a/Tiles/PlayerTurrets/PlayerOnyxTurret.cs b/Tiles/PlayerTurrets/PlayerOnyxTurret.cs index 80c5af3026..03a6c2cb93 100644 --- a/Tiles/PlayerTurrets/PlayerOnyxTurret.cs +++ b/Tiles/PlayerTurrets/PlayerOnyxTurret.cs @@ -70,7 +70,7 @@ namespace CalamityMod.Tiles.PlayerTurrets public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile t = Main.tile[i, j]; - if (t.TileFrameX != 36 || t.TileFrameY != 0) + if (t.TileFrameX != 36 || t.TileFrameY != 0 || t.IsTileActuallyInvisible()) return; TEPlayerOnyxTurret te = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); diff --git a/Tiles/PlayerTurrets/PlayerPlagueTurret.cs b/Tiles/PlayerTurrets/PlayerPlagueTurret.cs index 011130a5ea..0094c5557a 100644 --- a/Tiles/PlayerTurrets/PlayerPlagueTurret.cs +++ b/Tiles/PlayerTurrets/PlayerPlagueTurret.cs @@ -70,7 +70,7 @@ namespace CalamityMod.Tiles.PlayerTurrets public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile t = Main.tile[i, j]; - if (t.TileFrameX != 36 || t.TileFrameY != 0) + if (t.TileFrameX != 36 || t.TileFrameY != 0 || t.IsTileActuallyInvisible()) return; TEPlayerPlagueTurret te = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); diff --git a/Tiles/PlayerTurrets/PlayerWaterTurret.cs b/Tiles/PlayerTurrets/PlayerWaterTurret.cs index e9da005ea0..0c1c8cbfa1 100644 --- a/Tiles/PlayerTurrets/PlayerWaterTurret.cs +++ b/Tiles/PlayerTurrets/PlayerWaterTurret.cs @@ -70,7 +70,7 @@ namespace CalamityMod.Tiles.PlayerTurrets public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile t = Main.tile[i, j]; - if (t.TileFrameX != 36 || t.TileFrameY != 0) + if (t.TileFrameX != 36 || t.TileFrameY != 0 || t.IsTileActuallyInvisible()) return; TEPlayerWaterTurret te = CalamityUtils.FindTileEntity(i, j, Width, Height, SheetSquare); diff --git a/Tiles/Rubblemaker/Abyss/AbyssGiantKelp1Echo.cs b/Tiles/Rubblemaker/Abyss/AbyssGiantKelp1Echo.cs index fcf1baa9b1..4dc342e39b 100644 --- a/Tiles/Rubblemaker/Abyss/AbyssGiantKelp1Echo.cs +++ b/Tiles/Rubblemaker/Abyss/AbyssGiantKelp1Echo.cs @@ -70,6 +70,9 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp1Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); @@ -84,6 +87,9 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp2Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); diff --git a/Tiles/Rubblemaker/Abyss/AbyssGiantKelp3Echo.cs b/Tiles/Rubblemaker/Abyss/AbyssGiantKelp3Echo.cs index 9a4a19759d..fe0ed10bd6 100644 --- a/Tiles/Rubblemaker/Abyss/AbyssGiantKelp3Echo.cs +++ b/Tiles/Rubblemaker/Abyss/AbyssGiantKelp3Echo.cs @@ -70,6 +70,9 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp3Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); diff --git a/Tiles/Rubblemaker/Abyss/AbyssGiantKelp4Echo.cs b/Tiles/Rubblemaker/Abyss/AbyssGiantKelp4Echo.cs index c1229ed58c..685953dfa9 100644 --- a/Tiles/Rubblemaker/Abyss/AbyssGiantKelp4Echo.cs +++ b/Tiles/Rubblemaker/Abyss/AbyssGiantKelp4Echo.cs @@ -70,6 +70,9 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/AbyssGiantKelp4Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); diff --git a/Tiles/Rubblemaker/Abyss/BulbTreeEcho.cs b/Tiles/Rubblemaker/Abyss/BulbTreeEcho.cs index d08fbdacd0..c3f55cd174 100644 --- a/Tiles/Rubblemaker/Abyss/BulbTreeEcho.cs +++ b/Tiles/Rubblemaker/Abyss/BulbTreeEcho.cs @@ -54,6 +54,9 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/BulbTree1Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); @@ -67,6 +70,9 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/BulbTree2Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); @@ -80,6 +86,9 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/BulbTree3Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); diff --git a/Tiles/Rubblemaker/Abyss/SpiderCoralEcho.cs b/Tiles/Rubblemaker/Abyss/SpiderCoralEcho.cs index f463aa1ff8..d4d7463c16 100644 --- a/Tiles/Rubblemaker/Abyss/SpiderCoralEcho.cs +++ b/Tiles/Rubblemaker/Abyss/SpiderCoralEcho.cs @@ -37,6 +37,9 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral1Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); @@ -50,6 +53,9 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral2Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); @@ -63,6 +69,9 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral3Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); @@ -76,6 +85,9 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral4Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); @@ -89,6 +101,9 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SpiderCoral5Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); diff --git a/Tiles/Rubblemaker/Abyss/SulphurPireCoralEcho.cs b/Tiles/Rubblemaker/Abyss/SulphurPireCoralEcho.cs index eb0d6f6388..615e7b74e0 100644 --- a/Tiles/Rubblemaker/Abyss/SulphurPireCoralEcho.cs +++ b/Tiles/Rubblemaker/Abyss/SulphurPireCoralEcho.cs @@ -53,6 +53,9 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SulphurPireCoral1Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); @@ -66,6 +69,9 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SulphurPireCoral2Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); @@ -79,6 +85,9 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { Tile tile = Framing.GetTileSafely(i, j); + if (tile.IsTileActuallyInvisible()) + return; + Texture2D tex = ModContent.Request("CalamityMod/Tiles/Abyss/AbyssAmbient/SulphurPireCoral3Glow").Value; Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange, Main.offScreenRange); From e509242d8cd76e4d2f15c50485250cf5741fe240 Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Mon, 11 Nov 2024 23:46:23 +0700 Subject: [PATCH 024/118] specialdraw too --- ILEditing/MechanicILChanges.cs | 2 +- Tiles/Crags/ScorchedRemainsGrass.cs | 3 +++ Tiles/FloralParadise/PinkFlower.cs | 3 +++ Tiles/FloralParadise/PinkFlowerBig.cs | 3 +++ Tiles/Furniture/WulfrumLure.cs | 3 +++ Tiles/UelibloomBrick.cs | 3 +++ 6 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index 6e50d291e0..21eb8c6b6b 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -1914,7 +1914,7 @@ namespace CalamityMod.ILEditing return; var glowMaskTile = GlowMaskTile.InstanceLookup[type]; - if (glowMaskTile is null) + if (glowMaskTile is null || !TileDrawing.IsVisible(drawData.tileCache)) return; var glowMask = glowMaskTile.GlowMask; diff --git a/Tiles/Crags/ScorchedRemainsGrass.cs b/Tiles/Crags/ScorchedRemainsGrass.cs index c93a845ccb..aaab2a3a01 100644 --- a/Tiles/Crags/ScorchedRemainsGrass.cs +++ b/Tiles/Crags/ScorchedRemainsGrass.cs @@ -147,6 +147,9 @@ namespace CalamityMod.Tiles.Crags public override void SpecialDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, Lighting.GetColor(i, j)); diff --git a/Tiles/FloralParadise/PinkFlower.cs b/Tiles/FloralParadise/PinkFlower.cs index 56c0f03581..f6c1a7bb90 100644 --- a/Tiles/FloralParadise/PinkFlower.cs +++ b/Tiles/FloralParadise/PinkFlower.cs @@ -50,6 +50,9 @@ namespace CalamityMod.Tiles.FloralParadise public override void SpecialDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + // 02JUN2024: Ozzatron: directionY did not exist at the time of the creation of this content. As such, it is ignored here. ILChanges.Windgrid.GetWindTime(i, j, WindPushLifetime, out int windTimeLeft, out int direction, out _); diff --git a/Tiles/FloralParadise/PinkFlowerBig.cs b/Tiles/FloralParadise/PinkFlowerBig.cs index ce416e6c8f..a4481e7853 100644 --- a/Tiles/FloralParadise/PinkFlowerBig.cs +++ b/Tiles/FloralParadise/PinkFlowerBig.cs @@ -59,6 +59,9 @@ namespace CalamityMod.Tiles.FloralParadise public override void SpecialDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + // 02JUN2024: Ozzatron: directionY did not exist at the time of the creation of this content. As such, it is ignored here. ILChanges.Windgrid.GetWindTime(i, j, WindPushLifetime, out int windTimeLeft, out int direction, out _); diff --git a/Tiles/Furniture/WulfrumLure.cs b/Tiles/Furniture/WulfrumLure.cs index 7e7d864482..4b3d07d82d 100644 --- a/Tiles/Furniture/WulfrumLure.cs +++ b/Tiles/Furniture/WulfrumLure.cs @@ -82,6 +82,9 @@ namespace CalamityMod.Tiles.Furniture public override void SpecialDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + Vector2 offScreen = new Vector2(Main.offScreenRange); if (Main.drawToScreen) { diff --git a/Tiles/UelibloomBrick.cs b/Tiles/UelibloomBrick.cs index 92ba0fcfb6..88a30f67fb 100644 --- a/Tiles/UelibloomBrick.cs +++ b/Tiles/UelibloomBrick.cs @@ -57,6 +57,9 @@ namespace CalamityMod.Tiles public override void SpecialDraw(int i, int j, SpriteBatch spriteBatch) { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, Lighting.GetColor(i, j), false); From 059850b813747d6ffdc7498c378d3ee8e2f68a2d Mon Sep 17 00:00:00 2001 From: Heart-Plus-Up <85328817+Heart-Plus-Up@users.noreply.github.com> Date: Mon, 11 Nov 2024 18:10:32 -0700 Subject: [PATCH 025/118] New astral vines --- Tiles/Astral/AstralVines.png | Bin 4676 -> 4014 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/Tiles/Astral/AstralVines.png b/Tiles/Astral/AstralVines.png index 9eb6362cc976c7e3db9053c653117b1de3a64144..a7adaeb04abea4a7e9c0db17858441c81020294b 100644 GIT binary patch literal 4014 zcmY+Hc{G%L8^`ZK5lWUxDTK7}q%02)#)#}$vWJOEV;P|u%h;Vty<{o-*s~;qu{D;# zkdS>JV{6DhjC~nHcqcu*=e+0K%OCeS_kCa2@B6*JpI_)*L+z970_*?)oYd9PFk##m z7^gMcamKaWwoRFF10hYc)d6hR1quLgIq7PsnW0jaQf;2Xh;gs$+;ERu@%Io`(XLiQ z&9jg6!&zhazz<|D!5^4to;+s$^$s?UUuZpA*Y-7LVC&iKH;%lblti^qTx9n;QM*y0N+JiRE8J!iKETR$bAJ+G0vSW*m4}z z){^F3=sRfdoeNr6swoRzYuv4t49ENTJq@n_l>LL*VjRe8OTTYlBfq=trq6=>Bmp-Tn0kfuD< zA47^#^{Gp8Q!I-bQOr=SwaFf*hw)qJ)`nXS1UhS&$DX~*W87pPo(f^DFF)_K15HP# z9}gS<;do{aa2g(>Y@A&eguSCp#XGvX$r#+TvN`s^*|~)3?V|?SKX7p`-)c0aLy}Rb z^ENbgBfDN%ED3spu=j#DRjZ<`LvckI#THDZKLk$o%~jWB6~=6>T16zxn~fITl*^RR zs*@X^CZ*k~DN-4g_$xy9JZuU30xR+xNr4Th_!%NN zW1bT7;k?^stzD-SpvmQK$1g|odE9OV2qh1l;G5IyOTUf+kdN7GipgaScZ8zmQUQI3kHM3=+=|2R_2khp zvQ>WrNl7+5cgGIPXy<1h>*9oZ;{pb{;^<3v>eddn{sule=JMPP&+bQ>no|ZwQ6XEB zoDrYGc$oFJjcFHl{d;icsS~HE0l5gzM*Hr+x@JIqYWTqvJ%~TLtN`poS?vd&=(!sL zunvpuAuKhEq2jqmEMZ!;5tfDfegDB+mCm@7$u4}*{T3c1PIgzI|# zo9)ndyx*cw>F!2AxT6*Zk-3@>m zT1PslGDTs}bAL44G4+DvN=eAz>>0poMfDwk+Ngg*51%F9Z0N!@d&C5Wl6x-LK^Z;03)^LE#=((X~jC+L@3rn zfY`^c$>?hH+#~7e>~>*fS=zsRJTvyYdi=oyNDS*g$U{M3%yZKnfa%Za zU%GcS{TrnXikNHjig#!Knk75~THa}>Wi(U&Qi6_Ni-gO5L_+ev22RXMI}csjd&{4O zZ=x2f$d}YU^12oJv@v|=(^4x}BCkw>mSgyv!vy8FgS7WQOnrhQR46Qbb9~zuT7D^J zW+_EKG4YvZ1V)EZeAPn2@3NIQ#-Ykd1d`w3osH+62ev?<4t-@>z3|+c@#uzGS3&0A zTLN6=rA-~Fgw4VLU|Ps$kR;R_#Lx{~B};PeQ>x^sBAeo!(I4jJiL}{BwShgmbY$UWrR6TzgQ{UAcOpKk@zP3W`oM=u{^`v=`hWvoX>cmcFS%r_K$ z{D420%C_E8N)he?~JTyW!IJK*743vac$jrFi=;?RGx>R)y(Z!0^zxYZz zx1gs9fwIsIAK4sNH-#yc(wkiMqd|eCm_TAXV-7CT>JFWo_Wu5rKsw)d<5qy1F7WyE znki&G_}nhP0el79@eLjlZxIjrXMec_5)1X-*jZhC?%YJw2@Re?a|dbtOdRHiII7r{ zjVRvodemsi{R6k*K$Kn~R-Ej624_S-Lly6eCT8{GILx}{N|YV`aaw}X0K$-b!LJvy z`flu0{U~VPdV7~>Y9GR?MnJ?NFfTv^*va@FaW3jv>Xd)Txm!^(-^gX#vlghF$RMBlG6PW^o3rU8HeA zSope=gtEJ79Lghzx3PLtJXgTvEUoEPg!JE;DmmkIlHs8jn3%y=O(MPjPt_Yt}c8o?jwNq=LYB zd?&i=XOh)nTOoQMPq#vrBjG-I1$W<8EW|yL*+X^?h9-c!kwtBbrQa~?v)*d}$S{MMM=n$3}-T|KIlcwN)kj>I(al<&o4=Mvex}!!~iXH{lkznF8cH+kwC;^&@)^ ztWUy(GLU78$$maQP54ICfQ%5i0^_teq;tt8soi4WL_cq8)wQe`gmZo(>%IIg@HA+! zhW$*wBE96NSP%5Y4OInLdJ40Zp=a zF|iOm&U8dwX66z5v|`-t<}Q!#b--o>6x0eVwMDJ+Ex$T4;IbfXUguRxvOp*E=L&Ce z*ur0bb?h$3EG{pOG1vd7l7*`H>{p%*ZJX4~?Uit5ix?^T4;UWDFaN5 z3CT{@*Cw1C68h}oPz=70vaIKabV2g%P${N>2P(hyt;NTn)5e}KOZBq?a&a8dx^>-Y zsj^@}DHQRP(Dm1woXAb{6_ zwGO*3;w(95{=o1j^cL0w2A?One5|ujzl-?2M~UtiJ>1Pvcc@*N>tFP@HZN4Nqrcgk z#zXj20;O+{!}#MZ=k;>Q^n#@Ve+j6)7_!TZj;mED?hiOR2~pnkG!Pv1A#V ztVthZ*D!{$`(UyRvd@f}`TFqr{vN+S?!AB9$NSv#KIgp7`+08sHA~Y&LPv!F061iB zW_*3;Ik$7!3mn+FS2?xm0)WIpbK{FPq3`KvpOf7mb zvGwEazNhlE%HKx%&nXOEB|Y|@yNSO?I$P)tx4xsS;2m%YWkZiWJfw`0pu9>M7s^3c z9xcG8<{fF7xh?<1^MFUx?eyC&@-AbM1D+${oAsV!tFm7_2O2b1zl4-lY>aL$25q>p zUx!TogaR(+5WcoAo?|TF@kTY0KZ?!Ix#hG1Jnxd@aamuvy29mY1aUbz(;lG{U=5$( zzy2!a=|Qd)8-~YpF6y>edM&;1_B8k52h!AE`)o8fEPiU&i~9LO8VC)aFD=-#Qq?sd zYH2P?vvVp@b;v+$q@JFqpjK`zG9>}DT(wW|J@y|QRMw!l!OzX#jSs3e=uTgS|5?v7 z6k_fZ%kMwCa{glQBo)GzVI?zVDfY;q`n9F#;3flPF7yRYUEq1yGbZSldi=3u!x}=~ zHGEX!Vwbw;_%lpxQKH@q(co-k+o_}R5SnRp8}TP;cyiyBt5$F|jikPpvUe1*HV!Y& z+u^Mo+DfE~x>V(!l*a;0igWt)8z!fD2m#QFQ}f5^kiRhYH6#zMbUm2;u`?Y5!7 zcN(lP6^G|YG$V&-gU?^&iv@&EWC!TQ(v9m!uzFW)(DVy_$ic9otE&lN>_vs7=IzQ`ghOBT&_<` zRVN48XSMV~gJ+redx=+b+a3zg@5@?qY9%yW2jXj$tvW_V59oc~nRg;kJtEMy67%3X)*MJ+9(%NLbDsXD# z>-nx}iPegc9qY5D_lhp?TMQYrpDpPheGOfCpOc=C3V3A})g%m?)>WjpJ zxFc8uvwfI*xM}0JqjAvr2ZmbNqh$~9!3c`1__RB0R_Xd__o?`ROFwuA2v*LCsVn9* zm6(N`cO2PKJcV~)*~Xt;?gtv0`?9dqwr+`$OK{h~ZIrE3x*`JL9efG#_(qy*)ktj_Qx(fc^9mtQC9rvP!z!@5O|CozU}|;WHR)6DcrGrUphLI?_-wJ zh>fg4kX|aflCHSk)Z5ZFNbrf$e_%E`J+GJ+O%ic>iFldp{djZ=N@ zMPa^MTWFxe@dj%m@lfGd_j{-<-YFLy&RpCWD=lfj!q>S&Eu%R5(aOLIR=bCWAKPI! zT$6Dh9?Z`;j#;x7WA%wAobc8Z zr*c5Rqb8k$^#wu3%F~@$w=l~9^8@EHz}(*CPJH9ups+#ftKX!G`J(vQl<$(lO`q3o zTQQ|R9Dy0xrR9RZqv@c{Kh`<-JdU(3AnU9VvL zy{9WfN-CikXT*Z#=|8%iV*z`N;M@%k%Qz}Q=X(6I`on`U^z{Ny=|K~<50BuQar0I- z|GXQF&(wFLHVm@wB-;?0Ol)Em`6V~4|GaG2Wnj6zMk^D(gBHj1gDxs`L*{i40yS37 zSKPs>$R;t?9Xq+`rOTznq+;l8GuF`J{Ie!c;&JJ%u;TImRZz;Ko_#@<@X=Cx=ueQ9_F&Gakta%A1G{eehCEfS^BHENYsYZQ zaTS>vO4~Li)W1Q+M5~p<*7M5hnC6gMHD*dE4&(RNAi!aD6FF4B7T5M6Y%$zk$4-h) zM_@9){hTml;YrR_8{%AFa4wcZ$@RcThKQ3Vi2H(8I-#p*eX2uCu&D3MTOlvVWb6j? zU$JPu$stO1yvg&KB8G+xlIaNs`Dv<)ZV^mAv^1HCL2P zo2_o^h0IxZ1wba>szA~=jCEXA5~$tYw~98ZCsiOtb~{_|+7c2?JfwnCyrSb$Pt79~ z*oD`PgRsfEiJH%1jl9E?b9y5QG7ZsgDo2VO*;+t}13X0b#eLhrvbRPc8@2mX@#&aB z9rD=K`lj!Vc0s}C=DdrydPzmyf_b^6uoWDFsfr6D?4?j=ZnnaR3|Xs&wfCge)?AG^ zR>?K(EIMbZo%z5pT`sH437x1Px-eoBoLu$V+&W;ghd1|!LF|0E`1Hax<=i!fq3+0XC%>OQvvJn32_h)miqHBAUOkQnLl?N9Mp2ZMr|;oYehbweD^M3O=NY`m?$xsy13J z0$j6{^*T0b-~y=KdfIZ{d@9fK%ybO@aw?M4+POnde8y9>9IEzOC%aUW!+5I_=m;wU zZ?i9EqOmf+PiRY{1Tr=l=zt+`@#ND1ySqZ7t89k(oE4R$;zSwXMm9O)8$6wBX*K`K zBTglOKUwWsFi#G!tcWy@yvLnSQg<0`x3wmUHg`C^dAapYkr$|xk@ZL-#zb2L!H#_I%batDSmX>ayG(618k*?}NeE&uRp6hY-+Xd)1|o zolEQyZGP!sz1dCjXwD?wXlz3~ir!)r*;QL1a6JbNCyu|tVla#qurE@I%|$WA*SorQ z8|F>hh~5unr)jC1oB837T60q1Rhr2j&9~SDmK{mi*m}^Z`(0{s-|Jn#qTZWiD#7(kfL< zVlStGqm#?O_mO1)zfH&#IIpjMWKau5^Xx5^s*#^lvW#7#MPaO=5M8;urfsDQ4uXa^ za=tDeh5n5k1`&iF=aUsr89`O~o)k%f!)o9WhZ#nGMs+GsoljI~Va&zre20215p=~z z#O%|zC2S|Ma`18|@vA}H)yI#QZIpDqc1}e~Gh%e_prGYv57z~g?LSsB!S6WbNTu|5 zbPtaPhCv{A<=5;ce&y_y8ts-hL@IK|9j@!y(&ZiaCB8rv7!IU3Mz3pXnTBS@M0aRS zy54yI2JZdt))0*P?PpdaVVc8B9{SOo`%#=M`mNvKPu-suNy=1x$~DMnnbAk`;T6rNc5 zN+^^Gfp*%&i8X!D_Apv>=^#_FtU$Y2DNnRxN`F^zwwS~oUY~^71ddrKq`ka5BbdZpE>Gx5gJnrh_xx-OpI9G@G>9 z4wr3F-ol59l4?g<)13ImnO=C6%(L2=b`~DUkyGA|$CZTlrVUS+@vZ%D&5ndvo>Z(b zPPo4R;HcIAa6Rin#aEhP4Ao>jtA>2_$1C4VHa8zLD($>~Jn8Q-ewQtLBtRWIpG~Eq z?kPOixwIKEVesj+KQ|0mj0imlAjg6+2=xNjC}Wb(4R6pjNo{qe)yCmwkoCY3S-Dp> zAjoB99AWs<4T1Okk3*FK#0p!8*cbMLz2Qs&NJfwdLRzwdR*(EPZO zB!tN(W;{G|>kXmAxT$F7!9kPbO6q$eJYwy8^n%^=lAx<|i6;yZkComm_>b}BYIVyX zc7BSZ)iJx89c~69t5}YJ0UMQgt{GE4&-ZH0ON#etRnS~Bxg%+x=tsA@3uR=al0Cxo zh#gLUW+&3hd*&zIldl?q)dFaG66WF6puRRwsfk@?_LTXTnb*j=4Y{app)&Bs9lXv< zY{I@H^s&mwLx8mND6UTaoHOO6%Oz68#IsznWXaw1x#-WUf;~v1FD^5VfJ617(5wX9 z6RLRuW5ttJFD~lB>X(Y%!D#r)(;3hmH?g&|-8-bLA9cve4$hTOKJXM>Yi^OA47=%6 z)OyMGe|b3hN~BzA5YllHIITLpQ%FJKP`)Ob`>Ah@!eb9lSlXj7tTis zM`R%+h09AQm*AoPC-->ZOm_d#0La>Ewu^s-B<~8zK;+qO5uSwg?F8PM@Kc8Q$Xe6v zLRt-3Qr<6U55-5)F~>0otv^)GsTei%O9>~d9B?N)<3|ldK_B_bk;div#zCF$dq{ zj617S@>0#8b7-jrW#2k_s*9QZM{j@q;kByveZhUi+3qczb^hT$Zpn(oexL9kR@jF2 Yct93T{dsR~=kE|;ZenR%a>*s;zvGB=iU0rr From 40aba79a15eac04671bca65171ee5466417aa442 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Tue, 12 Nov 2024 02:12:13 -0500 Subject: [PATCH 026/118] Buffed Statis' Ninja Belt Now grants fall damage immunity instead of fall damage resistance, increased dash length Added smoke particle visuals to dash Also Statis' Void Sash tooltip line about releasing scythes got removed for some reason, re-added that --- CalPlayer/Dashes/StatisNinjaBeltDash.cs | 57 +++++++++++++++++++ Items/Accessories/StatisNinjaBelt.cs | 9 +-- .../Mods.CalamityMod.Items.Accessories.hjson | 6 +- 3 files changed, 65 insertions(+), 7 deletions(-) create mode 100644 CalPlayer/Dashes/StatisNinjaBeltDash.cs diff --git a/CalPlayer/Dashes/StatisNinjaBeltDash.cs b/CalPlayer/Dashes/StatisNinjaBeltDash.cs new file mode 100644 index 0000000000..a0253e7f77 --- /dev/null +++ b/CalPlayer/Dashes/StatisNinjaBeltDash.cs @@ -0,0 +1,57 @@ +using CalamityMod.Enums; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; + +namespace CalamityMod.CalPlayer.Dashes +{ + public class StatisNinjaBeltDash : PlayerDashEffect + { + public static new string ID => "Statis' Ninja Belt"; + public override DashCollisionType CollisionType => DashCollisionType.NoCollision; + public override bool IsOmnidirectional => false; + public int Time = 0; + + public override float CalculateDashSpeed(Player player) => 20f; + + public override void OnDashEffects(Player player) + { + Time = 0; + for (int i = 0; i < 12; i++) + { + Vector2 smokePos = player.Center + new Vector2(Main.rand.Next(-player.width, player.width), Main.rand.Next(-player.height, player.height)) * 0.8f; + Vector2 smokeVel = Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(1.25f, 1.75f); + HeavySmokeParticle onDashSmoke = new(smokePos, smokeVel, Color.Gray, 30, 0.5f, 0.75f, 0.2f * Main.rand.NextFloatDirection()); + GeneralParticleHandler.SpawnParticle(onDashSmoke); + } + } + + public override void MidDashEffects(Player player, ref float dashSpeed, ref float dashSpeedDecelerationFactor, ref float runSpeedDecelerationFactor) + { + Time++; + if (Time % 3 == 0) + { + int colorType = Main.rand.Next(3); + Color smokeColor = Color.White; + switch (colorType) + { + case 0: + smokeColor = Color.Gray; + break; + case 1: + smokeColor = new Color(28, 75, 163); + break; + case 2: + smokeColor = new Color(195, 0, 255); + break; + } + + Vector2 smokePos = player.Center - (player.velocity * 1.25f) + Main.rand.NextVector2Circular(10, 20); + float smokeScale = player.velocity.X * 0.045f; + HeavySmokeParticle midDashSmoke = new(smokePos, player.velocity * 0.2f, smokeColor, 20, smokeScale, 0.75f, 0.2f * Main.rand.NextFloatDirection(), true); + GeneralParticleHandler.SpawnParticle(midDashSmoke); + } + } + } +} diff --git a/Items/Accessories/StatisNinjaBelt.cs b/Items/Accessories/StatisNinjaBelt.cs index 6039acb7ca..0758843f88 100644 --- a/Items/Accessories/StatisNinjaBelt.cs +++ b/Items/Accessories/StatisNinjaBelt.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.CalPlayer.Dashes; +using CalamityMod.Items.Materials; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -28,10 +29,10 @@ namespace CalamityMod.Items.Accessories { player.autoJump = true; player.jumpSpeedBoost += 1.6f; - player.extraFall += 35; + player.noFallDmg = true; player.blackBelt = true; - player.dashType = 1; - player.Calamity().DashID = string.Empty; + player.dashType = 0; + player.Calamity().DashID = StatisNinjaBeltDash.ID; player.spikedBoots = 2; player.accFlipper = true; } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 9ad5edf804..15bd53bafb 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -1632,8 +1632,7 @@ StatisNinjaBelt: { DisplayName: Statis' Ninja Belt Tooltip: ''' - 32% increased jump speed and allows auto-jump - Increased fall damage resistance by 35 blocks + 32% increased jump speed, allows auto-jump, and negates fall damage Grants the ability to swim, climb walls, dash, and dodge attacks ''' HoldShiftTooltip: @@ -1649,7 +1648,8 @@ StatisVoidSash: { Tooltip: ''' 32% increased jump speed, allows auto-jump, and negates fall damage - Can swim, climb walls, dash, and dodge attacks + Grants the ability to swim, climb walls, dash, and dodge attacks + Dashes leave homing scythes in your wake ''' HoldShiftTooltip: ''' From 8da2410095b2ad9b9a46fbd693d1d840ff95814b Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <142704082+CongratsIsTrash@users.noreply.github.com> Date: Tue, 12 Nov 2024 12:18:59 -0500 Subject: [PATCH 027/118] Calamity Eye HP was nerfed instead of buffed --- NPCs/Crags/CalamityEye.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NPCs/Crags/CalamityEye.cs b/NPCs/Crags/CalamityEye.cs index 3a5430ba14..0ed1511b15 100644 --- a/NPCs/Crags/CalamityEye.cs +++ b/NPCs/Crags/CalamityEye.cs @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.Crags NPC.width = 30; NPC.height = 30; NPC.defense = 12; - NPC.lifeMax = 80; + NPC.lifeMax = 180; NPC.knockBackResist = 0.75f; AnimationType = NPCID.DemonEye; NPC.value = Item.buyPrice(0, 0, 5, 0); From 249b077b35732776d2f44f5dea5cc094cb95128a Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Wed, 13 Nov 2024 01:08:48 +0700 Subject: [PATCH 028/118] The Comb --- CalPlayer/CalamityPlayer.cs | 2 + CalPlayer/DrawLayers/CombHairSparkleLayer.cs | 106 ++++++++++++++++++ Items/Accessories/Vanity/TheComb.cs | 29 +++++ Items/Accessories/Vanity/TheComb.png | Bin 0 -> 887 bytes .../Mods.CalamityMod.Items.Accessories.hjson | 5 + Systems/World/WorldgenManagementSystem.cs | 15 ++- 6 files changed, 156 insertions(+), 1 deletion(-) create mode 100644 CalPlayer/DrawLayers/CombHairSparkleLayer.cs create mode 100644 Items/Accessories/Vanity/TheComb.cs create mode 100644 Items/Accessories/Vanity/TheComb.png diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 2e719efee4..1f48e6e1ec 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -113,6 +113,7 @@ namespace CalamityMod.CalPlayer public float healingPotionMultiplier = 1f; public bool heldGaelsLastFrame = false; internal bool hadNanomachinesLastFrame = false; + public bool combHair; public bool disableVoodooSpawns = false; public bool disablePerfCystSpawns = false; public bool disableHiveCystSpawns = false; @@ -1608,6 +1609,7 @@ namespace CalamityMod.CalPlayer ResetRogueStealth(); calamityBonusLuck = 0f; + combHair = false; // Reset adrenaline duration to default. If Draedon's Heart is equipped, it'll change itself every frame. AdrenalineDuration = CalamityUtils.SecondsToFrames(5); diff --git a/CalPlayer/DrawLayers/CombHairSparkleLayer.cs b/CalPlayer/DrawLayers/CombHairSparkleLayer.cs new file mode 100644 index 0000000000..18833205ea --- /dev/null +++ b/CalPlayer/DrawLayers/CombHairSparkleLayer.cs @@ -0,0 +1,106 @@ +using CalamityMod.Items.Accessories.Vanity; +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.CalPlayer.DrawLayers +{ + public class CombHairSparkleLayer : PlayerDrawLayer + { + public override Position GetDefaultPosition() => new BeforeParent(PlayerDrawLayers.LeinforsHairShampoo); + + public override bool IsHeadLayer => true; + + public override bool GetDefaultVisibility(PlayerDrawSet drawInfo) + { + Player drawPlayer = drawInfo.drawPlayer; + CalamityPlayer modPlayer = drawPlayer.Calamity(); + + // Specific hair drawing requirements: Hair must be drawing with 20% lightness, and you're not bald + bool canReceiveHairSparkles = (drawInfo.fullHair || drawInfo.hatHair || drawInfo.drawsBackHairWithoutHeadgear || drawPlayer.head == -1 || drawPlayer.head == 0) && Main.rgbToHsl(drawInfo.colorHead).Z > 0.2f; + bool baldHairStyles = drawPlayer.hair == 12 || drawPlayer.hair == 76; + return drawInfo.shadow == 0f && !drawPlayer.dead && !drawInfo.headOnlyRender && modPlayer.combHair && canReceiveHairSparkles && !baldHairStyles; + } + + protected override void Draw(ref PlayerDrawSet drawInfo) + { + Player drawPlayer = drawInfo.drawPlayer; + + // 5% chance per frame any of this draws + if (!Main.rand.NextBool(20)) + return; + + // Search through the equipped index for the comb. We need this to get the right dye + int dyeIndex = -1; + for (int i = 0; i < 20; i++) + { + if (drawPlayer.armor[i].type == ModContent.ItemType()) + { + dyeIndex = i; + break; + } + } + var shader = GameShaders.Armor.GetSecondaryShader(dyeIndex == -1 ? 0 : drawPlayer.dye[dyeIndex % 10].dye, drawPlayer); + + // Now detect if there are chests nearby + int LeftRange = Utils.Clamp((int)drawPlayer.MountedCenter.X / 16 - 60, 2, Main.maxTilesX - 2); + int RightRange = Utils.Clamp((int)drawPlayer.MountedCenter.X / 16 + 60, 2, Main.maxTilesX - 2); + int TopRange = Utils.Clamp((int)drawPlayer.MountedCenter.Y / 16 - 60, 2, Main.maxTilesY - 2); + int BottomRange = Utils.Clamp((int)drawPlayer.MountedCenter.Y / 16 + 60, 2, Main.maxTilesY - 2); + + float range = 50000f; + Vector2 ChestPosition = Vector2.Zero; + for (int i = LeftRange; i <= RightRange; i++) + { + for (int j = TopRange; j <= BottomRange; j++) + { + int PotentialChest = Chest.FindChestByGuessing(i, j); + if (PotentialChest != -1 && !TileID.Sets.BasicDresser[Main.tile[i, j].TileType]) + { + // Adjust position ot the center of the chest + Chest chest = Main.chest[PotentialChest]; + Vector2 chestCenter = new Vector2(chest.x + 1, chest.y + 1) * 16f; + float distance = Vector2.Distance(chestCenter, drawPlayer.MountedCenter); + + if (distance < range) + { + range = distance; + ChestPosition = chestCenter; + } + } + } + } + + if (!drawInfo.hatHair || Main.rand.NextBool()) + { + Rectangle area = drawInfo.hatHair ? Utils.CenteredRectangle(drawInfo.Position + drawPlayer.Size * 0.5f + new Vector2(drawPlayer.direction * -10, drawPlayer.gravDir * -10f), new Vector2(5f, 5f)) + : Utils.CenteredRectangle(drawInfo.Position + drawPlayer.Size * 0.5f + new Vector2(0f, drawPlayer.gravDir * -20f), new Vector2(20f, 14f)); + + Dust sparkle = Dust.NewDustDirect(area.TopLeft(), area.Width, area.Height, DustID.GoldCoin, Alpha: 150, Scale: 0.3f); + sparkle.fadeIn = 1f; + sparkle.velocity = ChestPosition == Vector2.Zero ? (sparkle.velocity * 0.1f) : (ChestPosition - sparkle.position).SafeNormalize(Vector2.Zero); + sparkle.noLight = true; + sparkle.shader = shader; + drawInfo.DustCache.Add(sparkle.dustIndex); + } + + // Back hair + if (drawPlayer.velocity.X != 0f && drawInfo.backHairDraw) + { + Rectangle areaB = Utils.CenteredRectangle(drawInfo.Position + drawPlayer.Size * 0.5f + new Vector2(drawPlayer.direction * -14, 0f), new Vector2(4f, 30f)); + Dust sparkleB = Dust.NewDustDirect(areaB.TopLeft(), areaB.Width, areaB.Height, DustID.GoldCoin, Alpha: 150, Scale: 0.3f); + sparkleB.fadeIn = 1f; + sparkleB.velocity = ChestPosition == Vector2.Zero ? (sparkleB.velocity * 0.1f) : (ChestPosition - sparkleB.position).SafeNormalize(Vector2.Zero); + sparkleB.noLight = true; + sparkleB.shader = shader; + drawInfo.DustCache.Add(sparkleB.dustIndex); + } + } + } +} diff --git a/Items/Accessories/Vanity/TheComb.cs b/Items/Accessories/Vanity/TheComb.cs new file mode 100644 index 0000000000..a0b6f21acf --- /dev/null +++ b/Items/Accessories/Vanity/TheComb.cs @@ -0,0 +1,29 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories.Vanity +{ + public class TheComb : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Accessories"; + + public override void SetDefaults() + { + Item.width = 40; + Item.height = 42; + Item.accessory = true; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; + } + + public override void UpdateVanity(Player player) => player.Calamity().combHair = true; + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (!hideVisual) + player.Calamity().combHair = true; + } + } +} diff --git a/Items/Accessories/Vanity/TheComb.png b/Items/Accessories/Vanity/TheComb.png new file mode 100644 index 0000000000000000000000000000000000000000..95d69e8fbd3d1ce39043a56035fa6dbc2002e37c GIT binary patch literal 887 zcmV--1Bm>IP)Px#1ZP1_K>z@;j|==^1poj82T4RhR9Hvlm(NdTt4o(^d0@?pv(hq`wU#yvN&4Y5K?JEJiZIu&_xJg@ z@!g0AwC#c3m)G|V4~OTq&-4906v%|!KhIcRSptUqt3QQ~Yg{8g{y_HFR}7}h&}2YZ zZ7ya|fMv^byxI_(i6L$;*Qpe4i>!rZ}#fT~eWM)}-_eKD%`si>P-X$y~76 z4H{=0Aep3eG%%`LlTG&zn!&9ynG-VzbIpB!9j%Sjres z=si$u@^1#o*itkOQrt=#=t#T)ODl*(lzxy*mZ+34xf*BJr86mggQt&_V)1*w zf;lqcY?}pBnF}v71H8%6&s89WOqz?>Nj1F~0>zq?zQLY$Gt8Ym%65AGDdo)#yTf3& zgY9e7t6SL9Ue#y>X%;Ejn#{eEWac7nNOta;4&=?XRcOJfXR8OV zT)hrT-=M&akWsak-O<-5`@Dc2o4plLzkPE6q#5OBFn$4X=H}7!&mbjJ zlbM=}EG~fgYmh=FH9OcD9sBe#$t0cKnVO^Izd?#xFsRZL!yvuoWNVJ{{}|L+tYDEw z1AdFeV3Lnma}()); + chest.item[inventoryIndex].stack = 1; + break; + } + } + } } } } From 168b63c79fa90b8b0f505849695dfc10eaca9a8f Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Wed, 13 Nov 2024 01:11:03 +0700 Subject: [PATCH 029/118] ozz tooltip --- .../en-US/Mods.CalamityMod.Items.Accessories.hjson | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 755a0a156c..cfaab4d524 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -2081,7 +2081,13 @@ SharkyPlush: { TheComb: { DisplayName: The Comb - Tooltip: '''"We ain't found shit!"''' + Tooltip: + ''' + Illuminates your hair with lustrous sparkles + Sparkles point to nearby treasure + This effect works in vanity slots + 'We ain't found shit!' + ''' } XyksBlessingBlue: { From 572a1c6204d7825ed40aee66ca771e177dd92394 Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Wed, 13 Nov 2024 01:13:49 +0700 Subject: [PATCH 030/118] bald hairstyle correction** --- CalPlayer/DrawLayers/CombHairSparkleLayer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CalPlayer/DrawLayers/CombHairSparkleLayer.cs b/CalPlayer/DrawLayers/CombHairSparkleLayer.cs index 18833205ea..0dc4dec66e 100644 --- a/CalPlayer/DrawLayers/CombHairSparkleLayer.cs +++ b/CalPlayer/DrawLayers/CombHairSparkleLayer.cs @@ -24,7 +24,7 @@ namespace CalamityMod.CalPlayer.DrawLayers // Specific hair drawing requirements: Hair must be drawing with 20% lightness, and you're not bald bool canReceiveHairSparkles = (drawInfo.fullHair || drawInfo.hatHair || drawInfo.drawsBackHairWithoutHeadgear || drawPlayer.head == -1 || drawPlayer.head == 0) && Main.rgbToHsl(drawInfo.colorHead).Z > 0.2f; - bool baldHairStyles = drawPlayer.hair == 12 || drawPlayer.hair == 76; + bool baldHairStyles = drawPlayer.hair == 15 || drawPlayer.hair == 76; return drawInfo.shadow == 0f && !drawPlayer.dead && !drawInfo.headOnlyRender && modPlayer.combHair && canReceiveHairSparkles && !baldHairStyles; } From 9268911d510996b694b28fa147b5a139b4cd00e3 Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Wed, 13 Nov 2024 01:28:45 +0700 Subject: [PATCH 031/118] comb edits again --- CalPlayer/DrawLayers/CombHairSparkleLayer.cs | 4 ++-- Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/CalPlayer/DrawLayers/CombHairSparkleLayer.cs b/CalPlayer/DrawLayers/CombHairSparkleLayer.cs index 0dc4dec66e..ce4d7ca95d 100644 --- a/CalPlayer/DrawLayers/CombHairSparkleLayer.cs +++ b/CalPlayer/DrawLayers/CombHairSparkleLayer.cs @@ -84,7 +84,7 @@ namespace CalamityMod.CalPlayer.DrawLayers Dust sparkle = Dust.NewDustDirect(area.TopLeft(), area.Width, area.Height, DustID.GoldCoin, Alpha: 150, Scale: 0.3f); sparkle.fadeIn = 1f; - sparkle.velocity = ChestPosition == Vector2.Zero ? (sparkle.velocity * 0.1f) : (ChestPosition - sparkle.position).SafeNormalize(Vector2.Zero); + sparkle.velocity = ChestPosition == Vector2.Zero ? (sparkle.velocity * 0.1f) : (ChestPosition - sparkle.position).SafeNormalize(Vector2.Zero) * 0.5f; sparkle.noLight = true; sparkle.shader = shader; drawInfo.DustCache.Add(sparkle.dustIndex); @@ -96,7 +96,7 @@ namespace CalamityMod.CalPlayer.DrawLayers Rectangle areaB = Utils.CenteredRectangle(drawInfo.Position + drawPlayer.Size * 0.5f + new Vector2(drawPlayer.direction * -14, 0f), new Vector2(4f, 30f)); Dust sparkleB = Dust.NewDustDirect(areaB.TopLeft(), areaB.Width, areaB.Height, DustID.GoldCoin, Alpha: 150, Scale: 0.3f); sparkleB.fadeIn = 1f; - sparkleB.velocity = ChestPosition == Vector2.Zero ? (sparkleB.velocity * 0.1f) : (ChestPosition - sparkleB.position).SafeNormalize(Vector2.Zero); + sparkleB.velocity = ChestPosition == Vector2.Zero ? (sparkleB.velocity * 0.1f) : (ChestPosition - sparkleB.position).SafeNormalize(Vector2.Zero) * 0.5f; sparkleB.noLight = true; sparkleB.shader = shader; drawInfo.DustCache.Add(sparkleB.dustIndex); diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index cfaab4d524..95fbb505ef 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -2083,9 +2083,8 @@ TheComb: { DisplayName: The Comb Tooltip: ''' - Illuminates your hair with lustrous sparkles - Sparkles point to nearby treasure - This effect works in vanity slots + Gives the wearer's hair a lustrous finish + Sparkles are attracted to nearby chests 'We ain't found shit!' ''' } From 8a9ad027a7cd95d2c25f9c17e8258a65d9bebb8c Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Wed, 13 Nov 2024 11:00:58 +0700 Subject: [PATCH 032/118] nerfed comb lmao --- CalPlayer/DrawLayers/CombHairSparkleLayer.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CalPlayer/DrawLayers/CombHairSparkleLayer.cs b/CalPlayer/DrawLayers/CombHairSparkleLayer.cs index ce4d7ca95d..18ca428d85 100644 --- a/CalPlayer/DrawLayers/CombHairSparkleLayer.cs +++ b/CalPlayer/DrawLayers/CombHairSparkleLayer.cs @@ -49,10 +49,10 @@ namespace CalamityMod.CalPlayer.DrawLayers var shader = GameShaders.Armor.GetSecondaryShader(dyeIndex == -1 ? 0 : drawPlayer.dye[dyeIndex % 10].dye, drawPlayer); // Now detect if there are chests nearby - int LeftRange = Utils.Clamp((int)drawPlayer.MountedCenter.X / 16 - 60, 2, Main.maxTilesX - 2); - int RightRange = Utils.Clamp((int)drawPlayer.MountedCenter.X / 16 + 60, 2, Main.maxTilesX - 2); - int TopRange = Utils.Clamp((int)drawPlayer.MountedCenter.Y / 16 - 60, 2, Main.maxTilesY - 2); - int BottomRange = Utils.Clamp((int)drawPlayer.MountedCenter.Y / 16 + 60, 2, Main.maxTilesY - 2); + int LeftRange = Utils.Clamp((int)drawPlayer.MountedCenter.X / 16 - 50, 2, Main.maxTilesX - 2); + int RightRange = Utils.Clamp((int)drawPlayer.MountedCenter.X / 16 + 50, 2, Main.maxTilesX - 2); + int TopRange = Utils.Clamp((int)drawPlayer.MountedCenter.Y / 16 - 50, 2, Main.maxTilesY - 2); + int BottomRange = Utils.Clamp((int)drawPlayer.MountedCenter.Y / 16 + 50, 2, Main.maxTilesY - 2); float range = 50000f; Vector2 ChestPosition = Vector2.Zero; @@ -84,7 +84,7 @@ namespace CalamityMod.CalPlayer.DrawLayers Dust sparkle = Dust.NewDustDirect(area.TopLeft(), area.Width, area.Height, DustID.GoldCoin, Alpha: 150, Scale: 0.3f); sparkle.fadeIn = 1f; - sparkle.velocity = ChestPosition == Vector2.Zero ? (sparkle.velocity * 0.1f) : (ChestPosition - sparkle.position).SafeNormalize(Vector2.Zero) * 0.5f; + sparkle.velocity = ChestPosition == Vector2.Zero ? (sparkle.velocity * 0.1f) : (ChestPosition - sparkle.position).SafeNormalize(Vector2.Zero) * 0.2f; sparkle.noLight = true; sparkle.shader = shader; drawInfo.DustCache.Add(sparkle.dustIndex); @@ -96,7 +96,7 @@ namespace CalamityMod.CalPlayer.DrawLayers Rectangle areaB = Utils.CenteredRectangle(drawInfo.Position + drawPlayer.Size * 0.5f + new Vector2(drawPlayer.direction * -14, 0f), new Vector2(4f, 30f)); Dust sparkleB = Dust.NewDustDirect(areaB.TopLeft(), areaB.Width, areaB.Height, DustID.GoldCoin, Alpha: 150, Scale: 0.3f); sparkleB.fadeIn = 1f; - sparkleB.velocity = ChestPosition == Vector2.Zero ? (sparkleB.velocity * 0.1f) : (ChestPosition - sparkleB.position).SafeNormalize(Vector2.Zero) * 0.5f; + sparkleB.velocity = ChestPosition == Vector2.Zero ? (sparkleB.velocity * 0.1f) : (ChestPosition - sparkleB.position).SafeNormalize(Vector2.Zero) * 0.2f; sparkleB.noLight = true; sparkleB.shader = shader; drawInfo.DustCache.Add(sparkleB.dustIndex); From 92f1d605a66bfd103c8980c39b1f097b23b27bb9 Mon Sep 17 00:00:00 2001 From: Xyk Date: Wed, 13 Nov 2024 11:26:13 -0800 Subject: [PATCH 033/118] Mourningstar now uses fuck you --- Projectiles/Melee/MourningstarFlail.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Projectiles/Melee/MourningstarFlail.cs b/Projectiles/Melee/MourningstarFlail.cs index f19edc709f..147a4d209c 100644 --- a/Projectiles/Melee/MourningstarFlail.cs +++ b/Projectiles/Melee/MourningstarFlail.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.Typeless; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -19,22 +20,21 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.ignoreWater = true; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 4; + Projectile.localNPCHitCooldown = 7; Projectile.extraUpdates = 1; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.Daybreak, 180); - // Note: This is being left as the solar explosion projectile for now, since the weapon is in a good balancing position right now. - // If it is to be rebalanced, consider replacing it with the FuckYou projectile (which does not mess with I-frames) if (Projectile.localAI[1] <= 0f && Projectile.owner == Main.myPlayer) { - int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center.X, target.Center.Y, 0f, 0f, ProjectileID.SolarWhipSwordExplosion, Projectile.damage, hit.Knockback, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Main.projectile[proj].usesLocalNPCImmunity = true; - Main.projectile[proj].localNPCHitCooldown = 4; + int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, hit.Knockback, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + Main.projectile[proj].usesLocalNPCImmunity = false; + Main.projectile[proj].usesIDStaticNPCImmunity = true; + Main.projectile[proj].idStaticNPCHitCooldown = 60; } - Projectile.localAI[1] = 4f; + Projectile.localAI[1] = 16f; } } } From 6eca288aba18118523d23dfd69036c8fc8bb0314 Mon Sep 17 00:00:00 2001 From: Javyz <36089970+JavyzTaken@users.noreply.github.com> Date: Wed, 13 Nov 2024 20:33:43 +0100 Subject: [PATCH 034/118] Fixed Fargo's Mutant AddIndestructibleRectangle modcall using tile coords instead of world coords (#73) --- Utilities/WorldgenUtils.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Utilities/WorldgenUtils.cs b/Utilities/WorldgenUtils.cs index 37cadf07e3..3730a6265f 100644 --- a/Utilities/WorldgenUtils.cs +++ b/Utilities/WorldgenUtils.cs @@ -236,6 +236,10 @@ namespace CalamityMod // If Fargo's Mutant Mod is loaded, add to their Indestructible Rectangle list, which prevents structures from being trashed by Fargo's terrain tools. Mod fargos = ExternalMods.fargos; + paddedArea.X *= 16; + paddedArea.Y *= 16; + paddedArea.Width *= 16; + paddedArea.Height *= 16; fargos?.Call("AddIndestructibleRectangle", paddedArea); } } From 3731c18232c92a08fd91712cd7b10f06241c81c7 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Fri, 11 Oct 2024 23:53:42 +0900 Subject: [PATCH 035/118] Implemented Sliced Lighting for TileBlendMerge --- .../TileMerging/TileBlendMergeSystem_Draw.cs | 115 +++++++++++++++++- Utilities/DrawingUtils.cs | 10 ++ 2 files changed, 120 insertions(+), 5 deletions(-) diff --git a/Systems/TileMerging/TileBlendMergeSystem_Draw.cs b/Systems/TileMerging/TileBlendMergeSystem_Draw.cs index 5a37663367..7cd1867083 100644 --- a/Systems/TileMerging/TileBlendMergeSystem_Draw.cs +++ b/Systems/TileMerging/TileBlendMergeSystem_Draw.cs @@ -9,22 +9,89 @@ using Terraria; using Terraria.ModLoader; using Microsoft.Xna.Framework; using Terraria.GameContent.Drawing; +using System.Reflection; +using Terraria.ID; +using System.Runtime.CompilerServices; namespace CalamityMod.Systems { public sealed partial class TileBlendMergeSystem : ModSystem { + private readonly static BindingFlags NonPublicStatic = BindingFlags.NonPublic | BindingFlags.Static; + private readonly static BindingFlags NonPublicInstance = BindingFlags.NonPublic | BindingFlags.Instance; + + private readonly static FastField MediumQualityLightRequirement = new("_mediumQualityLightingRequirement", NonPublicInstance); + private readonly static FastField HighQualityLightRequirement = new("_highQualityLightingRequirement", NonPublicInstance); + + private readonly static Rectangle[] Rects9Slice = [ + new Rectangle(x: 0, y: 0, width: 4, height: 4), + new Rectangle(x: 4, y: 0, width: 8, height: 4), + new Rectangle(x: 12, y: 0, width: 4, height: 4), + + new Rectangle(x: 0, y: 4, width: 4, height: 8), + new Rectangle(x: 4, y: 4, width: 8, height: 8), + new Rectangle(x: 12, y: 4, width: 4, height: 8), + + new Rectangle(x: 0, y: 12, width: 4, height: 4), + new Rectangle(x: 4, y: 12, width: 8, height: 4), + new Rectangle(x: 12, y: 12, width: 4, height: 4), + ]; + + private readonly static Rectangle[] Rects4Slice = [ + new Rectangle(x: 0, y: 0, width: 8, height: 8), + new Rectangle(x: 8, y: 0, width: 8, height: 8), + new Rectangle(x: 0, y: 8, width: 8, height: 8), + new Rectangle(x: 8, y: 8, width: 8, height: 8), + ]; + + private enum SliceState : byte + { + None, + Slice_4, + Slice_9 + } + private static void OnDrawSingleTile(On_TileDrawing.orig_DrawSingleTile orig, TileDrawing self, TileDrawInfo drawData, bool solidLayer, int waterStyleOverride, Vector2 screenPosition, Vector2 screenOffset, int tileX, int tileY) { orig(self, drawData, solidLayer, waterStyleOverride, screenPosition, screenOffset, tileX, tileY); var tile = drawData.tileCache; + var tileType = tile.TileType; - Color drawColor = drawData.tileLight; - if (drawColor.R <= 0 && drawColor.G <= 0 && drawColor.B <= 0) + Color tileLight = drawData.tileLight; + if (tileLight.R <= 0 && tileLight.G <= 0 && tileLight.B <= 0) return; + + var slices = drawData.colorSlices; + int sliceLength = 0; + var sliceRects = Array.Empty(); + var sliceState = SliceState.None; + var shouldTileShine = ShouldTileShine(tileType, (short)(drawData.tileFrameX + drawData.addFrX)); + + // Is HalfBlock condition is also in vanilla, so we follow that + if (Lighting.NotRetro && !tile.IsHalfBlock && !TileID.Sets.DontDrawTileSliced[tileType]) + { + var midQualityThreshold = MediumQualityLightRequirement.Get(self); + var highQualityThreshold = HighQualityLightRequirement.Get(self); + if (tileLight.IsAnyChannelGreaterThan(highQualityThreshold)) + { + sliceLength = 9; + sliceState = SliceState.Slice_9; + sliceRects = Rects9Slice; + Lighting.GetColor9Slice(tileX, tileY, ref slices); + } + else if (tileLight.IsAnyChannelGreaterThan(midQualityThreshold)) + { + sliceLength = 4; + sliceState = SliceState.Slice_4; + sliceRects = Rects4Slice; + Lighting.GetColor4Slice(tileX, tileY, ref slices); + } + } Vector2 drawPos = new Vector2(tileX * 16, tileY * 16) - screenPosition + screenOffset; + var tileRandomFrame = Math.Clamp(tile.TileFrameNumber, 0, 2); + var isFullBright = tile.IsTileFullbright; var blendingData = tile.Get(); // Since we are not editing the value, we can just copy the values from here for (int idx = 0; idx < TileBlendingData.Length; idx++) { @@ -35,10 +102,48 @@ namespace CalamityMod.Systems break; var rect = TileBlendTexture.SideFlagsToSheetRect(data); - var texture = TileBlendTextureLoader.Registry[sheetIdx]; - var variant = Math.Clamp(tile.TileFrameNumber, 0, 2); - Main.spriteBatch.Draw(texture.BlendTextures[variant], drawPos, rect, drawColor, rotation: 0.0f, origin: default, scale: 1.0f, SpriteEffects.None, layerDepth: 0.0f); + var texture = TileBlendTextureLoader.Registry[sheetIdx].BlendTextures[tileRandomFrame]; + + // No Slice Drawing + if (sliceState == SliceState.None || isFullBright) + { + var drawColor = isFullBright ? Color.White : tileLight; + Main.spriteBatch.Draw(texture, drawPos, rect, drawColor, rotation: 0.0f, origin: default, scale: 1.0f, SpriteEffects.None, layerDepth: 0.0f); + return; + } + + // Sliced Drawing + for (int i = 0; i < sliceLength; i++) + { + var drawRect = sliceRects[i]; + drawRect.X += rect.X; + drawRect.Y += rect.Y; + + var drawColorVec = (tileLight.ToVector3() + slices[i]) * 0.5f; + drawColorVec *= drawData.colorTint.ToVector3(); + + // Tile is Actucated, Reduce brightness + if (tile.IsActuated) + { + drawColorVec *= 0.4f; + } + + // Tile is shine + if (shouldTileShine) + { + Main.shine(ref drawColorVec, tileType); + } + + Main.spriteBatch.Draw(texture, drawPos, rect, new Color(drawColorVec), rotation: 0.0f, origin: default, scale: 1.0f, SpriteEffects.None, layerDepth: 0.0f); + } } } + + private static MethodInfo ShouldTileShineMethod; + private static bool ShouldTileShine(ushort type, short frameX) + { + ShouldTileShineMethod ??= typeof(TileDrawing).GetMethod("ShouldTileShine", BindingFlags.NonPublic | BindingFlags.Static); + return (bool)ShouldTileShineMethod.Invoke(null, [type, frameX]); + } } } diff --git a/Utilities/DrawingUtils.cs b/Utilities/DrawingUtils.cs index 8f13a8b86e..05d01e183d 100644 --- a/Utilities/DrawingUtils.cs +++ b/Utilities/DrawingUtils.cs @@ -591,6 +591,16 @@ namespace CalamityMod return Color.Lerp(currentColor, nextColor, increment * colors.Length % 1f); } + [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] + public static bool IsAnyChannelGreaterThan(this Color a, Color b, bool includeAlpha = false) + { + if (a.R > b.R) return true; + if (a.G > b.G) return true; + if (a.B > b.B) return true; + if (includeAlpha && a.A > b.B) return true; + return false; + } + // Cached for efficiency purposes. internal static readonly FieldInfo UImageFieldMisc0 = typeof(MiscShaderData).GetField("_uImage0", BindingFlags.NonPublic | BindingFlags.Instance); internal static readonly FieldInfo UImageFieldMisc1 = typeof(MiscShaderData).GetField("_uImage1", BindingFlags.NonPublic | BindingFlags.Instance); From d3888f35072cd222859cee5b78aa1f123694ef6d Mon Sep 17 00:00:00 2001 From: Flowaria Date: Sat, 12 Oct 2024 02:05:28 +0900 Subject: [PATCH 036/118] Minor fixes --- Systems/TileMerging/TileBlendMergeSystem_Draw.cs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/Systems/TileMerging/TileBlendMergeSystem_Draw.cs b/Systems/TileMerging/TileBlendMergeSystem_Draw.cs index 7cd1867083..98a2a2b445 100644 --- a/Systems/TileMerging/TileBlendMergeSystem_Draw.cs +++ b/Systems/TileMerging/TileBlendMergeSystem_Draw.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Microsoft.Xna.Framework.Graphics; using Terraria.DataStructures; using Terraria; @@ -11,17 +7,16 @@ using Microsoft.Xna.Framework; using Terraria.GameContent.Drawing; using System.Reflection; using Terraria.ID; -using System.Runtime.CompilerServices; namespace CalamityMod.Systems { public sealed partial class TileBlendMergeSystem : ModSystem { - private readonly static BindingFlags NonPublicStatic = BindingFlags.NonPublic | BindingFlags.Static; - private readonly static BindingFlags NonPublicInstance = BindingFlags.NonPublic | BindingFlags.Instance; + private static readonly BindingFlags NonPublicStatic = BindingFlags.NonPublic | BindingFlags.Static; + private static readonly BindingFlags NonPublicInstance = BindingFlags.NonPublic | BindingFlags.Instance; - private readonly static FastField MediumQualityLightRequirement = new("_mediumQualityLightingRequirement", NonPublicInstance); - private readonly static FastField HighQualityLightRequirement = new("_highQualityLightingRequirement", NonPublicInstance); + private static readonly FastField MediumQualityLightRequirement = new("_mediumQualityLightingRequirement", NonPublicInstance); + private static readonly FastField HighQualityLightRequirement = new("_highQualityLightingRequirement", NonPublicInstance); private readonly static Rectangle[] Rects9Slice = [ new Rectangle(x: 0, y: 0, width: 4, height: 4), @@ -142,7 +137,7 @@ namespace CalamityMod.Systems private static MethodInfo ShouldTileShineMethod; private static bool ShouldTileShine(ushort type, short frameX) { - ShouldTileShineMethod ??= typeof(TileDrawing).GetMethod("ShouldTileShine", BindingFlags.NonPublic | BindingFlags.Static); + ShouldTileShineMethod ??= typeof(TileDrawing).GetMethod("ShouldTileShine", NonPublicStatic); return (bool)ShouldTileShineMethod.Invoke(null, [type, frameX]); } } From ca68c9f5f3e60dcb39978597e8f925af291b35ef Mon Sep 17 00:00:00 2001 From: Flowaria Date: Sat, 12 Oct 2024 14:18:32 +0900 Subject: [PATCH 037/118] Updated Slice Rendering Logic --- .../TileMerging/TileBlendMergeSystem_Draw.cs | 62 +++++++++++-------- 1 file changed, 36 insertions(+), 26 deletions(-) diff --git a/Systems/TileMerging/TileBlendMergeSystem_Draw.cs b/Systems/TileMerging/TileBlendMergeSystem_Draw.cs index 98a2a2b445..207c4bc4ea 100644 --- a/Systems/TileMerging/TileBlendMergeSystem_Draw.cs +++ b/Systems/TileMerging/TileBlendMergeSystem_Draw.cs @@ -56,37 +56,20 @@ namespace CalamityMod.Systems Color tileLight = drawData.tileLight; if (tileLight.R <= 0 && tileLight.G <= 0 && tileLight.B <= 0) return; - + + // Generic Drawing Parameter + Vector2 drawPos = new Vector2(tileX * 16, tileY * 16) - screenPosition + screenOffset; + var tileRandomFrame = Math.Clamp(tile.TileFrameNumber, 0, 2); + var isFullBright = tile.IsTileFullbright; + + // Sliced Rendering + var sliceRenderingPrepared = false; var slices = drawData.colorSlices; int sliceLength = 0; var sliceRects = Array.Empty(); var sliceState = SliceState.None; var shouldTileShine = ShouldTileShine(tileType, (short)(drawData.tileFrameX + drawData.addFrX)); - // Is HalfBlock condition is also in vanilla, so we follow that - if (Lighting.NotRetro && !tile.IsHalfBlock && !TileID.Sets.DontDrawTileSliced[tileType]) - { - var midQualityThreshold = MediumQualityLightRequirement.Get(self); - var highQualityThreshold = HighQualityLightRequirement.Get(self); - if (tileLight.IsAnyChannelGreaterThan(highQualityThreshold)) - { - sliceLength = 9; - sliceState = SliceState.Slice_9; - sliceRects = Rects9Slice; - Lighting.GetColor9Slice(tileX, tileY, ref slices); - } - else if (tileLight.IsAnyChannelGreaterThan(midQualityThreshold)) - { - sliceLength = 4; - sliceState = SliceState.Slice_4; - sliceRects = Rects4Slice; - Lighting.GetColor4Slice(tileX, tileY, ref slices); - } - } - - Vector2 drawPos = new Vector2(tileX * 16, tileY * 16) - screenPosition + screenOffset; - var tileRandomFrame = Math.Clamp(tile.TileFrameNumber, 0, 2); - var isFullBright = tile.IsTileFullbright; var blendingData = tile.Get(); // Since we are not editing the value, we can just copy the values from here for (int idx = 0; idx < TileBlendingData.Length; idx++) { @@ -99,12 +82,39 @@ namespace CalamityMod.Systems var rect = TileBlendTexture.SideFlagsToSheetRect(data); var texture = TileBlendTextureLoader.Registry[sheetIdx].BlendTextures[tileRandomFrame]; + // Prepare Slice Rendering + if (!sliceRenderingPrepared) + { + // Is HalfBlock condition is also in vanilla, so we follow that + if (Lighting.NotRetro && !tile.IsHalfBlock && !TileID.Sets.DontDrawTileSliced[tileType]) + { + var midQualityThreshold = MediumQualityLightRequirement.Get(self); + var highQualityThreshold = HighQualityLightRequirement.Get(self); + if (tileLight.IsAnyChannelGreaterThan(highQualityThreshold)) + { + sliceLength = 9; + sliceState = SliceState.Slice_9; + sliceRects = Rects9Slice; + Lighting.GetColor9Slice(tileX, tileY, ref slices); + } + else if (tileLight.IsAnyChannelGreaterThan(midQualityThreshold)) + { + sliceLength = 4; + sliceState = SliceState.Slice_4; + sliceRects = Rects4Slice; + Lighting.GetColor4Slice(tileX, tileY, ref slices); + } + } + + sliceRenderingPrepared = true; + } + // No Slice Drawing if (sliceState == SliceState.None || isFullBright) { var drawColor = isFullBright ? Color.White : tileLight; Main.spriteBatch.Draw(texture, drawPos, rect, drawColor, rotation: 0.0f, origin: default, scale: 1.0f, SpriteEffects.None, layerDepth: 0.0f); - return; + continue; } // Sliced Drawing From 30a704bf0242ca2d6e236dae1c7d9254c9a8c714 Mon Sep 17 00:00:00 2001 From: Cameron Ewell Date: Wed, 13 Nov 2024 14:41:18 -0500 Subject: [PATCH 038/118] Fix typo in inlined alpha channel check --- Utilities/DrawingUtils.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utilities/DrawingUtils.cs b/Utilities/DrawingUtils.cs index 05d01e183d..9ed32533e5 100644 --- a/Utilities/DrawingUtils.cs +++ b/Utilities/DrawingUtils.cs @@ -597,7 +597,7 @@ namespace CalamityMod if (a.R > b.R) return true; if (a.G > b.G) return true; if (a.B > b.B) return true; - if (includeAlpha && a.A > b.B) return true; + if (includeAlpha && a.A > b.A) return true; return false; } From bd850464d15a84cf6ee4dad407befe07f113e9df Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Thu, 14 Nov 2024 03:10:57 +0700 Subject: [PATCH 039/118] Fishing changes (#955) See PR for details. Squashed due to illegal rebase. --- CalPlayer/CalamityPlayerFishing.cs | 750 ++++++------------ Enums/HardmodeCrateType.cs | 9 + Items/Accessories/AlluringBait.cs | 2 +- Items/Accessories/RustyMedallion.cs | 10 - .../SupremeBaitTackleBoxFishingStation.cs | 2 +- Items/BrokenWaterFilter.cs | 12 +- Items/CalamityGlobalItemLoot.cs | 149 ++-- Items/Fishing/AstralCatches/AstralCrate.cs | 72 +- Items/Fishing/AstralCatches/MonolithCrate.cs | 40 +- .../BrimstoneCragCatches/BrimstoneCrate.cs | 26 +- .../Fishing/BrimstoneCragCatches/SlagCrate.cs | 37 +- Items/Fishing/GrandMarquisBait.cs | 2 +- Items/Fishing/StuffedFish.cs | 9 +- .../SulphurCatches/HydrothermalCrate.cs | 86 +- .../Fishing/SulphurCatches/SulphurousCrate.cs | 78 +- .../SunkenSeaCatches/EutrophicCrate.cs | 50 +- Items/Fishing/SunkenSeaCatches/PrismCrate.cs | 61 +- Items/Placeables/Furniture/EffigyOfDecay.cs | 10 - Items/Weapons/Summon/RustyBeaconPrototype.cs | 12 +- .../Mods.CalamityMod.Items.Accessories.hjson | 18 +- Systems/Mechanic/RecipeSystem.cs | 16 - Utilities/DropHelper.cs | 366 ++++++++- 22 files changed, 757 insertions(+), 1060 deletions(-) create mode 100644 Enums/HardmodeCrateType.cs diff --git a/CalPlayer/CalamityPlayerFishing.cs b/CalPlayer/CalamityPlayerFishing.cs index 79e31c99bd..b88f777f11 100644 --- a/CalPlayer/CalamityPlayerFishing.cs +++ b/CalPlayer/CalamityPlayerFishing.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; using CalamityMod.Events; using CalamityMod.Items.Accessories; @@ -27,20 +28,52 @@ namespace CalamityMod.CalPlayer { public partial class CalamityPlayer : ModPlayer { + #region Modify Fishing Attempt + public override void ModifyFishingAttempt(ref FishingAttempt attempt) + { + if (enchantedPearl) + { + // If the player fails to roll a crate naturally and has Enchanted Pearl, reroll + // Stacking with existing probability, it should increase chances by 15% (12.5% with Crate Potion) + if (!attempt.crate) + attempt.crate = Main.rand.NextBool(6); + + // If the player does get a crate (can be from the reroll above), give it increased chances of being rarer + if (attempt.crate) + { + int uncommonRate = Math.Clamp(240 / attempt.fishingLevel, 3, 240); // Iron/Mythril (originally 300) + attempt.uncommon = Main.rand.NextBool(uncommonRate); + int rareRate = Math.Clamp(840 / attempt.fishingLevel, 4, 840); // Biome (originally 1050) + attempt.uncommon = Main.rand.NextBool(rareRate); + int veryRareRate = Math.Clamp(1800 / attempt.fishingLevel, 5, 1800); // Golden/Titanium (originally 2250) + attempt.uncommon = Main.rand.NextBool(veryRareRate); + } + } + } + #endregion + #region Catch Fish public override void CatchFish(FishingAttempt attempt, ref int itemDrop, ref int npcSpawn, ref AdvancedPopupRequest sonar, ref Vector2 sonarPosition) { + // If vanilla catches an enemy, just immediately cancel + if (npcSpawn > 0) + return; + int bait = attempt.playerFishingConditions.BaitItemType; - int power = attempt.playerFishingConditions.BaitPower + attempt.playerFishingConditions.PolePower; + int power = attempt.fishingLevel; int questFish = attempt.questFish; int poolSize = attempt.waterTilesCount; - bool water = !attempt.inHoney && !attempt.inLava; bool lava = attempt.inLava; bool honey = attempt.inHoney; - // If vanilla catches an enemy, just cancel - if (npcSpawn > 0) - return; + bool sky = attempt.heightLevel == 0; + bool surface = attempt.heightLevel == 1; + bool underground = attempt.heightLevel == 2; + bool cavern = attempt.heightLevel == 3; + bool underworld = attempt.heightLevel == 4; + + // Custom rate; increased by Enchanted Pearl + bool grabBagFish = attempt.uncommon && Main.rand.Next(100) < (enchantedPearl ? 30 : 15); // Set up for allowing fishing in the Sulphurous Sea Point point = Player.Center.ToTileCoordinates(); @@ -58,538 +91,210 @@ namespace CalamityMod.CalPlayer if (ZoneAbyss || ZoneSulphur) canSulphurFish = true; - // Old Duke spawn - if (canSulphurFish && bait == ModContent.ItemType() && water && !BossRushEvent.BossRushActive) - { - CalamityGlobalNPC.OldDukeSpawn(Player.whoAmI, ModContent.NPCType(), bait); - } - - // Don't do anything if you can't fish in lava - if (!attempt.CanFishInLava && lava) - return; - - // If you caught junk, then ignore all Calamity catches - if (itemDrop == ItemID.OldShoe || itemDrop == ItemID.FishingSeaweed || itemDrop == ItemID.TinCan) - return; - - // Handle our modded Quest Fish, You can catch these in any liquid... because I don't care if you can - if (ZoneSunkenSea && questFish == ModContent.ItemType() && attempt.uncommon) - { - itemDrop = ModContent.ItemType(); - return; - } - if (ZoneSunkenSea && questFish == ModContent.ItemType() && attempt.uncommon) - { - itemDrop = ModContent.ItemType(); - return; - } - if (ZoneSunkenSea && questFish == ModContent.ItemType() && attempt.uncommon) - { - itemDrop = ModContent.ItemType(); - return; - } - if (ZoneCalamity && questFish == ModContent.ItemType() && attempt.uncommon) - { - itemDrop = ModContent.ItemType(); - return; - } - if (ZoneCalamity && questFish == ModContent.ItemType() && attempt.uncommon) - { - itemDrop = ModContent.ItemType(); - return; - } - - // Handle Alluring Bait's increased chance for Potion Material fish - if (alluringBait) - { - int chanceForPotionFish = 1000 / power; - - if (chanceForPotionFish < 3) - chanceForPotionFish = 3; - - if (Main.rand.NextBool(chanceForPotionFish)) - { - List fishList = new List(); - - if (lava) - { - fishList.AddWithCondition(ItemID.FlarefinKoi, !ZoneCalamity); - fishList.AddWithCondition(ItemID.Obsidifish, !ZoneCalamity); - fishList.AddWithCondition(ModContent.ItemType(), ZoneCalamity); - fishList.AddWithCondition(ModContent.ItemType(), ZoneCalamity); - } - else if (water) - { - if (Player.ZoneDirtLayerHeight || Player.ZoneRockLayerHeight) - { - fishList.Add(ItemID.ArmoredCavefish); - fishList.Add(ItemID.Stinkfish); - fishList.Add(ItemID.SpecularFish); - fishList.AddWithCondition(ItemID.ChaosFish, Player.ZoneHallow); - fishList.AddWithCondition(ItemID.VariegatedLardfish, Player.ZoneJungle); - } - if (Player.ZoneOverworldHeight || Player.ZoneSkyHeight) - { - fishList.AddWithCondition(ItemID.DoubleCod, Player.ZoneJungle); - } - fishList.AddWithCondition(ItemID.FrostMinnow, Player.ZoneSnow); - fishList.AddWithCondition(ItemID.Ebonkoi, Player.ZoneCorrupt); - fishList.AddWithCondition(ItemID.CrimsonTigerfish, Player.ZoneCrimson); - fishList.AddWithCondition(ItemID.Hemopiranha, Player.ZoneCrimson); - fishList.AddWithCondition(ItemID.PrincessFish, Player.ZoneHallow); - fishList.AddWithCondition(ItemID.Prismite, Player.ZoneHallow); - fishList.AddWithCondition(ItemID.Damselfish, Player.ZoneSkyHeight); - fishList.AddWithCondition(ModContent.ItemType(), ZoneAstral); - fishList.AddWithCondition(ModContent.ItemType(), ZoneSunkenSea); - fishList.AddWithCondition(ModContent.ItemType(), !Main.dayTime && !Player.ZoneSkyHeight); - } - - if (fishList.Any()) - { - int fishAmt = fishList.Count; - int caughtFish = fishList[Main.rand.Next(fishAmt)]; - itemDrop = caughtFish; - return; - } - } - } - - // Handle the increased chance of crates from Enchanted Pearl and the Supreme Fishing Station - if (enchantedPearl || fishingStation) - { - int chanceForCrates = (enchantedPearl ? 10 : 0) + - (fishingStation ? 10 : 0); - - int poolSizeAmt = poolSize / 10; - if (poolSizeAmt > 100) - poolSizeAmt = 100; - - int fishingPowerDivisor = power + poolSizeAmt; - - int chanceForIronCrate = 1000 / fishingPowerDivisor; - int chanceForBiomeCrate = 2000 / fishingPowerDivisor; - int chanceForGoldCrate = 3000 / fishingPowerDivisor; - int chanceForRareItems = 4000 / fishingPowerDivisor; - - if (chanceForIronCrate < 3) - chanceForIronCrate = 3; - - if (chanceForBiomeCrate < 4) - chanceForBiomeCrate = 4; - - if (chanceForGoldCrate < 5) - chanceForGoldCrate = 5; - - if (chanceForRareItems < 6) - chanceForRareItems = 6; - - if (lava) - { - if (Main.rand.Next(100) < chanceForCrates) - { - if (Main.rand.NextBool(chanceForBiomeCrate)) - { - if (ZoneCalamity) - itemDrop = Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(); - else - itemDrop = Main.hardMode ? ItemID.LavaCrateHard : ItemID.LavaCrate; - } - if ((Main.rand.NextBool(chanceForRareItems) && enchantedPearl && fishingStation && Player.cratePotion) && ZoneCalamity) - { - itemDrop = ModContent.ItemType(); - } - } - } - - if (water) - { - if (Main.rand.Next(100) < chanceForCrates) - { - if (Main.rand.NextBool(chanceForRareItems) && enchantedPearl && fishingStation && Player.cratePotion) - { - List rareItemList = new List(); - - if (canSulphurFish) - { - switch (Main.rand.Next(2)) - { - case 0: - rareItemList.Add(ModContent.ItemType()); - break; - case 1: - rareItemList.Add(ModContent.ItemType()); - break; - } - } - if (ZoneAstral) - { - switch (Main.rand.Next(3)) - { - case 0: - rareItemList.Add(ModContent.ItemType()); - break; - case 1: - rareItemList.Add(ModContent.ItemType()); - break; - case 2: - rareItemList.Add(ModContent.ItemType()); - break; - } - } - if (ZoneSunkenSea) - { - switch (Main.rand.Next(3)) - { - case 0: - rareItemList.Add(ModContent.ItemType()); - break; - case 1: - rareItemList.Add(ModContent.ItemType()); - break; - case 2: - rareItemList.Add(ModContent.ItemType()); - break; - } - } - if (Player.ZoneSnow && Player.ZoneRockLayerHeight && (Player.ZoneCorrupt || Player.ZoneCrimson || Player.ZoneHallow)) - { - rareItemList.Add(ItemID.ScalyTruffle); - } - rareItemList.AddWithCondition(ItemID.Toxikarp, Player.ZoneCorrupt); - rareItemList.AddWithCondition(ItemID.Bladetongue, Player.ZoneCrimson); - rareItemList.AddWithCondition(ItemID.CrystalSerpent, Player.ZoneHallow); - - if (rareItemList.Any()) - { - int rareItemAmt = rareItemList.Count; - int caughtRareItem = rareItemList[Main.rand.Next(rareItemAmt)]; - itemDrop = caughtRareItem; - } - } - else if (Main.rand.NextBool(chanceForGoldCrate)) - { - itemDrop = Main.hardMode ? ItemID.GoldenCrateHard : ItemID.GoldenCrate; - } - else if (Main.rand.NextBool(chanceForBiomeCrate)) - { - List biomeCrateList = new List(); - - biomeCrateList.AddWithCondition(Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(), ZoneAstral); - biomeCrateList.AddWithCondition(Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(), ZoneSunkenSea); - biomeCrateList.AddWithCondition(Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(), canSulphurFish); - biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.CorruptFishingCrateHard : ItemID.CorruptFishingCrate, Player.ZoneCorrupt); - biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.CrimsonFishingCrateHard : ItemID.CrimsonFishingCrate, Player.ZoneCrimson); - biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.HallowedFishingCrateHard : ItemID.HallowedFishingCrate, Player.ZoneHallow); - biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.DungeonFishingCrateHard : ItemID.DungeonFishingCrate, Player.ZoneDungeon); - biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.JungleFishingCrateHard : ItemID.JungleFishingCrate, Player.ZoneJungle); - biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.FloatingIslandFishingCrateHard : ItemID.FloatingIslandFishingCrate, Player.ZoneSkyHeight); - biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.FrozenCrateHard : ItemID.FrozenCrate, Player.ZoneSnow); - biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.OasisCrateHard : ItemID.OasisCrate, Player.ZoneDesert && !Player.ZoneBeach); - biomeCrateList.AddWithCondition(Main.hardMode ? ItemID.OceanCrateHard : ItemID.OceanCrate, Player.ZoneBeach); - - if (biomeCrateList.Any()) - { - int biomeCrateAmt = biomeCrateList.Count; - int caughtBiomeCrate = biomeCrateList[Main.rand.Next(biomeCrateAmt)]; - itemDrop = caughtBiomeCrate; - } - } - else if (Main.rand.NextBool(chanceForIronCrate)) - { - itemDrop = Main.hardMode ? ItemID.IronCrateHard : ItemID.IronCrate; - } - else - { - itemDrop = Main.hardMode ? ItemID.WoodenCrateHard : ItemID.WoodenCrate; - } - return; - } - } - } - - if (water) - { - // Handle Calamity's crates, veryrare and legendary means it's a Golden Crate - if (attempt.crate) - { - if (attempt.rare && !attempt.veryrare && !attempt.legendary) - { - if (ZoneAstral) - { - itemDrop = Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(); - } - if (ZoneSunkenSea) - { - itemDrop = Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(); - } - if (canSulphurFish) - { - itemDrop = Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(); - } - } - return; - } - - // Don't override the vanilla crates or any special vanilla fishing loot - List keepCatchList = new List() - { - ItemID.WoodenCrate, - ItemID.WoodenCrateHard, - ItemID.IronCrate, - ItemID.IronCrateHard, - ItemID.GoldenCrate, - ItemID.GoldenCrateHard, - ItemID.FrogLeg, - ItemID.BalloonPufferfish, - ItemID.ZephyrFish, - ItemID.CombatBook, - ItemID.CorruptFishingCrate, - ItemID.CorruptFishingCrateHard, - ItemID.CrimsonFishingCrate, - ItemID.CrimsonFishingCrateHard, - ItemID.HallowedFishingCrate, - ItemID.HallowedFishingCrateHard, - ItemID.DungeonFishingCrate, - ItemID.DungeonFishingCrateHard, - ItemID.JungleFishingCrate, - ItemID.JungleFishingCrateHard, - ItemID.FloatingIslandFishingCrate, - ItemID.FloatingIslandFishingCrateHard, - ItemID.FrozenCrate, - ItemID.FrozenCrateHard, - ItemID.OasisCrate, - ItemID.OasisCrateHard, - ItemID.OceanCrate, - ItemID.OceanCrateHard - }; - if (keepCatchList.Contains(itemDrop)) - { - return; - } - - if ((Player.ZoneCrimson || Player.ZoneCorrupt) && Player.ZoneRockLayerHeight && Main.hardMode) - { - if (attempt.uncommon && Main.rand.NextBool(7)) - { - itemDrop = ModContent.ItemType(); - } - } - - if (Player.ZoneHallow && Player.ZoneRockLayerHeight && Main.hardMode) - { - if (attempt.uncommon && Main.rand.NextBool(7)) - { - itemDrop = ModContent.ItemType(); - } - } - - if (Player.ZoneSkyHeight && Main.hardMode) - { - if (attempt.uncommon && Main.rand.NextBool(7)) - { - itemDrop = Main.rand.NextBool() ? ModContent.ItemType() : ModContent.ItemType(); - } - } - - // Increased chance of Enchanted Starfish if you don't have maximum mana - if (Player.ZoneOverworldHeight && !Main.dayTime) - { - int chance = Player.statManaMax < 200 ? 5 : 20; - if (attempt.uncommon && Main.rand.NextBool(chance)) - { - itemDrop = ModContent.ItemType(); - } - } - - if (!Player.ZoneSkyHeight && !Main.dayTime) - { - if (attempt.uncommon && Main.rand.NextBool(10)) - { - itemDrop = ModContent.ItemType(); - } - } - - if (Player.ZoneOverworldHeight && Main.dayTime) - { - if (attempt.uncommon && Main.rand.NextBool(7)) - { - itemDrop = ModContent.ItemType(); - } - } - - if (Player.ZoneRockLayerHeight) - { - if (attempt.uncommon && Main.rand.NextBool(7)) - { - itemDrop = ModContent.ItemType(); - } - } - - if (Player.ZoneSnow && Main.hardMode) - { - if (attempt.uncommon && Main.rand.NextBool(7)) - { - itemDrop = ModContent.ItemType(); - } - } - - // Lower chance of Spadefish in Hardmode - if (Player.ZoneDirtLayerHeight) - { - int chance = Main.hardMode ? 10 : 2; - if (attempt.veryrare && Main.rand.NextBool(chance)) - { - itemDrop = ModContent.ItemType(); - } - } - - if (Player.FindBuffIndex(BuffID.Gills) > -1 && DownedBossSystem.downedLeviathan && (attempt.legendary || (attempt.veryrare && Main.rand.NextBool()))) - { - itemDrop = ModContent.ItemType(); - } - - if (Player.ZoneOverworldHeight && Main.bloodMoon) - { - if (attempt.uncommon && Main.rand.NextBool(7)) - { - itemDrop = ModContent.ItemType(); - } - } - - if (ZoneAstral) // Astral Infection, fishing in water - { - if (attempt.legendary) - { - int legendaryCatch = Utils.SelectRandom(Main.rand, new int[] - { - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() - }); - itemDrop = legendaryCatch; - } - else if (attempt.uncommon || attempt.rare || attempt.veryrare) - { - int uncommonCatch = Utils.SelectRandom(Main.rand, new int[] - { - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() - }); - itemDrop = uncommonCatch; - } - else - { - itemDrop = ModContent.ItemType(); - return; - } - } - - if (ZoneSunkenSea) // Sunken Sea, fishing in water - { - if (attempt.legendary) - { - List legendaryCatches = new List() - { - ModContent.ItemType() - }; - legendaryCatches.AddWithCondition(ModContent.ItemType(), DownedBossSystem.downedDesertScourge); - legendaryCatches.AddWithCondition(ModContent.ItemType(), Main.hardMode); - itemDrop = legendaryCatches[Main.rand.Next(legendaryCatches.Count)]; - } - else if (attempt.veryrare) - { - itemDrop = ModContent.ItemType(); - } - else if (attempt.uncommon || attempt.rare) - { - itemDrop = ModContent.ItemType(); - } - else - { - itemDrop = ModContent.ItemType(); - return; - } - } - - // There is no complete fishing pool here, so most of it is vanilla default - if (canSulphurFish) // Sulphurous Sea, fishing in water - { - if (attempt.legendary || (attempt.veryrare && Main.rand.NextBool())) - { - itemDrop = Utils.SelectRandom(Main.rand, new int[] - { - ModContent.ItemType(), - ModContent.ItemType() - }); - } - else if (attempt.common) - { - itemDrop = ModContent.ItemType(); - } - } - - /*if (canSulphurFish && (bait.type == ItemID.GoldWorm || bait.type == ItemID.GoldGrasshopper || bait.type == ItemID.GoldButterfly) && power > 150) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - CalamityGlobalNPC.OldDukeSpawn(player.whoAmI, ModContent.NPCType()); - } - else - { - NetMessage.SendData(61, -1, -1, null, player.whoAmI, (float)ModContent.NPCType(), 0f, 0f, 0, 0, 0); - } - switch (Main.rand.Next(4)) - { - case 0: itemDrop = ModContent.ItemType(); break; //movement acc - case 1: itemDrop = ModContent.ItemType(); break; //regen acc - case 2: itemDrop = ModContent.ItemType(); break; //defense acc - case 3: itemDrop = ModContent.ItemType(); break; //light pet - } - return; - }*/ - } - + // Fishing in lava overrides the rest of logic if (lava) { - if (ZoneCalamity) // Brimstone Crags, fishing in lava + // Don't do anything if you can't fish in lava + if (!attempt.CanFishInLava) + return; + + if (ZoneCalamity) { - if (attempt.crate) - { + // Crates have highest priority + if (attempt.crate && attempt.rare) itemDrop = Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(); - } else if (attempt.legendary) - { itemDrop = ModContent.ItemType(); - } - // Increased chance of Dragoon Drizzlefish in Prehardmode - else if (attempt.veryrare && !Main.hardMode) - { - itemDrop = ModContent.ItemType(); - } else if (attempt.veryrare) - { itemDrop = ModContent.ItemType(); - } - else if ((attempt.rare || attempt.veryrare) && DownedBossSystem.downedProvidence && Main.rand.Next(3) >= 2) - { + else if (DownedBossSystem.downedProvidence && ((attempt.rare && Main.rand.NextBool(2)) || (attempt.uncommon && Main.rand.NextBool(4)))) itemDrop = ModContent.ItemType(); - } - else if (attempt.uncommon || attempt.rare) + // Quest fish hover around this priority + else if (questFish == ModContent.ItemType() && attempt.uncommon) + itemDrop = ModContent.ItemType(); + else if (questFish == ModContent.ItemType() && attempt.uncommon) + itemDrop = ModContent.ItemType(); + else if (grabBagFish && Main.hardMode) + itemDrop = ModContent.ItemType(); + else if (attempt.rare) { List uncommonCatches = new List() { ModContent.ItemType(), ModContent.ItemType() }; - uncommonCatches.AddWithCondition(ModContent.ItemType(), Main.hardMode); itemDrop = uncommonCatches[Main.rand.Next(uncommonCatches.Count)]; } + // Lava fish usually don't have plentiful catches but we can be more lenient else - { itemDrop = ModContent.ItemType(); - } } + return; + } + + // Honey also overrides logic but we have nothing to catch from honey... for now + if (honey) + return; + + // Old Duke spawn + if (canSulphurFish && bait == ModContent.ItemType() && !BossRushEvent.BossRushActive) + { + CalamityGlobalNPC.OldDukeSpawn(Player.whoAmI, ModContent.NPCType(), bait); + } + + // Ignore catches if it's junk + if (itemDrop == ItemID.OldShoe || itemDrop == ItemID.FishingSeaweed || itemDrop == ItemID.TinCan || itemDrop == ItemID.JojaCola) + return; + + if (attempt.crate) + { + // This can override Golden/Titanium Crates, but so do vanilla biome crates + // Those are still obtainable if the catch is very rare/legendary but not rare (fishing oddities) + if (attempt.rare) + { + if (ZoneAstral) + itemDrop = Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(); + if (ZoneSunkenSea) + itemDrop = Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(); + if (canSulphurFish) + itemDrop = Main.hardMode ? ModContent.ItemType() : ModContent.ItemType(); + } + return; + } + + // Ignore all top priority legendary vanilla catches + List keepCatchList = new List() + { + ItemID.CombatBook, + ItemID.DreadoftheRedSea, + ItemID.FrogLeg, + ItemID.BalloonPufferfish, + ItemID.ZephyrFish + }; + if (keepCatchList.Contains(itemDrop)) + return; + + // Add top priorities of our own + if (DownedBossSystem.downedLeviathan && attempt.legendary && poolSize > 1000) + { + itemDrop = ModContent.ItemType(); + return; + } + + if (grabBagFish) + { + if (surface && Main.bloodMoon) + itemDrop = ModContent.ItemType(); + else if (surface && Main.dayTime) + itemDrop = ModContent.ItemType(); + else if (cavern) + itemDrop = ModContent.ItemType(); + if (Main.hardMode) + { + // Fish of Light/Night are evenly split with Gemfish + if ((Player.ZoneCrimson || Player.ZoneCorrupt) && cavern && Main.rand.NextBool()) + itemDrop = ModContent.ItemType(); + else if (Player.ZoneHallow && cavern && Main.rand.NextBool()) + itemDrop = ModContent.ItemType(); + else if (Player.ZoneSnow) + itemDrop = ModContent.ItemType(); + else if (sky) + itemDrop = Main.rand.NextBool() ? ModContent.ItemType() : ModContent.ItemType(); + } + } + + // Increased chance of Enchanted Starfish if you don't have maximum mana + if (surface && !Main.dayTime) // Surface + { + int chance = (Player.ConsumedManaCrystals >= Player.ManaCrystalMax) ? 20 : 5; + if (attempt.uncommon && Main.rand.NextBool(chance)) + itemDrop = ModContent.ItemType(); + + if (attempt.uncommon && Main.rand.NextBool(10)) + itemDrop = ModContent.ItemType(); + } + + // Lower chance of Spadefish in Hardmode + if (underground) // Underground + { + int chance = Main.hardMode ? 10 : 2; + if (attempt.veryrare && Main.rand.NextBool(chance)) + { + itemDrop = ModContent.ItemType(); + } + } + + if (ZoneAstral) + { + if (attempt.legendary) + { + int legendaryCatch = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + }); + itemDrop = legendaryCatch; + } + else if (attempt.veryrare) + itemDrop = ModContent.ItemType(); + else if (attempt.uncommon || attempt.rare) + { + int uncommonCatch = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.ItemType(), + ModContent.ItemType() + }); + itemDrop = uncommonCatch; + } + else + itemDrop = ModContent.ItemType(); + return; + } + if (ZoneSunkenSea) + { + // If the player is overlapping with the desert, split the catches + if (Player.ZoneDesert && Main.rand.NextBool()) + return; + + if (attempt.legendary) + { + List legendaryCatches = new List() + { + ModContent.ItemType() + }; + legendaryCatches.AddWithCondition(ModContent.ItemType(), DownedBossSystem.downedDesertScourge); + legendaryCatches.AddWithCondition(ModContent.ItemType(), Main.hardMode); + itemDrop = legendaryCatches[Main.rand.Next(legendaryCatches.Count)]; + } + else if (attempt.veryrare) + itemDrop = ModContent.ItemType(); + // Quest fish hover around this priority + else if (questFish == ModContent.ItemType() && attempt.uncommon) + itemDrop = ModContent.ItemType(); + else if (questFish == ModContent.ItemType() && attempt.uncommon) + itemDrop = ModContent.ItemType(); + else if (questFish == ModContent.ItemType() && attempt.uncommon) + itemDrop = ModContent.ItemType(); + else if (attempt.uncommon || attempt.rare) + itemDrop = ModContent.ItemType(); + else + itemDrop = ModContent.ItemType(); + return; + } + // There is no complete fishing pool here, so most of it is vanilla default + if (canSulphurFish) + { + if (attempt.legendary) + { + itemDrop = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.ItemType(), + ModContent.ItemType() + }); + } + else if (attempt.common && Main.rand.NextBool()) + itemDrop = ModContent.ItemType(); } } #endregion @@ -597,6 +302,7 @@ namespace CalamityMod.CalPlayer #region Get Fishing Level public override void GetFishingLevel(Item fishingRod, Item bait, ref float fishingLevel) { + // Note: This is calculated after equipments (Rod, Bait, Potions, etc) and before modifications (Chum Buckets, Luck) if ((ZoneAstral || ZoneAbyss || ZoneSulphur) && bait.type == ModContent.ItemType()) fishingLevel = fishingLevel * ArcturusAstroidean.FishingPowerBiomeMult; if (Player.ZoneSnow && fishingRod.type == ModContent.ItemType()) @@ -634,9 +340,10 @@ namespace CalamityMod.CalPlayer } #endregion - #region Get Fishing Level + #region Modify Caught Fish public override void ModifyCaughtFish(Item fish) { + // Increases the yield of potion ingredient fish with Alluring Bait if (alluringBait) { List fishList = new List() @@ -663,10 +370,7 @@ namespace CalamityMod.CalPlayer }; if (fishList.Contains(fish.type)) - { - // Increase the yield by 1 or 2 - fish.stack += Main.rand.NextBool() ? 1 : 2; - } + fish.stack += Main.rand.Next(1, 3 + 1); } } #endregion diff --git a/Enums/HardmodeCrateType.cs b/Enums/HardmodeCrateType.cs new file mode 100644 index 0000000000..6febfd2600 --- /dev/null +++ b/Enums/HardmodeCrateType.cs @@ -0,0 +1,9 @@ +namespace CalamityMod.Enums +{ + public enum HardmodeCrateType + { + Biome, + Mythril, + Titanium + } +} diff --git a/Items/Accessories/AlluringBait.cs b/Items/Accessories/AlluringBait.cs index 1a5383e4b1..786435906e 100644 --- a/Items/Accessories/AlluringBait.cs +++ b/Items/Accessories/AlluringBait.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { player.Calamity().alluringBait = true; - player.fishingSkill += 30; + player.fishingSkill += 10; } } } diff --git a/Items/Accessories/RustyMedallion.cs b/Items/Accessories/RustyMedallion.cs index 52d7328429..b7d0e8f3a1 100644 --- a/Items/Accessories/RustyMedallion.cs +++ b/Items/Accessories/RustyMedallion.cs @@ -1,6 +1,5 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; -using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -30,14 +29,5 @@ namespace CalamityMod.Items.Accessories modPlayer.RustyMedallionDroplets = true; player.buffImmune[ModContent.BuffType()] = true; } - - public override void AddRecipes() - { - CreateRecipe(). - AddRecipeGroup("AnySilverBar", 10). - AddIngredient(3). - AddTile(TileID.Anvils). - Register(); - } } } diff --git a/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs b/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs index bf385bc526..5c1034b6db 100644 --- a/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs +++ b/Items/Accessories/SupremeBaitTackleBoxFishingStation.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - player.fishingSkill += 80; + player.fishingSkill += 50; player.accFishingLine = true; player.accTackleBox = true; player.accLavaFishing = true; diff --git a/Items/BrokenWaterFilter.cs b/Items/BrokenWaterFilter.cs index d1988055a3..ffb03203aa 100644 --- a/Items/BrokenWaterFilter.cs +++ b/Items/BrokenWaterFilter.cs @@ -1,5 +1,4 @@ -using CalamityMod.Items.Materials; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; using Microsoft.Xna.Framework.Graphics; @@ -87,14 +86,5 @@ namespace CalamityMod.Items text = GetTextValue("Items.Misc.SpawnBlockersOff"); tooltips.FindAndReplace("[STATE]", text); } - - public override void AddRecipes() - { - CreateRecipe(). - AddRecipeGroup("IronBar", 10). - AddIngredient(). - AddTile(TileID.Anvils). - Register(); - } } } diff --git a/Items/CalamityGlobalItemLoot.cs b/Items/CalamityGlobalItemLoot.cs index 7b41779c8a..2df054f082 100644 --- a/Items/CalamityGlobalItemLoot.cs +++ b/Items/CalamityGlobalItemLoot.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using CalamityMod.Enums; using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.PermanentBoosters; @@ -25,12 +26,6 @@ namespace CalamityMod.Items public override void ModifyItemLoot(Item item, ItemLoot loot) { Fraction fifteenPercent = new Fraction(15, 100); - static bool CryonicAvailable() - { - if (!DownedBossSystem.downedCryogen) - return false; - return (NPC.downedMechBoss1.ToInt() + NPC.downedMechBoss2.ToInt() + NPC.downedMechBoss3.ToInt()) >= 2; - } switch (item.type) { @@ -275,91 +270,49 @@ namespace CalamityMod.Items #endregion #region Fishing Crates - // TODO -- What is all this shit? + // Kylie @ 1% (yes this is the consistent rate, dw it's not hard to get one of these) case ItemID.WoodenCrate: case ItemID.WoodenCrateHard: - loot.Add(ModContent.ItemType(), 4, 3, 5); // 25% 3-5 Wulfrum Scrap - loot.Add(ModContent.ItemType(), 20); + loot.Add(ModContent.ItemType(), 100); + // We do not need to pop Hardmode ores out of Pearlwood Crates. They do not drop higher tier ores. break; - case ItemID.IronCrate: case ItemID.IronCrateHard: - loot.Add(ModContent.ItemType(), 4, 5, 8); // 25% 5-8 Wulfrum Scrap - loot.Add(ModContent.ItemType(), 4, 5, 8); // 25% 5-8 Ancient Bone Dust + RemoveHardmodeOresFromStandardCrates(loot); + loot.AddHardmodeOresToCrates(HardmodeCrateType.Mythril); break; - // these drops are not available in hardmode because this crate will stop dropping + // Non-crafted underground Gold Chest loot @ 20%; Individually 5% case ItemID.GoldenCrate: - loot.Add(ItemID.FlareGun, 10); // 10% Flare Gun - loot.Add(ItemID.ShoeSpikes, 10); // 10% Shoe Spikes (BUT NOT CLIMBING CLAWS?) - loot.Add(ItemID.BandofRegeneration, 10); // 10% Band of Regeneration + loot.Add(new OneFromOptionsNotScaledWithLuckDropRule(5, 1, + ItemID.FlareGun, + ItemID.Mace, + ItemID.BandofRegeneration, + ItemID.ShoeSpikes)); // Climbing Claws is in Wooden/Pearlwood (vanilla) in case you're curious break; case ItemID.GoldenCrateHard: - // Post-Yharon: 15% 30-40 Auric Ore - loot.AddIf(() => DownedBossSystem.downedYharon, ModContent.ItemType(), fifteenPercent, 30, 40); + RemoveHardmodeOresFromStandardCrates(loot); + loot.AddHardmodeOresToCrates(HardmodeCrateType.Titanium); + loot.Add(new OneFromOptionsNotScaledWithLuckDropRule(5, 1, + ItemID.FlareGun, + ItemID.Mace, + ItemID.BandofRegeneration, + ItemID.ShoeSpikes)); break; - case ItemID.CorruptFishingCrate: - case ItemID.CrimsonFishingCrate: case ItemID.CorruptFishingCrateHard: case ItemID.CrimsonFishingCrateHard: - loot.Add(ModContent.ItemType(), fifteenPercent, 5, 8); // 15% 5-8 Blighted Gel - break; - - case ItemID.HallowedFishingCrate: // WHY case ItemID.HallowedFishingCrateHard: - var postProv = loot.DefineConditionalDropSet(() => DownedBossSystem.downedProvidence); - postProv.Add(ModContent.ItemType(), fifteenPercent, 5, 10); // 15% 5-10 Unholy Essence - break; - - case ItemID.DungeonFishingCrate: case ItemID.DungeonFishingCrateHard: - loot.AddIf(() => NPC.downedPlantBoss, ItemID.Ectoplasm, 10, 1, 5); // 10% 1-5 Ectoplasm - loot.AddIf(() => DownedBossSystem.downedPolterghast, ModContent.ItemType(), 10, 1, 5); // 10% 1-5 Necroplasm - break; - - case ItemID.JungleFishingCrate: case ItemID.JungleFishingCrateHard: - var postPlant = loot.DefineConditionalDropSet(() => NPC.downedPlantBoss); - postPlant.Add(ModContent.ItemType(), 5, 16, 28); // 20% 16-28 Perennial Ore - postPlant.Add(ModContent.ItemType(), fifteenPercent, 4, 7); // 15% 4-7 Perennial Bar - loot.AddIf(() => NPC.downedGolemBoss, ModContent.ItemType(), 5, 3, 6); // 20% 3-6 Plague Cell Canister - var uelibloom = loot.DefineConditionalDropSet(() => DownedBossSystem.downedProvidence); - uelibloom.Add(ModContent.ItemType(), 5, 16, 28); // 20% 16-28 Uelibloom Ore - uelibloom.Add(ModContent.ItemType(), fifteenPercent, 4, 7); // 15% 4-7 Uelibloom Bar - break; - - case ItemID.FloatingIslandFishingCrate: case ItemID.FloatingIslandFishingCrateHard: - var evilBossTwo = loot.DefineConditionalDropSet(() => DownedBossSystem.downedHiveMind || DownedBossSystem.downedPerforator); - evilBossTwo.Add(ModContent.ItemType(), 5, 16, 28); // 20% 16-28 Aerialite Ore - evilBossTwo.Add(ModContent.ItemType(), fifteenPercent, 4, 7); // 15% 4-7 Aerialite Bar - loot.AddIf(() => Main.hardMode, ModContent.ItemType(), 5, 2, 4); // 20% 2-4 Essence of Sunlight - loot.AddIf(() => NPC.downedMoonlord, ModContent.ItemType(), 5, 16, 28); // 20% 16-28 Exodium Clusters - break; - - case ItemID.FrozenCrate: case ItemID.FrozenCrateHard: - var cryonic = loot.DefineConditionalDropSet(CryonicAvailable); - cryonic.Add(ModContent.ItemType(), 5, 16, 28); // 20% 16-28 Cryonic Ore - cryonic.Add(ModContent.ItemType(), fifteenPercent, 4, 7); // 15% 4-7 Cryonic Bar - loot.AddIf(() => Main.hardMode, ModContent.ItemType(), 5, 2, 4); // 20% 2-4 Essence of Eleum - break; - - case ItemID.LavaCrate: case ItemID.LavaCrateHard: - loot.AddIf(() => Main.hardMode, ModContent.ItemType(), 5, 2, 4); // 20% 2-4 Essence of Havoc - break; - - // Calamity does not touch Oasis Crates yet - case ItemID.OasisCrate: case ItemID.OasisCrateHard: - break; - - // Calamity does not touch Ocean Crates yet - case ItemID.OceanCrate: case ItemID.OceanCrateHard: + RemoveHardmodeOresFromBiomeCrates(loot); + loot.AddHardmodeOresToCrates(HardmodeCrateType.Biome); break; #endregion @@ -530,6 +483,66 @@ namespace CalamityMod.Items } #endregion + #region Fishing Crate Loot Rule Manipulation + private static void RemoveHardmodeOresFromStandardCrates(ItemLoot loot) + { + List rules = loot.Get(false); + + // This is the primary rule which contains every drop + AlwaysAtleastOneSuccessDropRule mainRule = null; + foreach (IItemDropRule rule in rules) + if (rule is AlwaysAtleastOneSuccessDropRule a) + mainRule = a; + if (mainRule is null) + return; + + // Find ones that are supposed to be for the ore and not the other loot + foreach (IItemDropRule rule in mainRule.rules) + { + // Hardmode ores/bars are both nested within *another* nested rule + if (rule is SequentialRulesNotScalingWithLuckRule oreRule) + { + // Confirm that this is for the ore/bar then pop the numerator for the big rule + foreach (IItemDropRule nestedRule in oreRule.rules) + { + if (nestedRule is SequentialRulesNotScalingWithLuckRule s) + { + oreRule.chanceNumerator = 0; + return; + } + } + } + } + } + + private static void RemoveHardmodeOresFromBiomeCrates(ItemLoot loot) + { + List rules = loot.Get(false); + + // This is the primary rule which contains every drop + AlwaysAtleastOneSuccessDropRule mainRule = null; + foreach (IItemDropRule rule in rules) + if (rule is AlwaysAtleastOneSuccessDropRule a) + mainRule = a; + if (mainRule is null) + return; + + foreach (IItemDropRule rule in mainRule.rules) + { + // 2 rules, one for ore and another for bar, nested within *another* nested rule + if (rule is SequentialRulesNotScalingWithLuckRule oreRule) + { + // Confirm that this is for the ore/bar then pop the numerator for the big rule + foreach (IItemDropRule nestedRule in oreRule.rules) + { + if (nestedRule is OneFromRulesRule o) + oreRule.chanceNumerator = 0; + } + } + } + } + #endregion + #region Goodie Bag Bat Hook private static void RemoveBatHookFromGoodieBag(ItemLoot loot) { diff --git a/Items/Fishing/AstralCatches/AstralCrate.cs b/Items/Fishing/AstralCatches/AstralCrate.cs index 690c4c8e8b..75ca58ba4b 100644 --- a/Items/Fishing/AstralCatches/AstralCrate.cs +++ b/Items/Fishing/AstralCatches/AstralCrate.cs @@ -1,16 +1,6 @@ -using CalamityMod.Items.Accessories; -using CalamityMod.Items.Critters; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Ores; -using CalamityMod.Items.Potions; -using CalamityMod.Items.Weapons.Magic; -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Tiles.Astral; using Terraria; -using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; @@ -29,18 +19,10 @@ namespace CalamityMod.Items.Fishing.AstralCatches public override void SetDefaults() { - Item.width = 32; - Item.height = 32; - Item.maxStack = 9999; - Item.consumable = true; - Item.rare = ItemRarityID.Green; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 32; Item.value = Item.sellPrice(gold: 1); - Item.createTile = ModContent.TileType(); - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Green; } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) @@ -51,48 +33,14 @@ namespace CalamityMod.Items.Fishing.AstralCatches public override bool CanRightClick() => true; public override void ModifyItemLoot(ItemLoot itemLoot) { - var postAstrumAureus = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedAstrumAureus); - var postAstrumDeus = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedAstrumDeus); + // 4-10 Starblight Soot @ 50% + // This is our equivalent to Crystal Shards/Ichor + itemLoot.Add(ModContent.ItemType(), 2, 4, 10); - // Materials - itemLoot.Add(ModContent.ItemType(), 1, 5, 10); - itemLoot.Add(ItemID.FallenStar, 1, 5, 10); - itemLoot.Add(ItemID.Meteorite, 5, 10, 20); - itemLoot.Add(ItemID.MeteoriteBar, 10, 1, 3); + // Astrophage @ 5% + itemLoot.Add(ModContent.ItemType(), 20); - postAstrumAureus.Add(ModContent.ItemType(), 5, 2, 5); - postAstrumDeus.Add(ModContent.ItemType(), 5, 10, 20); - postAstrumDeus.Add(ModContent.ItemType(), 10, 1, 3); - postAstrumDeus.Add(ModContent.ItemType(), 4, 5, 10); - - // Weapons (and Starburster Core) - postAstrumAureus.Add(new OneFromOptionsDropRule(10, 1, - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() - )); - - // Pet - itemLoot.Add(ModContent.ItemType(), 10); - - // Bait - itemLoot.Add(ModContent.ItemType(), 5, 1, 3); - itemLoot.Add(ItemID.EnchantedNightcrawler, 5, 1, 3); - itemLoot.Add(ModContent.ItemType(), 5, 1, 3); - itemLoot.Add(ItemID.Firefly, 3, 1, 3); - - // Potions - postAstrumAureus.Add(ModContent.ItemType(), 10, 1, 3); - postAstrumAureus.Add(ModContent.ItemType(), 10, 1, 3); - itemLoot.AddCratePotionRules(); - - // Money - itemLoot.Add(ItemID.SilverCoin, 1, 10, 90); - itemLoot.Add(ItemID.GoldCoin, 2, 1, 5); + itemLoot.AddBiomeCrateLootRules(); } } } diff --git a/Items/Fishing/AstralCatches/MonolithCrate.cs b/Items/Fishing/AstralCatches/MonolithCrate.cs index 060d03675b..736bd5ba2e 100644 --- a/Items/Fishing/AstralCatches/MonolithCrate.cs +++ b/Items/Fishing/AstralCatches/MonolithCrate.cs @@ -1,5 +1,4 @@ -using CalamityMod.Items.Critters; -using CalamityMod.Tiles.Astral; +using CalamityMod.Tiles.Astral; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,18 +16,10 @@ namespace CalamityMod.Items.Fishing.AstralCatches public override void SetDefaults() { - Item.width = 32; - Item.height = 32; - Item.maxStack = 9999; - Item.consumable = true; - Item.rare = ItemRarityID.Green; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 32; Item.value = Item.sellPrice(gold: 1); - Item.createTile = ModContent.TileType(); - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Green; } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) @@ -39,27 +30,10 @@ namespace CalamityMod.Items.Fishing.AstralCatches public override bool CanRightClick() => true; public override void ModifyItemLoot(ItemLoot itemLoot) { - // Materials - itemLoot.Add(ItemID.FallenStar, 1, 5, 10); - itemLoot.Add(ItemID.Meteorite, 5, 10, 20); - itemLoot.Add(ItemID.MeteoriteBar, 10, 1, 3); + // Astrophage @ 5% + itemLoot.Add(ModContent.ItemType(), 20); - // Pet - itemLoot.Add(ModContent.ItemType(), 10); - - // Bait - itemLoot.Add(ModContent.ItemType(), 5, 1, 3); - itemLoot.Add(ItemID.EnchantedNightcrawler, 5, 1, 3); - itemLoot.Add(ModContent.ItemType(), 5, 1, 3); - - itemLoot.Add(ItemID.Firefly, 3, 1, 3); - - // Potions - itemLoot.AddCratePotionRules(false); - - // Money - itemLoot.Add(ItemID.SilverCoin, 1, 10, 90); - itemLoot.Add(ItemID.GoldCoin, 2, 1, 5); + itemLoot.AddBiomeCrateLootRules(false); } } } diff --git a/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs b/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs index 9346ddecb4..fb5785cf59 100644 --- a/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs +++ b/Items/Fishing/BrimstoneCragCatches/BrimstoneCrate.cs @@ -1,6 +1,4 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Potions; -using CalamityMod.Tiles.Crags; +using CalamityMod.Tiles.Crags; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -42,27 +40,7 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches public override bool CanRightClick() => true; public override void ModifyItemLoot(ItemLoot itemLoot) { - // Materials - itemLoot.Add(ItemID.Obsidian, 1, 2, 5); - itemLoot.Add(ItemID.Hellstone, 4, 2, 5); - itemLoot.Add(ItemID.HellstoneBar, 10, 1, 3); - itemLoot.AddIf(() => DownedBossSystem.downedBrimstoneElemental, ModContent.ItemType(), 10, 1, 3); - itemLoot.AddIf(() => DownedBossSystem.downedProvidence, ModContent.ItemType(), 2, 1, 3); - - // Weapons (none) - - // Bait - itemLoot.Add(ItemID.MasterBait, 10, 1, 2); - itemLoot.Add(ItemID.JourneymanBait, 5, 1, 3); - itemLoot.Add(ItemID.ApprenticeBait, 3, 2, 3); - - // Potions - itemLoot.Add(ItemID.InfernoPotion, 10, 1, 3); - itemLoot.AddCratePotionRules(); - - // Money - itemLoot.Add(ItemID.SilverCoin, 1, 10, 90); - itemLoot.Add(ItemID.GoldCoin, 2, 1, 5); + itemLoot.AddBiomeCrateLootRules(); } } } diff --git a/Items/Fishing/BrimstoneCragCatches/SlagCrate.cs b/Items/Fishing/BrimstoneCragCatches/SlagCrate.cs index 0afec68579..ea62747e86 100644 --- a/Items/Fishing/BrimstoneCragCatches/SlagCrate.cs +++ b/Items/Fishing/BrimstoneCragCatches/SlagCrate.cs @@ -1,5 +1,4 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Tiles.Crags; +using CalamityMod.Tiles.Crags; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,18 +16,10 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches public override void SetDefaults() { - Item.width = 32; - Item.height = 32; - Item.maxStack = 9999; - Item.consumable = true; - Item.rare = ItemRarityID.Green; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 32; Item.value = Item.sellPrice(gold: 1); - Item.createTile = ModContent.TileType(); - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Green; } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) @@ -39,25 +30,7 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches public override bool CanRightClick() => true; public override void ModifyItemLoot(ItemLoot itemLoot) { - // Materials - itemLoot.Add(ItemID.Obsidian, 1, 2, 5); - itemLoot.Add(ItemID.Hellstone, 4, 2, 5); - itemLoot.Add(ItemID.HellstoneBar, 10, 1, 3); - - // Weapons (none) - - // Bait - itemLoot.Add(ItemID.MasterBait, 10, 1, 2); - itemLoot.Add(ItemID.JourneymanBait, 5, 1, 3); - itemLoot.Add(ItemID.ApprenticeBait, 3, 2, 3); - - // Potions - itemLoot.Add(ItemID.InfernoPotion, 10, 1, 3); - itemLoot.AddCratePotionRules(false); - - // Money - itemLoot.Add(ItemID.SilverCoin, 1, 10, 90); - itemLoot.Add(ItemID.GoldCoin, 2, 1, 5); + itemLoot.AddBiomeCrateLootRules(false); } } } diff --git a/Items/Fishing/GrandMarquisBait.cs b/Items/Fishing/GrandMarquisBait.cs index be370af1e8..21b68505b6 100644 --- a/Items/Fishing/GrandMarquisBait.cs +++ b/Items/Fishing/GrandMarquisBait.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Fishing Item.maxStack = Item.CommonMaxStack; Item.rare = ItemRarityID.LightRed; Item.value = Item.sellPrice(silver: 30); - Item.bait = 65; + Item.bait = 75; Item.consumable = true; } diff --git a/Items/Fishing/StuffedFish.cs b/Items/Fishing/StuffedFish.cs index 8ee4b5c0f9..b3f6398ade 100644 --- a/Items/Fishing/StuffedFish.cs +++ b/Items/Fishing/StuffedFish.cs @@ -1,4 +1,6 @@ -using System.Collections.Generic; +using CalamityMod.Items.Placeables.Astral; +using CalamityMod.Items.Placeables.Crags; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -30,6 +32,8 @@ namespace CalamityMod.Items.Fishing ItemID.GrassSeeds, ItemID.JungleGrassSeeds, ItemID.MushroomGrassSeeds, + ItemID.AshGrassSeeds, + ModContent.ItemType(), ItemID.PumpkinSeed }; @@ -84,12 +88,15 @@ namespace CalamityMod.Items.Fishing itemLoot.Add(ItemID.GrassSeeds, 10, seedMin, seedMax); itemLoot.Add(ItemID.JungleGrassSeeds, 10, seedMin, seedMax); itemLoot.Add(ItemID.MushroomGrassSeeds, 10, seedMin, seedMax); + itemLoot.Add(ItemID.AshGrassSeeds, 20, seedMin, seedMax); + itemLoot.Add(ModContent.ItemType(), 20, seedMin, seedMax); itemLoot.Add(ItemID.PumpkinSeed, 20, seedMin, seedMax); // Biome grass seeds itemLoot.AddIf(() => !WorldGen.crimson, ItemID.CorruptSeeds, 20, seedMin, seedMax); itemLoot.AddIf(() => WorldGen.crimson, ItemID.CrimsonSeeds, 20, seedMin, seedMax); itemLoot.AddIf(() => Main.hardMode, ItemID.HallowedSeeds, 20, seedMin, seedMax); + itemLoot.AddIf(() => Main.hardMode, ModContent.ItemType(), 20, seedMin, seedMax); // Add Thorium Marine Kelp if Thorium is loaded. Mod thorium = ExternalMods.thorium; diff --git a/Items/Fishing/SulphurCatches/HydrothermalCrate.cs b/Items/Fishing/SulphurCatches/HydrothermalCrate.cs index fca10d69a5..d14e2f292c 100644 --- a/Items/Fishing/SulphurCatches/HydrothermalCrate.cs +++ b/Items/Fishing/SulphurCatches/HydrothermalCrate.cs @@ -1,9 +1,6 @@ using CalamityMod.Items.Accessories; -using CalamityMod.Items.Materials; using CalamityMod.Items.Pets; -using CalamityMod.Items.Placeables.Abyss; -using CalamityMod.Items.Placeables.Ores; -using CalamityMod.Items.Potions; +using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Items.Tools.ClimateChange; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; @@ -31,18 +28,10 @@ namespace CalamityMod.Items.Fishing.SulphurCatches public override void SetDefaults() { - Item.width = 32; - Item.height = 32; - Item.maxStack = 9999; - Item.consumable = true; - Item.rare = ItemRarityID.Green; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 32; Item.value = Item.sellPrice(gold: 1); - Item.createTile = ModContent.TileType(); - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Green; } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) @@ -53,51 +42,29 @@ namespace CalamityMod.Items.Fishing.SulphurCatches public override bool CanRightClick() => true; public override void ModifyItemLoot(ItemLoot itemLoot) { - // The contents of this crate depend massively on progression, so it uses a large number of LeadingConditionRules. - var tier1AbyssAvailable = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedSlimeGod || Main.hardMode); - var tier2AbyssAvailable = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedLeviathan); - var scoriaAvailable = itemLoot.DefineConditionalDropSet(() => NPC.downedGolemBoss); - var tier1AcidRain = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedEoCAcidRain); - var tier2AcidRain = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedAquaticScourgeAcidRain); - var tier3AcidRain = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedPolterghast && DownedBossSystem.downedBoomerDuke); + // 20-50 Blocks @ 100%; Individually 33.33% + itemLoot.Add(new OneFromRulesRule(1, new IItemDropRule[3] + { + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50), + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50), + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50) + })); - // Materials - itemLoot.Add(ModContent.ItemType(), 1, 5, 10); - itemLoot.Add(ModContent.ItemType(), 1, 5, 10); - itemLoot.Add(ModContent.ItemType(), 1, 5, 10); - itemLoot.Add(ModContent.ItemType(), 1, 5, 10); - - tier1AcidRain.Add(ModContent.ItemType(), 10, 1, 3); - tier2AcidRain.Add(ModContent.ItemType(), 10, 1, 3); - tier2AbyssAvailable.Add(ModContent.ItemType(), 5, 2, 5); - tier2AbyssAvailable.Add(ModContent.ItemType(), 5, 2, 5); - tier2AbyssAvailable.Add(ModContent.ItemType(), 5, 2, 5); - scoriaAvailable.Add(ModContent.ItemType(), 5, 16, 28); - scoriaAvailable.Add(ModContent.ItemType(), new Fraction(15, 100), 4, 7); - tier3AcidRain.Add(ModContent.ItemType(), 10, 1, 5); + // Rusty Chest Loot @ 100%; Individually 25% + itemLoot.Add(new OneFromOptionsNotScaledWithLuckDropRule(1, 1, + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + )); // Pre-HM Abyss Weapons - tier1AbyssAvailable.Add(new OneFromOptionsDropRule(10, 1, + itemLoot.Add(new OneFromOptionsDropRule(10, 1, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType() - )); - - // Post-AS Acid Rain Weapons (and Nuclear Rod) - tier2AcidRain.Add(new OneFromOptionsDropRule(10, 1, - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() - )); - - // Pre-HM Abyss Equipment (and Torrential Tear) - tier1AbyssAvailable.Add(new OneFromOptionsDropRule(4, 1, + ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), @@ -105,18 +72,7 @@ namespace CalamityMod.Items.Fishing.SulphurCatches ModContent.ItemType() )); - // Bait - itemLoot.Add(ItemID.MasterBait, 10, 1, 2); - itemLoot.Add(ItemID.JourneymanBait, 5, 1, 3); - itemLoot.Add(ItemID.ApprenticeBait, 3, 2, 3); - - // Potions - itemLoot.Add(ModContent.ItemType(), 10, 1, 3); - itemLoot.AddCratePotionRules(); - - // Money - itemLoot.Add(ItemID.SilverCoin, 1, 10, 90); - itemLoot.Add(ItemID.GoldCoin, 2, 1, 5); + itemLoot.AddBiomeCrateLootRules(); } } } diff --git a/Items/Fishing/SulphurCatches/SulphurousCrate.cs b/Items/Fishing/SulphurCatches/SulphurousCrate.cs index 4b7f174bf8..692e01abdb 100644 --- a/Items/Fishing/SulphurCatches/SulphurousCrate.cs +++ b/Items/Fishing/SulphurCatches/SulphurousCrate.cs @@ -1,19 +1,11 @@ using CalamityMod.Items.Accessories; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Pets; -using CalamityMod.Items.Placeables.Abyss; -using CalamityMod.Items.Potions; -using CalamityMod.Items.Tools.ClimateChange; -using CalamityMod.Items.Weapons.Magic; -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Tiles.Abyss; using Terraria; using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; -using CrateTile = CalamityMod.Tiles.Abyss.SulphurousCrateTile; namespace CalamityMod.Items.Fishing.SulphurCatches { @@ -29,18 +21,10 @@ namespace CalamityMod.Items.Fishing.SulphurCatches public override void SetDefaults() { - Item.width = 32; - Item.height = 32; - Item.maxStack = 9999; - Item.consumable = true; - Item.rare = ItemRarityID.Green; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 32; Item.value = Item.sellPrice(gold: 1); - Item.createTile = ModContent.TileType(); - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Green; } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) @@ -51,47 +35,23 @@ namespace CalamityMod.Items.Fishing.SulphurCatches public override bool CanRightClick() => true; public override void ModifyItemLoot(ItemLoot itemLoot) { - var tier1AbyssAvailable = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedSlimeGod || Main.hardMode); - var tier1AcidRain = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedEoCAcidRain); + // 20-50 Blocks @ 100%; Individually 33.33% + itemLoot.Add(new OneFromRulesRule(1, new IItemDropRule[3] + { + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50), + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50), + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50) + })); - // Materials - itemLoot.Add(ModContent.ItemType(), 1, 5, 10); - itemLoot.Add(ModContent.ItemType(), 1, 5, 10); - itemLoot.Add(ModContent.ItemType(), 1, 5, 10); - itemLoot.Add(ModContent.ItemType(), 1, 5, 10); - - tier1AcidRain.Add(ModContent.ItemType(), 10, 1, 3); - - // Pre-HM Abyss Weapons - tier1AbyssAvailable.Add(new OneFromOptionsDropRule(10, 1, - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() + // Rusty Chest Loot @ 100%; Individually 25% + itemLoot.Add(new OneFromOptionsNotScaledWithLuckDropRule(1, 1, + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() )); - // Pre-HM Abyss Equipment (and Torrential Tear) - tier1AbyssAvailable.Add(new OneFromOptionsDropRule(4, 1, - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() - )); - - // Bait - itemLoot.Add(ItemID.MasterBait, 10, 1, 2); - itemLoot.Add(ItemID.JourneymanBait, 5, 1, 3); - itemLoot.Add(ItemID.ApprenticeBait, 3, 2, 3); - - // Potions - itemLoot.Add(ModContent.ItemType(), 10, 1, 3); - itemLoot.AddCratePotionRules(false); - - // Money - itemLoot.Add(ItemID.SilverCoin, 1, 10, 90); - itemLoot.Add(ItemID.GoldCoin, 2, 1, 5); + itemLoot.AddBiomeCrateLootRules(false); } } } diff --git a/Items/Fishing/SunkenSeaCatches/EutrophicCrate.cs b/Items/Fishing/SunkenSeaCatches/EutrophicCrate.cs index 6a5f8b7677..308fe9e4d2 100644 --- a/Items/Fishing/SunkenSeaCatches/EutrophicCrate.cs +++ b/Items/Fishing/SunkenSeaCatches/EutrophicCrate.cs @@ -1,10 +1,4 @@ -using CalamityMod.Items.Critters; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.SunkenSea; -using CalamityMod.Items.Weapons.Magic; -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Tiles.SunkenSea; using Terraria; using Terraria.GameContent.ItemDropRules; using Terraria.ID; @@ -24,18 +18,10 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public override void SetDefaults() { - Item.width = 32; - Item.height = 32; - Item.maxStack = 9999; - Item.consumable = true; - Item.rare = ItemRarityID.Green; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 32; Item.value = Item.sellPrice(gold: 1); - Item.createTile = ModContent.TileType(); - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Green; } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) @@ -46,27 +32,15 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public override bool CanRightClick() => true; public override void ModifyItemLoot(ItemLoot itemLoot) { - var postDesertScourge = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedDesertScourge); + // 20-50 Blocks @ 100%; Individually 33.33% + itemLoot.Add(new OneFromRulesRule(1, new IItemDropRule[3] + { + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50), + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50), + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50) + })); - // Materials - itemLoot.Add(ModContent.ItemType(), 1, 10, 30); - itemLoot.Add(ModContent.ItemType(), 1, 10, 30); - itemLoot.Add(ModContent.ItemType(), 1, 30, 60); - postDesertScourge.Add(ModContent.ItemType(), 1, 5, 10); - postDesertScourge.Add(ModContent.ItemType(), 5, 2, 5); - - // Bait - itemLoot.Add(ItemID.MasterBait, 10, 1, 2); - itemLoot.Add(ItemID.JourneymanBait, 5, 1, 3); - itemLoot.Add(ModContent.ItemType(), 5, 1, 3); - itemLoot.Add(ItemID.ApprenticeBait, 3, 2, 3); - - // Potions - itemLoot.AddCratePotionRules(false); - - // Money - itemLoot.Add(ItemID.SilverCoin, 1, 10, 90); - itemLoot.Add(ItemID.GoldCoin, 2, 1, 5); + itemLoot.AddBiomeCrateLootRules(false); } } } diff --git a/Items/Fishing/SunkenSeaCatches/PrismCrate.cs b/Items/Fishing/SunkenSeaCatches/PrismCrate.cs index b5e9eb4101..57b33bb787 100644 --- a/Items/Fishing/SunkenSeaCatches/PrismCrate.cs +++ b/Items/Fishing/SunkenSeaCatches/PrismCrate.cs @@ -1,11 +1,4 @@ -using CalamityMod.Items.Critters; -using CalamityMod.Items.Fishing.BrimstoneCragCatches; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.SunkenSea; -using CalamityMod.Items.Weapons.Magic; -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Tiles.SunkenSea; using Terraria; using Terraria.GameContent.ItemDropRules; using Terraria.ID; @@ -26,18 +19,10 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public override void SetDefaults() { - Item.width = 32; - Item.height = 32; - Item.maxStack = 9999; - Item.consumable = true; - Item.rare = ItemRarityID.Green; + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = Item.height = 32; Item.value = Item.sellPrice(gold: 1); - Item.createTile = ModContent.TileType(); - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; + Item.rare = ItemRarityID.Green; } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) @@ -48,37 +33,15 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public override bool CanRightClick() => true; public override void ModifyItemLoot(ItemLoot itemLoot) { - var postDesertScourge = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedDesertScourge); - var postHardmodeClam = itemLoot.DefineConditionalDropSet(() => DownedBossSystem.downedCLAMHardMode); + // 20-50 Blocks @ 100%; Individually 33.33% + itemLoot.Add(new OneFromRulesRule(1, new IItemDropRule[3] + { + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50), + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50), + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50) + })); - // Materials - itemLoot.Add(ModContent.ItemType(), 1, 10, 30); - itemLoot.Add(ModContent.ItemType(), 1, 10, 30); - itemLoot.Add(ModContent.ItemType(), 1, 30, 60); - postDesertScourge.Add(ModContent.ItemType(), 1, 5, 10); - postDesertScourge.Add(ModContent.ItemType(), 5, 2, 5); - postHardmodeClam.Add(ModContent.ItemType(), new Fraction(12, 100), 2, 5); - - // Weapons - postHardmodeClam.Add(new OneFromOptionsNotScaledWithLuckDropRule(7, 100, - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() - )); - - // Bait - itemLoot.Add(ItemID.MasterBait, 10, 1, 2); - itemLoot.Add(ItemID.JourneymanBait, 5, 1, 3); - itemLoot.Add(ModContent.ItemType(), 5, 1, 3); - itemLoot.Add(ItemID.ApprenticeBait, 3, 2, 3); - - // Potions - itemLoot.AddCratePotionRules(); - - // Money - itemLoot.Add(ItemID.SilverCoin, 1, 10, 90); - itemLoot.Add(ItemID.GoldCoin, 2, 1, 5); + itemLoot.AddBiomeCrateLootRules(); } } } diff --git a/Items/Placeables/Furniture/EffigyOfDecay.cs b/Items/Placeables/Furniture/EffigyOfDecay.cs index a67f4d7bdd..500771f63b 100644 --- a/Items/Placeables/Furniture/EffigyOfDecay.cs +++ b/Items/Placeables/Furniture/EffigyOfDecay.cs @@ -1,5 +1,3 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Tiles.Furniture; using Terraria; using Terraria.ID; @@ -16,13 +14,5 @@ namespace CalamityMod.Items.Placeables.Furniture Item.value = Item.sellPrice(silver: 10); Item.rare = ItemRarityID.Blue; } - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(10). - AddIngredient(2). - AddTile(TileID.Anvils). - Register(); - } } } diff --git a/Items/Weapons/Summon/RustyBeaconPrototype.cs b/Items/Weapons/Summon/RustyBeaconPrototype.cs index 7568c46903..1002d5134e 100644 --- a/Items/Weapons/Summon/RustyBeaconPrototype.cs +++ b/Items/Weapons/Summon/RustyBeaconPrototype.cs @@ -1,5 +1,4 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -44,14 +43,5 @@ namespace CalamityMod.Items.Weapons.Summon player.UpdateMaxTurrets(); return false; } - - public override void AddRecipes() - { - CreateRecipe(). - AddRecipeGroup("AnySilverBar", 10). - AddIngredient(3). - AddTile(TileID.Anvils). - Register(); - } } } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 95fbb505ef..398aee940e 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -93,9 +93,8 @@ AlluringBait: { DisplayName: Alluring Bait Tooltip: ''' - Increases fishing power by 30 - Greatly increases chance of catching potion ingredient fish - Potion ingredient fish yield is increased + Increases fishing power by 10 + Increases the yield of potion ingredient fish ''' } @@ -706,7 +705,12 @@ ElysianAegis: { EnchantedPearl: { DisplayName: Enchanted Pearl - Tooltip: Increases fishing power by 10 and crate catch chance by 10% + Tooltip: + ''' + Increases fishing power by 10 + Increases chance to catch crates and loot-containing fish by 15% + Crates are 25% more likely to be higher quality + ''' } EtherealExtorter: { @@ -1746,11 +1750,9 @@ SupremeBaitTackleBoxFishingStation: { DisplayName: Supreme Bait Tackle Box Fishing Station Tooltip: ''' - Increases fishing skill by 80, and crate catch chance by 10% + Increases fishing power by 50 Fishing line will never break and decreases chance of bait consumption - Allows fishing in lava - Sonar potion effect - The ultimate fishing accessory + Allows fishing in lava and detects hooked fish ''' } diff --git a/Systems/Mechanic/RecipeSystem.cs b/Systems/Mechanic/RecipeSystem.cs index 9a67e12607..85c64dcb67 100644 --- a/Systems/Mechanic/RecipeSystem.cs +++ b/Systems/Mechanic/RecipeSystem.cs @@ -1716,22 +1716,6 @@ namespace CalamityMod.Systems r.AddTile(TileID.Loom); r.Register(); r.DisableDecraft(); - - // Band of Regeneration - r = Recipe.Create(ItemID.BandofRegeneration); - r.AddIngredient(ItemID.Shackle); - r.AddIngredient(ItemID.LifeCrystal, 1); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); - - // Flare Gun - r = Recipe.Create(ItemID.FlareGun); - r.AddRecipeGroup(AnyCopperBar, 5); - r.AddIngredient(ItemID.Torch, 10); - r.AddTile(TileID.Anvils); - r.Register(); - r.DisableDecraft(); } #endregion diff --git a/Utilities/DropHelper.cs b/Utilities/DropHelper.cs index ab5c4d06d8..1cb2255b9f 100644 --- a/Utilities/DropHelper.cs +++ b/Utilities/DropHelper.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using CalamityMod.Enums; using CalamityMod.Items.Accessories; using CalamityMod.Items.Potions; using CalamityMod.NPCs.SulphurousSea; @@ -282,51 +283,323 @@ namespace CalamityMod } /// - /// Adds all the common potions for fishing crates, alongside scaling mana and regen potions + /// Adds all the common drops for Biome Crates. /// /// The ILoot interface for the loot table. /// Whether or not the crate is considered a hardmode crate. - public static void AddCratePotionRules(this ILoot loot, bool hardMode = true) + public static void AddBiomeCrateLootRules(this ILoot loot, bool hardMode = true) { - loot.Add(ItemID.ObsidianSkinPotion, 10, 1, 3); - loot.Add(ItemID.SwiftnessPotion, 10, 1, 3); - loot.Add(ItemID.IronskinPotion, 10, 1, 3); - loot.Add(ItemID.NightOwlPotion, 10, 1, 3); - loot.Add(ItemID.ShinePotion, 10, 1, 3); - loot.Add(ItemID.MiningPotion, 10, 1, 3); - loot.Add(ItemID.HeartreachPotion, 10, 1, 3); - loot.Add(ItemID.TrapsightPotion, 10, 1, 3); // Dangersense Potion - - // Define all the loot rules for the potion types - var supremePots = new OneFromOptionsNotScaledWithLuckDropRule(1, 1, ModContent.ItemType(), ModContent.ItemType()); - var superPots = new OneFromOptionsNotScaledWithLuckDropRule(1, 1, ItemID.SuperHealingPotion, ItemID.SuperManaPotion); - var greaterPots = new OneFromOptionsNotScaledWithLuckDropRule(1, 1, ItemID.GreaterHealingPotion, ItemID.GreaterManaPotion); - var regularPots = new OneFromOptionsNotScaledWithLuckDropRule(1, 1, ItemID.HealingPotion, ItemID.ManaPotion); - var lesserPots = new OneFromOptionsNotScaledWithLuckDropRule(1, 1, ItemID.LesserHealingPotion, ItemID.LesserManaPotion); - - // Chained LeadingConditionRules achieve the equivalent of "if killed X, else if killed Y, else if killed Z, else..." - var lcrSupremePotion = loot.DefineConditionalDropSet(() => DownedBossSystem.downedDoG); - var lcrSuperPotion = new LeadingConditionRule(If(() => DownedBossSystem.downedProvidence)); - var lcrGreaterPotion = new LeadingConditionRule(If(() => NPC.downedMechBossAny)); - var lcrRegularPotion = new LeadingConditionRule(If(() => NPC.downedBoss3)); - - // Actually chain all the LCRs together - // Greater potions upwards are only chained if the crate is marked as Hardmode if (hardMode) + loot.AddHardmodeOresToCrates(HardmodeCrateType.Biome); + else { - lcrSupremePotion.Add(supremePots); - lcrSupremePotion.OnFailedConditions(lcrSuperPotion); - lcrSuperPotion.Add(superPots); - lcrSuperPotion.OnFailedConditions(lcrGreaterPotion); - lcrGreaterPotion.Add(greaterPots); - lcrGreaterPotion.OnFailedConditions(lcrRegularPotion); + // Pre-Hardmode Ore/Bar loot pools + // 20-35 Ores @ 14.29%; Individually 1.79% + IItemDropRule[] phmOres = new IItemDropRule[8] + { + ItemDropRule.NotScalingWithLuck(ItemID.CopperOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.TinOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.IronOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.LeadOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.SilverOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.TungstenOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.GoldOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.PlatinumOre, 1, 20, 35) + }; + loot.Add(new OneFromRulesRule(7, phmOres)); + + // 6-16 Bars @ 25%; Individually 4.17% + IItemDropRule[] phmBars = new IItemDropRule[6] + { + ItemDropRule.NotScalingWithLuck(ItemID.IronBar, 1, 6, 16), + ItemDropRule.NotScalingWithLuck(ItemID.LeadBar, 1, 6, 16), + ItemDropRule.NotScalingWithLuck(ItemID.SilverBar, 1, 6, 16), + ItemDropRule.NotScalingWithLuck(ItemID.TungstenBar, 1, 6, 16), + ItemDropRule.NotScalingWithLuck(ItemID.GoldBar, 1, 6, 16), + ItemDropRule.NotScalingWithLuck(ItemID.PlatinumBar, 1, 6, 16) + }; + loot.Add(new OneFromRulesRule(4, phmBars)); } - lcrRegularPotion.Add(regularPots); - lcrRegularPotion.OnFailedConditions(lesserPots); - // Add the chain starting from regular potions if marked as a Pre-Hardmode crate - if (!hardMode) + + // 2-4 Buff Potions @ 25%; Individually 4.17% + loot.Add(new OneFromRulesRule(4, new IItemDropRule[6] { - loot.Add(lcrRegularPotion); + ItemDropRule.NotScalingWithLuck(ItemID.ObsidianSkinPotion, 1, 2, 4), + ItemDropRule.NotScalingWithLuck(ItemID.SpelunkerPotion, 1, 2, 4), + ItemDropRule.NotScalingWithLuck(ItemID.HunterPotion, 1, 2, 4), + ItemDropRule.NotScalingWithLuck(ItemID.GravitationPotion, 1, 2, 4), + ItemDropRule.NotScalingWithLuck(ItemID.MiningPotion, 1, 2, 4), + ItemDropRule.NotScalingWithLuck(ItemID.HeartreachPotion, 1, 2, 4) + })); + + // 5-17 (Regular) Recovery Potions @ 50%; 25% Healing 25% Mana + loot.Add(new OneFromRulesRule(2, new IItemDropRule[2] + { + ItemDropRule.NotScalingWithLuck(ItemID.HealingPotion, 1, 5, 17), + ItemDropRule.NotScalingWithLuck(ItemID.ManaPotion, 1, 5, 17) + })); + + // 2-6 Bait @ 50%; 25% Master 25% Apprentice + loot.Add(new OneFromRulesRule(2, new IItemDropRule[2] + { + ItemDropRule.NotScalingWithLuck(ItemID.MasterBait, 1, 2, 6), + ItemDropRule.NotScalingWithLuck(ItemID.ApprenticeBait, 1, 2, 6) + })); + + // 5-12 Gold Coin @ 25% + loot.Add(ItemID.GoldCoin, 4, 5, 12); + } + + /// + /// Adds (or re-adds) Hardmode Ores to crates with respect to Hardmode Progression rework
+ /// Drop rules replicate vanilla's rules. + ///
+ /// The ILoot interface for the loot table. + /// Type of crate: Mythril, Titanium, Biome + public static void AddHardmodeOresToCrates(this ILoot loot, HardmodeCrateType type) + { + var adamantiteLCR = loot.DefineConditionalDropSet(AdamantiteCondition); + var mythrilLCR = new LeadingConditionRule(MythrilCondition); + if (type == HardmodeCrateType.Biome) + { + // Pre-Hardmode loot pools + // 20-35 Ores @ 7.14%; Individually 0.89% + IItemDropRule[] phmOres = new IItemDropRule[8] + { + ItemDropRule.NotScalingWithLuck(ItemID.CopperOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.TinOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.IronOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.LeadOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.SilverOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.TungstenOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.GoldOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.PlatinumOre, 1, 20, 35) + }; + // 6-16 Bars @ 8.33%; Individually 1.39% + IItemDropRule[] phmBars = new IItemDropRule[6] + { + ItemDropRule.NotScalingWithLuck(ItemID.IronBar, 1, 6, 16), + ItemDropRule.NotScalingWithLuck(ItemID.LeadBar, 1, 6, 16), + ItemDropRule.NotScalingWithLuck(ItemID.SilverBar, 1, 6, 16), + ItemDropRule.NotScalingWithLuck(ItemID.TungstenBar, 1, 6, 16), + ItemDropRule.NotScalingWithLuck(ItemID.GoldBar, 1, 6, 16), + ItemDropRule.NotScalingWithLuck(ItemID.PlatinumBar, 1, 6, 16) + }; + + // Tier 3 loot pools + // 20-35 Ores @ 7.14%; Individually 1.19% + IItemDropRule[] hmOresThree = new IItemDropRule[6] + { + ItemDropRule.NotScalingWithLuck(ItemID.CobaltOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.PalladiumOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.MythrilOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.OrichalcumOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.AdamantiteOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.TitaniumOre, 1, 20, 35) + }; + // 5-16 Bars @ 16.67%; Individually 2.78% + IItemDropRule[] hmBarsThree = new IItemDropRule[6] + { + ItemDropRule.NotScalingWithLuck(ItemID.CobaltBar, 1, 5, 16), + ItemDropRule.NotScalingWithLuck(ItemID.PalladiumBar, 1, 5, 16), + ItemDropRule.NotScalingWithLuck(ItemID.MythrilBar, 1, 5, 16), + ItemDropRule.NotScalingWithLuck(ItemID.OrichalcumBar, 1, 5, 16), + ItemDropRule.NotScalingWithLuck(ItemID.AdamantiteBar, 1, 5, 16), + ItemDropRule.NotScalingWithLuck(ItemID.TitaniumBar, 1, 5, 16) + }; + var adamantiteDropsOres = new SequentialRulesNotScalingWithLuckRule(7, new OneFromRulesRule(2, hmOresThree), new OneFromRulesRule(1, phmOres)); + var adamantiteDropsBars = new SequentialRulesNotScalingWithLuckRule(4, new OneFromRulesRule(3, 2, hmBarsThree), new OneFromRulesRule(1, phmBars)); + + // Tier 2 loot pools + // 20-35 Ores @ 7.14%; Individually 1.79% + IItemDropRule[] hmOresTwo = new IItemDropRule[4] + { + ItemDropRule.NotScalingWithLuck(ItemID.CobaltOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.PalladiumOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.MythrilOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.OrichalcumOre, 1, 20, 35) + }; + // 5-16 Bars @ 16.67%; Individually 4.17% + IItemDropRule[] hmBarsTwo = new IItemDropRule[4] + { + ItemDropRule.NotScalingWithLuck(ItemID.CobaltBar, 1, 5, 16), + ItemDropRule.NotScalingWithLuck(ItemID.PalladiumBar, 1, 5, 16), + ItemDropRule.NotScalingWithLuck(ItemID.MythrilBar, 1, 5, 16), + ItemDropRule.NotScalingWithLuck(ItemID.OrichalcumBar, 1, 5, 16) + }; + var mythrilDropsOres = new SequentialRulesNotScalingWithLuckRule(7, new OneFromRulesRule(2, hmOresTwo), new OneFromRulesRule(1, phmOres)); + var mythrilDropsBars = new SequentialRulesNotScalingWithLuckRule(4, new OneFromRulesRule(3, 2, hmBarsTwo), new OneFromRulesRule(1, phmBars)); + + // Tier 1 loot pools + // 20-35 Ores @ 7.14%; Individually 3.57% + IItemDropRule[] hmOresOne = new IItemDropRule[2] + { + ItemDropRule.NotScalingWithLuck(ItemID.CobaltOre, 1, 20, 35), + ItemDropRule.NotScalingWithLuck(ItemID.PalladiumOre, 1, 20, 35) + }; + // 5-16 Bars @ 16.67%; Individually 8.33% + IItemDropRule[] hmBarsOne = new IItemDropRule[2] + { + ItemDropRule.NotScalingWithLuck(ItemID.CobaltBar, 1, 5, 16), + ItemDropRule.NotScalingWithLuck(ItemID.PalladiumBar, 1, 5, 16) + }; + var cobaltDropsOres = new SequentialRulesNotScalingWithLuckRule(7, new OneFromRulesRule(2, hmOresOne), new OneFromRulesRule(1, phmOres)); + var cobaltDropsBars = new SequentialRulesNotScalingWithLuckRule(4, new OneFromRulesRule(3, 2, hmBarsOne), new OneFromRulesRule(1, phmBars)); + + adamantiteLCR.Add(adamantiteDropsOres); + adamantiteLCR.Add(adamantiteDropsBars); + adamantiteLCR.OnFailedConditions(mythrilLCR); + mythrilLCR.Add(mythrilDropsOres); + mythrilLCR.Add(mythrilDropsBars); + mythrilLCR.OnFailedConditions(cobaltDropsOres); + mythrilLCR.OnFailedConditions(cobaltDropsBars); + } + else if (type == HardmodeCrateType.Mythril) + { + // Pre-Hardmode loot pools + // 12-21 Ores @ 8.33%; Individually 1.39% + IItemDropRule[] phmOres = new IItemDropRule[6] + { + ItemDropRule.NotScalingWithLuck(ItemID.CopperOre, 1, 12, 21), + ItemDropRule.NotScalingWithLuck(ItemID.TinOre, 1, 12, 21), + ItemDropRule.NotScalingWithLuck(ItemID.IronOre, 1, 12, 21), + ItemDropRule.NotScalingWithLuck(ItemID.LeadOre, 1, 12, 21), + ItemDropRule.NotScalingWithLuck(ItemID.SilverOre, 1, 12, 21), + ItemDropRule.NotScalingWithLuck(ItemID.TungstenOre, 1, 12, 21), + }; + // 4-7 Bars @ 6.94%; Individually 1.16% + IItemDropRule[] phmBars = new IItemDropRule[6] + { + ItemDropRule.NotScalingWithLuck(ItemID.CopperBar, 1, 4, 7), + ItemDropRule.NotScalingWithLuck(ItemID.TinBar, 1, 4, 7), + ItemDropRule.NotScalingWithLuck(ItemID.IronBar, 1, 4, 7), + ItemDropRule.NotScalingWithLuck(ItemID.LeadBar, 1, 4, 7), + ItemDropRule.NotScalingWithLuck(ItemID.SilverBar, 1, 4, 7), + ItemDropRule.NotScalingWithLuck(ItemID.TungstenBar, 1, 4, 7), + }; + + // Tier 2 loot pools + // 12-21 Ores @ 8.33%; Individually 2.08% + IItemDropRule[] hmOresTwo = new IItemDropRule[4] + { + ItemDropRule.NotScalingWithLuck(ItemID.CobaltOre, 1, 12, 21), + ItemDropRule.NotScalingWithLuck(ItemID.PalladiumOre, 1, 12, 21), + ItemDropRule.NotScalingWithLuck(ItemID.MythrilOre, 1, 12, 21), + ItemDropRule.NotScalingWithLuck(ItemID.OrichalcumOre, 1, 12, 21) + }; + // 3-7 Bars @ 13.89%; Individually 3.47% + IItemDropRule[] hmBarsTwo = new IItemDropRule[4] + { + ItemDropRule.NotScalingWithLuck(ItemID.CobaltBar, 1, 3, 7), + ItemDropRule.NotScalingWithLuck(ItemID.PalladiumBar, 1, 3, 7), + ItemDropRule.NotScalingWithLuck(ItemID.MythrilBar, 1, 3, 7), + ItemDropRule.NotScalingWithLuck(ItemID.OrichalcumBar, 1, 3, 7) + }; + var mythrilDropsOres = new SequentialRulesNotScalingWithLuckRule(6, new OneFromRulesRule(2, hmOresTwo), new OneFromRulesRule(1, phmOres)); + var mythrilDropsBars = new SequentialRulesNotScalingWithLuckRule(4, new OneFromRulesRule(3, 2, hmBarsTwo), new OneFromRulesRule(1, phmBars)); + var mythrilDrops = new SequentialRulesNotScalingWithLuckRule(1, mythrilDropsOres, mythrilDropsBars); + + // Tier 1 loot pools + // 12-21 Ores @ 8.33%; Individually 4.17% + IItemDropRule[] hmOresOne = new IItemDropRule[2] + { + ItemDropRule.NotScalingWithLuck(ItemID.CobaltOre, 1, 12, 21), + ItemDropRule.NotScalingWithLuck(ItemID.PalladiumOre, 1, 12, 21) + }; + // 3-7 Bars @ 13.89%; Individually 6.94% + IItemDropRule[] hmBarsOne = new IItemDropRule[2] + { + ItemDropRule.NotScalingWithLuck(ItemID.CobaltBar, 1, 3, 7), + ItemDropRule.NotScalingWithLuck(ItemID.PalladiumBar, 1, 3, 7) + }; + var cobaltDropsOres = new SequentialRulesNotScalingWithLuckRule(6, new OneFromRulesRule(2, hmOresOne), new OneFromRulesRule(1, phmOres)); + var cobaltDropsBars = new SequentialRulesNotScalingWithLuckRule(4, new OneFromRulesRule(3, 2, hmBarsOne), new OneFromRulesRule(1, phmBars)); + var cobaltDrops = new SequentialRulesNotScalingWithLuckRule(1, cobaltDropsOres, cobaltDropsBars); + + mythrilLCR.Add(mythrilDrops); + mythrilLCR.OnFailedConditions(cobaltDrops); + loot.Add(mythrilLCR); // No Adamantite LCR here so we need to add this in + } + else if (type == HardmodeCrateType.Titanium) + { + // Pre-Hardmode loot pools + // 25-34 Ores @ 10%; Individually 2.5% + IItemDropRule[] phmOres = new IItemDropRule[4] + { + ItemDropRule.NotScalingWithLuck(ItemID.SilverOre, 1, 25, 34), + ItemDropRule.NotScalingWithLuck(ItemID.TungstenOre, 1, 25, 34), + ItemDropRule.NotScalingWithLuck(ItemID.GoldOre, 1, 25, 34), + ItemDropRule.NotScalingWithLuck(ItemID.PlatinumOre, 1, 25, 34) + }; + // 8-11 Bars @ 8.89%; Individually 2.22% + IItemDropRule[] phmBars = new IItemDropRule[4] + { + ItemDropRule.NotScalingWithLuck(ItemID.SilverBar, 1, 8, 11), + ItemDropRule.NotScalingWithLuck(ItemID.TungstenBar, 1, 8, 11), + ItemDropRule.NotScalingWithLuck(ItemID.GoldBar, 1, 8, 11), + ItemDropRule.NotScalingWithLuck(ItemID.PlatinumBar, 1, 8, 11) + }; + + // Tier 3 loot pools + // 25-34 Ores @ 10%; Individually 2.5% + IItemDropRule[] hmOresThree = new IItemDropRule[4] + { + ItemDropRule.NotScalingWithLuck(ItemID.MythrilOre, 1, 25, 34), + ItemDropRule.NotScalingWithLuck(ItemID.OrichalcumOre, 1, 25, 34), + ItemDropRule.NotScalingWithLuck(ItemID.AdamantiteOre, 1, 25, 34), + ItemDropRule.NotScalingWithLuck(ItemID.TitaniumOre, 1, 25, 34) + }; + // 8-11 Bars @ 17.78%; Individually 4.44% + IItemDropRule[] hmBarsThree = new IItemDropRule[4] + { + ItemDropRule.NotScalingWithLuck(ItemID.MythrilBar, 1, 8, 11), + ItemDropRule.NotScalingWithLuck(ItemID.OrichalcumBar, 1, 8, 11), + ItemDropRule.NotScalingWithLuck(ItemID.AdamantiteBar, 1, 8, 11), + ItemDropRule.NotScalingWithLuck(ItemID.TitaniumBar, 1, 8, 11) + }; + var adamantiteDropsOres = new SequentialRulesNotScalingWithLuckRule(5, new OneFromRulesRule(2, hmOresThree), new OneFromRulesRule(1, phmOres)); + var adamantiteDropsBars = new SequentialRulesNotScalingWithLuckRule(3, new OneFromRulesRule(3, 2, hmBarsThree), new OneFromRulesRule(1, phmBars)); + var adamantiteDrops = new SequentialRulesNotScalingWithLuckRule(1, adamantiteDropsOres, adamantiteDropsBars); + + // Tier 2 loot pools + // 25-34 Ores @ 10%; Individually 5% + IItemDropRule[] hmOresTwo = new IItemDropRule[2] + { + ItemDropRule.NotScalingWithLuck(ItemID.MythrilOre, 1, 25, 34), + ItemDropRule.NotScalingWithLuck(ItemID.OrichalcumOre, 1, 25, 34) + }; + // 8-11 Bars @ 17.78%; Individually 8.89% + IItemDropRule[] hmBarsTwo = new IItemDropRule[2] + { + ItemDropRule.NotScalingWithLuck(ItemID.MythrilBar, 1, 8, 11), + ItemDropRule.NotScalingWithLuck(ItemID.OrichalcumBar, 1, 8, 11) + }; + var mythrilDropsOres = new SequentialRulesNotScalingWithLuckRule(5, new OneFromRulesRule(2, hmOresTwo), new OneFromRulesRule(1, phmOres)); + var mythrilDropsBars = new SequentialRulesNotScalingWithLuckRule(3, new OneFromRulesRule(3, 2, hmBarsTwo), new OneFromRulesRule(1, phmBars)); + var mythrilDrops = new SequentialRulesNotScalingWithLuckRule(1, mythrilDropsOres, mythrilDropsBars); + + // Tier 1 loot pools + // EXCEPTION: Titanium Crates do not drop Cobalt. This is added to make it not entirely useless to get early. + // 25-34 Ores @ 10%; Individually 5% + IItemDropRule[] hmOresOne = new IItemDropRule[2] + { + ItemDropRule.NotScalingWithLuck(ItemID.CobaltOre, 1, 25, 34), + ItemDropRule.NotScalingWithLuck(ItemID.PalladiumOre, 1, 25, 34) + }; + // 8-11 Bars @ 17.78%; Individually 8.89% + IItemDropRule[] hmBarsOne = new IItemDropRule[2] + { + ItemDropRule.NotScalingWithLuck(ItemID.CobaltBar, 1, 8, 11), + ItemDropRule.NotScalingWithLuck(ItemID.PalladiumBar, 1, 8, 11) + }; + var cobaltDropsOres = new SequentialRulesNotScalingWithLuckRule(5, new OneFromRulesRule(2, hmOresOne), new OneFromRulesRule(1, phmOres)); + var cobaltDropsBars = new SequentialRulesNotScalingWithLuckRule(3, new OneFromRulesRule(3, 2, hmBarsOne), new OneFromRulesRule(1, phmBars)); + var cobaltDrops = new SequentialRulesNotScalingWithLuckRule(1, cobaltDropsOres, cobaltDropsBars); + + adamantiteLCR.Add(adamantiteDrops); + adamantiteLCR.OnFailedConditions(mythrilLCR); + mythrilLCR.Add(mythrilDrops); + mythrilLCR.OnFailedConditions(cobaltDrops); } } #endregion @@ -484,6 +757,25 @@ namespace CalamityMod #endregion #region Drop Rule Conditions + public static IItemDropRuleCondition MythrilCondition = If((info) => + { + // If the Early Hardmode Progression Rework is not enabled, then Mythril/Orichalcum can always drop. + if (!CalamityServerConfig.Instance.EarlyHardmodeProgressionRework) + return true; + + // If the Early Hardmode Progression Rework is enabled, then any Mechanical Boss must be defeated for Mythril/Orichalcum to drop. + return NPC.downedMechBossAny; + }); + public static IItemDropRuleCondition AdamantiteCondition = If((info) => + { + // If the Early Hardmode Progression Rework is not enabled, then Adamantite/Titanium can always drop. + if (!CalamityServerConfig.Instance.EarlyHardmodeProgressionRework) + return true; + + // If the Early Hardmode Progression Rework is enabled, then 2 of the Mechanical Bosses must be defeated for Adamantite/Titanium to drop. + return (NPC.downedMechBoss1 && NPC.downedMechBoss2) || (NPC.downedMechBoss2 && NPC.downedMechBoss3) || (NPC.downedMechBoss1 && NPC.downedMechBoss3); + }); + public static IItemDropRuleCondition HallowedBarsCondition = If((info) => { // If the Early Hardmode Progression Rework is not enabled, then Hallowed Bars can always drop from Mechanical Bosses. From eb5cd92e81878bcaa48e37af666325490549a735 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 12:28:31 +0900 Subject: [PATCH 040/118] Added ResizeArrayHook --- Systems/ResizeArrayHook.cs | 42 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Systems/ResizeArrayHook.cs diff --git a/Systems/ResizeArrayHook.cs b/Systems/ResizeArrayHook.cs new file mode 100644 index 0000000000..e5ffa028d2 --- /dev/null +++ b/Systems/ResizeArrayHook.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + internal delegate void ResizeArrayDelegate(bool unloading); + + internal sealed class ResizeArrayHook : ModSystem + { + public static event ResizeArrayDelegate OnResizeArrays; + public static event ResizeArrayDelegate OnPostResizeArrays; + + public override void Load() + { + var resizeArrayMethod = typeof(ModContent).GetMethod("ResizeArrays", BindingFlags.NonPublic | BindingFlags.Static); + MonoModHooks.Add(resizeArrayMethod, ResizeArrays); + } + + private static void ResizeArrays(ResizeArrayDelegate orig, bool unloading) + { + OnResizeArrays?.Invoke(unloading); + orig(unloading); + OnPostResizeArrays?.Invoke(unloading); + } + + // MonoMod Hook Unloads before this being called + // So we forcely call ResizeArray with Unload true + public override void Unload() + { + OnResizeArrays?.Invoke(unloading: true); + OnPostResizeArrays?.Invoke(unloading: true); + + OnResizeArrays = null; + OnPostResizeArrays = null; + } + } +} From 198c3ab366f01d7fa308776f2572cef8db993b4e Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 13:06:37 +0900 Subject: [PATCH 041/118] Changed EmptySlot from 255 to 0 --- Systems/TileMerging/TileBlendTextureLoader.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Systems/TileMerging/TileBlendTextureLoader.cs b/Systems/TileMerging/TileBlendTextureLoader.cs index 3409a1a0ee..e07c9bd876 100644 --- a/Systems/TileMerging/TileBlendTextureLoader.cs +++ b/Systems/TileMerging/TileBlendTextureLoader.cs @@ -13,23 +13,25 @@ namespace CalamityMod.Systems { internal sealed class TileBlendTextureLoader : ModSystem { - internal const int EmptySlot = 255; + internal const int EmptySlot = 0; + internal const int StartingIndex = 1; + internal const int MaxCount = 255; internal static TileBlendTexture[] Registry { get; private set; } internal static IEnumerable AllTextures => Registry.Take(Count); - internal static int Count => _UniqueSlot; + internal static int Count => _UniqueSlot - StartingIndex; - private static int _UniqueSlot = 0; + private static int _UniqueSlot = StartingIndex; public override void Load() { - Registry = new TileBlendTexture[EmptySlot + 1]; + Registry = new TileBlendTexture[MaxCount]; } public override void Unload() { Registry = null; - _UniqueSlot = 0; + _UniqueSlot = StartingIndex; } internal static int Register(TileBlendTexture sheet) @@ -37,8 +39,8 @@ namespace CalamityMod.Systems if (sheet.Slot >= 0) throw new ArgumentException("Argument has already registered to System", nameof(sheet)); - if (_UniqueSlot >= EmptySlot) - throw new InvalidOperationException($"Slots are all used up to {EmptySlot}, We can't allocate more!"); + if (_UniqueSlot >= MaxCount) + throw new InvalidOperationException($"Slots are all used up to {MaxCount}, We can't allocate more!"); var slot = _UniqueSlot++; Registry[slot] = sheet; From 08e9e5c4d98a052426881532a4d154debbc62e13 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 13:10:35 +0900 Subject: [PATCH 042/118] Changed AllTextures Logic --- Systems/TileMerging/TileBlendTextureLoader.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Systems/TileMerging/TileBlendTextureLoader.cs b/Systems/TileMerging/TileBlendTextureLoader.cs index e07c9bd876..0b3dce33a3 100644 --- a/Systems/TileMerging/TileBlendTextureLoader.cs +++ b/Systems/TileMerging/TileBlendTextureLoader.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Systems internal const int MaxCount = 255; internal static TileBlendTexture[] Registry { get; private set; } - internal static IEnumerable AllTextures => Registry.Take(Count); + internal static IEnumerable AllTextures => Registry.Where(tex => tex is not null); internal static int Count => _UniqueSlot - StartingIndex; private static int _UniqueSlot = StartingIndex; From 8bc3ee572d3a48474c72ddc2f51d84a7ed28d09c Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 13:24:37 +0900 Subject: [PATCH 043/118] Fixed Issue where other Mods tile breaks TileMerge System --- Systems/TileMerging/TileBlendMergeSystem.cs | 93 +++++++++++---------- 1 file changed, 50 insertions(+), 43 deletions(-) diff --git a/Systems/TileMerging/TileBlendMergeSystem.cs b/Systems/TileMerging/TileBlendMergeSystem.cs index dd11372a56..88658e9bc5 100644 --- a/Systems/TileMerging/TileBlendMergeSystem.cs +++ b/Systems/TileMerging/TileBlendMergeSystem.cs @@ -1,28 +1,6 @@ using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Security.Cryptography.X509Certificates; -using System.Text; -using System.Threading.Tasks; -using CalamityMod.Graphics; -using CalamityMod.Tiles.Abyss; -using CalamityMod.Tiles.Astral; -using CalamityMod.Tiles.AstralDesert; -using CalamityMod.Tiles.AstralSnow; -using CalamityMod.Tiles.SunkenSea; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using MonoMod.Utils; -using Newtonsoft.Json.Linq; -using ReLogic.Content; using Terraria; -using Terraria.DataStructures; using Terraria.GameContent.Drawing; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Systems @@ -33,26 +11,62 @@ namespace CalamityMod.Systems private static bool[,] _TileBlendable; // dimension: [TileTypeCount, AllBlendTextureCount] private static bool[,] _TileBlendLooselyFillDiagonal; // dimension: [TileTypeCount, AllBlendTextureCount] private static byte[] _TileTypeToBlendTextureSlot; // dimension: [TileTypeCount] + private static bool _IDSetsInitialized = false; #region Load/Unload public override void OnModLoad() { - var tileCount = TileLoader.TileCount; - var blendTextureCount = TileBlendTextureLoader.Count; - _TileBlendable = new bool[tileCount, blendTextureCount]; - _TileBlendLooselyFillDiagonal = new bool[tileCount, blendTextureCount]; - _TileTypeToBlendTextureSlot = new byte[tileCount]; - - Array.Fill(_TileTypeToBlendTextureSlot, (byte)TileBlendTextureLoader.EmptySlot); - - for (int i = 0; i(ref T[,] array, int newColNum, int newRowNum) + { + var newArray = new T[newColNum, newRowNum]; + int colCount = array.GetLength(1); + int newColCount = newRowNum; + int cols = array.GetUpperBound(0); + for (int co = 0; co <= cols; co++) + Array.Copy(array, co * colCount, newArray, co * newColCount, colCount); + array = newArray; } private static void SetupMergeData() @@ -62,13 +76,6 @@ namespace CalamityMod.Systems blendTexture.BakeBlendTexture(blendTexture.TextureAsset.Value); } } - - public override void Unload() - { - _TileBlendable = null; - _TileBlendLooselyFillDiagonal = null; - _TileTypeToBlendTextureSlot = null; - } #endregion #region Public API From e83382dcfc6c448566310473dd5f05d5f26c3fbe Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 13:25:49 +0900 Subject: [PATCH 044/118] Removed Obsolete Attribute on RegUniversalMerge method --- Utilities/TileUtils.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Utilities/TileUtils.cs b/Utilities/TileUtils.cs index e358ebf68a..b4582f43ec 100644 --- a/Utilities/TileUtils.cs +++ b/Utilities/TileUtils.cs @@ -408,7 +408,8 @@ namespace CalamityMod // Extension shorthand for the Tile Framing System Universal Merges. // As this must be defined in a static class, it's out here in CalamityUtils. - [Obsolete("Use TileBlendMergeSystem.RegisterMerge Instead")] + // Flow, 2024/OCT/31 Removing Obsolete in here as tModLoader doesn't like this + //[Obsolete("Use TileBlendMergeSystem.RegisterMerge Instead")] public static void RegisterUniversalMerge(this ModTile tile, int mergeType, string blendSheetPath) { //TileFramingSystem.RegisterUniversalMerge(tile.Type, mergeType, blendSheetPath); From e36d0901dfdf4504c38ec6ca6cc5a80bb7f942e9 Mon Sep 17 00:00:00 2001 From: Memes <114233643+Mr-Memes@users.noreply.github.com> Date: Sun, 13 Oct 2024 20:48:58 +0200 Subject: [PATCH 045/118] DonatorNameList. --- CalamityLists.cs | 635 ----------------------- NPCs/TownNPCs/FAP.cs | 12 +- Systems/Collections/DonatorNameList.cs | 669 +++++++++++++++++++++++++ 3 files changed, 671 insertions(+), 645 deletions(-) create mode 100644 Systems/Collections/DonatorNameList.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index 3fe9ee8878..209d7b002e 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -81,7 +81,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static IList donatorList; public static List projectileDestroyExceptionList; public static List enemyImmunityList; public static List confusionEnemyList; @@ -166,639 +165,6 @@ namespace CalamityMod public override void OnModLoad() { - donatorList = new List() - { - "Vorbis", - "SoloMael", - "Chaotic Reks", - "The Buildmonger", - "YuH", - "Littlepiggy", - "LompL", - "Lilith", - "Ben Shapiro", - "Frederik", - "Faye", - "Gibb50", - "Braden", - "Hannes", - "profoundmango69", - "Jack", - "Hans Volter", - "Krankwagon", - "MishiroUsui", - "pixlgray", - "Arkhine", - "Lodude", - "DevAesthetic", - "Mister Winchester", - "Zacky", - "Veine", - "Javyz", - "Shifter", - "Crysthamyr", - "Elfinlocks", - "Ein", - "2Larry2", - "Jenonen", - "Dodu", - "Arti", - "Tervastator", - "Luis", - "Alexander", - "BakaQing", - "Taylor", - "Xaphlactus", - "MajinBagel", - "Bendy", - "Rando Calrissian", - "Tails the Fox 92", - "Bread", - "Minty Candy", - "Preston", - "MovingTarget_086", - "Shiro", - "Chip", - "Taylor", - "ShotgunAngel", - "Sandblast", - "ThomasThePencil", - "Aero (Aero#4599)", - "Shirosity", // used to be GlitchOut - "Daawnz", - "CrabBar", - "Yatagarasu", - "Jarod", - "Zombieh", - "MingWhy", - "Random Weeb", - "Afzofa", - "Eragon3942", - "TheBlackHand", - "william", - "Samuel", - "Christopher", - "DemoN K!ng", - "Malik", - "Ryan Baker-Ortiz", - "Aleksanders", - "TheSilverGhost", - "Lucazii", - "Shay", - "Prism", - "BobIsNotMyRealName", - "Guwahavel", - "Azura", - "Joshua", - "Doveda", - "William", - "Arche", - "DevilSunrise", - "Yanmei", - "Chaos", - "Ryan", - "Fish Repairs", - "Melvin", - "Vroomy Has -3,000 IQ", - "The Goliath", - "DaPyRo", - "Takeru", - "Circuit-Jay", - "Commmander Frostbite", - "cytokat", - "Cameron", - "Orudeon", - "BumbleDoge", - "Naglfar", - "Helixas", - "Vetus", - "High Charity", - "Devonte", - "Cerberus", - "Brendan", - "Victor", - "KAT-G307", - "Tombarry Expresserino", - "Drip Veezy", - "Glaid", - "Apotheosis", - "Bladesaber", - "Devon", - "Ruthoranium", - "cocodezi_", - "Mendzey", - "GameRDheAsianSandwich", - "Chigbungus", - "Streakist", - "Eisaya", - "Xenocrona", - "RKMoon", - "Eternal Silence", - "Jeff", - "Beta165", - "DanYami", - "Xenocrona", - "Ari", - "cosmickalamity", - "xd Ow0", - "Darren", - "Florian", - "dawn thunder", - "asdf935", - "GentSkeleton", - "Fizzlpoprock", - "Pigeon", - "Aleksh", - "Just a random guy", - "Dee", - "Æthereal", - "Broken Faucet", - "Sarcosuchus", - "Marissa443", - "Warlok", - "JackShizz", - "NebulaMagePlays", - "Primpy", - "Thys", - "Min", - "Wodernet", - "Pedro", - "Depressed Dad Gaming", - "Snowy", - "Stormone", - "Mobian", - "Rinja", - "Check pins", - "Dakota", - "Neoplasmatic", - "False", - "Whitegiraffe", - "Drakkece", - "Levi", - "Izuna", - "djsnj20", - "pyobbo", - "Alec", - "The Illustrious Sqouinchuousor", - "Moist Lad", - "TwanTheGOAT", - "3x1t_5tyl3", - "Will", - "SpookyNinja", - "Boomdiada", - "Culex", - "Rossadon", - "Ben", - "hubert thieblot", - "NepNep", - "Nanaki", - "CrimsonCrips", - "Lagohz", - "Timon", - "F00d Demon", - "Olkothan", - "Vmar98", - "Dasdruid", - "Cinder", - "Brutzli", - "Yhashtur", - "Zekai", - "Doug", - "Uberransy", - "KurlozClown", - "Nemesis 041", - "Asheel", - "Hayden", - "Lightedflare", - "Lady Shira", - "Devin", - "Qelrin", - "Thomas", - "Ne'er Dowell", - "Potion Man", - "martyrdomination", - "Destructoid", - "Coolguystorm YT", - "Wolfmaw", - "yiumik", - "Destiny Stallcup", - "GreenBerry", - "SolsticeUnlimitd", - "darkhawke", - "oracle", - "YumeiSenshi", - "Cameron", - "Toxin", - "Fweepachino", - "DESPACITO", - "Altzeus", - "Ryan", - "Spider region", - "WinterTire", - "Nycro", - "Vyster", // previously "Bewearium" - "William", - "HellGoat2", - "116taj", - "CaineSenpai", - "Suicide Dreams", - "Roxas", - "Obsoleek", - "Jetpat3", - "GreenTea", - "Woah", - "Ryaegos", - "Popsickle Yoshi", - "Arcadia", - "JensB__", - "Nuclei", - "Picasso's Bean", - "Corn M. Cobb", - "kgh8090", - "Luke", - "Barbara", - "Alexis", - "Soko", - "Albino gonkvader", - "Monic", - "Slim", - "ChaosChaos", - "Deallly", - "Jeff", - "vcf55", - "Kazurgundu", - "Jheybyrd", - "Kipluck", - "SCONICBOOM", - "Mr.Matter", - "Billy", - "jjth0m3", - "GTW High Cube", - "Sabrina", - "Potato - Stego", - "Perditio Astrum", - "MaxingOut", - "SharZz", - "Allegro", - "hoosfire", - "Lauren", - "Ultra Succ", - "Ethan", - "Pacnysam", - "dummyAzure", - "Jaykob", - "Goblin", - "NoOneElse", - "Nicholas", - "Toasty", - "oli saer", - "Blobby6799", - "Domrinth", - "zombieseatflesh7", - "Shiny", - "Whale", - "The Infinity", - "MrCreamen", - "TemperedAether", - "LucasTwocas", - "JustLonelyPi", - "Brian", - "Ashton", - "Rolandark", - "Ally2Cute", - "Dionysos", - "Plant Waifu", - "fire", - "Charles", - "Kaden", - "Dr. Pawsworth", - "Jackson", - "Freakish", - "Ashamper", - "Kinzoku", - "Elementari", - "The Wolf Commando", - "Jordan", - "Jessire", - "Ashton", - "callisto", - "velneu", - "Mathuantie", - "Robert", - "Matias", - "T E R M I N A T O R", - "apotofkoolaid", - "Matthew", - "Terrarian Dragon", - "Pomelo", - "Thomas", - "Iconic Parker Gaming", - "Jaydon", - "Aidan", - "Avery", - "yayoi", - "Splotchycrib", - "GIGA MAN", - "Eric", - "Merubel", - "Smug", - "Lime-Wars l 1", - "WillyDilly", - "xAqult", - "Himakaze", - "Face", - "Carboniferous", - "James", - "Taitou1", - "Yumi", - "NEBULA", - "Blackbluue", - "Alex", - "Ruben", - "Rixu", - "Antonie", - "Zerimore", - "Oblivionisbruh", - "Loser", - "Patrick", - "Magic Love", - "gluten tag", - "RetroRed", - "Katherine", - "SoyScoutSmasher", - "Jersey", - "Reiter splash", - "Conner", - "Ekun", - "Driser", - "bikmin", - "MittoMan", - "Pyromaniac146", - "Eddie Spaghetti", - "Colin", - "ZyferDex_", - "LumiEvi", - "Anish", - "MissMudflaps", - "Valkyrie", - "anglerraptor", - "Scribbles", - "Pneuma", - "OrrangProto", - "Tomat (Stevie)", - "That Katsafaros", - "PsychoGrizzly", - "Dayne", - "Hargestar", - "The Pyro", - "Lucas", - "Superbeepig", - "Larry That Barry", - "Monti", - "StarryFox", - "Kevin", - "Poopifier Poopifly", - "Lacuna", - "Nathan", - "Handburger", - "XusTingo9", - "Underlost", - "julius", - "Mark", - "Habb", - "Reanamet", - "Empress Vega", - "Team", - "GP", - "Xsiana", - "NyanLegacy215", - "ethan", - "Trinity Series", - "M001NG", - "WrathOfOlympus", - "dennis", - "Darkweb", - "Chaozhi", - "Mars", - "Elijah", - "Tezguin", - "Shpee", - "Archie", - "Meow", - "CosmicStarIight", - "Alfragiste", - "Number1piratepan", - "Noah", - "Max Kim", - "Anton", - "edm vibes", - "Hunter", - "Doodled_lynx", - "3en", - "Kiyotu", - "Aero", - "Iguy", - "병현 송", - "Tyler", - "Leonidas", - "GregTheSpinarak", - "Cheddar", - "Alex N", - "Magicoal", - "Seanツ", - "Ariscottle", - "Kevin", - "OnTheAirPogs", - "Zerafir", - "Bill", - "Starmitzy", - "FaeLoPondering", - "Brian", - "Smart2004", - "sherk", - "Squishy", - "Ash", - "rawpie2", - "Hokojin", - "sk", - "Done", - "MeanieG", - "Sanctuary", - "Landon", - "Moonicento", - "Hayden", - "Steven", - "Hana", - "Mikabul", - "Nathaniel", - "Brutus", - "EdelVollMilch", - "garfu", - "NuT NiTe", - "adain", - "Dylan", - "Lucas", - "Arthur", - "sweatingdishes", - "pomp neigh", - "Proffesor prostate", - "Saladify", - "26-4-1", - "VeryMasterNinja", - "Vorbis", - "Nyapano", - "Shadoku", - "allosar", - "jes", - "Paltham", - "Fartein", - "Derdjin", - "A_Normal_Person", - "Duck Satan", - "Jalapeno9", - "Grylken", - "Nexus", - "KJ", - "Goober", - "ChAoS DiScOrD", - "Mayhem", - "Zombified _G", - "Madd Cat", - "Natalie", - "Solaire", - "Dakota C", - "The Davester", - "Jose", - "Him", - "Umberto", - "Lance", - "Navigator", - "Ferret4T", - "Rooki", - "LvL-94", - "Feels Fishy", - "Korb Orb", - "Calcium Comrade", - "Talmadge", - "ddoogg88 tdog", - "CasualNoLifer", - "Bossy Punch", - "Creamy", - "Tyler", - "topnormal", - "Gilded Gryphon", - "Nightskyflyer", - "Schlarfblrfsch", - "MrNobody", - "Aden C.N.", - "zombie wolf", - "n0tacat", - "Marko", - "dexxer65", - "DeLordeyeee", - "Kaledoulas", - "Mohammad", - "Skeli_G", - "Arcxus", - "Sigil", - "Dull", - "DjackV", - "Misinput", - "Gameology", - "KugelBlitz", - "TheGreatSako", - "Joep", - "Rottingwood", - "anything5000", - "Gretchen", - "Spirit Shield", - "Briny_Coffee", - "_Skeggy_", - "just akkolite", - "J.U.N.E.S", - "Bruggs", - "Vimek Xol", - "Oceanman232", - "Sadouken", - "srxe", - "ProfessorWinston", - "OctolingGrimm", - "Cole", - "Markie", - "Met Vox", - "Tweee", - "Kaimonick", - "Chow Chow", - "drenmus!", - "Nitronium Productions", - "Goomfrontlut", - "Akkolite", - "Shaun", - "Bruh.PNG", - "James", - "Lord_Lucerne", - "Ulmod", - "Adamko", - "Gamma Freya", - "Finnrua", - "Maskedmilo", - "RockRecker39", - "Konorango", - "Indeciiissive", - "Curtis", - "Ponynator", - "Crippling-Ambition", - "TitaniumLlama", - "OriginForme487", - "FishBread", - "Real mystlc", - "Levi", - "jc.", - "Medi", - "Jakob", - "Borb9834", - "Georgios", - "KeL", - "Cody", - "Cristian(Mihaii)", - "Marco", - "RuskieThe3rd", - "BreachNClear747", - "happy thoughts", - "Azure", - "theHoopty", - "porglesupreme", - "XDkilljoy65XX", - "Mr. Bones", - "dawnboi", - "Joe", - "Sailor Jolt", - "SomeRando", - "Nuclear Chaos", - "Jankle", - "The Roborex", - "everquartz", - "discokittie", - "IsaacInsomnia", - "xElectrix_", - "Forge", - "MiyoshiEira", - "thebettercat", - "Darthlego", - "Azzilan", - "Griffin", - "LucasHM", - "ChrigTopher", - "Colin V", - "Scrumlet", - "Darkus", - "Homunculus Derelictus", - "Professor Pissington", - "Buppercups - Roblox", - "Pusheen_", - "Patrera" - }; - projectileDestroyExceptionList = new List() { //holdout projectiles @@ -2737,7 +2103,6 @@ namespace CalamityMod public override void Unload() { - donatorList = null; projectileDestroyExceptionList = null; enemyImmunityList = null; confusionEnemyList = null; diff --git a/NPCs/TownNPCs/FAP.cs b/NPCs/TownNPCs/FAP.cs index 81104f2006..bcb8059e40 100644 --- a/NPCs/TownNPCs/FAP.cs +++ b/NPCs/TownNPCs/FAP.cs @@ -7,6 +7,7 @@ using CalamityMod.Items.Potions.Alcohol; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Summon; +using CalamityMod.Systems.Collections; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -841,16 +842,7 @@ namespace CalamityMod.NPCs.TownNPCs else if (deaths > 100) text += " " + this.GetLocalizedValue("Death100"); - IList donorList = new List(CalamityLists.donatorList); - int maxDonorsListed = 25; - string[] donors = new string[maxDonorsListed]; - for (int i = 0; i < maxDonorsListed; i++) - { - donors[i] = donorList[Main.rand.Next(donorList.Count)]; - donorList.Remove(donors[i]); - } - - text += ("\n\n" + this.GetLocalization("DonorShoutout").Format(donors)); + text += "\n\n" + this.GetLocalization("DonorShoutout").Format(DonatorNameList.GetRandomDonors()); return text; } diff --git a/Systems/Collections/DonatorNameList.cs b/Systems/Collections/DonatorNameList.cs new file mode 100644 index 0000000000..5ea0d0fa65 --- /dev/null +++ b/Systems/Collections/DonatorNameList.cs @@ -0,0 +1,669 @@ +using System.Collections.Generic; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that stores all of Calamity's Patreon donator's usernames. + /// + public sealed class DonatorNameList : ModSystem + { + private static List _donatorNames; + + public override void OnModLoad() + { + _donatorNames = + [ + "Vorbis", + "SoloMael", + "Chaotic Reks", + "The Buildmonger", + "YuH", + "Littlepiggy", + "LompL", + "Lilith", + "Ben Shapiro", + "Frederik", + "Faye", + "Gibb50", + "Braden", + "Hannes", + "profoundmango69", + "Jack", + "Hans Volter", + "Krankwagon", + "MishiroUsui", + "pixlgray", + "Arkhine", + "Lodude", + "DevAesthetic", + "Mister Winchester", + "Zacky", + "Veine", + "Javyz", + "Shifter", + "Crysthamyr", + "Elfinlocks", + "Ein", + "2Larry2", + "Jenonen", + "Dodu", + "Arti", + "Tervastator", + "Luis", + "Alexander", + "BakaQing", + "Taylor", + "Xaphlactus", + "MajinBagel", + "Bendy", + "Rando Calrissian", + "Tails the Fox 92", + "Bread", + "Minty Candy", + "Preston", + "MovingTarget_086", + "Shiro", + "Chip", + "Taylor", + "ShotgunAngel", + "Sandblast", + "ThomasThePencil", + "Aero (Aero#4599)", + "Shirosity", // used to be GlitchOut + "Daawnz", + "CrabBar", + "Yatagarasu", + "Jarod", + "Zombieh", + "MingWhy", + "Random Weeb", + "Afzofa", + "Eragon3942", + "TheBlackHand", + "william", + "Samuel", + "Christopher", + "DemoN K!ng", + "Malik", + "Ryan Baker-Ortiz", + "Aleksanders", + "TheSilverGhost", + "Lucazii", + "Shay", + "Prism", + "BobIsNotMyRealName", + "Guwahavel", + "Azura", + "Joshua", + "Doveda", + "William", + "Arche", + "DevilSunrise", + "Yanmei", + "Chaos", + "Ryan", + "Fish Repairs", + "Melvin", + "Vroomy Has -3,000 IQ", + "The Goliath", + "DaPyRo", + "Takeru", + "Circuit-Jay", + "Commmander Frostbite", + "cytokat", + "Cameron", + "Orudeon", + "BumbleDoge", + "Naglfar", + "Helixas", + "Vetus", + "High Charity", + "Devonte", + "Cerberus", + "Brendan", + "Victor", + "KAT-G307", + "Tombarry Expresserino", + "Drip Veezy", + "Glaid", + "Apotheosis", + "Bladesaber", + "Devon", + "Ruthoranium", + "cocodezi_", + "Mendzey", + "GameRDheAsianSandwich", + "Chigbungus", + "Streakist", + "Eisaya", + "Xenocrona", + "RKMoon", + "Eternal Silence", + "Jeff", + "Beta165", + "DanYami", + "Xenocrona", + "Ari", + "cosmickalamity", + "xd Ow0", + "Darren", + "Florian", + "dawn thunder", + "asdf935", + "GentSkeleton", + "Fizzlpoprock", + "Pigeon", + "Aleksh", + "Just a random guy", + "Dee", + "Æthereal", + "Broken Faucet", + "Sarcosuchus", + "Marissa443", + "Warlok", + "JackShizz", + "NebulaMagePlays", + "Primpy", + "Thys", + "Min", + "Wodernet", + "Pedro", + "Depressed Dad Gaming", + "Snowy", + "Stormone", + "Mobian", + "Rinja", + "Check pins", + "Dakota", + "Neoplasmatic", + "False", + "Whitegiraffe", + "Drakkece", + "Levi", + "Izuna", + "djsnj20", + "pyobbo", + "Alec", + "The Illustrious Sqouinchuousor", + "Moist Lad", + "TwanTheGOAT", + "3x1t_5tyl3", + "Will", + "SpookyNinja", + "Boomdiada", + "Culex", + "Rossadon", + "Ben", + "hubert thieblot", + "NepNep", + "Nanaki", + "CrimsonCrips", + "Lagohz", + "Timon", + "F00d Demon", + "Olkothan", + "Vmar98", + "Dasdruid", + "Cinder", + "Brutzli", + "Yhashtur", + "Zekai", + "Doug", + "Uberransy", + "KurlozClown", + "Nemesis 041", + "Asheel", + "Hayden", + "Lightedflare", + "Lady Shira", + "Devin", + "Qelrin", + "Thomas", + "Ne'er Dowell", + "Potion Man", + "martyrdomination", + "Destructoid", + "Coolguystorm YT", + "Wolfmaw", + "yiumik", + "Destiny Stallcup", + "GreenBerry", + "SolsticeUnlimitd", + "darkhawke", + "oracle", + "YumeiSenshi", + "Cameron", + "Toxin", + "Fweepachino", + "DESPACITO", + "Altzeus", + "Ryan", + "Spider region", + "WinterTire", + "Nycro", + "Vyster", // previously "Bewearium" + "William", + "HellGoat2", + "116taj", + "CaineSenpai", + "Suicide Dreams", + "Roxas", + "Obsoleek", + "Jetpat3", + "GreenTea", + "Woah", + "Ryaegos", + "Popsickle Yoshi", + "Arcadia", + "JensB__", + "Nuclei", + "Picasso's Bean", + "Corn M. Cobb", + "kgh8090", + "Luke", + "Barbara", + "Alexis", + "Soko", + "Albino gonkvader", + "Monic", + "Slim", + "ChaosChaos", + "Deallly", + "Jeff", + "vcf55", + "Kazurgundu", + "Jheybyrd", + "Kipluck", + "SCONICBOOM", + "Mr.Matter", + "Billy", + "jjth0m3", + "GTW High Cube", + "Sabrina", + "Potato - Stego", + "Perditio Astrum", + "MaxingOut", + "SharZz", + "Allegro", + "hoosfire", + "Lauren", + "Ultra Succ", + "Ethan", + "Pacnysam", + "dummyAzure", + "Jaykob", + "Goblin", + "NoOneElse", + "Nicholas", + "Toasty", + "oli saer", + "Blobby6799", + "Domrinth", + "zombieseatflesh7", + "Shiny", + "Whale", + "The Infinity", + "MrCreamen", + "TemperedAether", + "LucasTwocas", + "JustLonelyPi", + "Brian", + "Ashton", + "Rolandark", + "Ally2Cute", + "Dionysos", + "Plant Waifu", + "fire", + "Charles", + "Kaden", + "Dr. Pawsworth", + "Jackson", + "Freakish", + "Ashamper", + "Kinzoku", + "Elementari", + "The Wolf Commando", + "Jordan", + "Jessire", + "Ashton", + "callisto", + "velneu", + "Mathuantie", + "Robert", + "Matias", + "T E R M I N A T O R", + "apotofkoolaid", + "Matthew", + "Terrarian Dragon", + "Pomelo", + "Thomas", + "Iconic Parker Gaming", + "Jaydon", + "Aidan", + "Avery", + "yayoi", + "Splotchycrib", + "GIGA MAN", + "Eric", + "Merubel", + "Smug", + "Lime-Wars l 1", + "WillyDilly", + "xAqult", + "Himakaze", + "Face", + "Carboniferous", + "James", + "Taitou1", + "Yumi", + "NEBULA", + "Blackbluue", + "Alex", + "Ruben", + "Rixu", + "Antonie", + "Zerimore", + "Oblivionisbruh", + "Loser", + "Patrick", + "Magic Love", + "gluten tag", + "RetroRed", + "Katherine", + "SoyScoutSmasher", + "Jersey", + "Reiter splash", + "Conner", + "Ekun", + "Driser", + "bikmin", + "MittoMan", + "Pyromaniac146", + "Eddie Spaghetti", + "Colin", + "ZyferDex_", + "LumiEvi", + "Anish", + "MissMudflaps", + "Valkyrie", + "anglerraptor", + "Scribbles", + "Pneuma", + "OrrangProto", + "Tomat (Stevie)", + "That Katsafaros", + "PsychoGrizzly", + "Dayne", + "Hargestar", + "The Pyro", + "Lucas", + "Superbeepig", + "Larry That Barry", + "Monti", + "StarryFox", + "Kevin", + "Poopifier Poopifly", + "Lacuna", + "Nathan", + "Handburger", + "XusTingo9", + "Underlost", + "julius", + "Mark", + "Habb", + "Reanamet", + "Empress Vega", + "Team", + "GP", + "Xsiana", + "NyanLegacy215", + "ethan", + "Trinity Series", + "M001NG", + "WrathOfOlympus", + "dennis", + "Darkweb", + "Chaozhi", + "Mars", + "Elijah", + "Tezguin", + "Shpee", + "Archie", + "Meow", + "CosmicStarIight", + "Alfragiste", + "Number1piratepan", + "Noah", + "Max Kim", + "Anton", + "edm vibes", + "Hunter", + "Doodled_lynx", + "3en", + "Kiyotu", + "Aero", + "Iguy", + "병현 송", + "Tyler", + "Leonidas", + "GregTheSpinarak", + "Cheddar", + "Alex N", + "Magicoal", + "Seanツ", + "Ariscottle", + "Kevin", + "OnTheAirPogs", + "Zerafir", + "Bill", + "Starmitzy", + "FaeLoPondering", + "Brian", + "Smart2004", + "sherk", + "Squishy", + "Ash", + "rawpie2", + "Hokojin", + "sk", + "Done", + "MeanieG", + "Sanctuary", + "Landon", + "Moonicento", + "Hayden", + "Steven", + "Hana", + "Mikabul", + "Nathaniel", + "Brutus", + "EdelVollMilch", + "garfu", + "NuT NiTe", + "adain", + "Dylan", + "Lucas", + "Arthur", + "sweatingdishes", + "pomp neigh", + "Proffesor prostate", + "Saladify", + "26-4-1", + "VeryMasterNinja", + "Vorbis", + "Nyapano", + "Shadoku", + "allosar", + "jes", + "Paltham", + "Fartein", + "Derdjin", + "A_Normal_Person", + "Duck Satan", + "Jalapeno9", + "Grylken", + "Nexus", + "KJ", + "Goober", + "ChAoS DiScOrD", + "Mayhem", + "Zombified _G", + "Madd Cat", + "Natalie", + "Solaire", + "Dakota C", + "The Davester", + "Jose", + "Him", + "Umberto", + "Lance", + "Navigator", + "Ferret4T", + "Rooki", + "LvL-94", + "Feels Fishy", + "Korb Orb", + "Calcium Comrade", + "Talmadge", + "ddoogg88 tdog", + "CasualNoLifer", + "Bossy Punch", + "Creamy", + "Tyler", + "topnormal", + "Gilded Gryphon", + "Nightskyflyer", + "Schlarfblrfsch", + "MrNobody", + "Aden C.N.", + "zombie wolf", + "n0tacat", + "Marko", + "dexxer65", + "DeLordeyeee", + "Kaledoulas", + "Mohammad", + "Skeli_G", + "Arcxus", + "Sigil", + "Dull", + "DjackV", + "Misinput", + "Gameology", + "KugelBlitz", + "TheGreatSako", + "Joep", + "Rottingwood", + "anything5000", + "Gretchen", + "Spirit Shield", + "Briny_Coffee", + "_Skeggy_", + "just akkolite", + "J.U.N.E.S", + "Bruggs", + "Vimek Xol", + "Oceanman232", + "Sadouken", + "srxe", + "ProfessorWinston", + "OctolingGrimm", + "Cole", + "Markie", + "Met Vox", + "Tweee", + "Kaimonick", + "Chow Chow", + "drenmus!", + "Nitronium Productions", + "Goomfrontlut", + "Akkolite", + "Shaun", + "Bruh.PNG", + "James", + "Lord_Lucerne", + "Ulmod", + "Adamko", + "Gamma Freya", + "Finnrua", + "Maskedmilo", + "RockRecker39", + "Konorango", + "Indeciiissive", + "Curtis", + "Ponynator", + "Crippling-Ambition", + "TitaniumLlama", + "OriginForme487", + "FishBread", + "Real mystlc", + "Levi", + "jc.", + "Medi", + "Jakob", + "Borb9834", + "Georgios", + "KeL", + "Cody", + "Cristian(Mihaii)", + "Marco", + "RuskieThe3rd", + "BreachNClear747", + "happy thoughts", + "Azure", + "theHoopty", + "porglesupreme", + "XDkilljoy65XX", + "Mr. Bones", + "dawnboi", + "Joe", + "Sailor Jolt", + "SomeRando", + "Nuclear Chaos", + "Jankle", + "The Roborex", + "everquartz", + "discokittie", + "IsaacInsomnia", + "xElectrix_", + "Forge", + "MiyoshiEira", + "thebettercat", + "Darthlego", + "Azzilan", + "Griffin", + "LucasHM", + "ChrigTopher", + "Colin V", + "Scrumlet", + "Darkus", + "Homunculus Derelictus", + "Professor Pissington", + "Buppercups - Roblox", + "Pusheen_", + "Patrera" + ]; + } + + public override void Unload() => _donatorNames = null; + + /// + /// Returns 25 random donator usernames. + /// + public static string[] GetRandomDonors() + { + List donorList = new(_donatorNames); + const int maxDonorsListed = 25; + string[] donors = new string[maxDonorsListed]; + for (int i = 0; i < maxDonorsListed; i++) + { + donors[i] = donorList[Main.rand.Next(donorList.Count)]; + donorList.Remove(donors[i]); + } + + return donors; + } + } +} From 67715a62d4b6e1249705968f82490ab048b0ff7e Mon Sep 17 00:00:00 2001 From: Memes <114233643+Mr-Memes@users.noreply.github.com> Date: Mon, 14 Oct 2024 00:24:25 +0200 Subject: [PATCH 046/118] ProjectileDestroyExceptionsList and cleanup. --- CalPlayer/CalamityPlayerHitHurt.cs | 7 +- CalamityLists.cs | 118 -------------- NPCs/TownNPCs/FAP.cs | 2 +- ...DonatorNameList.cs => DonatorsNameList.cs} | 10 +- .../ProjectileDestroyExceptionsList.cs | 149 ++++++++++++++++++ 5 files changed, 159 insertions(+), 127 deletions(-) rename Systems/Collections/{DonatorNameList.cs => DonatorsNameList.cs} (98%) create mode 100644 Systems/Collections/ProjectileDestroyExceptionsList.cs diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index 92a2ea4e13..0e7913bae3 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -42,6 +42,7 @@ using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Typeless; +using CalamityMod.Systems.Collections; using CalamityMod.UI; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -912,7 +913,7 @@ namespace CalamityMod.CalPlayer { // TODO -- Evolution dodge isn't actually a dodge and you'll still get hit for 1. // This should probably be changed so that when the evolution reflects it gives you 1 frame of guaranteed free dodging everything. - if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => proj.type != x) && proj.active && !proj.friendly && proj.hostile && proj.damage > 0) + if (!ProjectileDestroyExceptionsList.IsDestroyException(proj) && proj.active && !proj.friendly && proj.hostile && proj.damage > 0) { double dodgeDamageGateValuePercent = 0.05; int dodgeDamageGateValue = (int)Math.Round(Player.statLifeMax2 * dodgeDamageGateValuePercent); @@ -1045,7 +1046,7 @@ namespace CalamityMod.CalPlayer projectileDamageReduction += 0.25; } - if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => proj.type != x) && proj.active && !proj.friendly && proj.hostile && proj.damage > 0) + if (!ProjectileDestroyExceptionsList.IsDestroyException(proj) && proj.active && !proj.friendly && proj.hostile && proj.damage > 0) { // Daedalus Reflect counts as a reflect but doesn't actually stop you from taking damage if (daedalusReflect && !disableAllDodges && !evolution && !Player.HasCooldown(GlobalDodge.ID)) @@ -1467,7 +1468,7 @@ namespace CalamityMod.CalPlayer } // As these reflects do not cancel damage, they need to be in OnHit rather than ModifyHit - if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => proj.type != x) && proj.active && !proj.friendly && proj.hostile && hurtInfo.Damage > 0) + if (!ProjectileDestroyExceptionsList.IsDestroyException(proj) && proj.active && !proj.friendly && proj.hostile && hurtInfo.Damage > 0) { double dodgeDamageGateValuePercent = 0.05; int dodgeDamageGateValue = (int)Math.Round(Player.statLifeMax2 * dodgeDamageGateValuePercent); diff --git a/CalamityLists.cs b/CalamityLists.cs index 209d7b002e..9e46306f66 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -62,7 +62,6 @@ using CalamityMod.NPCs.StormWeaver; using CalamityMod.NPCs.SunkenSea; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs.Yharon; -using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Melee; @@ -165,122 +164,6 @@ namespace CalamityMod public override void OnModLoad() { - projectileDestroyExceptionList = new List() - { - //holdout projectiles - ProjectileID.Phantasm, - ProjectileID.VortexBeater, - ProjectileID.DD2PhoenixBow, - ProjectileID.LastPrism, - ProjectileID.LastPrismLaser, - ProjectileID.LaserMachinegun, - ProjectileID.ChargedBlasterCannon, - ProjectileID.MedusaHead, - - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - - // Some hostile boss projectiles - ProjectileID.SaucerDeathray, - ProjectileID.PhantasmalDeathray, - - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType() - }; - enemyImmunityList = new List() { NPCID.KingSlime, @@ -2103,7 +1986,6 @@ namespace CalamityMod public override void Unload() { - projectileDestroyExceptionList = null; enemyImmunityList = null; confusionEnemyList = null; dungeonEnemyBuffList = null; diff --git a/NPCs/TownNPCs/FAP.cs b/NPCs/TownNPCs/FAP.cs index bcb8059e40..b7a01b79ce 100644 --- a/NPCs/TownNPCs/FAP.cs +++ b/NPCs/TownNPCs/FAP.cs @@ -842,7 +842,7 @@ namespace CalamityMod.NPCs.TownNPCs else if (deaths > 100) text += " " + this.GetLocalizedValue("Death100"); - text += "\n\n" + this.GetLocalization("DonorShoutout").Format(DonatorNameList.GetRandomDonors()); + text += "\n\n" + this.GetLocalization("DonorShoutout").Format(DonatorsNameList.GetRandomDonors()); return text; } diff --git a/Systems/Collections/DonatorNameList.cs b/Systems/Collections/DonatorsNameList.cs similarity index 98% rename from Systems/Collections/DonatorNameList.cs rename to Systems/Collections/DonatorsNameList.cs index 5ea0d0fa65..ed851b871a 100644 --- a/Systems/Collections/DonatorNameList.cs +++ b/Systems/Collections/DonatorsNameList.cs @@ -7,13 +7,13 @@ namespace CalamityMod.Systems.Collections /// /// A that stores all of Calamity's Patreon donator's usernames. /// - public sealed class DonatorNameList : ModSystem + public sealed class DonatorsNameList : ModSystem { - private static List _donatorNames; + public static IList List { get; private set; } public override void OnModLoad() { - _donatorNames = + List = [ "Vorbis", "SoloMael", @@ -647,14 +647,14 @@ namespace CalamityMod.Systems.Collections ]; } - public override void Unload() => _donatorNames = null; + public override void Unload() => List = null; /// /// Returns 25 random donator usernames. /// public static string[] GetRandomDonors() { - List donorList = new(_donatorNames); + List donorList = new(List); const int maxDonorsListed = 25; string[] donors = new string[maxDonorsListed]; for (int i = 0; i < maxDonorsListed; i++) diff --git a/Systems/Collections/ProjectileDestroyExceptionsList.cs b/Systems/Collections/ProjectileDestroyExceptionsList.cs new file mode 100644 index 0000000000..ecfb0cdc0e --- /dev/null +++ b/Systems/Collections/ProjectileDestroyExceptionsList.cs @@ -0,0 +1,149 @@ +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Rogue; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that holds a list of all projectiles that should be, exceptionally, ignored by projectile destruction. + /// + public sealed class ProjectileDestroyExceptionsList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + // Holdout projectiles. + ProjectileID.Phantasm, + ProjectileID.VortexBeater, + ProjectileID.DD2PhoenixBow, + ProjectileID.LastPrism, + ProjectileID.LastPrismLaser, + ProjectileID.LaserMachinegun, + ProjectileID.ChargedBlasterCannon, + ProjectileID.MedusaHead, + + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + + // Some hostile boss projectiles. + ProjectileID.SaucerDeathray, + ProjectileID.PhantasmalDeathray, + + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType() + ]; + } + + public override void Unload() => List = null; + + /// + /// A shorthand method to check if a projectile belongs in the exception list. + /// + public static bool IsDestroyException(Projectile proj) => List.Any(x => proj.type == x); + } +} From ece86cc82ffc8cde56c496ea28f0b84fd26e2eea Mon Sep 17 00:00:00 2001 From: Memes <114233643+Mr-Memes@users.noreply.github.com> Date: Tue, 15 Oct 2024 22:55:58 +0200 Subject: [PATCH 047/118] EnemyImmunitiesList. --- Buffs/CalamityGlobalBuff.cs | 5 +- Buffs/DamageOverTime/TrueVulnerabilityHex.cs | 3 +- Buffs/DamageOverTime/Vaporfied.cs | 3 +- Buffs/DamageOverTime/VulnerabilityHex.cs | 3 +- Buffs/StatDebuffs/Eutrophication.cs | 3 +- Buffs/StatDebuffs/GalvanicCorrosion.cs | 3 +- Buffs/StatDebuffs/GlacialState.cs | 3 +- Buffs/StatDebuffs/KamiFlu.cs | 3 +- Buffs/StatDebuffs/TemporalSadness.cs | 3 +- Buffs/StatDebuffs/TimeDistortion.cs | 3 +- CalPlayer/CalamityPlayerOnHit.cs | 1 + CalamityLists.cs | 146 -------------- NPCs/CalamityGlobalNPC.cs | 3 +- Systems/Collections/EnemyImmunitiesList.cs | 191 +++++++++++++++++++ Utilities/NPCDebuffs.cs | 3 +- 15 files changed, 217 insertions(+), 159 deletions(-) create mode 100644 Systems/Collections/EnemyImmunitiesList.cs diff --git a/Buffs/CalamityGlobalBuff.cs b/Buffs/CalamityGlobalBuff.cs index 37acd3132c..45fc1974d3 100644 --- a/Buffs/CalamityGlobalBuff.cs +++ b/Buffs/CalamityGlobalBuff.cs @@ -1,6 +1,7 @@ using CalamityMod.Balancing; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.NPCs; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -104,7 +105,7 @@ namespace CalamityMod.Buffs { if (npc.Calamity().webbed < npc.buffTime[buffIndex]) npc.Calamity().webbed = npc.buffTime[buffIndex]; - if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + if ((EnemyImmunitiesList.IsNPCImmune(npc) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().webbed; npc.DelBuff(buffIndex); buffIndex--; @@ -113,7 +114,7 @@ namespace CalamityMod.Buffs { if (npc.Calamity().slowed < npc.buffTime[buffIndex]) npc.Calamity().slowed = npc.buffTime[buffIndex]; - if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + if ((EnemyImmunitiesList.IsNPCImmune(npc) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().slowed; npc.DelBuff(buffIndex); buffIndex--; diff --git a/Buffs/DamageOverTime/TrueVulnerabilityHex.cs b/Buffs/DamageOverTime/TrueVulnerabilityHex.cs index ff9aeafec2..26620b2a52 100644 --- a/Buffs/DamageOverTime/TrueVulnerabilityHex.cs +++ b/Buffs/DamageOverTime/TrueVulnerabilityHex.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts; using CalamityMod.NPCs; using CalamityMod.Particles; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -40,7 +41,7 @@ namespace CalamityMod.Buffs.DamageOverTime } // Apply immunity timer. - if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && cgn.debuffResistanceTimer <= 0) + if ((EnemyImmunitiesList.IsNPCImmune(npc) || npc.boss) && cgn.debuffResistanceTimer <= 0) cgn.debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + cgn.trueVulnerabilityHex; // Destroy the vanilla buff, we don't use it. diff --git a/Buffs/DamageOverTime/Vaporfied.cs b/Buffs/DamageOverTime/Vaporfied.cs index 15064126fb..95fb11724b 100644 --- a/Buffs/DamageOverTime/Vaporfied.cs +++ b/Buffs/DamageOverTime/Vaporfied.cs @@ -1,4 +1,5 @@ using CalamityMod.NPCs; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -26,7 +27,7 @@ namespace CalamityMod.Buffs.DamageOverTime { if (npc.Calamity().vaporfied < npc.buffTime[buffIndex]) npc.Calamity().vaporfied = npc.buffTime[buffIndex]; - if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + if ((EnemyImmunitiesList.IsNPCImmune(npc) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().vaporfied; npc.DelBuff(buffIndex); buffIndex--; diff --git a/Buffs/DamageOverTime/VulnerabilityHex.cs b/Buffs/DamageOverTime/VulnerabilityHex.cs index 13cbad0a14..adbcfe635a 100644 --- a/Buffs/DamageOverTime/VulnerabilityHex.cs +++ b/Buffs/DamageOverTime/VulnerabilityHex.cs @@ -1,6 +1,7 @@ using CalamityMod.Dusts; using CalamityMod.NPCs; using CalamityMod.Particles; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -43,7 +44,7 @@ namespace CalamityMod.Buffs.DamageOverTime } // Apply immunity timer. - if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && cgn.debuffResistanceTimer <= 0) + if ((EnemyImmunitiesList.IsNPCImmune(npc) || npc.boss) && cgn.debuffResistanceTimer <= 0) cgn.debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + cgn.vulnerabilityHex; // Destroy the vanilla buff, we don't use it. diff --git a/Buffs/StatDebuffs/Eutrophication.cs b/Buffs/StatDebuffs/Eutrophication.cs index fe7bb2c1f3..e4bf120f00 100644 --- a/Buffs/StatDebuffs/Eutrophication.cs +++ b/Buffs/StatDebuffs/Eutrophication.cs @@ -1,4 +1,5 @@ using CalamityMod.NPCs; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -26,7 +27,7 @@ namespace CalamityMod.Buffs.StatDebuffs { if (npc.Calamity().eutrophication < npc.buffTime[buffIndex]) npc.Calamity().eutrophication = npc.buffTime[buffIndex]; - if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + if ((EnemyImmunitiesList.IsNPCImmune(npc) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().eutrophication; npc.DelBuff(buffIndex); buffIndex--; diff --git a/Buffs/StatDebuffs/GalvanicCorrosion.cs b/Buffs/StatDebuffs/GalvanicCorrosion.cs index 0d6639ee28..17254c5d2f 100644 --- a/Buffs/StatDebuffs/GalvanicCorrosion.cs +++ b/Buffs/StatDebuffs/GalvanicCorrosion.cs @@ -1,4 +1,5 @@ using CalamityMod.NPCs; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -19,7 +20,7 @@ namespace CalamityMod.Buffs.StatDebuffs { if (npc.Calamity().tesla < npc.buffTime[buffIndex]) npc.Calamity().tesla = npc.buffTime[buffIndex]; - if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + if ((EnemyImmunitiesList.IsNPCImmune(npc) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().tesla; npc.DelBuff(buffIndex); buffIndex--; diff --git a/Buffs/StatDebuffs/GlacialState.cs b/Buffs/StatDebuffs/GlacialState.cs index d1c0ed7639..0983aad4b4 100644 --- a/Buffs/StatDebuffs/GlacialState.cs +++ b/Buffs/StatDebuffs/GlacialState.cs @@ -1,4 +1,5 @@ using CalamityMod.NPCs; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -26,7 +27,7 @@ namespace CalamityMod.Buffs.StatDebuffs { if (npc.Calamity().gState < npc.buffTime[buffIndex]) npc.Calamity().gState = npc.buffTime[buffIndex]; - if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + if ((EnemyImmunitiesList.IsNPCImmune(npc) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().gState; npc.DelBuff(buffIndex); buffIndex--; diff --git a/Buffs/StatDebuffs/KamiFlu.cs b/Buffs/StatDebuffs/KamiFlu.cs index 2bcb04e825..730ca67496 100644 --- a/Buffs/StatDebuffs/KamiFlu.cs +++ b/Buffs/StatDebuffs/KamiFlu.cs @@ -1,4 +1,5 @@ using CalamityMod.NPCs; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ModLoader; @@ -17,7 +18,7 @@ namespace CalamityMod.Buffs.StatDebuffs { if (npc.Calamity().kamiFlu < npc.buffTime[buffIndex]) npc.Calamity().kamiFlu = npc.buffTime[buffIndex]; - if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + if ((EnemyImmunitiesList.IsNPCImmune(npc) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().kamiFlu; npc.DelBuff(buffIndex); buffIndex--; diff --git a/Buffs/StatDebuffs/TemporalSadness.cs b/Buffs/StatDebuffs/TemporalSadness.cs index 329546014b..8e765be36e 100644 --- a/Buffs/StatDebuffs/TemporalSadness.cs +++ b/Buffs/StatDebuffs/TemporalSadness.cs @@ -1,4 +1,5 @@ using CalamityMod.NPCs; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ModLoader; @@ -17,7 +18,7 @@ namespace CalamityMod.Buffs.StatDebuffs { if (npc.Calamity().tSad < npc.buffTime[buffIndex]) npc.Calamity().tSad = npc.buffTime[buffIndex]; - if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + if ((EnemyImmunitiesList.IsNPCImmune(npc) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().tSad; npc.DelBuff(buffIndex); buffIndex--; diff --git a/Buffs/StatDebuffs/TimeDistortion.cs b/Buffs/StatDebuffs/TimeDistortion.cs index 4156fa9434..f56d673df3 100644 --- a/Buffs/StatDebuffs/TimeDistortion.cs +++ b/Buffs/StatDebuffs/TimeDistortion.cs @@ -1,4 +1,5 @@ using CalamityMod.NPCs; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -19,7 +20,7 @@ namespace CalamityMod.Buffs.StatDebuffs { if (npc.Calamity().timeSlow < npc.buffTime[buffIndex]) npc.Calamity().timeSlow = npc.buffTime[buffIndex]; - if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + if ((EnemyImmunitiesList.IsNPCImmune(npc) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().timeSlow; npc.DelBuff(buffIndex); buffIndex--; diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index 8697e95793..8e2cdefd72 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -33,6 +33,7 @@ using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; +using CalamityMod.Systems.Collections; namespace CalamityMod.CalPlayer { diff --git a/CalamityLists.cs b/CalamityLists.cs index 9e46306f66..7fe90ea38d 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -80,8 +80,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List projectileDestroyExceptionList; - public static List enemyImmunityList; public static List confusionEnemyList; public static List dungeonEnemyBuffList; public static List dungeonProjectileBuffList; @@ -164,150 +162,6 @@ namespace CalamityMod public override void OnModLoad() { - enemyImmunityList = new List() - { - NPCID.KingSlime, - NPCType(), - NPCType(), - NPCType(), - NPCID.EyeofCthulhu, - NPCType(), - NPCID.EaterofWorldsHead, - NPCID.EaterofWorldsBody, - NPCID.EaterofWorldsTail, - NPCID.BrainofCthulhu, - NPCID.Creeper, - NPCID.QueenBee, - NPCID.Deerclops, - NPCID.SkeletronHead, - NPCID.SkeletronHand, - NPCID.WallofFlesh, - NPCID.WallofFleshEye, - NPCID.PirateShipCannon, - NPCID.QueenSlimeBoss, - NPCID.Probe, - NPCID.Retinazer, - NPCID.Spazmatism, - NPCType(), - NPCID.SkeletronPrime, - NPCType(), - NPCID.PrimeCannon, - NPCID.PrimeSaw, - NPCID.PrimeLaser, - NPCID.PrimeVice, - NPCID.Plantera, - NPCID.PlanterasTentacle, - NPCType(), - NPCID.Everscream, - NPCID.SantaNK1, - NPCID.IceQueen, - NPCID.MourningWood, - NPCID.Pumpking, - NPCID.Mothron, - NPCID.Golem, - NPCID.GolemHead, - NPCID.GolemHeadFree, - NPCID.GolemFistRight, - NPCID.GolemFistLeft, - NPCID.MartianSaucerCore, - NPCID.MartianSaucerCannon, - NPCID.MartianSaucerTurret, - NPCID.DukeFishron, - NPCID.Sharkron, - NPCID.Sharkron2, - NPCID.HallowBoss, - NPCID.CultistBoss, - NPCID.CultistDragonHead, - NPCID.CultistDragonBody1, - NPCID.CultistDragonBody2, - NPCID.CultistDragonBody3, - NPCID.CultistDragonBody4, - NPCID.CultistDragonTail, - NPCID.AncientCultistSquidhead, - NPCID.MoonLordHead, - NPCID.MoonLordHand, - NPCID.MoonLordCore, - NPCID.MoonLordFreeEye, - NPCID.DD2WyvernT1, - NPCID.DD2WyvernT2, - NPCID.DD2WyvernT3, - NPCID.DD2DarkMageT1, - NPCID.DD2DarkMageT3, - NPCID.DD2SkeletonT1, - NPCID.DD2SkeletonT3, - NPCID.DD2WitherBeastT2, - NPCID.DD2WitherBeastT3, - NPCID.DD2DrakinT2, - NPCID.DD2DrakinT3, - NPCID.DD2KoboldWalkerT2, - NPCID.DD2KoboldWalkerT3, - NPCID.DD2KoboldFlyerT2, - NPCID.DD2KoboldFlyerT3, - NPCID.DD2OgreT2, - NPCID.DD2OgreT3, - NPCID.DD2Betsy, - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType() - }; - confusionEnemyList = new List() { NPCType(), diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 4f9d40fdd2..045099d291 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -88,6 +88,7 @@ using Terraria.Utilities; using static Terraria.ModLoader.ModContent; using CalamityMod.ExtraTextures; using MonoMod.Utils; +using CalamityMod.Systems.Collections; namespace CalamityMod.NPCs { @@ -8689,7 +8690,7 @@ namespace CalamityMod.NPCs if (target.damage > 0 && !target.boss && !target.friendly && !target.dontTakeDamage && target.type != NPCID.Creeper && target.type != NPCType() && target.type != NPCID.MourningWood && target.type != NPCID.Everscream && target.type != NPCID.SantaNK1 && target.type != NPCType() && target.type != NPCType() && target.type != NPCType() && target.type != NPCType() && target.type != NPCID.GolemFistLeft && target.type != NPCID.GolemFistRight && - target.type != NPCType() && target.type != NPCType() && target.type != NPCID.DD2Betsy && !CalamityLists.enemyImmunityList.Contains(target.type) && !AcidRainEvent.AllMinibosses.Contains(target.type)) + target.type != NPCType() && target.type != NPCType() && target.type != NPCID.DD2Betsy && !EnemyImmunitiesList.IsNPCImmune(target) && !AcidRainEvent.AllMinibosses.Contains(target.type)) { return true; } diff --git a/Systems/Collections/EnemyImmunitiesList.cs b/Systems/Collections/EnemyImmunitiesList.cs new file mode 100644 index 0000000000..e82e7e9dc5 --- /dev/null +++ b/Systems/Collections/EnemyImmunitiesList.cs @@ -0,0 +1,191 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.Abyss; +using CalamityMod.NPCs.AcidRain; +using CalamityMod.NPCs.AquaticScourge; +using CalamityMod.NPCs.AstrumAureus; +using CalamityMod.NPCs.Bumblebirb; +using CalamityMod.NPCs.CalClone; +using CalamityMod.NPCs.Cryogen; +using CalamityMod.NPCs.DesertScourge; +using CalamityMod.NPCs.GreatSandShark; +using CalamityMod.NPCs.Leviathan; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.OldDuke; +using CalamityMod.NPCs.Perforator; +using CalamityMod.NPCs.PlaguebringerGoliath; +using CalamityMod.NPCs.PlagueEnemies; +using CalamityMod.NPCs.ProfanedGuardians; +using CalamityMod.NPCs.Providence; +using CalamityMod.NPCs.Ravager; +using CalamityMod.NPCs.SlimeGod; +using CalamityMod.NPCs.SunkenSea; +using CalamityMod.NPCs.SupremeCalamitas; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains all of the NPC IDs of all NPCs that are immune to special debuffs. + /// + public sealed class EnemyImmunitiesList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.KingSlime, + NPCType(), + NPCType(), + NPCType(), + NPCID.EyeofCthulhu, + NPCType(), + NPCID.EaterofWorldsHead, + NPCID.EaterofWorldsBody, + NPCID.EaterofWorldsTail, + NPCID.BrainofCthulhu, + NPCID.Creeper, + NPCID.QueenBee, + NPCID.Deerclops, + NPCID.SkeletronHead, + NPCID.SkeletronHand, + NPCID.WallofFlesh, + NPCID.WallofFleshEye, + NPCID.PirateShipCannon, + NPCID.QueenSlimeBoss, + NPCID.Probe, + NPCID.Retinazer, + NPCID.Spazmatism, + NPCType(), + NPCID.SkeletronPrime, + NPCType(), + NPCID.PrimeCannon, + NPCID.PrimeSaw, + NPCID.PrimeLaser, + NPCID.PrimeVice, + NPCID.Plantera, + NPCID.PlanterasTentacle, + NPCType(), + NPCID.Everscream, + NPCID.SantaNK1, + NPCID.IceQueen, + NPCID.MourningWood, + NPCID.Pumpking, + NPCID.Mothron, + NPCID.Golem, + NPCID.GolemHead, + NPCID.GolemHeadFree, + NPCID.GolemFistRight, + NPCID.GolemFistLeft, + NPCID.MartianSaucerCore, + NPCID.MartianSaucerCannon, + NPCID.MartianSaucerTurret, + NPCID.DukeFishron, + NPCID.Sharkron, + NPCID.Sharkron2, + NPCID.HallowBoss, + NPCID.CultistBoss, + NPCID.CultistDragonHead, + NPCID.CultistDragonBody1, + NPCID.CultistDragonBody2, + NPCID.CultistDragonBody3, + NPCID.CultistDragonBody4, + NPCID.CultistDragonTail, + NPCID.AncientCultistSquidhead, + NPCID.MoonLordHead, + NPCID.MoonLordHand, + NPCID.MoonLordCore, + NPCID.MoonLordFreeEye, + NPCID.DD2WyvernT1, + NPCID.DD2WyvernT2, + NPCID.DD2WyvernT3, + NPCID.DD2DarkMageT1, + NPCID.DD2DarkMageT3, + NPCID.DD2SkeletonT1, + NPCID.DD2SkeletonT3, + NPCID.DD2WitherBeastT2, + NPCID.DD2WitherBeastT3, + NPCID.DD2DrakinT2, + NPCID.DD2DrakinT3, + NPCID.DD2KoboldWalkerT2, + NPCID.DD2KoboldWalkerT3, + NPCID.DD2KoboldFlyerT2, + NPCID.DD2KoboldFlyerT3, + NPCID.DD2OgreT2, + NPCID.DD2OgreT3, + NPCID.DD2Betsy, + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() + ]; + } + + public override void Unload() => List = null; + + /// + /// A shorthand method to check if an NPC is in this list. + /// + public static bool IsNPCImmune(NPC npc) => List.Contains(npc.type); + } +} diff --git a/Utilities/NPCDebuffs.cs b/Utilities/NPCDebuffs.cs index 31ce973dc9..cd362d8e55 100644 --- a/Utilities/NPCDebuffs.cs +++ b/Utilities/NPCDebuffs.cs @@ -35,6 +35,7 @@ using CalamityMod.NPCs.SulphurousSea; using CalamityMod.NPCs.SunkenSea; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs.Yharon; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -99,7 +100,7 @@ namespace CalamityMod // // All bosses and several enemies are automatically immune to Pearl Aura. - if (CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) + if (EnemyImmunitiesList.IsNPCImmune(npc) || npc.boss) NPCID.Sets.SpecificDebuffImmunity[npc.type][ModContent.BuffType()] = true; // Make all Cal NPCs immune to confused unless otherwise specified From d434ac45e5788f36e7a9865d27f997184d493c3d Mon Sep 17 00:00:00 2001 From: Memes <114233643+Mr-Memes@users.noreply.github.com> Date: Tue, 15 Oct 2024 23:25:11 +0200 Subject: [PATCH 048/118] ConfusionDebuffImmunitiesList. --- CalamityLists.cs | 34 ----------- .../ConfusionDebuffImmunitiesList.cs | 59 +++++++++++++++++++ Utilities/NPCDebuffs.cs | 2 +- 3 files changed, 60 insertions(+), 35 deletions(-) create mode 100644 Systems/Collections/ConfusionDebuffImmunitiesList.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index 7fe90ea38d..d6dbf30475 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -80,7 +80,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List confusionEnemyList; public static List dungeonEnemyBuffList; public static List dungeonProjectileBuffList; public static List bossHPScaleList; @@ -162,37 +161,6 @@ namespace CalamityMod public override void OnModLoad() { - confusionEnemyList = new List() - { - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType() - }; - dungeonEnemyBuffList = new List() { NPCID.SkeletonSniper, @@ -1840,8 +1808,6 @@ namespace CalamityMod public override void Unload() { - enemyImmunityList = null; - confusionEnemyList = null; dungeonEnemyBuffList = null; dungeonProjectileBuffList = null; bossHPScaleList = null; diff --git a/Systems/Collections/ConfusionDebuffImmunitiesList.cs b/Systems/Collections/ConfusionDebuffImmunitiesList.cs new file mode 100644 index 0000000000..c2eeed2c0d --- /dev/null +++ b/Systems/Collections/ConfusionDebuffImmunitiesList.cs @@ -0,0 +1,59 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.Astral; +using CalamityMod.NPCs.Crags; +using CalamityMod.NPCs.NormalNPCs; +using Terraria; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains all of the NPC's IDs of the NPCs who are immune to the Confusion debuff. + /// + public sealed class ConfusionDebuffImmunitiesList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() + ]; + } + + public override void Unload() => List = null; + + /// + /// A shorthand method to check if an NPC is supposed to be immune to the Confusion debuff. + /// + public static bool IsNPCImmune(NPC npc) => List.Contains(npc.type); + } +} diff --git a/Utilities/NPCDebuffs.cs b/Utilities/NPCDebuffs.cs index cd362d8e55..0f4507cdc6 100644 --- a/Utilities/NPCDebuffs.cs +++ b/Utilities/NPCDebuffs.cs @@ -106,7 +106,7 @@ namespace CalamityMod // Make all Cal NPCs immune to confused unless otherwise specified // Extra note: Clams are not in this list as they initially immune to Confused, but are no longer immune once aggro'd. This is set in their AI(). bool cal = npc.ModNPC != null && npc.ModNPC.Mod.Name.Equals(ModContent.GetInstance().Name); - if (!CalamityLists.confusionEnemyList.Contains(npc.type) && cal) + if (!ConfusionDebuffImmunitiesList.IsNPCImmune(npc) && cal) NPCID.Sets.SpecificDebuffImmunity[npc.type][BuffID.Confused] = true; // Sets certain vanilla NPCs and all town NPCs to be immune to most debuffs. From 1d1170a9d67b8d30e4a69b1ef8e19756d83e9e73 Mon Sep 17 00:00:00 2001 From: Memes <114233643+Mr-Memes@users.noreply.github.com> Date: Tue, 15 Oct 2024 23:31:36 +0200 Subject: [PATCH 049/118] BuffedDungeonEnemiesList. --- CalamityLists.cs | 32 ----------- NPCs/CalamityGlobalNPC.cs | 2 +- NPCs/CalamityGlobalNPCLoot.cs | 3 +- .../Collections/BuffedDungeonEnemiesList.cs | 53 +++++++++++++++++++ 4 files changed, 56 insertions(+), 34 deletions(-) create mode 100644 Systems/Collections/BuffedDungeonEnemiesList.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index d6dbf30475..b5cdb6ec45 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -27,7 +27,6 @@ using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.Abyss; using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.AquaticScourge; -using CalamityMod.NPCs.Astral; using CalamityMod.NPCs.AstrumAureus; using CalamityMod.NPCs.AstrumDeus; using CalamityMod.NPCs.BrimstoneElemental; @@ -35,7 +34,6 @@ using CalamityMod.NPCs.Bumblebirb; using CalamityMod.NPCs.CalClone; using CalamityMod.NPCs.CeaselessVoid; using CalamityMod.NPCs.Crabulon; -using CalamityMod.NPCs.Crags; using CalamityMod.NPCs.Cryogen; using CalamityMod.NPCs.DesertScourge; using CalamityMod.NPCs.DevourerofGods; @@ -80,7 +78,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List dungeonEnemyBuffList; public static List dungeonProjectileBuffList; public static List bossHPScaleList; public static List friendlyBeeList; @@ -161,34 +158,6 @@ namespace CalamityMod public override void OnModLoad() { - dungeonEnemyBuffList = new List() - { - NPCID.SkeletonSniper, - NPCID.TacticalSkeleton, - NPCID.SkeletonCommando, - NPCID.Paladin, - NPCID.GiantCursedSkull, - NPCID.BoneLee, - NPCID.DiabolistWhite, - NPCID.DiabolistRed, - NPCID.NecromancerArmored, - NPCID.Necromancer, - NPCID.RaggedCasterOpenCoat, - NPCID.RaggedCaster, - NPCID.HellArmoredBonesSword, - NPCID.HellArmoredBonesMace, - NPCID.HellArmoredBonesSpikeShield, - NPCID.HellArmoredBones, - NPCID.BlueArmoredBonesSword, - NPCID.BlueArmoredBonesNoPants, - NPCID.BlueArmoredBonesMace, - NPCID.BlueArmoredBones, - NPCID.RustyArmoredBonesSwordNoArmor, - NPCID.RustyArmoredBonesSword, - NPCID.RustyArmoredBonesFlail, - NPCID.RustyArmoredBonesAxe - }; - dungeonProjectileBuffList = new List() { ProjectileID.PaladinsHammerHostile, @@ -1808,7 +1777,6 @@ namespace CalamityMod public override void Unload() { - dungeonEnemyBuffList = null; dungeonProjectileBuffList = null; bossHPScaleList = null; friendlyBeeList = null; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 045099d291..bcea7c100a 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -2852,7 +2852,7 @@ namespace CalamityMod.NPCs if (NPC.downedMoonlord) { - if (CalamityLists.dungeonEnemyBuffList.Contains(npc.type)) + if (BuffedDungeonEnemiesList.IsNPCBuffedDungeonEnemy(npc)) { npc.lifeMax = (int)Math.Round(npc.lifeMax * 2.5); npc.damage += 30; diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 0394fb464f..6b8953dba0 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -23,6 +23,7 @@ using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.Astral; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.TownNPCs; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Ores; using CalamityMod.World; using CalamityMod.World.Planets; @@ -1718,7 +1719,7 @@ DukeEditFailed: // All Hardmode Dungeon Enemies // Ectoplasm @ 20% - if (CalamityLists.dungeonEnemyBuffList.Contains(npc.type)) + if (BuffedDungeonEnemiesList.IsNPCBuffedDungeonEnemy(npc)) npcLoot.Add(ItemID.Ectoplasm, 5); #endregion diff --git a/Systems/Collections/BuffedDungeonEnemiesList.cs b/Systems/Collections/BuffedDungeonEnemiesList.cs new file mode 100644 index 0000000000..341463c522 --- /dev/null +++ b/Systems/Collections/BuffedDungeonEnemiesList.cs @@ -0,0 +1,53 @@ +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A which contains a of all NPC's IDs of NPCs who are buffed dungeon enemies. + /// + public sealed class BuffedDungeonEnemiesList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.SkeletonSniper, + NPCID.TacticalSkeleton, + NPCID.SkeletonCommando, + NPCID.Paladin, + NPCID.GiantCursedSkull, + NPCID.BoneLee, + NPCID.DiabolistWhite, + NPCID.DiabolistRed, + NPCID.NecromancerArmored, + NPCID.Necromancer, + NPCID.RaggedCasterOpenCoat, + NPCID.RaggedCaster, + NPCID.HellArmoredBonesSword, + NPCID.HellArmoredBonesMace, + NPCID.HellArmoredBonesSpikeShield, + NPCID.HellArmoredBones, + NPCID.BlueArmoredBonesSword, + NPCID.BlueArmoredBonesNoPants, + NPCID.BlueArmoredBonesMace, + NPCID.BlueArmoredBones, + NPCID.RustyArmoredBonesSwordNoArmor, + NPCID.RustyArmoredBonesSword, + NPCID.RustyArmoredBonesFlail, + NPCID.RustyArmoredBonesAxe + ]; + } + + public override void Unload() => List = null; + + /// + /// A shorthand method to check if an NPC is a buffed Dungeon enemy. + /// + public static bool IsNPCBuffedDungeonEnemy(NPC npc) => List.Contains(npc.type); + } +} From 140944081a8c2fd50f1a58cce80e93280edc3713 Mon Sep 17 00:00:00 2001 From: Memes <114233643+Mr-Memes@users.noreply.github.com> Date: Tue, 15 Oct 2024 23:37:22 +0200 Subject: [PATCH 050/118] BuffedDungeonProjectilesList. --- CalamityLists.cs | 15 -------- Projectiles/CalamityGlobalProjectile.cs | 3 +- .../BuffedDungeonProjectilesList.cs | 38 +++++++++++++++++++ 3 files changed, 40 insertions(+), 16 deletions(-) create mode 100644 Systems/Collections/BuffedDungeonProjectilesList.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index b5cdb6ec45..7aefb9ee59 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -78,7 +78,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List dungeonProjectileBuffList; public static List bossHPScaleList; public static List friendlyBeeList; public static List debuffList; @@ -158,19 +157,6 @@ namespace CalamityMod public override void OnModLoad() { - dungeonProjectileBuffList = new List() - { - ProjectileID.PaladinsHammerHostile, - ProjectileID.ShadowBeamHostile, - ProjectileID.InfernoHostileBolt, - ProjectileID.InfernoHostileBlast, - ProjectileID.LostSoulHostile, - ProjectileID.SniperBullet, - ProjectileID.RocketSkeleton, - ProjectileID.BulletDeadeye, - ProjectileID.Shadowflames - }; - bossHPScaleList = new List() { NPCID.EaterofWorldsHead, @@ -1777,7 +1763,6 @@ namespace CalamityMod public override void Unload() { - dungeonProjectileBuffList = null; bossHPScaleList = null; friendlyBeeList = null; debuffList = null; diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 8db19e7b2b..7840a5860c 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -25,6 +25,7 @@ using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.Projectiles.VanillaProjectileOverrides; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Abyss; using CalamityMod.Tiles.Astral; using CalamityMod.Tiles.AstralDesert; @@ -3437,7 +3438,7 @@ namespace CalamityMod.Projectiles if (NPC.downedMoonlord) { - if (CalamityLists.dungeonProjectileBuffList.Contains(projectile.type)) + if (BuffedDungeonProjectilesList.IsProjectileBuffed(projectile)) { // ai[1] being set to 1 is done only by the Calamity usages of these projectiles in Skeletron and Skeletron Prime boss fights bool isSkeletronBossProjectile = (projectile.type == ProjectileID.RocketSkeleton || projectile.type == ProjectileID.Shadowflames) && projectile.ai[1] > 0f; diff --git a/Systems/Collections/BuffedDungeonProjectilesList.cs b/Systems/Collections/BuffedDungeonProjectilesList.cs new file mode 100644 index 0000000000..1070655e7a --- /dev/null +++ b/Systems/Collections/BuffedDungeonProjectilesList.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A which contains a that has the Projectile IDs of all projectiles who are buffed Dungeon projectiles. + /// + public sealed class BuffedDungeonProjectilesList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + ProjectileID.PaladinsHammerHostile, + ProjectileID.ShadowBeamHostile, + ProjectileID.InfernoHostileBolt, + ProjectileID.InfernoHostileBlast, + ProjectileID.LostSoulHostile, + ProjectileID.SniperBullet, + ProjectileID.RocketSkeleton, + ProjectileID.BulletDeadeye, + ProjectileID.Shadowflames + ]; + } + + public override void Unload() => List = null; + + /// + /// A shorthand method to check if this projectile is a buffed Dungeon projectile. + /// + public static bool IsProjectileBuffed(Projectile proj) => List.Contains(proj.type); + } +} From cb3e5e07e2c4ba26235caec51ea2bae21ec18666 Mon Sep 17 00:00:00 2001 From: Memes <114233643+Mr-Memes@users.noreply.github.com> Date: Tue, 15 Oct 2024 23:50:16 +0200 Subject: [PATCH 051/118] BossHPScaling. --- CalamityLists.cs | 93 -------------- ModSupport/ModCalls.cs | 5 +- NPCs/CalamityGlobalNPC.cs | 2 +- Systems/Collections/BossHPScalingList.cs | 152 +++++++++++++++++++++++ 4 files changed, 156 insertions(+), 96 deletions(-) create mode 100644 Systems/Collections/BossHPScalingList.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index 7aefb9ee59..69f83451f9 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -50,7 +50,6 @@ using CalamityMod.NPCs.Perforator; using CalamityMod.NPCs.PlaguebringerGoliath; using CalamityMod.NPCs.PlagueEnemies; using CalamityMod.NPCs.Polterghast; -using CalamityMod.NPCs.PrimordialWyrm; using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.NPCs.Providence; using CalamityMod.NPCs.Ravager; @@ -78,7 +77,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List bossHPScaleList; public static List friendlyBeeList; public static List debuffList; public static List fireDebuffList; @@ -157,93 +155,6 @@ namespace CalamityMod public override void OnModLoad() { - bossHPScaleList = new List() - { - NPCID.EaterofWorldsHead, - NPCID.EaterofWorldsBody, - NPCID.EaterofWorldsTail, - NPCID.SkeletronHand, - NPCID.WallofFleshEye, - NPCID.TheDestroyerBody, - NPCID.TheDestroyerTail, - NPCID.PrimeCannon, - NPCID.PrimeLaser, - NPCID.PrimeVice, - NPCID.PrimeSaw, - NPCID.GolemHead, - NPCID.GolemHeadFree, - NPCID.GolemFistRight, - NPCID.GolemFistLeft, - NPCID.Sharkron, - NPCID.Sharkron2, - NPCID.MoonLordHead, - NPCID.MoonLordHand, - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - }; - //Many more are added later with AddRange - friendlyBeeList = new List() { ProjectileID.GiantBee, @@ -1118,7 +1029,6 @@ namespace CalamityMod NPCType(), NPCType() }; - bossHPScaleList.AddRange(PerforatorIDs); DesertScourgeIDs = new List { @@ -1142,7 +1052,6 @@ namespace CalamityMod NPCType(), NPCType() }; - bossHPScaleList.AddRange(SlimeGodIDs); DeathModeSplittingWormIDs = new List { @@ -1208,7 +1117,6 @@ namespace CalamityMod NPCType(), NPCType() }; - bossHPScaleList.AddRange(RavagerIDs); GolemIDs = new List { @@ -1763,7 +1671,6 @@ namespace CalamityMod public override void Unload() { - bossHPScaleList = null; friendlyBeeList = null; debuffList = null; fireDebuffList = null; diff --git a/ModSupport/ModCalls.cs b/ModSupport/ModCalls.cs index d154133dee..a7b2391163 100644 --- a/ModSupport/ModCalls.cs +++ b/ModSupport/ModCalls.cs @@ -7,6 +7,7 @@ using CalamityMod.Items; using CalamityMod.NPCs; using CalamityMod.NPCs.TownNPCs; using CalamityMod.Systems; +using CalamityMod.Systems.Collections; using CalamityMod.UI; using CalamityMod.UI.CalamitasEnchants; using CalamityMod.UI.DraedonSummoning; @@ -1076,9 +1077,9 @@ namespace CalamityMod //This is to add minions to the hp scaling config public static bool AddToHPScaling(int type) { - if (!CalamityLists.bossHPScaleList.Contains(type)) + if (!BossHPScalingList.List.Contains(type)) { - CalamityLists.bossHPScaleList.Add(type); + BossHPScalingList.List.Add(type); return true; } return false; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index bcea7c100a..e0e536f399 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3523,7 +3523,7 @@ namespace CalamityMod.NPCs return; bool countsAsBoss = npc.boss || NPCID.Sets.ShouldBeCountedAsBoss[npc.type]; - bool scalesLikeBoss = countsAsBoss || CalamityLists.bossHPScaleList.Contains(npc.type); + bool scalesLikeBoss = countsAsBoss || BossHPScalingList.List.Contains(npc.type); bool isCalamityNPC = npc.ModNPC != null && npc.ModNPC.Mod == CalamityMod.Instance; // All bosses, NPCs that are supposed to scale like bosses, and Calamity NPCs follow these rules. diff --git a/Systems/Collections/BossHPScalingList.cs b/Systems/Collections/BossHPScalingList.cs new file mode 100644 index 0000000000..cfab279a8a --- /dev/null +++ b/Systems/Collections/BossHPScalingList.cs @@ -0,0 +1,152 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.AstrumAureus; +using CalamityMod.NPCs.BrimstoneElemental; +using CalamityMod.NPCs.Bumblebirb; +using CalamityMod.NPCs.CalClone; +using CalamityMod.NPCs.CeaselessVoid; +using CalamityMod.NPCs.Crabulon; +using CalamityMod.NPCs.Cryogen; +using CalamityMod.NPCs.DesertScourge; +using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.HiveMind; +using CalamityMod.NPCs.Leviathan; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.OldDuke; +using CalamityMod.NPCs.Perforator; +using CalamityMod.NPCs.PlaguebringerGoliath; +using CalamityMod.NPCs.Polterghast; +using CalamityMod.NPCs.PrimordialWyrm; +using CalamityMod.NPCs.ProfanedGuardians; +using CalamityMod.NPCs.Providence; +using CalamityMod.NPCs.Ravager; +using CalamityMod.NPCs.Signus; +using CalamityMod.NPCs.SlimeGod; +using CalamityMod.NPCs.SupremeCalamitas; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains a that has all NPC IDs of bosses or boss minions that have HP scaling. + /// + public sealed class BossHPScalingList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.EaterofWorldsHead, + NPCID.EaterofWorldsBody, + NPCID.EaterofWorldsTail, + NPCID.SkeletronHand, + NPCID.WallofFleshEye, + NPCID.TheDestroyerBody, + NPCID.TheDestroyerTail, + NPCID.PrimeCannon, + NPCID.PrimeLaser, + NPCID.PrimeVice, + NPCID.PrimeSaw, + NPCID.GolemHead, + NPCID.GolemHeadFree, + NPCID.GolemFistRight, + NPCID.GolemFistLeft, + NPCID.Sharkron, + NPCID.Sharkron2, + NPCID.MoonLordHead, + NPCID.MoonLordHand, + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() + ]; + } + + public override void Unload() => List = null; + } +} From a2fc330e47f4e1a2a5e091bb87ae1fccf1c1ba29 Mon Sep 17 00:00:00 2001 From: Memes <114233643+Mr-Memes@users.noreply.github.com> Date: Tue, 15 Oct 2024 23:57:42 +0200 Subject: [PATCH 052/118] FriendlyBeesList. --- CalPlayer/CalamityPlayerOnHit.cs | 2 +- CalamityLists.cs | 13 --------- Systems/Collections/FriendlyBeesList.cs | 39 +++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 14 deletions(-) create mode 100644 Systems/Collections/FriendlyBeesList.cs diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index 8e2cdefd72..3323172001 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -281,7 +281,7 @@ namespace CalamityMod.CalPlayer if (!proj.npcProj && !proj.trap && proj.friendly) { - if ((plaguebringerCarapace || uberBees) && CalamityLists.friendlyBeeList.Contains(proj.type)) + if ((plaguebringerCarapace || uberBees) && FriendlyBeesList.IsFriendlyBee(proj)) target.AddBuff(BuffType(), 300); // All projectiles fired from Soma Prime are marked using CalamityGlobalProjectile diff --git a/CalamityLists.cs b/CalamityLists.cs index 69f83451f9..fd49eb5dc6 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -77,7 +77,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List friendlyBeeList; public static List debuffList; public static List fireDebuffList; public static List sicknessDebuffList; @@ -155,17 +154,6 @@ namespace CalamityMod public override void OnModLoad() { - friendlyBeeList = new List() - { - ProjectileID.GiantBee, - ProjectileID.Bee, - ProjectileID.Wasp, - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType() - }; - debuffList = new List() { BuffID.Poisoned, @@ -1671,7 +1659,6 @@ namespace CalamityMod public override void Unload() { - friendlyBeeList = null; debuffList = null; fireDebuffList = null; sicknessDebuffList = null; diff --git a/Systems/Collections/FriendlyBeesList.cs b/Systems/Collections/FriendlyBeesList.cs new file mode 100644 index 0000000000..370b8a76f3 --- /dev/null +++ b/Systems/Collections/FriendlyBeesList.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains a that has all the Projectile IDs of all friendly bees. + /// + public sealed class FriendlyBeesList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + ProjectileID.GiantBee, + ProjectileID.Bee, + ProjectileID.Wasp, + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType() + ]; + } + + public override void Unload() => List = null; + + /// + /// A shorthand method to check if a projectile is a friendly bee. + /// + public static bool IsFriendlyBee(Projectile proj) => List.Contains(proj.type); + } +} From 557d86144199144ec0c533e5797ea877dd01f255 Mon Sep 17 00:00:00 2001 From: Memes <114233643+Mr-Memes@users.noreply.github.com> Date: Wed, 16 Oct 2024 00:13:40 +0200 Subject: [PATCH 053/118] DebuffsList. --- CalPlayer/CalamityPlayerMiscEffects.cs | 7 +- CalamityLists.cs | 73 ---------------- NPCs/SupremeCalamitas/SupremeCalamitas.cs | 3 +- Projectiles/Healing/AbsorberAura.cs | 5 +- Projectiles/Healing/BlueJellyAura.cs | 5 +- Projectiles/Healing/GreenJellyAura.cs | 5 +- Systems/Collections/DebuffsList.cs | 100 ++++++++++++++++++++++ 7 files changed, 115 insertions(+), 83 deletions(-) create mode 100644 Systems/Collections/DebuffsList.cs diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 86dd0baf5a..5d8c41681b 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -82,6 +82,7 @@ using Terraria.ID; using Terraria.ModLoader; using ProvidenceBoss = CalamityMod.NPCs.Providence.Providence; using CalamityMod.Projectiles.Pets; +using CalamityMod.Systems.Collections; namespace CalamityMod.CalPlayer { @@ -1932,12 +1933,12 @@ namespace CalamityMod.CalPlayer for (int l = 0; l < Player.MaxBuffs; l++) { - int hasBuff = Player.buffType[l]; - if (Player.buffTime[l] <= 2 && hasBuff == ModContent.BuffType()) + int buffID = Player.buffType[l]; + if (Player.buffTime[l] <= 2 && buffID == ModContent.BuffType()) if (Player.whoAmI == Main.myPlayer) Player.AddCooldown(Cooldowns.TarragonImmunity.ID, CalamityUtils.SecondsToFrames(25)); - bool shouldAffect = CalamityLists.debuffList.Contains(hasBuff); + bool shouldAffect = DebuffsList.IsDebuff(buffID); if (shouldAffect) Player.GetDamage() += 0.1f; } diff --git a/CalamityLists.cs b/CalamityLists.cs index fd49eb5dc6..6c272647da 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -77,7 +77,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List debuffList; public static List fireDebuffList; public static List sicknessDebuffList; public static List alcoholList; @@ -154,77 +153,6 @@ namespace CalamityMod public override void OnModLoad() { - debuffList = new List() - { - BuffID.Poisoned, - BuffID.Darkness, - BuffID.Cursed, - BuffID.OnFire, - BuffID.Bleeding, - BuffID.Confused, - BuffID.Slow, - BuffID.Weak, - BuffID.Silenced, - BuffID.BrokenArmor, - BuffID.CursedInferno, - BuffID.Frostburn, - BuffID.Chilled, - BuffID.Frozen, - BuffID.Burning, - BuffID.Suffocation, - BuffID.Ichor, - BuffID.Venom, - BuffID.Blackout, - BuffID.Electrified, - BuffID.Rabies, - BuffID.Webbed, - BuffID.Stoned, - BuffID.Dazed, - BuffID.VortexDebuff, - BuffID.WitheredArmor, - BuffID.WitheredWeapon, - BuffID.OgreSpit, - BuffID.BetsysCurse, - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - // BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType() - }; - fireDebuffList = new List() { BuffID.OnFire, @@ -1659,7 +1587,6 @@ namespace CalamityMod public override void Unload() { - debuffList = null; fireDebuffList = null; sicknessDebuffList = null; alcoholList = null; diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 70b5837865..8043e814eb 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -45,6 +45,7 @@ using CalamityMod.Projectiles.Ranged; using Steamworks; using CalamityMod.Particles; using Terraria.Utilities.Terraria.Utilities; +using CalamityMod.Systems.Collections; namespace CalamityMod.NPCs.SupremeCalamitas { @@ -1612,7 +1613,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { int buffID = NPC.buffType[l]; - bool shouldHalveDuration = CalamityLists.debuffList.Contains(buffID); + bool shouldHalveDuration = DebuffsList.IsDebuff(buffID); if (shouldHalveDuration && NPC.buffTime[l] > 4) NPC.buffTime[l] = 4; diff --git a/Projectiles/Healing/AbsorberAura.cs b/Projectiles/Healing/AbsorberAura.cs index a4f44ec2f3..81429fed0a 100644 --- a/Projectiles/Healing/AbsorberAura.cs +++ b/Projectiles/Healing/AbsorberAura.cs @@ -6,6 +6,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Items.Accessories; using CalamityMod.Particles; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -58,8 +59,8 @@ namespace CalamityMod.Projectiles.Healing CleansingEffect = 1; for (int l = 0; l < Player.MaxBuffs; l++) { - int hasBuff = player.buffType[l]; - if (player.buffTime[l] > 2 && CalamityLists.debuffList.Contains(hasBuff)) + int buffID = player.buffType[l]; + if (player.buffTime[l] > 2 && DebuffsList.IsDebuff(buffID)) { player.buffTime[l] *= 0; } diff --git a/Projectiles/Healing/BlueJellyAura.cs b/Projectiles/Healing/BlueJellyAura.cs index 1725c2fc9a..a7e947e665 100644 --- a/Projectiles/Healing/BlueJellyAura.cs +++ b/Projectiles/Healing/BlueJellyAura.cs @@ -6,6 +6,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Items.Accessories; using CalamityMod.Particles; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -56,8 +57,8 @@ namespace CalamityMod.Projectiles.Healing CleansingEffect = 1; for (int l = 0; l < Player.MaxBuffs; l++) { - int hasBuff = player.buffType[l]; - if (player.buffTime[l] > 2 && CalamityLists.debuffList.Contains(hasBuff)) + int buffID = player.buffType[l]; + if (player.buffTime[l] > 2 && DebuffsList.IsDebuff(buffID)) { player.buffTime[l] *= 0; } diff --git a/Projectiles/Healing/GreenJellyAura.cs b/Projectiles/Healing/GreenJellyAura.cs index 5ae975ea63..c8882093f0 100644 --- a/Projectiles/Healing/GreenJellyAura.cs +++ b/Projectiles/Healing/GreenJellyAura.cs @@ -6,6 +6,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Items.Accessories; using CalamityMod.Particles; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -58,8 +59,8 @@ namespace CalamityMod.Projectiles.Healing CleansingEffect = 1; for (int l = 0; l < Player.MaxBuffs; l++) { - int hasBuff = player.buffType[l]; - if (player.buffTime[l] > 2 && CalamityLists.debuffList.Contains(hasBuff)) + int buffID = player.buffType[l]; + if (player.buffTime[l] > 2 && DebuffsList.IsDebuff(buffID)) { player.buffTime[l] *= 0; } diff --git a/Systems/Collections/DebuffsList.cs b/Systems/Collections/DebuffsList.cs new file mode 100644 index 0000000000..6dc4cd1f66 --- /dev/null +++ b/Systems/Collections/DebuffsList.cs @@ -0,0 +1,100 @@ +using System.Collections.Generic; +using CalamityMod.Buffs; +using CalamityMod.Buffs.Cooldowns; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains a that has all Debuff IDs. + /// + public sealed class DebuffsList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + BuffID.Poisoned, + BuffID.Darkness, + BuffID.Cursed, + BuffID.OnFire, + BuffID.Bleeding, + BuffID.Confused, + BuffID.Slow, + BuffID.Weak, + BuffID.Silenced, + BuffID.BrokenArmor, + BuffID.CursedInferno, + BuffID.Frostburn, + BuffID.Chilled, + BuffID.Frozen, + BuffID.Burning, + BuffID.Suffocation, + BuffID.Ichor, + BuffID.Venom, + BuffID.Blackout, + BuffID.Electrified, + BuffID.Rabies, + BuffID.Webbed, + BuffID.Stoned, + BuffID.Dazed, + BuffID.VortexDebuff, + BuffID.WitheredArmor, + BuffID.WitheredWeapon, + BuffID.OgreSpit, + BuffID.BetsysCurse, + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + // BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType() + ]; + } + + public override void Unload() => List = null; + + /// + /// A shorthand method to check if a buff ID is a debuff. + /// + public static bool IsDebuff(int buffID) => List.Contains(buffID); + } +} From 34fbf02b57ca26e5798cddf8754f7e68616f601b Mon Sep 17 00:00:00 2001 From: Memes <114233643+Mr-Memes@users.noreply.github.com> Date: Wed, 16 Oct 2024 14:42:34 +0200 Subject: [PATCH 054/118] FireDebuffsList and oopsies. --- CalPlayer/CalamityPlayerLifeRegen.cs | 11 ++++--- CalamityLists.cs | 17 +--------- Systems/Collections/FireDebuffsList.cs | 43 ++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 21 deletions(-) create mode 100644 Systems/Collections/FireDebuffsList.cs diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 92cd348b65..46400873cb 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -16,6 +16,7 @@ using CalamityMod.NPCs; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems; +using CalamityMod.Systems.Collections; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -390,9 +391,9 @@ namespace CalamityMod.CalPlayer continue; bool shouldHalveDuration = CalamityLists.sicknessDebuffList.Contains(buffID); if (livingDewHalveDebuffs) - shouldHalveDuration |= CalamityLists.fireDebuffList.Contains(buffID); + shouldHalveDuration |= FireDebuffsList.IsFireDebuff(buffID); if (purity) - shouldHalveDuration |= CalamityLists.debuffList.Contains(buffID); + shouldHalveDuration |= DebuffsList.IsDebuff(buffID); if (shouldHalveDuration) --Player.buffTime[l]; @@ -456,7 +457,7 @@ namespace CalamityMod.CalPlayer if (purity) { int intendedPurityDefense = 0; - int currentDebuffs = Player.buffType.Count(CalamityLists.debuffList.Contains); + int currentDebuffs = Player.buffType.Count(DebuffsList.List.Contains); if (currentDebuffs > 0) { // Healing rate is normally 5 HP/s (+1 every 12 frames) @@ -509,7 +510,7 @@ namespace CalamityMod.CalPlayer // If the player has any debuffs, give the extra life regen and defense // More defense is given for each additional debuff int intendedJewelDefense = 0; - int currentDebuffs = Player.buffType.Count(CalamityLists.debuffList.Contains); + int currentDebuffs = Player.buffType.Count(DebuffsList.List.Contains); if (currentDebuffs > 0) { Player.lifeRegen += 4; @@ -536,7 +537,7 @@ namespace CalamityMod.CalPlayer Player.lifeRegen += 2; // If any debuff is detected, provide even more life regen and massively accelerate it - if (Player.buffType.Any(CalamityLists.debuffList.Contains)) + if (Player.buffType.Any(DebuffsList.List.Contains)) { Player.lifeRegen += 3; if (Player.lifeRegenTime < 1800) diff --git a/CalamityLists.cs b/CalamityLists.cs index 6c272647da..956b98d2c1 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -153,22 +153,7 @@ namespace CalamityMod public override void OnModLoad() { - fireDebuffList = new List() - { - BuffID.OnFire, - BuffID.OnFire3, // Hellfire - BuffID.Burning, // Touching meteorite ore or hellstone without obsidian skull - BuffID.CursedInferno, - BuffID.ShadowFlame, // Vanilla Shadowflame, can normally never be applied to players - BuffType(), // Calamity Shadowflame copy for players - BuffType(), // Crags lava - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), // Aflame enchant self damage - BuffType(), - }; + fireDebuffList sicknessDebuffList = new List() { diff --git a/Systems/Collections/FireDebuffsList.cs b/Systems/Collections/FireDebuffsList.cs new file mode 100644 index 0000000000..dabf894cb4 --- /dev/null +++ b/Systems/Collections/FireDebuffsList.cs @@ -0,0 +1,43 @@ +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains a that has all the IDs of all Fire-type debuffs. + /// + public sealed class FireDebuffsList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + BuffID.OnFire, + BuffID.OnFire3, // Hellfire + BuffID.Burning, // Touching meteorite ore or hellstone without obsidian skull + BuffID.CursedInferno, + BuffID.ShadowFlame, // Vanilla Shadowflame, can normally never be applied to players + BuffType(), // Calamity Shadowflame copy for players + BuffType(), // Crags lava + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), // Aflame enchant self damage + BuffType(), + ]; + } + + public override void Unload() => List = null; + + /// + /// A shorthand method to check if a buff ID is a fire debuff. + /// + public static bool IsFireDebuff(int buffID) => List.Contains(buffID); + } +} From 3eefa0a146110aae93c200e965e952feff77b112 Mon Sep 17 00:00:00 2001 From: Memes <114233643+Mr-Memes@users.noreply.github.com> Date: Wed, 16 Oct 2024 14:47:15 +0200 Subject: [PATCH 055/118] SicknessDebuffsList and more oopsies. --- CalPlayer/CalamityPlayerLifeRegen.cs | 2 +- CalamityLists.cs | 18 ---------- Systems/Collections/SicknessDebuffsList.cs | 39 ++++++++++++++++++++++ 3 files changed, 40 insertions(+), 19 deletions(-) create mode 100644 Systems/Collections/SicknessDebuffsList.cs diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 46400873cb..9b743fa3c0 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -389,7 +389,7 @@ namespace CalamityMod.CalPlayer int buffID = Player.buffType[l]; if (Player.buffTime[l] <= 2) continue; - bool shouldHalveDuration = CalamityLists.sicknessDebuffList.Contains(buffID); + bool shouldHalveDuration = SicknessDebuffsList.IsSickenessDebuff(buffID); if (livingDewHalveDebuffs) shouldHalveDuration |= FireDebuffsList.IsFireDebuff(buffID); if (purity) diff --git a/CalamityLists.cs b/CalamityLists.cs index 956b98d2c1..43581e6a97 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -77,8 +77,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List fireDebuffList; - public static List sicknessDebuffList; public static List alcoholList; public static List spearAutoreuseList; public static List pumpkinMoonBuffList; @@ -153,20 +151,6 @@ namespace CalamityMod public override void OnModLoad() { - fireDebuffList - - sicknessDebuffList = new List() - { - BuffID.Poisoned, - BuffID.Venom, - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType() - }; - alcoholList = new List() { BuffID.Tipsy, @@ -1572,8 +1556,6 @@ namespace CalamityMod public override void Unload() { - fireDebuffList = null; - sicknessDebuffList = null; alcoholList = null; spearAutoreuseList = null; pumpkinMoonBuffList = null; diff --git a/Systems/Collections/SicknessDebuffsList.cs b/Systems/Collections/SicknessDebuffsList.cs new file mode 100644 index 0000000000..9bf886a662 --- /dev/null +++ b/Systems/Collections/SicknessDebuffsList.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains a that has all the Sickness Debuffs' IDs. + /// + public sealed class SicknessDebuffsList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + BuffID.Poisoned, + BuffID.Venom, + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType() + ]; + } + + public override void Unload() => List = null; + + /// + /// A shorthand method to check if a buff ID is a Sickness Debuff. + /// + public static bool IsSickenessDebuff(int buffID) => List.Contains(buffID); + } +} From 11b0125db27b733a44c9542284e248d85e37f6c7 Mon Sep 17 00:00:00 2001 From: Memes <114233643+Mr-Memes@users.noreply.github.com> Date: Wed, 16 Oct 2024 14:51:50 +0200 Subject: [PATCH 056/118] AlcoholsList. --- CalPlayer/CalamityPlayerLifeRegen.cs | 2 +- CalamityLists.cs | 27 --------------- Systems/Collections/AlcoholsList.cs | 51 ++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 28 deletions(-) create mode 100644 Systems/Collections/AlcoholsList.cs diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 9b743fa3c0..3ff0d4b7f8 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -703,7 +703,7 @@ namespace CalamityMod.CalPlayer for (int l = 0; l < Player.MaxBuffs; l++) { int hasBuff = Player.buffType[l]; - lesserEffect = CalamityLists.alcoholList.Contains(hasBuff); + lesserEffect = AlcoholsList.List.Contains(hasBuff); } if (Player.lifeRegen < 0) Player.lifeRegen += lesserEffect ? 1 : regenBoost; diff --git a/CalamityLists.cs b/CalamityLists.cs index 43581e6a97..75bf7b3b98 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -77,7 +77,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List alcoholList; public static List spearAutoreuseList; public static List pumpkinMoonBuffList; public static List frostMoonBuffList; @@ -151,31 +150,6 @@ namespace CalamityMod public override void OnModLoad() { - alcoholList = new List() - { - BuffID.Tipsy, - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType() - }; - spearAutoreuseList = new List() { ItemID.AdamantiteGlaive, @@ -1556,7 +1530,6 @@ namespace CalamityMod public override void Unload() { - alcoholList = null; spearAutoreuseList = null; pumpkinMoonBuffList = null; frostMoonBuffList = null; diff --git a/Systems/Collections/AlcoholsList.cs b/Systems/Collections/AlcoholsList.cs new file mode 100644 index 0000000000..43c2e09126 --- /dev/null +++ b/Systems/Collections/AlcoholsList.cs @@ -0,0 +1,51 @@ +using System.Collections.Generic; +using CalamityMod.Buffs.Alcohol; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains a of all alcohol buff's IDs. + /// + public sealed class AlcoholsList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + BuffID.Tipsy, + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType() + ]; + } + + public override void Unload() => List = null; + + /// + /// A shorthand method to check whether or not a buff ID is an alcohol. + /// + public static bool HasAlcoholBuff(int buffID) => List.Contains(buffID); + } +} From 4d8df1177b52b3b56e0ba8abf8ade96882c40fe1 Mon Sep 17 00:00:00 2001 From: Memes <114233643+Mr-Memes@users.noreply.github.com> Date: Wed, 16 Oct 2024 14:58:17 +0200 Subject: [PATCH 057/118] AutoreuseableSpearsList. --- CalamityLists.cs | 24 ---------- Items/CalamityGlobalItem.cs | 3 +- .../Collections/AutoreuseableSpearsList.cs | 47 +++++++++++++++++++ 3 files changed, 49 insertions(+), 25 deletions(-) create mode 100644 Systems/Collections/AutoreuseableSpearsList.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index 75bf7b3b98..a1978c7516 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -77,7 +77,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List spearAutoreuseList; public static List pumpkinMoonBuffList; public static List frostMoonBuffList; public static List eclipseBuffList; @@ -150,28 +149,6 @@ namespace CalamityMod public override void OnModLoad() { - spearAutoreuseList = new List() - { - ItemID.AdamantiteGlaive, - ItemID.ChlorophytePartisan, - ItemID.CobaltNaginata, - ItemID.DarkLance, - ItemID.MonkStaffT2, - ItemID.Gungnir, - ItemID.MushroomSpear, - ItemID.MythrilHalberd, - ItemID.NorthPole, - ItemID.ObsidianSwordfish, - ItemID.OrichalcumHalberd, - ItemID.PalladiumPike, - ItemID.Spear, - ItemID.Swordfish, - ItemID.TheRottedFork, - ItemID.TitaniumTrident, - ItemID.Trident, - ItemID.ThunderSpear - }; - pumpkinMoonBuffList = new List() { NPCID.Scarecrow1, @@ -1530,7 +1507,6 @@ namespace CalamityMod public override void Unload() { - spearAutoreuseList = null; pumpkinMoonBuffList = null; frostMoonBuffList = null; eclipseBuffList = null; diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index a4e07a9ead..0b511bb1b0 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -24,6 +24,7 @@ using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.UI; using CalamityMod.UI.CalamitasEnchants; @@ -850,7 +851,7 @@ namespace CalamityMod.Items // Handle general use-item effects for the Gem Tech Armor. player.Calamity().GemTechState.OnItemUseEffects(item); - if (item.type == ItemID.MonkStaffT1 || CalamityLists.spearAutoreuseList.Contains(item.type)) + if (item.type == ItemID.MonkStaffT1 || AutoreusableSpearsList.IsAutoreuseableSpear(item)) { return player.ownedProjectileCounts[item.shoot] <= 0; } diff --git a/Systems/Collections/AutoreuseableSpearsList.cs b/Systems/Collections/AutoreuseableSpearsList.cs new file mode 100644 index 0000000000..6853bfc155 --- /dev/null +++ b/Systems/Collections/AutoreuseableSpearsList.cs @@ -0,0 +1,47 @@ +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains a of all Vanilla Spears to make them autoreusable. + /// + public sealed class AutoreusableSpearsList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + ItemID.AdamantiteGlaive, + ItemID.ChlorophytePartisan, + ItemID.CobaltNaginata, + ItemID.DarkLance, + ItemID.MonkStaffT2, + ItemID.Gungnir, + ItemID.MushroomSpear, + ItemID.MythrilHalberd, + ItemID.NorthPole, + ItemID.ObsidianSwordfish, + ItemID.OrichalcumHalberd, + ItemID.PalladiumPike, + ItemID.Spear, + ItemID.Swordfish, + ItemID.TheRottedFork, + ItemID.TitaniumTrident, + ItemID.Trident, + ItemID.ThunderSpear + ]; + } + + public override void Unload() => List = null; + + /// + /// A shorthand method to check whether or not an item is an autoreusable spear. + /// + public static bool IsAutoreuseableSpear(Item item) => List.Contains(item.type); + } +} From 245fc7dea9be444e039824237ac94f970bf42bac Mon Sep 17 00:00:00 2001 From: Flowaria Date: Wed, 16 Oct 2024 22:11:44 +0900 Subject: [PATCH 058/118] PumpkinMoonBuffList. --- CalamityLists.cs | 22 ---------- NPCs/CalamityGlobalNPC.cs | 2 +- Systems/Collections/PumpkinMoonBuffList.cs | 47 ++++++++++++++++++++++ 3 files changed, 48 insertions(+), 23 deletions(-) create mode 100644 Systems/Collections/PumpkinMoonBuffList.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index a1978c7516..f6f490b52a 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -149,27 +149,6 @@ namespace CalamityMod public override void OnModLoad() { - pumpkinMoonBuffList = new List() - { - NPCID.Scarecrow1, - NPCID.Scarecrow2, - NPCID.Scarecrow3, - NPCID.Scarecrow4, - NPCID.Scarecrow5, - NPCID.Scarecrow6, - NPCID.Scarecrow7, - NPCID.Scarecrow8, - NPCID.Scarecrow9, - NPCID.Scarecrow10, - NPCID.HeadlessHorseman, - NPCID.MourningWood, - NPCID.Splinterling, - NPCID.Pumpking, - NPCID.PumpkingBlade, - NPCID.Hellhound, - NPCID.Poltergeist - }; - frostMoonBuffList = new List() { NPCID.ZombieElf, @@ -1507,7 +1486,6 @@ namespace CalamityMod public override void Unload() { - pumpkinMoonBuffList = null; frostMoonBuffList = null; eclipseBuffList = null; eventProjectileBuffList = null; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index e0e536f399..5ab2c5a127 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -2827,7 +2827,7 @@ namespace CalamityMod.NPCs if (DownedBossSystem.downedDoG) { - if (CalamityLists.pumpkinMoonBuffList.Contains(npc.type)) + if (PumpkinMoonBuffList.IsPumpkinMoonBuffNPC(npc)) { npc.lifeMax = (int)Math.Round(npc.lifeMax * 3.5); npc.damage += 30; diff --git a/Systems/Collections/PumpkinMoonBuffList.cs b/Systems/Collections/PumpkinMoonBuffList.cs new file mode 100644 index 0000000000..55beea5e44 --- /dev/null +++ b/Systems/Collections/PumpkinMoonBuffList.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains a of all NPC Types that receive Post-DoG Pumpkin Moon Buff + /// + public sealed class PumpkinMoonBuffList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.Scarecrow1, + NPCID.Scarecrow2, + NPCID.Scarecrow3, + NPCID.Scarecrow4, + NPCID.Scarecrow5, + NPCID.Scarecrow6, + NPCID.Scarecrow7, + NPCID.Scarecrow8, + NPCID.Scarecrow9, + NPCID.Scarecrow10, + NPCID.HeadlessHorseman, + NPCID.MourningWood, + NPCID.Splinterling, + NPCID.Pumpking, + NPCID.PumpkingBlade, + NPCID.Hellhound, + NPCID.Poltergeist + ]; + } + + public override void Unload() => List = null; + + public static bool IsPumpkinMoonBuffNPC(NPC npc) => List.Contains(npc.type); + } +} From a81b77afd355ec336c2630cb1ea9a3921fa8bd43 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Wed, 16 Oct 2024 22:14:47 +0900 Subject: [PATCH 059/118] FrostMoonBuffList. --- CalamityLists.cs | 21 ----------- NPCs/CalamityGlobalNPC.cs | 2 +- Systems/Collections/FrostMoonBuffList.cs | 45 ++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 22 deletions(-) create mode 100644 Systems/Collections/FrostMoonBuffList.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index f6f490b52a..cc02295bce 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -77,8 +77,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List pumpkinMoonBuffList; - public static List frostMoonBuffList; public static List eclipseBuffList; public static List eventProjectileBuffList; public static List noRageWormSegmentList; @@ -149,24 +147,6 @@ namespace CalamityMod public override void OnModLoad() { - frostMoonBuffList = new List() - { - NPCID.ZombieElf, - NPCID.ZombieElfBeard, - NPCID.ZombieElfGirl, - NPCID.PresentMimic, - NPCID.GingerbreadMan, - NPCID.Yeti, - NPCID.Everscream, - NPCID.IceQueen, - NPCID.SantaNK1, - NPCID.ElfCopter, - NPCID.Nutcracker, - NPCID.NutcrackerSpinning, - NPCID.ElfArcher, - NPCID.Krampus, - NPCID.Flocko - }; eclipseBuffList = new List() { @@ -1486,7 +1466,6 @@ namespace CalamityMod public override void Unload() { - frostMoonBuffList = null; eclipseBuffList = null; eventProjectileBuffList = null; noRageWormSegmentList = null; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 5ab2c5a127..52fce16e17 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -2834,7 +2834,7 @@ namespace CalamityMod.NPCs npc.life = npc.lifeMax; npc.defDamage = npc.damage; } - else if (CalamityLists.frostMoonBuffList.Contains(npc.type)) + else if (FrostMoonBuffList.IsFrostMoonBuffNPC(npc)) { npc.lifeMax = (int)Math.Round(npc.lifeMax * 2.5); npc.damage += 30; diff --git a/Systems/Collections/FrostMoonBuffList.cs b/Systems/Collections/FrostMoonBuffList.cs new file mode 100644 index 0000000000..1138472d2b --- /dev/null +++ b/Systems/Collections/FrostMoonBuffList.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains a of all NPC Types that receive Post-DoG Frost Moon Buff + /// + public sealed class FrostMoonBuffList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.ZombieElf, + NPCID.ZombieElfBeard, + NPCID.ZombieElfGirl, + NPCID.PresentMimic, + NPCID.GingerbreadMan, + NPCID.Yeti, + NPCID.Everscream, + NPCID.IceQueen, + NPCID.SantaNK1, + NPCID.ElfCopter, + NPCID.Nutcracker, + NPCID.NutcrackerSpinning, + NPCID.ElfArcher, + NPCID.Krampus, + NPCID.Flocko + ]; + } + + public override void Unload() => List = null; + + public static bool IsFrostMoonBuffNPC(NPC npc) => List.Contains(npc.type); + } +} From 9edde47488a09185fe79a58d0ab15106340be0ce Mon Sep 17 00:00:00 2001 From: Flowaria Date: Wed, 16 Oct 2024 22:17:59 +0900 Subject: [PATCH 060/118] EclipseBuffList. --- CalamityLists.cs | 24 ------------- NPCs/CalamityGlobalNPC.cs | 2 +- Systems/Collections/EclipseBuffList.cs | 47 ++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 25 deletions(-) create mode 100644 Systems/Collections/EclipseBuffList.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index cc02295bce..c1f5dcbcac 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -77,7 +77,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List eclipseBuffList; public static List eventProjectileBuffList; public static List noRageWormSegmentList; public static List needsDebuffIconDisplayList; @@ -147,28 +146,6 @@ namespace CalamityMod public override void OnModLoad() { - - eclipseBuffList = new List() - { - NPCID.Eyezor, - NPCID.Reaper, - NPCID.Frankenstein, - NPCID.SwampThing, - NPCID.Vampire, - NPCID.VampireBat, - NPCID.Butcher, - NPCID.CreatureFromTheDeep, - NPCID.Fritz, - NPCID.Nailhead, - NPCID.Psycho, - NPCID.DeadlySphere, - NPCID.DrManFly, - NPCID.ThePossessed, - NPCID.Mothron, - NPCID.MothronEgg, - NPCID.MothronSpawn - }; - eventProjectileBuffList = new List() { ProjectileID.FlamingWood, @@ -1466,7 +1443,6 @@ namespace CalamityMod public override void Unload() { - eclipseBuffList = null; eventProjectileBuffList = null; noRageWormSegmentList = null; needsDebuffIconDisplayList = null; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 52fce16e17..79b76a20c8 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -2841,7 +2841,7 @@ namespace CalamityMod.NPCs npc.life = npc.lifeMax; npc.defDamage = npc.damage; } - else if (CalamityLists.eclipseBuffList.Contains(npc.type)) + else if (EclipseBuffList.IsEclipseBuffNPC(npc)) { npc.lifeMax = (int)Math.Round(npc.lifeMax * 5D); npc.damage += 30; diff --git a/Systems/Collections/EclipseBuffList.cs b/Systems/Collections/EclipseBuffList.cs new file mode 100644 index 0000000000..0492248483 --- /dev/null +++ b/Systems/Collections/EclipseBuffList.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains a of all NPC Types that receive Post-DoG Eclipse Buff + /// + public sealed class EclipseBuffList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.Eyezor, + NPCID.Reaper, + NPCID.Frankenstein, + NPCID.SwampThing, + NPCID.Vampire, + NPCID.VampireBat, + NPCID.Butcher, + NPCID.CreatureFromTheDeep, + NPCID.Fritz, + NPCID.Nailhead, + NPCID.Psycho, + NPCID.DeadlySphere, + NPCID.DrManFly, + NPCID.ThePossessed, + NPCID.Mothron, + NPCID.MothronEgg, + NPCID.MothronSpawn + ]; + } + + public override void Unload() => List = null; + + public static bool IsEclipseBuffNPC(NPC npc) => List.Contains(npc.type); + } +} From a01a3e8381eb435217cec7e0a1793a89e0b17874 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Wed, 16 Oct 2024 22:55:16 +0900 Subject: [PATCH 061/118] EventProjectileBuffList. --- CalamityLists.cs | 24 ---------- Projectiles/CalamityGlobalProjectile.cs | 2 +- .../Collections/EventProjectileBuffList.cs | 48 +++++++++++++++++++ 3 files changed, 49 insertions(+), 25 deletions(-) create mode 100644 Systems/Collections/EventProjectileBuffList.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index c1f5dcbcac..2e6330376f 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -77,7 +77,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List eventProjectileBuffList; public static List noRageWormSegmentList; public static List needsDebuffIconDisplayList; public static List scopedWeaponList; @@ -146,28 +145,6 @@ namespace CalamityMod public override void OnModLoad() { - eventProjectileBuffList = new List() - { - ProjectileID.FlamingWood, - ProjectileID.GreekFire1, - ProjectileID.GreekFire2, - ProjectileID.GreekFire3, - ProjectileID.FlamingScythe, - ProjectileID.FlamingArrow, - ProjectileID.PineNeedleHostile, - ProjectileID.OrnamentHostile, - ProjectileID.OrnamentHostileShrapnel, - ProjectileID.FrostWave, - ProjectileID.FrostShard, - ProjectileID.Missile, - ProjectileID.Present, - ProjectileID.Spike, - ProjectileID.BulletDeadeye, - ProjectileID.EyeLaser, - ProjectileID.Nail, - ProjectileID.DrManFlyFlask - }; - noRageWormSegmentList = new List() { NPCType(), @@ -1443,7 +1420,6 @@ namespace CalamityMod public override void Unload() { - eventProjectileBuffList = null; noRageWormSegmentList = null; needsDebuffIconDisplayList = null; scopedWeaponList = null; diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 7840a5860c..f347c9a51c 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -3453,7 +3453,7 @@ namespace CalamityMod.Projectiles if (DownedBossSystem.downedDoG && (Main.pumpkinMoon || Main.snowMoon || Main.eclipse)) { - if (CalamityLists.eventProjectileBuffList.Contains(projectile.type)) + if (EventProjectileBuffList.IsEventBuffProjectile(projectile)) projectile.damage += 15; } diff --git a/Systems/Collections/EventProjectileBuffList.cs b/Systems/Collections/EventProjectileBuffList.cs new file mode 100644 index 0000000000..66c9f7da0f --- /dev/null +++ b/Systems/Collections/EventProjectileBuffList.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains a of all Projectile Types that receive Post-DoG Event Buff + /// + public sealed class EventProjectileBuffList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + ProjectileID.FlamingWood, + ProjectileID.GreekFire1, + ProjectileID.GreekFire2, + ProjectileID.GreekFire3, + ProjectileID.FlamingScythe, + ProjectileID.FlamingArrow, + ProjectileID.PineNeedleHostile, + ProjectileID.OrnamentHostile, + ProjectileID.OrnamentHostileShrapnel, + ProjectileID.FrostWave, + ProjectileID.FrostShard, + ProjectileID.Missile, + ProjectileID.Present, + ProjectileID.Spike, + ProjectileID.BulletDeadeye, + ProjectileID.EyeLaser, + ProjectileID.Nail, + ProjectileID.DrManFlyFlask + ]; + } + + public override void Unload() => List = null; + + public static bool IsEventBuffProjectile(Projectile projectile) => List.Contains(projectile.type); + } +} From de3cb6c05228ea51aab450ab4e7c8e1650815931 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Wed, 16 Oct 2024 22:59:11 +0900 Subject: [PATCH 062/118] NoRageWormSegmentList. --- CalPlayer/CalamityPlayerMiscEffects.cs | 2 +- CalamityLists.cs | 24 ---------- Systems/Collections/NoRageWormSegmentList.cs | 48 ++++++++++++++++++++ 3 files changed, 49 insertions(+), 25 deletions(-) create mode 100644 Systems/Collections/NoRageWormSegmentList.cs diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 5d8c41681b..ad83d7c6ed 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -556,7 +556,7 @@ namespace CalamityMod.CalPlayer // If they're a boss, reduce the boss distance. // Boss distance will always be >= enemy distance, so there's no need to do another check. // Worm boss body and tail segments are not counted as bosses for this calculation. - if (npc.IsABoss() && !CalamityLists.noRageWormSegmentList.Contains(npc.type)) + if (npc.IsABoss() && !NoRageWormSegmentList.IsNoRageWormSegment(npc)) bossDistance = hitboxEdgeDist; } } diff --git a/CalamityLists.cs b/CalamityLists.cs index 2e6330376f..14646da047 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -77,7 +77,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List noRageWormSegmentList; public static List needsDebuffIconDisplayList; public static List scopedWeaponList; public static List highTestFishList; @@ -145,28 +144,6 @@ namespace CalamityMod public override void OnModLoad() { - noRageWormSegmentList = new List() - { - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType() - }; - needsDebuffIconDisplayList = new List() { NPCID.TargetDummy, @@ -1420,7 +1397,6 @@ namespace CalamityMod public override void Unload() { - noRageWormSegmentList = null; needsDebuffIconDisplayList = null; scopedWeaponList = null; highTestFishList = null; diff --git a/Systems/Collections/NoRageWormSegmentList.cs b/Systems/Collections/NoRageWormSegmentList.cs new file mode 100644 index 0000000000..fe9abb14ee --- /dev/null +++ b/Systems/Collections/NoRageWormSegmentList.cs @@ -0,0 +1,48 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.AquaticScourge; +using CalamityMod.NPCs.AstrumDeus; +using CalamityMod.NPCs.DesertScourge; +using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.ExoMechs.Ares; +using CalamityMod.NPCs.ExoMechs.Thanatos; +using CalamityMod.NPCs.StormWeaver; +using Terraria; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class NoRageWormSegmentList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() + ]; + } + + public override void Unload() => List = null; + + public static bool IsNoRageWormSegment(NPC npc) => List.Contains(npc.type); + } +} From 6665cd5465aba8b554e8024d3f211ab20a68bf7a Mon Sep 17 00:00:00 2001 From: Flowaria Date: Wed, 16 Oct 2024 23:03:07 +0900 Subject: [PATCH 063/118] NeedsDebuffIconDisplayList. --- CalamityLists.cs | 9 ------ NPCs/CalamityGlobalNPC.cs | 2 +- .../Collections/NeedsDebuffIconDisplayList.cs | 29 +++++++++++++++++++ 3 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 Systems/Collections/NeedsDebuffIconDisplayList.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index 14646da047..d599816cf4 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -77,7 +77,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List needsDebuffIconDisplayList; public static List scopedWeaponList; public static List highTestFishList; public static List forceItemList; @@ -144,13 +143,6 @@ namespace CalamityMod public override void OnModLoad() { - needsDebuffIconDisplayList = new List() - { - NPCID.TargetDummy, - NPCID.WallofFleshEye, - NPCType() - }; - // TODO -- override HoldItem => Player.accFishingLine = true; on these items, just like the scope fix... highTestFishList = new List() { @@ -1397,7 +1389,6 @@ namespace CalamityMod public override void Unload() { - needsDebuffIconDisplayList = null; scopedWeaponList = null; highTestFishList = null; forceItemList = null; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 79b76a20c8..aac0c4938f 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -7277,7 +7277,7 @@ namespace CalamityMod.NPCs } if (npc.type != NPCID.BrainofCthulhu && (npc.type != NPCID.DukeFishron || npc.ai[0] <= 9f) && npc.active) { - if (CalamityClientConfig.Instance.DebuffDisplay && (npc.boss || BossHealthBarManager.MinibossHPBarList.Contains(npc.type) || BossHealthBarManager.OneToMany.ContainsKey(npc.type) || CalamityLists.needsDebuffIconDisplayList.Contains(npc.type))) + if (CalamityClientConfig.Instance.DebuffDisplay && (npc.boss || BossHealthBarManager.MinibossHPBarList.Contains(npc.type) || BossHealthBarManager.OneToMany.ContainsKey(npc.type) || NeedsDebuffIconDisplayList.IsNPCNeedDebuffIconDisplay(npc))) { List currentDebuffs = new List() { }; diff --git a/Systems/Collections/NeedsDebuffIconDisplayList.cs b/Systems/Collections/NeedsDebuffIconDisplayList.cs new file mode 100644 index 0000000000..fe1c0f9e75 --- /dev/null +++ b/Systems/Collections/NeedsDebuffIconDisplayList.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using CalamityMod.NPCs.NormalNPCs; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class NeedsDebuffIconDisplayList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.TargetDummy, + NPCID.WallofFleshEye, + NPCType() + ]; + } + + public override void Unload() => List = null; + + public static bool IsNPCNeedDebuffIconDisplay(NPC npc) => List.Contains(npc.type); + } +} From 14792e20b87dbcb7abc79e4f4d200d1ff8e438cb Mon Sep 17 00:00:00 2001 From: Flowaria Date: Wed, 16 Oct 2024 23:13:41 +0900 Subject: [PATCH 064/118] HighTestFishingPoleList. --- CalPlayer/CalamityPlayerMiscEffects.cs | 2 +- CalamityLists.cs | 12 -------- Items/Fishing/FishingRods/EarlyBloomRod.cs | 5 ++++ .../Fishing/FishingRods/TheDevourerofCods.cs | 5 ++++ .../Collections/HighTestFishingPoleList.cs | 28 +++++++++++++++++++ 5 files changed, 39 insertions(+), 13 deletions(-) create mode 100644 Systems/Collections/HighTestFishingPoleList.cs diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index ad83d7c6ed..499db82c0e 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -3081,7 +3081,7 @@ namespace CalamityMod.CalPlayer } } - if (CalamityLists.highTestFishList.Contains(Player.ActiveItem().type)) + if (HighTestFishingPoleList.IsHighTestFishingPole(Player.ActiveItem())) Player.accFishingLine = true; if (planarSpeedBoost != 0) diff --git a/CalamityLists.cs b/CalamityLists.cs index d599816cf4..329cf64be8 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -77,8 +77,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List scopedWeaponList; - public static List highTestFishList; public static List forceItemList; public static List livingFireBlockList; public static List amalgamBuffList; @@ -143,14 +141,6 @@ namespace CalamityMod public override void OnModLoad() { - // TODO -- override HoldItem => Player.accFishingLine = true; on these items, just like the scope fix... - highTestFishList = new List() - { - ItemID.GoldenFishingRod, - ItemType(), - ItemType() - }; - forceItemList = new List() { ItemType(), @@ -1389,8 +1379,6 @@ namespace CalamityMod public override void Unload() { - scopedWeaponList = null; - highTestFishList = null; forceItemList = null; livingFireBlockList = null; amalgamBuffList = null; diff --git a/Items/Fishing/FishingRods/EarlyBloomRod.cs b/Items/Fishing/FishingRods/EarlyBloomRod.cs index 2c536a12f5..fa92d6cf33 100644 --- a/Items/Fishing/FishingRods/EarlyBloomRod.cs +++ b/Items/Fishing/FishingRods/EarlyBloomRod.cs @@ -27,6 +27,11 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.rare = ModContent.RarityType(); } + public override void HoldItem(Player player) + { + player.accFishingLine = true; + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { for (int i = 0; i < 6; i++) diff --git a/Items/Fishing/FishingRods/TheDevourerofCods.cs b/Items/Fishing/FishingRods/TheDevourerofCods.cs index 62d2e6cc12..c05b8bb2ec 100644 --- a/Items/Fishing/FishingRods/TheDevourerofCods.cs +++ b/Items/Fishing/FishingRods/TheDevourerofCods.cs @@ -33,6 +33,11 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.rare = ModContent.RarityType(); } + public override void HoldItem(Player player) + { + player.accFishingLine = true; + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { for (int i = 0; i < 10; i++) diff --git a/Systems/Collections/HighTestFishingPoleList.cs b/Systems/Collections/HighTestFishingPoleList.cs new file mode 100644 index 0000000000..743f869edd --- /dev/null +++ b/Systems/Collections/HighTestFishingPoleList.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; +using CalamityMod.Items.Fishing.FishingRods; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class HighTestFishingPoleList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + ItemID.GoldenFishingRod, + ItemType(), + ItemType() + ]; + } + + public override void Unload() => List = null; + + public static bool IsHighTestFishingPole(Item item) => List.Contains(item.type); + } +} From ca110871f5e90f1c68a4e95981b8de7755963792 Mon Sep 17 00:00:00 2001 From: Memes <114233643+Mr-Memes@users.noreply.github.com> Date: Tue, 22 Oct 2024 14:05:15 +0200 Subject: [PATCH 065/118] ItemsForcedInsideWorldList. --- CalamityLists.cs | 80 ------------- Items/CalamityGlobalItem.cs | 2 +- .../Collections/ItemsForcedInsideWorldList.cs | 111 ++++++++++++++++++ 3 files changed, 112 insertions(+), 81 deletions(-) create mode 100644 Systems/Collections/ItemsForcedInsideWorldList.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index 329cf64be8..e6914708bb 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -1,17 +1,12 @@ using System; using System.Collections.Generic; using CalamityMod.BiomeManagers; -using CalamityMod.Buffs; using CalamityMod.Buffs.Alcohol; -using CalamityMod.Buffs.Cooldowns; -using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.Potions; -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Enums; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.DraedonMisc; -using CalamityMod.Items.Fishing.FishingRods; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Abyss; @@ -77,7 +72,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List forceItemList; public static List livingFireBlockList; public static List amalgamBuffList; public static List persistentBuffList; @@ -141,79 +135,6 @@ namespace CalamityMod public override void OnModLoad() { - forceItemList = new List() - { - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemID.HotlineFishingHook, - ItemID.BottomlessBucket, - ItemID.SuperAbsorbantSponge, - ItemID.FishingPotion, - ItemID.SonarPotion, - ItemID.CratePotion, - ItemID.AnglerTackleBag, - ItemID.HighTestFishingLine, - ItemID.TackleBox, - ItemID.AnglerEarring, - ItemID.FishermansGuide, - ItemID.WeatherRadio, - ItemID.Sextant, - ItemID.AnglerHat, - ItemID.AnglerVest, - ItemID.AnglerPants, - ItemID.GoldenBugNet, - ItemID.FishronWings, - ItemID.Flairon, - ItemID.Tsunami, - ItemID.BubbleGun, - ItemID.RazorbladeTyphoon, - ItemID.TempestStaff, - ItemID.FishronBossBag, - ItemID.Coral, - ItemID.Seashell, - ItemID.Starfish, - ItemID.SoulofSight, - ItemID.GreaterHealingPotion, - ItemID.SuperHealingPotion - }; - livingFireBlockList = new List() { TileType(), @@ -1379,7 +1300,6 @@ namespace CalamityMod public override void Unload() { - forceItemList = null; livingFireBlockList = null; amalgamBuffList = null; persistentBuffList = null; diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 0b511bb1b0..885dc186a5 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -1604,7 +1604,7 @@ namespace CalamityMod.Items #region PostUpdate public override void PostUpdate(Item item) { - if (CalamityLists.forceItemList?.Contains(item.type) ?? false) + if (ItemsForcedInsideWorldList.IsItemForcedInsideWorld(item)) CalamityUtils.ForceItemIntoWorld(item); } #endregion diff --git a/Systems/Collections/ItemsForcedInsideWorldList.cs b/Systems/Collections/ItemsForcedInsideWorldList.cs new file mode 100644 index 0000000000..0315199893 --- /dev/null +++ b/Systems/Collections/ItemsForcedInsideWorldList.cs @@ -0,0 +1,111 @@ +using System.Collections.Generic; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Armor.Vanity; +using CalamityMod.Items.LoreItems; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Items.TreasureBags; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains a of Item IDs of those which are forced to be inside the world map. + /// + public class ItemsForcedInsideWorldList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemID.HotlineFishingHook, + ItemID.BottomlessBucket, + ItemID.SuperAbsorbantSponge, + ItemID.FishingPotion, + ItemID.SonarPotion, + ItemID.CratePotion, + ItemID.AnglerTackleBag, + ItemID.HighTestFishingLine, + ItemID.TackleBox, + ItemID.AnglerEarring, + ItemID.FishermansGuide, + ItemID.WeatherRadio, + ItemID.Sextant, + ItemID.AnglerHat, + ItemID.AnglerVest, + ItemID.AnglerPants, + ItemID.GoldenBugNet, + ItemID.FishronWings, + ItemID.Flairon, + ItemID.Tsunami, + ItemID.BubbleGun, + ItemID.RazorbladeTyphoon, + ItemID.TempestStaff, + ItemID.FishronBossBag, + ItemID.Coral, + ItemID.Seashell, + ItemID.Starfish, + ItemID.SoulofSight, + ItemID.GreaterHealingPotion, + ItemID.SuperHealingPotion + ]; + } + + public override void Unload() => List = null; + + /// + /// A shorthand method to check whether or not an item is an item that should be forced inside the world map. + /// + public static bool IsItemForcedInsideWorld(Item item) => List.Contains(item.type); + } +} From 3126f511a004967bd44a265fbd388ed1ef17be92 Mon Sep 17 00:00:00 2001 From: Memes <114233643+Mr-Memes@users.noreply.github.com> Date: Tue, 22 Oct 2024 14:05:33 +0200 Subject: [PATCH 066/118] Oopsie. --- Systems/Collections/ItemsForcedInsideWorldList.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Systems/Collections/ItemsForcedInsideWorldList.cs b/Systems/Collections/ItemsForcedInsideWorldList.cs index 0315199893..55ef699fd5 100644 --- a/Systems/Collections/ItemsForcedInsideWorldList.cs +++ b/Systems/Collections/ItemsForcedInsideWorldList.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Systems.Collections /// /// A that contains a of Item IDs of those which are forced to be inside the world map. /// - public class ItemsForcedInsideWorldList : ModSystem + public sealed class ItemsForcedInsideWorldList : ModSystem { public static IList List { get; private set; } From 7ad2bb7fb94a8d0ee65fdb37d9b7b699c73d1a30 Mon Sep 17 00:00:00 2001 From: Memes <114233643+Mr-Memes@users.noreply.github.com> Date: Tue, 22 Oct 2024 14:13:42 +0200 Subject: [PATCH 067/118] LivingFireTilesList. --- CalamityLists.cs | 22 ---------- Systems/Collections/LivingFireTilesList.cs | 41 +++++++++++++++++++ Tiles/LivingFire/LivingPlagueFireBlockTile.cs | 1 + 3 files changed, 42 insertions(+), 22 deletions(-) create mode 100644 Systems/Collections/LivingFireTilesList.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index e6914708bb..981bfc5e66 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -4,21 +4,16 @@ using CalamityMod.BiomeManagers; using CalamityMod.Buffs.Alcohol; using CalamityMod.Buffs.Potions; using CalamityMod.Enums; -using CalamityMod.Items.Accessories; -using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.Tools; -using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.Items.Weapons.Magic; 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.AquaticScourge; @@ -62,7 +57,6 @@ using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; -using CalamityMod.Tiles.LivingFire; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -72,7 +66,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List livingFireBlockList; public static List amalgamBuffList; public static List persistentBuffList; public static List MagicGunIDs; @@ -135,20 +128,6 @@ namespace CalamityMod public override void OnModLoad() { - livingFireBlockList = new List() - { - TileType(), - TileType(), - TileType(), - TileType(), - TileID.LivingFire, - TileID.LivingCursedFire, - TileID.LivingDemonFire, - TileID.LivingFrostFire, - TileID.LivingIchor, - TileID.LivingUltrabrightFire - }; - amalgamBuffList = new List() { BuffType(), @@ -1300,7 +1279,6 @@ namespace CalamityMod public override void Unload() { - livingFireBlockList = null; amalgamBuffList = null; persistentBuffList = null; MagicGunIDs = null; diff --git a/Systems/Collections/LivingFireTilesList.cs b/Systems/Collections/LivingFireTilesList.cs new file mode 100644 index 0000000000..32b10bce83 --- /dev/null +++ b/Systems/Collections/LivingFireTilesList.cs @@ -0,0 +1,41 @@ +using System.Collections.Generic; +using CalamityMod.Tiles.LivingFire; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains a with all Tile IDs of those which are Living-Fire-type tiles. + /// + public sealed class LivingFireTilesList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + TileType(), + TileType(), + TileType(), + TileType(), + TileID.LivingFire, + TileID.LivingCursedFire, + TileID.LivingDemonFire, + TileID.LivingFrostFire, + TileID.LivingIchor, + TileID.LivingUltrabrightFire + ]; + } + + public override void Unload() => List = null; + + /// + /// A shorthand method to check whether or not a tile is a Living-Fire-type of tile. + /// + public static bool IsLivingFireTile(Tile tile) => List.Contains(tile.TileType); + } +} diff --git a/Tiles/LivingFire/LivingPlagueFireBlockTile.cs b/Tiles/LivingFire/LivingPlagueFireBlockTile.cs index a99e7b7b64..7e30de8770 100644 --- a/Tiles/LivingFire/LivingPlagueFireBlockTile.cs +++ b/Tiles/LivingFire/LivingPlagueFireBlockTile.cs @@ -1,4 +1,5 @@ using CalamityMod.Dusts; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; From 30a2e249e19489a29cf4482948cc6f847225285f Mon Sep 17 00:00:00 2001 From: Memes <114233643+Mr-Memes@users.noreply.github.com> Date: Tue, 22 Oct 2024 14:28:01 +0200 Subject: [PATCH 068/118] AmalgamBuffList & previous oopsies. --- CalPlayer/CalamityPlayerMiscEffects.cs | 20 ++-- CalamityLists.cs | 98 ------------------- ModSupport/ModCalls.cs | 8 +- Projectiles/Boss/BrimstoneMonster.cs | 3 +- Systems/Collections/AmalgamBuffLists.cs | 123 ++++++++++++++++++++++++ 5 files changed, 139 insertions(+), 113 deletions(-) create mode 100644 Systems/Collections/AmalgamBuffLists.cs diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 499db82c0e..e0421dd2f8 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -1078,8 +1078,8 @@ namespace CalamityMod.CalPlayer { for (int l = 0; l < Player.MaxBuffs; l++) { - int hasBuff = Player.buffType[l]; - if (Player.buffTime[l] > 2 && CalamityLists.debuffList.Contains(hasBuff)) + int buffID = Player.buffType[l]; + if (Player.buffTime[l] > 2 && DebuffsList.IsDebuff(buffID)) Player.buffTime[l]--; } } @@ -1786,7 +1786,7 @@ namespace CalamityMod.CalPlayer // God Slayer Armor dash debuff immunity if (DashID == GodSlayerDash.ID && Player.dashDelay < 0) { - foreach (int debuff in CalamityLists.debuffList) + foreach (int debuff in DebuffsList.List) Player.buffImmune[debuff] = true; } @@ -1858,7 +1858,7 @@ namespace CalamityMod.CalPlayer if (silvaCountdown > 0 && hasSilvaEffect && silvaSet) { // You become immune to all debuffs - foreach (int debuff in CalamityLists.debuffList) + foreach (int debuff in DebuffsList.List) Player.buffImmune[debuff] = true; // Prevent thorns effects from being abused during invincibility @@ -3850,8 +3850,8 @@ namespace CalamityMod.CalPlayer { for (int l = 0; l < Player.MaxBuffs; l++) { - int hasBuff = Player.buffType[l]; - if (CalamityLists.amalgamBuffList.Contains(hasBuff)) + int buffID = Player.buffType[l]; + if (AmalgamBuffList.IsBuffBoostedByAmalgan(buffID)) { if (amalgam) { @@ -3862,14 +3862,14 @@ namespace CalamityMod.CalPlayer Player.buffTime[l] += 1; // Buffs will not go away when you die, to prevent wasting potions. - if (!Main.persistentBuff[hasBuff]) - Main.persistentBuff[hasBuff] = true; + if (!Main.persistentBuff[buffID]) + Main.persistentBuff[buffID] = true; } else { // Reset buff persistence if Amalgam is removed. - if (Main.persistentBuff[hasBuff] && !CalamityLists.persistentBuffList.Contains(hasBuff)) - Main.persistentBuff[hasBuff] = false; + if (Main.persistentBuff[buffID] && !CalamityLists.persistentBuffList.Contains(buffID)) + Main.persistentBuff[buffID] = false; } } } diff --git a/CalamityLists.cs b/CalamityLists.cs index 981bfc5e66..9a9c5025e6 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -66,7 +66,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List amalgamBuffList; public static List persistentBuffList; public static List MagicGunIDs; public static List BlacklistedWeaponsWithToolPower; @@ -128,102 +127,6 @@ namespace CalamityMod public override void OnModLoad() { - amalgamBuffList = new List() - { - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffID.ObsidianSkin, - BuffID.Regeneration, - BuffID.Swiftness, - BuffID.Gills, - BuffID.Ironskin, - BuffID.ManaRegeneration, - BuffID.MagicPower, - BuffID.Featherfall, - BuffID.Spelunker, - BuffID.Invisibility, - BuffID.Shine, - BuffID.NightOwl, - BuffID.Battle, - BuffID.Thorns, - BuffID.WaterWalking, - BuffID.Archery, - BuffID.Hunter, - BuffID.Gravitation, - BuffID.Tipsy, - BuffID.WellFed, - BuffID.WellFed2, - BuffID.WellFed3, - BuffID.Honey, - BuffID.WeaponImbueVenom, - BuffID.WeaponImbueCursedFlames, - BuffID.WeaponImbueFire, - BuffID.WeaponImbueGold, - BuffID.WeaponImbueIchor, - BuffID.WeaponImbueNanites, - BuffID.WeaponImbueConfetti, - BuffID.WeaponImbuePoison, - BuffID.Lucky, - BuffID.Mining, - BuffID.Heartreach, - BuffID.Calm, - BuffID.Builder, - BuffID.Titan, - BuffID.Flipper, - BuffID.Summoning, - BuffID.Dangersense, - BuffID.AmmoReservation, - BuffID.Lifeforce, - BuffID.Endurance, - BuffID.Rage, - BuffID.Inferno, - BuffID.Wrath, - BuffID.Lovestruck, - BuffID.Stinky, - BuffID.Fishing, - BuffID.Sonar, - BuffID.Crate, - BuffID.Warmth, - BuffID.SugarRush - }; - persistentBuffList = new List() { BuffType(), @@ -1279,7 +1182,6 @@ namespace CalamityMod public override void Unload() { - amalgamBuffList = null; persistentBuffList = null; MagicGunIDs = null; BlacklistedWeaponsWithToolPower = null; diff --git a/ModSupport/ModCalls.cs b/ModSupport/ModCalls.cs index a7b2391163..497faf2f37 100644 --- a/ModSupport/ModCalls.cs +++ b/ModSupport/ModCalls.cs @@ -915,14 +915,14 @@ namespace CalamityMod #region Amalgam Potion Buff List public static bool SetAmalgamBuffList(int type, bool shouldBeListed) { - if (shouldBeListed && !CalamityLists.amalgamBuffList.Contains(type)) + if (shouldBeListed && !AmalgamBuffList.IsBuffBoostedByAmalgan(type)) { - CalamityLists.amalgamBuffList.Add(type); + AmalgamBuffList.List.Add(type); return true; } else if (!shouldBeListed) { - return CalamityLists.amalgamBuffList.Remove(type); + return AmalgamBuffList.List.Remove(type); } return false; @@ -942,7 +942,7 @@ namespace CalamityMod return false; } - public static bool IsOnAmalgamBuffList(int type) => CalamityLists.amalgamBuffList.Contains(type); + public static bool IsOnAmalgamBuffList(int type) => AmalgamBuffList.IsBuffBoostedByAmalgan(type); public static bool IsOnPersistentBuffList(int type) => CalamityLists.persistentBuffList.Contains(type); #endregion diff --git a/Projectiles/Boss/BrimstoneMonster.cs b/Projectiles/Boss/BrimstoneMonster.cs index bf47477ee5..3dab41e24a 100644 --- a/Projectiles/Boss/BrimstoneMonster.cs +++ b/Projectiles/Boss/BrimstoneMonster.cs @@ -7,6 +7,7 @@ using CalamityMod.Events; using CalamityMod.NPCs; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.Particles; +using CalamityMod.Systems.Collections; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -350,7 +351,7 @@ namespace CalamityMod.Projectiles.Boss for (int l = 0; l < Player.MaxBuffs; l++) { int buffType = target.buffType[l]; - if (target.buffTime[l] > 0 && CalamityLists.amalgamBuffList.Contains(buffType)) + if (target.buffTime[l] > 0 && AmalgamBuffList.IsBuffBoostedByAmalgan(buffType)) { target.DelBuff(l); l--; diff --git a/Systems/Collections/AmalgamBuffLists.cs b/Systems/Collections/AmalgamBuffLists.cs new file mode 100644 index 0000000000..06b178e8b0 --- /dev/null +++ b/Systems/Collections/AmalgamBuffLists.cs @@ -0,0 +1,123 @@ +using System.Collections.Generic; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Buffs.Potions; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains a with all buff IDs of those who are boosted by The Amalgam accessory. + /// + public sealed class AmalgamBuffList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffType(), + BuffID.ObsidianSkin, + BuffID.Regeneration, + BuffID.Swiftness, + BuffID.Gills, + BuffID.Ironskin, + BuffID.ManaRegeneration, + BuffID.MagicPower, + BuffID.Featherfall, + BuffID.Spelunker, + BuffID.Invisibility, + BuffID.Shine, + BuffID.NightOwl, + BuffID.Battle, + BuffID.Thorns, + BuffID.WaterWalking, + BuffID.Archery, + BuffID.Hunter, + BuffID.Gravitation, + BuffID.Tipsy, + BuffID.WellFed, + BuffID.WellFed2, + BuffID.WellFed3, + BuffID.Honey, + BuffID.WeaponImbueVenom, + BuffID.WeaponImbueCursedFlames, + BuffID.WeaponImbueFire, + BuffID.WeaponImbueGold, + BuffID.WeaponImbueIchor, + BuffID.WeaponImbueNanites, + BuffID.WeaponImbueConfetti, + BuffID.WeaponImbuePoison, + BuffID.Lucky, + BuffID.Mining, + BuffID.Heartreach, + BuffID.Calm, + BuffID.Builder, + BuffID.Titan, + BuffID.Flipper, + BuffID.Summoning, + BuffID.Dangersense, + BuffID.AmmoReservation, + BuffID.Lifeforce, + BuffID.Endurance, + BuffID.Rage, + BuffID.Inferno, + BuffID.Wrath, + BuffID.Lovestruck, + BuffID.Stinky, + BuffID.Fishing, + BuffID.Sonar, + BuffID.Crate, + BuffID.Warmth, + BuffID.SugarRush + ]; + } + + public override void Unload() => List = null; + + /// + /// A shorthand method to check whether or not a buff is boosted by The Amalgam or not. + /// + public static bool IsBuffBoostedByAmalgan(int buffID) => List.Contains(buffID); + } +} From 04d05c56ebc5eee5db87d378edaa2f6414442bfe Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 17:56:20 +0900 Subject: [PATCH 069/118] PersistentBuffList. --- CalPlayer/CalamityPlayerMiscEffects.cs | 2 +- CalamityLists.cs | 17 --------- ModSupport/ModCalls.cs | 8 ++--- Systems/Collections/PersistentBuffList.cs | 42 +++++++++++++++++++++++ 4 files changed, 47 insertions(+), 22 deletions(-) create mode 100644 Systems/Collections/PersistentBuffList.cs diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index e0421dd2f8..69988d269c 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -3868,7 +3868,7 @@ namespace CalamityMod.CalPlayer else { // Reset buff persistence if Amalgam is removed. - if (Main.persistentBuff[buffID] && !CalamityLists.persistentBuffList.Contains(buffID)) + if (Main.persistentBuff[buffID] && !PersistentBuffList.IsPersistentBuff(buffID)) Main.persistentBuff[buffID] = false; } } diff --git a/CalamityLists.cs b/CalamityLists.cs index 9a9c5025e6..3be3e1a07b 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -66,7 +66,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List persistentBuffList; public static List MagicGunIDs; public static List BlacklistedWeaponsWithToolPower; @@ -127,21 +126,6 @@ namespace CalamityMod public override void OnModLoad() { - persistentBuffList = new List() - { - BuffType(), - BuffType(), - BuffType(), - BuffID.WeaponImbueVenom, - BuffID.WeaponImbueCursedFlames, - BuffID.WeaponImbueFire, - BuffID.WeaponImbueGold, - BuffID.WeaponImbueIchor, - BuffID.WeaponImbueNanites, - BuffID.WeaponImbueConfetti, - BuffID.WeaponImbuePoison - }; - MagicGunIDs = new List() { ItemType(), @@ -1182,7 +1166,6 @@ namespace CalamityMod public override void Unload() { - persistentBuffList = null; MagicGunIDs = null; BlacklistedWeaponsWithToolPower = null; diff --git a/ModSupport/ModCalls.cs b/ModSupport/ModCalls.cs index 497faf2f37..934efc430c 100644 --- a/ModSupport/ModCalls.cs +++ b/ModSupport/ModCalls.cs @@ -929,21 +929,21 @@ namespace CalamityMod } public static bool SetPersistentBuffList(int type, bool isPersistent) { - if (isPersistent && !CalamityLists.persistentBuffList.Contains(type)) + if (isPersistent && !PersistentBuffList.IsPersistentBuff(type)) { - CalamityLists.persistentBuffList.Add(type); + PersistentBuffList.List.Add(type); return true; } else if (!isPersistent) { - return CalamityLists.persistentBuffList.Remove(type); + return PersistentBuffList.List.Remove(type); } return false; } public static bool IsOnAmalgamBuffList(int type) => AmalgamBuffList.IsBuffBoostedByAmalgan(type); - public static bool IsOnPersistentBuffList(int type) => CalamityLists.persistentBuffList.Contains(type); + public static bool IsOnPersistentBuffList(int type) => PersistentBuffList.IsPersistentBuff(type); #endregion #region Venerated Locket Bans diff --git a/Systems/Collections/PersistentBuffList.cs b/Systems/Collections/PersistentBuffList.cs new file mode 100644 index 0000000000..58d25c743f --- /dev/null +++ b/Systems/Collections/PersistentBuffList.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Buffs.Potions; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class PersistentBuffList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + BuffType(), + BuffType(), + BuffType(), + BuffID.WeaponImbueVenom, + BuffID.WeaponImbueCursedFlames, + BuffID.WeaponImbueFire, + BuffID.WeaponImbueGold, + BuffID.WeaponImbueIchor, + BuffID.WeaponImbueNanites, + BuffID.WeaponImbueConfetti, + BuffID.WeaponImbuePoison + ]; + } + + public override void Unload() => List = null; + + /// + /// A shorthand method to check if this buffType is a PersistentBuff. + /// + public static bool IsPersistentBuff(int buffType) => List.Contains(buffType); + } +} From 6590caf4f2a8db503c85b62fc49171a3024ced8d Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 17:59:58 +0900 Subject: [PATCH 070/118] MagicGunIDList. --- CalPlayer/CalamityPlayer.cs | 3 +- CalamityLists.cs | 43 --------------- Systems/Collections/MagicGunIDList.cs | 66 +++++++++++++++++++++++ Systems/Collections/PersistentBuffList.cs | 6 +-- 4 files changed, 69 insertions(+), 49 deletions(-) create mode 100644 Systems/Collections/MagicGunIDList.cs diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 1f48e6e1ec..fed35514bf 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -52,6 +52,7 @@ using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems; +using CalamityMod.Systems.Collections; using CalamityMod.Waters; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -4011,7 +4012,7 @@ namespace CalamityMod.CalPlayer #region Modify Mana Cost public override void ModifyManaCost(Item item, ref float reduce, ref float mult) { - if (CalamityLists.MagicGunIDs.Contains(item.type) && meteorSet) + if (MagicGunIDList.IsMagicGun(item) && meteorSet) { mult *= 0.33f; } diff --git a/CalamityLists.cs b/CalamityLists.cs index 3be3e1a07b..d77d7361b8 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -66,7 +66,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List MagicGunIDs; public static List BlacklistedWeaponsWithToolPower; // Some of these lists of enemies are unused, but were difficult to create. Many of these common enemy types have a ton of variants. @@ -126,47 +125,6 @@ namespace CalamityMod public override void OnModLoad() { - MagicGunIDs = new List() - { - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemID.BeeGun, - ItemID.BubbleGun, - ItemID.ChargedBlasterCannon, - ItemID.HeatRay, - ItemID.LaserMachinegun, - ItemID.LaserRifle, - ItemID.LeafBlower, - ItemID.RainbowGun, - ItemID.SpaceGun, - ItemID.WaspGun, - ItemID.ZapinatorGray, - ItemID.ZapinatorOrange - }; - // This list intentionally does not contain Grax. BlacklistedWeaponsWithToolPower = new List() { @@ -1166,7 +1124,6 @@ namespace CalamityMod public override void Unload() { - MagicGunIDs = null; BlacklistedWeaponsWithToolPower = null; zombieList = null; diff --git a/Systems/Collections/MagicGunIDList.cs b/Systems/Collections/MagicGunIDList.cs new file mode 100644 index 0000000000..bc1b787287 --- /dev/null +++ b/Systems/Collections/MagicGunIDList.cs @@ -0,0 +1,66 @@ +using System.Collections.Generic; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Items.Weapons.Magic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class MagicGunIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemID.BeeGun, + ItemID.BubbleGun, + ItemID.ChargedBlasterCannon, + ItemID.HeatRay, + ItemID.LaserMachinegun, + ItemID.LaserRifle, + ItemID.LeafBlower, + ItemID.RainbowGun, + ItemID.SpaceGun, + ItemID.WaspGun, + ItemID.ZapinatorGray, + ItemID.ZapinatorOrange + ]; + } + + public override void Unload() => List = null; + + /// + /// A shorthand method to check if this Item is Magic Gun. + /// + public static bool IsMagicGun(Item item) => List.Contains(item.type); + } +} diff --git a/Systems/Collections/PersistentBuffList.cs b/Systems/Collections/PersistentBuffList.cs index 58d25c743f..e85813b135 100644 --- a/Systems/Collections/PersistentBuffList.cs +++ b/Systems/Collections/PersistentBuffList.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.Generic; using CalamityMod.Buffs.Potions; using Terraria.ID; using Terraria.ModLoader; From 663c2c83eccb1b6cc5e9b30bf057451fb30f2733 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 18:11:49 +0900 Subject: [PATCH 071/118] BlacklistedWeaponsWithToolPowerList. --- CalamityLists.cs | 17 -------- .../BlacklistedWeaponsWithToolPowerList.cs | 41 +++++++++++++++++++ Utilities/PlayerUtils.cs | 3 +- 3 files changed, 43 insertions(+), 18 deletions(-) create mode 100644 Systems/Collections/BlacklistedWeaponsWithToolPowerList.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index d77d7361b8..5d85ae580e 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -66,8 +66,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List BlacklistedWeaponsWithToolPower; - // Some of these lists of enemies are unused, but were difficult to create. Many of these common enemy types have a ton of variants. public static List zombieList; public static List demonEyeList; @@ -125,19 +123,6 @@ namespace CalamityMod public override void OnModLoad() { - // This list intentionally does not contain Grax. - BlacklistedWeaponsWithToolPower = new List() - { - ItemID.ButchersChainsaw, - ItemID.LucyTheAxe, - ItemID.Rockfish, - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType() - }; - zombieList = new List() { NPCID.Zombie, @@ -1124,8 +1109,6 @@ namespace CalamityMod public override void Unload() { - BlacklistedWeaponsWithToolPower = null; - zombieList = null; demonEyeList = null; skeletonList = null; diff --git a/Systems/Collections/BlacklistedWeaponsWithToolPowerList.cs b/Systems/Collections/BlacklistedWeaponsWithToolPowerList.cs new file mode 100644 index 0000000000..ed6953383b --- /dev/null +++ b/Systems/Collections/BlacklistedWeaponsWithToolPowerList.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Items.Tools; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Items.Weapons.Melee; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class BlacklistedWeaponsWithToolPowerList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + // This list intentionally does not contain Grax. + List = + [ + ItemID.ButchersChainsaw, + ItemID.LucyTheAxe, + ItemID.Rockfish, + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType() + ]; + } + + public override void Unload() => List = null; + + /// + /// A shorthand method to check if this Item is Blacklisted. + /// + public static bool IsBlacklistedItem(Item item) => List.Contains(item.type); + } +} diff --git a/Utilities/PlayerUtils.cs b/Utilities/PlayerUtils.cs index df0c716d35..0cf1ed5df5 100644 --- a/Utilities/PlayerUtils.cs +++ b/Utilities/PlayerUtils.cs @@ -15,6 +15,7 @@ using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Enums; using static Terraria.Player; +using CalamityMod.Systems.Collections; namespace CalamityMod { @@ -905,7 +906,7 @@ namespace CalamityMod item.CountsAsClass() ); - bool heldItemIsTool = (item.pick > 0 || item.axe > 0 || item.hammer > 0) && !CalamityLists.BlacklistedWeaponsWithToolPower.Contains(item.type); + bool heldItemIsTool = (item.pick > 0 || item.axe > 0 || item.hammer > 0) && !BlacklistedWeaponsWithToolPowerList.IsBlacklistedItem(item); bool heldItemCanBeUsed = item.useStyle != ItemUseStyleID.None; bool heldItemIsAccessoryOrAmmo = item.accessory || item.ammo != AmmoID.None; bool heldItemIsExcludedByModCall = CalamityLists.DisabledSummonerNerfItems.Contains(item.type); From 4f9a561c61416062dd4149ac3f564631300d7f9f Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 18:17:25 +0900 Subject: [PATCH 072/118] Code Cleanup --- CalamityLists.cs | 10 ---------- .../Collections/BlacklistedWeaponsWithToolPowerList.cs | 4 +--- Systems/Collections/EclipseBuffList.cs | 6 +----- Systems/Collections/EventProjectileBuffList.cs | 6 +----- Systems/Collections/FrostMoonBuffList.cs | 8 ++------ Systems/Collections/NeedsDebuffIconDisplayList.cs | 3 +-- Systems/Collections/PumpkinMoonBuffList.cs | 6 +----- 7 files changed, 7 insertions(+), 36 deletions(-) diff --git a/CalamityLists.cs b/CalamityLists.cs index 5d85ae580e..cfe78054b9 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -1,18 +1,8 @@ using System; using System.Collections.Generic; using CalamityMod.BiomeManagers; -using CalamityMod.Buffs.Alcohol; -using CalamityMod.Buffs.Potions; using CalamityMod.Enums; using CalamityMod.Items.DraedonMisc; -using CalamityMod.Items.LoreItems; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Abyss; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using CalamityMod.Items.Tools; -using CalamityMod.Items.Weapons.DraedonsArsenal; -using CalamityMod.Items.Weapons.Magic; -using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.NPCs.Abyss; using CalamityMod.NPCs.AcidRain; diff --git a/Systems/Collections/BlacklistedWeaponsWithToolPowerList.cs b/Systems/Collections/BlacklistedWeaponsWithToolPowerList.cs index ed6953383b..708d982295 100644 --- a/Systems/Collections/BlacklistedWeaponsWithToolPowerList.cs +++ b/Systems/Collections/BlacklistedWeaponsWithToolPowerList.cs @@ -1,6 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; +using System.Collections.Generic; using CalamityMod.Items.Tools; using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.Items.Weapons.Melee; diff --git a/Systems/Collections/EclipseBuffList.cs b/Systems/Collections/EclipseBuffList.cs index 0492248483..5c0326a7f6 100644 --- a/Systems/Collections/EclipseBuffList.cs +++ b/Systems/Collections/EclipseBuffList.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Systems/Collections/EventProjectileBuffList.cs b/Systems/Collections/EventProjectileBuffList.cs index 66c9f7da0f..e54f8ba499 100644 --- a/Systems/Collections/EventProjectileBuffList.cs +++ b/Systems/Collections/EventProjectileBuffList.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Systems/Collections/FrostMoonBuffList.cs b/Systems/Collections/FrostMoonBuffList.cs index 1138472d2b..2c1fb19b83 100644 --- a/Systems/Collections/FrostMoonBuffList.cs +++ b/Systems/Collections/FrostMoonBuffList.cs @@ -1,11 +1,7 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.Generic; +using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Terraria; namespace CalamityMod.Systems.Collections { diff --git a/Systems/Collections/NeedsDebuffIconDisplayList.cs b/Systems/Collections/NeedsDebuffIconDisplayList.cs index fe1c0f9e75..fd7e93cc9d 100644 --- a/Systems/Collections/NeedsDebuffIconDisplayList.cs +++ b/Systems/Collections/NeedsDebuffIconDisplayList.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using CalamityMod.NPCs.NormalNPCs; using Terraria; using Terraria.ID; diff --git a/Systems/Collections/PumpkinMoonBuffList.cs b/Systems/Collections/PumpkinMoonBuffList.cs index 55beea5e44..0408ce7de1 100644 --- a/Systems/Collections/PumpkinMoonBuffList.cs +++ b/Systems/Collections/PumpkinMoonBuffList.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; From 9dc2a3a3bb061cc265a1af8d47b7fff62e0f2cf9 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 18:19:32 +0900 Subject: [PATCH 073/118] Moving NPC related List to subfolder --- Systems/Collections/{ => NPCs}/BossHPScalingList.cs | 0 Systems/Collections/{ => NPCs}/BuffedDungeonEnemiesList.cs | 0 Systems/Collections/{ => NPCs}/EclipseBuffList.cs | 0 Systems/Collections/{ => NPCs}/EnemyImmunitiesList.cs | 0 Systems/Collections/{ => NPCs}/FriendlyBeesList.cs | 0 Systems/Collections/{ => NPCs}/FrostMoonBuffList.cs | 0 Systems/Collections/{ => NPCs}/NoRageWormSegmentList.cs | 0 Systems/Collections/{ => NPCs}/PumpkinMoonBuffList.cs | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename Systems/Collections/{ => NPCs}/BossHPScalingList.cs (100%) rename Systems/Collections/{ => NPCs}/BuffedDungeonEnemiesList.cs (100%) rename Systems/Collections/{ => NPCs}/EclipseBuffList.cs (100%) rename Systems/Collections/{ => NPCs}/EnemyImmunitiesList.cs (100%) rename Systems/Collections/{ => NPCs}/FriendlyBeesList.cs (100%) rename Systems/Collections/{ => NPCs}/FrostMoonBuffList.cs (100%) rename Systems/Collections/{ => NPCs}/NoRageWormSegmentList.cs (100%) rename Systems/Collections/{ => NPCs}/PumpkinMoonBuffList.cs (100%) diff --git a/Systems/Collections/BossHPScalingList.cs b/Systems/Collections/NPCs/BossHPScalingList.cs similarity index 100% rename from Systems/Collections/BossHPScalingList.cs rename to Systems/Collections/NPCs/BossHPScalingList.cs diff --git a/Systems/Collections/BuffedDungeonEnemiesList.cs b/Systems/Collections/NPCs/BuffedDungeonEnemiesList.cs similarity index 100% rename from Systems/Collections/BuffedDungeonEnemiesList.cs rename to Systems/Collections/NPCs/BuffedDungeonEnemiesList.cs diff --git a/Systems/Collections/EclipseBuffList.cs b/Systems/Collections/NPCs/EclipseBuffList.cs similarity index 100% rename from Systems/Collections/EclipseBuffList.cs rename to Systems/Collections/NPCs/EclipseBuffList.cs diff --git a/Systems/Collections/EnemyImmunitiesList.cs b/Systems/Collections/NPCs/EnemyImmunitiesList.cs similarity index 100% rename from Systems/Collections/EnemyImmunitiesList.cs rename to Systems/Collections/NPCs/EnemyImmunitiesList.cs diff --git a/Systems/Collections/FriendlyBeesList.cs b/Systems/Collections/NPCs/FriendlyBeesList.cs similarity index 100% rename from Systems/Collections/FriendlyBeesList.cs rename to Systems/Collections/NPCs/FriendlyBeesList.cs diff --git a/Systems/Collections/FrostMoonBuffList.cs b/Systems/Collections/NPCs/FrostMoonBuffList.cs similarity index 100% rename from Systems/Collections/FrostMoonBuffList.cs rename to Systems/Collections/NPCs/FrostMoonBuffList.cs diff --git a/Systems/Collections/NoRageWormSegmentList.cs b/Systems/Collections/NPCs/NoRageWormSegmentList.cs similarity index 100% rename from Systems/Collections/NoRageWormSegmentList.cs rename to Systems/Collections/NPCs/NoRageWormSegmentList.cs diff --git a/Systems/Collections/PumpkinMoonBuffList.cs b/Systems/Collections/NPCs/PumpkinMoonBuffList.cs similarity index 100% rename from Systems/Collections/PumpkinMoonBuffList.cs rename to Systems/Collections/NPCs/PumpkinMoonBuffList.cs From dc594e2e7e4afae58dd82e6f98bff29fee4ab0bb Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 18:22:45 +0900 Subject: [PATCH 074/118] ZombieList. --- CalamityLists.cs | 42 ------------------ Systems/Collections/NPCs/ZombieList.cs | 60 ++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 42 deletions(-) create mode 100644 Systems/Collections/NPCs/ZombieList.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index cfe78054b9..fd555fd221 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -56,8 +56,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - // Some of these lists of enemies are unused, but were difficult to create. Many of these common enemy types have a ton of variants. - public static List zombieList; public static List demonEyeList; public static List skeletonList; public static List angryBonesList; @@ -113,45 +111,6 @@ namespace CalamityMod public override void OnModLoad() { - zombieList = new List() - { - NPCID.Zombie, - NPCID.ArmedZombie, - NPCID.BaldZombie, - NPCID.PincushionZombie, - NPCID.ArmedZombiePincussion, // what is this spelling - NPCID.SlimedZombie, - NPCID.ArmedZombieSlimed, - NPCID.SwampZombie, - NPCID.ArmedZombieSwamp, - NPCID.TwiggyZombie, - NPCID.ArmedZombieTwiggy, - NPCID.FemaleZombie, - NPCID.ArmedZombieCenx, - NPCID.ZombieRaincoat, - NPCID.ZombieEskimo, - NPCID.ArmedZombieEskimo, - NPCID.BigRainZombie, - NPCID.SmallRainZombie, - NPCID.BigFemaleZombie, - NPCID.SmallFemaleZombie, - NPCID.BigTwiggyZombie, - NPCID.SmallTwiggyZombie, - NPCID.BigSwampZombie, - NPCID.SmallSwampZombie, - NPCID.BigSlimedZombie, - NPCID.SmallSlimedZombie, - NPCID.BigPincushionZombie, - NPCID.SmallPincushionZombie, - NPCID.BigBaldZombie, - NPCID.SmallBaldZombie, - NPCID.BigZombie, - NPCID.SmallZombie, - NPCID.MaggotZombie, - NPCType() - // halloween zombies not included because they don't drop shackles or zombie arms - }; - demonEyeList = new List() { NPCID.DemonEye, @@ -1099,7 +1058,6 @@ namespace CalamityMod public override void Unload() { - zombieList = null; demonEyeList = null; skeletonList = null; angryBonesList = null; diff --git a/Systems/Collections/NPCs/ZombieList.cs b/Systems/Collections/NPCs/ZombieList.cs new file mode 100644 index 0000000000..de8077571c --- /dev/null +++ b/Systems/Collections/NPCs/ZombieList.cs @@ -0,0 +1,60 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.NormalNPCs; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class ZombieList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.Zombie, + NPCID.ArmedZombie, + NPCID.BaldZombie, + NPCID.PincushionZombie, + NPCID.ArmedZombiePincussion, // what is this spelling + NPCID.SlimedZombie, + NPCID.ArmedZombieSlimed, + NPCID.SwampZombie, + NPCID.ArmedZombieSwamp, + NPCID.TwiggyZombie, + NPCID.ArmedZombieTwiggy, + NPCID.FemaleZombie, + NPCID.ArmedZombieCenx, + NPCID.ZombieRaincoat, + NPCID.ZombieEskimo, + NPCID.ArmedZombieEskimo, + NPCID.BigRainZombie, + NPCID.SmallRainZombie, + NPCID.BigFemaleZombie, + NPCID.SmallFemaleZombie, + NPCID.BigTwiggyZombie, + NPCID.SmallTwiggyZombie, + NPCID.BigSwampZombie, + NPCID.SmallSwampZombie, + NPCID.BigSlimedZombie, + NPCID.SmallSlimedZombie, + NPCID.BigPincushionZombie, + NPCID.SmallPincushionZombie, + NPCID.BigBaldZombie, + NPCID.SmallBaldZombie, + NPCID.BigZombie, + NPCID.SmallZombie, + NPCID.MaggotZombie, + NPCType() + // halloween zombies not included because they don't drop shackles or zombie arms + ]; + } + + public override void Unload() => List = null; + + public static bool IsZombie(NPC npc) => List.Contains(npc.type); + } +} From 1547ec9a893d8691b6727ff87536599d8922bac4 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 18:24:33 +0900 Subject: [PATCH 075/118] DemonEyeList. --- CalamityLists.cs | 20 ------------- Systems/Collections/NPCs/DemonEyeList.cs | 37 ++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 20 deletions(-) create mode 100644 Systems/Collections/NPCs/DemonEyeList.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index fd555fd221..fd1099fedb 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -56,7 +56,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List demonEyeList; public static List skeletonList; public static List angryBonesList; public static List hornetList; @@ -111,24 +110,6 @@ namespace CalamityMod public override void OnModLoad() { - demonEyeList = new List() - { - NPCID.DemonEye, - NPCID.CataractEye, - NPCID.SleepyEye, - NPCID.DialatedEye, // it is spelled "dilated" - NPCID.GreenEye, - NPCID.PurpleEye, - NPCID.DemonEyeOwl, - NPCID.DemonEyeSpaceship, - NPCID.DemonEye2, - NPCID.PurpleEye2, - NPCID.GreenEye2, - NPCID.DialatedEye2, - NPCID.SleepyEye2, - NPCID.CataractEye2 - }; - skeletonList = new List() { NPCID.Skeleton, @@ -1058,7 +1039,6 @@ namespace CalamityMod public override void Unload() { - demonEyeList = null; skeletonList = null; angryBonesList = null; hornetList = null; diff --git a/Systems/Collections/NPCs/DemonEyeList.cs b/Systems/Collections/NPCs/DemonEyeList.cs new file mode 100644 index 0000000000..e2a3b1e72f --- /dev/null +++ b/Systems/Collections/NPCs/DemonEyeList.cs @@ -0,0 +1,37 @@ +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + public sealed class DemonEyeList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.DemonEye, + NPCID.CataractEye, + NPCID.SleepyEye, + NPCID.DialatedEye, // it is spelled "dilated" + NPCID.GreenEye, + NPCID.PurpleEye, + NPCID.DemonEyeOwl, + NPCID.DemonEyeSpaceship, + NPCID.DemonEye2, + NPCID.PurpleEye2, + NPCID.GreenEye2, + NPCID.DialatedEye2, + NPCID.SleepyEye2, + NPCID.CataractEye2 + ]; + } + + public override void Unload() => List = null; + + public static bool IsDemonEye(NPC npc) => List.Contains(npc.type); + } +} From 202862cbac487f037de718616ed66ed2627db2c5 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 18:27:16 +0900 Subject: [PATCH 076/118] SkeletonList. --- CalamityLists.cs | 34 ---------------- NPCs/CalamityGlobalNPCLoot.cs | 5 +-- Systems/Collections/NPCs/SkeletonList.cs | 51 ++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 38 deletions(-) create mode 100644 Systems/Collections/NPCs/SkeletonList.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index fd1099fedb..d1db878316 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -56,7 +56,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List skeletonList; public static List angryBonesList; public static List hornetList; public static List mossHornetList; @@ -110,38 +109,6 @@ namespace CalamityMod public override void OnModLoad() { - skeletonList = new List() - { - NPCID.Skeleton, - NPCID.HeadacheSkeleton, - NPCID.MisassembledSkeleton, - NPCID.PantlessSkeleton, - NPCID.BoneThrowingSkeleton, - NPCID.BoneThrowingSkeleton2, - NPCID.BoneThrowingSkeleton3, - NPCID.BoneThrowingSkeleton4, - NPCID.BigPantlessSkeleton, - NPCID.SmallPantlessSkeleton, - NPCID.BigMisassembledSkeleton, - NPCID.SmallMisassembledSkeleton, - NPCID.BigHeadacheSkeleton, - NPCID.SmallHeadacheSkeleton, - NPCID.BigSkeleton, - NPCID.SmallSkeleton, - - //Note: These skeletons don't count for Skeleton Banner for some god forsaken reason - NPCID.SkeletonTopHat, - NPCID.SkeletonAstonaut, - NPCID.SkeletonAlien, - - //Other skeleton types - NPCID.ArmoredSkeleton, - NPCID.HeavySkeleton, - NPCID.SkeletonArcher, - NPCID.GreekSkeleton, - NPCID.SporeSkeleton - }; - angryBonesList = new List() { NPCID.AngryBones, @@ -1039,7 +1006,6 @@ namespace CalamityMod public override void Unload() { - skeletonList = null; angryBonesList = null; hornetList = null; mossHornetList = null; diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 6b8953dba0..8193cd7e1a 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -19,9 +19,6 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Items.Weapons.Typeless; -using CalamityMod.NPCs.AcidRain; -using CalamityMod.NPCs.Astral; -using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.TownNPCs; using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Ores; @@ -1714,7 +1711,7 @@ DukeEditFailed: // All Skeletons // Ancient Bone Dust @ 20% Normal, 33.33% Expert+ - if (CalamityLists.skeletonList.Contains(npc.type)) + if (SkeletonList.IsSkeleton(npc)) npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 5, 3)); // All Hardmode Dungeon Enemies diff --git a/Systems/Collections/NPCs/SkeletonList.cs b/Systems/Collections/NPCs/SkeletonList.cs new file mode 100644 index 0000000000..d525b121a7 --- /dev/null +++ b/Systems/Collections/NPCs/SkeletonList.cs @@ -0,0 +1,51 @@ +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + public sealed class SkeletonList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.Skeleton, + NPCID.HeadacheSkeleton, + NPCID.MisassembledSkeleton, + NPCID.PantlessSkeleton, + NPCID.BoneThrowingSkeleton, + NPCID.BoneThrowingSkeleton2, + NPCID.BoneThrowingSkeleton3, + NPCID.BoneThrowingSkeleton4, + NPCID.BigPantlessSkeleton, + NPCID.SmallPantlessSkeleton, + NPCID.BigMisassembledSkeleton, + NPCID.SmallMisassembledSkeleton, + NPCID.BigHeadacheSkeleton, + NPCID.SmallHeadacheSkeleton, + NPCID.BigSkeleton, + NPCID.SmallSkeleton, + + //Note: These skeletons don't count for Skeleton Banner for some god forsaken reason + NPCID.SkeletonTopHat, + NPCID.SkeletonAstonaut, + NPCID.SkeletonAlien, + + //Other skeleton types + NPCID.ArmoredSkeleton, + NPCID.HeavySkeleton, + NPCID.SkeletonArcher, + NPCID.GreekSkeleton, + NPCID.SporeSkeleton + ]; + } + + public override void Unload() => List = null; + + public static bool IsSkeleton(NPC npc) => List.Contains(npc.type); + } +} From d0c5a78403866d7cbde002d85bda22c227551115 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 18:28:49 +0900 Subject: [PATCH 077/118] AngryBonesList. --- CalamityLists.cs | 12 --------- Systems/Collections/NPCs/AngryBonesList.cs | 29 ++++++++++++++++++++++ 2 files changed, 29 insertions(+), 12 deletions(-) create mode 100644 Systems/Collections/NPCs/AngryBonesList.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index d1db878316..c76bc55601 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -56,7 +56,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List angryBonesList; public static List hornetList; public static List mossHornetList; public static List minibossList; @@ -109,16 +108,6 @@ namespace CalamityMod public override void OnModLoad() { - angryBonesList = new List() - { - NPCID.AngryBones, - NPCID.AngryBonesBig, - NPCID.AngryBonesBigMuscle, - NPCID.AngryBonesBigHelmet, - NPCID.BigBoned, - NPCID.ShortBones - }; - hornetList = new List() { NPCID.BigHornetStingy, @@ -1006,7 +995,6 @@ namespace CalamityMod public override void Unload() { - angryBonesList = null; hornetList = null; mossHornetList = null; minibossList = null; diff --git a/Systems/Collections/NPCs/AngryBonesList.cs b/Systems/Collections/NPCs/AngryBonesList.cs new file mode 100644 index 0000000000..c79cd682cd --- /dev/null +++ b/Systems/Collections/NPCs/AngryBonesList.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + public sealed class AngryBonesList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.AngryBones, + NPCID.AngryBonesBig, + NPCID.AngryBonesBigMuscle, + NPCID.AngryBonesBigHelmet, + NPCID.BigBoned, + NPCID.ShortBones + ]; + } + + public override void Unload() => List = null; + + public static bool IsAngryBones(NPC npc) => List.Contains(npc.type); + } +} From d3795b7bcdf121596942ab01db16575b1fe8a217 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 18:37:58 +0900 Subject: [PATCH 078/118] HornetList. and MossHornetList. --- CalamityLists.cs | 35 ------------------ NPCs/CalamityGlobalNPCLoot.cs | 2 +- Systems/Collections/NPCs/HornetList.cs | 41 ++++++++++++++++++++++ Systems/Collections/NPCs/MossHornetList.cs | 28 +++++++++++++++ 4 files changed, 70 insertions(+), 36 deletions(-) create mode 100644 Systems/Collections/NPCs/HornetList.cs create mode 100644 Systems/Collections/NPCs/MossHornetList.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index c76bc55601..371baf8690 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -56,8 +56,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List hornetList; - public static List mossHornetList; public static List minibossList; public static List pierceResistList; @@ -108,37 +106,6 @@ namespace CalamityMod public override void OnModLoad() { - hornetList = new List() - { - NPCID.BigHornetStingy, - NPCID.LittleHornetStingy, - NPCID.BigHornetSpikey, - NPCID.LittleHornetSpikey, - NPCID.BigHornetLeafy, - NPCID.LittleHornetLeafy, - NPCID.BigHornetHoney, - NPCID.LittleHornetHoney, - NPCID.BigHornetFatty, - NPCID.LittleHornetFatty, - NPCID.BigStinger, - NPCID.LittleStinger, - NPCID.Hornet, - NPCID.HornetFatty, - NPCID.HornetHoney, - NPCID.HornetLeafy, - NPCID.HornetSpikey, - NPCID.HornetStingy - }; - - mossHornetList = new List() - { - NPCID.MossHornet, - NPCID.TinyMossHornet, - NPCID.LittleMossHornet, - NPCID.BigMossHornet, - NPCID.GiantMossHornet - }; - minibossList = new List() { NPCType(), @@ -995,8 +962,6 @@ namespace CalamityMod public override void Unload() { - hornetList = null; - mossHornetList = null; minibossList = null; pierceResistList = null; pierceResistExceptionLeviAureusList = null; diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 8193cd7e1a..c9a59fd8a4 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -1706,7 +1706,7 @@ DukeEditFailed: // All Moss Hornets // Needler @ 4% Normal, 6.67% Expert+ - if (CalamityLists.mossHornetList.Contains(npc.type)) + if (MossHornetList.IsMossHornet(npc)) npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 25, 15)); // All Skeletons diff --git a/Systems/Collections/NPCs/HornetList.cs b/Systems/Collections/NPCs/HornetList.cs new file mode 100644 index 0000000000..48d0721499 --- /dev/null +++ b/Systems/Collections/NPCs/HornetList.cs @@ -0,0 +1,41 @@ +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + public sealed class HornetList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.BigHornetStingy, + NPCID.LittleHornetStingy, + NPCID.BigHornetSpikey, + NPCID.LittleHornetSpikey, + NPCID.BigHornetLeafy, + NPCID.LittleHornetLeafy, + NPCID.BigHornetHoney, + NPCID.LittleHornetHoney, + NPCID.BigHornetFatty, + NPCID.LittleHornetFatty, + NPCID.BigStinger, + NPCID.LittleStinger, + NPCID.Hornet, + NPCID.HornetFatty, + NPCID.HornetHoney, + NPCID.HornetLeafy, + NPCID.HornetSpikey, + NPCID.HornetStingy + ]; + } + + public override void Unload() => List = null; + + public static bool IsHornet(NPC npc) => List.Contains(npc.type); + } +} diff --git a/Systems/Collections/NPCs/MossHornetList.cs b/Systems/Collections/NPCs/MossHornetList.cs new file mode 100644 index 0000000000..344437796f --- /dev/null +++ b/Systems/Collections/NPCs/MossHornetList.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + public sealed class MossHornetList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.MossHornet, + NPCID.TinyMossHornet, + NPCID.LittleMossHornet, + NPCID.BigMossHornet, + NPCID.GiantMossHornet + ]; + } + + public override void Unload() => List = null; + + public static bool IsMossHornet(NPC npc) => List.Contains(npc.type); + } +} From 41ea207493e4d72550bd2e623978964e0630dc0e Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 18:42:05 +0900 Subject: [PATCH 079/118] MinibossList. --- CalamityLists.cs | 35 ---------------- Systems/Collections/NPCs/MinibossList.cs | 53 ++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 35 deletions(-) create mode 100644 Systems/Collections/NPCs/MinibossList.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index 371baf8690..0746545b8b 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -4,8 +4,6 @@ using CalamityMod.BiomeManagers; using CalamityMod.Enums; using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.NPCs.Abyss; -using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.AquaticScourge; using CalamityMod.NPCs.AstrumAureus; using CalamityMod.NPCs.AstrumDeus; @@ -21,14 +19,12 @@ using CalamityMod.NPCs.ExoMechs.Apollo; using CalamityMod.NPCs.ExoMechs.Ares; using CalamityMod.NPCs.ExoMechs.Artemis; using CalamityMod.NPCs.ExoMechs.Thanatos; -using CalamityMod.NPCs.GreatSandShark; using CalamityMod.NPCs.HiveMind; using CalamityMod.NPCs.Leviathan; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.OldDuke; using CalamityMod.NPCs.Perforator; using CalamityMod.NPCs.PlaguebringerGoliath; -using CalamityMod.NPCs.PlagueEnemies; using CalamityMod.NPCs.Polterghast; using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.NPCs.Providence; @@ -36,7 +32,6 @@ using CalamityMod.NPCs.Ravager; using CalamityMod.NPCs.Signus; using CalamityMod.NPCs.SlimeGod; using CalamityMod.NPCs.StormWeaver; -using CalamityMod.NPCs.SunkenSea; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs.Yharon; using CalamityMod.Projectiles.DraedonsArsenal; @@ -56,8 +51,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List minibossList; - public static List pierceResistList; public static List pierceResistExceptionLeviAureusList; public static List pierceResistExceptionList; @@ -106,33 +99,6 @@ namespace CalamityMod public override void OnModLoad() { - minibossList = new List() - { - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCID.Pumpking, - NPCID.MourningWood, - NPCID.IceQueen, - NPCID.SantaNK1, - NPCID.Everscream, - NPCID.DD2Betsy, - NPCID.Mothron, - NPCID.MartianSaucer, - NPCID.MartianSaucerCannon, - NPCID.MartianSaucerCore, - NPCID.MartianSaucerTurret, - }; - pierceResistList = new List() { NPCID.EaterofWorldsHead, @@ -962,7 +928,6 @@ namespace CalamityMod public override void Unload() { - minibossList = null; pierceResistList = null; pierceResistExceptionLeviAureusList = null; pierceResistExceptionList = null; diff --git a/Systems/Collections/NPCs/MinibossList.cs b/Systems/Collections/NPCs/MinibossList.cs new file mode 100644 index 0000000000..5d2c0ea5a9 --- /dev/null +++ b/Systems/Collections/NPCs/MinibossList.cs @@ -0,0 +1,53 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.Abyss; +using CalamityMod.NPCs.AcidRain; +using CalamityMod.NPCs.GreatSandShark; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.PlagueEnemies; +using CalamityMod.NPCs.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class MinibossList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCID.Pumpking, + NPCID.MourningWood, + NPCID.IceQueen, + NPCID.SantaNK1, + NPCID.Everscream, + NPCID.DD2Betsy, + NPCID.Mothron, + NPCID.MartianSaucer, + NPCID.MartianSaucerCannon, + NPCID.MartianSaucerCore, + NPCID.MartianSaucerTurret + ]; + } + + public override void Unload() => List = null; + + public static bool IsMiniboss(NPC npc) => List.Contains(npc.type); + } +} From f77847134863eea9b962cff0c20d86e05c039859 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 18:47:59 +0900 Subject: [PATCH 080/118] PierceResistList. --- CalamityLists.cs | 57 ------------- NPCs/CalamityGlobalNPC.cs | 15 ++-- Systems/Collections/NPCs/PierceResistList.cs | 89 ++++++++++++++++++++ 3 files changed, 98 insertions(+), 63 deletions(-) create mode 100644 Systems/Collections/NPCs/PierceResistList.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index 0746545b8b..0d0a34cd0c 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -51,7 +51,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List pierceResistList; public static List pierceResistExceptionLeviAureusList; public static List pierceResistExceptionList; @@ -99,61 +98,6 @@ namespace CalamityMod public override void OnModLoad() { - pierceResistList = new List() - { - NPCID.EaterofWorldsHead, - NPCID.EaterofWorldsBody, - NPCID.EaterofWorldsTail, - NPCID.Creeper, - NPCID.TheDestroyer, - NPCID.TheDestroyerBody, - NPCID.TheDestroyerTail, - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType() - }; - pierceResistExceptionLeviAureusList = new List() { ProjectileID.NettleBurstEnd, @@ -928,7 +872,6 @@ namespace CalamityMod public override void Unload() { - pierceResistList = null; pierceResistExceptionLeviAureusList = null; pierceResistExceptionList = null; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index aac0c4938f..443e4b7754 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -11,6 +11,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Buffs.Summon.Whips; using CalamityMod.CalPlayer; using CalamityMod.Events; +using CalamityMod.ExtraTextures; using CalamityMod.Graphics.Metaballs; using CalamityMod.Graphics.Renderers.CalamityRenderers; using CalamityMod.Items.Accessories; @@ -57,11 +58,12 @@ using CalamityMod.Particles; using CalamityMod.Projectiles; using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Melee; -using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.FurnitureAuric; using CalamityMod.Tiles.Ores; using CalamityMod.UI; @@ -71,6 +73,7 @@ using CalamityMod.World; using Microsoft.CodeAnalysis; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using MonoMod.Utils; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -6073,7 +6076,7 @@ namespace CalamityMod.NPCs #endregion #region Modify Hit By Projectile - public static bool DisableMultWhipTag = false; + public static bool DisableMultWhipTag = false; //this bool does nothing on this branch, its just here so that CalTestHelpers doesn't crash searching for it //if you want to mess with this, please do so in the summoner branch - Shade public override void ModifyHitByProjectile(NPC npc, Projectile projectile, ref NPC.HitModifiers modifiers) @@ -6170,7 +6173,7 @@ namespace CalamityMod.NPCs if (bullseye.ai[2] == 0f) { - bullseye.timeLeft = DaawnlightSpiritOrigin.BullseyeHitLifetime; + bullseye.timeLeft = DaawnlightSpiritOrigin.BullseyeHitLifetime; bullseye.ai[2] = 1f; } @@ -6178,7 +6181,7 @@ namespace CalamityMod.NPCs { int randomStarAmount = Main.rand.Next(3, 6); float randomCircleRotation = Main.rand.NextFloat(MathHelper.TwoPi); - for (int i = 0 ; i < randomStarAmount ; i++) + for (int i = 0; i < randomStarAmount; i++) { Particle fancyStars = new FancyStars( bullseye.Center, @@ -6189,7 +6192,7 @@ namespace CalamityMod.NPCs 55, new Color(Main.rand.Next(256), Main.rand.Next(256), Main.rand.Next(256)) * 1.2f); GeneralParticleHandler.SpawnParticle(fancyStars); - } + } } bullseye.netUpdate = true; @@ -6237,7 +6240,7 @@ namespace CalamityMod.NPCs modifiers.SourceDamage *= 0.4f; } - if (CalamityLists.pierceResistList.Contains(npc.type)) + if (PierceResistList.HasPierceResist(npc)) PierceResistGlobal(projectile, npc, ref modifiers); if (modPlayer.camper && !player.StandingStill()) diff --git a/Systems/Collections/NPCs/PierceResistList.cs b/Systems/Collections/NPCs/PierceResistList.cs new file mode 100644 index 0000000000..575d8f8f71 --- /dev/null +++ b/Systems/Collections/NPCs/PierceResistList.cs @@ -0,0 +1,89 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.AquaticScourge; +using CalamityMod.NPCs.AstrumAureus; +using CalamityMod.NPCs.AstrumDeus; +using CalamityMod.NPCs.CeaselessVoid; +using CalamityMod.NPCs.DesertScourge; +using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.ExoMechs.Ares; +using CalamityMod.NPCs.ExoMechs.Thanatos; +using CalamityMod.NPCs.Leviathan; +using CalamityMod.NPCs.Perforator; +using CalamityMod.NPCs.ProfanedGuardians; +using CalamityMod.NPCs.Ravager; +using CalamityMod.NPCs.StormWeaver; +using CalamityMod.NPCs.SupremeCalamitas; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class PierceResistList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.EaterofWorldsHead, + NPCID.EaterofWorldsBody, + NPCID.EaterofWorldsTail, + NPCID.Creeper, + NPCID.TheDestroyer, + NPCID.TheDestroyerBody, + NPCID.TheDestroyerTail, + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() + ]; + } + + public override void Unload() => List = null; + + public static bool HasPierceResist(NPC npc) => List.Contains(npc.type); + } +} From 39db2379c69db33f1c0af8052186bb90f8b75cc5 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 18:52:05 +0900 Subject: [PATCH 081/118] PierceResistExceptionLeviAureusList. --- CalamityLists.cs | 15 -------- NPCs/CalamityGlobalNPC.cs | 2 +- .../PierceResistExceptionLeviAureusList.cs | 35 +++++++++++++++++++ 3 files changed, 36 insertions(+), 16 deletions(-) create mode 100644 Systems/Collections/PierceResistExceptionLeviAureusList.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index 0d0a34cd0c..b1e494570e 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -51,7 +51,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List pierceResistExceptionLeviAureusList; public static List pierceResistExceptionList; public static List AstrumDeusIDs; @@ -98,19 +97,6 @@ namespace CalamityMod public override void OnModLoad() { - pierceResistExceptionLeviAureusList = new List() - { - ProjectileID.NettleBurstEnd, - ProjectileID.NettleBurstLeft, - ProjectileID.NettleBurstRight, - ProjectileID.PrincessWeapon, - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType() - }; - pierceResistExceptionList = new List() { ProjectileID.Arkhalis, @@ -872,7 +858,6 @@ namespace CalamityMod public override void Unload() { - pierceResistExceptionLeviAureusList = null; pierceResistExceptionList = null; AstrumDeusIDs = null; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 443e4b7754..00979df231 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -6259,7 +6259,7 @@ namespace CalamityMod.NPCs return; // Isolates projectiles which ignore pierce resist only on Leviathan and Astrum Aureus - if ((npc.type == NPCType() || npc.type == NPCType()) && CalamityLists.pierceResistExceptionLeviAureusList.Contains(projectile.type)) + if ((npc.type == NPCType() || npc.type == NPCType()) && PierceResistExceptionLeviAureusList.IsException(projectile)) return; float damageReduction = projectile.Calamity().timesPierced * CalamityGlobalProjectile.PierceResistHarshness; diff --git a/Systems/Collections/PierceResistExceptionLeviAureusList.cs b/Systems/Collections/PierceResistExceptionLeviAureusList.cs new file mode 100644 index 0000000000..96fa4f0327 --- /dev/null +++ b/Systems/Collections/PierceResistExceptionLeviAureusList.cs @@ -0,0 +1,35 @@ +using System.Collections.Generic; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Rogue; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class PierceResistExceptionLeviAureusList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + ProjectileID.NettleBurstEnd, + ProjectileID.NettleBurstLeft, + ProjectileID.NettleBurstRight, + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType() + ]; + } + + public override void Unload() => List = null; + + public static bool IsException(Projectile projectile) => List.Contains(projectile.type); + } +} From a1fc84babd5d568bba39da8de9569b4c715c5a01 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 18:54:44 +0900 Subject: [PATCH 082/118] PierceResistExceptionList. OZZ EDIT: AcidRocket from Sulphuric Acid Cannon --- CalamityLists.cs | 86 --------------- NPCs/CalamityGlobalNPC.cs | 2 +- .../Collections/PierceResistExceptionList.cs | 102 ++++++++++++++++++ 3 files changed, 103 insertions(+), 87 deletions(-) create mode 100644 Systems/Collections/PierceResistExceptionList.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index b1e494570e..88c8be1029 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -34,13 +34,6 @@ using CalamityMod.NPCs.SlimeGod; using CalamityMod.NPCs.StormWeaver; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs.Yharon; -using CalamityMod.Projectiles.DraedonsArsenal; -using CalamityMod.Projectiles.Magic; -using CalamityMod.Projectiles.Melee; -using CalamityMod.Projectiles.Melee.MaceFlails; -using CalamityMod.Projectiles.Ranged; -using CalamityMod.Projectiles.Rogue; -using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using Terraria; using Terraria.ID; @@ -51,8 +44,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List pierceResistExceptionList; - public static List AstrumDeusIDs; public static List DevourerOfGodsIDs; public static List CosmicGuardianIDs; @@ -97,81 +88,6 @@ namespace CalamityMod public override void OnModLoad() { - pierceResistExceptionList = new List() - { - ProjectileID.Arkhalis, - ProjectileID.ChargedBlasterLaser, - ProjectileID.ClingerStaff, - ProjectileID.FinalFractal, - ProjectileID.FlyingKnife, - ProjectileID.LastPrismLaser, - ProjectileID.MechanicalPiranha, - ProjectileID.MonkStaffT3, - ProjectileID.PiercingStarlight, - ProjectileID.Terragrim, - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - }; - // Lists of enemies that resist piercing to some extent (mostly worms). // Could prove useful for other things as well. @@ -858,8 +774,6 @@ namespace CalamityMod public override void Unload() { - pierceResistExceptionList = null; - AstrumDeusIDs = null; DevourerOfGodsIDs = null; CosmicGuardianIDs = null; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 00979df231..ac26c300cf 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -6268,7 +6268,7 @@ namespace CalamityMod.NPCs modifiers.FinalDamage *= 1f - damageReduction; - if ((projectile.penetrate > 1 || projectile.penetrate == -1) && !CalamityLists.pierceResistExceptionList.Contains(projectile.type) && !projectile.CountsAsClass() && projectile.aiStyle != 15 && projectile.aiStyle != 39 && projectile.aiStyle != 99) + if ((projectile.penetrate > 1 || projectile.penetrate == -1) && !PierceResistExceptionList.IsException(projectile) && !projectile.CountsAsClass() && projectile.aiStyle != 15 && projectile.aiStyle != 39 && projectile.aiStyle != 99) projectile.Calamity().timesPierced++; } diff --git a/Systems/Collections/PierceResistExceptionList.cs b/Systems/Collections/PierceResistExceptionList.cs new file mode 100644 index 0000000000..d018527a89 --- /dev/null +++ b/Systems/Collections/PierceResistExceptionList.cs @@ -0,0 +1,102 @@ +using System.Collections.Generic; +using CalamityMod.Projectiles.DraedonsArsenal; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee.MaceFlails; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class PierceResistExceptionList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + ProjectileID.Arkhalis, + ProjectileID.ChargedBlasterLaser, + ProjectileID.ClingerStaff, + ProjectileID.FinalFractal, + ProjectileID.FlyingKnife, + ProjectileID.LastPrismLaser, + ProjectileID.MechanicalPiranha, + ProjectileID.MonkStaffT3, + ProjectileID.PiercingStarlight, + ProjectileID.Terragrim, + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ProjectileType(), + ]; + } + + public override void Unload() => List = null; + + public static bool IsException(Projectile projectile) => List.Contains(projectile.type); + } +} From c76047e7debd640f8b95dfb10dddc1d1e841ec03 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 19:03:29 +0900 Subject: [PATCH 083/118] AstrumDeusIDList. --- Balancing/BalancingChangesManager.cs | 31 ++++++++++---------- CalamityLists.cs | 10 ------- NPCs/CalamityGlobalNPC.cs | 9 +++--- Systems/Collections/NPCs/AstrumDeusIDList.cs | 28 ++++++++++++++++++ 4 files changed, 48 insertions(+), 30 deletions(-) create mode 100644 Systems/Collections/NPCs/AstrumDeusIDList.cs diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index 9e00d3d032..bfc387be47 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -1,9 +1,9 @@ -using CalamityMod.Items.Weapons.Ranged; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Items.Weapons.Ranged; using CalamityMod.NPCs.AstrumAureus; using CalamityMod.NPCs.CeaselessVoid; using CalamityMod.NPCs.Crabulon; -using CalamityMod.NPCs.ExoMechs.Apollo; -using CalamityMod.NPCs.ExoMechs.Artemis; using CalamityMod.NPCs.OldDuke; using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.NPCs.Providence; @@ -17,8 +17,7 @@ using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Summon.MirrorofKalandraMinions; using CalamityMod.Projectiles.Typeless; -using System.Collections.Generic; -using System.Linq; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -249,37 +248,37 @@ namespace CalamityMod.Balancing #region Astrum Deus // 75% resist to Plaguenades. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.25f, ProjectileType(), ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(new ProjectileResistBalancingRule(0.25f, ProjectileType(), ProjectileType())))); // 70% resist to Charged Blaster Cannon. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.3f, ProjectileID.ChargedBlasterLaser)))); + NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(new ProjectileResistBalancingRule(0.3f, ProjectileID.ChargedBlasterLaser)))); // 70% resist to Stardust Dragon Staff. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.3f, ProjectileID.StardustDragon1, ProjectileID.StardustDragon2, ProjectileID.StardustDragon3, ProjectileID.StardustDragon4)))); + NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(new ProjectileResistBalancingRule(0.3f, ProjectileID.StardustDragon1, ProjectileID.StardustDragon2, ProjectileID.StardustDragon3, ProjectileID.StardustDragon4)))); // 65% resist to Atlantis (Atlantis gaming!). - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType())))); // 55% resist to Flak Kraken. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.45f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(new ProjectileResistBalancingRule(0.45f, ProjectileType())))); // 50% resist to true melee. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(ResistTrueMelee(0.5f)))); + NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(ResistTrueMelee(0.5f)))); // 50% resist to Aurora Blazer. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 35% resist to Aerial Bane. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.65f, ProjectileID.DD2BetsyArrow)))); + NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(new ProjectileResistBalancingRule(0.65f, ProjectileID.DD2BetsyArrow)))); // 35% resist to Ballistic Poison Bomb's clouds. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); // 35% resist to Icicle Arrows. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); // 20% resist to Cluster Rocket fragments. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AstrumDeusIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileID.ClusterFragmentsI, ProjectileID.ClusterFragmentsII)))); + NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(new ProjectileResistBalancingRule(0.8f, ProjectileID.ClusterFragmentsI, ProjectileID.ClusterFragmentsII)))); #endregion #region Moon Lord diff --git a/CalamityLists.cs b/CalamityLists.cs index 88c8be1029..dc2719ff4b 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -44,7 +44,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List AstrumDeusIDs; public static List DevourerOfGodsIDs; public static List CosmicGuardianIDs; public static List AquaticScourgeIDs; @@ -90,14 +89,6 @@ namespace CalamityMod { // Lists of enemies that resist piercing to some extent (mostly worms). // Could prove useful for other things as well. - - AstrumDeusIDs = new List - { - NPCType(), - NPCType(), - NPCType() - }; - DevourerOfGodsIDs = new List { NPCType(), @@ -774,7 +765,6 @@ namespace CalamityMod public override void Unload() { - AstrumDeusIDs = null; DevourerOfGodsIDs = null; CosmicGuardianIDs = null; AquaticScourgeIDs = null; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index ac26c300cf..8f86dc65cb 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -805,7 +805,7 @@ namespace CalamityMod.NPCs // Worms that are vulnerable to debuffs and Slime God slimes take reduced damage from vulnerabilities. #region Debuff System Multiplier Calculations bool wormBoss = CalamityLists.DesertScourgeIDs.Contains(npc.type) || CalamityLists.EaterofWorldsIDs.Contains(npc.type) || CalamityLists.PerforatorIDs.Contains(npc.type) || - CalamityLists.AquaticScourgeIDs.Contains(npc.type) || CalamityLists.AstrumDeusIDs.Contains(npc.type) || CalamityLists.StormWeaverIDs.Contains(npc.type); + CalamityLists.AquaticScourgeIDs.Contains(npc.type) || AstrumDeusIDList.Includes(npc) || CalamityLists.StormWeaverIDs.Contains(npc.type); bool slimeGod = CalamityLists.SlimeGodIDs.Contains(npc.type); bool slimed = npc.drippingSlime || npc.drippingSparkleSlime; @@ -3606,7 +3606,7 @@ namespace CalamityMod.NPCs 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 (CalamityLists.DestroyerIDs.Contains(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 (CalamityLists.AstrumDeusIDs.Contains(npc.type)) + if (AstrumDeusIDList.Includes(npc)) { float drTime = newAI[0] != 0f ? 300f : 600f; if (newAI[1] < drTime) @@ -6065,8 +6065,9 @@ namespace CalamityMod.NPCs // True melee resists if (CalamityLists.DesertScourgeIDs.Contains(npc.type) || CalamityLists.EaterofWorldsIDs.Contains(npc.type) || npc.type == NPCID.Creeper || CalamityLists.PerforatorIDs.Contains(npc.type) || CalamityLists.AquaticScourgeIDs.Contains(npc.type) || CalamityLists.DestroyerIDs.Contains(npc.type) || - CalamityLists.AstrumDeusIDs.Contains(npc.type) || CalamityLists.StormWeaverIDs.Contains(npc.type) || CalamityLists.ThanatosIDs.Contains(npc.type) || - npc.type == NPCType() || npc.type == NPCType() || npc.type == NPCType() || npc.type == NPCType()) + AstrumDeusIDList.Includes(npc) || CalamityLists.StormWeaverIDs.Contains(npc.type) || CalamityLists.ThanatosIDs.Contains(npc.type) || + npc.type == NPCType() || npc.type == NPCType() || CalamityLists.AresIDs.Contains(npc.type) || npc.type == NPCType() || + npc.type == NPCType()) { float damageMult = CalamityLists.ThanatosIDs.Contains(npc.type) ? 0.35f : (CalamityLists.DesertScourgeIDs.Contains(npc.type) || npc.type == NPCType()) ? 0.75f : 0.5f; if (item.CountsAsClass() && item.type != ItemType()) diff --git a/Systems/Collections/NPCs/AstrumDeusIDList.cs b/Systems/Collections/NPCs/AstrumDeusIDList.cs new file mode 100644 index 0000000000..3394ccc051 --- /dev/null +++ b/Systems/Collections/NPCs/AstrumDeusIDList.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.AstrumDeus; +using Terraria; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class AstrumDeusIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCType(), + NPCType(), + NPCType() + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(NPC npc) => List.Contains(npc.type); + public static bool Includes(int npcType) => List.Contains(npcType); + } +} From 234dabc14f73c2637a2dd7788c1815a33c008113 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 19:04:52 +0900 Subject: [PATCH 084/118] Organizing Boss Specific IDs to Subfolder --- Systems/Collections/{NPCs => BossIDs}/AstrumDeusIDList.cs | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Systems/Collections/{NPCs => BossIDs}/AstrumDeusIDList.cs (100%) diff --git a/Systems/Collections/NPCs/AstrumDeusIDList.cs b/Systems/Collections/BossIDs/AstrumDeusIDList.cs similarity index 100% rename from Systems/Collections/NPCs/AstrumDeusIDList.cs rename to Systems/Collections/BossIDs/AstrumDeusIDList.cs From b3d91bbb4cad9b3848c76ddd60db361b5f1d2760 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 19:07:19 +0900 Subject: [PATCH 085/118] DevourerOfGodsIDList --- Balancing/BalancingChangesManager.cs | 10 +++---- CalamityLists.cs | 8 ------ .../BossIDs/DevourerOfGodsIDList.cs | 28 +++++++++++++++++++ 3 files changed, 33 insertions(+), 13 deletions(-) create mode 100644 Systems/Collections/BossIDs/DevourerOfGodsIDList.cs diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index bfc387be47..9295b529ba 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -346,22 +346,22 @@ namespace CalamityMod.Balancing #region The Devourer of Gods // 65% resist to Wave Pounder. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(DevourerOfGodsIDList.List, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType())))); // 35% resist to Venusian Trident. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(DevourerOfGodsIDList.List, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); // 35% resist to Sulphuric Acid Cannon's Explosions. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); // 25% resist to Corinth Prime's Grenades. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(DevourerOfGodsIDList.List, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); // 20% resist to Valediction's typhoons; will catch Nuclear Fury as well but that doesn't matter. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(DevourerOfGodsIDList.List, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); // 15% vulnerability to Time Bolt stealth strikes. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DevourerOfGodsIDs, Do(new StealthStrikeBalancingRule(1.15f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(DevourerOfGodsIDList.List, Do(new StealthStrikeBalancingRule(1.15f, ProjectileType())))); #endregion The Devourer of Gods #region Yharon diff --git a/CalamityLists.cs b/CalamityLists.cs index dc2719ff4b..d83dcc7709 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -44,7 +44,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List DevourerOfGodsIDs; public static List CosmicGuardianIDs; public static List AquaticScourgeIDs; public static List PerforatorIDs; @@ -89,12 +88,6 @@ namespace CalamityMod { // Lists of enemies that resist piercing to some extent (mostly worms). // Could prove useful for other things as well. - DevourerOfGodsIDs = new List - { - NPCType(), - NPCType(), - NPCType() - }; CosmicGuardianIDs = new List { @@ -765,7 +758,6 @@ namespace CalamityMod public override void Unload() { - DevourerOfGodsIDs = null; CosmicGuardianIDs = null; AquaticScourgeIDs = null; PerforatorIDs = null; diff --git a/Systems/Collections/BossIDs/DevourerOfGodsIDList.cs b/Systems/Collections/BossIDs/DevourerOfGodsIDList.cs new file mode 100644 index 0000000000..38382aaa06 --- /dev/null +++ b/Systems/Collections/BossIDs/DevourerOfGodsIDList.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.DevourerofGods; +using Terraria; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class DevourerOfGodsIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCType(), + NPCType(), + NPCType() + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(NPC npc) => List.Contains(npc.type); + public static bool Includes(int npcType) => List.Contains(npcType); + } +} From 0114d2f7915394adb06220e222d5977d02f5d6ec Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 19:10:54 +0900 Subject: [PATCH 086/118] CosmicGuardianIDList. --- CalamityLists.cs | 10 ------- .../{BossIDs => NPCIDs}/AstrumDeusIDList.cs | 0 .../NPCIDs/CosmicGuardianIDList.cs | 28 +++++++++++++++++++ .../DevourerOfGodsIDList.cs | 0 4 files changed, 28 insertions(+), 10 deletions(-) rename Systems/Collections/{BossIDs => NPCIDs}/AstrumDeusIDList.cs (100%) create mode 100644 Systems/Collections/NPCIDs/CosmicGuardianIDList.cs rename Systems/Collections/{BossIDs => NPCIDs}/DevourerOfGodsIDList.cs (100%) diff --git a/CalamityLists.cs b/CalamityLists.cs index d83dcc7709..5f385dd9db 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -44,7 +44,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List CosmicGuardianIDs; public static List AquaticScourgeIDs; public static List PerforatorIDs; public static List DesertScourgeIDs; @@ -88,14 +87,6 @@ namespace CalamityMod { // Lists of enemies that resist piercing to some extent (mostly worms). // Could prove useful for other things as well. - - CosmicGuardianIDs = new List - { - NPCType(), - NPCType(), - NPCType() - }; - AquaticScourgeIDs = new List { NPCType(), @@ -758,7 +749,6 @@ namespace CalamityMod public override void Unload() { - CosmicGuardianIDs = null; AquaticScourgeIDs = null; PerforatorIDs = null; DesertScourgeIDs = null; diff --git a/Systems/Collections/BossIDs/AstrumDeusIDList.cs b/Systems/Collections/NPCIDs/AstrumDeusIDList.cs similarity index 100% rename from Systems/Collections/BossIDs/AstrumDeusIDList.cs rename to Systems/Collections/NPCIDs/AstrumDeusIDList.cs diff --git a/Systems/Collections/NPCIDs/CosmicGuardianIDList.cs b/Systems/Collections/NPCIDs/CosmicGuardianIDList.cs new file mode 100644 index 0000000000..9dc00012c5 --- /dev/null +++ b/Systems/Collections/NPCIDs/CosmicGuardianIDList.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.DevourerofGods; +using Terraria; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class CosmicGuardianIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCType(), + NPCType(), + NPCType() + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(NPC npc) => List.Contains(npc.type); + public static bool Includes(int npcType) => List.Contains(npcType); + } +} diff --git a/Systems/Collections/BossIDs/DevourerOfGodsIDList.cs b/Systems/Collections/NPCIDs/DevourerOfGodsIDList.cs similarity index 100% rename from Systems/Collections/BossIDs/DevourerOfGodsIDList.cs rename to Systems/Collections/NPCIDs/DevourerOfGodsIDList.cs From a22c3844655f5a5596b408f74899b229e59e1c1f Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 19:14:00 +0900 Subject: [PATCH 087/118] AquaticScourgeIDList. --- Balancing/BalancingChangesManager.cs | 16 +++++----- CalamityLists.cs | 10 ------- NPCs/CalamityGlobalNPC.cs | 6 ++-- .../NPCIDs/AquaticScourgeIDList.cs | 29 +++++++++++++++++++ 4 files changed, 40 insertions(+), 21 deletions(-) create mode 100644 Systems/Collections/NPCIDs/AquaticScourgeIDList.cs diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index 9295b529ba..ae7b643f5e 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -133,29 +133,29 @@ namespace CalamityMod.Balancing #region Aquatic Scourge // 50% resist to true melee. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AquaticScourgeIDs, Do(ResistTrueMelee(0.5f)))); + NPCSpecificBalancingChanges.AddRange(Bundle(AquaticScourgeIDList.List, Do(ResistTrueMelee(0.5f)))); // 50% resist to Adamantite Throwing Axe's lightning. // Twisting Thunder and Gael's Greatsword use this projectile too, but they are far beyond progression, so who cares! - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AquaticScourgeIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.CultistBossLightningOrbArc)))); + NPCSpecificBalancingChanges.AddRange(Bundle(AquaticScourgeIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.CultistBossLightningOrbArc)))); // 50% resist to Dormant Brimseeker. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AquaticScourgeIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(AquaticScourgeIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 50% resist to Mounted Scanner. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AquaticScourgeIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(AquaticScourgeIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 40% resist to Cryophobia. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AquaticScourgeIDs, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(AquaticScourgeIDList.List, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); // 40% resist to SHPC. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AquaticScourgeIDs, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(AquaticScourgeIDList.List, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); // 30% resist to Meowthrower. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AquaticScourgeIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(AquaticScourgeIDList.List, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); // 25% resist to Snowstorm Staff. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AquaticScourgeIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType(), ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(AquaticScourgeIDList.List, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType(), ProjectileType())))); #endregion #region The Destroyer diff --git a/CalamityLists.cs b/CalamityLists.cs index 5f385dd9db..6c552928e2 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -44,7 +44,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List AquaticScourgeIDs; public static List PerforatorIDs; public static List DesertScourgeIDs; public static List EaterofWorldsIDs; @@ -87,14 +86,6 @@ namespace CalamityMod { // Lists of enemies that resist piercing to some extent (mostly worms). // Could prove useful for other things as well. - AquaticScourgeIDs = new List - { - NPCType(), - NPCType(), - NPCType(), - NPCType() - }; - PerforatorIDs = new List { NPCType(), @@ -749,7 +740,6 @@ namespace CalamityMod public override void Unload() { - AquaticScourgeIDs = null; PerforatorIDs = null; DesertScourgeIDs = null; EaterofWorldsIDs = null; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 8f86dc65cb..d2006d887c 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -805,7 +805,7 @@ namespace CalamityMod.NPCs // Worms that are vulnerable to debuffs and Slime God slimes take reduced damage from vulnerabilities. #region Debuff System Multiplier Calculations bool wormBoss = CalamityLists.DesertScourgeIDs.Contains(npc.type) || CalamityLists.EaterofWorldsIDs.Contains(npc.type) || CalamityLists.PerforatorIDs.Contains(npc.type) || - CalamityLists.AquaticScourgeIDs.Contains(npc.type) || AstrumDeusIDList.Includes(npc) || CalamityLists.StormWeaverIDs.Contains(npc.type); + AquaticScourgeIDList.Includes(npc) || AstrumDeusIDList.Includes(npc) || CalamityLists.StormWeaverIDs.Contains(npc.type); bool slimeGod = CalamityLists.SlimeGodIDs.Contains(npc.type); bool slimed = npc.drippingSlime || npc.drippingSparkleSlime; @@ -1514,7 +1514,7 @@ namespace CalamityMod.NPCs } // Aquatic Scourge sets kill time in AI, not here. - if (BossKillTimes.TryGetValue(npc.type, out int revKillTime) && !CalamityLists.AquaticScourgeIDs.Contains(npc.type)) + if (BossKillTimes.TryGetValue(npc.type, out int revKillTime) && !AquaticScourgeIDList.Includes(npc)) { KillTime = revKillTime; } @@ -6064,7 +6064,7 @@ namespace CalamityMod.NPCs // True melee resists if (CalamityLists.DesertScourgeIDs.Contains(npc.type) || CalamityLists.EaterofWorldsIDs.Contains(npc.type) || npc.type == NPCID.Creeper || - CalamityLists.PerforatorIDs.Contains(npc.type) || CalamityLists.AquaticScourgeIDs.Contains(npc.type) || CalamityLists.DestroyerIDs.Contains(npc.type) || + CalamityLists.PerforatorIDs.Contains(npc.type) || AquaticScourgeIDList.Includes(npc) || CalamityLists.DestroyerIDs.Contains(npc.type) || AstrumDeusIDList.Includes(npc) || CalamityLists.StormWeaverIDs.Contains(npc.type) || CalamityLists.ThanatosIDs.Contains(npc.type) || npc.type == NPCType() || npc.type == NPCType() || CalamityLists.AresIDs.Contains(npc.type) || npc.type == NPCType() || npc.type == NPCType()) diff --git a/Systems/Collections/NPCIDs/AquaticScourgeIDList.cs b/Systems/Collections/NPCIDs/AquaticScourgeIDList.cs new file mode 100644 index 0000000000..b52a95d4d1 --- /dev/null +++ b/Systems/Collections/NPCIDs/AquaticScourgeIDList.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.AquaticScourge; +using Terraria; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class AquaticScourgeIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCType(), + NPCType(), + NPCType(), + NPCType() + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(NPC npc) => List.Contains(npc.type); + public static bool Includes(int npcType) => List.Contains(npcType); + } +} From be0ab6f9154fdf6667614d894da56eaa92405f12 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 19:18:35 +0900 Subject: [PATCH 088/118] PerforatorWormIDList. --- Balancing/BalancingChangesManager.cs | 2 +- CalamityLists.cs | 12 ------- NPCs/CalamityGlobalNPC.cs | 6 ++-- .../NPCIDs/PerforatorWormIDList.cs | 34 +++++++++++++++++++ 4 files changed, 38 insertions(+), 16 deletions(-) create mode 100644 Systems/Collections/NPCIDs/PerforatorWormIDList.cs diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index ae7b643f5e..268cc8b7f4 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -123,7 +123,7 @@ namespace CalamityMod.Balancing #region The Perforators // 50% resist to true melee. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.PerforatorIDs, Do(ResistTrueMelee(0.5f)))); + NPCSpecificBalancingChanges.AddRange(Bundle(PerforatorWormIDList.List, Do(ResistTrueMelee(0.5f)))); #endregion #region Wall of Flesh diff --git a/CalamityLists.cs b/CalamityLists.cs index 6c552928e2..0a46067a98 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -86,18 +86,6 @@ namespace CalamityMod { // Lists of enemies that resist piercing to some extent (mostly worms). // Could prove useful for other things as well. - PerforatorIDs = new List - { - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType() - }; DesertScourgeIDs = new List { diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index d2006d887c..4f30abfe63 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -804,7 +804,7 @@ namespace CalamityMod.NPCs // Damage multiplier calcs. // Worms that are vulnerable to debuffs and Slime God slimes take reduced damage from vulnerabilities. #region Debuff System Multiplier Calculations - bool wormBoss = CalamityLists.DesertScourgeIDs.Contains(npc.type) || CalamityLists.EaterofWorldsIDs.Contains(npc.type) || CalamityLists.PerforatorIDs.Contains(npc.type) || + bool wormBoss = CalamityLists.DesertScourgeIDs.Contains(npc.type) || CalamityLists.EaterofWorldsIDs.Contains(npc.type) || PerforatorWormIDList.Includes(npc) || AquaticScourgeIDList.Includes(npc) || AstrumDeusIDList.Includes(npc) || CalamityLists.StormWeaverIDs.Contains(npc.type); bool slimeGod = CalamityLists.SlimeGodIDs.Contains(npc.type); @@ -6064,7 +6064,7 @@ namespace CalamityMod.NPCs // True melee resists if (CalamityLists.DesertScourgeIDs.Contains(npc.type) || CalamityLists.EaterofWorldsIDs.Contains(npc.type) || npc.type == NPCID.Creeper || - CalamityLists.PerforatorIDs.Contains(npc.type) || AquaticScourgeIDList.Includes(npc) || CalamityLists.DestroyerIDs.Contains(npc.type) || + PerforatorWormIDList.Includes(npc) || AquaticScourgeIDList.Includes(npc) || CalamityLists.DestroyerIDs.Contains(npc.type) || AstrumDeusIDList.Includes(npc) || CalamityLists.StormWeaverIDs.Contains(npc.type) || CalamityLists.ThanatosIDs.Contains(npc.type) || npc.type == NPCType() || npc.type == NPCType() || CalamityLists.AresIDs.Contains(npc.type) || npc.type == NPCType() || npc.type == NPCType()) @@ -6235,7 +6235,7 @@ namespace CalamityMod.NPCs // Note that Calamity reduces the vanilla resist from 80% to 60% bool hasResist = CalamityLists.EaterofWorldsIDs.Contains(npc.type) && !Main.expertMode; // Add a resist for BoC's creepers and Prehardmode worm bosses - if (npc.type == NPCID.Creeper || CalamityLists.DesertScourgeIDs.Contains(npc.type) || CalamityLists.PerforatorIDs.Contains(npc.type)) + if (npc.type == NPCID.Creeper || CalamityLists.DesertScourgeIDs.Contains(npc.type) || PerforatorWormIDList.Includes(npc)) hasResist = true; if (hasResist) modifiers.SourceDamage *= 0.4f; diff --git a/Systems/Collections/NPCIDs/PerforatorWormIDList.cs b/Systems/Collections/NPCIDs/PerforatorWormIDList.cs new file mode 100644 index 0000000000..8ccfb3db4a --- /dev/null +++ b/Systems/Collections/NPCIDs/PerforatorWormIDList.cs @@ -0,0 +1,34 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.Perforator; +using Terraria; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class PerforatorWormIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(NPC npc) => List.Contains(npc.type); + public static bool Includes(int npcType) => List.Contains(npcType); + } +} From a96ab160fa830e705f8b641410580b7fd0bdf2ff Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 19:22:05 +0900 Subject: [PATCH 089/118] DesertScourgeIDList. --- Balancing/BalancingChangesManager.cs | 2 +- CalamityLists.cs | 11 -------- NPCs/CalamityGlobalNPC.cs | 6 ++-- .../Collections/NPCIDs/DesertScourgeIDList.cs | 28 +++++++++++++++++++ 4 files changed, 32 insertions(+), 15 deletions(-) create mode 100644 Systems/Collections/NPCIDs/DesertScourgeIDList.cs diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index 268cc8b7f4..819cabe3ec 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -94,7 +94,7 @@ namespace CalamityMod.Balancing #region Desert Scourge // 25% resist to true melee. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DesertScourgeIDs, Do(ResistTrueMelee(0.75f)))); + NPCSpecificBalancingChanges.AddRange(Bundle(DesertScourgeIDList.List, Do(ResistTrueMelee(0.75f)))); #endregion #region Crabulon diff --git a/CalamityLists.cs b/CalamityLists.cs index 0a46067a98..d3843d30c3 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -44,8 +44,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List PerforatorIDs; - public static List DesertScourgeIDs; public static List EaterofWorldsIDs; public static List SlimeGodIDs; public static List DeathModeSplittingWormIDs; @@ -87,13 +85,6 @@ namespace CalamityMod // Lists of enemies that resist piercing to some extent (mostly worms). // Could prove useful for other things as well. - DesertScourgeIDs = new List - { - NPCType(), - NPCType(), - NPCType() - }; - EaterofWorldsIDs = new List { NPCID.EaterofWorldsHead, @@ -728,8 +719,6 @@ namespace CalamityMod public override void Unload() { - PerforatorIDs = null; - DesertScourgeIDs = null; EaterofWorldsIDs = null; SlimeGodIDs = null; DeathModeSplittingWormIDs = null; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 4f30abfe63..48764ace41 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -804,7 +804,7 @@ namespace CalamityMod.NPCs // Damage multiplier calcs. // Worms that are vulnerable to debuffs and Slime God slimes take reduced damage from vulnerabilities. #region Debuff System Multiplier Calculations - bool wormBoss = CalamityLists.DesertScourgeIDs.Contains(npc.type) || CalamityLists.EaterofWorldsIDs.Contains(npc.type) || PerforatorWormIDList.Includes(npc) || + bool wormBoss = DesertScourgeIDList.Includes(npc) || CalamityLists.EaterofWorldsIDs.Contains(npc.type) || PerforatorWormIDList.Includes(npc) || AquaticScourgeIDList.Includes(npc) || AstrumDeusIDList.Includes(npc) || CalamityLists.StormWeaverIDs.Contains(npc.type); bool slimeGod = CalamityLists.SlimeGodIDs.Contains(npc.type); @@ -6063,7 +6063,7 @@ namespace CalamityMod.NPCs modifiers.SourceDamage *= 0.1f; // True melee resists - if (CalamityLists.DesertScourgeIDs.Contains(npc.type) || CalamityLists.EaterofWorldsIDs.Contains(npc.type) || npc.type == NPCID.Creeper || + if (DesertScourgeIDList.Includes(npc) || CalamityLists.EaterofWorldsIDs.Contains(npc.type) || npc.type == NPCID.Creeper || PerforatorWormIDList.Includes(npc) || AquaticScourgeIDList.Includes(npc) || CalamityLists.DestroyerIDs.Contains(npc.type) || AstrumDeusIDList.Includes(npc) || CalamityLists.StormWeaverIDs.Contains(npc.type) || CalamityLists.ThanatosIDs.Contains(npc.type) || npc.type == NPCType() || npc.type == NPCType() || CalamityLists.AresIDs.Contains(npc.type) || npc.type == NPCType() || @@ -6235,7 +6235,7 @@ namespace CalamityMod.NPCs // Note that Calamity reduces the vanilla resist from 80% to 60% bool hasResist = CalamityLists.EaterofWorldsIDs.Contains(npc.type) && !Main.expertMode; // Add a resist for BoC's creepers and Prehardmode worm bosses - if (npc.type == NPCID.Creeper || CalamityLists.DesertScourgeIDs.Contains(npc.type) || PerforatorWormIDList.Includes(npc)) + if (npc.type == NPCID.Creeper || DesertScourgeIDList.Includes(npc) || PerforatorWormIDList.Includes(npc)) hasResist = true; if (hasResist) modifiers.SourceDamage *= 0.4f; diff --git a/Systems/Collections/NPCIDs/DesertScourgeIDList.cs b/Systems/Collections/NPCIDs/DesertScourgeIDList.cs new file mode 100644 index 0000000000..c76e65a551 --- /dev/null +++ b/Systems/Collections/NPCIDs/DesertScourgeIDList.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.DesertScourge; +using Terraria; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class DesertScourgeIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCType(), + NPCType(), + NPCType() + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(NPC npc) => List.Contains(npc.type); + public static bool Includes(int npcType) => List.Contains(npcType); + } +} From 3a3fbdd04934ab4a0a472ce0accd942d586de913 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 19:25:41 +0900 Subject: [PATCH 090/118] EaterOfWorldsIDList --- Balancing/BalancingChangesManager.cs | 6 ++--- CalamityLists.cs | 8 ------ NPCs/CalamityGlobalNPC.cs | 12 ++++----- NPCs/CalamityGlobalNPCLoot.cs | 2 +- .../Collections/NPCIDs/EaterOfWorldsIDList.cs | 27 +++++++++++++++++++ 5 files changed, 37 insertions(+), 18 deletions(-) create mode 100644 Systems/Collections/NPCIDs/EaterOfWorldsIDList.cs diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index 819cabe3ec..6a08edf155 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -112,13 +112,13 @@ namespace CalamityMod.Balancing #region Eater of Worlds // 50% resist to true melee. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.EaterofWorldsIDs, Do(ResistTrueMelee(0.5f)))); + NPCSpecificBalancingChanges.AddRange(Bundle(EaterOfWorldsIDList.List, Do(ResistTrueMelee(0.5f)))); // 50% resist to Demon Scythe. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.EaterofWorldsIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.DemonScythe)))); + NPCSpecificBalancingChanges.AddRange(Bundle(EaterOfWorldsIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.DemonScythe)))); // 40% resist to Sky Glaze. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.EaterofWorldsIDs, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(EaterOfWorldsIDList.List, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); #endregion #region The Perforators diff --git a/CalamityLists.cs b/CalamityLists.cs index d3843d30c3..617b0294e4 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -85,13 +85,6 @@ namespace CalamityMod // Lists of enemies that resist piercing to some extent (mostly worms). // Could prove useful for other things as well. - EaterofWorldsIDs = new List - { - NPCID.EaterofWorldsHead, - NPCID.EaterofWorldsBody, - NPCID.EaterofWorldsTail - }; - SlimeGodIDs = new List { NPCType(), @@ -719,7 +712,6 @@ namespace CalamityMod public override void Unload() { - EaterofWorldsIDs = null; SlimeGodIDs = null; DeathModeSplittingWormIDs = null; DestroyerIDs = null; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 48764ace41..9a3196f5ac 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -804,7 +804,7 @@ namespace CalamityMod.NPCs // Damage multiplier calcs. // Worms that are vulnerable to debuffs and Slime God slimes take reduced damage from vulnerabilities. #region Debuff System Multiplier Calculations - bool wormBoss = DesertScourgeIDList.Includes(npc) || CalamityLists.EaterofWorldsIDs.Contains(npc.type) || PerforatorWormIDList.Includes(npc) || + bool wormBoss = DesertScourgeIDList.Includes(npc) || EaterOfWorldsIDList.Includes(npc) || PerforatorWormIDList.Includes(npc) || AquaticScourgeIDList.Includes(npc) || AstrumDeusIDList.Includes(npc) || CalamityLists.StormWeaverIDs.Contains(npc.type); bool slimeGod = CalamityLists.SlimeGodIDs.Contains(npc.type); @@ -1824,7 +1824,7 @@ namespace CalamityMod.NPCs { npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.4); } - else if (CalamityLists.EaterofWorldsIDs.Contains(npc.type)) + else if (EaterOfWorldsIDList.Includes(npc)) { npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.2); @@ -3602,7 +3602,7 @@ namespace CalamityMod.NPCs ApplyDR(npc, ref modifiers); // Damage reduction on spawn for certain worm bosses. - if (CalamityLists.EaterofWorldsIDs.Contains(npc.type) && newAI[1] < EaterOfWorldsAI.DRIncreaseTime) + if (EaterOfWorldsIDList.Includes(npc) && 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 (CalamityLists.DestroyerIDs.Contains(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))); @@ -6063,7 +6063,7 @@ namespace CalamityMod.NPCs modifiers.SourceDamage *= 0.1f; // True melee resists - if (DesertScourgeIDList.Includes(npc) || CalamityLists.EaterofWorldsIDs.Contains(npc.type) || npc.type == NPCID.Creeper || + if (DesertScourgeIDList.Includes(npc) || EaterOfWorldsIDList.Includes(npc) || npc.type == NPCID.Creeper || PerforatorWormIDList.Includes(npc) || AquaticScourgeIDList.Includes(npc) || CalamityLists.DestroyerIDs.Contains(npc.type) || AstrumDeusIDList.Includes(npc) || CalamityLists.StormWeaverIDs.Contains(npc.type) || CalamityLists.ThanatosIDs.Contains(npc.type) || npc.type == NPCType() || npc.type == NPCType() || CalamityLists.AresIDs.Contains(npc.type) || npc.type == NPCType() || @@ -6233,7 +6233,7 @@ namespace CalamityMod.NPCs { // Eater of Worlds has a vanilla resist in Expert+, this gives it to him in Normal mode // Note that Calamity reduces the vanilla resist from 80% to 60% - bool hasResist = CalamityLists.EaterofWorldsIDs.Contains(npc.type) && !Main.expertMode; + bool hasResist = EaterOfWorldsIDList.Includes(npc) && !Main.expertMode; // Add a resist for BoC's creepers and Prehardmode worm bosses if (npc.type == NPCID.Creeper || DesertScourgeIDList.Includes(npc) || PerforatorWormIDList.Includes(npc)) hasResist = true; @@ -8688,7 +8688,7 @@ namespace CalamityMod.NPCs #region Should Affect NPC public static bool ShouldAffectNPC(NPC target) { - if (CalamityLists.EaterofWorldsIDs.Contains(target.type) || CalamityLists.DestroyerIDs.Contains(target.type)) + if (EaterOfWorldsIDList.Includes(target) || CalamityLists.DestroyerIDs.Contains(target.type)) return false; if (target.damage > 0 && !target.boss && !target.friendly && !target.dontTakeDamage && target.type != NPCID.Creeper && target.type != NPCType() && diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index c9a59fd8a4..e94c338f3d 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -1784,7 +1784,7 @@ DukeEditFailed: public override bool PreKill(NPC npc) { // Stop Eater of Worlds segments and Brain of Cthulhu Creepers from dropping partial loot in Rev+ - if (CalamityWorld.revenge && (CalamityLists.EaterofWorldsIDs.Contains(npc.type) || npc.type == NPCID.Creeper)) + if (CalamityWorld.revenge && (EaterOfWorldsIDList.Includes(npc) || npc.type == NPCID.Creeper)) DropHelper.BlockDrops(ItemID.DemoniteOre, ItemID.ShadowScale, ItemID.CrimtaneOre, ItemID.TissueSample); // Boss Rush pre-kill effects diff --git a/Systems/Collections/NPCIDs/EaterOfWorldsIDList.cs b/Systems/Collections/NPCIDs/EaterOfWorldsIDList.cs new file mode 100644 index 0000000000..6047c906e9 --- /dev/null +++ b/Systems/Collections/NPCIDs/EaterOfWorldsIDList.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + public sealed class EaterOfWorldsIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.EaterofWorldsHead, + NPCID.EaterofWorldsBody, + NPCID.EaterofWorldsTail + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(NPC npc) => List.Contains(npc.type); + public static bool Includes(int npcType) => List.Contains(npcType); + } +} From 7dcb6429abed7f05c485a465d2f21aba6cdfe162 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 19:28:28 +0900 Subject: [PATCH 091/118] SlimeGodIDList. --- CalamityLists.cs | 12 -------- NPCs/CalamityGlobalNPC.cs | 2 +- Systems/Collections/NPCIDs/SlimeGodIDList.cs | 30 ++++++++++++++++++++ 3 files changed, 31 insertions(+), 13 deletions(-) create mode 100644 Systems/Collections/NPCIDs/SlimeGodIDList.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index 617b0294e4..c1f1daafd9 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -44,8 +44,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List EaterofWorldsIDs; - public static List SlimeGodIDs; public static List DeathModeSplittingWormIDs; public static List DestroyerIDs; public static List ThanatosIDs; @@ -85,15 +83,6 @@ namespace CalamityMod // Lists of enemies that resist piercing to some extent (mostly worms). // Could prove useful for other things as well. - SlimeGodIDs = new List - { - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType() - }; - DeathModeSplittingWormIDs = new List { NPCID.DuneSplicerHead, @@ -712,7 +701,6 @@ namespace CalamityMod public override void Unload() { - SlimeGodIDs = null; DeathModeSplittingWormIDs = null; DestroyerIDs = null; ThanatosIDs = null; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 9a3196f5ac..6b48eaf13d 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -806,7 +806,7 @@ namespace CalamityMod.NPCs #region Debuff System Multiplier Calculations bool wormBoss = DesertScourgeIDList.Includes(npc) || EaterOfWorldsIDList.Includes(npc) || PerforatorWormIDList.Includes(npc) || AquaticScourgeIDList.Includes(npc) || AstrumDeusIDList.Includes(npc) || CalamityLists.StormWeaverIDs.Contains(npc.type); - bool slimeGod = CalamityLists.SlimeGodIDs.Contains(npc.type); + bool slimeGod = SlimeGodIDList.Includes(npc); bool slimed = npc.drippingSlime || npc.drippingSparkleSlime; double heatDamageMult = slimed ? ((wormBoss || slimeGod) ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult) : BaseDoTDamageMult; diff --git a/Systems/Collections/NPCIDs/SlimeGodIDList.cs b/Systems/Collections/NPCIDs/SlimeGodIDList.cs new file mode 100644 index 0000000000..17604f9a52 --- /dev/null +++ b/Systems/Collections/NPCIDs/SlimeGodIDList.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.SlimeGod; +using Terraria; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class SlimeGodIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(NPC npc) => List.Contains(npc.type); + public static bool Includes(int npcType) => List.Contains(npcType); + } +} From a0c35bb765339cf37355e5487fc0003144634d52 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 19:32:00 +0900 Subject: [PATCH 092/118] DestroyerIDList --- Balancing/BalancingChangesManager.cs | 16 +++++------ CalamityLists.cs | 9 ------- NPCs/CalamityGlobalNPC.cs | 16 +++++------ Systems/Collections/NPCIDs/DestroyerIDList.cs | 27 +++++++++++++++++++ 4 files changed, 43 insertions(+), 25 deletions(-) create mode 100644 Systems/Collections/NPCIDs/DestroyerIDList.cs diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index 6a08edf155..46337d5428 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -160,29 +160,29 @@ namespace CalamityMod.Balancing #region The Destroyer // 50% resist to true melee. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(ResistTrueMelee(0.5f)))); + NPCSpecificBalancingChanges.AddRange(Bundle(DestroyerIDList.List, Do(ResistTrueMelee(0.5f)))); // 50% resist to Adamantite Throwing Axe's lightning. // See Aquatic Scourge comment. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.CultistBossLightningOrbArc)))); + NPCSpecificBalancingChanges.AddRange(Bundle(DestroyerIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.CultistBossLightningOrbArc)))); // 50% resist to Aftershock's rocks. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(DestroyerIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 50% resist to Dormant Brimseeker. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(DestroyerIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 45% resist to Mounted Scanner. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.55f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(DestroyerIDList.List, Do(new ProjectileResistBalancingRule(0.55f, ProjectileType())))); // 30% resist to Meowthrower. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(DestroyerIDList.List, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); // 25% resist to Avalanche's Ice Bombs and shards. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType(), ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(DestroyerIDList.List, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType(), ProjectileType())))); // 25% resist to Snowstorm Staff. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.DestroyerIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType(), ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(DestroyerIDList.List, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType(), ProjectileType())))); #endregion #region Astrum Aureus diff --git a/CalamityLists.cs b/CalamityLists.cs index c1f1daafd9..b4a6a1afee 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -45,7 +45,6 @@ namespace CalamityMod public sealed class CalamityLists : ModSystem { public static List DeathModeSplittingWormIDs; - public static List DestroyerIDs; public static List ThanatosIDs; public static List AresIDs; public static List SkeletronPrimeIDs; @@ -96,13 +95,6 @@ namespace CalamityMod NPCID.SeekerTail }; - DestroyerIDs = new List - { - NPCID.TheDestroyer, - NPCID.TheDestroyerBody, - NPCID.TheDestroyerTail - }; - ThanatosIDs = new List { NPCType(), @@ -702,7 +694,6 @@ namespace CalamityMod public override void Unload() { DeathModeSplittingWormIDs = null; - DestroyerIDs = null; ThanatosIDs = null; AresIDs = null; SkeletronPrimeIDs = null; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 6b48eaf13d..afd88d7aa2 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -1743,7 +1743,7 @@ namespace CalamityMod.NPCs npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.2); npc.npcSlots = 32f; } - else if (CalamityLists.DestroyerIDs.Contains(npc.type)) + else if (DestroyerIDList.Includes(npc)) { npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.25); npc.scale *= Main.zenithWorld ? 2f : CalamityWorld.death ? 1.4f : 1.2f; @@ -2785,7 +2785,7 @@ namespace CalamityMod.NPCs { if (!NPC.downedMechBossAny) { - if (CalamityLists.DestroyerIDs.Contains(npc.type) || npc.type == NPCID.Probe || CalamityLists.SkeletronPrimeIDs.Contains(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == NPCType()) + if (DestroyerIDList.Includes(npc) || npc.type == NPCID.Probe || CalamityLists.SkeletronPrimeIDs.Contains(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == NPCType()) { double multiplier = Main.expertMode ? EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; npc.lifeMax = (int)Math.Round(npc.lifeMax * multiplier); @@ -2795,7 +2795,7 @@ namespace CalamityMod.NPCs } else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) { - if (CalamityLists.DestroyerIDs.Contains(npc.type) || npc.type == NPCID.Probe || CalamityLists.SkeletronPrimeIDs.Contains(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == NPCType()) + if (DestroyerIDList.Includes(npc) || npc.type == NPCID.Probe || CalamityLists.SkeletronPrimeIDs.Contains(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == NPCType()) { double multiplier = Main.expertMode ? EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; npc.lifeMax = (int)Math.Round(npc.lifeMax * multiplier); @@ -3604,7 +3604,7 @@ namespace CalamityMod.NPCs // Damage reduction on spawn for certain worm bosses. if (EaterOfWorldsIDList.Includes(npc) && 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 (CalamityLists.DestroyerIDs.Contains(npc.type) && newAI[1] < DestroyerAI.DRIncreaseTime) + if (DestroyerIDList.Includes(npc) && 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)) { @@ -6064,7 +6064,7 @@ namespace CalamityMod.NPCs // True melee resists if (DesertScourgeIDList.Includes(npc) || EaterOfWorldsIDList.Includes(npc) || npc.type == NPCID.Creeper || - PerforatorWormIDList.Includes(npc) || AquaticScourgeIDList.Includes(npc) || CalamityLists.DestroyerIDs.Contains(npc.type) || + PerforatorWormIDList.Includes(npc) || AquaticScourgeIDList.Includes(npc) || DestroyerIDList.Includes(npc) || AstrumDeusIDList.Includes(npc) || CalamityLists.StormWeaverIDs.Contains(npc.type) || CalamityLists.ThanatosIDs.Contains(npc.type) || npc.type == NPCType() || npc.type == NPCType() || CalamityLists.AresIDs.Contains(npc.type) || npc.type == NPCType() || npc.type == NPCType()) @@ -7404,7 +7404,7 @@ namespace CalamityMod.NPCs if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { - if (npc.type == NPCID.SkeletronPrime || npc.type == NPCType() || CalamityLists.DestroyerIDs.Contains(npc.type)) + if (npc.type == NPCID.SkeletronPrime || npc.type == NPCType() || DestroyerIDList.Includes(npc)) return false; } @@ -7671,7 +7671,7 @@ namespace CalamityMod.NPCs } // Destroyer drawing and laser telegraphs - else if (CalamityLists.DestroyerIDs.Contains(npc.type) && !npc.IsABestiaryIconDummy) + else if (DestroyerIDList.Includes(npc) && !npc.IsABestiaryIconDummy) { Texture2D npcTexture = TextureAssets.Npc[npc.type].Value; int frameHeight = npcTexture.Height / Main.npcFrameCount[npc.type]; @@ -8688,7 +8688,7 @@ namespace CalamityMod.NPCs #region Should Affect NPC public static bool ShouldAffectNPC(NPC target) { - if (EaterOfWorldsIDList.Includes(target) || CalamityLists.DestroyerIDs.Contains(target.type)) + if (EaterOfWorldsIDList.Includes(target) || DestroyerIDList.Includes(target)) return false; if (target.damage > 0 && !target.boss && !target.friendly && !target.dontTakeDamage && target.type != NPCID.Creeper && target.type != NPCType() && diff --git a/Systems/Collections/NPCIDs/DestroyerIDList.cs b/Systems/Collections/NPCIDs/DestroyerIDList.cs new file mode 100644 index 0000000000..90b3bb3f48 --- /dev/null +++ b/Systems/Collections/NPCIDs/DestroyerIDList.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + public sealed class DestroyerIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.TheDestroyer, + NPCID.TheDestroyerBody, + NPCID.TheDestroyerTail + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(NPC npc) => List.Contains(npc.type); + public static bool Includes(int npcType) => List.Contains(npcType); + } +} From 77935f8e1031d875512eecb58576dd1d89ac0fc3 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 19:37:22 +0900 Subject: [PATCH 093/118] ThanatosIDList. --- Balancing/BalancingChangesManager.cs | 60 ++++++++++---------- CalamityLists.cs | 10 ---- NPCs/CalamityGlobalNPC.cs | 6 +- Systems/Collections/NPCIDs/ThanatosIDList.cs | 29 ++++++++++ 4 files changed, 62 insertions(+), 43 deletions(-) create mode 100644 Systems/Collections/NPCIDs/ThanatosIDList.cs diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index 46337d5428..2626089040 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -407,97 +407,97 @@ namespace CalamityMod.Balancing #region Exo Mechs: Thanatos // 65% resist to true melee. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(ResistTrueMelee(0.35f)))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(ResistTrueMelee(0.35f)))); // 65% resist to The Enforcer's projectiles. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType())))); // 65% resist to The Final Dawn's lunge. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType())))); // 65% resist to Stellar Torus Staff. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType())))); // 60% resist to Dynamic Pursuer. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.4f, ProjectileType(), ProjectileType(), ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.4f, ProjectileType(), ProjectileType(), ProjectileType())))); // 50% resist to Chicken Cannon. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 50% resist to Omicron's beam. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 50% resist to Rancor. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 50% resist to Vehemence's skulls. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 50% resist to Yharim's Crystal. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 45% resist to Prismatic Breaker's deathray. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.55f, ProjectileType())))); // 45% resist to Wrathwing's stealth strike fireballs. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.55f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.55f, ProjectileType())))); // 30% resist to Eclipse's Fall. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); // 30% resist to Sirius. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); // 30% resist to Ultima's rays. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); // 30% resist to Dragon Scales and The Wand's tornadoes. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType(), ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType(), ProjectileType())))); // 25% resist to the Spin Throw part of the Ark of the Cosmos' combo. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileSpecificRequirementBalancingRule(0.75f, AotCThrowCombo)))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileSpecificRequirementBalancingRule(0.75f, AotCThrowCombo)))); // 25% resist to Dragon Rage projectiles. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileSpecificRequirementBalancingRule(0.75f, DragonRageFilter)))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileSpecificRequirementBalancingRule(0.75f, DragonRageFilter)))); // 25% resist to Gael's Greatsword's big skulls. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileSpecificRequirementBalancingRule(0.75f, BigGaelsSkullFilter)))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileSpecificRequirementBalancingRule(0.75f, BigGaelsSkullFilter)))); // 25% resist to Mirror of Kalandra's Paradoxica minion. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); // 25% resist to Zenith. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileID.FinalFractal)))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.75f, ProjectileID.FinalFractal)))); // 20% resist to The Anomaly's Nanogun's bomb explosions. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); // 20% resist to Ariane's aura (Lilies of Finality). - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); // 20% resist to Eradicator's beams. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); // 20% resist to Plasma Grenade and Dynamic Pursuer's explosions. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType(), ProjectileType(), ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType(), ProjectileType(), ProjectileType())))); // 20% resist to Voltaic Climax / Void Vortex hitscan beams. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); // 15% resist to The Final Dawn's AoE sweep flames. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); // 15% resist to Dragon's Breath Beam. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); // 15% resist to God Slayer Slugs. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); // 15% resist to Gruesome Eminence. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); // 15% resist to Luminite Bullets. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.85f, ProjectileID.MoonlordBullet)))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.85f, ProjectileID.MoonlordBullet)))); #endregion #region Supreme Calamitas: Brimstone Hearts diff --git a/CalamityLists.cs b/CalamityLists.cs index b4a6a1afee..613c09480a 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -45,7 +45,6 @@ namespace CalamityMod public sealed class CalamityLists : ModSystem { public static List DeathModeSplittingWormIDs; - public static List ThanatosIDs; public static List AresIDs; public static List SkeletronPrimeIDs; public static List StormWeaverIDs; @@ -95,14 +94,6 @@ namespace CalamityMod NPCID.SeekerTail }; - ThanatosIDs = new List - { - NPCType(), - NPCType(), - NPCType(), - NPCType() - }; - AresIDs = new List { NPCType(), @@ -694,7 +685,6 @@ namespace CalamityMod public override void Unload() { DeathModeSplittingWormIDs = null; - ThanatosIDs = null; AresIDs = null; SkeletronPrimeIDs = null; StormWeaverIDs = null; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index afd88d7aa2..ba5e8e74fc 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -6065,11 +6065,11 @@ namespace CalamityMod.NPCs // True melee resists if (DesertScourgeIDList.Includes(npc) || EaterOfWorldsIDList.Includes(npc) || npc.type == NPCID.Creeper || PerforatorWormIDList.Includes(npc) || AquaticScourgeIDList.Includes(npc) || DestroyerIDList.Includes(npc) || - AstrumDeusIDList.Includes(npc) || CalamityLists.StormWeaverIDs.Contains(npc.type) || CalamityLists.ThanatosIDs.Contains(npc.type) || + AstrumDeusIDList.Includes(npc) || CalamityLists.StormWeaverIDs.Contains(npc.type) || ThanatosIDList.Includes(npc) || npc.type == NPCType() || npc.type == NPCType() || CalamityLists.AresIDs.Contains(npc.type) || npc.type == NPCType() || npc.type == NPCType()) { - float damageMult = CalamityLists.ThanatosIDs.Contains(npc.type) ? 0.35f : (CalamityLists.DesertScourgeIDs.Contains(npc.type) || npc.type == NPCType()) ? 0.75f : 0.5f; + float damageMult = ThanatosIDList.Includes(npc.type) ? 0.35f : (DesertScourgeIDList.Includes(npc.type) || npc.type == NPCType()) ? 0.75f : 0.5f; if (item.CountsAsClass() && item.type != ItemType()) modifiers.SourceDamage *= damageMult; } @@ -6256,7 +6256,7 @@ namespace CalamityMod.NPCs private void PierceResistGlobal(Projectile projectile, NPC npc, ref NPC.HitModifiers modifiers) { // Thanatos segments do not trigger pierce resistance if they are closed - if (CalamityLists.ThanatosIDs.Contains(npc.type) && unbreakableDR) + if (ThanatosIDList.Includes(npc) && unbreakableDR) return; // Isolates projectiles which ignore pierce resist only on Leviathan and Astrum Aureus diff --git a/Systems/Collections/NPCIDs/ThanatosIDList.cs b/Systems/Collections/NPCIDs/ThanatosIDList.cs new file mode 100644 index 0000000000..2741654250 --- /dev/null +++ b/Systems/Collections/NPCIDs/ThanatosIDList.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.ExoMechs.Thanatos; +using Terraria; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class ThanatosIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCType(), + NPCType(), + NPCType(), + NPCType() + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(NPC npc) => List.Contains(npc.type); + public static bool Includes(int npcType) => List.Contains(npcType); + } +} From 1f8bb9ecc044e9ca63f666394649affe68a2c588 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 19:39:55 +0900 Subject: [PATCH 094/118] AresIDList. --- Balancing/BalancingChangesManager.cs | 18 +++++++------- CalamityLists.cs | 11 --------- NPCs/CalamityGlobalNPC.cs | 2 +- Systems/Collections/NPCIDs/AresIDList.cs | 30 ++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 21 deletions(-) create mode 100644 Systems/Collections/NPCIDs/AresIDList.cs diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index 2626089040..7fd1226e22 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -371,31 +371,31 @@ namespace CalamityMod.Balancing #region Exo Mechs: Ares // 30% resist to Dynamic Pursuer. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType(), ProjectileType(), ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(AresIDList.List, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType(), ProjectileType(), ProjectileType())))); // 25% resist to Aetherflux Cannon. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(AresIDList.List, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); // 25% resist to Prismatic Breaker's deathray. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(AresIDList.List, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); // 20% resist to the Spin Throw part of the Ark of the Cosmos' combo. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileSpecificRequirementBalancingRule(0.8f, AotCThrowCombo)))); + NPCSpecificBalancingChanges.AddRange(Bundle(AresIDList.List, Do(new ProjectileSpecificRequirementBalancingRule(0.8f, AotCThrowCombo)))); // 20% resist to Dragon Rage projectiles. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileSpecificRequirementBalancingRule(0.8f, DragonRageFilter)))); + NPCSpecificBalancingChanges.AddRange(Bundle(AresIDList.List, Do(new ProjectileSpecificRequirementBalancingRule(0.8f, DragonRageFilter)))); // 20% resist to Eclipse's Fall. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType(), ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(AresIDList.List, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType(), ProjectileType())))); // 20% resist to Rancor. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(AresIDList.List, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); // 20% resist to Yharim's Crystal. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(AresIDList.List, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); // 20% resist to Zenith. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileID.FinalFractal)))); + NPCSpecificBalancingChanges.AddRange(Bundle(AresIDList.List, Do(new ProjectileResistBalancingRule(0.8f, ProjectileID.FinalFractal)))); #endregion #region Exo Mechs: Artemis and Apollo diff --git a/CalamityLists.cs b/CalamityLists.cs index 613c09480a..d699a9bb92 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -45,7 +45,6 @@ namespace CalamityMod public sealed class CalamityLists : ModSystem { public static List DeathModeSplittingWormIDs; - public static List AresIDs; public static List SkeletronPrimeIDs; public static List StormWeaverIDs; public static List RavagerIDs; @@ -94,15 +93,6 @@ namespace CalamityMod NPCID.SeekerTail }; - AresIDs = new List - { - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType() - }; - SkeletronPrimeIDs = new List { NPCID.SkeletronPrime, @@ -685,7 +675,6 @@ namespace CalamityMod public override void Unload() { DeathModeSplittingWormIDs = null; - AresIDs = null; SkeletronPrimeIDs = null; StormWeaverIDs = null; RavagerIDs = null; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index ba5e8e74fc..7f23430972 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -6066,7 +6066,7 @@ namespace CalamityMod.NPCs if (DesertScourgeIDList.Includes(npc) || EaterOfWorldsIDList.Includes(npc) || npc.type == NPCID.Creeper || PerforatorWormIDList.Includes(npc) || AquaticScourgeIDList.Includes(npc) || DestroyerIDList.Includes(npc) || AstrumDeusIDList.Includes(npc) || CalamityLists.StormWeaverIDs.Contains(npc.type) || ThanatosIDList.Includes(npc) || - npc.type == NPCType() || npc.type == NPCType() || CalamityLists.AresIDs.Contains(npc.type) || npc.type == NPCType() || + npc.type == NPCType() || npc.type == NPCType() || AresIDList.Includes(npc) || npc.type == NPCType() || npc.type == NPCType()) { float damageMult = ThanatosIDList.Includes(npc.type) ? 0.35f : (DesertScourgeIDList.Includes(npc.type) || npc.type == NPCType()) ? 0.75f : 0.5f; diff --git a/Systems/Collections/NPCIDs/AresIDList.cs b/Systems/Collections/NPCIDs/AresIDList.cs new file mode 100644 index 0000000000..bd347e99d5 --- /dev/null +++ b/Systems/Collections/NPCIDs/AresIDList.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.ExoMechs.Ares; +using Terraria; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class AresIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(NPC npc) => List.Contains(npc.type); + public static bool Includes(int npcType) => List.Contains(npcType); + } +} From 42a1ecc6d47c40c11c64192b597780e354d1dcc7 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 19:43:06 +0900 Subject: [PATCH 095/118] SkeletronPrimeIDList. --- CalamityLists.cs | 12 ------- NPCs/CalamityGlobalNPC.cs | 4 +-- .../NPCIDs/SkeletronPrimeIDList.cs | 32 +++++++++++++++++++ 3 files changed, 34 insertions(+), 14 deletions(-) create mode 100644 Systems/Collections/NPCIDs/SkeletronPrimeIDList.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index d699a9bb92..5695723ecc 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -45,7 +45,6 @@ namespace CalamityMod public sealed class CalamityLists : ModSystem { public static List DeathModeSplittingWormIDs; - public static List SkeletronPrimeIDs; public static List StormWeaverIDs; public static List RavagerIDs; public static List GolemIDs; @@ -93,16 +92,6 @@ namespace CalamityMod NPCID.SeekerTail }; - SkeletronPrimeIDs = new List - { - NPCID.SkeletronPrime, - NPCType(), - NPCID.PrimeCannon, - NPCID.PrimeLaser, - NPCID.PrimeSaw, - NPCID.PrimeVice - }; - StormWeaverIDs = new List { NPCType(), @@ -675,7 +664,6 @@ namespace CalamityMod public override void Unload() { DeathModeSplittingWormIDs = null; - SkeletronPrimeIDs = null; StormWeaverIDs = null; RavagerIDs = null; GolemIDs = null; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 7f23430972..32d020d4a6 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -2785,7 +2785,7 @@ namespace CalamityMod.NPCs { if (!NPC.downedMechBossAny) { - if (DestroyerIDList.Includes(npc) || npc.type == NPCID.Probe || CalamityLists.SkeletronPrimeIDs.Contains(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == NPCType()) + if (DestroyerIDList.Includes(npc) || npc.type == NPCID.Probe || SkeletronPrimeIDList.Includes(npc) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == NPCType()) { double multiplier = Main.expertMode ? EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; npc.lifeMax = (int)Math.Round(npc.lifeMax * multiplier); @@ -2795,7 +2795,7 @@ namespace CalamityMod.NPCs } else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) { - if (DestroyerIDList.Includes(npc) || npc.type == NPCID.Probe || CalamityLists.SkeletronPrimeIDs.Contains(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == NPCType()) + if (DestroyerIDList.Includes(npc) || npc.type == NPCID.Probe || SkeletronPrimeIDList.Includes(npc) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == NPCType()) { double multiplier = Main.expertMode ? EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; npc.lifeMax = (int)Math.Round(npc.lifeMax * multiplier); diff --git a/Systems/Collections/NPCIDs/SkeletronPrimeIDList.cs b/Systems/Collections/NPCIDs/SkeletronPrimeIDList.cs new file mode 100644 index 0000000000..a8df27a800 --- /dev/null +++ b/Systems/Collections/NPCIDs/SkeletronPrimeIDList.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.NormalNPCs; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class SkeletronPrimeIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.SkeletronPrime, + NPCType(), + NPCID.PrimeCannon, + NPCID.PrimeLaser, + NPCID.PrimeSaw, + NPCID.PrimeVice + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(NPC npc) => List.Contains(npc.type); + public static bool Includes(int npcType) => List.Contains(npcType); + } +} From 2bcd8c86709c70e46c55d133680044b5dec36b93 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 19:45:44 +0900 Subject: [PATCH 096/118] StormWeaverIDList --- Balancing/BalancingChangesManager.cs | 16 +++++------ CalamityLists.cs | 9 ------ NPCs/CalamityGlobalNPC.cs | 4 +-- .../Collections/NPCIDs/StormWeaverIDList.cs | 28 +++++++++++++++++++ 4 files changed, 38 insertions(+), 19 deletions(-) create mode 100644 Systems/Collections/NPCIDs/StormWeaverIDList.cs diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index 7fd1226e22..ed9e178fb3 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -315,28 +315,28 @@ namespace CalamityMod.Balancing #region Storm Weaver // 50% resist to true melee. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.StormWeaverIDs, Do(ResistTrueMelee(0.5f)))); + NPCSpecificBalancingChanges.AddRange(Bundle(StormWeaverIDList.List, Do(ResistTrueMelee(0.5f)))); // 50% resist to Dazzling Stabber Staff. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.StormWeaverIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(StormWeaverIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 50% resist to Last Prism. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.StormWeaverIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.LastPrismLaser)))); + NPCSpecificBalancingChanges.AddRange(Bundle(StormWeaverIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.LastPrismLaser)))); // 50% resist to Legion of Celestia. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.StormWeaverIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(StormWeaverIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 50% resist to Pristine Fury's alt fire. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.StormWeaverIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(StormWeaverIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 50% resist to Tactician's Trump Card's explosions. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.StormWeaverIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(StormWeaverIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 35% resist to Event Horizon. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.StormWeaverIDs, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType(), ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(StormWeaverIDList.List, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType(), ProjectileType())))); // 25% resist to Molten Amputator's blobs. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.StormWeaverIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(StormWeaverIDList.List, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); #endregion #region Old Duke diff --git a/CalamityLists.cs b/CalamityLists.cs index 5695723ecc..00de1430de 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -45,7 +45,6 @@ namespace CalamityMod public sealed class CalamityLists : ModSystem { public static List DeathModeSplittingWormIDs; - public static List StormWeaverIDs; public static List RavagerIDs; public static List GolemIDs; public static List BoundNPCIDs; @@ -92,13 +91,6 @@ namespace CalamityMod NPCID.SeekerTail }; - StormWeaverIDs = new List - { - NPCType(), - NPCType(), - NPCType() - }; - // Purposefully does not include the freed head RavagerIDs = new List { @@ -664,7 +656,6 @@ namespace CalamityMod public override void Unload() { DeathModeSplittingWormIDs = null; - StormWeaverIDs = null; RavagerIDs = null; GolemIDs = null; BoundNPCIDs = null; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 32d020d4a6..e0f717b718 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -805,7 +805,7 @@ namespace CalamityMod.NPCs // Worms that are vulnerable to debuffs and Slime God slimes take reduced damage from vulnerabilities. #region Debuff System Multiplier Calculations bool wormBoss = DesertScourgeIDList.Includes(npc) || EaterOfWorldsIDList.Includes(npc) || PerforatorWormIDList.Includes(npc) || - AquaticScourgeIDList.Includes(npc) || AstrumDeusIDList.Includes(npc) || CalamityLists.StormWeaverIDs.Contains(npc.type); + AquaticScourgeIDList.Includes(npc) || AstrumDeusIDList.Includes(npc) || StormWeaverIDList.Includes(npc); bool slimeGod = SlimeGodIDList.Includes(npc); bool slimed = npc.drippingSlime || npc.drippingSparkleSlime; @@ -6065,7 +6065,7 @@ namespace CalamityMod.NPCs // True melee resists if (DesertScourgeIDList.Includes(npc) || EaterOfWorldsIDList.Includes(npc) || npc.type == NPCID.Creeper || PerforatorWormIDList.Includes(npc) || AquaticScourgeIDList.Includes(npc) || DestroyerIDList.Includes(npc) || - AstrumDeusIDList.Includes(npc) || CalamityLists.StormWeaverIDs.Contains(npc.type) || ThanatosIDList.Includes(npc) || + AstrumDeusIDList.Includes(npc) || StormWeaverIDList.Includes(npc) || ThanatosIDList.Includes(npc) || npc.type == NPCType() || npc.type == NPCType() || AresIDList.Includes(npc) || npc.type == NPCType() || npc.type == NPCType()) { diff --git a/Systems/Collections/NPCIDs/StormWeaverIDList.cs b/Systems/Collections/NPCIDs/StormWeaverIDList.cs new file mode 100644 index 0000000000..6263f866bc --- /dev/null +++ b/Systems/Collections/NPCIDs/StormWeaverIDList.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.StormWeaver; +using Terraria; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class StormWeaverIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCType(), + NPCType(), + NPCType() + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(NPC npc) => List.Contains(npc.type); + public static bool Includes(int npcType) => List.Contains(npcType); + } +} From ef56d94beefe63cbe027d5e2260fa49a748c5abf Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 19:48:20 +0900 Subject: [PATCH 097/118] RavagerIDList. --- Balancing/BalancingChangesManager.cs | 16 +++++------ CalamityLists.cs | 13 --------- Systems/Collections/NPCIDs/RavagerIDList.cs | 32 +++++++++++++++++++++ 3 files changed, 40 insertions(+), 21 deletions(-) create mode 100644 Systems/Collections/NPCIDs/RavagerIDList.cs diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index ed9e178fb3..50a04f94b1 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -208,28 +208,28 @@ namespace CalamityMod.Balancing #region Ravager // 50% resist to true melee. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(ResistTrueMelee(0.5f)))); + NPCSpecificBalancingChanges.AddRange(Bundle(RavagerIDList.List, Do(ResistTrueMelee(0.5f)))); // 50% resist to Aegis Blade's explosions because the true melee resist ain't enough. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(RavagerIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 50% resist to Icicle Arrows. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(RavagerIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 35% resist to Flying Dragon. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(new ProjectileResistBalancingRule(0.65f, ProjectileID.DD2SquireSonicBoom)))); + NPCSpecificBalancingChanges.AddRange(Bundle(RavagerIDList.List, Do(new ProjectileResistBalancingRule(0.65f, ProjectileID.DD2SquireSonicBoom)))); // 30% resist to Aurora Blazer. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(RavagerIDList.List, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); // 30% resist to Flak Kraken. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(RavagerIDList.List, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); // 25% resist to Lucrecia. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(RavagerIDList.List, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); // 20% resist to The Hive. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.RavagerIDs, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType(), ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(RavagerIDList.List, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType(), ProjectileType())))); #endregion #region Lunatic Cultist diff --git a/CalamityLists.cs b/CalamityLists.cs index 00de1430de..cb3a26b724 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -45,7 +45,6 @@ namespace CalamityMod public sealed class CalamityLists : ModSystem { public static List DeathModeSplittingWormIDs; - public static List RavagerIDs; public static List GolemIDs; public static List BoundNPCIDs; @@ -91,17 +90,6 @@ namespace CalamityMod NPCID.SeekerTail }; - // Purposefully does not include the freed head - RavagerIDs = new List - { - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType() - }; - GolemIDs = new List { NPCID.Golem, @@ -656,7 +644,6 @@ namespace CalamityMod public override void Unload() { DeathModeSplittingWormIDs = null; - RavagerIDs = null; GolemIDs = null; BoundNPCIDs = null; GrenadeResistIDs = null; diff --git a/Systems/Collections/NPCIDs/RavagerIDList.cs b/Systems/Collections/NPCIDs/RavagerIDList.cs new file mode 100644 index 0000000000..881b50596f --- /dev/null +++ b/Systems/Collections/NPCIDs/RavagerIDList.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.Ravager; +using Terraria; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class RavagerIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + // Purposefully does not include the freed head + List = + [ + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType(), + NPCType() + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(NPC npc) => List.Contains(npc.type); + public static bool Includes(int npcType) => List.Contains(npcType); + } +} From 7434f1d5dcd6e95e25c438a90063bcd62ca00a66 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 19:50:00 +0900 Subject: [PATCH 098/118] GolemIDList. --- CalamityLists.cs | 11 --------- Systems/Collections/NPCIDs/GolemIDList.cs | 29 +++++++++++++++++++++++ 2 files changed, 29 insertions(+), 11 deletions(-) create mode 100644 Systems/Collections/NPCIDs/GolemIDList.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index cb3a26b724..68353ac41b 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -45,7 +45,6 @@ namespace CalamityMod public sealed class CalamityLists : ModSystem { public static List DeathModeSplittingWormIDs; - public static List GolemIDs; public static List BoundNPCIDs; public static List GrenadeResistIDs; @@ -90,15 +89,6 @@ namespace CalamityMod NPCID.SeekerTail }; - GolemIDs = new List - { - NPCID.Golem, - NPCID.GolemHead, - NPCID.GolemHeadFree, - NPCID.GolemFistLeft, - NPCID.GolemFistRight - }; - GrenadeResistIDs = new List { ProjectileID.Grenade, @@ -644,7 +634,6 @@ namespace CalamityMod public override void Unload() { DeathModeSplittingWormIDs = null; - GolemIDs = null; BoundNPCIDs = null; GrenadeResistIDs = null; ZeroContactDamageNPCList = null; diff --git a/Systems/Collections/NPCIDs/GolemIDList.cs b/Systems/Collections/NPCIDs/GolemIDList.cs new file mode 100644 index 0000000000..c5ffc77281 --- /dev/null +++ b/Systems/Collections/NPCIDs/GolemIDList.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + public sealed class GolemIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.Golem, + NPCID.GolemHead, + NPCID.GolemHeadFree, + NPCID.GolemFistLeft, + NPCID.GolemFistRight + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(NPC npc) => List.Contains(npc.type); + public static bool Includes(int npcType) => List.Contains(npcType); + } +} From 8e73db0add85b82e1624761a01262fef121c2f7c Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 19:51:22 +0900 Subject: [PATCH 099/118] Moved NPC Variants List to Subfolder --- Systems/Collections/{NPCs => NPCVariants}/AngryBonesList.cs | 0 Systems/Collections/{NPCs => NPCVariants}/DemonEyeList.cs | 0 Systems/Collections/{NPCs => NPCVariants}/HornetList.cs | 0 Systems/Collections/{NPCs => NPCVariants}/MossHornetList.cs | 0 Systems/Collections/{NPCs => NPCVariants}/SkeletonList.cs | 0 Systems/Collections/{NPCs => NPCVariants}/ZombieList.cs | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename Systems/Collections/{NPCs => NPCVariants}/AngryBonesList.cs (100%) rename Systems/Collections/{NPCs => NPCVariants}/DemonEyeList.cs (100%) rename Systems/Collections/{NPCs => NPCVariants}/HornetList.cs (100%) rename Systems/Collections/{NPCs => NPCVariants}/MossHornetList.cs (100%) rename Systems/Collections/{NPCs => NPCVariants}/SkeletonList.cs (100%) rename Systems/Collections/{NPCs => NPCVariants}/ZombieList.cs (100%) diff --git a/Systems/Collections/NPCs/AngryBonesList.cs b/Systems/Collections/NPCVariants/AngryBonesList.cs similarity index 100% rename from Systems/Collections/NPCs/AngryBonesList.cs rename to Systems/Collections/NPCVariants/AngryBonesList.cs diff --git a/Systems/Collections/NPCs/DemonEyeList.cs b/Systems/Collections/NPCVariants/DemonEyeList.cs similarity index 100% rename from Systems/Collections/NPCs/DemonEyeList.cs rename to Systems/Collections/NPCVariants/DemonEyeList.cs diff --git a/Systems/Collections/NPCs/HornetList.cs b/Systems/Collections/NPCVariants/HornetList.cs similarity index 100% rename from Systems/Collections/NPCs/HornetList.cs rename to Systems/Collections/NPCVariants/HornetList.cs diff --git a/Systems/Collections/NPCs/MossHornetList.cs b/Systems/Collections/NPCVariants/MossHornetList.cs similarity index 100% rename from Systems/Collections/NPCs/MossHornetList.cs rename to Systems/Collections/NPCVariants/MossHornetList.cs diff --git a/Systems/Collections/NPCs/SkeletonList.cs b/Systems/Collections/NPCVariants/SkeletonList.cs similarity index 100% rename from Systems/Collections/NPCs/SkeletonList.cs rename to Systems/Collections/NPCVariants/SkeletonList.cs diff --git a/Systems/Collections/NPCs/ZombieList.cs b/Systems/Collections/NPCVariants/ZombieList.cs similarity index 100% rename from Systems/Collections/NPCs/ZombieList.cs rename to Systems/Collections/NPCVariants/ZombieList.cs From 6af0d645832636db7c86e60aeb1ceb57c4445379 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 19:52:30 +0900 Subject: [PATCH 100/118] Get out from here --- Systems/Collections/{NPCs => }/FriendlyBeesList.cs | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Systems/Collections/{NPCs => }/FriendlyBeesList.cs (100%) diff --git a/Systems/Collections/NPCs/FriendlyBeesList.cs b/Systems/Collections/FriendlyBeesList.cs similarity index 100% rename from Systems/Collections/NPCs/FriendlyBeesList.cs rename to Systems/Collections/FriendlyBeesList.cs From 7c82e0e6604c4edaf39e2931ecbe4f060d63f377 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 19:58:11 +0900 Subject: [PATCH 101/118] DeathModeSplittingWormList. --- CalamityLists.cs | 14 -------- NPCs/CalamityGlobalNPC.cs | 2 +- .../NPCs/DeathModeSplittingWormList.cs | 33 +++++++++++++++++++ 3 files changed, 34 insertions(+), 15 deletions(-) create mode 100644 Systems/Collections/NPCs/DeathModeSplittingWormList.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index 68353ac41b..2da0844834 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -44,7 +44,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List DeathModeSplittingWormIDs; public static List BoundNPCIDs; public static List GrenadeResistIDs; @@ -76,18 +75,6 @@ namespace CalamityMod // Lists of enemies that resist piercing to some extent (mostly worms). // Could prove useful for other things as well. - DeathModeSplittingWormIDs = new List - { - NPCID.DuneSplicerHead, - NPCID.DuneSplicerBody, - NPCID.DuneSplicerTail, - NPCID.DiggerHead, - NPCID.DiggerBody, - NPCID.DiggerTail, - NPCID.SeekerHead, - NPCID.SeekerBody, - NPCID.SeekerTail - }; GrenadeResistIDs = new List { @@ -633,7 +620,6 @@ namespace CalamityMod public override void Unload() { - DeathModeSplittingWormIDs = null; BoundNPCIDs = null; GrenadeResistIDs = null; ZeroContactDamageNPCList = null; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index e0f717b718..7409496afa 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -1689,7 +1689,7 @@ namespace CalamityMod.NPCs #region Revengeance and Death Mode Stat Changes private void RevDeathStatChanges(NPC npc, Mod mod) { - if (CalamityLists.DeathModeSplittingWormIDs.Contains(npc.type)) + if (DeathModeSplittingWormList.Includes(npc)) { if (CalamityWorld.death) npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.15); diff --git a/Systems/Collections/NPCs/DeathModeSplittingWormList.cs b/Systems/Collections/NPCs/DeathModeSplittingWormList.cs new file mode 100644 index 0000000000..d6b9ecdd2f --- /dev/null +++ b/Systems/Collections/NPCs/DeathModeSplittingWormList.cs @@ -0,0 +1,33 @@ +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + public sealed class DeathModeSplittingWormList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.DuneSplicerHead, + NPCID.DuneSplicerBody, + NPCID.DuneSplicerTail, + NPCID.DiggerHead, + NPCID.DiggerBody, + NPCID.DiggerTail, + NPCID.SeekerHead, + NPCID.SeekerBody, + NPCID.SeekerTail + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(NPC npc) => List.Contains(npc.type); + public static bool Includes(int npcType) => List.Contains(npcType); + } +} From fc71ed54381fa0719a9c5dd2f70adefec77d846c Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 20:00:57 +0900 Subject: [PATCH 102/118] BoundNPCIDList --- CalamityLists.cs | 14 --------- NPCs/CalamityGlobalTownNPC.cs | 3 +- Systems/Collections/NPCIDs/BoundNPCIDList.cs | 31 ++++++++++++++++++++ 3 files changed, 33 insertions(+), 15 deletions(-) create mode 100644 Systems/Collections/NPCIDs/BoundNPCIDList.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index 2da0844834..9425340e15 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -44,8 +44,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List BoundNPCIDs; - public static List GrenadeResistIDs; public static List ZeroContactDamageNPCList; public static List HardmodeNPCNerfList; @@ -372,17 +370,6 @@ namespace CalamityMod NPCID.ZombieMerman }; - BoundNPCIDs = new List - { - NPCID.BoundGoblin, - NPCID.BoundWizard, - NPCID.BoundMechanic, - NPCID.SleepingAngler, - NPCID.BartenderUnconscious, - NPCID.WebbedStylist, - NPCID.GolferRescue - }; - // Collections BossRushHPChanges = new SortedDictionary { @@ -620,7 +607,6 @@ namespace CalamityMod public override void Unload() { - BoundNPCIDs = null; GrenadeResistIDs = null; ZeroContactDamageNPCList = null; HardmodeNPCNerfList = null; diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index b9e19f4789..0573c8f019 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -20,6 +20,7 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.NPCs.TownNPCs; using CalamityMod.Projectiles.Rogue; +using CalamityMod.Systems.Collections; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -1027,7 +1028,7 @@ namespace CalamityMod.NPCs public void BoundNPCSafety(Mod mod, NPC npc) { // Make Bound Town NPCs take no damage - if (CalamityLists.BoundNPCIDs.Contains(npc.type)) + if (BoundNPCIDList.Includes(npc)) { npc.dontTakeDamageFromHostiles = true; } diff --git a/Systems/Collections/NPCIDs/BoundNPCIDList.cs b/Systems/Collections/NPCIDs/BoundNPCIDList.cs new file mode 100644 index 0000000000..1a447dd339 --- /dev/null +++ b/Systems/Collections/NPCIDs/BoundNPCIDList.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + public sealed class BoundNPCIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.BoundGoblin, + NPCID.BoundWizard, + NPCID.BoundMechanic, + NPCID.SleepingAngler, + NPCID.BartenderUnconscious, + NPCID.WebbedStylist, + NPCID.GolferRescue + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(NPC npc) => List.Contains(npc.type); + public static bool Includes(int npcType) => List.Contains(npcType); + } +} From 5c112434b386df9db219c2763b18de39cb1a2b87 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 20:04:24 +0900 Subject: [PATCH 103/118] ZeroContactDamageNPCList. --- CalamityLists.cs | 138 ---------------- NPCs/CalamityGlobalNPC.cs | 2 +- .../NPCs/ZeroContactDamageNPCList.cs | 156 ++++++++++++++++++ 3 files changed, 157 insertions(+), 139 deletions(-) create mode 100644 Systems/Collections/NPCs/ZeroContactDamageNPCList.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index 9425340e15..021f045b0f 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -45,7 +45,6 @@ namespace CalamityMod public sealed class CalamityLists : ModSystem { public static List GrenadeResistIDs; - public static List ZeroContactDamageNPCList; public static List HardmodeNPCNerfList; public static SortedDictionary BossRushHPChanges; @@ -97,142 +96,6 @@ namespace CalamityMod ProjectileID.TNTBarrel }; - ZeroContactDamageNPCList = new List - { - NPCID.Harpy, - NPCID.Salamander, - NPCID.Salamander2, - NPCID.Salamander3, - NPCID.Salamander4, - NPCID.Salamander5, - NPCID.Salamander6, - NPCID.Salamander7, - NPCID.Salamander8, - NPCID.Salamander9, - NPCID.GiantCursedSkull, - NPCID.FungiBulb, - NPCID.GiantFungiBulb, - NPCID.IcyMerman, - NPCID.AngryNimbus, - NPCID.SandElemental, - NPCID.DarkCaster, - NPCID.FireImp, - NPCID.Tim, - NPCID.CultistArcherBlue, - NPCID.DesertDjinn, - NPCID.DiabolistRed, - NPCID.DiabolistWhite, - NPCID.Gastropod, - NPCID.IceElemental, - NPCID.IchorSticker, - NPCID.Necromancer, - NPCID.NecromancerArmored, - NPCID.RaggedCaster, - NPCID.RaggedCasterOpenCoat, - NPCID.RuneWizard, - NPCID.SkeletonArcher, - NPCID.SkeletonCommando, - NPCID.SkeletonSniper, - NPCID.TacticalSkeleton, - NPCID.Clown, - NPCID.GoblinArcher, - NPCID.GoblinSorcerer, - NPCID.GoblinSummoner, - NPCID.PirateCrossbower, - NPCID.PirateDeadeye, - NPCID.PirateCaptain, - NPCID.SnowmanGangsta, - NPCID.SnowBalla, - NPCID.DrManFly, - NPCID.Eyezor, - NPCID.Nailhead, - NPCID.BrainScrambler, - NPCID.GigaZapper, - NPCID.RayGunner, - NPCID.ScutlixRider, - NPCID.MartianWalker, - NPCID.MartianTurret, - NPCID.ElfCopter, - NPCID.ElfArcher, - NPCID.NebulaBrain, - NPCID.NebulaSoldier, - NPCID.StardustCellSmall, - NPCID.StardustJellyfishBig, - NPCID.StardustSoldier, - NPCID.StardustSpiderBig, - NPCID.VortexHornetQueen, - NPCID.VortexRifleman, - NPCID.VortexSoldier, - NPCID.PirateShipCannon, - NPCID.MartianSaucer, - NPCID.MartianSaucerCannon, - NPCID.MartianSaucerCore, - NPCID.MartianSaucerTurret, - NPCID.Probe, - NPCID.CultistBoss, - NPCID.GolemHead, - NPCID.GolemHeadFree, - NPCID.MoonLordFreeEye, - NPCID.BloodSquid, - NPCID.PlanterasHook, - NPCID.Dandelion, - NPCID.DD2DarkMageT1, - NPCID.DD2DarkMageT3, - NPCID.DD2OgreT2, - NPCID.DD2OgreT3, - NPCID.DD2GoblinBomberT1, - NPCID.DD2GoblinBomberT2, - NPCID.DD2GoblinBomberT3, - NPCID.DD2JavelinstT1, - NPCID.DD2JavelinstT2, - NPCID.DD2JavelinstT3, - NPCID.DD2KoboldWalkerT2, - NPCID.DD2KoboldWalkerT3, - NPCID.DD2DrakinT2, - NPCID.DD2DrakinT3, - NPCID.DD2KoboldFlyerT2, - NPCID.DD2KoboldFlyerT3, - NPCID.DD2WitherBeastT2, - NPCID.DD2WitherBeastT3, - NPCID.DD2LightningBugT3, - NPCID.MourningWood, - NPCID.Pumpking, - NPCID.Everscream, - NPCID.IceQueen, - NPCID.SantaNK1, - NPCID.DevourerBody, - NPCID.DevourerTail, - NPCID.DiggerBody, - NPCID.DiggerTail, - NPCID.TombCrawlerBody, - NPCID.TombCrawlerTail, - NPCID.DuneSplicerBody, - NPCID.DuneSplicerTail, - NPCID.GiantWormBody, - NPCID.GiantWormTail, - NPCID.LeechBody, - NPCID.LeechTail, - NPCID.StardustWormBody, - NPCID.StardustWormTail, - NPCID.SeekerBody, - NPCID.SeekerTail, - NPCID.BoneSerpentBody, - NPCID.BoneSerpentTail, - NPCID.WyvernBody, - NPCID.WyvernTail, - NPCID.WyvernBody2, - NPCID.WyvernBody3, - NPCID.WyvernLegs, - NPCID.CultistDragonBody1, - NPCID.CultistDragonBody2, - NPCID.CultistDragonBody3, - NPCID.CultistDragonBody4, - NPCID.CultistDragonTail, - NPCID.BloodEelBody, - NPCID.BloodEelTail, - NPCID.AncientDoom - }; - // Reduce contact damage by 25% HardmodeNPCNerfList = new List { @@ -608,7 +471,6 @@ namespace CalamityMod public override void Unload() { GrenadeResistIDs = null; - ZeroContactDamageNPCList = null; HardmodeNPCNerfList = null; BossRushHPChanges?.Clear(); diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 7409496afa..2167e5ef29 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3818,7 +3818,7 @@ namespace CalamityMod.NPCs } // Setting this in SetDefaults will disable expert mode scaling, so put it here instead - if (CalamityLists.ZeroContactDamageNPCList.Contains(npc.type) && (npc.type != NPCID.RuneWizard || !Main.zenithWorld)) + if (ZeroContactDamageNPCList.Includes(npc) && (npc.type != NPCID.RuneWizard || !Main.zenithWorld)) npc.damage = 0; // Don't do damage for 42 frames after spawning in diff --git a/Systems/Collections/NPCs/ZeroContactDamageNPCList.cs b/Systems/Collections/NPCs/ZeroContactDamageNPCList.cs new file mode 100644 index 0000000000..714f8ded23 --- /dev/null +++ b/Systems/Collections/NPCs/ZeroContactDamageNPCList.cs @@ -0,0 +1,156 @@ +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + public sealed class ZeroContactDamageNPCList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.Harpy, + NPCID.Salamander, + NPCID.Salamander2, + NPCID.Salamander3, + NPCID.Salamander4, + NPCID.Salamander5, + NPCID.Salamander6, + NPCID.Salamander7, + NPCID.Salamander8, + NPCID.Salamander9, + NPCID.GiantCursedSkull, + NPCID.FungiBulb, + NPCID.GiantFungiBulb, + NPCID.IcyMerman, + NPCID.AngryNimbus, + NPCID.SandElemental, + NPCID.DarkCaster, + NPCID.FireImp, + NPCID.Tim, + NPCID.CultistArcherBlue, + NPCID.DesertDjinn, + NPCID.DiabolistRed, + NPCID.DiabolistWhite, + NPCID.Gastropod, + NPCID.IceElemental, + NPCID.IchorSticker, + NPCID.Necromancer, + NPCID.NecromancerArmored, + NPCID.RaggedCaster, + NPCID.RaggedCasterOpenCoat, + NPCID.RuneWizard, + NPCID.SkeletonArcher, + NPCID.SkeletonCommando, + NPCID.SkeletonSniper, + NPCID.TacticalSkeleton, + NPCID.Clown, + NPCID.GoblinArcher, + NPCID.GoblinSorcerer, + NPCID.GoblinSummoner, + NPCID.PirateCrossbower, + NPCID.PirateDeadeye, + NPCID.PirateCaptain, + NPCID.SnowmanGangsta, + NPCID.SnowBalla, + NPCID.DrManFly, + NPCID.Eyezor, + NPCID.Nailhead, + NPCID.BrainScrambler, + NPCID.GigaZapper, + NPCID.RayGunner, + NPCID.ScutlixRider, + NPCID.MartianWalker, + NPCID.MartianTurret, + NPCID.ElfCopter, + NPCID.ElfArcher, + NPCID.NebulaBrain, + NPCID.NebulaSoldier, + NPCID.StardustCellSmall, + NPCID.StardustJellyfishBig, + NPCID.StardustSoldier, + NPCID.StardustSpiderBig, + NPCID.VortexHornetQueen, + NPCID.VortexRifleman, + NPCID.VortexSoldier, + NPCID.PirateShipCannon, + NPCID.MartianSaucer, + NPCID.MartianSaucerCannon, + NPCID.MartianSaucerCore, + NPCID.MartianSaucerTurret, + NPCID.Probe, + NPCID.CultistBoss, + NPCID.GolemHead, + NPCID.GolemHeadFree, + NPCID.MoonLordFreeEye, + NPCID.BloodSquid, + NPCID.PlanterasHook, + NPCID.Dandelion, + NPCID.DD2DarkMageT1, + NPCID.DD2DarkMageT3, + NPCID.DD2OgreT2, + NPCID.DD2OgreT3, + NPCID.DD2GoblinBomberT1, + NPCID.DD2GoblinBomberT2, + NPCID.DD2GoblinBomberT3, + NPCID.DD2JavelinstT1, + NPCID.DD2JavelinstT2, + NPCID.DD2JavelinstT3, + NPCID.DD2KoboldWalkerT2, + NPCID.DD2KoboldWalkerT3, + NPCID.DD2DrakinT2, + NPCID.DD2DrakinT3, + NPCID.DD2KoboldFlyerT2, + NPCID.DD2KoboldFlyerT3, + NPCID.DD2WitherBeastT2, + NPCID.DD2WitherBeastT3, + NPCID.DD2LightningBugT3, + NPCID.MourningWood, + NPCID.Pumpking, + NPCID.Everscream, + NPCID.IceQueen, + NPCID.SantaNK1, + NPCID.DevourerBody, + NPCID.DevourerTail, + NPCID.DiggerBody, + NPCID.DiggerTail, + NPCID.TombCrawlerBody, + NPCID.TombCrawlerTail, + NPCID.DuneSplicerBody, + NPCID.DuneSplicerTail, + NPCID.GiantWormBody, + NPCID.GiantWormTail, + NPCID.LeechBody, + NPCID.LeechTail, + NPCID.StardustWormBody, + NPCID.StardustWormTail, + NPCID.SeekerBody, + NPCID.SeekerTail, + NPCID.BoneSerpentBody, + NPCID.BoneSerpentTail, + NPCID.WyvernBody, + NPCID.WyvernTail, + NPCID.WyvernBody2, + NPCID.WyvernBody3, + NPCID.WyvernLegs, + NPCID.CultistDragonBody1, + NPCID.CultistDragonBody2, + NPCID.CultistDragonBody3, + NPCID.CultistDragonBody4, + NPCID.CultistDragonTail, + NPCID.BloodEelBody, + NPCID.BloodEelTail, + NPCID.AncientDoom + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(NPC npc) => List.Contains(npc.type); + public static bool Includes(int npcType) => List.Contains(npcType); + } +} From e797342a681a7bd191394c8e74c829ab8934dc51 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 20:06:32 +0900 Subject: [PATCH 104/118] HardmodeNPCNerfList --- CalamityLists.cs | 138 --------------- NPCs/CalamityGlobalNPC.cs | 2 +- .../Collections/NPCs/HardmodeNPCNerfList.cs | 157 ++++++++++++++++++ 3 files changed, 158 insertions(+), 139 deletions(-) create mode 100644 Systems/Collections/NPCs/HardmodeNPCNerfList.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index 021f045b0f..3b78e243b0 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -45,7 +45,6 @@ namespace CalamityMod public sealed class CalamityLists : ModSystem { public static List GrenadeResistIDs; - public static List HardmodeNPCNerfList; public static SortedDictionary BossRushHPChanges; public static SortedDictionary BossValues; @@ -96,142 +95,6 @@ namespace CalamityMod ProjectileID.TNTBarrel }; - // Reduce contact damage by 25% - HardmodeNPCNerfList = new List - { - NPCID.AnglerFish, - NPCID.AngryTrapper, - NPCID.Arapaima, - NPCID.BlackRecluse, - NPCID.BlackRecluseWall, - NPCID.BloodJelly, - NPCID.FungoFish, - NPCID.GreenJellyfish, - NPCID.Clinger, - NPCID.ArmoredSkeleton, - NPCID.ArmoredViking, - NPCID.Mummy, - NPCID.DarkMummy, - NPCID.LightMummy, - NPCID.BloodFeeder, - NPCID.DesertBeast, - NPCID.ChaosElemental, - NPCID.BloodMummy, - NPCID.CorruptSlime, - NPCID.Slimeling, - NPCID.Corruptor, - NPCID.Crimslime, - NPCID.BigCrimslime, - NPCID.LittleCrimslime, - NPCID.CrimsonAxe, - NPCID.CursedHammer, - NPCID.Derpling, - NPCID.Herpling, - NPCID.DiggerHead, - NPCID.DesertGhoul, - NPCID.DesertGhoulCorruption, - NPCID.DesertGhoulCrimson, - NPCID.DesertGhoulHallow, - NPCID.DuneSplicerHead, - NPCID.EnchantedSword, - NPCID.FloatyGross, - NPCID.GiantBat, - NPCID.GiantFlyingFox, - NPCID.FungiSpore, - NPCID.GiantTortoise, - NPCID.IceTortoise, - NPCID.HoppinJack, - NPCID.Mimic, - NPCID.IlluminantBat, - NPCID.IlluminantSlime, - NPCID.JungleCreeper, - NPCID.JungleCreeperWall, - NPCID.DesertLamiaDark, - NPCID.DesertLamiaLight, - NPCID.BigMossHornet, - NPCID.GiantMossHornet, - NPCID.LittleMossHornet, - NPCID.MossHornet, - NPCID.TinyMossHornet, - NPCID.Moth, - NPCID.PigronCorruption, - NPCID.PigronCrimson, - NPCID.PigronHallow, - NPCID.Pixie, - NPCID.PossessedArmor, - NPCID.RockGolem, - NPCID.DesertScorpionWalk, - NPCID.DesertScorpionWall, - NPCID.Slimer, - NPCID.Slimer2, - NPCID.ToxicSludge, - NPCID.Unicorn, - NPCID.WanderingEye, - NPCID.Werewolf, - NPCID.Wolf, - NPCID.SeekerHead, - NPCID.Wraith, - NPCID.ChatteringTeethBomb, - NPCID.IceGolem, - NPCID.RainbowSlime, - NPCID.SandShark, - NPCID.SandsharkCorrupt, - NPCID.SandsharkCrimson, - NPCID.SandsharkHallow, - NPCID.ShadowFlameApparition, - NPCID.Parrot, - NPCID.PirateCorsair, - NPCID.PirateDeckhand, - NPCID.PirateGhost, - NPCID.BlueArmoredBonesMace, - NPCID.BlueArmoredBonesSword, - NPCID.BoneLee, - NPCID.DungeonSpirit, - NPCID.FlyingSnake, - NPCID.HellArmoredBones, - NPCID.HellArmoredBonesSpikeShield, - NPCID.HellArmoredBonesSword, - NPCID.MisterStabby, - NPCID.Butcher, - NPCID.CreatureFromTheDeep, - NPCID.DeadlySphere, - NPCID.Frankenstein, - NPCID.Fritz, - NPCID.Psycho, - NPCID.Reaper, - NPCID.SwampThing, - NPCID.ThePossessed, - NPCID.Vampire, - NPCID.VampireBat, - NPCID.HeadlessHorseman, - NPCID.Hellhound, - NPCID.Poltergeist, - NPCID.Scarecrow1, - NPCID.Scarecrow2, - NPCID.Scarecrow3, - NPCID.Scarecrow4, - NPCID.Scarecrow5, - NPCID.Scarecrow6, - NPCID.Scarecrow7, - NPCID.Scarecrow8, - NPCID.Scarecrow9, - NPCID.Scarecrow10, - NPCID.Splinterling, - NPCID.Flocko, - NPCID.GingerbreadMan, - NPCID.Krampus, - NPCID.Nutcracker, - NPCID.NutcrackerSpinning, - NPCID.PresentMimic, - NPCID.Yeti, - NPCID.ZombieElf, - NPCID.ZombieElfBeard, - NPCID.ZombieElfGirl, - NPCID.BloodEelHead, - NPCID.GoblinShark, - NPCID.EyeballFlyingFish, - NPCID.ZombieMerman - }; // Collections BossRushHPChanges = new SortedDictionary @@ -471,7 +334,6 @@ namespace CalamityMod public override void Unload() { GrenadeResistIDs = null; - HardmodeNPCNerfList = null; BossRushHPChanges?.Clear(); BossRushHPChanges = null; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 2167e5ef29..a7f7f62163 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -2822,7 +2822,7 @@ namespace CalamityMod.NPCs } } - if (Main.hardMode && CalamityLists.HardmodeNPCNerfList.Contains(npc.type)) + if (Main.hardMode && HardmodeNPCNerfList.Includes(npc)) { npc.damage = (int)Math.Round(npc.damage * 0.75); npc.defDamage = npc.damage; diff --git a/Systems/Collections/NPCs/HardmodeNPCNerfList.cs b/Systems/Collections/NPCs/HardmodeNPCNerfList.cs new file mode 100644 index 0000000000..e0ccc72228 --- /dev/null +++ b/Systems/Collections/NPCs/HardmodeNPCNerfList.cs @@ -0,0 +1,157 @@ +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + public sealed class HardmodeNPCNerfList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + // Reduce contact damage by 25% + List = + [ + NPCID.AnglerFish, + NPCID.AngryTrapper, + NPCID.Arapaima, + NPCID.BlackRecluse, + NPCID.BlackRecluseWall, + NPCID.BloodJelly, + NPCID.FungoFish, + NPCID.GreenJellyfish, + NPCID.Clinger, + NPCID.ArmoredSkeleton, + NPCID.ArmoredViking, + NPCID.Mummy, + NPCID.DarkMummy, + NPCID.LightMummy, + NPCID.BloodFeeder, + NPCID.DesertBeast, + NPCID.ChaosElemental, + NPCID.BloodMummy, + NPCID.CorruptSlime, + NPCID.Slimeling, + NPCID.Corruptor, + NPCID.Crimslime, + NPCID.BigCrimslime, + NPCID.LittleCrimslime, + NPCID.CrimsonAxe, + NPCID.CursedHammer, + NPCID.Derpling, + NPCID.Herpling, + NPCID.DiggerHead, + NPCID.DesertGhoul, + NPCID.DesertGhoulCorruption, + NPCID.DesertGhoulCrimson, + NPCID.DesertGhoulHallow, + NPCID.DuneSplicerHead, + NPCID.EnchantedSword, + NPCID.FloatyGross, + NPCID.GiantBat, + NPCID.GiantFlyingFox, + NPCID.FungiSpore, + NPCID.GiantTortoise, + NPCID.IceTortoise, + NPCID.HoppinJack, + NPCID.Mimic, + NPCID.IlluminantBat, + NPCID.IlluminantSlime, + NPCID.JungleCreeper, + NPCID.JungleCreeperWall, + NPCID.DesertLamiaDark, + NPCID.DesertLamiaLight, + NPCID.BigMossHornet, + NPCID.GiantMossHornet, + NPCID.LittleMossHornet, + NPCID.MossHornet, + NPCID.TinyMossHornet, + NPCID.Moth, + NPCID.PigronCorruption, + NPCID.PigronCrimson, + NPCID.PigronHallow, + NPCID.Pixie, + NPCID.PossessedArmor, + NPCID.RockGolem, + NPCID.DesertScorpionWalk, + NPCID.DesertScorpionWall, + NPCID.Slimer, + NPCID.Slimer2, + NPCID.ToxicSludge, + NPCID.Unicorn, + NPCID.WanderingEye, + NPCID.Werewolf, + NPCID.Wolf, + NPCID.SeekerHead, + NPCID.Wraith, + NPCID.ChatteringTeethBomb, + NPCID.IceGolem, + NPCID.RainbowSlime, + NPCID.SandShark, + NPCID.SandsharkCorrupt, + NPCID.SandsharkCrimson, + NPCID.SandsharkHallow, + NPCID.ShadowFlameApparition, + NPCID.Parrot, + NPCID.PirateCorsair, + NPCID.PirateDeckhand, + NPCID.PirateGhost, + NPCID.BlueArmoredBonesMace, + NPCID.BlueArmoredBonesSword, + NPCID.BoneLee, + NPCID.DungeonSpirit, + NPCID.FlyingSnake, + NPCID.HellArmoredBones, + NPCID.HellArmoredBonesSpikeShield, + NPCID.HellArmoredBonesSword, + NPCID.MisterStabby, + NPCID.Butcher, + NPCID.CreatureFromTheDeep, + NPCID.DeadlySphere, + NPCID.Frankenstein, + NPCID.Fritz, + NPCID.Psycho, + NPCID.Reaper, + NPCID.SwampThing, + NPCID.ThePossessed, + NPCID.Vampire, + NPCID.VampireBat, + NPCID.HeadlessHorseman, + NPCID.Hellhound, + NPCID.Poltergeist, + NPCID.Scarecrow1, + NPCID.Scarecrow2, + NPCID.Scarecrow3, + NPCID.Scarecrow4, + NPCID.Scarecrow5, + NPCID.Scarecrow6, + NPCID.Scarecrow7, + NPCID.Scarecrow8, + NPCID.Scarecrow9, + NPCID.Scarecrow10, + NPCID.Splinterling, + NPCID.Flocko, + NPCID.GingerbreadMan, + NPCID.Krampus, + NPCID.Nutcracker, + NPCID.NutcrackerSpinning, + NPCID.PresentMimic, + NPCID.Yeti, + NPCID.ZombieElf, + NPCID.ZombieElfBeard, + NPCID.ZombieElfGirl, + NPCID.BloodEelHead, + NPCID.GoblinShark, + NPCID.EyeballFlyingFish, + NPCID.ZombieMerman + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(NPC npc) => List.Contains(npc.type); + public static bool Includes(int npcType) => List.Contains(npcType); + } +} From 787e81ed2a92afb10ccff110dd2cdb6e8363823f Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 20:09:18 +0900 Subject: [PATCH 105/118] GrenadeResistIDList --- CalamityLists.cs | 28 -------------- NPCs/CalamityGlobalNPC.cs | 2 +- Systems/Collections/GrenadeResistIDList.cs | 43 ++++++++++++++++++++++ 3 files changed, 44 insertions(+), 29 deletions(-) create mode 100644 Systems/Collections/GrenadeResistIDList.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index 3b78e243b0..317d0ad63f 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -34,7 +34,6 @@ using CalamityMod.NPCs.SlimeGod; using CalamityMod.NPCs.StormWeaver; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs.Yharon; -using CalamityMod.Projectiles.Typeless; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -44,8 +43,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static List GrenadeResistIDs; - public static SortedDictionary BossRushHPChanges; public static SortedDictionary BossValues; public static SortedDictionary bossTypes; @@ -72,30 +69,6 @@ namespace CalamityMod // Could prove useful for other things as well. - GrenadeResistIDs = new List - { - ProjectileID.Grenade, - ProjectileID.StickyGrenade, - ProjectileID.BouncyGrenade, - ProjectileID.Bomb, - ProjectileID.StickyBomb, - ProjectileID.BouncyBomb, - ProjectileID.Dynamite, - ProjectileID.StickyDynamite, - ProjectileID.BouncyDynamite, - ProjectileID.Explosives, - ProjectileID.ExplosiveBunny, - ProjectileID.PartyGirlGrenade, - ProjectileID.BombFish, - ProjectileID.Beenade, - ProjectileID.Bee, - ProjectileID.GiantBee, - ProjectileType(), - ProjectileID.ScarabBomb, - ProjectileID.TNTBarrel - }; - - // Collections BossRushHPChanges = new SortedDictionary { @@ -333,7 +306,6 @@ namespace CalamityMod public override void Unload() { - GrenadeResistIDs = null; BossRushHPChanges?.Clear(); BossRushHPChanges = null; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index a7f7f62163..6dd7eef90e 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -6229,7 +6229,7 @@ namespace CalamityMod.NPCs // Apply balancing resists/vulnerabilities. BalancingChangesManager.ApplyFromProjectile(npc, ref modifiers, projectile); - if (CalamityLists.GrenadeResistIDs.Contains(projectile.type)) + if (GrenadeResistIDList.Includes(projectile.type)) { // Eater of Worlds has a vanilla resist in Expert+, this gives it to him in Normal mode // Note that Calamity reduces the vanilla resist from 80% to 60% diff --git a/Systems/Collections/GrenadeResistIDList.cs b/Systems/Collections/GrenadeResistIDList.cs new file mode 100644 index 0000000000..917ae8271c --- /dev/null +++ b/Systems/Collections/GrenadeResistIDList.cs @@ -0,0 +1,43 @@ +using System.Collections.Generic; +using CalamityMod.Projectiles.Typeless; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class GrenadeResistIDList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + ProjectileID.Grenade, + ProjectileID.StickyGrenade, + ProjectileID.BouncyGrenade, + ProjectileID.Bomb, + ProjectileID.StickyBomb, + ProjectileID.BouncyBomb, + ProjectileID.Dynamite, + ProjectileID.StickyDynamite, + ProjectileID.BouncyDynamite, + ProjectileID.Explosives, + ProjectileID.ExplosiveBunny, + ProjectileID.PartyGirlGrenade, + ProjectileID.BombFish, + ProjectileID.Beenade, + ProjectileID.Bee, + ProjectileID.GiantBee, + ProjectileType(), + ProjectileID.ScarabBomb, + ProjectileID.TNTBarrel + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int projectileType) => List.Contains(projectileType); + } +} From eb6d78e7ab1a55742cbf6d4d89ce29fdc4533f56 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 20:12:30 +0900 Subject: [PATCH 106/118] LegOverrideList. --- CalPlayer/CalamityPlayerDrawEffects.cs | 3 ++- CalamityLists.cs | 10 ---------- Systems/Collections/LegOverrideList.cs | 27 ++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 11 deletions(-) create mode 100644 Systems/Collections/LegOverrideList.cs diff --git a/CalPlayer/CalamityPlayerDrawEffects.cs b/CalPlayer/CalamityPlayerDrawEffects.cs index 33b65d6b27..fd010bb7f6 100644 --- a/CalPlayer/CalamityPlayerDrawEffects.cs +++ b/CalPlayer/CalamityPlayerDrawEffects.cs @@ -6,6 +6,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer.DrawLayers; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -27,7 +28,7 @@ namespace CalamityMod.CalPlayer return; // Remove shoe drawing effects if special legs are meant to be drawn. - if (CalamityLists.legOverrideList.Contains(Player.legs)) + if (LegOverrideList.Includes(Player.legs)) { PlayerDrawLayers.Shoes.Hide(); } diff --git a/CalamityLists.cs b/CalamityLists.cs index 317d0ad63f..40d686b1c6 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -253,14 +253,6 @@ namespace CalamityMod { NPCID.Deerclops, 44 } }; - legOverrideList = new List() - { - EquipLoader.GetEquipSlot(CalamityMod.Instance, "ProfanedSoulCrystal", EquipType.Legs), - EquipLoader.GetEquipSlot(CalamityMod.Instance, "AquaticHeart", EquipType.Legs), - //CalamityMod.Instance.GetEquipSlot("SirenLeg", EquipType.Legs), whate even was SirenLeg vs SirenLegAlt? - EquipLoader.GetEquipSlot(CalamityMod.Instance, "Popo", EquipType.Legs) - }; - // Duke Fishron and Old Duke phase 3 becomes way too easy if you can make him stop being invisible with Yanmei's Knife. // This is a list so that other NPCs can be added as necessary. // IT DOES NOT make them immune to the debuff, just stops them from being recolored. @@ -314,8 +306,6 @@ namespace CalamityMod bossTypes?.Clear(); bossTypes = null; - legOverrideList = null; - kamiDebuffColorImmuneList = null; EncryptedSchematicIDRelationship = null; diff --git a/Systems/Collections/LegOverrideList.cs b/Systems/Collections/LegOverrideList.cs new file mode 100644 index 0000000000..16b2989168 --- /dev/null +++ b/Systems/Collections/LegOverrideList.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories.Vanity; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + public sealed class LegOverrideList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + EquipLoader.GetEquipSlot(CalamityMod.Instance, nameof(ProfanedSoulCrystal), EquipType.Legs), + EquipLoader.GetEquipSlot(CalamityMod.Instance, nameof(AquaticHeart), EquipType.Legs), + //CalamityMod.Instance.GetEquipSlot(nameof(SirenLeg), EquipType.Legs), whate even was SirenLeg vs SirenLegAlt? + EquipLoader.GetEquipSlot(CalamityMod.Instance, nameof(Popo), EquipType.Legs) + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int equipSlot) => List.Contains(equipSlot); + } +} From 738ce1a2b198560d5f8efb5206f9f11b57e2d280 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 20:15:40 +0900 Subject: [PATCH 107/118] KamiDebuffColorImmuneList. --- CalamityLists.cs | 15 ---------- NPCs/CalamityGlobalNPC.cs | 2 +- .../Collections/KamiDebuffColorImmuneList.cs | 29 +++++++++++++++++++ 3 files changed, 30 insertions(+), 16 deletions(-) create mode 100644 Systems/Collections/KamiDebuffColorImmuneList.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index 40d686b1c6..2218258613 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -47,10 +47,6 @@ namespace CalamityMod public static SortedDictionary BossValues; public static SortedDictionary bossTypes; - public static List legOverrideList; - - public static List kamiDebuffColorImmuneList; - public static Dictionary EncryptedSchematicIDRelationship; public static List DisabledSummonerNerfItems; @@ -253,15 +249,6 @@ namespace CalamityMod { NPCID.Deerclops, 44 } }; - // Duke Fishron and Old Duke phase 3 becomes way too easy if you can make him stop being invisible with Yanmei's Knife. - // This is a list so that other NPCs can be added as necessary. - // IT DOES NOT make them immune to the debuff, just stops them from being recolored. - kamiDebuffColorImmuneList = new List() - { - NPCID.DukeFishron, - NPCType() - }; - EncryptedSchematicIDRelationship = new Dictionary() { [1] = ItemType(), @@ -306,8 +293,6 @@ namespace CalamityMod bossTypes?.Clear(); bossTypes = null; - kamiDebuffColorImmuneList = null; - EncryptedSchematicIDRelationship = null; DisabledSummonerNerfItems = null; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 6dd7eef90e..dd2ea4d266 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -7194,7 +7194,7 @@ namespace CalamityMod.NPCs if (npc.HasBuff()) return new Color(200, 50, 50, 255 - npc.alpha); - if (npc.Calamity().kamiFlu > 0 && !CalamityLists.kamiDebuffColorImmuneList.Contains(npc.type)) + if (npc.Calamity().kamiFlu > 0 && !KamiDebuffColorImmuneList.Includes(npc.type)) return new Color(51, 197, 108, 255 - npc.alpha); if (npc.type == NPCID.VileSpit || npc.type == NPCID.VileSpitEaterOfWorlds) diff --git a/Systems/Collections/KamiDebuffColorImmuneList.cs b/Systems/Collections/KamiDebuffColorImmuneList.cs new file mode 100644 index 0000000000..028faa8375 --- /dev/null +++ b/Systems/Collections/KamiDebuffColorImmuneList.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.OldDuke; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class KamiDebuffColorImmuneList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + // Duke Fishron and Old Duke phase 3 becomes way too easy if you can make him stop being invisible with Yanmei's Knife. + // This is a list so that other NPCs can be added as necessary. + // IT DOES NOT make them immune to the debuff, just stops them from being recolored. + List = + [ + NPCID.DukeFishron, + NPCType() + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int npcType) => List.Contains(npcType); + } +} From 80c4e66b2bc4ded8192c1797a47a3674bc831e02 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 20:37:34 +0900 Subject: [PATCH 108/118] VeneratedLocketBanList. --- CalPlayer/CalamityPlayer.cs | 15 +++----- CalamityLists.cs | 21 ------------ ModSupport/ModCalls.cs | 4 +-- Systems/Collections/VeneratedLocketBanList.cs | 34 +++++++++++++++++++ 4 files changed, 41 insertions(+), 33 deletions(-) create mode 100644 Systems/Collections/VeneratedLocketBanList.cs diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index fed35514bf..3d5ecfc8e3 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -12,7 +12,6 @@ using CalamityMod.CalPlayer.Dashes; using CalamityMod.Cooldowns; using CalamityMod.DataStructures; using CalamityMod.Dusts; -using CalamityMod.Enums; using CalamityMod.Events; using CalamityMod.FluidSimulation; using CalamityMod.Items; @@ -53,20 +52,16 @@ using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems; using CalamityMod.Systems.Collections; -using CalamityMod.Waters; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.DataStructures; -using Terraria.GameContent; -using Terraria.GameContent.Liquid; using Terraria.GameInput; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.IO; -using Terraria.Utilities.Terraria.Utilities; using static Terraria.ModLoader.ModContent; namespace CalamityMod.CalPlayer @@ -1158,18 +1153,18 @@ namespace CalamityMod.CalPlayer public bool ZoneRadiantReefs => Player.InModBiome(); public bool ZoneGleamingBurrows => Player.InModBiome(); public bool ZoneBasaltGully => Player.InModBiome(); - + public bool ZoneSulphur => Player.InModBiome(); public bool ZoneAbyss => ZoneAbyssLayer1 || ZoneAbyssLayer2 || ZoneAbyssLayer3 || ZoneAbyssLayer4; public bool ZoneAbyssLayer1 => Player.InModBiome(); public bool ZoneAbyssLayer2 => Player.InModBiome(); public bool ZoneAbyssLayer3 => Player.InModBiome(); public bool ZoneAbyssLayer4 => Player.InModBiome(); - + public bool ZoneFloralParadise => Player.InModBiome(); - + public bool ZoneCalamity => Player.InModBiome(); - + public bool ZoneAstral => Player.InModBiome() && !ZoneAbyss; public bool InAnyCalamityBiome => ZoneAbyss || ZoneCalamity || ZoneFloralParadise || ZoneSulphur || ZoneSunkenSea || ZoneAstral; @@ -4168,7 +4163,7 @@ namespace CalamityMod.CalPlayer var LocketSource = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); if (item.CountsAsClass()) { - if (!CalamityLists.VeneratedLocketBanlist.Contains(item.type)) + if (!VeneratedLocketBanList.Includes(item.type)) { float veneratedCloneSpeed = item.shootSpeed; Vector2 realPlayerPos = Player.RotatedRelativePoint(Player.MountedCenter, true); diff --git a/CalamityLists.cs b/CalamityLists.cs index 2218258613..24dea356cf 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using CalamityMod.BiomeManagers; using CalamityMod.Enums; using CalamityMod.Items.DraedonMisc; -using CalamityMod.Items.Weapons.Rogue; using CalamityMod.NPCs.AquaticScourge; using CalamityMod.NPCs.AstrumAureus; using CalamityMod.NPCs.AstrumDeus; @@ -52,8 +51,6 @@ namespace CalamityMod public static List DisabledSummonerNerfItems; public static List DisabledSummonerNerfMinions; - public static List VeneratedLocketBanlist; //To ban projectiles from locket, mainly spikeballs altho Toasty asked me to add mod calls for adding stuff like Dreamtastic - /// /// Each Sunken Sea subbiome has a correspoding spawn condition boolean value and a biome type. /// @@ -61,10 +58,6 @@ namespace CalamityMod public override void OnModLoad() { - // Lists of enemies that resist piercing to some extent (mostly worms). - // Could prove useful for other things as well. - - // Collections BossRushHPChanges = new SortedDictionary { @@ -260,18 +253,6 @@ namespace CalamityMod DisabledSummonerNerfItems = new(); DisabledSummonerNerfMinions = new(); - VeneratedLocketBanlist = new List() - { - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType() - }; - SunkenSeaBiomeCorrespondentValues = new() { { SunkenSeaBiomeFlags.UndergroundDesert, (spawnInfo => spawnInfo.Player.ZoneDesert, -1 /* None needed. */) }, @@ -298,8 +279,6 @@ namespace CalamityMod DisabledSummonerNerfItems = null; DisabledSummonerNerfMinions = null; - VeneratedLocketBanlist = null; - SunkenSeaBiomeCorrespondentValues = null; } } diff --git a/ModSupport/ModCalls.cs b/ModSupport/ModCalls.cs index 934efc430c..8d056b58c5 100644 --- a/ModSupport/ModCalls.cs +++ b/ModSupport/ModCalls.cs @@ -949,9 +949,9 @@ namespace CalamityMod #region Venerated Locket Bans public static bool AddToVeneratedLocketBanlist(int type) { - if (!CalamityLists.VeneratedLocketBanlist.Contains(type)) + if (!VeneratedLocketBanList.Includes(type)) { - CalamityLists.VeneratedLocketBanlist.Add(type); + VeneratedLocketBanList.List.Add(type); return true; } return false; diff --git a/Systems/Collections/VeneratedLocketBanList.cs b/Systems/Collections/VeneratedLocketBanList.cs new file mode 100644 index 0000000000..bc241f08ac --- /dev/null +++ b/Systems/Collections/VeneratedLocketBanList.cs @@ -0,0 +1,34 @@ +using System.Collections.Generic; +using CalamityMod.Items.Weapons.Rogue; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + /// + /// To ban projectiles from locket, mainly spikeballs altho Toasty asked me to add mod calls for adding stuff like Dreamtastic + /// + public sealed class VeneratedLocketBanList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType(), + ItemType() + ]; + } + + public override void Unload() => List = null; + + public static bool Includes(int itemType) => List.Contains(itemType); + } +} From 5196c9319f2a96957f441d265bc89211b7dff060 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 20:39:22 +0900 Subject: [PATCH 109/118] DisabledSummonerNerfItemList. --- CalamityLists.cs | 3 --- ModSupport/ModCalls.cs | 8 ++++---- .../DisabledSummonerNerfItemList.cs | 19 +++++++++++++++++++ Utilities/PlayerUtils.cs | 10 +++++----- 4 files changed, 28 insertions(+), 12 deletions(-) create mode 100644 Systems/Collections/DisabledSummonerNerfItemList.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index 24dea356cf..593c5783b9 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -48,7 +48,6 @@ namespace CalamityMod public static Dictionary EncryptedSchematicIDRelationship; - public static List DisabledSummonerNerfItems; public static List DisabledSummonerNerfMinions; /// @@ -250,7 +249,6 @@ namespace CalamityMod [4] = ItemType(), }; - DisabledSummonerNerfItems = new(); DisabledSummonerNerfMinions = new(); SunkenSeaBiomeCorrespondentValues = new() @@ -276,7 +274,6 @@ namespace CalamityMod EncryptedSchematicIDRelationship = null; - DisabledSummonerNerfItems = null; DisabledSummonerNerfMinions = null; SunkenSeaBiomeCorrespondentValues = null; diff --git a/ModSupport/ModCalls.cs b/ModSupport/ModCalls.cs index 8d056b58c5..f73f654650 100644 --- a/ModSupport/ModCalls.cs +++ b/ModSupport/ModCalls.cs @@ -975,21 +975,21 @@ namespace CalamityMod } public static bool SetSummonerNerfDisabledByItem(int type, bool disableNerf) { - if (disableNerf && !CalamityLists.DisabledSummonerNerfItems.Contains(type)) + if (disableNerf && !DisabledSummonerNerfItemList.Includes(type)) { - CalamityLists.DisabledSummonerNerfItems.Add(type); + DisabledSummonerNerfItemList.List.Add(type); return true; } else if (!disableNerf) { - return CalamityLists.DisabledSummonerNerfItems.Remove(type); + return DisabledSummonerNerfItemList.List.Remove(type); } return false; } public static bool GetSummonerNerfDisabledByMinion(int type) => CalamityLists.DisabledSummonerNerfMinions.Contains(type); - public static bool GetSummonerNerfDisabledByItem(int type) => CalamityLists.DisabledSummonerNerfItems.Contains(type); + public static bool GetSummonerNerfDisabledByItem(int type) => DisabledSummonerNerfItemList.Includes(type); #endregion #region Debuff Display support diff --git a/Systems/Collections/DisabledSummonerNerfItemList.cs b/Systems/Collections/DisabledSummonerNerfItemList.cs new file mode 100644 index 0000000000..0f312357da --- /dev/null +++ b/Systems/Collections/DisabledSummonerNerfItemList.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + public sealed class DisabledSummonerNerfItemList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = []; + } + + public override void Unload() => List = null; + + public static bool Includes(int itemType) => List.Contains(itemType); + } +} diff --git a/Utilities/PlayerUtils.cs b/Utilities/PlayerUtils.cs index 0cf1ed5df5..30ca104077 100644 --- a/Utilities/PlayerUtils.cs +++ b/Utilities/PlayerUtils.cs @@ -4,18 +4,18 @@ using System.Reflection; using CalamityMod.Balancing; using CalamityMod.CalPlayer; using CalamityMod.Cooldowns; +using CalamityMod.Enums; using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.Systems.Collections; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.Events; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Enums; using static Terraria.Player; -using CalamityMod.Systems.Collections; namespace CalamityMod { @@ -432,7 +432,7 @@ namespace CalamityMod public static int GetExtraHitIFrames(this Player player, HurtInfo hurtInfo) { CalamityPlayer modPlayer = player.Calamity(); - + int extraIFrames = 0; if (modPlayer.godSlayerThrowing && hurtInfo.Damage > 80) extraIFrames += 30; @@ -881,7 +881,7 @@ namespace CalamityMod /// The player using the holdout. /// Returns if the player CAN'T use the item. public static bool CantUseHoldout(this Player player, bool needsToHold = true) => player == null || !player.active || player.dead || (!player.channel && needsToHold) || player.CCed || player.noItems; - + /// /// A shorthand bool to check if the held item should trigger Calamity's summon damage penalty. /// @@ -909,7 +909,7 @@ namespace CalamityMod bool heldItemIsTool = (item.pick > 0 || item.axe > 0 || item.hammer > 0) && !BlacklistedWeaponsWithToolPowerList.IsBlacklistedItem(item); bool heldItemCanBeUsed = item.useStyle != ItemUseStyleID.None; bool heldItemIsAccessoryOrAmmo = item.accessory || item.ammo != AmmoID.None; - bool heldItemIsExcludedByModCall = CalamityLists.DisabledSummonerNerfItems.Contains(item.type); + bool heldItemIsExcludedByModCall = DisabledSummonerNerfItemList.Includes(item.type); if (heldItemIsClassedWeapon && heldItemCanBeUsed && !heldItemIsTool && !heldItemIsAccessoryOrAmmo && !heldItemIsExcludedByModCall) return true; From 4d74e9769e408dddc6bcbb34b873da33ebab000d Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 20:41:44 +0900 Subject: [PATCH 110/118] DisabledSummonerNerfMinionList --- CalPlayer/CalamityPlayerHitHurt.cs | 16 ++++------------ CalamityLists.cs | 6 ------ ModSupport/ModCalls.cs | 8 ++++---- .../DisabledSummonerNerfMinionList.cs | 19 +++++++++++++++++++ 4 files changed, 27 insertions(+), 22 deletions(-) create mode 100644 Systems/Collections/DisabledSummonerNerfMinionList.cs diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index 0e7913bae3..ff8423717a 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Linq; using CalamityMod.Balancing; using CalamityMod.Buffs.Cooldowns; @@ -25,20 +24,14 @@ using CalamityMod.Items.Potions; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.Tools; using CalamityMod.Items.VanillaArmorChanges; -using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.Items.Weapons.Melee; using CalamityMod.NPCs; -using CalamityMod.NPCs.Abyss; using CalamityMod.NPCs.Cryogen; -using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.Other; using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.NPCs.Providence; -using CalamityMod.NPCs.SunkenSea; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.Particles; -using CalamityMod.Projectiles.Boss; -using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Typeless; @@ -50,7 +43,6 @@ using Terraria; using Terraria.Audio; using Terraria.Chat; using Terraria.DataStructures; -using Terraria.Graphics.Renderers; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.Localization; @@ -698,7 +690,7 @@ namespace CalamityMod.CalPlayer { Item heldItem = Player.ActiveItem(); - if (CalamityUtils.ShouldTriggerSummonPenalty(Player, heldItem) && !CalamityLists.DisabledSummonerNerfMinions.Contains(proj.type)) + if (CalamityUtils.ShouldTriggerSummonPenalty(Player, heldItem) && !DisabledSummonerNerfMinionList.Includes(proj.type)) modifiers.FinalDamage *= BalancingConstants.SummonerCrossClassNerf; } } @@ -1625,7 +1617,7 @@ namespace CalamityMod.CalPlayer { double maxCooldownDurationDamagePercent = 0.5; int maxCooldownDurationDamageValue = (int)Math.Round(Player.statLifeMax2 * (maxCooldownDurationDamagePercent - dodgeDamageGateValuePercent)); - + // Just in case... if (maxCooldownDurationDamageValue <= 0) maxCooldownDurationDamageValue = 1; @@ -2459,7 +2451,7 @@ namespace CalamityMod.CalPlayer if (Player.ownedProjectileCounts[ModContent.ProjectileType()] != 0) { - foreach(Projectile p in Main.ActiveProjectiles) + foreach (Projectile p in Main.ActiveProjectiles) { if (p.type == ModContent.ProjectileType() && p.owner == Player.whoAmI) { @@ -2934,7 +2926,7 @@ namespace CalamityMod.CalPlayer bool externalFlagsAppropriate = !CalamityMod.ExternalFlag_DisableDefenseDamage && !externalDefenseDamageImmunity; if (!externalFlagsAppropriate) return; - + // Can be dynamically reduced by Adamantite set bonus and maybe other future effects. int defenseDamageTaken = defenseDamage; diff --git a/CalamityLists.cs b/CalamityLists.cs index 593c5783b9..aa39ca987e 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -48,8 +48,6 @@ namespace CalamityMod public static Dictionary EncryptedSchematicIDRelationship; - public static List DisabledSummonerNerfMinions; - /// /// Each Sunken Sea subbiome has a correspoding spawn condition boolean value and a biome type. /// @@ -249,8 +247,6 @@ namespace CalamityMod [4] = ItemType(), }; - DisabledSummonerNerfMinions = new(); - SunkenSeaBiomeCorrespondentValues = new() { { SunkenSeaBiomeFlags.UndergroundDesert, (spawnInfo => spawnInfo.Player.ZoneDesert, -1 /* None needed. */) }, @@ -274,8 +270,6 @@ namespace CalamityMod EncryptedSchematicIDRelationship = null; - DisabledSummonerNerfMinions = null; - SunkenSeaBiomeCorrespondentValues = null; } } diff --git a/ModSupport/ModCalls.cs b/ModSupport/ModCalls.cs index f73f654650..0832793e0c 100644 --- a/ModSupport/ModCalls.cs +++ b/ModSupport/ModCalls.cs @@ -961,14 +961,14 @@ namespace CalamityMod #region Summoner Cross Class Nerf Disabling public static bool SetSummonerNerfDisabledByMinion(int type, bool disableNerf) { - if (disableNerf && !CalamityLists.DisabledSummonerNerfMinions.Contains(type)) + if (disableNerf && !DisabledSummonerNerfMinionList.Includes(type)) { - CalamityLists.DisabledSummonerNerfMinions.Add(type); + DisabledSummonerNerfMinionList.List.Add(type); return true; } else if (!disableNerf) { - return CalamityLists.DisabledSummonerNerfMinions.Remove(type); + return DisabledSummonerNerfMinionList.List.Remove(type); } return false; @@ -988,7 +988,7 @@ namespace CalamityMod return false; } - public static bool GetSummonerNerfDisabledByMinion(int type) => CalamityLists.DisabledSummonerNerfMinions.Contains(type); + public static bool GetSummonerNerfDisabledByMinion(int type) => DisabledSummonerNerfMinionList.Includes(type); public static bool GetSummonerNerfDisabledByItem(int type) => DisabledSummonerNerfItemList.Includes(type); #endregion diff --git a/Systems/Collections/DisabledSummonerNerfMinionList.cs b/Systems/Collections/DisabledSummonerNerfMinionList.cs new file mode 100644 index 0000000000..48a47c670b --- /dev/null +++ b/Systems/Collections/DisabledSummonerNerfMinionList.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + public sealed class DisabledSummonerNerfMinionList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = []; + } + + public override void Unload() => List = null; + + public static bool Includes(int projType) => List.Contains(projType); + } +} From ac4c79978778cb9640b9c9b703be818e43a47493 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 20:47:15 +0900 Subject: [PATCH 111/118] BossRushHPChangeDict. OZZ EDIT: Queen Slime health 150,000 -> 200,000 --- CalamityLists.cs | 109 --------------- NPCs/CalamityGlobalNPC.cs | 2 +- .../Collections/NPCs/BossRushHPChangeDict.cs | 125 ++++++++++++++++++ 3 files changed, 126 insertions(+), 110 deletions(-) create mode 100644 Systems/Collections/NPCs/BossRushHPChangeDict.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index aa39ca987e..8367f37190 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -20,7 +20,6 @@ using CalamityMod.NPCs.ExoMechs.Artemis; using CalamityMod.NPCs.ExoMechs.Thanatos; using CalamityMod.NPCs.HiveMind; using CalamityMod.NPCs.Leviathan; -using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.OldDuke; using CalamityMod.NPCs.Perforator; using CalamityMod.NPCs.PlaguebringerGoliath; @@ -42,7 +41,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static SortedDictionary BossRushHPChanges; public static SortedDictionary BossValues; public static SortedDictionary bossTypes; @@ -55,110 +53,6 @@ namespace CalamityMod public override void OnModLoad() { - // Collections - BossRushHPChanges = new SortedDictionary - { - // Tier 1 - { NPCID.KingSlime, 300000 }, // 30 seconds - { NPCID.BlueSlime, 3600 }, - { NPCID.SlimeSpiked, 7200 }, - { NPCID.GreenSlime, 2700 }, - { NPCID.RedSlime, 5400 }, - { NPCID.PurpleSlime, 7200 }, - { NPCID.YellowSlime, 6300 }, - { NPCID.IceSlime, 4500 }, - { NPCID.UmbrellaSlime, 5400 }, - { NPCID.RainbowSlime, 30000 }, - { NPCID.Pinky, 15000 }, - { NPCType(), 21000 }, - { NPCType(), 18000 }, - { NPCType(), 24000 }, - - { NPCID.EyeofCthulhu, 450000 }, // 30 seconds - { NPCID.ServantofCthulhu, 6000 }, - { NPCType(), 12000 }, - - { NPCID.EaterofWorldsHead, 10000 }, // 30 seconds + immunity timer at start - { NPCID.EaterofWorldsBody, 10000 }, - { NPCID.EaterofWorldsTail, 10000 }, - - { NPCID.BrainofCthulhu, 100000 }, // 30 seconds with creepers - { NPCID.Creeper, 10000 }, - - { NPCID.QueenBee, 315000 }, // 30 seconds - { NPCID.Bee, 3000 }, - { NPCID.BeeSmall, 2000 }, - { NPCID.BigHornetHoney, 10000 }, - { NPCID.HornetHoney, 7500 }, - { NPCID.LittleHornetHoney, 5000 }, - - { NPCID.Deerclops, 315000 }, // 30 seconds - - { NPCID.SkeletronHead, 150000 }, // 30 seconds - { NPCID.SkeletronHand, 60000 }, - - { NPCID.WallofFlesh, 450000 }, // 30 seconds - { NPCID.WallofFleshEye, 450000 }, - { NPCID.TheHungry, 10000 }, - { NPCID.TheHungryII, 5000 }, - { NPCID.LeechHead, 5000 }, - { NPCID.LeechBody, 5000 }, - { NPCID.LeechTail, 5000 }, - - // Tier 2 - { NPCID.QueenSlimeBoss, 200000 }, // 30 seconds - { NPCID.QueenSlimeMinionBlue, 6000 }, - { NPCID.QueenSlimeMinionPink, 6000 }, - { NPCID.QueenSlimeMinionPurple, 5000 }, - - { NPCID.Spazmatism, 150000 }, // 30 seconds - { NPCID.Retinazer, 125000 }, - { NPCType(), 137500 }, - - { NPCID.TheDestroyer, 250000 }, // 30 seconds + immunity timer at start - { NPCID.TheDestroyerBody, 250000 }, - { NPCID.TheDestroyerTail, 250000 }, - { NPCID.Probe, 5000 }, - - { NPCID.SkeletronPrime, 160000 }, // 30 seconds - { NPCType(), 160000 }, - { NPCID.PrimeVice, 54000 }, - { NPCID.PrimeCannon, 45000 }, - { NPCID.PrimeSaw, 45000 }, - { NPCID.PrimeLaser, 38000 }, - - { NPCID.Plantera, 160000 }, // 30 seconds - { NPCID.PlanterasTentacle, 5000 }, - { NPCType(), 5000 }, - - // Tier 3 - { NPCID.Golem, 50000 }, // 30 seconds - { NPCID.GolemHead, 30000 }, - { NPCID.GolemHeadFree, 30000 }, - { NPCID.GolemFistLeft, 25000 }, - { NPCID.GolemFistRight, 25000 }, - - { NPCID.HallowBoss, 200000 }, // 30 seconds - - { NPCID.DukeFishron, 290000 }, // 30 seconds - - { NPCID.CultistBoss, 220000 }, // 30 seconds - { NPCID.CultistDragonHead, 60000 }, - { NPCID.CultistDragonBody1, 60000 }, - { NPCID.CultistDragonBody2, 60000 }, - { NPCID.CultistDragonBody3, 60000 }, - { NPCID.CultistDragonBody4, 60000 }, - { NPCID.CultistDragonTail, 60000 }, - { NPCID.AncientCultistSquidhead, 50000 }, - - { NPCID.MoonLordCore, 160000 }, // 1 minute - { NPCID.MoonLordHand, 45000 }, - { NPCID.MoonLordHead, 60000 }, - { NPCID.MoonLordLeechBlob, 800 } - - // 9.5 minutes in total for vanilla Boss Rush bosses - }; - // NOTE: This does not account for Calamity's base value increases BossValues = new SortedDictionary { @@ -260,9 +154,6 @@ namespace CalamityMod public override void Unload() { - - BossRushHPChanges?.Clear(); - BossRushHPChanges = null; BossValues?.Clear(); BossValues = null; bossTypes?.Clear(); diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index dd2ea4d266..c6520a5dd0 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -1661,7 +1661,7 @@ namespace CalamityMod.NPCs #region Boss Rush Stat Changes private void BossRushStatChanges(NPC npc, Mod mod) { - foreach (KeyValuePair BossRushHPChange in CalamityLists.BossRushHPChanges) + foreach (var BossRushHPChange in BossRushHPChangeDict.Dict) { if (npc.type == BossRushHPChange.Key) { diff --git a/Systems/Collections/NPCs/BossRushHPChangeDict.cs b/Systems/Collections/NPCs/BossRushHPChangeDict.cs new file mode 100644 index 0000000000..164dfb5d44 --- /dev/null +++ b/Systems/Collections/NPCs/BossRushHPChangeDict.cs @@ -0,0 +1,125 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.NormalNPCs; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class BossRushHPChangeDict : ModSystem + { + public static IDictionary Dict { get; private set; } + + public override void OnModLoad() + { + Dict = new Dictionary + { + // Tier 1 + { NPCID.KingSlime, 300000 }, // 30 seconds + { NPCID.BlueSlime, 3600 }, + { NPCID.SlimeSpiked, 7200 }, + { NPCID.GreenSlime, 2700 }, + { NPCID.RedSlime, 5400 }, + { NPCID.PurpleSlime, 7200 }, + { NPCID.YellowSlime, 6300 }, + { NPCID.IceSlime, 4500 }, + { NPCID.UmbrellaSlime, 5400 }, + { NPCID.RainbowSlime, 30000 }, + { NPCID.Pinky, 15000 }, + { NPCType(), 21000 }, + { NPCType(), 18000 }, + { NPCType(), 24000 }, + + { NPCID.EyeofCthulhu, 450000 }, // 30 seconds + { NPCID.ServantofCthulhu, 6000 }, + { NPCType(), 12000 }, + + { NPCID.EaterofWorldsHead, 10000 }, // 30 seconds + immunity timer at start + { NPCID.EaterofWorldsBody, 10000 }, + { NPCID.EaterofWorldsTail, 10000 }, + + { NPCID.BrainofCthulhu, 100000 }, // 30 seconds with creepers + { NPCID.Creeper, 10000 }, + + { NPCID.QueenBee, 315000 }, // 30 seconds + { NPCID.Bee, 3000 }, + { NPCID.BeeSmall, 2000 }, + { NPCID.BigHornetHoney, 10000 }, + { NPCID.HornetHoney, 7500 }, + { NPCID.LittleHornetHoney, 5000 }, + + { NPCID.Deerclops, 315000 }, // 30 seconds + + { NPCID.SkeletronHead, 150000 }, // 30 seconds + { NPCID.SkeletronHand, 60000 }, + + { NPCID.WallofFlesh, 450000 }, // 30 seconds + { NPCID.WallofFleshEye, 450000 }, + { NPCID.TheHungry, 10000 }, + { NPCID.TheHungryII, 5000 }, + { NPCID.LeechHead, 5000 }, + { NPCID.LeechBody, 5000 }, + { NPCID.LeechTail, 5000 }, + + // Tier 2 + { NPCID.QueenSlimeBoss, 200000 }, // 30 seconds + { NPCID.QueenSlimeMinionBlue, 6000 }, + { NPCID.QueenSlimeMinionPink, 6000 }, + { NPCID.QueenSlimeMinionPurple, 5000 }, + + { NPCID.Spazmatism, 150000 }, // 30 seconds + { NPCID.Retinazer, 125000 }, + { NPCType(), 137500 }, + + { NPCID.TheDestroyer, 250000 }, // 30 seconds + immunity timer at start + { NPCID.TheDestroyerBody, 250000 }, + { NPCID.TheDestroyerTail, 250000 }, + { NPCID.Probe, 5000 }, + + { NPCID.SkeletronPrime, 160000 }, // 30 seconds + { NPCType(), 160000 }, + { NPCID.PrimeVice, 54000 }, + { NPCID.PrimeCannon, 45000 }, + { NPCID.PrimeSaw, 45000 }, + { NPCID.PrimeLaser, 38000 }, + + { NPCID.Plantera, 160000 }, // 30 seconds + { NPCID.PlanterasTentacle, 5000 }, + { NPCType(), 5000 }, + + // Tier 3 + { NPCID.Golem, 50000 }, // 30 seconds + { NPCID.GolemHead, 30000 }, + { NPCID.GolemHeadFree, 30000 }, + { NPCID.GolemFistLeft, 25000 }, + { NPCID.GolemFistRight, 25000 }, + + { NPCID.HallowBoss, 200000 }, // 30 seconds + + { NPCID.DukeFishron, 290000 }, // 30 seconds + + { NPCID.CultistBoss, 220000 }, // 30 seconds + { NPCID.CultistDragonHead, 60000 }, + { NPCID.CultistDragonBody1, 60000 }, + { NPCID.CultistDragonBody2, 60000 }, + { NPCID.CultistDragonBody3, 60000 }, + { NPCID.CultistDragonBody4, 60000 }, + { NPCID.CultistDragonTail, 60000 }, + { NPCID.AncientCultistSquidhead, 50000 }, + + { NPCID.MoonLordCore, 160000 }, // 1 minute + { NPCID.MoonLordHand, 45000 }, + { NPCID.MoonLordHead, 60000 }, + { NPCID.MoonLordLeechBlob, 800 } + + // 9.5 minutes in total for vanilla Boss Rush bosses + }; + } + + public override void Unload() + { + Dict?.Clear(); + Dict = null; + } + } +} From b603117a57e8ddd482df18f5bace47e79b7332b3 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 20:54:05 +0900 Subject: [PATCH 112/118] BossValueDict. --- CalamityLists.cs | 27 ---------- NPCs/CalamityGlobalNPC.cs | 16 ++---- .../Collections/NPCs/BossRushHPChangeDict.cs | 5 ++ Systems/Collections/NPCs/BossValueDict.cs | 49 +++++++++++++++++++ 4 files changed, 58 insertions(+), 39 deletions(-) create mode 100644 Systems/Collections/NPCs/BossValueDict.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index 8367f37190..37bd1162d4 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -32,7 +32,6 @@ using CalamityMod.NPCs.SlimeGod; using CalamityMod.NPCs.StormWeaver; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs.Yharon; -using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -41,7 +40,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static SortedDictionary BossValues; public static SortedDictionary bossTypes; public static Dictionary EncryptedSchematicIDRelationship; @@ -53,29 +51,6 @@ namespace CalamityMod public override void OnModLoad() { - // NOTE: This does not account for Calamity's base value increases - BossValues = new SortedDictionary - { - { NPCID.KingSlime, Item.buyPrice(0, 2) }, - { NPCID.EyeofCthulhu, Item.buyPrice(0, 2) }, - // Evil bosses drop 5 gold in vanilla; unmodified - { NPCID.QueenBee, Item.buyPrice(0, 8) }, - { NPCID.Deerclops, Item.buyPrice(0, 8) }, - { NPCID.SkeletronHead, Item.buyPrice(0, 12) }, - { NPCID.WallofFlesh, Item.buyPrice(0, 12) }, - { NPCID.QueenSlimeBoss, Item.buyPrice(0, 16) }, - { NPCID.Spazmatism, Item.buyPrice(0, 16) }, - { NPCID.Retinazer, Item.buyPrice(0, 16) }, - { NPCID.TheDestroyer, Item.buyPrice(0, 16) }, - { NPCID.SkeletronPrime, Item.buyPrice(0, 16) }, - { NPCID.Plantera, Item.buyPrice(0, 20) }, - { NPCID.Golem, Item.buyPrice(0, 25) }, - { NPCID.HallowBoss, Item.buyPrice(0, 30) }, - { NPCID.DukeFishron, Item.buyPrice(0, 30) }, - { NPCID.CultistBoss, Item.buyPrice(0, 50) } - // Moon Lord drops 1 plat in vanilla; unmodified - }; - bossTypes = new SortedDictionary() { { NPCID.KingSlime, 1 }, @@ -154,8 +129,6 @@ namespace CalamityMod public override void Unload() { - BossValues?.Clear(); - BossValues = null; bossTypes?.Clear(); bossTypes = null; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index c6520a5dd0..cd46825be7 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -1661,13 +1661,9 @@ namespace CalamityMod.NPCs #region Boss Rush Stat Changes private void BossRushStatChanges(NPC npc, Mod mod) { - foreach (var BossRushHPChange in BossRushHPChangeDict.Dict) + if (BossRushHPChangeDict.TryGet(npc.type, out var newHP)) { - if (npc.type == BossRushHPChange.Key) - { - npc.lifeMax = BossRushHPChange.Value; - break; - } + npc.lifeMax = newHP; } } #endregion @@ -1675,13 +1671,9 @@ namespace CalamityMod.NPCs #region Boss Value Changes private void BossValueChanges(NPC npc) { - foreach (KeyValuePair BossValue in CalamityLists.BossValues) + if (BossValueDict.TryGet(npc.type, out var value)) { - if (npc.type == BossValue.Key) - { - npc.value = BossValue.Value; - break; - } + npc.value = value; } } #endregion diff --git a/Systems/Collections/NPCs/BossRushHPChangeDict.cs b/Systems/Collections/NPCs/BossRushHPChangeDict.cs index 164dfb5d44..d55122244f 100644 --- a/Systems/Collections/NPCs/BossRushHPChangeDict.cs +++ b/Systems/Collections/NPCs/BossRushHPChangeDict.cs @@ -121,5 +121,10 @@ namespace CalamityMod.Systems.Collections Dict?.Clear(); Dict = null; } + + public static bool TryGet(int npcType, out int newHP) + { + return Dict.TryGetValue(npcType, out newHP); + } } } diff --git a/Systems/Collections/NPCs/BossValueDict.cs b/Systems/Collections/NPCs/BossValueDict.cs new file mode 100644 index 0000000000..43b450ad80 --- /dev/null +++ b/Systems/Collections/NPCs/BossValueDict.cs @@ -0,0 +1,49 @@ +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Collections +{ + public sealed class BossValueDict : ModSystem + { + public static IDictionary Dict { get; private set; } + + public override void OnModLoad() + { + // NOTE: This does not account for Calamity's base value increases + Dict = new SortedDictionary + { + { NPCID.KingSlime, Item.buyPrice(0, 2) }, + { NPCID.EyeofCthulhu, Item.buyPrice(0, 2) }, + // Evil bosses drop 5 gold in vanilla; unmodified + { NPCID.QueenBee, Item.buyPrice(0, 8) }, + { NPCID.Deerclops, Item.buyPrice(0, 8) }, + { NPCID.SkeletronHead, Item.buyPrice(0, 12) }, + { NPCID.WallofFlesh, Item.buyPrice(0, 12) }, + { NPCID.QueenSlimeBoss, Item.buyPrice(0, 16) }, + { NPCID.Spazmatism, Item.buyPrice(0, 16) }, + { NPCID.Retinazer, Item.buyPrice(0, 16) }, + { NPCID.TheDestroyer, Item.buyPrice(0, 16) }, + { NPCID.SkeletronPrime, Item.buyPrice(0, 16) }, + { NPCID.Plantera, Item.buyPrice(0, 20) }, + { NPCID.Golem, Item.buyPrice(0, 25) }, + { NPCID.HallowBoss, Item.buyPrice(0, 30) }, + { NPCID.DukeFishron, Item.buyPrice(0, 30) }, + { NPCID.CultistBoss, Item.buyPrice(0, 50) } + // Moon Lord drops 1 plat in vanilla; unmodified + }; + } + + public override void Unload() + { + Dict?.Clear(); + Dict = null; + } + + public static bool TryGet(int npcType, out int value) + { + return Dict.TryGetValue(npcType, out value); + } + } +} From 0e094e8234d378bab2d2be9bcea8bb3247b5df64 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 21:25:23 +0900 Subject: [PATCH 113/118] BossTypeDict and EncryptedSchematicIDRelationshipDict --- CalamityLists.cs | 105 ---------------- NPCs/CalamityGlobalNPC.cs | 2 +- .../EncryptedSchematicIDRelationshipDict.cs | 52 ++++++++ Systems/Collections/NPCs/BossTypeDict.cs | 112 ++++++++++++++++++ TileEntities/TECodebreaker.cs | 52 ++++---- UI/DraedonSummoning/CodebreakerUI.cs | 27 +++-- 6 files changed, 206 insertions(+), 144 deletions(-) create mode 100644 Systems/Collections/EncryptedSchematicIDRelationshipDict.cs create mode 100644 Systems/Collections/NPCs/BossTypeDict.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index 37bd1162d4..a93774f121 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -2,37 +2,6 @@ using System.Collections.Generic; using CalamityMod.BiomeManagers; using CalamityMod.Enums; -using CalamityMod.Items.DraedonMisc; -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.Crabulon; -using CalamityMod.NPCs.Cryogen; -using CalamityMod.NPCs.DesertScourge; -using CalamityMod.NPCs.DevourerofGods; -using CalamityMod.NPCs.ExoMechs.Apollo; -using CalamityMod.NPCs.ExoMechs.Ares; -using CalamityMod.NPCs.ExoMechs.Artemis; -using CalamityMod.NPCs.ExoMechs.Thanatos; -using CalamityMod.NPCs.HiveMind; -using CalamityMod.NPCs.Leviathan; -using CalamityMod.NPCs.OldDuke; -using CalamityMod.NPCs.Perforator; -using CalamityMod.NPCs.PlaguebringerGoliath; -using CalamityMod.NPCs.Polterghast; -using CalamityMod.NPCs.ProfanedGuardians; -using CalamityMod.NPCs.Providence; -using CalamityMod.NPCs.Ravager; -using CalamityMod.NPCs.Signus; -using CalamityMod.NPCs.SlimeGod; -using CalamityMod.NPCs.StormWeaver; -using CalamityMod.NPCs.SupremeCalamitas; -using CalamityMod.NPCs.Yharon; -using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -40,10 +9,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - public static SortedDictionary bossTypes; - - public static Dictionary EncryptedSchematicIDRelationship; - /// /// Each Sunken Sea subbiome has a correspoding spawn condition boolean value and a biome type. /// @@ -51,71 +16,6 @@ namespace CalamityMod public override void OnModLoad() { - bossTypes = new SortedDictionary() - { - { NPCID.KingSlime, 1 }, - { NPCType(), 2 }, - { NPCID.EyeofCthulhu, 3 }, - { NPCType(), 4 }, - { NPCID.EaterofWorldsHead, 5 }, - { NPCID.EaterofWorldsBody, 5 }, - { NPCID.EaterofWorldsTail, 5 }, - { NPCID.BrainofCthulhu, 6 }, - { NPCType(), 7 }, - { NPCType(), 8 }, - { NPCID.QueenBee, 9 }, - { NPCID.SkeletronHead, 10 }, - { NPCType(), 11 }, - { NPCType(), 11 }, - { NPCType(), 11 }, - { NPCID.WallofFlesh, 12 }, - { NPCType(), 13 }, - { NPCID.Retinazer, 14 }, - { NPCID.Spazmatism, 14 }, - { NPCType(), 15 }, - { NPCID.TheDestroyer, 16 }, - { NPCType(), 17 }, - { NPCID.SkeletronPrime, 18 }, - { NPCType(), 19 }, - { NPCID.Plantera, 20 }, - { NPCType(), 21 }, - { NPCType(), 21 }, - { NPCType(), 22 }, - { NPCID.Golem, 23 }, - { NPCType(), 24 }, - { NPCID.DukeFishron, 25 }, - { NPCType(), 26 }, - { NPCID.CultistBoss, 27 }, - { NPCType(), 28 }, - { NPCID.MoonLordCore, 29 }, - { NPCType(), 30 }, - { NPCType(), 31 }, - { NPCType(), 32 }, - { NPCType(), 33 }, - { NPCType(), 34 }, - { NPCType(), 35 }, - { NPCType(), 36 }, - { NPCType(), 37 }, - { NPCType(), 38 }, - { NPCType(), 39 }, - { NPCType(), 40 }, - { NPCType(), 41 }, - { NPCType(), 41 }, - { NPCType(), 41 }, - { NPCType(), 41 }, - { NPCID.QueenSlimeBoss, 42 }, - { NPCID.HallowBoss, 43 }, - { NPCID.Deerclops, 44 } - }; - - EncryptedSchematicIDRelationship = new Dictionary() - { - [1] = ItemType(), - [2] = ItemType(), - [3] = ItemType(), - [4] = ItemType(), - }; - SunkenSeaBiomeCorrespondentValues = new() { { SunkenSeaBiomeFlags.UndergroundDesert, (spawnInfo => spawnInfo.Player.ZoneDesert, -1 /* None needed. */) }, @@ -129,11 +29,6 @@ namespace CalamityMod public override void Unload() { - bossTypes?.Clear(); - bossTypes = null; - - EncryptedSchematicIDRelationship = null; - SunkenSeaBiomeCorrespondentValues = null; } } diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index cd46825be7..936c08ddbe 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -8637,7 +8637,7 @@ namespace CalamityMod.NPCs { if (!GetDownedBossVariable(npc.type)) { - CalamityLists.bossTypes.TryGetValue(npc.type, out int newBossTypeJustDowned); + BossTypeDict.TryGet(npc.type, out int newBossTypeJustDowned); for (int i = 0; i < Main.maxPlayers; i++) { diff --git a/Systems/Collections/EncryptedSchematicIDRelationshipDict.cs b/Systems/Collections/EncryptedSchematicIDRelationshipDict.cs new file mode 100644 index 0000000000..216b4a70e9 --- /dev/null +++ b/Systems/Collections/EncryptedSchematicIDRelationshipDict.cs @@ -0,0 +1,52 @@ +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Items.DraedonMisc; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class EncryptedSchematicIDRelationshipDict : ModSystem + { + public static IDictionary Dict { get; private set; } + + public override void OnModLoad() + { + var dict = new Dictionary() + { + [1] = ItemType(), + [2] = ItemType(), + [3] = ItemType(), + [4] = ItemType(), + }; + + Dict = dict; + } + + public override void Unload() + { + Dict?.Clear(); + Dict = null; + } + + public static bool TryGet(int schematicID, out int schematicItemType) + { + return Dict.TryGetValue(schematicID, out schematicItemType); + } + + public static bool TryGetKey(int schematicItemType, out int schematicID) + { + try + { + var pair = Dict.First(pair => pair.Value == schematicItemType); + schematicID = pair.Key; + return true; + } + catch + { + schematicID = 0; + return false; + } + } + } +} diff --git a/Systems/Collections/NPCs/BossTypeDict.cs b/Systems/Collections/NPCs/BossTypeDict.cs new file mode 100644 index 0000000000..20ddc6d87e --- /dev/null +++ b/Systems/Collections/NPCs/BossTypeDict.cs @@ -0,0 +1,112 @@ +using System.Collections.Generic; +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.Crabulon; +using CalamityMod.NPCs.Cryogen; +using CalamityMod.NPCs.DesertScourge; +using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.ExoMechs.Apollo; +using CalamityMod.NPCs.ExoMechs.Ares; +using CalamityMod.NPCs.ExoMechs.Artemis; +using CalamityMod.NPCs.ExoMechs.Thanatos; +using CalamityMod.NPCs.HiveMind; +using CalamityMod.NPCs.Leviathan; +using CalamityMod.NPCs.OldDuke; +using CalamityMod.NPCs.Perforator; +using CalamityMod.NPCs.PlaguebringerGoliath; +using CalamityMod.NPCs.Polterghast; +using CalamityMod.NPCs.ProfanedGuardians; +using CalamityMod.NPCs.Providence; +using CalamityMod.NPCs.Ravager; +using CalamityMod.NPCs.Signus; +using CalamityMod.NPCs.SlimeGod; +using CalamityMod.NPCs.StormWeaver; +using CalamityMod.NPCs.SupremeCalamitas; +using CalamityMod.NPCs.Yharon; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class BossTypeDict : ModSystem + { + public static IDictionary Dict { get; private set; } + + public override void OnModLoad() + { + Dict = new SortedDictionary() + { + { NPCID.KingSlime, 1 }, + { NPCType(), 2 }, + { NPCID.EyeofCthulhu, 3 }, + { NPCType(), 4 }, + { NPCID.EaterofWorldsHead, 5 }, + { NPCID.EaterofWorldsBody, 5 }, + { NPCID.EaterofWorldsTail, 5 }, + { NPCID.BrainofCthulhu, 6 }, + { NPCType(), 7 }, + { NPCType(), 8 }, + { NPCID.QueenBee, 9 }, + { NPCID.SkeletronHead, 10 }, + { NPCType(), 11 }, + { NPCType(), 11 }, + { NPCType(), 11 }, + { NPCID.WallofFlesh, 12 }, + { NPCType(), 13 }, + { NPCID.Retinazer, 14 }, + { NPCID.Spazmatism, 14 }, + { NPCType(), 15 }, + { NPCID.TheDestroyer, 16 }, + { NPCType(), 17 }, + { NPCID.SkeletronPrime, 18 }, + { NPCType(), 19 }, + { NPCID.Plantera, 20 }, + { NPCType(), 21 }, + { NPCType(), 21 }, + { NPCType(), 22 }, + { NPCID.Golem, 23 }, + { NPCType(), 24 }, + { NPCID.DukeFishron, 25 }, + { NPCType(), 26 }, + { NPCID.CultistBoss, 27 }, + { NPCType(), 28 }, + { NPCID.MoonLordCore, 29 }, + { NPCType(), 30 }, + { NPCType(), 31 }, + { NPCType(), 32 }, + { NPCType(), 33 }, + { NPCType(), 34 }, + { NPCType(), 35 }, + { NPCType(), 36 }, + { NPCType(), 37 }, + { NPCType(), 38 }, + { NPCType(), 39 }, + { NPCType(), 40 }, + { NPCType(), 41 }, + { NPCType(), 41 }, + { NPCType(), 41 }, + { NPCType(), 41 }, + { NPCID.QueenSlimeBoss, 42 }, + { NPCID.HallowBoss, 43 }, + { NPCID.Deerclops, 44 } + }; + } + + public override void Unload() + { + Dict?.Clear(); + Dict = null; + } + + public static bool TryGet(int npcType, out int type) + { + return Dict.TryGetValue(npcType, out type); + } + } +} diff --git a/TileEntities/TECodebreaker.cs b/TileEntities/TECodebreaker.cs index dedeb3ed1b..892883f846 100644 --- a/TileEntities/TECodebreaker.cs +++ b/TileEntities/TECodebreaker.cs @@ -3,6 +3,7 @@ using CalamityMod.CustomRecipes; using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Materials; using CalamityMod.Packets; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.DraedonSummoner; using Microsoft.Xna.Framework; using Terraria; @@ -39,17 +40,16 @@ namespace CalamityMod.TileEntities get { // You can't decrypt nothing. - if (HeldSchematicID == 0 || !CalamityLists.EncryptedSchematicIDRelationship.ContainsKey(HeldSchematicID)) + if (HeldSchematicID == 0 || !EncryptedSchematicIDRelationshipDict.TryGet(HeldSchematicID, out var schematicItemType)) return 0; - int schematicType = CalamityLists.EncryptedSchematicIDRelationship[HeldSchematicID]; - if (schematicType == ModContent.ItemType()) + if (schematicItemType == ModContent.ItemType()) return 500; - if (schematicType == ModContent.ItemType()) + if (schematicItemType == ModContent.ItemType()) return 950; - if (schematicType == ModContent.ItemType()) + if (schematicItemType == ModContent.ItemType()) return 1750; - if (schematicType == ModContent.ItemType()) + if (schematicItemType == ModContent.ItemType()) return 5000; return 0; @@ -72,17 +72,16 @@ namespace CalamityMod.TileEntities get { // You can't decrypt nothing. - if (HeldSchematicID == 0 || !CalamityLists.EncryptedSchematicIDRelationship.ContainsKey(HeldSchematicID)) + if (HeldSchematicID == 0 || !EncryptedSchematicIDRelationshipDict.TryGet(HeldSchematicID, out var schematicItemType)) return false; - int schematicType = CalamityLists.EncryptedSchematicIDRelationship[HeldSchematicID]; - if (schematicType == ModContent.ItemType()) + if (schematicItemType == ModContent.ItemType()) return ContainsDecryptionComputer; - if (schematicType == ModContent.ItemType()) + if (schematicItemType == ModContent.ItemType()) return ContainsDecryptionComputer && ContainsSensorArray; - if (schematicType == ModContent.ItemType()) + if (schematicItemType == ModContent.ItemType()) return ContainsDecryptionComputer && ContainsSensorArray && ContainsAdvancedDisplay; - if (schematicType == ModContent.ItemType()) + if (schematicItemType == ModContent.ItemType()) return ContainsDecryptionComputer && ContainsSensorArray && ContainsAdvancedDisplay && ContainsVoltageRegulationSystem; return false; @@ -94,15 +93,14 @@ namespace CalamityMod.TileEntities get { // You can't decrypt nothing. - if (HeldSchematicID == 0 || !CalamityLists.EncryptedSchematicIDRelationship.ContainsKey(HeldSchematicID)) + if (HeldSchematicID == 0 || !EncryptedSchematicIDRelationshipDict.TryGet(HeldSchematicID, out var schematicItemType)) return string.Empty; - int schematicType = CalamityLists.EncryptedSchematicIDRelationship[HeldSchematicID]; - if (schematicType == ModContent.ItemType() - || schematicType == ModContent.ItemType() - || schematicType == ModContent.ItemType() - || schematicType == ModContent.ItemType()) - return CalamityUtils.GetTextValueFromModItem(schematicType, "Content"); + if (schematicItemType == ModContent.ItemType() + || schematicItemType == ModContent.ItemType() + || schematicItemType == ModContent.ItemType() + || schematicItemType == ModContent.ItemType()) + return CalamityUtils.GetTextValueFromModItem(schematicItemType, "Content"); return string.Empty; } @@ -155,8 +153,8 @@ namespace CalamityMod.TileEntities if (ContainsCoolingCell) Item.NewItem(source, x * 16, y * 16, 32, 32, ModContent.ItemType()); - if (CalamityLists.EncryptedSchematicIDRelationship.ContainsKey(HeldSchematicID)) - Item.NewItem(source, x * 16, y * 16, 32, 32, CalamityLists.EncryptedSchematicIDRelationship[HeldSchematicID]); + if (EncryptedSchematicIDRelationshipDict.TryGet(HeldSchematicID, out var schematicItemType)) + Item.NewItem(source, x * 16, y * 16, 32, 32, schematicItemType); while (InputtedCellCount > 0) { @@ -233,27 +231,25 @@ namespace CalamityMod.TileEntities anythingChanged = false; // Do nothing if no valid schematic is inputted at the moment. - if (!CalamityLists.EncryptedSchematicIDRelationship.ContainsKey(HeldSchematicID)) + if (!EncryptedSchematicIDRelationshipDict.TryGet(HeldSchematicID, out var schematicItemType)) return; - int schematicType = CalamityLists.EncryptedSchematicIDRelationship[HeldSchematicID]; - - if (!RecipeUnlockHandler.HasUnlockedT2ArsenalRecipes && schematicType == ModContent.ItemType()) + if (!RecipeUnlockHandler.HasUnlockedT2ArsenalRecipes && schematicItemType == ModContent.ItemType()) { RecipeUnlockHandler.HasUnlockedT2ArsenalRecipes = true; anythingChanged = true; } - if (!RecipeUnlockHandler.HasUnlockedT3ArsenalRecipes && schematicType == ModContent.ItemType()) + if (!RecipeUnlockHandler.HasUnlockedT3ArsenalRecipes && schematicItemType == ModContent.ItemType()) { RecipeUnlockHandler.HasUnlockedT3ArsenalRecipes = true; anythingChanged = true; } - if (!RecipeUnlockHandler.HasUnlockedT4ArsenalRecipes && schematicType == ModContent.ItemType()) + if (!RecipeUnlockHandler.HasUnlockedT4ArsenalRecipes && schematicItemType == ModContent.ItemType()) { RecipeUnlockHandler.HasUnlockedT4ArsenalRecipes = true; anythingChanged = true; } - if (!RecipeUnlockHandler.HasUnlockedT5ArsenalRecipes && schematicType == ModContent.ItemType()) + if (!RecipeUnlockHandler.HasUnlockedT5ArsenalRecipes && schematicItemType == ModContent.ItemType()) { RecipeUnlockHandler.HasUnlockedT5ArsenalRecipes = true; anythingChanged = true; diff --git a/UI/DraedonSummoning/CodebreakerUI.cs b/UI/DraedonSummoning/CodebreakerUI.cs index df1ef0c32d..b50d05d200 100644 --- a/UI/DraedonSummoning/CodebreakerUI.cs +++ b/UI/DraedonSummoning/CodebreakerUI.cs @@ -1,10 +1,10 @@ using System; -using System.Linq; using System.Text; using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Materials; using CalamityMod.NPCs.ExoMechs; using CalamityMod.Packets; +using CalamityMod.Systems.Collections; using CalamityMod.TileEntities; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -228,7 +228,7 @@ namespace CalamityMod.UI.DraedonSummoning int schematicType = 0; if (codebreakerTileEntity.HeldSchematicID > 0) - schematicType = CalamityLists.EncryptedSchematicIDRelationship[codebreakerTileEntity.HeldSchematicID]; + schematicType = EncryptedSchematicIDRelationshipDict.Dict[codebreakerTileEntity.HeldSchematicID]; if (schematicType == ModContent.ItemType()) schematicIconTexture = ModContent.Request("CalamityMod/Items/DraedonMisc/EncryptedSchematicPlanetoid").Value; @@ -422,9 +422,16 @@ namespace CalamityMod.UI.DraedonSummoning { // If the player's hand item is empty and the codebreaker has a schematic, grab it. // This doesn't work if the Codebreaker is busy decrypting the schematic in question. - if (playerHandItem.IsAir && CalamityLists.EncryptedSchematicIDRelationship.ContainsKey(codebreakerTileEntity.HeldSchematicID) && codebreakerTileEntity.DecryptionCountdown <= 0) + + bool isAir = playerHandItem.IsAir; + bool countdownDone = codebreakerTileEntity.DecryptionCountdown <= 0; + bool hasValidSchematicID = EncryptedSchematicIDRelationshipDict.TryGet(codebreakerTileEntity.HeldSchematicID, out var schematicItemType); + bool hasHandHoldingValidSchematicItem = EncryptedSchematicIDRelationshipDict.TryGetKey(playerHandItem.type, out var handHoldSchematicID); + bool hasMouseHoldingValidSchematicItem = EncryptedSchematicIDRelationshipDict.TryGetKey(Main.mouseItem.type, out var mouseHoldSchematicID); + + if (isAir && countdownDone && hasValidSchematicID) { - playerHandItem.SetDefaults(CalamityLists.EncryptedSchematicIDRelationship[codebreakerTileEntity.HeldSchematicID]); + playerHandItem.SetDefaults(schematicItemType); codebreakerTileEntity.HeldSchematicID = 0; codebreakerTileEntity.DecryptionCountdown = 0; codebreakerTileEntity.SyncContainedStuff(); @@ -434,9 +441,9 @@ namespace CalamityMod.UI.DraedonSummoning } // Otherwise, if the player has an encrypted schematic and the Codebreaker doesn't, insert it into the machine. - else if (CalamityLists.EncryptedSchematicIDRelationship.ContainsValue(playerHandItem.type) && codebreakerTileEntity.HeldSchematicID == 0) + else if (hasHandHoldingValidSchematicItem && hasMouseHoldingValidSchematicItem && codebreakerTileEntity.HeldSchematicID == 0) { - codebreakerTileEntity.HeldSchematicID = CalamityLists.EncryptedSchematicIDRelationship.First(i => i.Value == Main.mouseItem.type).Key; + codebreakerTileEntity.HeldSchematicID = mouseHoldSchematicID; playerHandItem.TurnToAir(); codebreakerTileEntity.SyncContainedStuff(); SoundEngine.PlaySound(SoundID.Grab); @@ -445,15 +452,15 @@ namespace CalamityMod.UI.DraedonSummoning } // Lastly, if the player has an encrypted schematic but so does the Codebreaker, swap the two. - else if (CalamityLists.EncryptedSchematicIDRelationship.ContainsValue(playerHandItem.type) && codebreakerTileEntity.HeldSchematicID != 0) + else if (hasHandHoldingValidSchematicItem && hasValidSchematicID) { - int previouslyHeldSchematic = CalamityLists.EncryptedSchematicIDRelationship[codebreakerTileEntity.HeldSchematicID]; + int previouslyHeldSchematic = schematicItemType; // If the schematics are the same, don't actually do anything, just play the sound as an illusion, to prevent having to send a packet. SoundEngine.PlaySound(SoundID.Grab); - if (playerHandItem.type != previouslyHeldSchematic) + if (playerHandItem.type != previouslyHeldSchematic && hasMouseHoldingValidSchematicItem) { - codebreakerTileEntity.HeldSchematicID = CalamityLists.EncryptedSchematicIDRelationship.First(i => i.Value == Main.mouseItem.type).Key; + codebreakerTileEntity.HeldSchematicID = mouseHoldSchematicID; playerHandItem.SetDefaults(previouslyHeldSchematic); codebreakerTileEntity.SyncContainedStuff(); AwaitingDecryptionTextClose = false; From f3e62d57ed0c406329a06c6ea77b7dccbf7e8496 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 21:35:07 +0900 Subject: [PATCH 114/118] SunkenSeaBiomeCorrespondentDict --- CalamityLists.cs | 24 ++------- NPCs/SunkenSea/SunkenSeaNPC.cs | 17 +++++-- .../SunkenSeaBiomeCorrespondentDict.cs | 50 +++++++++++++++++++ 3 files changed, 65 insertions(+), 26 deletions(-) create mode 100644 Systems/Collections/SunkenSeaBiomeCorrespondentDict.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index a93774f121..f6a6dbd3af 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -1,35 +1,17 @@ -using System; -using System.Collections.Generic; -using CalamityMod.BiomeManagers; -using CalamityMod.Enums; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; +using Terraria.ModLoader; namespace CalamityMod { public sealed class CalamityLists : ModSystem { - /// - /// Each Sunken Sea subbiome has a correspoding spawn condition boolean value and a biome type. - /// - public static SortedDictionary SpawnCondition, int BiomeType)> SunkenSeaBiomeCorrespondentValues { get; private set; } - public override void OnModLoad() { - SunkenSeaBiomeCorrespondentValues = new() - { - { SunkenSeaBiomeFlags.UndergroundDesert, (spawnInfo => spawnInfo.Player.ZoneDesert, -1 /* None needed. */) }, - { SunkenSeaBiomeFlags.TimelessShores, (spawnInfo => spawnInfo.Player.Calamity().ZoneTimelessShores, GetInstance().Type) }, - { SunkenSeaBiomeFlags.RadiantReefs, (spawnInfo => spawnInfo.Player.Calamity().ZoneRadiantReefs, GetInstance().Type) }, - { SunkenSeaBiomeFlags.PolypForest, (spawnInfo => spawnInfo.Player.Calamity().ZonePolypForest, GetInstance().Type) }, - { SunkenSeaBiomeFlags.GleamingBurrows, (spawnInfo => spawnInfo.Player.Calamity().ZoneGleamingBurrows, GetInstance().Type) }, - { SunkenSeaBiomeFlags.BasaltGully, (spawnInfo => spawnInfo.Player.Calamity().ZoneBasaltGully, GetInstance().Type) }, - }; + } public override void Unload() { - SunkenSeaBiomeCorrespondentValues = null; + } } } diff --git a/NPCs/SunkenSea/SunkenSeaNPC.cs b/NPCs/SunkenSea/SunkenSeaNPC.cs index e72a35eaf9..7798680cd2 100644 --- a/NPCs/SunkenSea/SunkenSeaNPC.cs +++ b/NPCs/SunkenSea/SunkenSeaNPC.cs @@ -4,13 +4,13 @@ using System.IO; using System.Linq; using CalamityMod.Enums; using CalamityMod.Particles; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; -using static CalamityMod.CalamityLists; using static Terraria.Utilities.NPCUtils; namespace CalamityMod.NPCs.SunkenSea @@ -204,12 +204,19 @@ namespace CalamityMod.NPCs.SunkenSea List biomeTypes = []; foreach (var flag in Enum.GetValues()) { - if (flag == SunkenSeaBiomeFlags.None || !BiomeDesignation.HasFlag(flag)) + if (flag == SunkenSeaBiomeFlags.None) continue; - BiomeSpawnConditions.Add(SunkenSeaBiomeCorrespondentValues[flag].SpawnCondition); - if (flag == SunkenSeaBiomeFlags.UndergroundDesert) + + if (!BiomeDesignation.HasFlag(flag)) continue; - biomeTypes.Add(SunkenSeaBiomeCorrespondentValues[flag].BiomeType); + + if (!SunkenSeaBiomeCorrespondentDict.TryGet(flag, out var spawnCondition, out var biomeType)) + continue; + + // Apply Conditions and Biome Types + BiomeSpawnConditions.Add(spawnCondition); + if (flag != SunkenSeaBiomeFlags.UndergroundDesert) + biomeTypes.Add(biomeType); } SpawnModBiomes = [.. biomeTypes]; } diff --git a/Systems/Collections/SunkenSeaBiomeCorrespondentDict.cs b/Systems/Collections/SunkenSeaBiomeCorrespondentDict.cs new file mode 100644 index 0000000000..5fb07cab3d --- /dev/null +++ b/Systems/Collections/SunkenSeaBiomeCorrespondentDict.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using CalamityMod.BiomeManagers; +using CalamityMod.Enums; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + /// + /// Each Sunken Sea subbiome has a correspoding spawn condition boolean value and a biome type. + /// + public sealed class SunkenSeaBiomeCorrespondentDict : ModSystem + { + public static IDictionary SpawnCondition, int BiomeType)> Dict { get; private set; } + + public override void OnModLoad() + { + Dict = new Dictionary SpawnCondition, int BiomeType)>() + { + { SunkenSeaBiomeFlags.UndergroundDesert, (spawnInfo => spawnInfo.Player.ZoneDesert, -1 /* None needed. */) }, + { SunkenSeaBiomeFlags.TimelessShores, (spawnInfo => spawnInfo.Player.Calamity().ZoneTimelessShores, GetInstance().Type) }, + { SunkenSeaBiomeFlags.RadiantReefs, (spawnInfo => spawnInfo.Player.Calamity().ZoneRadiantReefs, GetInstance().Type) }, + { SunkenSeaBiomeFlags.PolypForest, (spawnInfo => spawnInfo.Player.Calamity().ZonePolypForest, GetInstance().Type) }, + { SunkenSeaBiomeFlags.GleamingBurrows, (spawnInfo => spawnInfo.Player.Calamity().ZoneGleamingBurrows, GetInstance().Type) }, + { SunkenSeaBiomeFlags.BasaltGully, (spawnInfo => spawnInfo.Player.Calamity().ZoneBasaltGully, GetInstance().Type) }, + }; + } + + public override void Unload() + { + Dict?.Clear(); + Dict = null; + } + + public static bool TryGet(SunkenSeaBiomeFlags flags, out Func spawnCondition, out int biomeType) + { + if (!Dict.TryGetValue(flags, out var biomeInfoTuple)) + { + spawnCondition = null; + biomeType = default; + return false; + } + + spawnCondition = biomeInfoTuple.SpawnCondition; + biomeType = biomeInfoTuple.BiomeType; + return true; + } + } +} From bf90f39148340199aa7056d5de091b9a199bad03 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 21:40:16 +0900 Subject: [PATCH 115/118] CalamityLists goes byebye + Fixed few issues --- CalPlayer/CalamityPlayerLifeRegen.cs | 4 +--- CalamityLists.cs | 17 ----------------- NPCs/CalamityGlobalNPC.cs | 2 +- Systems/Collections/NPCs/BossHPScalingList.cs | 4 ++++ 4 files changed, 6 insertions(+), 21 deletions(-) delete mode 100644 CalamityLists.cs diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 3ff0d4b7f8..a314a51122 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -13,7 +13,6 @@ using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Items.Potions; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.NPCs; -using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems; using CalamityMod.Systems.Collections; @@ -24,7 +23,6 @@ using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using Terraria.Utilities.Terraria.Utilities; namespace CalamityMod.CalPlayer { @@ -437,7 +435,7 @@ namespace CalamityMod.CalPlayer } // Permafrost's Concoction increases life regen while afflicted with a fire debuff - if (permafrostsConcoction && Player.buffType.Any(CalamityLists.fireDebuffList.Contains)) + if (permafrostsConcoction && Player.buffType.Any(FireDebuffsList.IsFireDebuff)) { if (Player.lifeRegenTime < 1800) Player.lifeRegenTime = 1800; diff --git a/CalamityLists.cs b/CalamityLists.cs deleted file mode 100644 index f6a6dbd3af..0000000000 --- a/CalamityLists.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Terraria.ModLoader; - -namespace CalamityMod -{ - public sealed class CalamityLists : ModSystem - { - public override void OnModLoad() - { - - } - - public override void Unload() - { - - } - } -} diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 936c08ddbe..bbb5d40dc8 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -2568,7 +2568,7 @@ namespace CalamityMod.NPCs npc.GetNPCDamage(); npc.defDamage = npc.damage; } - if ((npc.boss && npc.type != NPCID.MartianSaucerCore) || CalamityLists.bossHPScaleList.Contains(npc.type)) + if ((npc.boss && npc.type != NPCID.MartianSaucerCore) || BossHPScalingList.Includes(npc.type)) { double HPBoost = CalamityServerConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)Math.Round(npc.lifeMax * HPBoost); diff --git a/Systems/Collections/NPCs/BossHPScalingList.cs b/Systems/Collections/NPCs/BossHPScalingList.cs index cfab279a8a..b43aa76caf 100644 --- a/Systems/Collections/NPCs/BossHPScalingList.cs +++ b/Systems/Collections/NPCs/BossHPScalingList.cs @@ -22,6 +22,7 @@ using CalamityMod.NPCs.Ravager; using CalamityMod.NPCs.Signus; using CalamityMod.NPCs.SlimeGod; using CalamityMod.NPCs.SupremeCalamitas; +using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -148,5 +149,8 @@ namespace CalamityMod.Systems.Collections } public override void Unload() => List = null; + + public static bool Includes(NPC npc) => List.Contains(npc.type); + public static bool Includes(int npcType) => List.Contains(npcType); } } From d2e1478348f241503cf3fe00216d91337d41557b Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 22:06:11 +0900 Subject: [PATCH 116/118] Standardize Contains shorthand method to Include(int) --- Buffs/CalamityGlobalBuff.cs | 5 +- Buffs/DamageOverTime/TrueVulnerabilityHex.cs | 2 +- Buffs/DamageOverTime/Vaporfied.cs | 2 +- Buffs/DamageOverTime/VulnerabilityHex.cs | 4 +- Buffs/StatDebuffs/Eutrophication.cs | 2 +- Buffs/StatDebuffs/GalvanicCorrosion.cs | 2 +- Buffs/StatDebuffs/GlacialState.cs | 2 +- Buffs/StatDebuffs/KamiFlu.cs | 2 +- Buffs/StatDebuffs/TemporalSadness.cs | 2 +- Buffs/StatDebuffs/TimeDistortion.cs | 2 +- CalPlayer/CalamityPlayer.cs | 2 +- CalPlayer/CalamityPlayerHitHurt.cs | 6 +- CalPlayer/CalamityPlayerLifeRegen.cs | 8 +-- CalPlayer/CalamityPlayerMiscEffects.cs | 28 ++++---- CalPlayer/CalamityPlayerOnHit.cs | 10 +-- Items/CalamityGlobalItem.cs | 5 +- ModSupport/ModCalls.cs | 8 +-- NPCs/CalamityGlobalNPC.cs | 66 +++++++++---------- NPCs/CalamityGlobalNPCLoot.cs | 8 +-- NPCs/CalamityGlobalTownNPC.cs | 2 +- NPCs/SupremeCalamitas/SupremeCalamitas.cs | 2 +- Projectiles/Boss/BrimstoneMonster.cs | 2 +- Projectiles/CalamityGlobalProjectile.cs | 12 ++-- Projectiles/Healing/AbsorberAura.cs | 2 +- Projectiles/Healing/BlueJellyAura.cs | 2 +- Projectiles/Healing/GreenJellyAura.cs | 2 +- Systems/Collections/AlcoholsList.cs | 2 +- Systems/Collections/AmalgamBuffLists.cs | 2 +- .../Collections/AutoreuseableSpearsList.cs | 3 +- .../BlacklistedWeaponsWithToolPowerList.cs | 3 +- .../BuffedDungeonProjectilesList.cs | 3 +- .../ConfusionDebuffImmunitiesList.cs | 3 +- Systems/Collections/DebuffsList.cs | 2 +- .../Collections/EventProjectileBuffList.cs | 3 +- Systems/Collections/FireDebuffsList.cs | 2 +- Systems/Collections/FriendlyBeesList.cs | 3 +- .../Collections/HighTestFishingPoleList.cs | 3 +- .../Collections/ItemsForcedInsideWorldList.cs | 3 +- Systems/Collections/LivingFireTilesList.cs | 3 +- Systems/Collections/MagicGunIDList.cs | 3 +- .../NPCIDs/AquaticScourgeIDList.cs | 2 - Systems/Collections/NPCIDs/AresIDList.cs | 2 - .../Collections/NPCIDs/AstrumDeusIDList.cs | 2 - Systems/Collections/NPCIDs/BoundNPCIDList.cs | 2 - .../NPCIDs/CosmicGuardianIDList.cs | 2 - .../Collections/NPCIDs/DesertScourgeIDList.cs | 2 - Systems/Collections/NPCIDs/DestroyerIDList.cs | 2 - .../NPCIDs/DevourerOfGodsIDList.cs | 2 - .../Collections/NPCIDs/EaterOfWorldsIDList.cs | 2 - Systems/Collections/NPCIDs/GolemIDList.cs | 2 - .../NPCIDs/PerforatorWormIDList.cs | 2 - Systems/Collections/NPCIDs/RavagerIDList.cs | 2 - .../NPCIDs/SkeletronPrimeIDList.cs | 2 - Systems/Collections/NPCIDs/SlimeGodIDList.cs | 2 - .../Collections/NPCIDs/StormWeaverIDList.cs | 2 - Systems/Collections/NPCIDs/ThanatosIDList.cs | 2 - .../Collections/NPCVariants/AngryBonesList.cs | 3 +- .../Collections/NPCVariants/DemonEyeList.cs | 3 +- Systems/Collections/NPCVariants/HornetList.cs | 3 +- .../Collections/NPCVariants/MossHornetList.cs | 3 +- .../Collections/NPCVariants/SkeletonList.cs | 3 +- Systems/Collections/NPCVariants/ZombieList.cs | 3 +- Systems/Collections/NPCs/BossHPScalingList.cs | 2 - .../NPCs/BuffedDungeonEnemiesList.cs | 3 +- .../NPCs/DeathModeSplittingWormList.cs | 2 - Systems/Collections/NPCs/EclipseBuffList.cs | 3 +- .../Collections/NPCs/EnemyImmunitiesList.cs | 3 +- Systems/Collections/NPCs/FrostMoonBuffList.cs | 3 +- .../Collections/NPCs/HardmodeNPCNerfList.cs | 2 - Systems/Collections/NPCs/MinibossList.cs | 3 +- .../Collections/NPCs/NoRageWormSegmentList.cs | 3 +- Systems/Collections/NPCs/PierceResistList.cs | 3 +- .../Collections/NPCs/PumpkinMoonBuffList.cs | 5 +- .../NPCs/ZeroContactDamageNPCList.cs | 2 - .../Collections/NeedsDebuffIconDisplayList.cs | 3 +- Systems/Collections/PersistentBuffList.cs | 2 +- .../PierceResistExceptionLeviAureusList.cs | 3 +- .../Collections/PierceResistExceptionList.cs | 3 +- .../ProjectileDestroyExceptionsList.cs | 4 +- Systems/Collections/SicknessDebuffsList.cs | 2 +- Utilities/NPCDebuffs.cs | 4 +- Utilities/PlayerUtils.cs | 2 +- 82 files changed, 127 insertions(+), 208 deletions(-) diff --git a/Buffs/CalamityGlobalBuff.cs b/Buffs/CalamityGlobalBuff.cs index 45fc1974d3..0d4b39fe67 100644 --- a/Buffs/CalamityGlobalBuff.cs +++ b/Buffs/CalamityGlobalBuff.cs @@ -1,5 +1,4 @@ using CalamityMod.Balancing; -using CalamityMod.Buffs.StatDebuffs; using CalamityMod.NPCs; using CalamityMod.Systems.Collections; using Terraria; @@ -105,7 +104,7 @@ namespace CalamityMod.Buffs { if (npc.Calamity().webbed < npc.buffTime[buffIndex]) npc.Calamity().webbed = npc.buffTime[buffIndex]; - if ((EnemyImmunitiesList.IsNPCImmune(npc) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + if ((EnemyImmunitiesList.Includes(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().webbed; npc.DelBuff(buffIndex); buffIndex--; @@ -114,7 +113,7 @@ namespace CalamityMod.Buffs { if (npc.Calamity().slowed < npc.buffTime[buffIndex]) npc.Calamity().slowed = npc.buffTime[buffIndex]; - if ((EnemyImmunitiesList.IsNPCImmune(npc) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + if ((EnemyImmunitiesList.Includes(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().slowed; npc.DelBuff(buffIndex); buffIndex--; diff --git a/Buffs/DamageOverTime/TrueVulnerabilityHex.cs b/Buffs/DamageOverTime/TrueVulnerabilityHex.cs index 26620b2a52..72910c2fa8 100644 --- a/Buffs/DamageOverTime/TrueVulnerabilityHex.cs +++ b/Buffs/DamageOverTime/TrueVulnerabilityHex.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Buffs.DamageOverTime } // Apply immunity timer. - if ((EnemyImmunitiesList.IsNPCImmune(npc) || npc.boss) && cgn.debuffResistanceTimer <= 0) + if ((EnemyImmunitiesList.Includes(npc.type) || npc.boss) && cgn.debuffResistanceTimer <= 0) cgn.debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + cgn.trueVulnerabilityHex; // Destroy the vanilla buff, we don't use it. diff --git a/Buffs/DamageOverTime/Vaporfied.cs b/Buffs/DamageOverTime/Vaporfied.cs index 95fb11724b..f4dd7d5fee 100644 --- a/Buffs/DamageOverTime/Vaporfied.cs +++ b/Buffs/DamageOverTime/Vaporfied.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Buffs.DamageOverTime { if (npc.Calamity().vaporfied < npc.buffTime[buffIndex]) npc.Calamity().vaporfied = npc.buffTime[buffIndex]; - if ((EnemyImmunitiesList.IsNPCImmune(npc) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + if ((EnemyImmunitiesList.Includes(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().vaporfied; npc.DelBuff(buffIndex); buffIndex--; diff --git a/Buffs/DamageOverTime/VulnerabilityHex.cs b/Buffs/DamageOverTime/VulnerabilityHex.cs index adbcfe635a..45c6a98946 100644 --- a/Buffs/DamageOverTime/VulnerabilityHex.cs +++ b/Buffs/DamageOverTime/VulnerabilityHex.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Buffs.DamageOverTime } // Apply immunity timer. - if ((EnemyImmunitiesList.IsNPCImmune(npc) || npc.boss) && cgn.debuffResistanceTimer <= 0) + if ((EnemyImmunitiesList.Includes(npc.type) || npc.boss) && cgn.debuffResistanceTimer <= 0) cgn.debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + cgn.vulnerabilityHex; // Destroy the vanilla buff, we don't use it. @@ -61,7 +61,7 @@ namespace CalamityMod.Buffs.DamageOverTime GeneralParticleHandler.SpawnParticle(spark2); } - Dust dust = Dust.NewDustPerfect(Player.Calamity().RandomDebuffVisualSpot, Main.rand.NextBool() ? 261 :(int)CalamityDusts.Brimstone); + Dust dust = Dust.NewDustPerfect(Player.Calamity().RandomDebuffVisualSpot, Main.rand.NextBool() ? 261 : (int)CalamityDusts.Brimstone); dust.scale = Main.rand.NextFloat(0.4f, 0.5f); dust.velocity = new Vector2(0, Main.rand.NextFloat(-0.5f, -2.5f)).RotatedByRandom(0.6f); if (dust.type == 261) diff --git a/Buffs/StatDebuffs/Eutrophication.cs b/Buffs/StatDebuffs/Eutrophication.cs index e4bf120f00..0f99d11480 100644 --- a/Buffs/StatDebuffs/Eutrophication.cs +++ b/Buffs/StatDebuffs/Eutrophication.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Buffs.StatDebuffs { if (npc.Calamity().eutrophication < npc.buffTime[buffIndex]) npc.Calamity().eutrophication = npc.buffTime[buffIndex]; - if ((EnemyImmunitiesList.IsNPCImmune(npc) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + if ((EnemyImmunitiesList.Includes(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().eutrophication; npc.DelBuff(buffIndex); buffIndex--; diff --git a/Buffs/StatDebuffs/GalvanicCorrosion.cs b/Buffs/StatDebuffs/GalvanicCorrosion.cs index 17254c5d2f..d8b4a6e77c 100644 --- a/Buffs/StatDebuffs/GalvanicCorrosion.cs +++ b/Buffs/StatDebuffs/GalvanicCorrosion.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Buffs.StatDebuffs { if (npc.Calamity().tesla < npc.buffTime[buffIndex]) npc.Calamity().tesla = npc.buffTime[buffIndex]; - if ((EnemyImmunitiesList.IsNPCImmune(npc) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + if ((EnemyImmunitiesList.Includes(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().tesla; npc.DelBuff(buffIndex); buffIndex--; diff --git a/Buffs/StatDebuffs/GlacialState.cs b/Buffs/StatDebuffs/GlacialState.cs index 0983aad4b4..ffbb2a810b 100644 --- a/Buffs/StatDebuffs/GlacialState.cs +++ b/Buffs/StatDebuffs/GlacialState.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Buffs.StatDebuffs { if (npc.Calamity().gState < npc.buffTime[buffIndex]) npc.Calamity().gState = npc.buffTime[buffIndex]; - if ((EnemyImmunitiesList.IsNPCImmune(npc) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + if ((EnemyImmunitiesList.Includes(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().gState; npc.DelBuff(buffIndex); buffIndex--; diff --git a/Buffs/StatDebuffs/KamiFlu.cs b/Buffs/StatDebuffs/KamiFlu.cs index 730ca67496..a4f3908529 100644 --- a/Buffs/StatDebuffs/KamiFlu.cs +++ b/Buffs/StatDebuffs/KamiFlu.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.StatDebuffs { if (npc.Calamity().kamiFlu < npc.buffTime[buffIndex]) npc.Calamity().kamiFlu = npc.buffTime[buffIndex]; - if ((EnemyImmunitiesList.IsNPCImmune(npc) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + if ((EnemyImmunitiesList.Includes(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().kamiFlu; npc.DelBuff(buffIndex); buffIndex--; diff --git a/Buffs/StatDebuffs/TemporalSadness.cs b/Buffs/StatDebuffs/TemporalSadness.cs index 8e765be36e..b3eb4099dc 100644 --- a/Buffs/StatDebuffs/TemporalSadness.cs +++ b/Buffs/StatDebuffs/TemporalSadness.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Buffs.StatDebuffs { if (npc.Calamity().tSad < npc.buffTime[buffIndex]) npc.Calamity().tSad = npc.buffTime[buffIndex]; - if ((EnemyImmunitiesList.IsNPCImmune(npc) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + if ((EnemyImmunitiesList.Includes(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().tSad; npc.DelBuff(buffIndex); buffIndex--; diff --git a/Buffs/StatDebuffs/TimeDistortion.cs b/Buffs/StatDebuffs/TimeDistortion.cs index f56d673df3..95a1cf23fa 100644 --- a/Buffs/StatDebuffs/TimeDistortion.cs +++ b/Buffs/StatDebuffs/TimeDistortion.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Buffs.StatDebuffs { if (npc.Calamity().timeSlow < npc.buffTime[buffIndex]) npc.Calamity().timeSlow = npc.buffTime[buffIndex]; - if ((EnemyImmunitiesList.IsNPCImmune(npc) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + if ((EnemyImmunitiesList.Includes(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().timeSlow; npc.DelBuff(buffIndex); buffIndex--; diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 3d5ecfc8e3..68f1206821 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -4007,7 +4007,7 @@ namespace CalamityMod.CalPlayer #region Modify Mana Cost public override void ModifyManaCost(Item item, ref float reduce, ref float mult) { - if (MagicGunIDList.IsMagicGun(item) && meteorSet) + if (MagicGunIDList.Includes(item.type) && meteorSet) { mult *= 0.33f; } diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index ff8423717a..bdcd461999 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -905,7 +905,7 @@ namespace CalamityMod.CalPlayer { // TODO -- Evolution dodge isn't actually a dodge and you'll still get hit for 1. // This should probably be changed so that when the evolution reflects it gives you 1 frame of guaranteed free dodging everything. - if (!ProjectileDestroyExceptionsList.IsDestroyException(proj) && proj.active && !proj.friendly && proj.hostile && proj.damage > 0) + if (!ProjectileDestroyExceptionsList.Includes(proj.type) && proj.active && !proj.friendly && proj.hostile && proj.damage > 0) { double dodgeDamageGateValuePercent = 0.05; int dodgeDamageGateValue = (int)Math.Round(Player.statLifeMax2 * dodgeDamageGateValuePercent); @@ -1038,7 +1038,7 @@ namespace CalamityMod.CalPlayer projectileDamageReduction += 0.25; } - if (!ProjectileDestroyExceptionsList.IsDestroyException(proj) && proj.active && !proj.friendly && proj.hostile && proj.damage > 0) + if (!ProjectileDestroyExceptionsList.Includes(proj.type) && proj.active && !proj.friendly && proj.hostile && proj.damage > 0) { // Daedalus Reflect counts as a reflect but doesn't actually stop you from taking damage if (daedalusReflect && !disableAllDodges && !evolution && !Player.HasCooldown(GlobalDodge.ID)) @@ -1460,7 +1460,7 @@ namespace CalamityMod.CalPlayer } // As these reflects do not cancel damage, they need to be in OnHit rather than ModifyHit - if (!ProjectileDestroyExceptionsList.IsDestroyException(proj) && proj.active && !proj.friendly && proj.hostile && hurtInfo.Damage > 0) + if (!ProjectileDestroyExceptionsList.Includes(proj.type) && proj.active && !proj.friendly && proj.hostile && hurtInfo.Damage > 0) { double dodgeDamageGateValuePercent = 0.05; int dodgeDamageGateValue = (int)Math.Round(Player.statLifeMax2 * dodgeDamageGateValuePercent); diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index a314a51122..49dd58e354 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -387,11 +387,11 @@ namespace CalamityMod.CalPlayer int buffID = Player.buffType[l]; if (Player.buffTime[l] <= 2) continue; - bool shouldHalveDuration = SicknessDebuffsList.IsSickenessDebuff(buffID); + bool shouldHalveDuration = SicknessDebuffsList.Includes(buffID); if (livingDewHalveDebuffs) - shouldHalveDuration |= FireDebuffsList.IsFireDebuff(buffID); + shouldHalveDuration |= FireDebuffsList.Includes(buffID); if (purity) - shouldHalveDuration |= DebuffsList.IsDebuff(buffID); + shouldHalveDuration |= DebuffsList.Includes(buffID); if (shouldHalveDuration) --Player.buffTime[l]; @@ -435,7 +435,7 @@ namespace CalamityMod.CalPlayer } // Permafrost's Concoction increases life regen while afflicted with a fire debuff - if (permafrostsConcoction && Player.buffType.Any(FireDebuffsList.IsFireDebuff)) + if (permafrostsConcoction && Player.buffType.Any(FireDebuffsList.Includes)) { if (Player.lifeRegenTime < 1800) Player.lifeRegenTime = 1800; diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 69988d269c..22f1238120 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -4,7 +4,6 @@ using System.Linq; using CalamityMod.Balancing; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.Placeables; -using CalamityMod.Buffs.Potions; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Buffs.Summon; @@ -47,20 +46,20 @@ using CalamityMod.NPCs; using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.Astral; using CalamityMod.NPCs.Crags; -using CalamityMod.NPCs.ExoMechs.Ares; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.Other; using CalamityMod.NPCs.PlagueEnemies; using CalamityMod.NPCs.TownNPCs; using CalamityMod.Packets; using CalamityMod.Particles; -using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Pets; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems; +using CalamityMod.Systems.Collections; using CalamityMod.Tiles.Abyss.AbyssAmbient; using CalamityMod.Tiles.FurnitureAuric; using CalamityMod.Tiles.Ores; @@ -76,13 +75,10 @@ using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.Events; using Terraria.GameInput; -using Terraria.Graphics.Renderers; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; using ProvidenceBoss = CalamityMod.NPCs.Providence.Providence; -using CalamityMod.Projectiles.Pets; -using CalamityMod.Systems.Collections; namespace CalamityMod.CalPlayer { @@ -374,7 +370,7 @@ namespace CalamityMod.CalPlayer } IsFirstDashFrame = false; } - + float sparkscale1 = MathF.Min(Player.velocity.X * dir * 0.08f, 1.2f); Vector2 SparkVelocity1 = -Player.velocity.SafeNormalize(Vector2.UnitX) * 5; @@ -556,7 +552,7 @@ namespace CalamityMod.CalPlayer // If they're a boss, reduce the boss distance. // Boss distance will always be >= enemy distance, so there's no need to do another check. // Worm boss body and tail segments are not counted as bosses for this calculation. - if (npc.IsABoss() && !NoRageWormSegmentList.IsNoRageWormSegment(npc)) + if (npc.IsABoss() && !NoRageWormSegmentList.Includes(npc.type)) bossDistance = hitboxEdgeDist; } } @@ -1015,7 +1011,7 @@ namespace CalamityMod.CalPlayer continue; var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); - if (Main.myPlayer == Player.whoAmI && target.WithinRange(Player.Center , 2000f)) + if (Main.myPlayer == Player.whoAmI && target.WithinRange(Player.Center, 2000f)) { Projectile.NewProjectile(source, target.Center, Vector2.Zero, bullseyeType, 0, 0f, Player.whoAmI, target.whoAmI); @@ -1079,7 +1075,7 @@ namespace CalamityMod.CalPlayer for (int l = 0; l < Player.MaxBuffs; l++) { int buffID = Player.buffType[l]; - if (Player.buffTime[l] > 2 && DebuffsList.IsDebuff(buffID)) + if (Player.buffTime[l] > 2 && DebuffsList.Includes(buffID)) Player.buffTime[l]--; } } @@ -1938,7 +1934,7 @@ namespace CalamityMod.CalPlayer if (Player.whoAmI == Main.myPlayer) Player.AddCooldown(Cooldowns.TarragonImmunity.ID, CalamityUtils.SecondsToFrames(25)); - bool shouldAffect = DebuffsList.IsDebuff(buffID); + bool shouldAffect = DebuffsList.Includes(buffID); if (shouldAffect) Player.GetDamage() += 0.1f; } @@ -3081,7 +3077,7 @@ namespace CalamityMod.CalPlayer } } - if (HighTestFishingPoleList.IsHighTestFishingPole(Player.ActiveItem())) + if (HighTestFishingPoleList.Includes(Player.ActiveItem().type)) Player.accFishingLine = true; if (planarSpeedBoost != 0) @@ -3178,7 +3174,7 @@ namespace CalamityMod.CalPlayer Player.statDefense += Mushy.DefenseBoost; if (fungalSymbiote) Player.GetDamage() += 0.1f; - } + } if (omniscience) { @@ -3851,7 +3847,7 @@ namespace CalamityMod.CalPlayer for (int l = 0; l < Player.MaxBuffs; l++) { int buffID = Player.buffType[l]; - if (AmalgamBuffList.IsBuffBoostedByAmalgan(buffID)) + if (AmalgamBuffList.Includes(buffID)) { if (amalgam) { @@ -3868,7 +3864,7 @@ namespace CalamityMod.CalPlayer else { // Reset buff persistence if Amalgam is removed. - if (Main.persistentBuff[buffID] && !PersistentBuffList.IsPersistentBuff(buffID)) + if (Main.persistentBuff[buffID] && !PersistentBuffList.Includes(buffID)) Main.persistentBuff[buffID] = false; } } @@ -4252,7 +4248,7 @@ namespace CalamityMod.CalPlayer // Apply defense damage Player.statDefense -= currentDefenseDamage; - + } // Defense can never be reduced below zero, no matter what diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index 3323172001..7fe8646eaf 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -7,33 +7,29 @@ using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Cooldowns; using CalamityMod.Dusts; -using CalamityMod.Enums; -using CalamityMod.EntitySources; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Reaver; using CalamityMod.Items.Fishing.AstralCatches; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.VanillaArmorChanges; -using CalamityMod.Items.Weapons.Ranged; using CalamityMod.NPCs; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.Particles; using CalamityMod.Projectiles; using CalamityMod.Projectiles.Healing; using CalamityMod.Projectiles.Magic; -using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; -using CalamityMod.Systems.Collections; namespace CalamityMod.CalPlayer { @@ -281,7 +277,7 @@ namespace CalamityMod.CalPlayer if (!proj.npcProj && !proj.trap && proj.friendly) { - if ((plaguebringerCarapace || uberBees) && FriendlyBeesList.IsFriendlyBee(proj)) + if ((plaguebringerCarapace || uberBees) && FriendlyBeesList.Includes(proj.type)) target.AddBuff(BuffType(), 300); // All projectiles fired from Soma Prime are marked using CalamityGlobalProjectile @@ -1145,7 +1141,7 @@ namespace CalamityMod.CalPlayer if (profanedCrystal && (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs)) { - target.AddBuff(BuffType(), 600); + target.AddBuff(BuffType(), 600); } if (divineBless) diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 885dc186a5..277af101c4 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -10,7 +10,6 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Potions; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.VanillaArmorChanges; -using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.Other; @@ -851,7 +850,7 @@ namespace CalamityMod.Items // Handle general use-item effects for the Gem Tech Armor. player.Calamity().GemTechState.OnItemUseEffects(item); - if (item.type == ItemID.MonkStaffT1 || AutoreusableSpearsList.IsAutoreuseableSpear(item)) + if (item.type == ItemID.MonkStaffT1 || AutoreusableSpearsList.Includes(item.type)) { return player.ownedProjectileCounts[item.shoot] <= 0; } @@ -1604,7 +1603,7 @@ namespace CalamityMod.Items #region PostUpdate public override void PostUpdate(Item item) { - if (ItemsForcedInsideWorldList.IsItemForcedInsideWorld(item)) + if (ItemsForcedInsideWorldList.Includes(item.type)) CalamityUtils.ForceItemIntoWorld(item); } #endregion diff --git a/ModSupport/ModCalls.cs b/ModSupport/ModCalls.cs index 0832793e0c..bce9cbdf27 100644 --- a/ModSupport/ModCalls.cs +++ b/ModSupport/ModCalls.cs @@ -915,7 +915,7 @@ namespace CalamityMod #region Amalgam Potion Buff List public static bool SetAmalgamBuffList(int type, bool shouldBeListed) { - if (shouldBeListed && !AmalgamBuffList.IsBuffBoostedByAmalgan(type)) + if (shouldBeListed && !AmalgamBuffList.Includes(type)) { AmalgamBuffList.List.Add(type); return true; @@ -929,7 +929,7 @@ namespace CalamityMod } public static bool SetPersistentBuffList(int type, bool isPersistent) { - if (isPersistent && !PersistentBuffList.IsPersistentBuff(type)) + if (isPersistent && !PersistentBuffList.Includes(type)) { PersistentBuffList.List.Add(type); return true; @@ -942,8 +942,8 @@ namespace CalamityMod return false; } - public static bool IsOnAmalgamBuffList(int type) => AmalgamBuffList.IsBuffBoostedByAmalgan(type); - public static bool IsOnPersistentBuffList(int type) => PersistentBuffList.IsPersistentBuff(type); + public static bool IsOnAmalgamBuffList(int type) => AmalgamBuffList.Includes(type); + public static bool IsOnPersistentBuffList(int type) => PersistentBuffList.Includes(type); #endregion #region Venerated Locket Bans diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index bbb5d40dc8..1ad898e04a 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -804,9 +804,9 @@ namespace CalamityMod.NPCs // Damage multiplier calcs. // Worms that are vulnerable to debuffs and Slime God slimes take reduced damage from vulnerabilities. #region Debuff System Multiplier Calculations - bool wormBoss = DesertScourgeIDList.Includes(npc) || EaterOfWorldsIDList.Includes(npc) || PerforatorWormIDList.Includes(npc) || - AquaticScourgeIDList.Includes(npc) || AstrumDeusIDList.Includes(npc) || StormWeaverIDList.Includes(npc); - bool slimeGod = SlimeGodIDList.Includes(npc); + bool wormBoss = DesertScourgeIDList.Includes(npc.type) || EaterOfWorldsIDList.Includes(npc.type) || PerforatorWormIDList.Includes(npc.type) || + AquaticScourgeIDList.Includes(npc.type) || AstrumDeusIDList.Includes(npc.type) || StormWeaverIDList.Includes(npc.type); + bool slimeGod = SlimeGodIDList.Includes(npc.type); bool slimed = npc.drippingSlime || npc.drippingSparkleSlime; double heatDamageMult = slimed ? ((wormBoss || slimeGod) ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult) : BaseDoTDamageMult; @@ -1514,7 +1514,7 @@ namespace CalamityMod.NPCs } // Aquatic Scourge sets kill time in AI, not here. - if (BossKillTimes.TryGetValue(npc.type, out int revKillTime) && !AquaticScourgeIDList.Includes(npc)) + if (BossKillTimes.TryGetValue(npc.type, out int revKillTime) && !AquaticScourgeIDList.Includes(npc.type)) { KillTime = revKillTime; } @@ -1681,7 +1681,7 @@ namespace CalamityMod.NPCs #region Revengeance and Death Mode Stat Changes private void RevDeathStatChanges(NPC npc, Mod mod) { - if (DeathModeSplittingWormList.Includes(npc)) + if (DeathModeSplittingWormList.Includes(npc.type)) { if (CalamityWorld.death) npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.15); @@ -1735,7 +1735,7 @@ namespace CalamityMod.NPCs npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.2); npc.npcSlots = 32f; } - else if (DestroyerIDList.Includes(npc)) + 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; @@ -1816,7 +1816,7 @@ namespace CalamityMod.NPCs { npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.4); } - else if (EaterOfWorldsIDList.Includes(npc)) + else if (EaterOfWorldsIDList.Includes(npc.type)) { npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.2); @@ -2777,7 +2777,7 @@ namespace CalamityMod.NPCs { if (!NPC.downedMechBossAny) { - if (DestroyerIDList.Includes(npc) || npc.type == NPCID.Probe || SkeletronPrimeIDList.Includes(npc) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == NPCType()) + if (DestroyerIDList.Includes(npc.type) || npc.type == NPCID.Probe || SkeletronPrimeIDList.Includes(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == NPCType()) { double multiplier = Main.expertMode ? EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; npc.lifeMax = (int)Math.Round(npc.lifeMax * multiplier); @@ -2787,7 +2787,7 @@ namespace CalamityMod.NPCs } else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) { - if (DestroyerIDList.Includes(npc) || npc.type == NPCID.Probe || SkeletronPrimeIDList.Includes(npc) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == NPCType()) + if (DestroyerIDList.Includes(npc.type) || npc.type == NPCID.Probe || SkeletronPrimeIDList.Includes(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == NPCType()) { double multiplier = Main.expertMode ? EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; npc.lifeMax = (int)Math.Round(npc.lifeMax * multiplier); @@ -2814,7 +2814,7 @@ namespace CalamityMod.NPCs } } - if (Main.hardMode && HardmodeNPCNerfList.Includes(npc)) + if (Main.hardMode && HardmodeNPCNerfList.Includes(npc.type)) { npc.damage = (int)Math.Round(npc.damage * 0.75); npc.defDamage = npc.damage; @@ -2822,21 +2822,21 @@ namespace CalamityMod.NPCs if (DownedBossSystem.downedDoG) { - if (PumpkinMoonBuffList.IsPumpkinMoonBuffNPC(npc)) + if (PumpkinMoonBuffList.Includes(npc.type)) { npc.lifeMax = (int)Math.Round(npc.lifeMax * 3.5); npc.damage += 30; npc.life = npc.lifeMax; npc.defDamage = npc.damage; } - else if (FrostMoonBuffList.IsFrostMoonBuffNPC(npc)) + else if (FrostMoonBuffList.Includes(npc.type)) { npc.lifeMax = (int)Math.Round(npc.lifeMax * 2.5); npc.damage += 30; npc.life = npc.lifeMax; npc.defDamage = npc.damage; } - else if (EclipseBuffList.IsEclipseBuffNPC(npc)) + else if (EclipseBuffList.Includes(npc.type)) { npc.lifeMax = (int)Math.Round(npc.lifeMax * 5D); npc.damage += 30; @@ -2847,7 +2847,7 @@ namespace CalamityMod.NPCs if (NPC.downedMoonlord) { - if (BuffedDungeonEnemiesList.IsNPCBuffedDungeonEnemy(npc)) + if (BuffedDungeonEnemiesList.Includes(npc.type)) { npc.lifeMax = (int)Math.Round(npc.lifeMax * 2.5); npc.damage += 30; @@ -3594,11 +3594,11 @@ namespace CalamityMod.NPCs ApplyDR(npc, ref modifiers); // Damage reduction on spawn for certain worm bosses. - if (EaterOfWorldsIDList.Includes(npc) && newAI[1] < EaterOfWorldsAI.DRIncreaseTime) + 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) && newAI[1] < DestroyerAI.DRIncreaseTime) + 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)) + if (AstrumDeusIDList.Includes(npc.type)) { float drTime = newAI[0] != 0f ? 300f : 600f; if (newAI[1] < drTime) @@ -3810,7 +3810,7 @@ namespace CalamityMod.NPCs } // Setting this in SetDefaults will disable expert mode scaling, so put it here instead - if (ZeroContactDamageNPCList.Includes(npc) && (npc.type != NPCID.RuneWizard || !Main.zenithWorld)) + if (ZeroContactDamageNPCList.Includes(npc.type) && (npc.type != NPCID.RuneWizard || !Main.zenithWorld)) npc.damage = 0; // Don't do damage for 42 frames after spawning in @@ -6055,10 +6055,10 @@ namespace CalamityMod.NPCs modifiers.SourceDamage *= 0.1f; // True melee resists - if (DesertScourgeIDList.Includes(npc) || EaterOfWorldsIDList.Includes(npc) || npc.type == NPCID.Creeper || - PerforatorWormIDList.Includes(npc) || AquaticScourgeIDList.Includes(npc) || DestroyerIDList.Includes(npc) || - AstrumDeusIDList.Includes(npc) || StormWeaverIDList.Includes(npc) || ThanatosIDList.Includes(npc) || - npc.type == NPCType() || npc.type == NPCType() || AresIDList.Includes(npc) || npc.type == NPCType() || + if (DesertScourgeIDList.Includes(npc.type) || EaterOfWorldsIDList.Includes(npc.type) || npc.type == NPCID.Creeper || + PerforatorWormIDList.Includes(npc.type) || AquaticScourgeIDList.Includes(npc.type) || DestroyerIDList.Includes(npc.type) || + AstrumDeusIDList.Includes(npc.type) || StormWeaverIDList.Includes(npc.type) || ThanatosIDList.Includes(npc.type) || + npc.type == NPCType() || npc.type == NPCType() || AresIDList.Includes(npc.type) || npc.type == NPCType() || npc.type == NPCType()) { float damageMult = ThanatosIDList.Includes(npc.type) ? 0.35f : (DesertScourgeIDList.Includes(npc.type) || npc.type == NPCType()) ? 0.75f : 0.5f; @@ -6225,15 +6225,15 @@ namespace CalamityMod.NPCs { // Eater of Worlds has a vanilla resist in Expert+, this gives it to him in Normal mode // Note that Calamity reduces the vanilla resist from 80% to 60% - bool hasResist = EaterOfWorldsIDList.Includes(npc) && !Main.expertMode; + bool hasResist = EaterOfWorldsIDList.Includes(npc.type) && !Main.expertMode; // Add a resist for BoC's creepers and Prehardmode worm bosses - if (npc.type == NPCID.Creeper || DesertScourgeIDList.Includes(npc) || PerforatorWormIDList.Includes(npc)) + if (npc.type == NPCID.Creeper || DesertScourgeIDList.Includes(npc.type) || PerforatorWormIDList.Includes(npc.type)) hasResist = true; if (hasResist) modifiers.SourceDamage *= 0.4f; } - if (PierceResistList.HasPierceResist(npc)) + if (PierceResistList.Includes(npc.type)) PierceResistGlobal(projectile, npc, ref modifiers); if (modPlayer.camper && !player.StandingStill()) @@ -6248,11 +6248,11 @@ namespace CalamityMod.NPCs private void PierceResistGlobal(Projectile projectile, NPC npc, ref NPC.HitModifiers modifiers) { // Thanatos segments do not trigger pierce resistance if they are closed - if (ThanatosIDList.Includes(npc) && unbreakableDR) + if (ThanatosIDList.Includes(npc.type) && unbreakableDR) return; // Isolates projectiles which ignore pierce resist only on Leviathan and Astrum Aureus - if ((npc.type == NPCType() || npc.type == NPCType()) && PierceResistExceptionLeviAureusList.IsException(projectile)) + if ((npc.type == NPCType() || npc.type == NPCType()) && PierceResistExceptionLeviAureusList.Includes(projectile.type)) return; float damageReduction = projectile.Calamity().timesPierced * CalamityGlobalProjectile.PierceResistHarshness; @@ -6261,7 +6261,7 @@ namespace CalamityMod.NPCs modifiers.FinalDamage *= 1f - damageReduction; - if ((projectile.penetrate > 1 || projectile.penetrate == -1) && !PierceResistExceptionList.IsException(projectile) && !projectile.CountsAsClass() && projectile.aiStyle != 15 && projectile.aiStyle != 39 && projectile.aiStyle != 99) + if ((projectile.penetrate > 1 || projectile.penetrate == -1) && !PierceResistExceptionList.Includes(projectile.type) && !projectile.CountsAsClass() && projectile.aiStyle != 15 && projectile.aiStyle != 39 && projectile.aiStyle != 99) projectile.Calamity().timesPierced++; } @@ -7273,7 +7273,7 @@ namespace CalamityMod.NPCs } if (npc.type != NPCID.BrainofCthulhu && (npc.type != NPCID.DukeFishron || npc.ai[0] <= 9f) && npc.active) { - if (CalamityClientConfig.Instance.DebuffDisplay && (npc.boss || BossHealthBarManager.MinibossHPBarList.Contains(npc.type) || BossHealthBarManager.OneToMany.ContainsKey(npc.type) || NeedsDebuffIconDisplayList.IsNPCNeedDebuffIconDisplay(npc))) + if (CalamityClientConfig.Instance.DebuffDisplay && (npc.boss || BossHealthBarManager.MinibossHPBarList.Contains(npc.type) || BossHealthBarManager.OneToMany.ContainsKey(npc.type) || NeedsDebuffIconDisplayList.Includes(npc.type))) { List currentDebuffs = new List() { }; @@ -7396,7 +7396,7 @@ namespace CalamityMod.NPCs if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { - if (npc.type == NPCID.SkeletronPrime || npc.type == NPCType() || DestroyerIDList.Includes(npc)) + if (npc.type == NPCID.SkeletronPrime || npc.type == NPCType() || DestroyerIDList.Includes(npc.type)) return false; } @@ -7663,7 +7663,7 @@ namespace CalamityMod.NPCs } // Destroyer drawing and laser telegraphs - else if (DestroyerIDList.Includes(npc) && !npc.IsABestiaryIconDummy) + else if (DestroyerIDList.Includes(npc.type) && !npc.IsABestiaryIconDummy) { Texture2D npcTexture = TextureAssets.Npc[npc.type].Value; int frameHeight = npcTexture.Height / Main.npcFrameCount[npc.type]; @@ -8680,13 +8680,13 @@ namespace CalamityMod.NPCs #region Should Affect NPC public static bool ShouldAffectNPC(NPC target) { - if (EaterOfWorldsIDList.Includes(target) || DestroyerIDList.Includes(target)) + if (EaterOfWorldsIDList.Includes(target.type) || DestroyerIDList.Includes(target.type)) return false; if (target.damage > 0 && !target.boss && !target.friendly && !target.dontTakeDamage && target.type != NPCID.Creeper && target.type != NPCType() && target.type != NPCID.MourningWood && target.type != NPCID.Everscream && target.type != NPCID.SantaNK1 && target.type != NPCType() && target.type != NPCType() && target.type != NPCType() && target.type != NPCType() && target.type != NPCID.GolemFistLeft && target.type != NPCID.GolemFistRight && - target.type != NPCType() && target.type != NPCType() && target.type != NPCID.DD2Betsy && !EnemyImmunitiesList.IsNPCImmune(target) && !AcidRainEvent.AllMinibosses.Contains(target.type)) + target.type != NPCType() && target.type != NPCType() && target.type != NPCID.DD2Betsy && !EnemyImmunitiesList.Includes(target.type) && !AcidRainEvent.AllMinibosses.Contains(target.type)) { return true; } diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index e94c338f3d..087ef5ab10 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -1706,17 +1706,17 @@ DukeEditFailed: // All Moss Hornets // Needler @ 4% Normal, 6.67% Expert+ - if (MossHornetList.IsMossHornet(npc)) + if (MossHornetList.Includes(npc.type)) npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 25, 15)); // All Skeletons // Ancient Bone Dust @ 20% Normal, 33.33% Expert+ - if (SkeletonList.IsSkeleton(npc)) + if (SkeletonList.IsSkeleton(npc.type)) npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 5, 3)); // All Hardmode Dungeon Enemies // Ectoplasm @ 20% - if (BuffedDungeonEnemiesList.IsNPCBuffedDungeonEnemy(npc)) + if (BuffedDungeonEnemiesList.Includes(npc.type)) npcLoot.Add(ItemID.Ectoplasm, 5); #endregion @@ -1784,7 +1784,7 @@ DukeEditFailed: public override bool PreKill(NPC npc) { // Stop Eater of Worlds segments and Brain of Cthulhu Creepers from dropping partial loot in Rev+ - if (CalamityWorld.revenge && (EaterOfWorldsIDList.Includes(npc) || npc.type == NPCID.Creeper)) + if (CalamityWorld.revenge && (EaterOfWorldsIDList.Includes(npc.type) || npc.type == NPCID.Creeper)) DropHelper.BlockDrops(ItemID.DemoniteOre, ItemID.ShadowScale, ItemID.CrimtaneOre, ItemID.TissueSample); // Boss Rush pre-kill effects diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index 0573c8f019..37775253f2 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -1028,7 +1028,7 @@ namespace CalamityMod.NPCs public void BoundNPCSafety(Mod mod, NPC npc) { // Make Bound Town NPCs take no damage - if (BoundNPCIDList.Includes(npc)) + if (BoundNPCIDList.Includes(npc.type)) { npc.dontTakeDamageFromHostiles = true; } diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 8043e814eb..5684ebbbbc 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -1613,7 +1613,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { int buffID = NPC.buffType[l]; - bool shouldHalveDuration = DebuffsList.IsDebuff(buffID); + bool shouldHalveDuration = DebuffsList.Includes(buffID); if (shouldHalveDuration && NPC.buffTime[l] > 4) NPC.buffTime[l] = 4; diff --git a/Projectiles/Boss/BrimstoneMonster.cs b/Projectiles/Boss/BrimstoneMonster.cs index 3dab41e24a..143bd0df9f 100644 --- a/Projectiles/Boss/BrimstoneMonster.cs +++ b/Projectiles/Boss/BrimstoneMonster.cs @@ -351,7 +351,7 @@ namespace CalamityMod.Projectiles.Boss for (int l = 0; l < Player.MaxBuffs; l++) { int buffType = target.buffType[l]; - if (target.buffTime[l] > 0 && AmalgamBuffList.IsBuffBoostedByAmalgan(buffType)) + if (target.buffTime[l] > 0 && AmalgamBuffList.Includes(buffType)) { target.DelBuff(l); l--; diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index f347c9a51c..5d772067df 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -13,11 +13,9 @@ using CalamityMod.ExtraTextures; using CalamityMod.Items.Accessories; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.NPCs; -using CalamityMod.NPCs.Cryogen; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.PlagueEnemies; using CalamityMod.Particles; -using CalamityMod.Projectiles.BaseProjectiles; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Ranged; @@ -195,7 +193,7 @@ namespace CalamityMod.Projectiles { // TODO -- it would be nice to move frame one hacks here, but this runs in the middle of NewProjectile // which is way too early, the projectile's own initialization isn't even done yet - + CreatedByPlayerDash = source is ProjectileSource_PlayerDashHit; IEntitySource sourceItem = source as EntitySource_ItemUse_WithAmmo; @@ -3438,7 +3436,7 @@ namespace CalamityMod.Projectiles if (NPC.downedMoonlord) { - if (BuffedDungeonProjectilesList.IsProjectileBuffed(projectile)) + if (BuffedDungeonProjectilesList.Includes(projectile.type)) { // ai[1] being set to 1 is done only by the Calamity usages of these projectiles in Skeletron and Skeletron Prime boss fights bool isSkeletronBossProjectile = (projectile.type == ProjectileID.RocketSkeleton || projectile.type == ProjectileID.Shadowflames) && projectile.ai[1] > 0f; @@ -3453,7 +3451,7 @@ namespace CalamityMod.Projectiles if (DownedBossSystem.downedDoG && (Main.pumpkinMoon || Main.snowMoon || Main.eclipse)) { - if (EventProjectileBuffList.IsEventBuffProjectile(projectile)) + if (EventProjectileBuffList.Includes(projectile.type)) projectile.damage += 15; } @@ -3886,7 +3884,7 @@ namespace CalamityMod.Projectiles } // Adds Elemental Gauntlet dust to melee projectiles to mirror Fire Gauntlet's behavior. - if (modPlayer.eGauntlet && modPlayer.eGauntletVisuals && projectile.CountsAsClass() ) + if (modPlayer.eGauntlet && modPlayer.eGauntletVisuals && projectile.CountsAsClass()) { if (Main.rand.NextBool(3)) { @@ -4134,7 +4132,7 @@ namespace CalamityMod.Projectiles bool isPlayerNear = WorldGen.PlayerLOS(i, j); bool success = WorldGen.GrowPalmTree(i, j); if (success && isPlayerNear) - WorldGen.TreeGrowFXCheck(i, j); + WorldGen.TreeGrowFXCheck(i, j); } else if (tile.TileType == ModContent.TileType()) { diff --git a/Projectiles/Healing/AbsorberAura.cs b/Projectiles/Healing/AbsorberAura.cs index 81429fed0a..794e2bf4f1 100644 --- a/Projectiles/Healing/AbsorberAura.cs +++ b/Projectiles/Healing/AbsorberAura.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Healing for (int l = 0; l < Player.MaxBuffs; l++) { int buffID = player.buffType[l]; - if (player.buffTime[l] > 2 && DebuffsList.IsDebuff(buffID)) + if (player.buffTime[l] > 2 && DebuffsList.Includes(buffID)) { player.buffTime[l] *= 0; } diff --git a/Projectiles/Healing/BlueJellyAura.cs b/Projectiles/Healing/BlueJellyAura.cs index a7e947e665..1282ea8349 100644 --- a/Projectiles/Healing/BlueJellyAura.cs +++ b/Projectiles/Healing/BlueJellyAura.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Healing for (int l = 0; l < Player.MaxBuffs; l++) { int buffID = player.buffType[l]; - if (player.buffTime[l] > 2 && DebuffsList.IsDebuff(buffID)) + if (player.buffTime[l] > 2 && DebuffsList.Includes(buffID)) { player.buffTime[l] *= 0; } diff --git a/Projectiles/Healing/GreenJellyAura.cs b/Projectiles/Healing/GreenJellyAura.cs index c8882093f0..3b41df93d3 100644 --- a/Projectiles/Healing/GreenJellyAura.cs +++ b/Projectiles/Healing/GreenJellyAura.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Healing for (int l = 0; l < Player.MaxBuffs; l++) { int buffID = player.buffType[l]; - if (player.buffTime[l] > 2 && DebuffsList.IsDebuff(buffID)) + if (player.buffTime[l] > 2 && DebuffsList.Includes(buffID)) { player.buffTime[l] *= 0; } diff --git a/Systems/Collections/AlcoholsList.cs b/Systems/Collections/AlcoholsList.cs index 43c2e09126..e4af8ac36e 100644 --- a/Systems/Collections/AlcoholsList.cs +++ b/Systems/Collections/AlcoholsList.cs @@ -46,6 +46,6 @@ namespace CalamityMod.Systems.Collections /// /// A shorthand method to check whether or not a buff ID is an alcohol. /// - public static bool HasAlcoholBuff(int buffID) => List.Contains(buffID); + public static bool Includes(int buffID) => List.Contains(buffID); } } diff --git a/Systems/Collections/AmalgamBuffLists.cs b/Systems/Collections/AmalgamBuffLists.cs index 06b178e8b0..111cc58e73 100644 --- a/Systems/Collections/AmalgamBuffLists.cs +++ b/Systems/Collections/AmalgamBuffLists.cs @@ -118,6 +118,6 @@ namespace CalamityMod.Systems.Collections /// /// A shorthand method to check whether or not a buff is boosted by The Amalgam or not. /// - public static bool IsBuffBoostedByAmalgan(int buffID) => List.Contains(buffID); + public static bool Includes(int buffID) => List.Contains(buffID); } } diff --git a/Systems/Collections/AutoreuseableSpearsList.cs b/Systems/Collections/AutoreuseableSpearsList.cs index 6853bfc155..80d81b13f5 100644 --- a/Systems/Collections/AutoreuseableSpearsList.cs +++ b/Systems/Collections/AutoreuseableSpearsList.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -42,6 +41,6 @@ namespace CalamityMod.Systems.Collections /// /// A shorthand method to check whether or not an item is an autoreusable spear. /// - public static bool IsAutoreuseableSpear(Item item) => List.Contains(item.type); + public static bool Includes(int itemType) => List.Contains(itemType); } } diff --git a/Systems/Collections/BlacklistedWeaponsWithToolPowerList.cs b/Systems/Collections/BlacklistedWeaponsWithToolPowerList.cs index 708d982295..769faa281d 100644 --- a/Systems/Collections/BlacklistedWeaponsWithToolPowerList.cs +++ b/Systems/Collections/BlacklistedWeaponsWithToolPowerList.cs @@ -2,7 +2,6 @@ using CalamityMod.Items.Tools; using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.Items.Weapons.Melee; -using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -34,6 +33,6 @@ namespace CalamityMod.Systems.Collections /// /// A shorthand method to check if this Item is Blacklisted. /// - public static bool IsBlacklistedItem(Item item) => List.Contains(item.type); + public static bool Includes(int itemType) => List.Contains(itemType); } } diff --git a/Systems/Collections/BuffedDungeonProjectilesList.cs b/Systems/Collections/BuffedDungeonProjectilesList.cs index 1070655e7a..2d847d0d29 100644 --- a/Systems/Collections/BuffedDungeonProjectilesList.cs +++ b/Systems/Collections/BuffedDungeonProjectilesList.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -33,6 +32,6 @@ namespace CalamityMod.Systems.Collections /// /// A shorthand method to check if this projectile is a buffed Dungeon projectile. /// - public static bool IsProjectileBuffed(Projectile proj) => List.Contains(proj.type); + public static bool Includes(int projType) => List.Contains(projType); } } diff --git a/Systems/Collections/ConfusionDebuffImmunitiesList.cs b/Systems/Collections/ConfusionDebuffImmunitiesList.cs index c2eeed2c0d..48a0214b2e 100644 --- a/Systems/Collections/ConfusionDebuffImmunitiesList.cs +++ b/Systems/Collections/ConfusionDebuffImmunitiesList.cs @@ -2,7 +2,6 @@ using CalamityMod.NPCs.Astral; using CalamityMod.NPCs.Crags; using CalamityMod.NPCs.NormalNPCs; -using Terraria; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -54,6 +53,6 @@ namespace CalamityMod.Systems.Collections /// /// A shorthand method to check if an NPC is supposed to be immune to the Confusion debuff. /// - public static bool IsNPCImmune(NPC npc) => List.Contains(npc.type); + public static bool Includes(int npcType) => List.Contains(npcType); } } diff --git a/Systems/Collections/DebuffsList.cs b/Systems/Collections/DebuffsList.cs index 6dc4cd1f66..39b22ffc30 100644 --- a/Systems/Collections/DebuffsList.cs +++ b/Systems/Collections/DebuffsList.cs @@ -95,6 +95,6 @@ namespace CalamityMod.Systems.Collections /// /// A shorthand method to check if a buff ID is a debuff. /// - public static bool IsDebuff(int buffID) => List.Contains(buffID); + public static bool Includes(int buffID) => List.Contains(buffID); } } diff --git a/Systems/Collections/EventProjectileBuffList.cs b/Systems/Collections/EventProjectileBuffList.cs index e54f8ba499..9f3db41e46 100644 --- a/Systems/Collections/EventProjectileBuffList.cs +++ b/Systems/Collections/EventProjectileBuffList.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -39,6 +38,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool IsEventBuffProjectile(Projectile projectile) => List.Contains(projectile.type); + public static bool Includes(int projType) => List.Contains(projType); } } diff --git a/Systems/Collections/FireDebuffsList.cs b/Systems/Collections/FireDebuffsList.cs index dabf894cb4..f68d38db98 100644 --- a/Systems/Collections/FireDebuffsList.cs +++ b/Systems/Collections/FireDebuffsList.cs @@ -38,6 +38,6 @@ namespace CalamityMod.Systems.Collections /// /// A shorthand method to check if a buff ID is a fire debuff. /// - public static bool IsFireDebuff(int buffID) => List.Contains(buffID); + public static bool Includes(int buffID) => List.Contains(buffID); } } diff --git a/Systems/Collections/FriendlyBeesList.cs b/Systems/Collections/FriendlyBeesList.cs index 370b8a76f3..4ccdaf609f 100644 --- a/Systems/Collections/FriendlyBeesList.cs +++ b/Systems/Collections/FriendlyBeesList.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -34,6 +33,6 @@ namespace CalamityMod.Systems.Collections /// /// A shorthand method to check if a projectile is a friendly bee. /// - public static bool IsFriendlyBee(Projectile proj) => List.Contains(proj.type); + public static bool Includes(int projType) => List.Contains(projType); } } diff --git a/Systems/Collections/HighTestFishingPoleList.cs b/Systems/Collections/HighTestFishingPoleList.cs index 743f869edd..aea4781598 100644 --- a/Systems/Collections/HighTestFishingPoleList.cs +++ b/Systems/Collections/HighTestFishingPoleList.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using CalamityMod.Items.Fishing.FishingRods; -using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -23,6 +22,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool IsHighTestFishingPole(Item item) => List.Contains(item.type); + public static bool Includes(int itemType) => List.Contains(itemType); } } diff --git a/Systems/Collections/ItemsForcedInsideWorldList.cs b/Systems/Collections/ItemsForcedInsideWorldList.cs index 55ef699fd5..3fda7e85be 100644 --- a/Systems/Collections/ItemsForcedInsideWorldList.cs +++ b/Systems/Collections/ItemsForcedInsideWorldList.cs @@ -11,7 +11,6 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; -using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -106,6 +105,6 @@ namespace CalamityMod.Systems.Collections /// /// A shorthand method to check whether or not an item is an item that should be forced inside the world map. /// - public static bool IsItemForcedInsideWorld(Item item) => List.Contains(item.type); + public static bool Includes(int itemType) => List.Contains(itemType); } } diff --git a/Systems/Collections/LivingFireTilesList.cs b/Systems/Collections/LivingFireTilesList.cs index 32b10bce83..81b2d27c33 100644 --- a/Systems/Collections/LivingFireTilesList.cs +++ b/Systems/Collections/LivingFireTilesList.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using CalamityMod.Tiles.LivingFire; -using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -36,6 +35,6 @@ namespace CalamityMod.Systems.Collections /// /// A shorthand method to check whether or not a tile is a Living-Fire-type of tile. /// - public static bool IsLivingFireTile(Tile tile) => List.Contains(tile.TileType); + public static bool Includes(int tileType) => List.Contains(tileType); } } diff --git a/Systems/Collections/MagicGunIDList.cs b/Systems/Collections/MagicGunIDList.cs index bc1b787287..510ee2f898 100644 --- a/Systems/Collections/MagicGunIDList.cs +++ b/Systems/Collections/MagicGunIDList.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using CalamityMod.Items.Weapons.DraedonsArsenal; using CalamityMod.Items.Weapons.Magic; -using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -61,6 +60,6 @@ namespace CalamityMod.Systems.Collections /// /// A shorthand method to check if this Item is Magic Gun. /// - public static bool IsMagicGun(Item item) => List.Contains(item.type); + public static bool Includes(int itemType) => List.Contains(itemType); } } diff --git a/Systems/Collections/NPCIDs/AquaticScourgeIDList.cs b/Systems/Collections/NPCIDs/AquaticScourgeIDList.cs index b52a95d4d1..e6b8dae864 100644 --- a/Systems/Collections/NPCIDs/AquaticScourgeIDList.cs +++ b/Systems/Collections/NPCIDs/AquaticScourgeIDList.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using CalamityMod.NPCs.AquaticScourge; -using Terraria; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -23,7 +22,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool Includes(NPC npc) => List.Contains(npc.type); public static bool Includes(int npcType) => List.Contains(npcType); } } diff --git a/Systems/Collections/NPCIDs/AresIDList.cs b/Systems/Collections/NPCIDs/AresIDList.cs index bd347e99d5..09b52cdd3a 100644 --- a/Systems/Collections/NPCIDs/AresIDList.cs +++ b/Systems/Collections/NPCIDs/AresIDList.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using CalamityMod.NPCs.ExoMechs.Ares; -using Terraria; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -24,7 +23,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool Includes(NPC npc) => List.Contains(npc.type); public static bool Includes(int npcType) => List.Contains(npcType); } } diff --git a/Systems/Collections/NPCIDs/AstrumDeusIDList.cs b/Systems/Collections/NPCIDs/AstrumDeusIDList.cs index 3394ccc051..d5ddc2b632 100644 --- a/Systems/Collections/NPCIDs/AstrumDeusIDList.cs +++ b/Systems/Collections/NPCIDs/AstrumDeusIDList.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using CalamityMod.NPCs.AstrumDeus; -using Terraria; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -22,7 +21,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool Includes(NPC npc) => List.Contains(npc.type); public static bool Includes(int npcType) => List.Contains(npcType); } } diff --git a/Systems/Collections/NPCIDs/BoundNPCIDList.cs b/Systems/Collections/NPCIDs/BoundNPCIDList.cs index 1a447dd339..a3667b2fd0 100644 --- a/Systems/Collections/NPCIDs/BoundNPCIDList.cs +++ b/Systems/Collections/NPCIDs/BoundNPCIDList.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -25,7 +24,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool Includes(NPC npc) => List.Contains(npc.type); public static bool Includes(int npcType) => List.Contains(npcType); } } diff --git a/Systems/Collections/NPCIDs/CosmicGuardianIDList.cs b/Systems/Collections/NPCIDs/CosmicGuardianIDList.cs index 9dc00012c5..ebacf52a13 100644 --- a/Systems/Collections/NPCIDs/CosmicGuardianIDList.cs +++ b/Systems/Collections/NPCIDs/CosmicGuardianIDList.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using CalamityMod.NPCs.DevourerofGods; -using Terraria; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -22,7 +21,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool Includes(NPC npc) => List.Contains(npc.type); public static bool Includes(int npcType) => List.Contains(npcType); } } diff --git a/Systems/Collections/NPCIDs/DesertScourgeIDList.cs b/Systems/Collections/NPCIDs/DesertScourgeIDList.cs index c76e65a551..280a969845 100644 --- a/Systems/Collections/NPCIDs/DesertScourgeIDList.cs +++ b/Systems/Collections/NPCIDs/DesertScourgeIDList.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using CalamityMod.NPCs.DesertScourge; -using Terraria; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -22,7 +21,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool Includes(NPC npc) => List.Contains(npc.type); public static bool Includes(int npcType) => List.Contains(npcType); } } diff --git a/Systems/Collections/NPCIDs/DestroyerIDList.cs b/Systems/Collections/NPCIDs/DestroyerIDList.cs index 90b3bb3f48..5199177076 100644 --- a/Systems/Collections/NPCIDs/DestroyerIDList.cs +++ b/Systems/Collections/NPCIDs/DestroyerIDList.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -21,7 +20,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool Includes(NPC npc) => List.Contains(npc.type); public static bool Includes(int npcType) => List.Contains(npcType); } } diff --git a/Systems/Collections/NPCIDs/DevourerOfGodsIDList.cs b/Systems/Collections/NPCIDs/DevourerOfGodsIDList.cs index 38382aaa06..ff37b9725c 100644 --- a/Systems/Collections/NPCIDs/DevourerOfGodsIDList.cs +++ b/Systems/Collections/NPCIDs/DevourerOfGodsIDList.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using CalamityMod.NPCs.DevourerofGods; -using Terraria; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -22,7 +21,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool Includes(NPC npc) => List.Contains(npc.type); public static bool Includes(int npcType) => List.Contains(npcType); } } diff --git a/Systems/Collections/NPCIDs/EaterOfWorldsIDList.cs b/Systems/Collections/NPCIDs/EaterOfWorldsIDList.cs index 6047c906e9..e4c2f65476 100644 --- a/Systems/Collections/NPCIDs/EaterOfWorldsIDList.cs +++ b/Systems/Collections/NPCIDs/EaterOfWorldsIDList.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -21,7 +20,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool Includes(NPC npc) => List.Contains(npc.type); public static bool Includes(int npcType) => List.Contains(npcType); } } diff --git a/Systems/Collections/NPCIDs/GolemIDList.cs b/Systems/Collections/NPCIDs/GolemIDList.cs index c5ffc77281..db9e1b362a 100644 --- a/Systems/Collections/NPCIDs/GolemIDList.cs +++ b/Systems/Collections/NPCIDs/GolemIDList.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -23,7 +22,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool Includes(NPC npc) => List.Contains(npc.type); public static bool Includes(int npcType) => List.Contains(npcType); } } diff --git a/Systems/Collections/NPCIDs/PerforatorWormIDList.cs b/Systems/Collections/NPCIDs/PerforatorWormIDList.cs index 8ccfb3db4a..4bb42decc1 100644 --- a/Systems/Collections/NPCIDs/PerforatorWormIDList.cs +++ b/Systems/Collections/NPCIDs/PerforatorWormIDList.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using CalamityMod.NPCs.Perforator; -using Terraria; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -28,7 +27,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool Includes(NPC npc) => List.Contains(npc.type); public static bool Includes(int npcType) => List.Contains(npcType); } } diff --git a/Systems/Collections/NPCIDs/RavagerIDList.cs b/Systems/Collections/NPCIDs/RavagerIDList.cs index 881b50596f..61dfdb3135 100644 --- a/Systems/Collections/NPCIDs/RavagerIDList.cs +++ b/Systems/Collections/NPCIDs/RavagerIDList.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using CalamityMod.NPCs.Ravager; -using Terraria; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -26,7 +25,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool Includes(NPC npc) => List.Contains(npc.type); public static bool Includes(int npcType) => List.Contains(npcType); } } diff --git a/Systems/Collections/NPCIDs/SkeletronPrimeIDList.cs b/Systems/Collections/NPCIDs/SkeletronPrimeIDList.cs index a8df27a800..21c182ddfa 100644 --- a/Systems/Collections/NPCIDs/SkeletronPrimeIDList.cs +++ b/Systems/Collections/NPCIDs/SkeletronPrimeIDList.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using CalamityMod.NPCs.NormalNPCs; -using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -26,7 +25,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool Includes(NPC npc) => List.Contains(npc.type); public static bool Includes(int npcType) => List.Contains(npcType); } } diff --git a/Systems/Collections/NPCIDs/SlimeGodIDList.cs b/Systems/Collections/NPCIDs/SlimeGodIDList.cs index 17604f9a52..85bdebd8b6 100644 --- a/Systems/Collections/NPCIDs/SlimeGodIDList.cs +++ b/Systems/Collections/NPCIDs/SlimeGodIDList.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using CalamityMod.NPCs.SlimeGod; -using Terraria; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -24,7 +23,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool Includes(NPC npc) => List.Contains(npc.type); public static bool Includes(int npcType) => List.Contains(npcType); } } diff --git a/Systems/Collections/NPCIDs/StormWeaverIDList.cs b/Systems/Collections/NPCIDs/StormWeaverIDList.cs index 6263f866bc..39f1ecd0fa 100644 --- a/Systems/Collections/NPCIDs/StormWeaverIDList.cs +++ b/Systems/Collections/NPCIDs/StormWeaverIDList.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using CalamityMod.NPCs.StormWeaver; -using Terraria; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -22,7 +21,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool Includes(NPC npc) => List.Contains(npc.type); public static bool Includes(int npcType) => List.Contains(npcType); } } diff --git a/Systems/Collections/NPCIDs/ThanatosIDList.cs b/Systems/Collections/NPCIDs/ThanatosIDList.cs index 2741654250..8688eac6b6 100644 --- a/Systems/Collections/NPCIDs/ThanatosIDList.cs +++ b/Systems/Collections/NPCIDs/ThanatosIDList.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using CalamityMod.NPCs.ExoMechs.Thanatos; -using Terraria; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -23,7 +22,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool Includes(NPC npc) => List.Contains(npc.type); public static bool Includes(int npcType) => List.Contains(npcType); } } diff --git a/Systems/Collections/NPCVariants/AngryBonesList.cs b/Systems/Collections/NPCVariants/AngryBonesList.cs index c79cd682cd..f4263436dc 100644 --- a/Systems/Collections/NPCVariants/AngryBonesList.cs +++ b/Systems/Collections/NPCVariants/AngryBonesList.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -24,6 +23,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool IsAngryBones(NPC npc) => List.Contains(npc.type); + public static bool Includes(int npcType) => List.Contains(npcType); } } diff --git a/Systems/Collections/NPCVariants/DemonEyeList.cs b/Systems/Collections/NPCVariants/DemonEyeList.cs index e2a3b1e72f..a2c5fd39f8 100644 --- a/Systems/Collections/NPCVariants/DemonEyeList.cs +++ b/Systems/Collections/NPCVariants/DemonEyeList.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -32,6 +31,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool IsDemonEye(NPC npc) => List.Contains(npc.type); + public static bool Includes(int npcType) => List.Contains(npcType); } } diff --git a/Systems/Collections/NPCVariants/HornetList.cs b/Systems/Collections/NPCVariants/HornetList.cs index 48d0721499..823463d697 100644 --- a/Systems/Collections/NPCVariants/HornetList.cs +++ b/Systems/Collections/NPCVariants/HornetList.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -36,6 +35,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool IsHornet(NPC npc) => List.Contains(npc.type); + public static bool Includes(int npcType) => List.Contains(npcType); } } diff --git a/Systems/Collections/NPCVariants/MossHornetList.cs b/Systems/Collections/NPCVariants/MossHornetList.cs index 344437796f..616f0f4f2d 100644 --- a/Systems/Collections/NPCVariants/MossHornetList.cs +++ b/Systems/Collections/NPCVariants/MossHornetList.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -23,6 +22,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool IsMossHornet(NPC npc) => List.Contains(npc.type); + public static bool Includes(int npcType) => List.Contains(npcType); } } diff --git a/Systems/Collections/NPCVariants/SkeletonList.cs b/Systems/Collections/NPCVariants/SkeletonList.cs index d525b121a7..dbeefc444c 100644 --- a/Systems/Collections/NPCVariants/SkeletonList.cs +++ b/Systems/Collections/NPCVariants/SkeletonList.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -46,6 +45,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool IsSkeleton(NPC npc) => List.Contains(npc.type); + public static bool Includes(int npcType) => List.Contains(npcType); } } diff --git a/Systems/Collections/NPCVariants/ZombieList.cs b/Systems/Collections/NPCVariants/ZombieList.cs index de8077571c..6591c007da 100644 --- a/Systems/Collections/NPCVariants/ZombieList.cs +++ b/Systems/Collections/NPCVariants/ZombieList.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using CalamityMod.NPCs.NormalNPCs; -using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -55,6 +54,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool IsZombie(NPC npc) => List.Contains(npc.type); + public static bool Includes(int npcType) => List.Contains(npcType); } } diff --git a/Systems/Collections/NPCs/BossHPScalingList.cs b/Systems/Collections/NPCs/BossHPScalingList.cs index b43aa76caf..5912dbbc55 100644 --- a/Systems/Collections/NPCs/BossHPScalingList.cs +++ b/Systems/Collections/NPCs/BossHPScalingList.cs @@ -22,7 +22,6 @@ using CalamityMod.NPCs.Ravager; using CalamityMod.NPCs.Signus; using CalamityMod.NPCs.SlimeGod; using CalamityMod.NPCs.SupremeCalamitas; -using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -150,7 +149,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool Includes(NPC npc) => List.Contains(npc.type); public static bool Includes(int npcType) => List.Contains(npcType); } } diff --git a/Systems/Collections/NPCs/BuffedDungeonEnemiesList.cs b/Systems/Collections/NPCs/BuffedDungeonEnemiesList.cs index 341463c522..78c00a647b 100644 --- a/Systems/Collections/NPCs/BuffedDungeonEnemiesList.cs +++ b/Systems/Collections/NPCs/BuffedDungeonEnemiesList.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -48,6 +47,6 @@ namespace CalamityMod.Systems.Collections /// /// A shorthand method to check if an NPC is a buffed Dungeon enemy. /// - public static bool IsNPCBuffedDungeonEnemy(NPC npc) => List.Contains(npc.type); + public static bool Includes(int npcType) => List.Contains(npcType); } } diff --git a/Systems/Collections/NPCs/DeathModeSplittingWormList.cs b/Systems/Collections/NPCs/DeathModeSplittingWormList.cs index d6b9ecdd2f..9a9f638071 100644 --- a/Systems/Collections/NPCs/DeathModeSplittingWormList.cs +++ b/Systems/Collections/NPCs/DeathModeSplittingWormList.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -27,7 +26,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool Includes(NPC npc) => List.Contains(npc.type); public static bool Includes(int npcType) => List.Contains(npcType); } } diff --git a/Systems/Collections/NPCs/EclipseBuffList.cs b/Systems/Collections/NPCs/EclipseBuffList.cs index 5c0326a7f6..aaff7f27b1 100644 --- a/Systems/Collections/NPCs/EclipseBuffList.cs +++ b/Systems/Collections/NPCs/EclipseBuffList.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -38,6 +37,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool IsEclipseBuffNPC(NPC npc) => List.Contains(npc.type); + public static bool Includes(int npcType) => List.Contains(npcType); } } diff --git a/Systems/Collections/NPCs/EnemyImmunitiesList.cs b/Systems/Collections/NPCs/EnemyImmunitiesList.cs index e82e7e9dc5..667c66cc2b 100644 --- a/Systems/Collections/NPCs/EnemyImmunitiesList.cs +++ b/Systems/Collections/NPCs/EnemyImmunitiesList.cs @@ -20,7 +20,6 @@ using CalamityMod.NPCs.Ravager; using CalamityMod.NPCs.SlimeGod; using CalamityMod.NPCs.SunkenSea; using CalamityMod.NPCs.SupremeCalamitas; -using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -186,6 +185,6 @@ namespace CalamityMod.Systems.Collections /// /// A shorthand method to check if an NPC is in this list. /// - public static bool IsNPCImmune(NPC npc) => List.Contains(npc.type); + public static bool Includes(int npcType) => List.Contains(npcType); } } diff --git a/Systems/Collections/NPCs/FrostMoonBuffList.cs b/Systems/Collections/NPCs/FrostMoonBuffList.cs index 2c1fb19b83..d94d780e9e 100644 --- a/Systems/Collections/NPCs/FrostMoonBuffList.cs +++ b/Systems/Collections/NPCs/FrostMoonBuffList.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -36,6 +35,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool IsFrostMoonBuffNPC(NPC npc) => List.Contains(npc.type); + public static bool Includes(int npcType) => List.Contains(npcType); } } diff --git a/Systems/Collections/NPCs/HardmodeNPCNerfList.cs b/Systems/Collections/NPCs/HardmodeNPCNerfList.cs index e0ccc72228..a8d0a144bd 100644 --- a/Systems/Collections/NPCs/HardmodeNPCNerfList.cs +++ b/Systems/Collections/NPCs/HardmodeNPCNerfList.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -151,7 +150,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool Includes(NPC npc) => List.Contains(npc.type); public static bool Includes(int npcType) => List.Contains(npcType); } } diff --git a/Systems/Collections/NPCs/MinibossList.cs b/Systems/Collections/NPCs/MinibossList.cs index 5d2c0ea5a9..97353eb626 100644 --- a/Systems/Collections/NPCs/MinibossList.cs +++ b/Systems/Collections/NPCs/MinibossList.cs @@ -5,7 +5,6 @@ using CalamityMod.NPCs.GreatSandShark; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.PlagueEnemies; using CalamityMod.NPCs.SunkenSea; -using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -48,6 +47,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool IsMiniboss(NPC npc) => List.Contains(npc.type); + public static bool Includes(int npcType) => List.Contains(npcType); } } diff --git a/Systems/Collections/NPCs/NoRageWormSegmentList.cs b/Systems/Collections/NPCs/NoRageWormSegmentList.cs index fe9abb14ee..456dbaa828 100644 --- a/Systems/Collections/NPCs/NoRageWormSegmentList.cs +++ b/Systems/Collections/NPCs/NoRageWormSegmentList.cs @@ -6,7 +6,6 @@ using CalamityMod.NPCs.DevourerofGods; using CalamityMod.NPCs.ExoMechs.Ares; using CalamityMod.NPCs.ExoMechs.Thanatos; using CalamityMod.NPCs.StormWeaver; -using Terraria; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -43,6 +42,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool IsNoRageWormSegment(NPC npc) => List.Contains(npc.type); + public static bool Includes(int npcType) => List.Contains(npcType); } } diff --git a/Systems/Collections/NPCs/PierceResistList.cs b/Systems/Collections/NPCs/PierceResistList.cs index 575d8f8f71..efbe96843f 100644 --- a/Systems/Collections/NPCs/PierceResistList.cs +++ b/Systems/Collections/NPCs/PierceResistList.cs @@ -13,7 +13,6 @@ using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.NPCs.Ravager; using CalamityMod.NPCs.StormWeaver; using CalamityMod.NPCs.SupremeCalamitas; -using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -84,6 +83,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool HasPierceResist(NPC npc) => List.Contains(npc.type); + public static bool Includes(int npcType) => List.Contains(npcType); } } diff --git a/Systems/Collections/NPCs/PumpkinMoonBuffList.cs b/Systems/Collections/NPCs/PumpkinMoonBuffList.cs index 0408ce7de1..6ab32c0323 100644 --- a/Systems/Collections/NPCs/PumpkinMoonBuffList.cs +++ b/Systems/Collections/NPCs/PumpkinMoonBuffList.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -14,7 +13,7 @@ namespace CalamityMod.Systems.Collections public override void OnModLoad() { - List = + List = [ NPCID.Scarecrow1, NPCID.Scarecrow2, @@ -38,6 +37,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool IsPumpkinMoonBuffNPC(NPC npc) => List.Contains(npc.type); + public static bool Includes(int npcType) => List.Contains(npcType); } } diff --git a/Systems/Collections/NPCs/ZeroContactDamageNPCList.cs b/Systems/Collections/NPCs/ZeroContactDamageNPCList.cs index 714f8ded23..dbc3aa6ffd 100644 --- a/Systems/Collections/NPCs/ZeroContactDamageNPCList.cs +++ b/Systems/Collections/NPCs/ZeroContactDamageNPCList.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -150,7 +149,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool Includes(NPC npc) => List.Contains(npc.type); public static bool Includes(int npcType) => List.Contains(npcType); } } diff --git a/Systems/Collections/NeedsDebuffIconDisplayList.cs b/Systems/Collections/NeedsDebuffIconDisplayList.cs index fd7e93cc9d..1cd6d90efe 100644 --- a/Systems/Collections/NeedsDebuffIconDisplayList.cs +++ b/Systems/Collections/NeedsDebuffIconDisplayList.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using CalamityMod.NPCs.NormalNPCs; -using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -23,6 +22,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool IsNPCNeedDebuffIconDisplay(NPC npc) => List.Contains(npc.type); + public static bool Includes(int npcType) => List.Contains(npcType); } } diff --git a/Systems/Collections/PersistentBuffList.cs b/Systems/Collections/PersistentBuffList.cs index e85813b135..01e165e604 100644 --- a/Systems/Collections/PersistentBuffList.cs +++ b/Systems/Collections/PersistentBuffList.cs @@ -33,6 +33,6 @@ namespace CalamityMod.Systems.Collections /// /// A shorthand method to check if this buffType is a PersistentBuff. /// - public static bool IsPersistentBuff(int buffType) => List.Contains(buffType); + public static bool Includes(int buffType) => List.Contains(buffType); } } diff --git a/Systems/Collections/PierceResistExceptionLeviAureusList.cs b/Systems/Collections/PierceResistExceptionLeviAureusList.cs index 96fa4f0327..b53edb437d 100644 --- a/Systems/Collections/PierceResistExceptionLeviAureusList.cs +++ b/Systems/Collections/PierceResistExceptionLeviAureusList.cs @@ -2,7 +2,6 @@ using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; -using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -30,6 +29,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool IsException(Projectile projectile) => List.Contains(projectile.type); + public static bool Includes(int projectileType) => List.Contains(projectileType); } } diff --git a/Systems/Collections/PierceResistExceptionList.cs b/Systems/Collections/PierceResistExceptionList.cs index d018527a89..acbb5de9ca 100644 --- a/Systems/Collections/PierceResistExceptionList.cs +++ b/Systems/Collections/PierceResistExceptionList.cs @@ -6,7 +6,6 @@ using CalamityMod.Projectiles.Melee.MaceFlails; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -97,6 +96,6 @@ namespace CalamityMod.Systems.Collections public override void Unload() => List = null; - public static bool IsException(Projectile projectile) => List.Contains(projectile.type); + public static bool Includes(int projectileType) => List.Contains(projectileType); } } diff --git a/Systems/Collections/ProjectileDestroyExceptionsList.cs b/Systems/Collections/ProjectileDestroyExceptionsList.cs index ecfb0cdc0e..3c2315dc33 100644 --- a/Systems/Collections/ProjectileDestroyExceptionsList.cs +++ b/Systems/Collections/ProjectileDestroyExceptionsList.cs @@ -1,12 +1,10 @@ using System.Collections.Generic; -using System.Linq; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; -using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; @@ -144,6 +142,6 @@ namespace CalamityMod.Systems.Collections /// /// A shorthand method to check if a projectile belongs in the exception list. /// - public static bool IsDestroyException(Projectile proj) => List.Any(x => proj.type == x); + public static bool Includes(int projType) => List.Contains(projType); } } diff --git a/Systems/Collections/SicknessDebuffsList.cs b/Systems/Collections/SicknessDebuffsList.cs index 9bf886a662..7d687952a6 100644 --- a/Systems/Collections/SicknessDebuffsList.cs +++ b/Systems/Collections/SicknessDebuffsList.cs @@ -34,6 +34,6 @@ namespace CalamityMod.Systems.Collections /// /// A shorthand method to check if a buff ID is a Sickness Debuff. /// - public static bool IsSickenessDebuff(int buffID) => List.Contains(buffID); + public static bool Includes(int buffID) => List.Contains(buffID); } } diff --git a/Utilities/NPCDebuffs.cs b/Utilities/NPCDebuffs.cs index 0f4507cdc6..d14b07c8dc 100644 --- a/Utilities/NPCDebuffs.cs +++ b/Utilities/NPCDebuffs.cs @@ -100,13 +100,13 @@ namespace CalamityMod // // All bosses and several enemies are automatically immune to Pearl Aura. - if (EnemyImmunitiesList.IsNPCImmune(npc) || npc.boss) + if (EnemyImmunitiesList.Includes(npc.type) || npc.boss) NPCID.Sets.SpecificDebuffImmunity[npc.type][ModContent.BuffType()] = true; // Make all Cal NPCs immune to confused unless otherwise specified // Extra note: Clams are not in this list as they initially immune to Confused, but are no longer immune once aggro'd. This is set in their AI(). bool cal = npc.ModNPC != null && npc.ModNPC.Mod.Name.Equals(ModContent.GetInstance().Name); - if (!ConfusionDebuffImmunitiesList.IsNPCImmune(npc) && cal) + if (!ConfusionDebuffImmunitiesList.Includes(npc.type) && cal) NPCID.Sets.SpecificDebuffImmunity[npc.type][BuffID.Confused] = true; // Sets certain vanilla NPCs and all town NPCs to be immune to most debuffs. diff --git a/Utilities/PlayerUtils.cs b/Utilities/PlayerUtils.cs index 30ca104077..f804ba792d 100644 --- a/Utilities/PlayerUtils.cs +++ b/Utilities/PlayerUtils.cs @@ -906,7 +906,7 @@ namespace CalamityMod item.CountsAsClass() ); - bool heldItemIsTool = (item.pick > 0 || item.axe > 0 || item.hammer > 0) && !BlacklistedWeaponsWithToolPowerList.IsBlacklistedItem(item); + bool heldItemIsTool = (item.pick > 0 || item.axe > 0 || item.hammer > 0) && !BlacklistedWeaponsWithToolPowerList.Includes(item.type); bool heldItemCanBeUsed = item.useStyle != ItemUseStyleID.None; bool heldItemIsAccessoryOrAmmo = item.accessory || item.ammo != AmmoID.None; bool heldItemIsExcludedByModCall = DisabledSummonerNerfItemList.Includes(item.type); From 289dfa7dda7bf4e8f3f7abe660820ac76a5233e5 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 22:23:19 +0900 Subject: [PATCH 117/118] Compile Error fixes after rebase --- Balancing/BalancingChangesManager.cs | 2 +- NPCs/CalamityGlobalNPCLoot.cs | 2 +- Projectiles/Rogue/SlickCaneProjectile.cs | 6 ++---- Systems/Collections/ItemsForcedInsideWorldList.cs | 2 +- Systems/Collections/PierceResistExceptionLeviAureusList.cs | 1 + 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index 50a04f94b1..8462c19352 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -437,7 +437,7 @@ namespace CalamityMod.Balancing NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 45% resist to Prismatic Breaker's deathray. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.ThanatosIDs, Do(new ProjectileResistBalancingRule(0.55f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.55f, ProjectileType())))); // 45% resist to Wrathwing's stealth strike fireballs. NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.55f, ProjectileType())))); diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 087ef5ab10..a00ba5bde3 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -1711,7 +1711,7 @@ DukeEditFailed: // All Skeletons // Ancient Bone Dust @ 20% Normal, 33.33% Expert+ - if (SkeletonList.IsSkeleton(npc.type)) + if (SkeletonList.Includes(npc.type)) npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 5, 3)); // All Hardmode Dungeon Enemies diff --git a/Projectiles/Rogue/SlickCaneProjectile.cs b/Projectiles/Rogue/SlickCaneProjectile.cs index 8c0adbc6fe..95bc85c671 100644 --- a/Projectiles/Rogue/SlickCaneProjectile.cs +++ b/Projectiles/Rogue/SlickCaneProjectile.cs @@ -1,14 +1,12 @@ using System; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.NPCs.NormalNPCs; using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; -using Terraria.GameContent; -using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -82,7 +80,7 @@ namespace CalamityMod.Projectiles.Rogue { Player player = Main.player[Projectile.owner]; //Dont drop money from Dummies, WoF eyes and worm segments to make grinding money a bit harder and not give money from Dummies since that was apparently happening - if (Projectile.owner == Main.myPlayer && target.IsAnEnemy(false) && !target.dontCountMe && !CalamityLists.needsDebuffIconDisplayList.Contains(target.type)) + if (Projectile.owner == Main.myPlayer && target.IsAnEnemy(false) && !target.dontCountMe && !NeedsDebuffIconDisplayList.Includes(target.type)) { float moneyValueToDrop = target.value / Main.rand.NextFloat(15f, 35f); // Maximum of 50 silver, not counting steath strikes diff --git a/Systems/Collections/ItemsForcedInsideWorldList.cs b/Systems/Collections/ItemsForcedInsideWorldList.cs index 3fda7e85be..6fd8da39ab 100644 --- a/Systems/Collections/ItemsForcedInsideWorldList.cs +++ b/Systems/Collections/ItemsForcedInsideWorldList.cs @@ -3,7 +3,7 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.Magic; diff --git a/Systems/Collections/PierceResistExceptionLeviAureusList.cs b/Systems/Collections/PierceResistExceptionLeviAureusList.cs index b53edb437d..4c3f202da1 100644 --- a/Systems/Collections/PierceResistExceptionLeviAureusList.cs +++ b/Systems/Collections/PierceResistExceptionLeviAureusList.cs @@ -19,6 +19,7 @@ namespace CalamityMod.Systems.Collections ProjectileID.NettleBurstEnd, ProjectileID.NettleBurstLeft, ProjectileID.NettleBurstRight, + ProjectileID.PrincessWeapon, ProjectileType(), ProjectileType(), ProjectileType(), From e7a44f588e071c6cd353284bb7543c27de6f43ca Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 22:49:30 +0900 Subject: [PATCH 118/118] Reorganize NPCVariants to NPCIDs --- NPCs/CalamityGlobalNPCLoot.cs | 4 ++-- .../AngryBonesList.cs => NPCIDs/AngryBonesIDList.cs} | 2 +- .../{NPCVariants/DemonEyeList.cs => NPCIDs/DemonEyeIDList.cs} | 2 +- .../{NPCVariants/HornetList.cs => NPCIDs/HornetIDList.cs} | 2 +- .../MossHornetList.cs => NPCIDs/MossHornetIDList.cs} | 2 +- .../{NPCVariants/SkeletonList.cs => NPCIDs/SkeletonIDList.cs} | 2 +- .../{NPCVariants/ZombieList.cs => NPCIDs/ZombieIDList.cs} | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) rename Systems/Collections/{NPCVariants/AngryBonesList.cs => NPCIDs/AngryBonesIDList.cs} (92%) rename Systems/Collections/{NPCVariants/DemonEyeList.cs => NPCIDs/DemonEyeIDList.cs} (94%) rename Systems/Collections/{NPCVariants/HornetList.cs => NPCIDs/HornetIDList.cs} (95%) rename Systems/Collections/{NPCVariants/MossHornetList.cs => NPCIDs/MossHornetIDList.cs} (92%) rename Systems/Collections/{NPCVariants/SkeletonList.cs => NPCIDs/SkeletonIDList.cs} (96%) rename Systems/Collections/{NPCVariants/ZombieList.cs => NPCIDs/ZombieIDList.cs} (97%) diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index a00ba5bde3..486a3babb9 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -1706,12 +1706,12 @@ DukeEditFailed: // All Moss Hornets // Needler @ 4% Normal, 6.67% Expert+ - if (MossHornetList.Includes(npc.type)) + if (MossHornetIDList.Includes(npc.type)) npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 25, 15)); // All Skeletons // Ancient Bone Dust @ 20% Normal, 33.33% Expert+ - if (SkeletonList.Includes(npc.type)) + if (SkeletonIDList.Includes(npc.type)) npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 5, 3)); // All Hardmode Dungeon Enemies diff --git a/Systems/Collections/NPCVariants/AngryBonesList.cs b/Systems/Collections/NPCIDs/AngryBonesIDList.cs similarity index 92% rename from Systems/Collections/NPCVariants/AngryBonesList.cs rename to Systems/Collections/NPCIDs/AngryBonesIDList.cs index f4263436dc..7ca8a86472 100644 --- a/Systems/Collections/NPCVariants/AngryBonesList.cs +++ b/Systems/Collections/NPCIDs/AngryBonesIDList.cs @@ -4,7 +4,7 @@ using Terraria.ModLoader; namespace CalamityMod.Systems.Collections { - public sealed class AngryBonesList : ModSystem + public sealed class AngryBonesIDList : ModSystem { public static IList List { get; private set; } diff --git a/Systems/Collections/NPCVariants/DemonEyeList.cs b/Systems/Collections/NPCIDs/DemonEyeIDList.cs similarity index 94% rename from Systems/Collections/NPCVariants/DemonEyeList.cs rename to Systems/Collections/NPCIDs/DemonEyeIDList.cs index a2c5fd39f8..d0c72b67bf 100644 --- a/Systems/Collections/NPCVariants/DemonEyeList.cs +++ b/Systems/Collections/NPCIDs/DemonEyeIDList.cs @@ -4,7 +4,7 @@ using Terraria.ModLoader; namespace CalamityMod.Systems.Collections { - public sealed class DemonEyeList : ModSystem + public sealed class DemonEyeIDList : ModSystem { public static IList List { get; private set; } diff --git a/Systems/Collections/NPCVariants/HornetList.cs b/Systems/Collections/NPCIDs/HornetIDList.cs similarity index 95% rename from Systems/Collections/NPCVariants/HornetList.cs rename to Systems/Collections/NPCIDs/HornetIDList.cs index 823463d697..3cb3d5e17f 100644 --- a/Systems/Collections/NPCVariants/HornetList.cs +++ b/Systems/Collections/NPCIDs/HornetIDList.cs @@ -4,7 +4,7 @@ using Terraria.ModLoader; namespace CalamityMod.Systems.Collections { - public sealed class HornetList : ModSystem + public sealed class HornetIDList : ModSystem { public static IList List { get; private set; } diff --git a/Systems/Collections/NPCVariants/MossHornetList.cs b/Systems/Collections/NPCIDs/MossHornetIDList.cs similarity index 92% rename from Systems/Collections/NPCVariants/MossHornetList.cs rename to Systems/Collections/NPCIDs/MossHornetIDList.cs index 616f0f4f2d..9f05bd9acf 100644 --- a/Systems/Collections/NPCVariants/MossHornetList.cs +++ b/Systems/Collections/NPCIDs/MossHornetIDList.cs @@ -4,7 +4,7 @@ using Terraria.ModLoader; namespace CalamityMod.Systems.Collections { - public sealed class MossHornetList : ModSystem + public sealed class MossHornetIDList : ModSystem { public static IList List { get; private set; } diff --git a/Systems/Collections/NPCVariants/SkeletonList.cs b/Systems/Collections/NPCIDs/SkeletonIDList.cs similarity index 96% rename from Systems/Collections/NPCVariants/SkeletonList.cs rename to Systems/Collections/NPCIDs/SkeletonIDList.cs index dbeefc444c..ec63ae51f9 100644 --- a/Systems/Collections/NPCVariants/SkeletonList.cs +++ b/Systems/Collections/NPCIDs/SkeletonIDList.cs @@ -4,7 +4,7 @@ using Terraria.ModLoader; namespace CalamityMod.Systems.Collections { - public sealed class SkeletonList : ModSystem + public sealed class SkeletonIDList : ModSystem { public static IList List { get; private set; } diff --git a/Systems/Collections/NPCVariants/ZombieList.cs b/Systems/Collections/NPCIDs/ZombieIDList.cs similarity index 97% rename from Systems/Collections/NPCVariants/ZombieList.cs rename to Systems/Collections/NPCIDs/ZombieIDList.cs index 6591c007da..0b5ece97d5 100644 --- a/Systems/Collections/NPCVariants/ZombieList.cs +++ b/Systems/Collections/NPCIDs/ZombieIDList.cs @@ -6,7 +6,7 @@ using static Terraria.ModLoader.ModContent; namespace CalamityMod.Systems.Collections { - public sealed class ZombieList : ModSystem + public sealed class ZombieIDList : ModSystem { public static IList List { get; private set; }