Пример #1
0
 public PetFightDetail(FightBase fb)
 {
     m_fb = fb;
 }
Пример #2
0
        /// <summary>
        /// 得到攻击受害值
        /// </summary>
        /// <param name="root">攻击者</param>
        /// <param name="target">被攻击者</param>
        /// <returns></returns>
        public PetFightDetail FightObject(Pet root, Pet target)
        {
            m_root = root;
            m_target = target;

            FightBase fightBase = new FightBase();
            fightBase.ID = target.ID;
            fightBase.Name = target.Name;
            fightBase.PlayerID = target.PlayerID;
            fightBase.CurSkill = m_curskill;
            //判断是否命中
            if (m_injuryType == 0)
            {
                if (CheckMingZhong(m_root.Value, m_target.Value))
                {
                    if (CheckBaoJi(m_root.Value, m_target.Value))
                    {
                        //暴击
                        fightBase.FB = FightType.BaoJi;
                    }
                    else
                    {
                        //普通攻击
                        fightBase.FB = FightType.PuTong;
                    }
                    fightBase.HPcost = FightValue(fightBase.FB);
                    //最小1点受害
                    fightBase.HPcost = fightBase.HPcost >= 1 ? fightBase.HPcost : 1;
                }
                else
                {
                    //闪避成功
                    fightBase.FB = FightType.ShangBi;
                    fightBase.HPcost = 0;
                }
            }
            else
            {
                if (CheckBaoJi(m_root.Value, m_target.Value))
                {
                    //暴击
                    fightBase.FB = FightType.BaoJi;
                }
                else
                {
                    //普通攻击
                    fightBase.FB = FightType.PuTong;
                }
                fightBase.HPcost = FightValue(fightBase.FB);
                //最小1点受害
                fightBase.HPcost = fightBase.HPcost >= 1 ? fightBase.HPcost : 1;
            }

            Variant sm = m_target.Value.GetValueOrDefault<Variant>("ShengMing");
            int m = sm.GetIntOrDefault("V");

            if (fightBase.HPcost >= m)
            {
                sm["V"] = 0;

                //计算相关战绩值
                GetFightValue();
                //宠物被打挂
                Variant tmp = new Variant();
                tmp.Add("ID", target.ID);
                tmp.Add("Level", target.Value.GetIntOrDefault("PetsLevel"));
                root.FightDeath.Add(tmp);

                PetDetail model = new PetDetail(root, "", 2);
                m_model.CallAll(ArenaCommand.ArenaPetOverR, model);
            }
            else
            {
                sm["V"] = m - fightBase.HPcost;
            }
            fightBase.ShengMing = sm;
            fightBase.MoFa = m_target.Value.GetValueOrDefault<Variant>("MoFa");
            return new PetFightDetail(fightBase);
        }