本文整理汇总了C#中Combatant.GetCriticalBonus方法的典型用法代码示例。如果您正苦于以下问题:C# Combatant.GetCriticalBonus方法的具体用法?C# Combatant.GetCriticalBonus怎么用?C# Combatant.GetCriticalBonus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Combatant
的用法示例。
在下文中一共展示了Combatant.GetCriticalBonus方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Use
/*
============================================================================
Use functions
============================================================================
*/
public bool Use(Combatant user, int element, Combatant target, float damageFactor, float damageMultiplier)
{
bool hit = false;
if(target.IsBlockBaseAttacks())
{
DataHolder.BattleSystemData().blockTextSettings.ShowText("", target);
}
else if((user is Enemy || this.ConsumeItems()) &&
(!this.hitChance || DataHolder.GameSettings().GetRandom() <=
(DataHolder.Formulas().formula[this.hitFormula].Calculate(user, target) + user.GetHitBonus())))
{
hit = true;
int eID = user.GetEffectAttackElement();
if(eID < 0)
{
eID = element;
}
ValueChange[] changes = this.consume;
AudioClip clip = null;
if(this.hasCritical && DataHolder.GameSettings().GetRandom() <=
DataHolder.Formula(user.baseCritical).Calculate(user, target) + user.GetCriticalBonus())
{
changes = this.criticalConsume;
clip = this.GetCriticalAudio();
}
if(clip == null)
{
clip = this.GetAttackAudio();
}
if(clip != null && target.prefabInstance != null)
{
AudioSource s = target.GetAudioSource();
if(s != null)
{
s.PlayOneShot(clip);
}
}
for(int i=0; i<changes.Length; i++)
{
if(changes[i].active)
{
int change = changes[i].ChangeValue(i, eID, user, target, true, damageFactor, damageMultiplier);
if(this.absorb)
{
change *= this.absorbValue;
change /= 100;
user.status[i].AddValue(change, true, false, true);
}
}
}
this.stealChance.Steal(user, target);
}
else
{
DataHolder.BattleSystemData().missTextSettings.ShowText("", target);
}
return hit;
}