本文整理匯總了C#中WCell.RealmServer.Entities.Unit.GetTargetResistanceMod方法的典型用法代碼示例。如果您正苦於以下問題:C# Unit.GetTargetResistanceMod方法的具體用法?C# Unit.GetTargetResistanceMod怎麽用?C# Unit.GetTargetResistanceMod使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類WCell.RealmServer.Entities.Unit
的用法示例。
在下文中一共展示了Unit.GetTargetResistanceMod方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: GetResistChancePct
/// <summary>
/// Calculates this Unit's chance to resist the given school.
/// Value is between 0 and 100
/// </summary>
public float GetResistChancePct(Unit attacker, DamageSchool school)
{
int attackerLevel;
var res = GetResistance(school);
if (attacker != null)
{
attackerLevel = Math.Max(1, attacker.Level);
res -= attacker.GetTargetResistanceMod(school);
}
else
{
attackerLevel = 1;
}
res = Math.Max(0, res);
var resist = (res / (attackerLevel * 5f)) * 0.75f;
if (resist > 75)
{
resist = 75f;
}
if (resist < 0)
{
resist = 0;
}
return resist;
}