Skip to content

Commit

Permalink
UI, effects, and other changes
Browse files Browse the repository at this point in the history
- Add visual and audio effects to several artifacts
- Change UI to have clearer descriptions
- Fix UI scaling for ultrawide resolution
- Add option to choose whether or not to place artifacts in world for randomizer
- Move save messages to debug level
- Nerf Traveler's Garment scaling
- Fix Void Emblem not resetting the buff
  • Loading branch information
Hoo-Knows committed Nov 25, 2022
1 parent 9c6d095 commit 3f9c7da
Show file tree
Hide file tree
Showing 33 changed files with 403 additions and 290 deletions.
14 changes: 10 additions & 4 deletions LostArtifacts/Artifact.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,27 @@ public abstract class Artifact : MonoBehaviour
public abstract int ID();
public abstract string Name();
public string InternalName() => Regex.Replace(Name(), @"[^0-9a-zA-Z\._]", "");
public abstract string Description();
public abstract string LevelInfo();
public abstract string LoreDescription();
public abstract string TraitName();
public abstract string TraitDescription();
public abstract string LevelInfo();
public abstract AbstractLocation Location();

public virtual string Description()
{
return string.Format("{0}\n\nThis artifact carries the trait <b>{1}</b>: {2}",
LoreDescription(), TraitName(), TraitDescription());
}

public virtual void Activate()
{
LostArtifacts.Instance.Log("Activating " + TraitName() + " " + (level == 4 ? "IV" : new string('I', level)));
LostArtifacts.Instance.LogDebug("Activating " + TraitName() + " " + (level == 4 ? "IV" : new string('I', level)));
active = true;
}

public virtual void Deactivate()
{
LostArtifacts.Instance.Log("Deactivating " + TraitName() + " " + (level == 4 ? "IV" : new string('I', level)));
LostArtifacts.Instance.LogDebug("Deactivating " + TraitName() + " " + (level == 4 ? "IV" : new string('I', level)));
active = false;
level = 0;
}
Expand Down
26 changes: 15 additions & 11 deletions LostArtifacts/LostArtifacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ public class LostArtifacts : Mod, ILocalSettings<Settings>, IGlobalSettings<Rand

public void OnLoadLocal(Settings s)
{
Log("Loading Lost Artifacts settings");
LogDebug("Loading Lost Artifacts settings");
Settings = s;
}
public Settings OnSaveLocal()
{
Log("Saving Lost Artifacts settings");
LogDebug("Saving Lost Artifacts settings");
return Settings;
}

Expand Down Expand Up @@ -105,19 +105,22 @@ public LostArtifacts() : base("LostArtifacts")
AddArtifact<WeaverSilk>();
AddArtifact<WyrmAsh>();
AddArtifact<BeastShell>();
AddArtifact<Honeydrop>(); //Yellow tint
AddArtifact<Honeydrop>();
AddArtifact<InfectedRock>();
AddArtifact<Buzzsaw>();
AddArtifact<VoidEmblem>(); //Void particles
AddArtifact<AttunedJewel>(); //Void particles
AddArtifact<VoidEmblem>();
AddArtifact<AttunedJewel>();
AddArtifact<HiddenMemento>();
}

public override List<ValueTuple<string, string>> GetPreloadNames()
{
return new List<ValueTuple<string, string>>
{
new ValueTuple<string, string>("GG_Uumuu", "Mega Jellyfish GG")
new ValueTuple<string, string>("Mines_03", "Crystal Crawler"),
new ValueTuple<string, string>("RestingGrounds_08", "Ghost revek"),
new ValueTuple<string, string>("GG_Uumuu", "Mega Jellyfish GG"),
new ValueTuple<string, string>("Hive_01", "Hive Bench")
};
}

Expand Down Expand Up @@ -184,10 +187,11 @@ private void HeroControllerStart(On.HeroController.orig_Start orig, HeroControll

//Activate artifact
artifact.level = 0;
if(Settings.slotHandle == artifact.ID()) artifact.level = Settings.overchargedSlot == 0 ? 2 : 1;
if(Settings.slotBladeL == artifact.ID()) artifact.level = Settings.overchargedSlot == 1 ? 3 : 2;
if(Settings.slotBladeR == artifact.ID()) artifact.level = Settings.overchargedSlot == 2 ? 3 : 2;
if(Settings.slotHead == artifact.ID()) artifact.level = Settings.overchargedSlot == 3 ? 4 : 3;
if(Settings.slots[0] == artifact.ID()) artifact.level = Settings.overchargedSlot == 0 ? 2 : 1;
if(Settings.slots[1] == artifact.ID()) artifact.level = Settings.overchargedSlot == 1 ? 3 : 2;
if(Settings.slots[2] == artifact.ID()) artifact.level = Settings.overchargedSlot == 2 ? 3 : 2;
if(Settings.slots[3] == artifact.ID()) artifact.level = Settings.overchargedSlot == 3 ? 4 : 3;

if(artifact.level > 0)
{
artifact.Activate();
Expand Down Expand Up @@ -307,7 +311,7 @@ private string LanguageGetHook(string key, string sheetTitle, string orig)
}
if(str == artifact.InternalName() + "Desc")
{
return artifact.Description();
return artifact.LoreDescription();
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions LostArtifacts/LostArtifacts.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<Product>LostArtifacts</Product>
<Description>A Hollow Knight Mod</Description>
<Copyright>Copyright © 2022</Copyright>
<AssemblyVersion>1.0.2.0</AssemblyVersion>
<FileVersion>1.0.2.0</FileVersion>
<AssemblyVersion>1.1.0.0</AssemblyVersion>
<FileVersion>1.1.0.0</FileVersion>
<OutputPath>bin\$(Configuration)\</OutputPath>
<LangVersion>latest</LangVersion>
</PropertyGroup>
Expand Down
6 changes: 3 additions & 3 deletions LostArtifacts/LostArtifacts/AttunedJewel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ public class AttunedJewel : Artifact
{
public override int ID() => 19;
public override string Name() => "Attuned Jewel";
public override string Description() => "The Godseekers crafted this jewel through harnessing the power of the Gods of " +
public override string LoreDescription() => "The Godseekers crafted this jewel through harnessing the power of the Gods of " +
"Thunder and Rain. It reveals the bearer’s inner nature and allows them to ascend ever higher.";
public override string LevelInfo() => "+15%, +20%, +25% to each stat";
public override string LevelInfo() => string.Format("+{0}% range, movement speed, or damage after a spell", 10 + level * 5);
public override string TraitName() => "Attuned";
public override string TraitDescription() => "Casting Fireball, Dive, or Shriek grants bonus attack range, movement speed, " +
"or damage for 5 seconds";
"or damage for 5 seconds.";
public override AbstractLocation Location()
{
return new CoordinateLocation()
Expand Down
15 changes: 11 additions & 4 deletions LostArtifacts/LostArtifacts/BeastShell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ public class BeastShell : Artifact
{
public override int ID() => 14;
public override string Name() => "Beast Shell";
public override string Description() => "A trophy from the God Tamer’s beast. It was deeply loyal toward its owner.";
public override string LevelInfo() => "+100%, +150%, +200% minion damage";
public override string LoreDescription() => "A trophy from the God Tamer’s beast. It was deeply loyal toward its owner.";
public override string LevelInfo() => string.Format("+{0}% minion damage after striking an enemy", 50 * (level + 1));
public override string TraitName() => "Beast Tamer";
public override string TraitDescription() => "Striking an enemy buffs minion damage for 5 seconds";
public override string TraitDescription() => "Striking an enemy buffs minion damage for 5 seconds.";
public override AbstractLocation Location()
{
return new EnemyLocation()
Expand All @@ -35,17 +35,23 @@ public override void Activate()
multiplier = 0.5f + 0.5f * level;
buffActive = false;

On.HealthManager.TakeDamage += HealthManagerTakeDamage;
On.HealthManager.Hit += HealthManagerHit;
On.HutongGames.PlayMaker.Actions.IntOperator.OnEnter += IntOperatorOnEnter;
}

private void HealthManagerHit(On.HealthManager.orig_Hit orig, HealthManager self, HitInstance hitInstance)
private void HealthManagerTakeDamage(On.HealthManager.orig_TakeDamage orig, HealthManager self, HitInstance hitInstance)
{
if(hitInstance.AttackType == AttackTypes.Nail || hitInstance.AttackType == AttackTypes.NailBeam)
{
StopAllCoroutines();
StartCoroutine(DamageControl());
}
orig(self, hitInstance);
}

private void HealthManagerHit(On.HealthManager.orig_Hit orig, HealthManager self, HitInstance hitInstance)
{
if(buffActive && hitInstance.Source.transform.parent != null &&
hitInstance.Source.transform.parent.name.Contains("Hatchling"))
{
Expand Down Expand Up @@ -85,6 +91,7 @@ public override void Deactivate()
{
base.Deactivate();

On.HealthManager.TakeDamage -= HealthManagerTakeDamage;
On.HealthManager.Hit -= HealthManagerHit;
On.HutongGames.PlayMaker.Actions.IntOperator.OnEnter -= IntOperatorOnEnter;
StopAllCoroutines();
Expand Down
6 changes: 3 additions & 3 deletions LostArtifacts/LostArtifacts/Buzzsaw.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ public class Buzzsaw : Artifact
{
public override int ID() => 17;
public override string Name() => "Buzzsaw";
public override string Description() => "Shaw";
public override string LevelInfo() => "Buff scales up to +30%, +45%, +60%";
public override string LoreDescription() => "Shaw";
public override string LevelInfo() => string.Format("Buff scales up to +{0}%", 15 * (level + 1));
public override string TraitName() => "Secluded";
public override string TraitDescription() => "Nail damage increases with distance from nearest enemy";
public override string TraitDescription() => "Nail damage increases with distance from nearest enemy.";
public override AbstractLocation Location()
{
return new CoordinateLocation()
Expand Down
46 changes: 43 additions & 3 deletions LostArtifacts/LostArtifacts/ChargedCrystal.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
using ItemChanger;
using ItemChanger.Locations;
using Satchel;
using HutongGames.PlayMaker.Actions;
using UnityEngine;
using System.Collections;

namespace LostArtifacts.Artifacts
{
public class ChargedCrystal : Artifact
{
public override int ID() => 8;
public override string Name() => "Charged Crystal";
public override string Description() => "Though all crystals from the Peaks hold some amount of energy, this crystal is " +
public override string LoreDescription() => "Though all crystals from the Peaks hold some amount of energy, this crystal is " +
"even more potent than usual. It pulses and glows with all of its might.";
public override string LevelInfo() => "+10%, +20%, +30% damage";
public override string LevelInfo() => string.Format("+{0}% nail art damage", 10 * level);
public override string TraitName() => "Energized";
public override string TraitDescription() => "Nail arts deal increased damage";
public override string TraitDescription() => "Nail arts deal increased damage.";
public override AbstractLocation Location()
{
return new DualLocation()
Expand All @@ -38,15 +42,22 @@ public override AbstractLocation Location()
};
}

private GameObject crystalParticlesGO;
private AudioClip crystalClip;
private float multiplier;

public override void Activate()
{
base.Activate();

PlayMakerFSM crystalFSM = LostArtifacts.Preloads["Mines_03"]["Crystal Crawler"].LocateMyFSM("Hit Crystals");
crystalParticlesGO = crystalFSM.GetAction<SetParticleEmission>("Particle effect", 2).gameObject.GameObject.Value;
crystalClip = crystalFSM.GetAction<AudioPlaySimple>("Particle effect", 4).oneShotClip.Value as AudioClip;

multiplier = level * 0.1f;

On.HealthManager.Hit += HealthManagerHit;
On.HealthManager.TakeDamage += HealthManagerTakeDamage;
}

private void HealthManagerHit(On.HealthManager.orig_Hit orig, HealthManager self, HitInstance hitInstance)
Expand All @@ -64,11 +75,40 @@ private void HealthManagerHit(On.HealthManager.orig_Hit orig, HealthManager self
orig(self, hitInstance);
}

private void HealthManagerTakeDamage(On.HealthManager.orig_TakeDamage orig, HealthManager self, HitInstance hitInstance)
{
if(hitInstance.AttackType == AttackTypes.Nail)
{
if(hitInstance.Source.name.Contains("Great Slash") ||
hitInstance.Source.name.Contains("Dash Slash") ||
hitInstance.Source.name.Contains("Hit L") ||
hitInstance.Source.name.Contains("Hit R"))
{
StartCoroutine(EmitParticles(self.transform.position));
HeroController.instance.GetComponent<AudioSource>().PlayOneShot(crystalClip);
}
}
orig(self, hitInstance);
}

private IEnumerator EmitParticles(Vector3 pos)
{
GameObject crystalParticles = Instantiate(crystalParticlesGO, pos, Quaternion.identity);
crystalParticles.SetActive(true);

ParticleSystem particles = crystalParticles.GetComponent<ParticleSystem>();
particles.Emit(10);

yield return new WaitForSeconds(2.5f);
Destroy(crystalParticles);
}

public override void Deactivate()
{
base.Deactivate();

On.HealthManager.Hit -= HealthManagerHit;
On.HealthManager.TakeDamage -= HealthManagerTakeDamage;
}
}
}
43 changes: 31 additions & 12 deletions LostArtifacts/LostArtifacts/CryingStatue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,20 @@
using Modding;
using System.Collections;
using UnityEngine;
using Satchel;
using HutongGames.PlayMaker.Actions;

namespace LostArtifacts.Artifacts
{
public class CryingStatue : Artifact
{
public override int ID() => 4;
public override string Name() => "Crying Statue";
public override string Description() => "The never-ending rain seeps into every object it can find, including this relic. " +
public override string LoreDescription() => "The never-ending rain seeps into every object it can find, including this relic. " +
"The water looks vaguely like tears.";
public override string LevelInfo() => "+10%, +15%, +20% damage per mask";
public override string LevelInfo() => string.Format("+{0}% damage per mask of damage taken", 5 * (level + 1));
public override string TraitName() => "Fallen";
public override string TraitDescription() => "Take one extra damage, but deal more damage for 10 seconds after taking damage";
public override string TraitDescription() => "Take one extra damage, but deal more damage for 10 seconds after taking damage.";
public override AbstractLocation Location()
{
return new CoordinateLocation()
Expand All @@ -27,25 +29,35 @@ public override AbstractLocation Location()
};
}

private AudioClip furyClip;
private GameObject furyGO;
private float multiplier;
private int damage;
private int damageTaken;

public override void Activate()
{
base.Activate();

PlayMakerFSM furyFSM = HeroController.instance.transform.Find("Charm Effects").gameObject.LocateMyFSM("Fury");
furyClip = (AudioClip)furyFSM.GetAction<AudioPlayerOneShotSingle>("Activate", 0).audioClip.Value;
furyGO = Instantiate(HeroController.instance.transform.Find("Charm Effects/Fury").gameObject);
furyGO.transform.parent = HeroController.instance.transform.Find("Charm Effects");
furyGO.transform.localPosition = new Vector3(-0.014f, - 0.713f, 0f);
DontDestroyOnLoad(furyGO);
ParticleSystem.MainModule settings = furyGO.GetComponent<ParticleSystem>().main;
settings.startColor = new Color(0f, 0.25f, 0.6f);

multiplier = 0.05f * (level + 1);
damageTaken = 0;

ModHooks.TakeHealthHook += TakeHealthHook;
ModHooks.TakeDamageHook += TakeDamageHook;
On.HealthManager.Hit += HealthManagerHit;
}

private int TakeHealthHook(int damage)
{
StopAllCoroutines();
On.HealthManager.Hit -= HealthManagerHit;
StartCoroutine(DamageControl());
this.damage = damage;
StartCoroutine(DamageControl(damage));
return damage;
}

Expand All @@ -54,18 +66,23 @@ private int TakeDamageHook(ref int hazardType, int damage)
return damage == 0 ? 0 : damage + 1;
}

private IEnumerator DamageControl()
private IEnumerator DamageControl(int damage)
{
On.HealthManager.Hit += HealthManagerHit;
damageTaken += damage;
HeroController.instance.GetComponent<AudioSource>().PlayOneShot(furyClip);
furyGO.GetComponent<ParticleSystem>().Play();

yield return new WaitForSeconds(10f);
On.HealthManager.Hit -= HealthManagerHit;

damageTaken -= damage;
if(damageTaken == 0) furyGO.GetComponent<ParticleSystem>().Stop();
}

private void HealthManagerHit(On.HealthManager.orig_Hit orig, HealthManager self, HitInstance hitInstance)
{
if(hitInstance.AttackType == AttackTypes.Nail || hitInstance.AttackType == AttackTypes.NailBeam)
{
hitInstance.Multiplier += multiplier * damage;
hitInstance.Multiplier += multiplier * damageTaken;
}
orig(self, hitInstance);
}
Expand All @@ -78,6 +95,8 @@ public override void Deactivate()
ModHooks.TakeDamageHook -= TakeDamageHook;
On.HealthManager.Hit -= HealthManagerHit;
StopAllCoroutines();

furyGO.GetComponent<ParticleSystem>().Stop();
}
}
}
Loading

0 comments on commit 3f9c7da

Please sign in to comment.