fix: a stagger cancels the form's attack

A form swing waits for its clip's hit event and lands on a timeout if none comes,
so a stagger that cut the clip short still dealt the blow. Attacks are marked as
they start (TrySpendStamina, Ravager AttackRoutine) and their hits are dropped if
a stagger began since. No attack or Cultist breath starts while staggered.
This commit is contained in:
kanym 2026-10-29 13:53:04 +01:00
commit beffd0bee6
5 changed files with 28 additions and 7 deletions

View file

@ -373,10 +373,14 @@ namespace RacesOfValheim
/// the equipment modifier, status effects (meads, race passives), then up to a third off with
/// the attack's skill. Without enough, the attack does not start and the stamina bar flashes,
/// as it does for a weapon. A cost of 0 is free and always goes through.
/// A staggered player cannot attack at all, and an attack that may start is marked for
/// FormStagger, so a stagger before its hit cancels it.
/// </summary>
/// <returns>True if the attack may start; the stamina is already spent.</returns>
public static bool TrySpendStamina(Player player, float baseCost, Skills.SkillType skill)
{
if (player != null && player.IsStaggering()) return false;
FormStagger.MarkAttack();
if (player == null || baseCost <= 0f) return true;
float cost = baseCost * (1f + player.GetEquipmentAttackStaminaModifier());