本文整理匯總了C#中Ability.getAbilityClass方法的典型用法代碼示例。如果您正苦於以下問題:C# Ability.getAbilityClass方法的具體用法?C# Ability.getAbilityClass怎麽用?C# Ability.getAbilityClass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Ability
的用法示例。
在下文中一共展示了Ability.getAbilityClass方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: calculateBaseDamage
public Damage calculateBaseDamage(Ability.IAbility ability)
{
int str = 0;
float damageModifier = ability.getDamageModifier();
string damageType = ability.getAbilityClass();
bool crit;
float critProb = 0.0f;
float critMultiplier;
switch (damageType)
{
case "Physical":
str = strength;
critMultiplier = 1.5f;
critProb = getBasePhysicalCritProbability();
break;
case "Fire":
str = magic;
critMultiplier = 1.2f;
critProb = getBaseMagicCritProbability();
break;
case "Ice":
str = magic;
critMultiplier = 1.2f;
critProb = getBaseMagicCritProbability();
break;
case "Light":
str = spirit;
critMultiplier = 1.2f;
critProb = getBaseMagicCritProbability();
break;
case "Poison":
str = magic;
critMultiplier = 1.2f;
critProb = getBaseMagicCritProbability();
break;
case "Ignore":
return new Damage(0, false);
default:
throw new System.NotImplementedException();
}
float rand = Random.Range(0.0f, 1.0f);
crit = critProb > rand ? true : false;
critMultiplier = crit ? 1.5f : 1.0f;
return new Damage((int)(((str * str * str) / 32 + 32) * damageModifier * critMultiplier * Random.Range(0.8f, 1.2f)), crit);
}
示例2: takeGeneralDamage
public virtual void takeGeneralDamage(Damage damage, Ability.IAbility ability, IBattleCharacter source)
{
if (ability.getStatusEffectTypes() != null)
{
addStatusEffect(ability.getStatusEffectTypes());
}
if (this.getCharStats().targetCurHP <= 0)
return;
float modifier = UnityEngine.Random.Range(0.9f, 1.1f);
damage.actualDamage = (int)((float)playerStats.calculateDamageTaken(damage.baseDamage, ability.getAbilityClass()) * modifier);
takeDamage(damage, ability.show0Damage(), ability.timeToDamage());
}