165 【挑战】天子的考验-服务端(优化生命条变更时B419同步最新当前生命最大生命;)
| | |
| | |
|
| | | # 玩家
|
| | | if tagType == 1:
|
| | | OnTurnFightVSPlayer(curPlayer, mapID, funcLineID, atkLineupID, defLineupID, tagID)
|
| | | if not OnTurnFightVSPlayer(curPlayer, mapID, funcLineID, atkLineupID, defLineupID, tagID):
|
| | | return
|
| | |
|
| | | # NPC
|
| | | else:
|
| | |
| | | if not ret:
|
| | | return
|
| | | npcLineupIDList, strongerLV, difficulty = ret
|
| | | OnTurnFightVSNPC(curPlayer, mapID, funcLineID, atkLineupID, npcLineupIDList, strongerLV, difficulty)
|
| | | if not OnTurnFightVSNPC(curPlayer, mapID, funcLineID, atkLineupID, npcLineupIDList, strongerLV, difficulty):
|
| | | return
|
| | |
|
| | | return
|
| | | return True
|
| | |
|
| | | def OnTurnFightVSNPC(curPlayer, mapID, funcLineID, atkLineupID, npcLineupIDList, strongerLV, difficulty):
|
| | | playerID = curPlayer.GetPlayerID()
|
| | |
| | | PlayerOnline.GetOnlinePlayer(curPlayer).SetLastBatBuffer(guid, turnFight.batBuffer)
|
| | | SyncTurnFightReport(curPlayer, guid, turnFight.batBuffer)
|
| | | tfMgr.delTurnFight(guid)
|
| | | return
|
| | | return True
|
| | |
|
| | | def OnTurnFightVSPlayer(curPlayer, mapID, funcLineID, atkLineupID, defLineupID, tagPlayerID):
|
| | | playerID = curPlayer.GetPlayerID()
|
| | |
| | | PlayerOnline.GetOnlinePlayer(curPlayer).SetLastBatBuffer(guid, turnFight.batBuffer)
|
| | | SyncTurnFightReport(curPlayer, guid, turnFight.batBuffer)
|
| | | tfMgr.delTurnFight(guid)
|
| | | return
|
| | | return True
|
| | |
|
| | | def GetTurnMax(mapID):
|
| | | if mapID == ChConfig.Def_FBMapID_Main:
|
| | |
| | | def TurnFightPerTurnBigStart(turnFight, turnNum):
|
| | | ## 大回合开始时
|
| | |
|
| | | |
| | | batObjMgr = BattleObj.GetBatObjMgr()
|
| | | for faction, num in turnFight.actionSortList:
|
| | | GameWorld.DebugLog("大回合开始逻辑: turnNum=%s,faction=%s, num=%s" % (turnNum, faction, num))
|
| | |
| | |
|
| | | # 非主线的PVE目标怪物
|
| | | if npcID and curPlayer and turnFight.isFBMap() and gameObj.GetFaction() != ChConfig.Def_FactionA:
|
| | | if not FBLogic.OnFBNPCKilledBefore(curPlayer, turnFight, gameObj, killer):
|
| | | if not FBLogic.OnFBNPCKilledBefore(curPlayer, turnFight, gameObj, killer, useSkill):
|
| | | return
|
| | |
|
| | | objID = gameObj.GetID()
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B4 19 对象最新生命刷新 #tagSCObjHPRefresh
|
| | |
|
| | | class tagSCObjHPRefresh(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("ObjID", c_int), |
| | | ("HP", c_int), # 当前血量,求余20亿部分
|
| | | ("HPEx", c_int), # 当前血量,整除20亿部分
|
| | | ("MaxHP", c_int), # 最大血量,求余20亿部分
|
| | | ("MaxHPEx", c_int), # 最大血量,整除20亿部分
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xB4
|
| | | self.SubCmd = 0x19
|
| | | return
|
| | |
|
| | | def ReadData(self, stringData, _pos=0, _len=0):
|
| | | self.Clear()
|
| | | memmove(addressof(self), stringData[_pos:], self.GetLength())
|
| | | return _pos + self.GetLength()
|
| | |
|
| | | def Clear(self):
|
| | | self.Cmd = 0xB4
|
| | | self.SubCmd = 0x19
|
| | | self.ObjID = 0
|
| | | self.HP = 0
|
| | | self.HPEx = 0
|
| | | self.MaxHP = 0
|
| | | self.MaxHPEx = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagSCObjHPRefresh)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// B4 19 对象最新生命刷新 //tagSCObjHPRefresh:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | ObjID:%d,
|
| | | HP:%d,
|
| | | HPEx:%d,
|
| | | MaxHP:%d,
|
| | | MaxHPEx:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.ObjID,
|
| | | self.HP,
|
| | | self.HPEx,
|
| | | self.MaxHP,
|
| | | self.MaxHPEx
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagSCObjHPRefresh=tagSCObjHPRefresh()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagSCObjHPRefresh.Cmd,m_NAtagSCObjHPRefresh.SubCmd))] = m_NAtagSCObjHPRefresh
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B4 18 对象属性刷新展示 #tagSCObjPropertyRefreshView
|
| | |
|
| | | class tagSCObjPropertyRefreshView(Structure):
|
| | |
| | | clientData.TagID = tagPlayerID
|
| | | index = curPlayer.GetIndex()
|
| | | tick = GameWorld.GetGameWorld().GetTick()
|
| | | TurnAttack.OnTurnFight(index, clientData, tick)
|
| | | if not TurnAttack.OnTurnFight(index, clientData, tick):
|
| | | GameWorld.DebugAnswer(curPlayer, "请求失败,详见服务器日志!")
|
| | | return
|
| | |
|
| | | def __doSetAttr(curPlayer, msgList):
|
| | |
| | |
|
| | | return callFunc(curPlayer, turnFight, npcObj)
|
| | |
|
| | | def OnFBNPCKilledBefore(curPlayer, turnFight, gameObj, killer):
|
| | | def OnFBNPCKilledBefore(curPlayer, turnFight, gameObj, killer=None, useSkill=None):
|
| | | ## 副本NPC被击杀前处理,一般用于处理一些不被击杀的副本NPC逻辑
|
| | | # @return: 可否被正常击杀
|
| | | do_FBLogic_ID = __GetFBLogic_MapID(turnFight.mapID)
|
| | |
| | | # 不需要逻辑时默认可被正常击杀
|
| | | return True
|
| | |
|
| | | return callFunc(curPlayer, turnFight, gameObj, killer)
|
| | | return callFunc(curPlayer, turnFight, gameObj, killer, useSkill)
|
| | |
|
| | | def OnPlayerLineupAttackResult(curPlayer, atkObj, killObjList, useSkill, mapID, funcLineID):
|
| | | ## 回合战斗主动发起的玩家阵容攻击结果额外处理 ,一般处理副本相关的掉落、奖励等
|
| | |
| | | import ShareDefine
|
| | | import PlayerMail
|
| | | import DBDataMgr
|
| | | import TurnSkill
|
| | | import ObjPool
|
| | |
|
| | | def OnDay():
|
| | |
| | | return {}
|
| | | return __getBossAttrDict(ipyDataList[0])
|
| | |
|
| | | def OnFBNPCKilledBefore(curPlayer, turnFight, gameObj, killer):
|
| | | def OnFBNPCKilledBefore(curPlayer, turnFight, gameObj, killer=None, useSkill=None):
|
| | | ## 副本NPC被击杀前处理,一般用于处理一些不被击杀的副本NPC逻辑
|
| | | # @return: 可否被正常击杀
|
| | |
|
| | |
| | | GameWorld.Log("天子考验全部血条被击杀! totalHPMax=%s,statDefValueTotal=%s" % (totalHPMax, statDefValueTotal))
|
| | | return True
|
| | |
|
| | | gameObj.SetMaxHP(ipyDataNow.GetMaxHP(), True)
|
| | | gameObj.SetHP(hp, True)
|
| | | gameObj.SetMaxHP(ipyDataNow.GetMaxHP(), False)
|
| | | gameObj.SetHP(hp, False)
|
| | | GameWorld.DebugLog("更新NPC血条: hpNum=%s,hp=%s/%s, statDefValueTotal=%s" % (hpNum, gameObj.GetHP(), gameObj.GetMaxHP(), statDefValueTotal))
|
| | | TurnSkill.Sync_HPRefresh(turnFight, gameObj)
|
| | | turnFight.SetDict("hpNum", hpNum)
|
| | | turnFight.syncHelp({"hpNum":hpNum})
|
| | | #turnFight.syncHelp({"hpNum":hpNum})
|
| | | gameObj.UpdInitBatAttr(__getBossAttrDict(ipyDataNow))
|
| | | return False
|
| | |
|
| | |
| | | clientPack.RelatedSkillID = relatedSkillID
|
| | | turnFight.addBatPack(clientPack)
|
| | | return
|
| | |
|
| | | def Sync_HPRefresh(turnFight, curBatObj):
|
| | | hp, maxHP = curBatObj.GetHP(), curBatObj.GetMaxHP()
|
| | | clientPack = ObjPool.GetPoolMgr().acquire(ChPyNetSendPack.tagSCObjHPRefresh)
|
| | | clientPack.ObjID = curBatObj.GetID()
|
| | | clientPack.HP = hp % ShareDefine.Def_PerPointValue
|
| | | clientPack.HPEx = hp / ShareDefine.Def_PerPointValue
|
| | | clientPack.MaxHP = maxHP % ShareDefine.Def_PerPointValue
|
| | | clientPack.MaxHPEx = maxHP / ShareDefine.Def_PerPointValue
|
| | | turnFight.addBatPack(clientPack)
|
| | | return
|
| | | |