/// <summary> /// Calculates the willpower-adjusted cooldown for an ability. /// </summary> public int GetAdjustedCooldown(int baseCooldown) { GameObject player = XRLCore.Core?.Game?.Player?.Body; if (player == null || !player.HasStat("Willpower")) { return(baseCooldown); } int internalCooldown = baseCooldown * 10; int val = (int)((double)internalCooldown * (100.0 - (double)((player.Stat("Willpower", 0) - 16) * 5))) / 100; int calculatedCooldown = Math.Max(val, ActivatedAbilities.MinimumValueForCooldown(internalCooldown)); baseCooldown = (int)Math.Ceiling((double)((float)calculatedCooldown / 10f)); return(baseCooldown); }