feat(forms): Trol True Form and Fenrir form attacks cost stamina

Every form swing was free. FormMelee.TrySpendStamina charges a form
attack the way Attack.GetAttackStamina charges a weapon: equipment
modifier, status effects, up to a third off with the skill. Short of
stamina, the attack does not start and the bar flashes.

Trol True Form (Clubs skill), priced by the troll's damage, the slam
dearer for hitting all around: punch 10, side log swing 10, overhead
log 12, ground slam 18.

Fenrir forms (Unarmed), cheaper than weapons: Fenring 6/10/16, Wolf
4/6/10, Ulv 5/8/14, Cultist claw 6 and double claw 12. In exchange each
form hit gives 1.5x adrenaline (Fenrir - Form Buffs / Form Adrenaline
Multiplier), in Fenrir forms only.

Every cost is its own config entry beside the attack's damage.
This commit is contained in:
kanym 2026-10-29 02:28:23 +01:00
commit ac4ce4c636
5 changed files with 114 additions and 11 deletions

View file

@ -143,6 +143,20 @@ namespace RacesOfValheim
}
}
/// <summary>What a swing costs, by the button pressed. Until these existed every troll
/// blow was free.</summary>
private static float StaminaFor(TrolTrueFormModel.AttackKind kind)
{
switch (kind)
{
case TrolTrueFormModel.AttackKind.Punch: return TrolConfig.TrueFormPunchStamina.Value;
case TrolTrueFormModel.AttackKind.Slam: return TrolConfig.TrueFormSlamStamina.Value;
case TrolTrueFormModel.AttackKind.LogSwingH: return TrolConfig.TrueFormLogSwingStamina.Value;
case TrolTrueFormModel.AttackKind.LogSwingV: return TrolConfig.TrueFormLogOverheadStamina.Value;
default: return 0f;
}
}
private void Play(TrolTrueFormModel.AttackKind kind)
{
TrolTrueFormModel.Profile profile = TrolTrueFormModel.Get(kind);
@ -150,6 +164,7 @@ namespace RacesOfValheim
if (profile == null && kind == TrolTrueFormModel.AttackKind.LogSwingH) profile = TrolTrueFormModel.Get(TrolTrueFormModel.AttackKind.Punch);
if (profile == null && kind == TrolTrueFormModel.AttackKind.LogSwingV) profile = TrolTrueFormModel.Get(TrolTrueFormModel.AttackKind.Slam);
if (profile == null) return;
if (!FormMelee.TrySpendStamina(Player.m_localPlayer, StaminaFor(kind), Skills.SkillType.Clubs)) return;
bool log = kind == TrolTrueFormModel.AttackKind.LogSwingH || kind == TrolTrueFormModel.AttackKind.LogSwingV;
// The slam goes by what the key means, not by the troll's attack type: troll_groundslam