From 0a0d9410e76a3b6bae2aab06cb65776614ed8469 Mon Sep 17 00:00:00 2001 From: kanym Date: Sun, 27 Sep 2026 00:52:01 +0200 Subject: [PATCH] fix(skadi): Middle Mouse in Drake form no longer spends the attack cooldown on nothing PerformAttackCoroutine starts the cooldown and shows its icon before it looks at the form, and the Drake has no Middle Mouse attack, so the press cost a cooldown and fired nothing. HasAttackForButton now answers for the Drake too and guards all three buttons, as it already did Left Mouse. Co-Authored-By: Claude Opus 5.5 --- JotunnModStub/Skadi/DrakeFormBehavior.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/JotunnModStub/Skadi/DrakeFormBehavior.cs b/JotunnModStub/Skadi/DrakeFormBehavior.cs index 53b9049..b86a59e 100644 --- a/JotunnModStub/Skadi/DrakeFormBehavior.cs +++ b/JotunnModStub/Skadi/DrakeFormBehavior.cs @@ -221,14 +221,14 @@ namespace RacesOfValheim } else if (SkadiConfig.BreathAttackKey.Value.IsDownIgnoringHeldKeys() || RaceInput.PadAttackDown(2)) { - if (Time.time - lastAttackTime >= ATTACK_COOLDOWN) + if (HasAttackForButton(2) && Time.time - lastAttackTime >= ATTACK_COOLDOWN) { StartCoroutine(PerformAttackCoroutine(2)); } } else if ((SkadiConfig.SpinAttackKey.Value.IsDownIgnoringHeldKeys() || RaceInput.PadAttackDown(1)) && formRules.Form == SkadiProgression.FormType.SkeletonDragon) // Fader Spin { - if (Time.time - lastAttackTime >= ATTACK_COOLDOWN) + if (HasAttackForButton(1) && Time.time - lastAttackTime >= ATTACK_COOLDOWN) { StartCoroutine(PerformAttackCoroutine(1)); } @@ -236,13 +236,23 @@ namespace RacesOfValheim } } + // Whether this form has an attack on this button right now. Asked before the cooldown for + // every button, because PerformAttackCoroutine starts the cooldown and shows its icon before + // it looks at the form: a button with nothing behind it used to spend both and fire nothing. + // + // The Drake has only its Left Mouse volley; Middle Mouse is Moder's and Fader's breath. // Airborne Moder keeps the same hand as the ground: the ranged breath is Middle Mouse, and // Left Mouse has no attack in the air (its ground bite and claws cannot reach from up - // there). Checked before the cooldown so a stray left click does not eat the next volley. + // there). private bool HasAttackForButton(int button) { if (formRules == null) return false; + if (formRules.Form == SkadiProgression.FormType.Drake && button != 0) + { + return false; + } + bool airborne = isFlying || isLanding; if (airborne && formRules.Form == SkadiProgression.FormType.Moder && button != 2) {