Example #1
0
        // 技能能否释放默认实现... 每次战斗有X%概率...
        private bool canCastSkillOpDefault()
        {
            //检测释放为奥义伪造的技能,如果是则判定 奥义是否触发过
            BT_Logical     war      = owner._war;
            BT_MonsterTeam selfTeam = owner.ownerTeam;

            if (real == 1)
            {
                //如果不能释放,则直接跳过。如果可以释放,则再判定概率的问题
                bool can = war.canCastAoYi(this, selfTeam);
                if (can == false)
                {
                    return(can);
                }
            }

            //再次判定概率的问题
            bool probility   = false;
            int  possibility = 0;

            if (opObj.type == SkillOpData.Anger_Skill)
            {
                int curTeamAngry = selfTeam.curAngry;
                int needNuqi     = param.nuqi;
                if (needNuqi == 0)
                {
                    throw new DragonException("调用canCastSkillOpDefault时,不存在怒气配置. id:" + id);
                }
                probility = curTeamAngry >= needNuqi;
            }
            else if (opObj.type == SkillOpData.Death_Closed_Skill)
            {
                possibility = param.gailv;
                // 如果有概率的话,则考虑概率触发,否则一定触发
                if (possibility > 0)
                {
                    probility = BT_WarUtils.happen(possibility);
                }
                else
                {
                    // 默认触发
                    probility = owner._almostDie;
                }
            }
            else
            {
                possibility = param.gailv;
                if (possibility == 0)
                {
                    throw new DragonException("调用canCastSkillOpDefault时,不存在概率配置. id:" + id);
                }
                probility = BT_WarUtils.happen(possibility);
            }

            //如果概率Ok,则奥义默认释放
            if (probility)
            {
                if (real == 1)
                {
                    //设定奥义
                    war.setCastAoYi(this, selfTeam);
                }
            }

            return(probility);
        }