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) {