private void DoAccelerateQueue(int goldNum, int coldTime, int timing, int totalTime) { //获取加速后的所需的精力 int npcCount = new ShareCacheStruct <PlotNPCInfo>().FindAll(m => m.PlotID == plotID).Count; int battleNum = PlotHelper.GetBattleNum(coldTime); int turnsNum = PlotHelper.GetTurnsNum(npcCount, battleNum); int energyNum = turnsNum * PlotInfo.BattleEnergyNum; ContextUser.RemoveEnergyNum((short)energyNum); ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, goldNum, int.MaxValue); ContextUser.UserStatus = UserStatus.Normal; //ContextUser.Update(); int totalTurnsNum = PlotHelper.GetTurnsNum(npcCount, PlotHelper.GetBattleNum(totalTime)); int tempNum = PlotHelper.GetBattleNum(timing); int sweepCount = PlotHelper.GetTurnsNum(npcCount, tempNum); int timesNum = PlotHelper.GetTimesNum(npcCount, tempNum); sweepCount = sweepCount == 0 ? 1 : sweepCount; for (int i = sweepCount; i <= totalTurnsNum; i++) { int j = 1; if (i == sweepCount) { j = timesNum; } for (; j <= npcCount; j++) { //TrumpAbilityAttack.CombatTrumpLift(ContextUser.UserID); PlotHelper.DoPlotSweepPrize(ContextUser.UserID, plotID, i, j, npcCount); } } }
public override bool TakeAction() { List <PlotNPCInfo> plotNPCInfoList = new ConfigCacheSet <PlotNPCInfo>().FindAll(m => m.PlotID == plotID); npcCount = (short)plotNPCInfoList.Count; var cacheSet = new GameDataCacheSet <UserQueue>(); List <UserQueue> userQueueList = cacheSet.FindAll(ContextUser.UserID, m => m.QueueType == QueueType.SaoDang); if (userQueueList.Count > 0) { UserQueue userQueue = userQueueList[0]; coldTime = userQueue.DoRefresh(); if (coldTime == 0) { cacheSet.Delete(userQueue); ContextUser.ResetSweepPool(0); ContextUser.UserStatus = UserStatus.Normal; //ContextUser.Update(); } int tempNum = PlotHelper.GetBattleNum(userQueue.GetTiming()) + 1; if (npcCount > 0) { turnsNum = PlotHelper.GetTurnsNum(npcCount, tempNum); timesNum = PlotHelper.GetTimesNum(npcCount, tempNum); } //PlotHelper.CheckSweepCount(npcCount, userQueue.GetTiming(), out turnsNum, out battleNum); //if (battleNum >= npcCount) //{ // turnsNum = turnsNum + 1; //} //else //{ // battleNum = battleNum + 1; //} } userItemCount = (short)UserItemHelper.GetItems(Uid).FindAll(m => m.ItemStatus == ItemStatus.BeiBao).Count; plotInfo = new ConfigCacheSet <PlotInfo>().FindKey(plotID); if (plotInfo == null) { return(false); } foreach (PlotNPCInfo npcInfo in plotNPCInfoList) { if (npcInfo == null) { continue; } List <PlotEmbattleInfo> embattleInfoList = new ConfigCacheSet <PlotEmbattleInfo>().FindAll(m => m.PlotNpcID == npcInfo.PlotNpcID); foreach (PlotEmbattleInfo embattleInfo in embattleInfoList) { if (monsterDict.ContainsKey(embattleInfo.MonsterID)) { if (monsterNumDict.ContainsKey(embattleInfo.MonsterID)) { monsterNumDict[embattleInfo.MonsterID] = monsterNumDict[embattleInfo.MonsterID] + 1; } } else { MonsterInfo monsterInfo = new ConfigCacheSet <MonsterInfo>().FindKey(embattleInfo.MonsterID); if (monsterInfo != null) { monsterDict.Add(embattleInfo.MonsterID, monsterInfo); monsterNumDict.Add(embattleInfo.MonsterID, 1); } } } } return(true); }