diff --git a/LostArtifacts/ArtifactSprite.cs b/LostArtifacts/ArtifactSprite.cs
index cdff1dc..63bc126 100644
--- a/LostArtifacts/ArtifactSprite.cs
+++ b/LostArtifacts/ArtifactSprite.cs
@@ -2,13 +2,14 @@
using UnityEngine;
using System.IO;
using Satchel;
+using Newtonsoft.Json;
namespace LostArtifacts
{
public class ArtifactSprite : ISprite
{
public string name;
- public Sprite Value => GetArtifactSprite();
+ [JsonIgnore] public Sprite Value => GetArtifactSprite();
public ArtifactSprite(string name)
{
diff --git a/LostArtifacts/LostArtifacts.cs b/LostArtifacts/LostArtifacts.cs
index d51e501..2dd2667 100644
--- a/LostArtifacts/LostArtifacts.cs
+++ b/LostArtifacts/LostArtifacts.cs
@@ -276,6 +276,8 @@ private void UIManagerStartNewGame(On.UIManager.orig_StartNewGame orig, UIManage
}
return;
}
+
+ if(!RandoSettings.Enabled) return;
PlaceArtifacts();
}
diff --git a/LostArtifacts/LostArtifacts.csproj b/LostArtifacts/LostArtifacts.csproj
index 12a6916..731e4ec 100644
--- a/LostArtifacts/LostArtifacts.csproj
+++ b/LostArtifacts/LostArtifacts.csproj
@@ -15,8 +15,8 @@
LostArtifacts
A Hollow Knight Mod
Copyright © 2022
- 1.0.0.0
- 1.0.0.0
+ 1.0.1.0
+ 1.0.1.0
bin\$(Configuration)\
latest
diff --git a/LostArtifacts/LostArtifacts/Dreamwood.cs b/LostArtifacts/LostArtifacts/Dreamwood.cs
index 3a3a1a4..5f58f8a 100644
--- a/LostArtifacts/LostArtifacts/Dreamwood.cs
+++ b/LostArtifacts/LostArtifacts/Dreamwood.cs
@@ -23,13 +23,10 @@ public override AbstractLocation Location()
name = InternalName(),
sceneName = nameof(SceneNames.RestingGrounds_05),
Test = new PDBool(nameof(PlayerData.completedRGDreamPlant)),
- falseLocation = new CoordinateLocation()
+ falseLocation = new DreamwoodLocation()
{
name = InternalName(),
- sceneName = nameof(SceneNames.RestingGrounds_05),
- x = 15.9f,
- y = -100f,
- elevation = 0f
+ sceneName = nameof(SceneNames.RestingGrounds_05)
},
trueLocation = new CoordinateLocation()
{
@@ -91,8 +88,37 @@ public override void Deactivate()
base.Deactivate();
On.EnemyDreamnailReaction.RecieveDreamImpact -= EnemyDreamnailReactionRecieveDreamImpact;
- On.HealthManager.Hit += HealthManagerHit;
+ On.HealthManager.Hit -= HealthManagerHit;
StopAllCoroutines();
}
}
+
+ internal class DreamwoodLocation : ContainerLocation
+ {
+ protected override void OnLoad()
+ {
+ On.DreamPlant.CheckOrbs += DreamPlantCheckOrbs;
+ }
+
+ private IEnumerator DreamPlantCheckOrbs(On.DreamPlant.orig_CheckOrbs orig, DreamPlant self)
+ {
+ yield return orig(self);
+ if(self.gameObject.scene.name == sceneName)
+ {
+ GameObject obj;
+ string containerType;
+ GetContainer(out obj, out containerType);
+ Container.GetContainer(containerType).ApplyTargetContext(obj, self.gameObject, 0f);
+ if(!obj.activeSelf)
+ {
+ obj.SetActive(true);
+ }
+ }
+ }
+
+ protected override void OnUnload()
+ {
+ On.DreamPlant.CheckOrbs -= DreamPlantCheckOrbs;
+ }
+ }
}
diff --git a/LostArtifacts/LostArtifacts/DungBall.cs b/LostArtifacts/LostArtifacts/DungBall.cs
index e868158..1839d08 100644
--- a/LostArtifacts/LostArtifacts/DungBall.cs
+++ b/LostArtifacts/LostArtifacts/DungBall.cs
@@ -56,8 +56,8 @@ private IEnumerator SpawnClouds(Vector3 pos)
{
int numToSpawn = 1;
if(level == 2) numToSpawn = 10;
- if(level == 3) numToSpawn = 75;
- if(level == 4) numToSpawn = 200;
+ if(level == 3) numToSpawn = 50;
+ if(level == 4) numToSpawn = 500;
for(int i = 0; i < numToSpawn; i++)
{
@@ -67,8 +67,8 @@ private IEnumerator SpawnClouds(Vector3 pos)
Destroy(stink.GetComponent());
if(level == 2) stink.transform.localScale *= 5f;
- if(level == 3) stink.transform.localScale *= 25f;
- if(level == 4) stink.transform.localScale *= 50f;
+ if(level == 3) stink.transform.localScale *= 10f;
+ if(level == 4) stink.transform.localScale *= 30f;
stink.SetActive(true);
diff --git a/LostArtifacts/LostArtifacts/Honeydrop.cs b/LostArtifacts/LostArtifacts/Honeydrop.cs
index 9183a5a..d60bad5 100644
--- a/LostArtifacts/LostArtifacts/Honeydrop.cs
+++ b/LostArtifacts/LostArtifacts/Honeydrop.cs
@@ -11,9 +11,9 @@ public class Honeydrop : Artifact
public override string Name() => "Honeydrop";
public override string Description() => "This honeydrop was made through the bees’ hard work. And you took it without " +
"permission. Unbeelievable.";
- public override string LevelInfo() => (50 * (PlayerData.instance.GetInt(nameof(PlayerData.nailDamage)) - 1)) + ", " +
- (40 * (PlayerData.instance.GetInt(nameof(PlayerData.nailDamage)) - 1)) + ", " +
- (30 * (PlayerData.instance.GetInt(nameof(PlayerData.nailDamage)) - 1)) + " damage";
+ public override string LevelInfo() => (40 * (PlayerData.instance.GetInt(nameof(PlayerData.nailDamage)) - 1)) + ", " +
+ (30 * (PlayerData.instance.GetInt(nameof(PlayerData.nailDamage)) - 1)) + ", " +
+ (20 * (PlayerData.instance.GetInt(nameof(PlayerData.nailDamage)) - 1)) + " damage";
public override string TraitName() => "Honey Coating";
public override string TraitDescription() => "Dealing enough damage gives a honey coating that blocks one instance " +
"of non-hazard damage (cannot stack)";
diff --git a/LostArtifacts/LostArtifacts/LumaflyEssence.cs b/LostArtifacts/LostArtifacts/LumaflyEssence.cs
index babe333..9df7df0 100644
--- a/LostArtifacts/LostArtifacts/LumaflyEssence.cs
+++ b/LostArtifacts/LostArtifacts/LumaflyEssence.cs
@@ -38,8 +38,17 @@ public override void Activate()
{
base.Activate();
- zapGO = LostArtifacts.Preloads["GG_Uumuu"]["Mega Jellyfish GG"].LocateMyFSM("Mega Jellyfish").
+ GameObject prefab = LostArtifacts.Preloads["GG_Uumuu"]["Mega Jellyfish GG"].LocateMyFSM("Mega Jellyfish").
GetAction("Gen", 2).gameObject.Value;
+ zapGO = Instantiate(prefab);
+ zapGO.SetActive(false);
+ DontDestroyOnLoad(zapGO);
+
+ zapGO.name = "LostArtifacts.LumaflyEssenceZap";
+ zapGO.layer = (int)PhysLayers.HERO_ATTACK;
+ Destroy(zapGO.GetComponent());
+ LumaflyEssenceZap de = zapGO.AddComponent();
+
numToSpawn = level;
ModHooks.AttackHook += AttackHook;
@@ -74,17 +83,6 @@ private IEnumerator ZapControl(Vector3 dir)
for(int i = 1; i <= numToSpawn; i++)
{
GameObject zap = Instantiate(zapGO, pos + i * dir, Quaternion.identity);
- zap.SetActive(false);
-
- zap.name = "LostArtifacts.LumaflyEssenceZap";
- zap.layer = (int)PhysLayers.HERO_ATTACK;
- Destroy(zap.GetComponent());
-
- DamageEnemies de = zap.AddComponent();
- de.damageDealt = PlayerData.instance.GetInt(nameof(PlayerData.nailDamage)) / 2;
- de.attackType = AttackTypes.NailBeam;
- de.ignoreInvuln = true;
-
zap.SetActive(true);
yield return new WaitForSeconds(0.1f);
@@ -97,13 +95,12 @@ private void HealthManagerHit(On.HealthManager.orig_Hit orig, HealthManager self
{
if(hitInstance.Source.name != "LostArtifacts.LumaflyEssenceZap")
{
+ LostArtifacts.Instance.Log(hitInstance.Source.layer);
orig(self, hitInstance);
return;
}
//Override the iframes on hit so that it doesn't eat nail hits
- GameObject.Destroy(hitInstance.Source.GetComponent());
- hitInstance.IsExtraDamage = true;
orig(self, hitInstance);
ReflectionHelper.SetField(self, "evasionByHitRemaining", 0f);
}
@@ -122,4 +119,24 @@ public override void Deactivate()
StopAllCoroutines();
}
}
+
+ internal class LumaflyEssenceZap : MonoBehaviour
+ {
+
+ private void OnTriggerEnter2D(Collider2D otherCollider)
+ {
+ if(otherCollider == null) return;
+ if(otherCollider.gameObject.layer != (int)PhysLayers.ENEMIES) return;
+
+ HitInstance hit = default(HitInstance);
+ hit.DamageDealt = PlayerData.instance.GetInt(nameof(PlayerData.nailDamage)) / 2;
+ hit.AttackType = AttackTypes.NailBeam;
+ hit.IgnoreInvulnerable = true;
+ hit.Source = gameObject;
+ hit.Multiplier = 1f;
+
+ HealthManager hm = otherCollider.gameObject.GetComponent();
+ hm.Hit(hit);
+ }
+ }
}
diff --git a/LostArtifacts/LostArtifacts/LushMoss.cs b/LostArtifacts/LostArtifacts/LushMoss.cs
index 7e7d447..0b29ae5 100644
--- a/LostArtifacts/LostArtifacts/LushMoss.cs
+++ b/LostArtifacts/LostArtifacts/LushMoss.cs
@@ -9,7 +9,7 @@ public class LushMoss : Artifact
public override string Name() => "Lush Moss";
public override string Description() => "This piece of moss came from the Massive Moss Charger. It has a mysterious " +
"healing power that allows the moss chargers to recover their moss no matter how many times it is destroyed.";
- public override string LevelInfo() => "20, 15, 10 hits to heal";
+ public override string LevelInfo() => "25, 20, 15 hits to heal";
public override string TraitName() => "Regeneration";
public override string TraitDescription() => "Heal a mask after a certain amount of nail hits";
public override AbstractLocation Location()
@@ -45,7 +45,7 @@ public override void Activate()
base.Activate();
counter = 0;
- hitsNeeded = 25 - level * 5;
+ hitsNeeded = 30 - level * 5;
On.HealthManager.TakeDamage += HealthManagerTakeDamage;
}
diff --git a/LostArtifacts/LostArtifacts/ThornedLeaf.cs b/LostArtifacts/LostArtifacts/ThornedLeaf.cs
index edf37de..fb11312 100644
--- a/LostArtifacts/LostArtifacts/ThornedLeaf.cs
+++ b/LostArtifacts/LostArtifacts/ThornedLeaf.cs
@@ -54,7 +54,7 @@ private void HealthManagerHit(On.HealthManager.orig_Hit orig, HealthManager self
{
Destroy(self.gameObject.GetComponent());
}
- if(!self.IsInvincible) self.gameObject.AddComponent();
+ self.gameObject.AddComponent();
}
orig(self, hitInstance);
@@ -72,7 +72,7 @@ public override void Deactivate()
}
}
- public class Laceration : MonoBehaviour
+ internal class Laceration : MonoBehaviour
{
private float damageInterval;
@@ -103,8 +103,7 @@ private IEnumerator DealDamage()
{
if(gameObject.GetComponent() != null)
{
- if(gameObject.GetComponent().hp <= 0 ||
- gameObject.GetComponent().IsInvincible) break;
+ if(gameObject.GetComponent().hp <= 0) break;
gameObject.GetComponent().ApplyExtraDamage(1);
gameObject.GetComponent().flashWhiteQuick();
diff --git a/LostArtifacts/RandoInterop/ArtifactRando.cs b/LostArtifacts/RandoInterop/ArtifactRando.cs
index 3f97d41..2de1f63 100644
--- a/LostArtifacts/RandoInterop/ArtifactRando.cs
+++ b/LostArtifacts/RandoInterop/ArtifactRando.cs
@@ -3,7 +3,10 @@
using RandomizerMod.Menu;
using RandomizerMod.RC;
using RandomizerMod.Settings;
+using RandomizerMod.Logging;
using System.IO;
+using System;
+using Newtonsoft.Json;
namespace LostArtifacts.Rando
{
@@ -15,11 +18,20 @@ public static void HookRando()
RequestBuilder.OnUpdate.Subscribe(-498f, DefineArtifacts);
RequestBuilder.OnUpdate.Subscribe(50f, AddArtifacts);
RandomizerMenuAPI.AddMenuPage(RandoMenu.ConstructMenu, RandoMenu.HandleButton);
+ SettingsLog.AfterLogSettings += AddSettingsToLog;
+ }
+
+ public static bool IsRandoActive()
+ {
+ RandomizerSettings rs = RandomizerMod.RandomizerMod.RS;
+ if(rs == null) return false;
+ if(rs.GenerationSettings == null) return false;
+ return true;
}
private static void DefineLogicItem(GenerationSettings gs, LogicManagerBuilder lmb)
{
- if(!LostArtifacts.RandoSettings.RandomizeArtifacts) return;
+ if(!LostArtifacts.RandoSettings.Enabled || !LostArtifacts.RandoSettings.RandomizeArtifacts) return;
foreach(Artifact artifact in LostArtifacts.Instance.artifacts)
{
@@ -32,7 +44,7 @@ private static void DefineLogicItem(GenerationSettings gs, LogicManagerBuilder l
private static void DefineArtifacts(RequestBuilder rb)
{
- if(!LostArtifacts.RandoSettings.RandomizeArtifacts) return;
+ if(!LostArtifacts.RandoSettings.Enabled || !LostArtifacts.RandoSettings.RandomizeArtifacts) return;
foreach(Artifact artifact in LostArtifacts.Instance.artifacts)
{
@@ -81,7 +93,7 @@ bool ResolveGroup(RequestBuilder rb, string item, RequestBuilder.ElementType typ
private static void AddArtifacts(RequestBuilder rb)
{
- if(!LostArtifacts.RandoSettings.RandomizeArtifacts) return;
+ if(!LostArtifacts.RandoSettings.Enabled || !LostArtifacts.RandoSettings.RandomizeArtifacts) return;
foreach(Artifact artifact in LostArtifacts.Instance.artifacts)
{
@@ -89,5 +101,13 @@ private static void AddArtifacts(RequestBuilder rb)
rb.AddLocationByName(artifact.InternalName());
}
}
+
+ private static void AddSettingsToLog(LogArguments args, TextWriter tw)
+ {
+ tw.WriteLine("Logging LostArtifacts settings:");
+ using JsonTextWriter jtw = new(tw) { CloseOutput = false, };
+ RandomizerMod.RandomizerData.JsonUtil._js.Serialize(jtw, LostArtifacts.RandoSettings);
+ tw.WriteLine();
+ }
}
}
diff --git a/LostArtifacts/RandoInterop/RandoMenu.cs b/LostArtifacts/RandoInterop/RandoMenu.cs
index bca7cca..bcee328 100644
--- a/LostArtifacts/RandoInterop/RandoMenu.cs
+++ b/LostArtifacts/RandoInterop/RandoMenu.cs
@@ -2,6 +2,7 @@
using MenuChanger.Extensions;
using MenuChanger.MenuElements;
using MenuChanger.MenuPanels;
+using System;
using UnityEngine;
namespace LostArtifacts.Rando
@@ -9,11 +10,17 @@ namespace LostArtifacts.Rando
public static class RandoMenu
{
private static MenuPage SettingsPage;
+ private static SmallButton pageRootButton;
+ private static ToggleButton enabledButton;
+ private static ToggleButton randomizedButton;
+ private static ToggleButton useMainItemGroupButton;
public static bool HandleButton(MenuPage landingPage, out SmallButton button)
{
- button = new(landingPage, LostArtifacts.Instance.GetName());
- button.AddHideAndShowEvent(landingPage, SettingsPage);
+ pageRootButton = new(landingPage, LostArtifacts.Instance.GetName());
+ pageRootButton.AddHideAndShowEvent(landingPage, SettingsPage);
+ ChangeTopLevelColor();
+ button = pageRootButton;
return true;
}
@@ -24,6 +31,40 @@ public static void ConstructMenu(MenuPage landingPage)
new MenuElementFactory(SettingsPage, LostArtifacts.RandoSettings);
IMenuElement[] elements = factory.Elements;
new VerticalItemPanel(SettingsPage, new Vector2(0f, 300f), 75f, true, elements);
+
+ enabledButton = (ToggleButton)factory.ElementLookup[nameof(LostArtifacts.RandoSettings.Enabled)];
+ randomizedButton = (ToggleButton)factory.ElementLookup[nameof(LostArtifacts.RandoSettings.RandomizeArtifacts)];
+ useMainItemGroupButton = (ToggleButton)factory.ElementLookup[nameof(LostArtifacts.RandoSettings.UseMainItemGroup)];
+ enabledButton.SelfChanged += EnabledChanged;
+ randomizedButton.SelfChanged += RandomizedChanged;
+ useMainItemGroupButton.SelfChanged += UseMainItemGroupChanged;
+ }
+
+ private static void EnabledChanged(IValueElement obj)
+ {
+ if(!(bool)obj.Value) randomizedButton.SetValue(false);
+ }
+
+ private static void RandomizedChanged(IValueElement obj)
+ {
+ if(!(bool)obj.Value) useMainItemGroupButton.SetValue(false);
+ else enabledButton.SetValue(true);
+ ChangeTopLevelColor();
+ }
+
+ private static void UseMainItemGroupChanged(IValueElement obj)
+ {
+ if((bool)obj.Value) randomizedButton.SetValue(true);
+ }
+
+ private static void ChangeTopLevelColor()
+ {
+ if(pageRootButton != null)
+ {
+ pageRootButton.Text.color = Colors.FALSE_COLOR;
+ if(LostArtifacts.RandoSettings.Enabled) pageRootButton.Text.color = Colors.DEFAULT_COLOR;
+ if(LostArtifacts.RandoSettings.RandomizeArtifacts) pageRootButton.Text.color = Colors.TRUE_COLOR;
+ }
}
}
}
diff --git a/LostArtifacts/RandoInterop/RandoSettings.cs b/LostArtifacts/RandoInterop/RandoSettings.cs
index 997eec9..8f22e25 100644
--- a/LostArtifacts/RandoInterop/RandoSettings.cs
+++ b/LostArtifacts/RandoInterop/RandoSettings.cs
@@ -2,6 +2,7 @@
{
public class RandoSettings
{
+ public bool Enabled { get; set; }
public bool RandomizeArtifacts { get; set; }
public bool UseMainItemGroup { get; set; }
}
diff --git a/LostArtifacts/UI/ArtifactManager.cs b/LostArtifacts/UI/ArtifactManager.cs
index 8b559b7..ea117ee 100644
--- a/LostArtifacts/UI/ArtifactManager.cs
+++ b/LostArtifacts/UI/ArtifactManager.cs
@@ -120,7 +120,7 @@ private void OnEnable()
}
//Update Overcharge
- canOvercharge = PlayerData.instance.GetInt(nameof(PlayerData.nailSmithUpgrades)) == 4;
+ canOvercharge = PlayerData.instance.GetInt(nameof(PlayerData.nailSmithUpgrades)) == 4 || LostArtifacts.Settings.unlockedSlots;
if(canOvercharge)
{
if(LostArtifacts.Settings.overchargedSlot == -1) LostArtifacts.Settings.overchargedSlot = 0;
diff --git a/ReadMe.md b/ReadMe.md
index 90828d7..453fb82 100644
--- a/ReadMe.md
+++ b/ReadMe.md
@@ -18,14 +18,14 @@ If Randomizer 4 is installed alongside this mod, artifact locations can be rando
### Randomizer Settings
- Randomize artifacts - whether or not to randomize artifacts
-- Use main item group - whether or not to randomize the artifacts within themselves or with other items
+- Use main item group - whether or not to randomize the artifacts with other items
### Debug Options
- Unlock all artifacts - unlocks all artifacts
- Toggle unlock all slots - toggles between automatically unlocking all slots and unlocking slots based on nail level
## Credits
-- Lots of ideas and balancing feedback: BANANALOVAH, DDX2000
+- Ideas and balancing feedback: BANANALOVAH, DDX2000, 4djesus
- Artifact icons: Chrome, HBKit
- Help with assetbundling and custom UI: RedFrog, SFGrenade
- Help with Randomizer/ItemChanger: BadMagic, Flibber, pimpas