Пример #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));
        }
Пример #2
0
            void Load()
            {
                mList = new List <NpcAbility>();

                Mono.Data.SqliteClient.SqliteDataReader reader = LocalDatabase.Instance.ReadFullTable("npcSkill");

                while (reader.Read())
                {
                    NpcAbility ability = new NpcAbility();
                    ability.id         = System.Convert.ToInt32(reader.GetString(reader.GetOrdinal("id")));
                    ability.icon       = reader.GetString(reader.GetOrdinal("icon"));
                    ability.desc       = System.Convert.ToInt32(reader.GetString(reader.GetOrdinal("desc")));
                    ability.skillId    = System.Convert.ToInt32(reader.GetString(reader.GetOrdinal("skill")));
                    ability.buffId     = System.Convert.ToInt32(reader.GetString(reader.GetOrdinal("buff")));
                    ability.itemBundle = ItemAsset.ItemProto.Bundle.Load(reader.GetString(reader.GetOrdinal("getItem")));
                    ability.level      = System.Convert.ToInt32(reader.GetString(reader.GetOrdinal("level")));
                    ability.type       = System.Convert.ToInt32(reader.GetString(reader.GetOrdinal("type")));
                    ability.learnTime  = System.Convert.ToInt32(reader.GetString(reader.GetOrdinal("time")));
                    string cond = reader.GetString(reader.GetOrdinal("cond"));
                    ability.Parse(cond);

                    string value = reader.GetString(reader.GetOrdinal("value"));
                    ability.Parse_value(value);

                    if (mList == null)
                    {
                        mList = new List <NpcAbility>();
                    }
                    mList.Add(ability);
                }
            }
Пример #3
0
        private static List <NpcAbility> CoverAblity(int abliyId)
        {
            List <NpcAbility> covers = new List <NpcAbility>();

            NpcAbility ablity = FindNpcAblityById(abliyId);

            if (ablity == null)
            {
                return(covers);
            }

            List <NpcAbility> all = GetAbilityByType(ablity.Type);

            if (all == null)
            {
                return(covers);
            }

            foreach (NpcAbility info in all)
            {
                if (ablity.level > info.level)
                {
                    covers.Add(info);
                }
            }
            return(covers);
        }
Пример #4
0
        private List <int> GetProtoIDs(int Id)
        {
            NpcAbility ablliy = FindNpcAblityById(Id);

            if (ablliy == null)
            {
                return(null);
            }

            return(ablliy.ProtoIds);
        }
Пример #5
0
        private float GetValueById(int Id)
        {
            NpcAbility ablliy = FindNpcAblityById(Id);

            if (ablliy == null)
            {
                return(0);
            }

            return(ablliy.Percent);
        }
Пример #6
0
        private static SkillLevel GetSkilllevel(int Id)
        {
            NpcAbility ablity = FindNpcAblityById(Id);

            if (ablity == null)
            {
                return(SkillLevel.none);
            }

            return(ablity.Level);
        }
Пример #7
0
        public static float GetLearnTime(int abilityid)
        {
            NpcAbility ablity = FindNpcAblityById(abilityid);

            if (ablity == null)
            {
                return(0.0f);
            }

            return(ablity.learnTime);
        }
Пример #8
0
        public bool ReflashBuffById(int Id, SkEntity target)
        {
            NpcAbility ablity = CanAddBuff(Id);

            if (ablity == null)
            {
                return(false);
            }

            if (_SkEnity == null)
            {
                return(false);
            }

            return(ablity.RefreshBuff(target));
        }
Пример #9
0
        public static Ablities CompareSkillType(List <int> _ablityIds)
        {
            Ablities ablityIds = new Ablities(_ablityIds.Count);

            ablityIds.AddRange(_ablityIds);

            if (ablityIds.Count <= 1)
            {
                return(ablityIds);
            }

            if (ablityIds.Count == 2)
            {
                int        Id0     = ablityIds[0];
                int        Id1     = ablityIds[1];
                NpcAbility ablity1 = FindNpcAblityById(Id0);
                if (ablity1 == null)
                {
                    Debug.LogError("Random Ability error. no Ability!!!" + "   " + Id0);
                    return(ablityIds);
                }
                NpcAbility ablity2 = FindNpcAblityById(Id1);
                if (ablity1 == null)
                {
                    Debug.LogError("Random Ability error. no Ability!!!" + "   " + Id1);
                    return(ablityIds);
                }

                if (ablity1.Type == ablity2.Type)
                {
                    if (ablity1.level - ablity2.level > 0)
                    {
                        ablityIds.Remove(Id1);
                    }
                    else
                    {
                        ablityIds.Remove(Id0);
                    }
                }
            }

            return(ablityIds);
        }
Пример #10
0
        //abliyLearn fun

        public int GetCanLearnId(int learnId)
        {
            NpcAbility ability = CanLearnAblity(learnId);

            return(ability != null ? ability.id : 0);
        }