Exemplo n.º 1
0
        private NpcAbility CanLearnAblity(int learnId)
        {
            NpcAbility learn_ablity = FindNpcAblityById(learnId);

            if (learn_ablity == null || learn_ablity.Type == AblityType.Max)
            {
                return(null);
            }

            if (Cur_ContainsType(learn_ablity.Type))
            {
                AblityInfo info = Cur_GetAblityInfoByType(learn_ablity.Type);
                if (info._level >= 4)
                {
                    return(null);
                }

                if (learn_ablity.level == info._level)
                {
                    return(null);
                }

                if (learn_ablity.level > info._level)
                {
                    return(FindNpcAblity(learn_ablity.Type, info._level + 1));
                }
            }
            return(FindNpcAblity(learn_ablity.Type, 1));
        }
Exemplo n.º 2
0
 private void  GetAblityInfos()
 {
     AblityInfos.Clear();
     foreach (NpcAbility Ablity in m_curNpcAblitys)
     {
         if (Ablity == null)
         {
             return;
         }
         if (Ablity.IsTalent())
         {
             AblityInfo info = new AblityInfo();
             Ablity.CalculateCondtion();
             info._Percent          = GetValueById(Ablity.id);
             info._ProtoIds         = GetProtoIDs(Ablity.id);
             info.IsTalent          = true;
             info._type             = Ablity.Type;
             info._Correctrate      = Ablity.Correctrate;
             info.DecsId            = Ablity.desc;
             info._icon             = Ablity.icon;
             info._level            = Ablity.level;
             AblityInfos[Ablity.id] = info;
         }
         else if (Ablity.Isskill())
         {
             AblityInfo info = new AblityInfo();
             info.IsSkill = true;
             Ablity.CalculateCondtion();
             info.SkillId           = Ablity.skillId;
             info._Skill_R          = Ablity.SkillRange;
             info._Percent          = Ablity.SkillPerCent;
             info._type             = Ablity.Type;
             info.DecsId            = Ablity.desc;
             info._icon             = Ablity.icon;
             info._level            = Ablity.level;
             AblityInfos[Ablity.id] = info;
         }
         else if (Ablity.IsBuff())
         {
             AblityInfo info = new AblityInfo();
             info.IsBuff            = true;
             info.BuffId            = Ablity.buffId;
             info._type             = Ablity.Type;
             info.DecsId            = Ablity.desc;
             info._icon             = Ablity.icon;
             info._level            = Ablity.level;
             AblityInfos[Ablity.id] = info;
         }
         if (Ablity.IsGetItem())
         {
             AblityInfo info = new AblityInfo();
             info.IsGetItem         = true;
             info._Items            = Ablity.GetItem(1.0f);
             info._type             = Ablity.Type;
             info.DecsId            = Ablity.desc;
             info._level            = Ablity.level;
             AblityInfos[Ablity.id] = info;
         }
     }
     return;
 }