From a3bf0aeb5d6aa858889e8183831f54f0eb27b856 Mon Sep 17 00:00:00 2001 From: nerthul11 <=> Date: Tue, 20 Aug 2024 13:30:12 -0300 Subject: [PATCH] Fix for disabled settings. Added inventory description for nail damage. --- CombatRandomizer.cs | 2 +- CombatRandomizer.csproj | 4 ++-- Manager/CombatManager.cs | 1 + Manager/LogicHandler.cs | 2 +- Modules/CombatModule.cs | 30 +++++++++++++++++++++++++++++- 5 files changed, 34 insertions(+), 5 deletions(-) diff --git a/CombatRandomizer.cs b/CombatRandomizer.cs index 01053a3..14ef22e 100644 --- a/CombatRandomizer.cs +++ b/CombatRandomizer.cs @@ -9,7 +9,7 @@ namespace CombatRandomizer public class CombatRandomizer : Mod, IGlobalSettings { new public string GetName() => "CombatRandomizer"; - public override string GetVersion() => "1.0.1.1"; + public override string GetVersion() => "1.0.1.2"; private static CombatRandomizer _instance; public CombatRandomizer() : base() diff --git a/CombatRandomizer.csproj b/CombatRandomizer.csproj index 07a4dc2..adbbffd 100644 --- a/CombatRandomizer.csproj +++ b/CombatRandomizer.csproj @@ -8,8 +8,8 @@ CombatRandomizer A Randomizer add-on for a cursed combat experience. Copyright © - 1.0.1.1 - 1.0.1.1 + 1.0.1.2 + 1.0.1.2 bin\$(Configuration)\ latest diff --git a/Manager/CombatManager.cs b/Manager/CombatManager.cs index d7a7fb4..27f52a1 100644 --- a/Manager/CombatManager.cs +++ b/Manager/CombatManager.cs @@ -28,6 +28,7 @@ private static void AddFileSettings(LogArguments args, System.IO.TextWriter tw) if (Settings.Enabled) { CombatModule module = ItemChangerMod.Modules.GetOrAdd(); + module.SetNailDamage(); // Enforce damage limit if Enemy Pogo setting is on module.Settings.LimitNailDamage = module.Settings.LimitNailDamage || args.gs.SkipSettings.EnemyPogos; } diff --git a/Manager/LogicHandler.cs b/Manager/LogicHandler.cs index b11dcc8..eea5c64 100644 --- a/Manager/LogicHandler.cs +++ b/Manager/LogicHandler.cs @@ -34,7 +34,7 @@ private static void ApplyLogic(GenerationSettings gs, LogicManagerBuilder lmb) lmb.AddItem(new StringItemTemplate("Notch_Fragment", "NOTCHES++")); // Modify combat macros - lmb.DoMacroEdit(new("ALLBALDURS", "((FIREBALL | QUAKE) + (SOULGAIN>10 | SOULPLUG>4)) | GLOWINGWOMB | (WEAVERSONG | SPORESHROOM + FOCUS) + OBSCURESKIPS | CYCLONE + DIFFICULTSKIPS")); + lmb.DoMacroEdit(new("ALLBALDURS", "((FIREBALL | QUAKE) + (SOULGAIN>10 | SOULPLUG>4)) | GLOWINGWOMB + (SOULGAIN>10 | SOULPLUG>4) | (WEAVERSONG | SPORESHROOM + FOCUS + (SOULGAIN>10 | SOULPLUG>4)) + OBSCURESKIPS | CYCLONE + DIFFICULTSKIPS")); lmb.DoMacroEdit(new("AERIALMINIBOSS", "ORIG + (NAILDAMAGE>4 + SOULGAIN>8 + SOULPLUG>3 | NAILDAMAGE>4 + SOULGAIN>6 + SOULPLUG>1 + MILDCOMBATSKIPS | SPICYCOMBATSKIPS)")); lmb.DoMacroEdit(new("BOSS", "ORIG + (NAILDAMAGE>4 + SOULGAIN>8 + SOULPLUG>3 | NAILDAMAGE>4 + SOULGAIN>6 + SOULPLUG>1 + MILDCOMBATSKIPS | SPICYCOMBATSKIPS)")); lmb.DoMacroEdit(new("BOSSFLUKE", "ORIG + (SOULGAIN>8 + SOULPLUG>3 | NAILDAMAGE>4 + SOULGAIN>6 + SOULPLUG>1 + MILDCOMBATSKIPS | SPICYCOMBATSKIPS) | NAILDAMAGE>12 + MILDCOMBATSKIPS | NAILDAMAGE>8 + SPICYCOMBATSKIPS")); diff --git a/Modules/CombatModule.cs b/Modules/CombatModule.cs index e302b1d..e8f43d3 100644 --- a/Modules/CombatModule.cs +++ b/Modules/CombatModule.cs @@ -35,11 +35,33 @@ public override void Initialize() { ModHooks.SoulGainHook += OverrideSoulGain; ModHooks.HeroUpdateHook += SoulDrain; + for (int i = 1; i <= 5; i++) Events.AddLanguageEdit(new("UI", "INV_DESC_NAIL" + i), ShowDamage); + } + + private void ShowDamage(ref string value) + { + if (Settings.NailDamage == Difficulty.Disabled) + return; + + int damage = PlayerData.instance.nailDamage; + value += $"
This nail currently deals {damage} damage. "; + if (damage < 5) + value += "This is less damage than an old nail."; + if (damage >= 5 && damage < 9) + value += "This is similar to an old nail."; + if (damage >= 9 && damage < 13) + value += "This is similar to a sharpened nail."; + if (damage >= 13 && damage < 17) + value += "This is similar to a channeled nail."; + if (damage >= 17 && damage < 21) + value += "This is similar to a coiled nail."; + if (damage >= 21) + value += "This is powerful as a pure nail."; } private void SoulDrain() { - if (GameManager.instance.isPaused) + if (GameManager.instance.isPaused || Settings.SoulPlugs == Difficulty.Disabled) return; Frames += 1; @@ -67,6 +89,9 @@ private int OverrideSoulGain(int soul) // and the damage is limited. SetNailDamage(); + if (Settings.SoulGain == Difficulty.Disabled) + return soul; + // By default, you get 11 soul + 3 with SC + 8 with SE. // If main mana pool is full, you get a reduced 6 + 2 + 6. // Using these as reference, the charms will now grant a relative multiplier @@ -100,6 +125,9 @@ private int OverrideSoulGain(int soul) public void SetNailDamage() { + if (Settings.NailDamage == Difficulty.Disabled) + return; + int base_damage = Settings.NailDamage >= Difficulty.Hard ? (6 - (int)Settings.NailDamage) : (Settings.NailDamage == Difficulty.Intermediate ? 3 : 5); int damage = base_damage + NailItems;