本文整理匯總了C#中WCell.RealmServer.Entities.Unit.GetAttackerSpellHitChanceMod方法的典型用法代碼示例。如果您正苦於以下問題:C# Unit.GetAttackerSpellHitChanceMod方法的具體用法?C# Unit.GetAttackerSpellHitChanceMod怎麽用?C# Unit.GetAttackerSpellHitChanceMod使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類WCell.RealmServer.Entities.Unit
的用法示例。
在下文中一共展示了Unit.GetAttackerSpellHitChanceMod方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CalcSpellHitChance
/// <summary>
/// Calculates the chance to hit the given defender with a spell of the given school
/// </summary>
/// <returns>The effective hitchance</returns>
public float CalcSpellHitChance(Unit defender, DamageSchool dmgSchool, float resistChance)
{
float res = GetResistance(dmgSchool);
if (this is Character && defender is Character) //pvp has diffrent values compared to pve
{
res += (float)(99.24f / (1 + 0.0281f * Math.Log((0.516f * (defender.Level - Level)), MathUtil.E)));
}
else
{
res += (float)(98.77f / (1 + 0.0215f * Math.Log((0.6862f * (defender.Level - Level)), MathUtil.E)));
}
res *= resistChance;
res -= defender.GetAttackerSpellHitChanceMod(dmgSchool);
if (res < 1)
{
res = 1;
}
return res;
}