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:
parent
373b0069dd
commit
ac4ce4c636
5 changed files with 114 additions and 11 deletions
|
|
@ -353,9 +353,37 @@ namespace RacesOfValheim
|
|||
|
||||
ItemDrop unarmed = player.m_unarmedWeapon;
|
||||
float perHit = unarmed != null ? unarmed.m_itemData.m_shared.m_attack.m_attackAdrenaline : 1f;
|
||||
// The Fenrir forms trade cheaper swings for a faster bar; the other races' forms do not.
|
||||
if (FenrirForms.LocalInForm(player)) perHit *= FenrirConfig.FormAdrenalineMultiplier.Value;
|
||||
player.AddAdrenaline(perHit * character.m_enemyAdrenalineMultiplier * scale);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Charges a form attack's stamina the way vanilla charges a weapon's (Attack.GetAttackStamina):
|
||||
/// 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.
|
||||
/// </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 || baseCost <= 0f) return true;
|
||||
|
||||
float cost = baseCost * (1f + player.GetEquipmentAttackStaminaModifier());
|
||||
player.GetSEMan().ModifyAttackStaminaUsage(cost, ref cost);
|
||||
cost -= cost * 0.33f * player.GetSkillFactor(skill);
|
||||
if (cost <= 0f) return true;
|
||||
|
||||
if (!player.HaveStamina(cost + 0.1f))
|
||||
{
|
||||
if (player == Player.m_localPlayer && Hud.instance != null) Hud.instance.StaminaBarEmptyFlash();
|
||||
return false;
|
||||
}
|
||||
|
||||
player.UseStamina(cost);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void LogHit(string form, IDestructible target, float damage)
|
||||
{
|
||||
if (!FenrirConfig.DebugFormHits.Value) return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue