/// <summary>
 /// 获取攻击单位
 /// </summary>
 /// <param name="position">攻击方的位置</param>
 /// <param name="attackType">攻击方式</param>
 /// <param name="attackTaget">攻击目标</param>
 /// <param name="targetEmbattle"></param>
 private static CombatGeneral[] GetTargetUnit(int position, AttackUnit attackType, AttackTaget attackTaget, EmbattleQueue targetEmbattle)
 {
     IGeneral[] generalList = new IGeneral[0];
     List<CombatGeneral> targetGeneralList = new List<CombatGeneral>();
     switch (attackType)
     {
         case AttackUnit.Single:
             CombatGeneral cg = null;
             if (attackTaget == AttackTaget.Self)
             {
                 cg = (CombatGeneral)targetEmbattle.GetGeneral(position);
             }
             else
             {
                 cg = (CombatGeneral)targetEmbattle.FindGeneral(position);
             }
             if (cg != null)
             {
                 generalList = new IGeneral[] { cg };
             }
             break;
         case AttackUnit.Horizontal:
             generalList = targetEmbattle.FindHorizontal(position);
             break;
         case AttackUnit.Vertical:
             generalList = targetEmbattle.FindVertical(position);
             break;
         case AttackUnit.All:
             generalList = targetEmbattle.FindAll();
             break;
         default:
             break;
     }
     foreach (IGeneral general in generalList)
     {
         targetGeneralList.Add((CombatGeneral)general);
     }
     return targetGeneralList.ToArray();
 }
Exemple #2
0
 public void SetDefend(EmbattleQueue combatGrid)
 {
     combatGrid.Role = EmbattleRole.RoleD;
     priorityList.Add(combatGrid);
     SetEmbattle(combatGrid, processContainer.DefenseList);
 }
Exemple #3
0
 private void SetEmbattle(EmbattleQueue combatGrid, CacheList<CombatEmbattle> list)
 {
     IGeneral[] generalList = combatGrid.FindAll(true);
     foreach (IGeneral general in generalList)
     {
         if (general != null && general is CombatGeneral)
         {
             CombatGeneral cgeneral = (CombatGeneral)general;
             list.Add(new CombatEmbattle
             {
                 UserID = cgeneral.UserID,
                 GeneralID = cgeneral.GeneralID,
                 GeneralName = cgeneral.GeneralName,
                 GeneralLv = cgeneral.Lv,
                 HeadID = cgeneral.HeadID,
                 AbilityID = cgeneral.TempAbility == null ? 0 : cgeneral.TempAbility.AbilityID,
                 LiveNum = cgeneral.LifeNum,
                 LiveMaxNum = cgeneral.LifeMaxNum,
                 MomentumNum = cgeneral.Momentum,
                 MaxMomentumNum = CombatGeneral.MomentumOut,
                 Position = cgeneral.Position,
                 IsWait = cgeneral.IsWait,
                 BattleHead =  cgeneral.BattleHeadID
             });
         }
     }
     if (list.Count == 0)
     {
         new BaseLog().SaveDebugLog("战斗异常,未能加载佣兵数据");
     }
 }
Exemple #4
0
 public void SetAttack(EmbattleQueue combatGrid)
 {
     combatGrid.Role = EmbattleRole.RoleA;
     priorityList.Add(combatGrid);
     SetEmbattle(combatGrid, processContainer.AttackList);
 }