Merge branch 'fix-form-adrenaline': Form hits build adrenaline

This commit is contained in:
kanym 2026-10-29 13:22:44 +01:00
commit 4cb9b7788d
4 changed files with 24 additions and 0 deletions

View file

@ -620,6 +620,7 @@ namespace RacesOfValheim
hitData.SetAttacker(Player.m_localPlayer);
target.Damage(hitData);
FormMelee.GrantAdrenaline(target);
}
}

View file

@ -1067,6 +1067,7 @@ namespace RacesOfValheim
hitData.SetAttacker(player);
target.Damage(hitData);
FormMelee.GrantAdrenaline(target);
}
}
}

View file

@ -496,6 +496,7 @@ namespace RacesOfValheim
hitData.SetAttacker(attacker);
target.Damage(hitData);
FormMelee.GrantAdrenaline(target);
}
}

View file

@ -337,6 +337,7 @@ namespace RacesOfValheim
aoe.m_hitOwner = false;
aoe.m_hitProps = true;
aoe.m_radius = Mathf.Max(aoe.m_radius, range * 0.6f);
instance.AddComponent<TrolSlamAoe>();
aoe.Setup(player, player.transform.forward, -1f, hitData, null, null);
spawned = true;
}
@ -429,6 +430,7 @@ namespace RacesOfValheim
if (targetObj != null) done.Add(targetObj);
FormMelee.LogHit(FormLabel, target, damage.GetTotalDamage());
target.Damage(hitData);
FormMelee.GrantAdrenaline(target);
profile.Shared.m_hitEffect.Create(targetCenter, Quaternion.identity);
landed++;
}
@ -437,6 +439,25 @@ namespace RacesOfValheim
}
}
/// <summary>Marks the Aoe a True Form slam spawned, so its hits can be told apart from a
/// real troll's.</summary>
internal class TrolSlamAoe : MonoBehaviour { }
/// <summary>
/// Adrenaline for each creature the slam's Aoe lands on. Vanilla gives it inside Attack, and
/// an Aoe set up by hand never goes through one (FormMelee.GrantAdrenaline says why the sweeps
/// needed the same).
/// </summary>
[HarmonyPatch(typeof(Aoe), "OnHit")]
public static class Trol_SlamAoeAdrenaline_Patch
{
public static void Postfix(Aoe __instance, Collider collider, bool __result)
{
if (!__result || collider == null || __instance.GetComponent<TrolSlamAoe>() == null) return;
FormMelee.GrantAdrenaline(collider.GetComponentInParent<Character>());
}
}
/// <summary>
/// The troll every other client sees. RemoteFenrirAnimator in shape: legs from the remote
/// player's own Animator, which ZSyncAnimation keeps fed over the network, and attacks replayed