/// <summary> /// 被动魂技效果 /// </summary> /// <param name="userId"></param> /// <returns></returns> public static List <SelfAbilityEffect> GetSelfAbilityEffectList(string userId, short role) { List <SelfAbilityEffect> selfAbilityEffectList = new List <SelfAbilityEffect>(); var cacheSetUserAbility = new PersonalCacheStruct <UserAbility>(); var cacheSetUserEmbattle = new PersonalCacheStruct <UserEmbattle>(); var cacheSetAbilityInfo = new ShareCacheStruct <AbilityInfo>(); var userAbility = cacheSetUserAbility.FindKey(userId); var userMagic = new PersonalCacheStruct <UserMagic>().Find(userId, s => s.IsEnabled); if (userAbility != null && userAbility.AbilityList != null) { var userEmbattleList = cacheSetUserEmbattle.FindAll(userId, s => s.MagicID == userMagic.MagicID); userEmbattleList.ForEach(obj => { if (obj.GeneralID > 0) { var abilityList = userAbility.AbilityList.FindAll(s => s.GeneralID == obj.GeneralID); abilityList.ForEach(ability => { var abilityInfo = cacheSetAbilityInfo.FindKey(ability.AbilityID); if (abilityInfo != null && abilityInfo.IsActive == 1) { SelfAbilityEffect selfAbilityEffect = new SelfAbilityEffect(); selfAbilityEffect.GeneralID = obj.GeneralID; selfAbilityEffect.EffectID1 = abilityInfo.EffectID1; selfAbilityEffect.FntHeadID = abilityInfo.FntHeadID; selfAbilityEffect.IsIncrease = abilityInfo.IsIncrease; selfAbilityEffect.Position = obj.Position; selfAbilityEffect.Role = role; selfAbilityEffectList.Add(selfAbilityEffect); } }); } }); } return(selfAbilityEffectList); }
public bool Doing() { List <EmbattleQueue> queueList = GetPriorityQueue(); if (queueList.Count != 2) { return(false); } EmbattleQueue roleA = queueList[0]; EmbattleQueue roleD = queueList[1]; //原因:空阵BUG if (roleA.GeneralCount == 0 && roleD.GeneralCount == 0) { new BaseLog().SaveLog("战斗双方佣兵不存在"); return(false); } if (roleA.Role == EmbattleRole.RoleA) { if (roleA.GeneralCount > 0 && roleD.GeneralCount == 0) { return(true); } if (roleA.GeneralCount == 0 && roleD.GeneralCount > 0) { return(false); } } else if (roleA.Role == EmbattleRole.RoleD) { if (roleA.GeneralCount > 0 && roleD.GeneralCount == 0) { return(false); } if (roleA.GeneralCount == 0 && roleD.GeneralCount > 0) { return(true); } } queueList.ForEach(item => { var general = (CombatGeneral)item.NextGeneral(); if (general != null) { general.SelfAbilityInfoList.ForEach(SelfAbility => { SelfAbilityEffect selfAbilityEffect = new SelfAbilityEffect(); selfAbilityEffect.GeneralID = general.GeneralID; selfAbilityEffect.EffectID1 = SelfAbility.EffectID1; selfAbilityEffect.FntHeadID = SelfAbility.FntHeadID; selfAbilityEffect.IsIncrease = SelfAbility.IsIncrease; selfAbilityEffect.Position = general.Position; selfAbilityEffect.Role = item.Role.ToShort(); processContainer.SelfAbilityEffectList.Add(selfAbilityEffect); }); } }); //原因:闪避高时死锁 bool isCombatOut = false; int index = 0; while (roleA.HasCombat() && roleD.HasCombat()) { if (index >= MaxCount) { isCombatOut = true; //防止死锁 new BaseLog().SaveLog(string.Format("[{0}]战斗超出最大回合数,判攻方输", _combatType)); break; } //设置重新一轮 roleA.ResetGeneralQueue(); roleD.ResetGeneralQueue(); DoSingle(queueList); index++; } foreach (var item in priorityList) { if (item.Number > BoutNum) { BoutNum = item.Number; } //恢复血量 double resumeLife = ConfigEnvSet.GetDouble("Combat.ResumeLifeNum"); //领土战直接恢复100% if (_combatType == CombatType.Country && item.IsOver) { resumeLife = 1; } if ((_combatType == CombatType.Country && item.IsOver) || (_combatType != CombatType.Country && item.IsOver)) { if (item.Role == EmbattleRole.RoleA) { DoResumeLife(processContainer.AttackList, resumeLife); } else { DoResumeLife(processContainer.DefenseList, resumeLife); } } } ; //超出判断攻方输 if (isCombatOut && roleA.Role == EmbattleRole.RoleA) { return(false); } if (isCombatOut && roleA.Role == EmbattleRole.RoleD) { return(true); } return(!priorityList.Find(m => m.Role == EmbattleRole.RoleA).IsOver); }