Example #1
0
        public IHttpActionResult Post([FromBody] Request <V_xy_sp_userspirit> request)
        {
            V_xy_sp_userspirit model = request.Data as V_xy_sp_userspirit;

            if (string.IsNullOrEmpty(model.UserSpiritID))
            {
                bll.Add(model);
            }
            else
            {
                bll.Edit(model);
            }

            return(Ok("ok"));
        }
Example #2
0
        /// <summary>
        /// 我方对怪物的伤害杀死的情况
        /// </summary>
        /// <param name="FighterFrom"></param>
        /// <param name="FighterTo"></param>
        private void updateEnemy(V_xy_sp_userspirit FighterFrom, V_xy_sp_spirit FighterTo, V_xy_sp_skill skill, ref string batmsg)
        {
            var LifeLeftValue = FighterTo.SpiritLife - skill.SkillGainValue;

            if (LifeLeftValue <= 0)//敌人已死亡
            {
                batmsg = "\"" + FighterFrom.SpiritName + "\"使用\"" + skill.SkillName + "\"杀死了\"" + FighterTo.SpiritName;
                //更新等级和经验
                xy_sp_userspiritBLL uspBll     = new xy_sp_userspiritBLL();
                decimal             Experience = FighterTo.SpiritExperience.Value;
                batmsg += " 获得" + Experience + "点经验 ";
                FighterFrom.SpiritExperience += Experience;
                //等级
                if (FighterFrom.SpiritExperience > LevelExperience(FighterFrom.SpiritLevel.Value))
                {
                    FighterFrom.SpiritLevel = FighterFrom.SpiritLevel + 1;
                    batmsg += System.Environment.NewLine + " 恭喜你升到" + FighterFrom.SpiritLevel + "级";
                    FighterFrom.SpiritExperience = FighterFrom.SpiritExperience - LevelExperience(FighterFrom.SpiritLevel.Value);
                }
                uspBll.Edit(FighterFrom);
                //我方获取敌方装备
                xy_sp_userspiritpackageBLL spBll = new xy_sp_userspiritpackageBLL();
                foreach (var item in FighterTo.spiritEquipmentList)
                {
                    V_xy_sp_userspiritpackage packageItem = new V_xy_sp_userspiritpackage();
                    packageItem.UserSpiritID = FighterFrom.UserSpiritID;
                    packageItem.EquipmentID  = item.EquipmentID;
                    spBll.Add(packageItem);
                    batmsg += System.Environment.NewLine + " 本次战斗意外获得:" + item.EquipmentName;
                }
            }
            else
            {
                batmsg = "\"" + FighterFrom.SpiritName + "\"使用\"" + skill.SkillName + "\"攻击\"" + FighterTo.SpiritName + "\"造成\"" + skill.SkillGainValue + "\"点物理伤害";
            }
            //更新怪物生命值
            FighterTo.SpiritLife = LifeLeftValue;
        }