Skip to content

Commit

Permalink
Fix for disabled settings. Added inventory description for nail damage.
Browse files Browse the repository at this point in the history
  • Loading branch information
nerthul11 committed Aug 20, 2024
1 parent 4605a47 commit a3bf0ae
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CombatRandomizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace CombatRandomizer
public class CombatRandomizer : Mod, IGlobalSettings<CombatSettings>
{
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()
Expand Down
4 changes: 2 additions & 2 deletions CombatRandomizer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<Product>CombatRandomizer</Product>
<Description>A Randomizer add-on for a cursed combat experience.</Description>
<Copyright>Copyright © </Copyright>
<AssemblyVersion>1.0.1.1</AssemblyVersion>
<FileVersion>1.0.1.1</FileVersion>
<AssemblyVersion>1.0.1.2</AssemblyVersion>
<FileVersion>1.0.1.2</FileVersion>
<OutputPath>bin\$(Configuration)\</OutputPath>
<LangVersion>latest</LangVersion>
</PropertyGroup>
Expand Down
1 change: 1 addition & 0 deletions Manager/CombatManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ private static void AddFileSettings(LogArguments args, System.IO.TextWriter tw)
if (Settings.Enabled)
{
CombatModule module = ItemChangerMod.Modules.GetOrAdd<CombatModule>();
module.SetNailDamage();
// Enforce damage limit if Enemy Pogo setting is on
module.Settings.LimitNailDamage = module.Settings.LimitNailDamage || args.gs.SkipSettings.EnemyPogos;
}
Expand Down
2 changes: 1 addition & 1 deletion Manager/LogicHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down
30 changes: 29 additions & 1 deletion Modules/CombatModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 += $"<br>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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit a3bf0ae

Please sign in to comment.