diff --git a/GodSeekerPlus/Modules/Visual/MorePantheonCaps.cs b/GodSeekerPlus/Modules/Visual/MorePantheonCaps.cs new file mode 100644 index 0000000..c8704e3 --- /dev/null +++ b/GodSeekerPlus/Modules/Visual/MorePantheonCaps.cs @@ -0,0 +1,68 @@ +using Bindings = BossSequenceController.ChallengeBindings; + +namespace GodSeekerPlus.Modules.Visual; + +[Category(nameof(Visual))] +[ToggleableLevel(ToggleableLevel.ChangeScene)] +[DefaultEnabled] +internal sealed class MorePantheonCaps : Module { + private static readonly Dictionary doorPDDict = new() { + { "bossDoorStateTier1", 1 }, + { "bossDoorStateTier2", 2 }, + { "bossDoorStateTier3", 3 }, + { "bossDoorStateTier4", 4 }, + { "bossDoorStateTier5", 5 } + }; + + private protected override void Load() { + On.BossSequenceDoor.Start += SetupCaps; + On.BossDoorChallengeCompleteUI.Start += RecordRAB; + } + + private protected override void Unload() { + On.BossSequenceDoor.Start -= SetupCaps; + On.BossDoorChallengeCompleteUI.Start -= RecordRAB; + } + + private void SetupCaps(On.BossSequenceDoor.orig_Start orig, BossSequenceDoor self) { + if (self.bossSequence != null) { + if ( + self.completedNoHitsDisplay == null + && self.gameObject.Child("Main Caps", "GG_door_cap_complete_nohits") is GameObject go + ) { + self.completedNoHitsDisplay = go; + Logger.LogDebug($"Radiant cap enabled for {self.bossSequence.name}"); + } + + if (Ref.LS.GetRABCompletion(doorPDDict[self.playerDataString]) + && self.completedNoHitsDisplay?.GetComponent() is SpriteRenderer sr + ) { + sr.transform.Translate(0, 0, -0.0801f); + sr.color = Color.black; + + Logger.LogDebug($"Radiant AB effect enabled for {self.bossSequence.name}"); + } + } + + orig(self); + } + + private void RecordRAB(On.BossDoorChallengeCompleteUI.orig_Start orig, BossDoorChallengeCompleteUI self) { + var currentData = (BossSequenceController.BossSequenceData) ReflectionHelper + .GetFieldInfo(typeof(BossSequenceController), "currentData", false) + .GetValue(null); + + int num = doorPDDict[currentData.playerData]; + bool rab = !currentData.knightDamaged + && currentData.bindings == (Bindings.Nail | Bindings.Shell | Bindings.Charms | Bindings.Soul); + bool rabPrev = Ref.LS.GetRABCompletion(num); + + if (rab && !rabPrev) { + Ref.LS.SetRABCompletion(num, true); + Logger.LogDebug($"Radiant AB in Pantheon #{num} recorded"); + } + + orig(self); + } + +} diff --git a/GodSeekerPlus/Resources/Lang/en.json b/GodSeekerPlus/Resources/Lang/en.json index e3d8c44..8a37615 100644 --- a/GodSeekerPlus/Resources/Lang/en.json +++ b/GodSeekerPlus/Resources/Lang/en.json @@ -31,6 +31,7 @@ "Modules/InfiniteGrimmPufferfish": "Infinite Grimm Pufferfish", "Modules/InfiniteRadianceClimbing": "Infinite Radiance Climbing", "Modules/MemorizeBindings": "Memorize Bindings", + "Modules/MorePantheonCaps": "More Pantheon Caps", "Modules/NoFuryEffect": "No Fury Effect", "Modules/NoLowHealthEffect": "No Low Health Effect", "Modules/NoNailAttack": "No Nail Attack", diff --git a/GodSeekerPlus/Resources/Lang/zh.json b/GodSeekerPlus/Resources/Lang/zh.json index a68b40d..fbd2c4f 100644 --- a/GodSeekerPlus/Resources/Lang/zh.json +++ b/GodSeekerPlus/Resources/Lang/zh.json @@ -31,6 +31,7 @@ "Modules/InfiniteGrimmPufferfish": "无限格林河豚", "Modules/InfiniteRadianceClimbing": "无限辐光爬梯", "Modules/MemorizeBindings": "记住束缚", + "Modules/MorePantheonCaps": "更多万神殿灯", "Modules/NoFuryEffect": "禁用亡怒效果", "Modules/NoLowHealthEffect": "禁用低生命效果", "Modules/NoNailAttack": "禁止骨钉攻击", diff --git a/GodSeekerPlus/Settings/LocalSettings.cs b/GodSeekerPlus/Settings/LocalSettings.cs index fe34b1f..00b84c1 100644 --- a/GodSeekerPlus/Settings/LocalSettings.cs +++ b/GodSeekerPlus/Settings/LocalSettings.cs @@ -5,4 +5,35 @@ public sealed class LocalSettings { public bool boundHeart = false; public bool boundCharms = false; public bool boundSoul = false; + + [JsonIgnore] + private int rabCompletion = 0; + + [JsonProperty(PropertyName = nameof(rabCompletion))] + public int RABCompletion { + get => rabCompletion; + set => rabCompletion = ((value & 0b11111) == value) ? value : 0; + } + + + #region RAB Completions Getter/Setter + + public bool GetRABCompletion(int num) => num >= 1 && num <= 5 + ? (RABCompletion & (1 << (num - 1))) != 0 + : throw new ArgumentOutOfRangeException(nameof(num)); + + internal void SetRABCompletion(int num, bool completed) { + if (num < 1 || num > 5) { + throw new ArgumentOutOfRangeException(nameof(num)); + } + + int mask = 1 << (num - 1); + if (completed) { + RABCompletion |= mask; + } else { + RABCompletion &= ~mask; + } + } + + #endregion } diff --git a/README.md b/README.md index 69c0480..81aff2b 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,7 @@ Compatible with `Hollow Knight` 1.5. + **No Spell Damage**: Remove damage from spells, including Sharp Shadow. - **Visual**: + + **More Pantheon Caps**: Enable the unused no hit cap for Pantheons 1 to 4, and add a new special effect for all pantheons indicating completed once with all bindings and once no hit. + **No Fury Effect**: Remove the red effect around the screen when the Fury of Fallen is activated. + **No Low Health Effect**: Remove the black effect around the screen when you have only one health. diff --git a/README.zh.md b/README.zh.md index 62f5cc6..1dbb28f 100644 --- a/README.zh.md +++ b/README.zh.md @@ -45,6 +45,7 @@ + **取消法术伤害**:取消法术攻击伤害,包括锋利之影。 - **视觉**: + + **更多万神殿灯**:为第一到四万神殿启用未使用的无伤灯,并为所有万神殿添加一个新的代表曾完成过四锁且曾完成过无伤的效果。 + **禁用亡怒效果**:移除亡者之怒激活时屏幕周围的红色效果。 + **禁用低生命效果**:移除当你仅剩一点生命值时屏幕周围的黑色效果。