当前位置: 首页>>代码示例>>C#>>正文


C# Weapon.getSecondAttackCritical方法代码示例

本文整理汇总了C#中Weapon.getSecondAttackCritical方法的典型用法代码示例。如果您正苦于以下问题:C# Weapon.getSecondAttackCritical方法的具体用法?C# Weapon.getSecondAttackCritical怎么用?C# Weapon.getSecondAttackCritical使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Weapon的用法示例。


在下文中一共展示了Weapon.getSecondAttackCritical方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: attack

 public void attack(Weapon w, Attackable a, bool flatFooted, bool touch)
 {
     //function actually attacks
     AC = getArmorClass(flatFooted, touch, a);
     rollAttack();
     Debug.Log(e.getName()+" attack roll = "+TattackRoll);
     if(TattackRoll == 1) {										//critical miss, add some sort of fumble later
         Debug.Log(e.getName()+"'s attack critically misses :(");
         if(transform.gameObject.tag == "Player") {
             hitter.SetTrigger("playerAttack");
         } else if(transform.gameObject.tag == "Fightable") {
             hitter.SetTrigger("fightableAttack");
         }
     } else if(TattackRoll >= 21 - w.getCriticalRange()) {		//critical hit
         rollAttack();
         Debug.Log(e.getName()+" critical roll = "+TattackRoll);
         if(TattackRoll == 20 || TattackRoll+attackBonus(w) > AC) {
             Debug.Log(e.getName()+" lands a critical hit!");
             for(int i = 0; i < w.getCriticalRolls(); i++) {
                 rollDamage(w.getDamage(), w.getDamageRolls(), a);
             }
         }
         try {
             hitee = hit.transform.gameObject.GetComponent<Animator>();
             if(hit.transform.gameObject.tag == "Player") {
                 hitee.SetTrigger("playerHit");
             }
         } catch (Exception ex) {
             Debug.Log(ex);
         }
         if(transform.gameObject.tag == "Player") {
             hitter.SetTrigger("playerAttack");
         } else if(transform.gameObject.tag == "Fightable") {
             hitter.SetTrigger("fightableAttack");
         }
         rollDamage(w.getDamage(), w.getDamageRolls(), a);
     } else if(TattackRoll == 20 || TattackRoll+attackBonus(w) > AC) {	//hit
         try {
             hitee = hit.transform.gameObject.GetComponent<Animator>();
             if(hit.transform.gameObject.tag == "Player") {
                 hitee.SetTrigger("playerHit");
             }
         } catch (Exception ex) {
             Debug.Log(ex);
         }
         if(transform.gameObject.tag == "Player") {
             hitter.SetTrigger("playerAttack");
         } else if(transform.gameObject.tag == "Fightable") {
             hitter.SetTrigger("fightableAttack");
         }
         rollDamage(w.getDamage(), w.getDamageRolls(), a);
     } else {
         if(transform.gameObject.tag == "Player") {
             hitter.SetTrigger("playerAttack");
         } else if(transform.gameObject.tag == "Fightable") {
             hitter.SetTrigger("fightableAttack");
         }
     }
     if(w.getTwoAttackRolls()) {
         rollAttack();
         Debug.Log(e.getName()+" attack roll = "+TattackRoll);
         if(TattackRoll == 1) {
             Debug.Log(e.getName()+"'s attack critically misses :(");
             if(transform.gameObject.tag == "Player") {
                 hitter.SetTrigger("playerAttack");
             } else if(transform.gameObject.tag == "Fightable") {
                 hitter.SetTrigger("fightableAttack");
             }
         } else if(TattackRoll < 21 - w.getCriticalRange()) {
             rollAttack();
             Debug.Log(e.getName()+" critical roll = "+TattackRoll);
             if(TattackRoll == 20 || TattackRoll+attackBonus(w) > AC) {
                 Debug.Log(e.getName()+" lands a critical hit!");
                 if(w.getTwoCriticalRolls()) {
                     for(int i = 0; i < w.getSecondAttackCritical(); i++) {
                         rollDamage(w.getSecondAttackDamage(), w.getDamageRolls(), a);
                     }
                 } else {
                     for(int i = 0; i < w.getCriticalRolls(); i++) {
                         rollDamage(w.getSecondAttackDamage(), w.getDamageRolls(), a);
                     }
                 }
             }
             try {
                 hitee = hit.transform.gameObject.GetComponent<Animator>();
                 if(hit.transform.gameObject.tag == "Player") {
                     hitee.SetTrigger("playerHit");
                 }
             } catch (Exception ex) {
                 Debug.Log(ex);
             }
             if(transform.gameObject.tag == "Player") {
                 hitter.SetTrigger("playerAttack");
             } else if(transform.gameObject.tag == "Fightable") {
                 hitter.SetTrigger("fightableAttack");
             }
             rollDamage(w.getSecondAttackDamage(), w.getDamageRolls(), a);
         } else if(TattackRoll == 20 || TattackRoll+attackBonus(w) > AC) {
             try {
                 hitee = hit.transform.gameObject.GetComponent<Animator>();
//.........这里部分代码省略.........
开发者ID:TheAlchemistStudio,项目名称:DnD,代码行数:101,代码来源:Action.cs


注:本文中的Weapon.getSecondAttackCritical方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。