本文整理汇总了C#中Dice.RollAttack方法的典型用法代码示例。如果您正苦于以下问题:C# Dice.RollAttack方法的具体用法?C# Dice.RollAttack怎么用?C# Dice.RollAttack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dice
的用法示例。
在下文中一共展示了Dice.RollAttack方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DealDamageOnAttackRoll
public void DealDamageOnAttackRoll(Ship target, int rollAmount, string rollTrigger, bool inflictCrits)
{
int resultHit, resultCrit, resultBS, resultMiss;
int amountHit = 0, amountCrit = 0;
Dice d = new Dice ();
d.RollAttack (rollAmount, out resultHit, out resultCrit, out resultBS, out resultMiss);
if (rollTrigger.Contains ("Hit"))
{
// Add rolled HIT-results to total HIT-damage
amountHit += resultHit;
}
if (rollTrigger.Contains("Critical"))
{
if (inflictCrits)
{
// Add rolled CRITICAL-results to total CRITITAL-damage
amountCrit += resultCrit;
}
else
{
// Add rolled CRITIAL-results to total HIT-damage (convert CRITICALS to HITS)
amountHit += resultCrit;
}
}
if (rollTrigger.Contains("BattleStations"))
{
// Add rolled BATTLESTATIONS-results to total HIT-damage
amountHit += resultBS;
}
// Call DealDamage-method for damage handling
DealDamage (target, amountHit, amountCrit);
}