diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index d30ac1320d..e358b4cc5f 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -139,6 +139,7 @@ namespace CalamityMod.ILEditing IL_WorldGen.MakeDungeon += ChangeDungeonSpikeQuantities; // Removal of vanilla stupidity + IL_NPC.VanillaHitEffect += PreventLavaSlimeLavaDrop; IL_Player.UpdateBuffs += RemoveFeralBiteRandomDebuffs; IL_Sandstorm.HasSufficientWind += DecreaseSandstormWindSpeedRequirement; IL_Item.TryGetPrefixStatMultipliersForItem += RelaxPrefixRequirements; diff --git a/ILEditing/VanillaStupidityFixingILChanges.cs b/ILEditing/VanillaStupidityFixingILChanges.cs index 9a430ec383..c9e5a5ee49 100644 --- a/ILEditing/VanillaStupidityFixingILChanges.cs +++ b/ILEditing/VanillaStupidityFixingILChanges.cs @@ -121,6 +121,25 @@ namespace CalamityMod.ILEditing } #endregion Prevention of Slime Rain Spawns When Near Bosses + #region Prevent Lava Slime Dropping Lava + private static void PreventLavaSlimeLavaDrop(ILContext il) + { + // Disable Lava Slimes dropping lava if its respective config is enabled. + var cursor = new ILCursor(il); + + // Go to the check for Remix world. + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdsfld
("remixWorld"))) + { + LogFailure("Prevent Lava Slime Dropping Lava", "Could not find the check for Remix World."); + return; + } + + // Add an additional check for the config. + cursor.Remove(); + cursor.EmitDelegate>(() => CalamityConfig.Instance.RemoveLavaDropsFromLavaSlimes || Main.remixWorld); + } + #endregion + #region Remove Feral Bite Random Debuffs private static void RemoveFeralBiteRandomDebuffs(ILContext il) { diff --git a/Localization/en-US/Mods.CalamityMod.Configs.hjson b/Localization/en-US/Mods.CalamityMod.Configs.hjson index 85d927e9eb..f2c06a2a69 100644 --- a/Localization/en-US/Mods.CalamityMod.Configs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Configs.hjson @@ -314,7 +314,7 @@ CalamityConfig: { RemoveLavaDropsFromLavaSlimes: { Label: "[i:LavaWaders] Remove Lava Drops From Lava Slimes" - Tooltip: When enabled, Lava Slimes will be replaced with a new Lava Slime that no longer drops lava. + Tooltip: When enabled, Lava Slimes will be prevented from dropping lava in Expert Mode. } RemoveReforgeRNG: { diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index adb0f3c8c8..4c896be3f3 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -6127,13 +6127,6 @@ namespace CalamityMod.NPCs spawnInfo.Player.Calamity().ZoneSunkenSea || (spawnInfo.Player.Calamity().ZoneAstral && !spawnInfo.Player.PillarZone()); - // Replace vanilla Lava Slimes with Calamity Lava Slimes to avoid annoying lava drops - if (spawnInfo.Player.ZoneUnderworldHeight && !calamityBiomeZone && CalamityConfig.Instance.RemoveLavaDropsFromLavaSlimes && Main.expertMode) - { - pool.Add(NPCType(), SpawnCondition.Underworld.Chance); - pool.Remove(NPCID.LavaSlime); - } - // Spawn Green Jellyfish in prehm and Blue Jellyfish in hardmode if (spawnInfo.Player.ZoneRockLayerHeight && spawnInfo.Water && !calamityBiomeZone) { diff --git a/NPCs/NormalNPCs/LavaSlimeNoLavaDrop.cs b/NPCs/NormalNPCs/LavaSlimeNoLavaDrop.cs deleted file mode 100644 index ca5764da80..0000000000 --- a/NPCs/NormalNPCs/LavaSlimeNoLavaDrop.cs +++ /dev/null @@ -1,75 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.NormalNPCs -{ - public class LavaSlimeNoLavaDrop : ModNPC - { - public override string Texture => $"Terraria/Images/NPC_{NPCID.LavaSlime}"; - - public override void SetStaticDefaults() - { - Main.npcFrameCount[NPC.type] = 2; - this.HideFromBestiary(); - } - - public override void SetDefaults() - { - NPC.aiStyle = NPCAIStyleID.Slime; - AIType = NPCID.LavaSlime; - AnimationType = NPCID.LavaSlime; - NPC.width = 24; - NPC.height = 18; - NPC.damage = 15; - NPC.defense = 10; - NPC.lifeMax = 50; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.scale = 1.1f; - NPC.alpha = 50; - NPC.lavaImmune = true; - NPC.value = 120f; - if (Main.remixWorld) - { - NPC.damage = 7; - NPC.defense = 2; - NPC.lifeMax = 25; - NPC.value = 25f; - } - //Banner = NPCID.LavaSlime; - //BannerItem = ItemID.LavaSlimeBanner; - - NPC.Calamity().VulnerableToCold = true; - NPC.Calamity().VulnerableToSickness = false; - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToWater = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); - } - - public override void HitEffect(NPC.HitInfo hit) - { - if (NPC.life > 0) - { - for (int i = 0; (double)i < hit.Damage / (double)NPC.lifeMax * 80D; i++) - { - int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 6, hit.HitDirection * 2, -1f, NPC.alpha, default, 1.5f); - if (Main.rand.Next(8) != 0) - Main.dust[dust].noGravity = true; - } - - return; - } - - for (int i = 0; i < 40; i++) - { - int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 6, hit.HitDirection * 2, -1f, NPC.alpha, default, 1.5f); - if (Main.rand.Next(8) != 0) - Main.dust[dust].noGravity = true; - } - } - } -} diff --git a/Systems/BestiaryRegistrySystem.cs b/Systems/BestiaryRegistrySystem.cs index f14f47f6dc..bd95735428 100644 --- a/Systems/BestiaryRegistrySystem.cs +++ b/Systems/BestiaryRegistrySystem.cs @@ -14,7 +14,6 @@ namespace CalamityMod.Systems // Manually register variants post-initiailization ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[NPCType()] = ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[NPCType()]; ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[NPCType()] = ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[NPCType()]; - ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[NPCType()] = ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[NPCID.LavaSlime]; } } }