Fix Skadi resetrace, cold spell VFX, and Freezing-to-Cold conversion

- resetrace never cleaned up SE_SkadiStats/SE_SkadiCooldown, so
  Skadi's Aura and its frost buffs stuck around after switching race.
- Cold Spell projectile spawned near the feet (0.4m) and used the
  unarmed kick animation; now spawns at chest height and uses the
  galdr_cast (raised-arms) trigger instead.
- Freezing-to-Cold silently did nothing from tier 1 onward: Skadi's
  passive Frost damage resistance made Valheim's own environmental
  check skip Cold/Freezing entirely before our conversion patch ever
  ran. Added a scoped patch that neutralizes just that environmental
  check for the local Skadi player, plus a guard against Valheim's
  own Cold-removal call flickering the converted status off every
  other frame, plus an explicit cleanup of any real Freezing left
  over from before the conversion kicked in.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
kanym 2026-07-31 13:04:30 +02:00
commit 00b1b4e9ed
3 changed files with 82 additions and 8 deletions

View file

@ -230,7 +230,7 @@ namespace RacesOfValheim
if (Player.m_localPlayer == null || Player.m_localPlayer.IsDead()) return;
if (isTransformed) return; // Do not cast human spell while in dragon form
// Middle Mouse Button to cast (Kick)
// Middle Mouse Button to cast
if (Input.GetMouseButtonDown(2))
{
float cooldown = rules.ImprovedColdSpell ? 2.0f : 1.5f;
@ -246,10 +246,11 @@ namespace RacesOfValheim
lastSpellTime = Time.time;
var zanim = HarmonyLib.Traverse.Create(Player.m_localPlayer).Field<ZSyncAnimation>("m_zanim").Value;
if (zanim != null)
if (zanim != null)
{
// Forcing secondary attack trigger, which is kick when unarmed
zanim.SetTrigger("secondary");
// Raised-arms Galdr cast gesture instead of the unarmed kick, so the cast
// reads as a spell instead of a leg swing near the ground.
zanim.SetTrigger("galdr_cast");
}
StartCoroutine(ColdSpellKickCoroutine(rules));
@ -258,7 +259,7 @@ namespace RacesOfValheim
private IEnumerator ColdSpellKickCoroutine(SkadiProgression.FormRules rules)
{
// Wait for the kick animation to reach the extension point
// Wait for the cast animation to reach the release point
yield return new WaitForSeconds(0.4f);
if (Player.m_localPlayer == null || Player.m_localPlayer.IsDead()) yield break;
@ -287,16 +288,16 @@ namespace RacesOfValheim
{
if (Player.m_localPlayer == null || Player.m_localPlayer.IsDead()) break;
// Spawn from the foot (low position, forward)
// Spawn from chest height, forward
Vector3 lookDir = Player.m_localPlayer.GetLookDir();
// Add a small spread for the improved blast
if (rules.ImprovedColdSpell && i > 0)
{
lookDir = Quaternion.Euler(UnityEngine.Random.Range(-5f, 5f), UnityEngine.Random.Range(-5f, 5f), 0f) * lookDir;
}
Vector3 spawnPos = Player.m_localPlayer.transform.position + Vector3.up * 0.4f + lookDir * 0.6f;
Vector3 spawnPos = Player.m_localPlayer.transform.position + Vector3.up * 1.4f + lookDir * 0.6f;
GameObject projInstance = Instantiate(projPrefab, spawnPos, Quaternion.LookRotation(lookDir));