Skip to content

Commit

Permalink
feat: more pantheon caps
Browse files Browse the repository at this point in the history
  • Loading branch information
Clazex committed Feb 21, 2022
1 parent d6af059 commit 871c1aa
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 0 deletions.
68 changes: 68 additions & 0 deletions GodSeekerPlus/Modules/Visual/MorePantheonCaps.cs
Original file line number Diff line number Diff line change
@@ -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<string, int> 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<SpriteRenderer>() 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);
}

}
1 change: 1 addition & 0 deletions GodSeekerPlus/Resources/Lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions GodSeekerPlus/Resources/Lang/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"Modules/InfiniteGrimmPufferfish": "无限格林河豚",
"Modules/InfiniteRadianceClimbing": "无限辐光爬梯",
"Modules/MemorizeBindings": "记住束缚",
"Modules/MorePantheonCaps": "更多万神殿灯",
"Modules/NoFuryEffect": "禁用亡怒效果",
"Modules/NoLowHealthEffect": "禁用低生命效果",
"Modules/NoNailAttack": "禁止骨钉攻击",
Expand Down
31 changes: 31 additions & 0 deletions GodSeekerPlus/Settings/LocalSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
1 change: 1 addition & 0 deletions README.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
+ **取消法术伤害**:取消法术攻击伤害,包括锋利之影。

- **视觉**:
+ **更多万神殿灯**:为第一到四万神殿启用未使用的无伤灯,并为所有万神殿添加一个新的代表曾完成过四锁且曾完成过无伤的效果。
+ **禁用亡怒效果**:移除亡者之怒激活时屏幕周围的红色效果。
+ **禁用低生命效果**:移除当你仅剩一点生命值时屏幕周围的黑色效果。

Expand Down

0 comments on commit 871c1aa

Please sign in to comment.