private void AddExtraDamage(LivingEntity ent, Weapon wpn, Dictionary <Weapon.WeaponKind, EntityStatKind> weapons2Esk, ref float currentDamage) { if (wpn != null && weapons2Esk != null) { if (weapons2Esk.ContainsKey(wpn.Kind))//AxeExtraDamage, SwordExtraDamage... { var extraPercentage = ent.Stats.GetCurrentValue(weapons2Esk[wpn.Kind]); currentDamage = FactorCalculator.AddFactor(currentDamage, extraPercentage); } } }
private void AddExtraDamage(LivingEntity ent, Weapon wpn, Dictionary <Weapon.WeaponKind, EntityStatKind> weapons2Esk, ref float currentDamage) { if (wpn != null) { if (weapons2Esk != null) { if (weapons2Esk.ContainsKey(wpn.Kind))//AxeExtraDamage, SwordExtraDamage... { currentDamage = ent.Stats.GetStat(weapons2Esk[wpn.Kind]).SumPercentageFactorAndValue(currentDamage); } } if (ent is AdvancedLivingEntity ale) { Func <Ability> GetAbility = () => { if (wpn.IsBowLike) { var ab = ale.GetActivePhysicalProjectileAbility(); if (ab != null) { if (ab.Kind != AbilityKind.PerfectHit) { return(null); } return(ab); } } else { if (ale.CanUseAbility(AbilityKind.Rage)) { return(ale.GetActiveAbility(AbilityKind.Rage)); } } return(null); }; var ability = GetAbility(); if (ability == null || !ale.CanUseAbility(ability.Kind)) { return; } if (wpn.IsBowLike) { if (ability.Kind == AbilityKind.PerfectHit) { var nd = ability.PrimaryStat.SumPercentageFactorAndValue(currentDamage); //if (nd / currentDamage < 1.5) //{ // int k = 0; // k++; //} currentDamage = nd; } } else { if (AbilityKind.Rage == ability.Kind) { currentDamage = FactorCalculator.AddFactor(currentDamage, ale.SelectedActiveAbility.PrimaryStat.Factor); } } } } }