From 726517b2002ec6dd46e07f89c10fdfe0274243af Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期四, 04 九月 2025 19:47:26 +0800 Subject: [PATCH] 129 【战斗】战斗系统-服务端(修复buff报错;) --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_MainLevel.py | 74 ++++++++++++++++++++++++++++++++++--- 1 files changed, 68 insertions(+), 6 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_MainLevel.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_MainLevel.py index 6cb2c29..cef5c8b 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_MainLevel.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_MainLevel.py @@ -17,6 +17,7 @@ import ChConfig import GameWorld +import TurnAttack import ShareDefine import IpyGameDataPY import PlayerControl @@ -25,6 +26,7 @@ import IPY_GameWorld import NetPackCommon import ItemCommon +import PlayerTask import NPCCommon import ChEquip import ObjPool @@ -91,7 +93,8 @@ def __doMainDrop(curPlayer): # 装备掉落 - __doDropEquip(curPlayer) + if __doDropEquip(curPlayer) == -1: + return playerID = curPlayer.GetPlayerID() DailyBootyUpperList = [] @@ -102,10 +105,16 @@ GameWorld.DebugLog("可掉落战利品上限: chapterID=%s, %s" % (chapterID, DailyBootyUpperList), playerID) + # 战利品掉落默认不堆叠,故最多只能掉落剩余空格子个数的物品 + spaceCount = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptIdentify) + # 其他战利品掉落 bootyDropNeedDict = IpyGameDataPY.GetFuncEvalCfg("MainBootyDrop", 1, {}) bootyDropCntDict = IpyGameDataPY.GetFuncEvalCfg("MainBootyDrop", 2, {}) for itemID, dropUpper in DailyBootyUpperList: + if spaceCount <= 0: + GameWorld.DebugLog("掉落背包已满!", playerID) + break if dropUpper <= 0: continue todyDropCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BootyDropToday % itemID) @@ -137,7 +146,8 @@ if dropCntTotal <= 0: continue - GameWorld.DebugLog("掉落战利品! itemID=%s,unXiantaoCntBooty=%s,次数=%s,dropCntTotal=%s" % (itemID, unXiantaoCntBooty, dropBootyCnt, dropCntTotal), playerID) + GameWorld.DebugLog("掉落战利品! itemID=%s,unXiantaoCntBooty=%s,次数=%s,dropCntTotal=%s,spaceCount=%s" + % (itemID, unXiantaoCntBooty, dropBootyCnt, dropCntTotal, spaceCount), playerID) curItem = ItemControler.GetOutPutItemObj(itemID, dropCntTotal, False, curPlayer=curPlayer) if curItem == None: continue @@ -147,23 +157,24 @@ unXiantaoCntBooty = unXiantaoCntBooty % dropOneNeed PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_UnXiantaoCntBooty % itemID, unXiantaoCntBooty) SetBootyDropToday(curPlayer, itemID, todyDropCnt + dropCntTotal) + spaceCount -= 1 return def __doDropEquip(curPlayer): ## 主线掉落装备 + playerID = curPlayer.GetPlayerID() unXiantaoCntEquip = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_UnXiantaoCntEquip) dropOneNeed = IpyGameDataPY.GetFuncCfg("MainEquipDrop", 1) # 每消耗X个战锤掉落一件装备 dropEquipCnt = unXiantaoCntEquip / dropOneNeed if dropEquipCnt <= 0: - GameWorld.DebugLog("主线暂不能掉落! unXiantaoCntEquip=%s,dropOneNeed=%s,dropEquipCnt=%s" % (unXiantaoCntEquip, dropOneNeed, dropEquipCnt)) + GameWorld.DebugLog("主线暂不能掉落! unXiantaoCntEquip=%s,dropOneNeed=%s,dropEquipCnt=%s" % (unXiantaoCntEquip, dropOneNeed, dropEquipCnt), playerID) return dropEquipCnt = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptIdentify, dropEquipCnt) if not dropEquipCnt: - GameWorld.DebugLog("掉落鉴定背包没有空间!") - return + GameWorld.DebugLog("掉落背包已满!", playerID) + return -1 - playerID = curPlayer.GetPlayerID() treeLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreeLV) ipyData = IpyGameDataPY.GetIpyGameData("TreeLV", treeLV) if not ipyData: @@ -251,6 +262,7 @@ else: __doPickupMainItem(curPlayer, itemIndexList) + ItemCommon.SyncMakeItemAnswer(curPlayer, ShareDefine.Def_mitMainDropItemOP, ChConfig.Def_ComposeState_Sucess, opType) return def __doEquipMainEquip(curPlayer, itemIndexList, isAutoDecompose): @@ -297,6 +309,8 @@ # 刷属性 ChEquip.RefreshRoleEquipAttr(curPlayer) + + PlayerTask.UpdTaskValue(curPlayer, ChConfig.TaskType_EquipColor) return def __doDecomposeMainEquip(curPlayer, itemIndexList): @@ -310,6 +324,7 @@ moneyTotal = 0 + decomposeCnt = 0 decomposeIndexList = [] for itemIndex in itemIndexList: if itemIndex < 0 or itemIndex >= IdentifyPack.GetCount(): @@ -340,11 +355,13 @@ ItemCommon.DelItem(curPlayer, curEquip, curEquip.GetCount(), True, ChConfig.ItemDel_EquipDecompose) decomposeIndexList.append(itemIndex) + decomposeCnt += 1 if not moneyTotal: return PlayerControl.GiveMoney(curPlayer, moneyType, moneyTotal, "DecomposeMainEquip", isSysHint=False) + PlayerTask.AddTaskValue(curPlayer, ChConfig.TaskType_EquipDecompose, decomposeCnt) return def __doPickupMainItem(curPlayer, itemIndexList): @@ -392,3 +409,48 @@ clientPack.Count = len(clientPack.DropBootyList) NetPackCommon.SendFakePack(curPlayer, clientPack) return + +def OnTurnFightOver(curPlayer, turnFight, mapID, funcLineID, overMsg): + ## 回合战斗结束 + + if not curPlayer: + return + + #winFaction = turnFight.winFaction + isWin = turnFight.isWin + + playerID = curPlayer.GetPlayerID() + mainFightMgr = TurnAttack.GetMainFightMgr(curPlayer) + chapterID, levelNum, wave = PlayerControl.GetMainLevelNowInfo(curPlayer) + + if not isWin: + nextWave = max(1, wave - 1) + nowValue = PlayerControl.SetMainLevelNowInfo(curPlayer, chapterID, levelNum, nextWave) + GameWorld.DebugLog("主线小怪战斗失败,降一波! chapterID=%s,levelNum=%s,wave=%s,nextWave=%s,nowValue=%s" + % (chapterID, levelNum, wave, nextWave, nowValue), playerID) + return + + if turnFight.haveNextLineup(): + GameWorld.DebugLog("主线小怪战斗胜利,有下一小队! chapterID=%s,levelNum=%s,wave=%s" % (chapterID, levelNum, wave), playerID) + return + + # 获胜过波 + if wave < mainFightMgr.waveMax: + nextWave = min(mainFightMgr.waveMax, wave + 1) + nowValue = PlayerControl.SetMainLevelNowInfo(curPlayer, chapterID, levelNum, nextWave) + GameWorld.DebugLog("主线小怪波战斗胜利,下一波! chapterID=%s,levelNum=%s,wave=%s,nextWave=%s,nowValue=%s" + % (chapterID, levelNum, wave, nextWave, nowValue), playerID) + else: + GameWorld.DebugLog("主线小怪波战斗胜利,最后一波循环刷! chapterID=%s,levelNum=%s,wave=%s" % (chapterID, levelNum, wave), playerID) + + # 小怪可能会退波,所以只在有超过已过关卡进度时才更新值 + hisPassValue = PlayerControl.GetMainLevelPassValue(curPlayer) + curPassValue = PlayerControl.ComMainLevelValue(chapterID, levelNum, wave) + if curPassValue > hisPassValue: + GameWorld.DebugLog("更新当前过关进度! curPassValue=%s,hisPassValue=%s" % (curPassValue, hisPassValue), playerID) + PlayerControl.SetMainLevelPassValue(curPlayer, curPassValue) + else: + GameWorld.DebugLog("未超过当前过关进度,不更新! curPassValue=%s <= hisPassValue=%s" % (curPassValue, hisPassValue), playerID) + + return + -- Gitblit v1.8.0