本文整理汇总了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());
}