Adds AswidConfig.cs, following the SkadiConfig pattern: one Configuration Manager section per topic (Keybinds, Passive Combat, Vampiric Aura, Superhuman Senses, Eclipse, Devour, Domination), covering every tunable number and all five ability keybinds (Bat Form, Mist Form, Eclipse, Tame, Toggle Devour). Defaults match the previous hardcoded constants exactly. Also fixes a real mismatch found along the way: the tame hover-text hardcoded "[K] Tame" while the key that actually triggered taming was U. Both now read the same configured Tame key, so the hint stays correct if it's rebound. Config sections are bound alphabetically by race (Aswid before Skadi) in RacesOfValheim.Awake(), since Configuration Manager's category list follows bind order.
145 lines
5.8 KiB
C#
145 lines
5.8 KiB
C#
using Jotunn.Managers;
|
|
using Jotunn.Entities;
|
|
using System;
|
|
using UnityEngine;
|
|
|
|
namespace RacesOfValheim
|
|
{
|
|
public class SE_AswidStats : SE_Stats
|
|
{
|
|
public override void Setup(Character character)
|
|
{
|
|
base.Setup(character);
|
|
name = "SE_AswidStats";
|
|
m_name = "Benedictus et Afflictus";
|
|
m_tooltip = "Vampiric senses and life drain.";
|
|
}
|
|
|
|
public void UpdateStats(int state)
|
|
{
|
|
m_fallDamageModifier = -1f; // No fall damage
|
|
|
|
float multiplier = (EnvMan.instance != null && EnvMan.IsNight()) ? AswidConfig.NightMultiplier.Value : 1f;
|
|
|
|
m_speedModifier = AswidConfig.SpeedBonusPerState.Value * state * multiplier;
|
|
|
|
// For jump, Valheim SE_Stats typically adds the y value to 1
|
|
m_jumpModifier = new Vector3(0f, AswidConfig.SpeedBonusPerState.Value * state * multiplier, 0f);
|
|
|
|
if (state >= 5)
|
|
{
|
|
if (m_mods == null) m_mods = new System.Collections.Generic.List<HitData.DamageModPair>();
|
|
m_mods.Clear(); // Refresh to avoid duplicates
|
|
m_mods.Add(new HitData.DamageModPair() { m_type = HitData.DamageType.Poison, m_modifier = HitData.DamageModifier.Immune });
|
|
}
|
|
else
|
|
{
|
|
if (m_mods != null) m_mods.Clear();
|
|
}
|
|
}
|
|
|
|
public override void ModifyAttack(Skills.SkillType skill, ref HitData hitData)
|
|
{
|
|
base.ModifyAttack(skill, ref hitData);
|
|
if (m_character is Player p && p.GetComponent<ZNetView>() != null && p.GetComponent<ZNetView>().GetZDO() != null)
|
|
{
|
|
int state = BossProgressionManager.GetCurrentProgressionState();
|
|
var rules = AswidProgression.GetRules(state);
|
|
if (rules != null && rules.HasSurtlingForm)
|
|
{
|
|
hitData.m_damage.m_damage += AswidConfig.SurtlingFormDamageBonus.Value;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public class SE_BatForm : SE_Stats
|
|
{
|
|
public override void Setup(Character character)
|
|
{
|
|
base.Setup(character);
|
|
name = "SE_BatForm";
|
|
m_name = "Like a Bat out of Hell";
|
|
m_tooltip = "You have taken the form of a Bat. You can fly, but cannot attack.";
|
|
m_fallDamageModifier = -1f; // Immune to fall damage just in case
|
|
}
|
|
}
|
|
|
|
public class SE_MistForm : SE_Stats
|
|
{
|
|
public override void Setup(Character character)
|
|
{
|
|
base.Setup(character);
|
|
name = "SE_MistForm";
|
|
m_name = "Weight of Shadows";
|
|
m_tooltip = "You are mist. Immune to physical damage and poison. Cannot attack or run.";
|
|
m_fallDamageModifier = -1f;
|
|
m_mods = new System.Collections.Generic.List<HitData.DamageModPair>
|
|
{
|
|
new HitData.DamageModPair { m_type = HitData.DamageType.Blunt, m_modifier = HitData.DamageModifier.Immune },
|
|
new HitData.DamageModPair { m_type = HitData.DamageType.Slash, m_modifier = HitData.DamageModifier.Immune },
|
|
new HitData.DamageModPair { m_type = HitData.DamageType.Pierce, m_modifier = HitData.DamageModifier.Immune },
|
|
new HitData.DamageModPair { m_type = HitData.DamageType.Poison, m_modifier = HitData.DamageModifier.Immune }
|
|
};
|
|
}
|
|
}
|
|
|
|
public class SE_AswidSensesMark : SE_Stats
|
|
{
|
|
public override void Setup(Character character)
|
|
{
|
|
base.Setup(character);
|
|
name = "SE_AswidSensesMark";
|
|
m_name = "Sensed";
|
|
m_tooltip = "";
|
|
m_ttl = 2f;
|
|
m_icon = null; // No icon needed for mobs
|
|
}
|
|
}
|
|
|
|
public class SE_SuperhumanSenses : SE_Stats
|
|
{
|
|
public override void Setup(Character character)
|
|
{
|
|
base.Setup(character);
|
|
name = "SE_SuperhumanSenses";
|
|
m_name = "Auspex";
|
|
m_tooltip = "Sensing life force of nearby creatures.";
|
|
}
|
|
}
|
|
|
|
public class AswidStatusEffects
|
|
{
|
|
public static void RegisterStatusEffects()
|
|
{
|
|
var aswidStats = ScriptableObject.CreateInstance<SE_AswidStats>();
|
|
aswidStats.name = "SE_AswidStats";
|
|
aswidStats.m_icon = PrefabManager.Cache.GetPrefab<ItemDrop>("TrophyBat")?.m_itemData.m_shared.m_icons[0];
|
|
|
|
ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(aswidStats, fixReference: false));
|
|
|
|
var batForm = ScriptableObject.CreateInstance<SE_BatForm>();
|
|
batForm.name = "SE_BatForm";
|
|
batForm.m_icon = PrefabManager.Cache.GetPrefab<ItemDrop>("TrophyBat")?.m_itemData.m_shared.m_icons[0];
|
|
|
|
ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(batForm, fixReference: false));
|
|
|
|
var mistForm = ScriptableObject.CreateInstance<SE_MistForm>();
|
|
mistForm.name = "SE_MistForm";
|
|
mistForm.m_icon = PrefabManager.Cache.GetPrefab<ItemDrop>("TrophyWraith")?.m_itemData.m_shared.m_icons[0];
|
|
|
|
ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(mistForm, fixReference: false));
|
|
|
|
var sensesMark = ScriptableObject.CreateInstance<SE_AswidSensesMark>();
|
|
sensesMark.name = "SE_AswidSensesMark";
|
|
sensesMark.m_name = "Sensed";
|
|
sensesMark.m_ttl = 2f;
|
|
ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(sensesMark, fixReference: false));
|
|
|
|
var senses = ScriptableObject.CreateInstance<SE_SuperhumanSenses>();
|
|
senses.name = "SE_SuperhumanSenses";
|
|
senses.m_icon = PrefabManager.Cache.GetPrefab<ItemDrop>("TrophyWolf")?.m_itemData.m_shared.m_icons[0];
|
|
ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(senses, fixReference: false));
|
|
}
|
|
}
|
|
}
|