Beispiel #1
0
        /// <summary>
        /// 获得修炼所需经验
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public int getFinishedExpForItem(Jyx2Item item)
        {
            if (item == null || item.ItemType != 2 || item.NeedExp < 0)
            {
                return(GameConst.MAX_EXP);
            }
            int multiple = 7 - this.IQ / 15;

            if (multiple <= 0)
            {
                multiple = 1;
            }

            //有关联武学的,如已满级则不可修炼
            if (item.Wugong > 0)
            {
                int magic_level_index = GetWugongLevel(item.Wugong);
                if (magic_level_index == GameConst.MAX_SKILL_LEVEL)
                {
                    return(GameConst.MAX_EXP);
                }
                //初次修炼和从1级升到2级的是一样的
                if (magic_level_index > 0)
                {
                    multiple *= magic_level_index;
                }
            }
            return(item.NeedExp * multiple);
        }
Beispiel #2
0
        /// <summary>
        /// 卸下物品(装备,修炼)
        /// </summary>
        /// <param name="item"></param>
        public void UnequipItem(Jyx2Item item)
        {
            if (item == null)
            {
                return;
            }

            this.Tili       -= item.AddTili;
            this.Hp         -= item.AddHp;
            this.MaxHp      -= item.AddMaxHp;
            this.Mp         -= item.AddMp;
            this.MaxMp      -= item.AddMaxMp;
            this.Poison     -= item.ChangePoisonLevel;
            this.Heal       -= item.Heal;
            this.DePoison   -= item.DePoison;
            this.AntiPoison -= item.AntiPoison;
            this.UsePoison  -= item.UsePoison;

            this.Attack   -= item.Attack;
            this.Defence  -= item.Defence;
            this.Qinggong -= item.Qinggong;

            this.Quanzhang -= item.Quanzhang;
            this.Yujian    -= item.Yujian;
            this.Shuadao   -= item.Shuadao;
            this.Qimen     -= item.Qimen;

            this.Pinde        -= item.AddPinde;
            this.AttackPoison -= item.AttackPoison;
            if (item.ChangeMPType == 2)
            {
                this.MpType = 2;
            }
            if (item.AttackFreq == 1)
            {
                this.Zuoyouhubo = 1;
            }

            int need_item_exp = getFinishedExpForItem(item);

            if (this.ExpForItem >= need_item_exp)
            {
                this.LearnMagic(item.Wugong);
                this.ExpForItem -= need_item_exp;
            }

            this.Limit();
        }
Beispiel #3
0
        public Jyx2Skill GetSkill(Jyx2Item _anqi = null)
        {
            if (_skill == null)
            {
                _skill = ConfigTable.Get <Jyx2Skill>(Key);

                //暗器
                if (_anqi != null)
                {
                    _skill.Animation = _anqi.AnqiAnimation;
                    _skill.Poison    = _anqi.ChangePoisonLevel;
                    foreach (Jyx2SkillLevel sl in _skill.SkillLevels)
                    {
                        sl.Attack = Mathf.Abs(_anqi.AddHp);
                    }
                }
            }
            return(_skill);
        }
Beispiel #4
0
 public WugongInstance(Jyx2Item item)
 {
     Key   = 0;
     Level = 0;
     GetSkill(item);
 }
Beispiel #5
0
 public AnqiZhaoshiInstance(int lv, Jyx2Item item)
 {
     _level = lv;
     Anqi   = item;
     Data   = new WugongInstance(item);
 }
Beispiel #6
0
        /// <summary>
        /// 判断角色是否可以使用道具
        ///
        /// 对应kyscpp:bool GameUtil::canUseItem(Role* r, Item* i)
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public bool CanUseItem(Jyx2Item item)
        {
            if (item == null)
            {
                return(false);
            }

            //剧情类无人可以使用
            if (item.ItemType == 0)
            {
                return(false);
            }

            else if (item.ItemType == 1 || item.ItemType == 2)
            {
                if (item.ItemType == 2)
                {
                    //内力属性判断
                    if ((this.MpType == 0 || this.MpType == 1) && (item.NeedMPType == 0 || item.NeedMPType == 1))
                    {
                        if (this.MpType != item.NeedMPType)
                        {
                            return(false);
                        }
                    }
                    //有仅适合人物,直接判断
                    if (item.OnlySuitableRole >= 0)
                    {
                        return(item.OnlySuitableRole == int.Parse(this.Key));
                    }
                }

                //若有相关武学,满级则为假,未满级为真
                //若已经学满武学,则为假
                //此处注意,如果有可制成物品的秘籍,则武学满级之后不会再制药了,请尽量避免这样的设置
                if (item.Wugong > 0)
                {
                    int level = GetWugongLevel(item.Wugong);
                    //if (level >= 0 && level < GameConst.MAX_WUGONG_LEVEL)
                    //{
                    //    return true;
                    //}
                    if (level < 0 && this.Wugongs.Count >= GameConst.MAX_ROLE_WUGONG_COUNT)
                    {
                        return(false);
                    }
                    if (level == GameConst.MAX_WUGONG_LEVEL)
                    {
                        return(false);
                    }
                }

                //上面的判断未确定则进入下面的判断链
                return(testAttr(this.Attack, item.ConditionAttack) &&
                       testAttr(this.Qinggong, item.ConditionQinggong) &&
                       testAttr(this.Heal, item.ConditionHeal) &&
                       testAttr(this.UsePoison, item.ConditionPoison) &&
                       testAttr(this.DePoison, item.ConditionDePoison) &&
                       testAttr(this.Quanzhang, item.ConditionQuanzhang) &&
                       testAttr(this.Yujian, item.ConditionYujian) &&
                       testAttr(this.Shuadao, item.ConditionShuadao) &&
                       testAttr(this.Qimen, item.ConditionQimen) &&
                       testAttr(this.Anqi, item.ConditionAnqi) &&
                       testAttr(this.Mp, item.ConditionMp) &&
                       testAttr(this.IQ, item.ConditionIQ));
            }
            else if (item.ItemType == 3)
            {
                //药品类所有人可以使用
                return(true);
            }
            else if (item.ItemType == 4)
            {
                //暗器类不可以使用
                return(false);
            }
            return(false);
        }