RacesOfValheim/JotunnModStub/Aswid/AswidStatusEffects.cs
kanym e75c7072c4 fix(prefabs): replace every lookup name that does not exist in vanilla
An audit of all 59 prefab names the mod resolves, against the game's own
asset manifests, found nine that are not in Valheim at all. A name vanilla
does not use has no vanilla candidate to beat in Jotunn's name cache, so it
is a free slot for whoever ships one - which is how another mod's weapon
trail became the Skeleton's fire aura in 00d4fd6.

Eight of the nine failed in silence, which is why none of them was ever
reported:

  vfx_corpse_destruction  ->  _medium, _large for the Muspell. The puff that
      covers a transformation. Fenrir and Skadi at least had their sparks;
      the Muspell swapped bodies in plain view with nothing at all.
  vfx_surtling_death      ->  vfx_wraith_death for the Aswid's Mist Form,
      which reads as mist by construction and is the same creature the form
      already borrows its Visual from; vfx_corpse_destruction_medium for the
      thrall, where nothing is misty. Vanilla has no surtling death effect
      under any spelling.
  TrophyTroll             ->  TrophyForestTroll.
  TrophyBat               ->  TrophyDeathsquito. Vanilla ships no bat trophy,
      so the Aswid's two status effects and its radial entry had no icon.
  vfx_smoke               ->  gone. It was the Trenta's fallback for Purple
      Rain's particle material behind Greydwarf_Shaman, and the day the
      Shaman failed to resolve it would have worn whatever a mod supplies.
      Purple Rain is purple by design, so nobody would ever have reported it.

The ninth did not fail in silence. vfx_OozeHit was passed to Instantiate
unguarded, so every successful Draugh parry threw ArgumentException and took
the North Wind nova below it down as well. It is vfx_blob_hit.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-26 00:20:02 +02:00

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>("TrophyDeathsquito")?.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>("TrophyDeathsquito")?.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));
}
}
}