Exemplo n.º 1
0
        public static bool RandomSelectSkill(CCreature m_creature, BtDatabase m_dataBase)
        {
            if (m_canUserSkillList == null)
            {
                m_canUserSkillList = new List <CSkillInfo>();
            }

            // 如果有技能没有被使用,就不进行新的随机
            int skillId = m_dataBase.GetData <int>((int)eAIParam.INT_SELECT_SKILL_INDEX);

            if (skillId != -1)
            {
                return(true);
            }

            m_creature.GetCanUseSkillList(ref m_canUserSkillList);

            if (m_canUserSkillList.Count == 0)
            {
                return(false);
            }


            int i;

            if (m_creature.m_aiType == eAIType.Client)
            {
                i = GameManager.Inst.GetRand(0, m_canUserSkillList.Count, 513);
            }
            else
            {
                i = GameManager.Inst.GetClientRand(0, m_canUserSkillList.Count);
            }
            int index = m_canUserSkillList[i].GetSkillIndex();

            m_dataBase.SetData <int>((int)eAIParam.INT_SELECT_SKILL_INDEX, index);
            return(true);
        }