コード例 #1
0
        /// <summary> 组装出招Vo </summary>
        /// <param name="roleid"></param>
        /// <param name="hitids"></param>
        private MovesVo BuildMovesVo(Int64 roleid, List <double> hitids)
        {
            var move = new MovesVo
            {
                attackId = roleid,
                hitIds   = hitids,
                rolesA   = ConvertRoleFightVo(GetRoles(true, true)),
                rolesB   = ConvertRoleFightVo(GetRoles(false, true)),
                times    = Round
            };

            if (!FirstRoles.Any())
            {
                move.yinA = 0;
            }
            else
            {
                var dic = FirstRoles.First();
                move.yinA = AllRoles.ContainsKey(dic.Value) ? YinCount[AllRoles[dic.Value].user_id] : 0;
            }
            if (!AfterRoles.Any())
            {
                move.yinB = 0;
            }
            else
            {
                var dic = AfterRoles.First();
                move.yinB = AllRoles.ContainsKey(dic.Value) ? YinCount[AllRoles[dic.Value].user_id] : 0;
            }
            return(move);
        }
コード例 #2
0
 /// <summary> 组装movesvo </summary>
 /// <param name="movesvo">movesvo</param>
 /// <param name="type">技能类型 秘技 奥义 印</param>
 private void BuildMovesVo(MovesVo movesvo, int type)
 {
     BuildMovesvoRole(movesvo);
     BuildSkillType(movesvo, type);
     GetYinCount(movesvo);
     list_move.Add(movesvo);
     UpdateBuff(); //将上次出手武将新Buff改为旧Buff
 }
コード例 #3
0
 /// <summary>获取双方当前印数</summary>
 public void GetYinCount(MovesVo movesvo)
 {
     if (!dic_yincount.ContainsKey(attack_matrix.user_id) || !dic_yincount.ContainsKey(defense_matrix.user_id))
     {
         AddYinCount(attack_matrix.user_id);
     }
     movesvo.yinA = dic_yincount[attack_matrix.user_id];
     movesvo.yinB = dic_yincount[defense_matrix.user_id];
 }
コード例 #4
0
        /// <summary> 初始化回合 </summary>
        private void InitRound()
        {
            foreach (var item in list_role)
            {
                dic_round.Add(item.id, 0);
            }

            var movesvo = new MovesVo();

            BuildMovesvoRole(movesvo);
            list_move.Add(movesvo);
        }
コード例 #5
0
        /// <summary> 组装触发的技能类型 如:奥义、秘技、印 </summary>
        /// <param name="movesvo">出招Vo</param>
        /// <param name="type">类型</param>
        private void BuildSkillType(MovesVo movesvo, int type)
        {
            switch (type)
            {
            case (int)SkillType.MYSTERY: { movesvo.isMystery = true; break; }

            case (int)SkillType.CHEATCODE: { movesvo.isSkill = true; break; }

            case (int)SkillType.YIN: { movesvo.isYin = true; break; }

            default: { break; }
            }
        }
コード例 #6
0
 /// <summary>初始化</summary>
 private void Init()
 {
     WIN               = 0;
     Round             = 0;
     IsAttack          = true;
     attack_number     = 0;
     defense_number    = 0;
     vo                = new FightVo();
     move              = new MovesVo();
     list_move         = new List <MovesVo>();
     list_skill        = new List <SkillVo>();
     list_role         = new List <FightRole>();
     attack_matrix     = new FightPersonal();
     list_role_hp      = new List <FightRole>();
     defense_matrix    = new FightPersonal();
     list_buff         = new List <FightRoleBuff>();
     list_attack_role  = new List <FightRole>();
     list_defense_role = new List <FightRole>();
     dic_round         = new Dictionary <decimal, int>();
     dic_yincount      = new Dictionary <decimal, int>();
     dic_vocation      = new Dictionary <decimal, double>();
 }
コード例 #7
0
        /// <summary>组装出招数据 </summary>
        /// <param name="flag">true:先手</param>
        /// <returns>是否完全组装完成</returns>
        private bool BuildMove(bool flag)
        {
            IsAttack  = flag;
            move      = new MovesVo();
            list_move = new List <MovesVo>();

            var attackrole = GetShotRole();                                               //最先出手未死的战斗武将

            if (attackrole == null)
            {
                WIN = IsAttack ? 1 : 0; return(false);
            }

            var matrix = GetMatrix(true);

            move.attackId = Convert.ToDouble(attackrole.id);                              //攻击武将Id
            if (!RoundCount(attackrole, move))                                            //出手方回合计数 +1
            {
                return(true);
            }

#if DEBUG
            XTrace.WriteLine("{0}  {1} - {2}  {3} - {4}  ---- {5} ----", "BuildMove", "当前出手武将", attackrole.id, "当前出手用户", attackrole.user_id, "一次出手");
#endif

            AddYinCount(matrix.user_id);                                                  //出手方印数+1
            GetYinCount(move);                                                            //双方印数
            if (!Shot(attackrole))                                                        //武将出手
            {
                return(false);
            }
            RolePositionChange(matrix, attackrole.id);                                    //改变该武将位置
            vo.moves.Add(list_move);                                                      //出手记录
            UpdateRolePosition();

            return(true);
        }
コード例 #8
0
        /// <summary> 回合计数 </summary>
        public bool RoundCount(FightRole role, MovesVo movesvo)
        {
            if (!dic_round.ContainsKey(role.id))
            {
                InitRound();                                 //InitRound方法只会在第一次出手时有效
            }
            //UpdateBuff();//将上次出手武将新Buff改为旧Buff 预防不是当前回合出手

            var values = dic_round[role.id] + 1;

            if (values <= Round)
            {
                dic_round[role.id] = values;
            }
            else
            {
                if (!IsAttack)
                {
                    return(false);
                }
                UpdateRound();
                if (dic_round.ContainsValue(Round - 1))
                {
                    return(false);
                }
#if DEBUG
                XTrace.WriteLine("{0}", "回合结束");
                XTrace.WriteLine(string.Format("{0}  {1}", "开始回合数", values));
#endif

                dic_round[role.id] = values;
                RemoveBuff(true);
            }
            movesvo.times = Round = values;
            return(true);
        }
コード例 #9
0
 /// <summary>组装MovesVo中的双方武将</summary>
 /// <param name="movesvo">要组装的MovesVo</param>
 private void BuildMovesvoRole(MovesVo movesvo)
 {
     movesvo.rolesA = ConvertRoleFightVoList(list_attack_role);
     movesvo.rolesB = ConvertRoleFightVoList(list_defense_role);
 }