diff --git a/JotunnModStub/Aswid/AswidRace.cs b/JotunnModStub/Aswid/AswidRace.cs
index 6f2b61b..a117fa9 100644
--- a/JotunnModStub/Aswid/AswidRace.cs
+++ b/JotunnModStub/Aswid/AswidRace.cs
@@ -170,9 +170,6 @@ namespace RacesOfValheim
}
}
- public bool IsChanneling { get; private set; } = false;
- private float channelDamageTimer = 0f;
-
private float m_tintCheckTimer = 0f;
private float sensesCheckTimer = 0f;
@@ -306,7 +303,7 @@ namespace RacesOfValheim
{
if (Player.m_localPlayer == null || Player.m_localPlayer.IsDead() || !IsAswid())
{
- if (IsChanneling) StopChanneling();
+ damageTickTimer = 0f;
wasNight = null; // reset so it triggers correctly on spawn/respawn
if (Player.m_localPlayer != null) AswidSpectralClaw.PurgeAll(Player.m_localPlayer); // feature disabled for now, see AswidSpectralClaw.cs
return;
@@ -357,11 +354,11 @@ namespace RacesOfValheim
try
{
- HandleChanneling();
+ HandleVampiricAura();
}
catch (Exception ex)
{
- Jotunn.Logger.LogError($"[Aswid] Error in HandleChanneling: {ex}");
+ Jotunn.Logger.LogError($"[Aswid] Error in HandleVampiricAura: {ex}");
}
if (isTransformingSequence) return;
@@ -396,8 +393,11 @@ namespace RacesOfValheim
}
}
- // Auto revert mist form at sunrise
- if (EnvMan.instance != null && EnvMan.IsDay() && Player.m_localPlayer.GetSEMan().HaveStatusEffect("SE_MistForm".GetStableHashCode()))
+ // Auto revert mist form at sunrise. The isTransformingSequence guard matters: without it
+ // this fires again on every frame of the one-second revert, stacking a new coroutine each
+ // time, and they all fight over the same visuals and status effect.
+ if (EnvMan.instance != null && EnvMan.IsDay() && !isTransformingSequence &&
+ Player.m_localPlayer.GetSEMan().HaveStatusEffect("SE_MistForm".GetStableHashCode()))
{
StartCoroutine(RevertMistFormRoutine());
}
@@ -816,57 +816,27 @@ namespace RacesOfValheim
private float damageTickTimer = 0f;
- private void StopChanneling()
+ ///
+ /// The Vampiric Aura is passive: it drains on its own, in every form, with no key to hold and
+ /// no icon or message of its own. The form only decides how hard it bites.
+ ///
+ private void HandleVampiricAura()
{
- if (!IsChanneling) return;
- IsChanneling = false;
- channelDamageTimer = 0f;
+ damageTickTimer += Time.deltaTime;
+ if (damageTickTimer < 0.25f) return;
+
damageTickTimer = 0f;
+ PerformLifeDrain();
}
- private void HandleChanneling()
+ /// Half damage as a human, full as a bat, double as mist.
+ private float GetAuraFormMultiplier()
{
- bool hasMistForm = Player.m_localPlayer.GetSEMan().HaveStatusEffect("SE_MistForm".GetStableHashCode());
- bool hasBatForm = Player.m_localPlayer.GetSEMan().HaveStatusEffect("SE_BatForm".GetStableHashCode());
+ SEMan seman = Player.m_localPlayer.GetSEMan();
- if (Player.m_localPlayer.IsBlocking() && (hasMistForm || hasBatForm))
- {
- if (!IsChanneling)
- {
- IsChanneling = true;
- if (mistTransformation != null)
- {
- var anim = mistTransformation.GetComponentInChildren();
- if (anim != null) anim.SetBool("alert", true);
- }
- }
-
- channelDamageTimer += Time.deltaTime;
- damageTickTimer += Time.deltaTime;
-
- if (channelDamageTimer >= 0.25f)
- {
- channelDamageTimer = 0f;
- }
-
- if (damageTickTimer >= 0.25f)
- {
- damageTickTimer = 0f;
- PerformLifeDrain();
- }
- }
- else
- {
- if (IsChanneling)
- {
- StopChanneling();
- if (mistTransformation != null)
- {
- var anim = mistTransformation.GetComponentInChildren();
- if (anim != null) anim.SetBool("alert", false);
- }
- }
- }
+ if (seman.HaveStatusEffect("SE_MistForm".GetStableHashCode())) return 2f;
+ if (seman.HaveStatusEffect("SE_BatForm".GetStableHashCode())) return 1f;
+ return 0.5f;
}
private void PerformLifeDrain()
@@ -882,8 +852,6 @@ namespace RacesOfValheim
int layerMask = LayerMask.GetMask("character", "character_net", "character_ghost");
var colliders = Physics.OverlapSphere(center, radius, layerMask);
- bool hitAnything = false;
-
foreach (var col in colliders)
{
Character c = col.GetComponentInParent();
@@ -894,19 +862,13 @@ namespace RacesOfValheim
continue;
}
- hitAnything = true;
float maxHp = c.GetMaxHealth();
float currentHp = c.GetHealth();
float baseDamage = 1.0f;
float bloodMagicFactor = Player.m_localPlayer.GetSkillFactor(Skills.SkillType.BloodMagic);
// Lo scaling aggiunge un massimo di +5.0 danni (al livello 100), indipendentemente dal danno base
- float totalDamage = baseDamage + bloodMagicFactor * 5f;
-
- if (Player.m_localPlayer.GetSEMan().HaveStatusEffect("SE_MistForm".GetStableHashCode()))
- {
- totalDamage *= 2.0f; // Damage doubled in Mist Form
- }
+ float totalDamage = (baseDamage + bloodMagicFactor * 5f) * GetAuraFormMultiplier();
if (currentHp > 0 && currentHp <= maxHp * 0.20f && !c.IsBoss())
{
@@ -917,8 +879,14 @@ namespace RacesOfValheim
HitData hd = new HitData();
hd.m_damage.m_damage = totalDamage;
hd.m_point = c.GetCenterPoint();
+ hd.m_dir = (c.GetCenterPoint() - center).normalized;
hd.m_attacker = Player.m_localPlayer.GetZDOID();
- c.ApplyDamage(hd, true, false);
+
+ // Damage() sends RPC_Damage to whoever owns the target, so the hit lands for
+ // everyone and still runs our Character.Damage patches (lifesteal, devour on
+ // kill). ApplyDamage() skipped all of that: it edited the local copy of a
+ // character we usually do not own, and the owner overwrote it on the next sync.
+ c.Damage(hd);
SpawnBloodVFX(c);
}