Beispiel #1
0
        //学习武学逻辑,对应kyscpp int Role::learnMagic(int magic_id)
        public int LearnMagic(int magicId)
        {
            if (magicId <= 0)
            {
                return(-1);
            }

            foreach (var skill in Wugongs)
            {
                if (skill.Key == magicId)
                {
                    if (skill.GetLevel() < Jyx2Consts.MAX_SKILL_LEVEL)
                    {
                        skill.Level += 100;
                        return(0);
                    }
                    else
                    {
                        return(-2); //已经满级
                    }
                }
            }

            if (Wugongs.Count >= Jyx2Consts.MAX_SKILL_COUNT)
            {
                return(-3); //武学已满
            }
            WugongInstance w = new WugongInstance(magicId);

            Wugongs.Add(w);
            ResetZhaoshis();
            return(0);
        }
Beispiel #2
0
        public void BindKey()
        {
            //for jyx2,自动适配为小虾米
            if (Key == "主角")
            {
                Key = "0";
            }
            _data = ConfigTable.Get <Jyx2Role>(Key);

            if (_data == null)
            {
                Key   = "10000"; //自动设置为空人物
                _data = new Jyx2Role()
                {
                    Id = "10000"
                };
                _data.Wugongs = new List <Jyx2RoleWugong>();
                _data.Items   = new List <Jyx2RoleItem>();
            }


            //初始化武功列表
            Wugongs.Clear();
            foreach (var wugong in _data.Wugongs)
            {
                if (wugong.Id == 0)
                {
                    continue;
                }
                Wugongs.Add(new WugongInstance(wugong));
            }

            //没有设置武功,默认增加一个普通攻击
            if (Wugongs.Count == 0 && _data.Wugongs != null && _data.Wugongs.Count > 0)
            {
                Wugongs.Add(new WugongInstance(_data.Wugongs[0]));
            }

            //每次战斗前reset一次
            ResetForBattle();
        }