/// <summary> /// Calculates the amount of stamina required to perform this attack /// </summary> public int GetAttackStamina(PowerAccuracy powerAccuracy) { // Stamina cost for melee and missile attacks is based on the total burden of what you are holding // in your hands (main hand and offhand), and your power/accuracy bar. // Attacking(Low power / accuracy bar) 1 point per 700 burden units // 1 point per 1200 burden units // 1.5 points per 1600 burden units // Attacking(Mid power / accuracy bar) 1 point per 700 burden units // 2 points per 1200 burden units // 3 points per 1600 burden units // Attacking(High power / accuracy bar) 2 point per 700 burden units // 4 points per 1200 burden units // 6 points per 1600 burden units // The higher a player's base Endurance, the less stamina one uses while attacking. This benefit is tied to Endurance only, // and caps out at 50% less stamina used per attack. Scaling is similar to other Endurance bonuses. Applies only to players. // When stamina drops to 0, your melee and missile defenses also drop to 0 and you will be incapable of attacking. // In addition, you will suffer a 50% penalty to your weapon skill. This applies to players and creatures. var burden = GetHandItemBurden(); var baseCost = StaminaTable.GetStaminaCost(powerAccuracy, burden); var staminaMod = GetStaminaMod(); var staminaCost = Math.Max(baseCost * staminaMod, 1); //Console.WriteLine($"GetAttackStamina({powerAccuracy}) - burden: {burden}, baseCost: {baseCost}, staminaMod: {staminaMod}, staminaCost: {staminaCost}"); return((int)Math.Round(staminaCost)); }
public static float GetStaminaCost(PowerAccuracy powerAccuracy, int burden) { var baseCost = 0.0f; var attackCosts = Costs[powerAccuracy]; foreach (var attackCost in attackCosts) { if (burden >= attackCost.Burden) { var numTimes = burden / attackCost.Burden; baseCost += attackCost.Stamina * numTimes; burden -= attackCost.Burden * numTimes; } } return(baseCost); }