| | |
| | | import PlayerTrade
|
| | | import PlayerTeam
|
| | | import SkillCommon
|
| | | import MirrorAttack
|
| | | import GameMap
|
| | | import FBLogic
|
| | | import GameWorldProcess
|
| | |
| | |
|
| | | return
|
| | | #---------------------------------------------------------------------
|
| | | def OnDelayDeleteMirror(curPlayer, tick):
|
| | | addTick = curPlayer.GetDictByKey("DelayDeleteMirror")
|
| | | if not addTick:
|
| | | return
|
| | | if tick - addTick < 10000: # 10s后回收
|
| | | return
|
| | | DeleteMirror(curPlayer, False)
|
| | | return True
|
| | |
|
| | | def DeleteMirror(curPlayer, isDelay=False):
|
| | | ''' 回收镜像玩家
|
| | | '''
|
| | | if not curPlayer.GetRealPlayerID():
|
| | | return
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | if isDelay:
|
| | | #由于系统场次快速战斗原因,如果立马回收可能导致某个功能出现问题
|
| | | #如被动技能效果,执行顺序的原因,如击杀后 -> 结算 -> 回收玩家 -> 触发被动技能,导致异常
|
| | | GameWorld.DebugLog("镜像玩家设置延迟回收!", playerID)
|
| | | SetPlayerSightLevel(curPlayer, playerID)
|
| | | tick = GameWorld.GetGameWorld().GetTick()
|
| | | curPlayer.SetDict("DelayDeleteMirror", tick)
|
| | | return
|
| | | GameWorld.DebugLog("镜像玩家回收!", playerID)
|
| | | #杀死所有召唤的灵
|
| | | KillPlayerSummonNPC(curPlayer)
|
| | | #召唤回出战的宠物
|
| | | PetControl.ReCallFightPet(curPlayer)
|
| | | curPlayer.DeleteMirror()
|
| | | return
|
| | |
|
| | | ##杀死玩家所有的召唤兽死亡
|
| | | # @param curPlayer 玩家实例
|
| | | # @return 返回值无意义
|
| | |
| | | UpdateOnLineTime(curPlayer, tick)
|
| | |
|
| | | PassiveBuffEffMng.OnPlayerLeaveMap(curPlayer)
|
| | | |
| | | MirrorAttack.OnPlayerLeaveMap(curPlayer)
|
| | |
|
| | | #离开地图清空恶意攻击自己玩家信息
|
| | | if curPlayer.GetPlayerID() in PyGameData.g_maliciousAttackDict:
|
| | |
| | | # @return 返回值无意义
|
| | | # @remarks 刷新玩家所有状态
|
| | | def RefreshAllState(self, isSyncBuff=False, billboardFunc=None, isForce=False):
|
| | | GameWorld.DebugLog("Start RefreshAllState!!!")
|
| | | curPlayer = self.__Player
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | GameWorld.DebugLog("Start RefreshAllState!!!", playerID)
|
| | |
|
| | | self.RefreshPlayerActionState()
|
| | | self.RefreshPlayerAttrState(billboardFunc, isForce)
|
| | |
| | | # @return 返回值无意义
|
| | | # @remarks 刷新玩家所有状态
|
| | | def ReCalcAllState(self):
|
| | | GameWorld.DebugLog("Start ReCalcAllState!!!")
|
| | | curPlayer = self.__Player
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | GameWorld.DebugLog("Start ReCalcAllState!!!", playerID)
|
| | |
|
| | | for funcIndex in ChConfig.CalcAttrFuncList:
|
| | | ClearCalcAttrListValue(curPlayer, funcIndex)
|
| | |
| | | PlayerFace.CalcFaceAttr(curPlayer)
|
| | | PlayerFace.CalcFacePicAttr(curPlayer)
|
| | | self.RefreshAllState(isForce=True)
|
| | | GameWorld.DebugLog("End ReCalcAllState!!!")
|
| | | GameWorld.DebugLog("End ReCalcAllState!!!", playerID)
|
| | | return
|
| | |
|
| | |
|
| | |
| | | if curPlayer.GetDictByKey(ChConfig.Def_Player_RefreshAttrByBuff) != 1:
|
| | | return
|
| | |
|
| | | GameWorld.DebugLog("Start RefreshPlayerAttrByBuffEx!!!")
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | GameWorld.DebugLog("Start RefreshPlayerAttrByBuffEx!!!", playerID)
|
| | | beforeMaxHP = GameObj.GetMaxHP(curPlayer)
|
| | | beforeMoveSpeedValue = GetSpeedValue(curPlayer)
|
| | | #构建玩家刷新通知客户端字典, 缓存[索引, 数值]
|
| | | playerStateDict = {}
|
| | | for index in xrange(1, ChConfig.Def_Calc_AllAttrType_MAX):
|
| | | playerStateDict.update({index:EffGetSet.GetValueByEffIndex(curPlayer, index)})
|
| | | #GameWorld.DebugLog("刷属性前=%s" % playerStateDict)
|
| | | #GameWorld.DebugLog("刷属性前=%s" % playerStateDict, playerID)
|
| | | #self.PrintAttr(curPlayer, "ˢ֮ǰ")
|
| | | #---------------------------开始计算-------------------------------------
|
| | | curPlayer.BeginRefreshState()
|
| | |
| | | self.__DoRefreshAttrAfterLogic(beforeMaxHP, beforeMoveSpeedValue, playerStateDict)
|
| | |
|
| | | curPlayer.SetDict(ChConfig.Def_Player_RefreshAttrByBuff, 0)
|
| | | GameWorld.DebugLog("End RefreshPlayerAttrByBuffEx!!!")
|
| | | GameWorld.DebugLog("End RefreshPlayerAttrByBuffEx!!!", playerID)
|
| | | return
|
| | |
|
| | |
|
| | |
| | |
|
| | | PlayerGubao.CalcGubaoAttr(curPlayer) # 古宝定位为对贯通所有游戏功能系统的属性玩法,所以每次都重新刷新
|
| | |
|
| | | GameWorld.DebugLog("Start RefreshPlayerAttrStateEx!!!")
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | GameWorld.DebugLog("Start RefreshPlayerAttrStateEx!!!", playerID)
|
| | |
|
| | | #beforeAtkInterval = curPlayer.GetAtkInterval()
|
| | | beforeMaxHP = GameObj.GetMaxHP(curPlayer)
|
| | |
| | | playerStateDict = {}
|
| | | for index in xrange(1, ChConfig.Def_Calc_AllAttrType_MAX):
|
| | | playerStateDict.update({index:EffGetSet.GetValueByEffIndex(curPlayer, index)})
|
| | | #GameWorld.DebugLog("刷属性前=%s" % playerStateDict)
|
| | | #GameWorld.DebugLog("刷属性前=%s" % playerStateDict, playerID)
|
| | | #self.PrintAttr(curPlayer, "ˢ֮ǰ")
|
| | | #---------------------------开始计算-------------------------------------
|
| | | curPlayer.BeginRefreshState()
|
| | |
| | | attrInfo, insidePerAttrDict = GetCalcAttrListValue(curPlayer, funcIndex)[:2]
|
| | | if attrInfo == notAttrList and not insidePerAttrDict:
|
| | | continue
|
| | | GameWorld.DebugLog("功能点属性: %s(%s), %s, 内层百分比附加: %s" % (funcIndex, ChConfig.FuncIndexName.get(funcIndex, ""), attrInfo, insidePerAttrDict))
|
| | | GameWorld.DebugLog("功能点属性: %s(%s), %s, 内层百分比附加: %s" % (funcIndex, ChConfig.FuncIndexName.get(funcIndex, ""), attrInfo, insidePerAttrDict), playerID)
|
| | | funcAttrInfoList[funcIndex] = attrInfo
|
| | | funcInsidePerAttrList[funcIndex] = insidePerAttrDict
|
| | | # 不同功能点间的数值累加,需使用支持衰减递增的计算方式
|
| | |
| | | # 2.2 将基础属性累加到玩家身上
|
| | | if baseAttrDict or baseAttrNolineDict:
|
| | | # 因为基础属性会影响战斗属性计算,所以先统计增加基础属性
|
| | | GameWorld.DebugLog("功能附加点: baseAttrDict=%s,baseAttrNolineDict=%s" % (baseAttrDict, baseAttrNolineDict))
|
| | | GameWorld.DebugLog("功能附加点: baseAttrDict=%s,baseAttrNolineDict=%s" % (baseAttrDict, baseAttrNolineDict), playerID)
|
| | | CalcLineEffect.ChangePlayerAttrInLineEffectList(curPlayer, baseAttrDict)
|
| | | CalcNoLineEffect.ChangePlayerAttrInNoLineEffectList(curPlayer, baseAttrNolineDict)
|
| | |
|
| | |
| | | funcAttrInfoList[ChConfig.Def_CalcAttrFunc_LingGenQuailty] = lingGenQualityAttrList
|
| | | funcInsidePerAttrList[ChConfig.Def_CalcAttrFunc_LingGenQuailty] = lingGenQualityInsidePerAttrDict
|
| | | GameWorld.DebugLog("功能点属性: %s(%s), %s, 内层百分比附加: %s"
|
| | | % (ChConfig.Def_CalcAttrFunc_RoleBase, ChConfig.FuncIndexName.get(ChConfig.Def_CalcAttrFunc_RoleBase, ""), roleBaseAttrInfo, roleInsidePerAttrDict))
|
| | | % (ChConfig.Def_CalcAttrFunc_RoleBase, ChConfig.FuncIndexName.get(ChConfig.Def_CalcAttrFunc_RoleBase, ""), roleBaseAttrInfo, roleInsidePerAttrDict), playerID)
|
| | | GameWorld.DebugLog("功能点属性: %s(%s), %s, 内层百分比附加: %s"
|
| | | % (ChConfig.Def_CalcAttrFunc_LingGenQuailty, ChConfig.FuncIndexName.get(ChConfig.Def_CalcAttrFunc_LingGenQuailty, ""), lingGenQualityAttrList, lingGenQualityInsidePerAttrDict))
|
| | | % (ChConfig.Def_CalcAttrFunc_LingGenQuailty, ChConfig.FuncIndexName.get(ChConfig.Def_CalcAttrFunc_LingGenQuailty, ""), lingGenQualityAttrList, lingGenQualityInsidePerAttrDict), playerID)
|
| | |
|
| | | #self.PrintAttr(curPlayer, "基础后")
|
| | | #self.PrintAttr(curPlayer, "基础后", playerID)
|
| | |
|
| | | # 3.计算战斗属性
|
| | | # 3.1 战斗属性层级交叉影响基值数值汇总
|
| | |
| | | funcAttrInfoList[ChConfig.Def_CalcAttrFunc_LingGen],
|
| | | funcAttrInfoList[ChConfig.Def_CalcAttrFunc_LingGenQuailty],
|
| | | ])
|
| | | #GameWorld.DebugLog("基础层级: %s" % baseAttrList)
|
| | | #GameWorld.DebugLog("基础层级: %s" % baseAttrList, playerID)
|
| | |
|
| | | # 功能点交叉影响非线性层对应属性基值列表
|
| | | funcAttrPerInfo = {ChConfig.TYPE_Calc_BaseAtkAddPer:[baseAttrList],
|
| | |
| | | if not battleNoLineAttrDict:
|
| | | continue
|
| | | addAttrDict = {}
|
| | | #GameWorld.DebugLog("交叉功能点: i=%s,%s" % (i,battleNoLineAttrDict))
|
| | | #GameWorld.DebugLog("交叉功能点: i=%s,%s" % (i,battleNoLineAttrDict), playerID)
|
| | | for noLineAttrType, addAttrPer in battleNoLineAttrDict.items():
|
| | | if noLineAttrType not in funcAttrPerInfo or noLineAttrType not in ChConfig.FuncNoLinearAttrDict:
|
| | | continue
|
| | |
| | | # 如符文有个武器攻击百分比增加属性,增加的数值属于符文功能,不属于武器功能点的,只是基值使用了武器攻击
|
| | | funcCrossAttrPerInfoDict[i] = addAttrDict # 先都统计完后再累加到对应功能属性里,不然可能会导致功能基值变更
|
| | |
|
| | | GameWorld.DebugLog("交叉影响属性: %s" % funcCrossAttrPerInfoDict)
|
| | | GameWorld.DebugLog("交叉影响属性: %s" % funcCrossAttrPerInfoDict, playerID)
|
| | |
|
| | | # 3.3 统计所有功能固定属性影响累加
|
| | | allFixAttrDict = {} # 固定属性层级总属性基值
|
| | |
| | | addValueExDict[fixAttrType] = addValueEx
|
| | | fixAttrPerAddExDict[funcIndex] = addValueExDict
|
| | |
|
| | | GameWorld.DebugLog("固定属性总和: %s" % allFixAttrDict)
|
| | | GameWorld.DebugLog("固定百分比附加属性: %s" % fixAttrPerAddExDict)
|
| | | GameWorld.DebugLog("固定属性总和: %s" % allFixAttrDict, playerID)
|
| | | GameWorld.DebugLog("固定百分比附加属性: %s" % fixAttrPerAddExDict, playerID)
|
| | |
|
| | | # 4. 计算属性及战力, 需在计算buff层之前计算
|
| | | curLV = curPlayer.GetLV()
|
| | |
| | | elif mfpType == ShareDefine.Def_MFPType_Wash:
|
| | | OpenServerCampaign.UpdOpenServerCampaignRecordData(curPlayer, ShareDefine.Def_Campaign_Type_Wash, mfpTotal)
|
| | |
|
| | | #GameWorld.DebugLog("整体层级线性属性: %s" % allAttrList)
|
| | | #GameWorld.DebugLog("整体层级线性属性: %s" % allAttrList, playerID)
|
| | |
|
| | | # 5.被动技能附加属性,不算战力
|
| | | passiveSkillAttrList = [{} for _ in range(4)]
|
| | | SkillShell.CalcPassiveAttr_Effect(curPlayer, passiveSkillAttrList) # 属性类技能与buff同层
|
| | | for funcIndex in ChConfig.CalcAttrFuncSkillList:
|
| | | passiveSkillAttrList = AddAttrListValue([passiveSkillAttrList, funcAttrInfoList[funcIndex]])
|
| | | GameWorld.DebugLog("无战力被动属性: %s" % passiveSkillAttrList)
|
| | | GameWorld.DebugLog("无战力被动属性: %s" % passiveSkillAttrList, playerID)
|
| | |
|
| | | skillFixAttrExDict = {}
|
| | | skillFixAddPerDict = passiveSkillAttrList[ChConfig.CalcAttr_BattleNoline]
|
| | |
| | | while billFuncCnt > 0 and PyGameData.g_refreshAttrBillboardFunc:
|
| | | billFuncCnt -= 1
|
| | | billboardFunc = PyGameData.g_refreshAttrBillboardFunc.pop(0)
|
| | | GameWorld.DebugLog("回调排行榜: %s" % billboardFunc)
|
| | | GameWorld.DebugLog("回调排行榜: %s" % billboardFunc, playerID)
|
| | | billboardFunc(curPlayer, isForceUpdate=True)
|
| | |
|
| | | # 暂停刷新属性标志,必须被调用
|
| | | curPlayer.SetDict(ChConfig.Def_Player_RefreshAttr, 0)
|
| | | curPlayer.SetDict(ChConfig.Def_Player_RefreshAttrByBuff, 0)
|
| | | curPlayer.SetDict(ChConfig.Def_Player_HadRefreshAttr, 1)
|
| | | GameWorld.DebugLog("End RefreshPlayerAttrStateEx!!!")
|
| | | GameWorld.DebugLog("End RefreshPlayerAttrStateEx!!!", playerID)
|
| | | return True
|
| | |
|
| | |
|
| | |
| | | def __RefreshBuffAttr(self):
|
| | | ## 刷新buff层属性,该层属性只会改变玩家最终属性,不会影响战力等
|
| | | curPlayer = self.__Player
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | allAttrListBuffs = [{} for _ in range(4)]
|
| | | # 6.计算buff属性, buff层级的不算如战斗力
|
| | | # 算战斗力总值时该层影响的数值不统计,但刷属性时需计算
|
| | |
| | |
|
| | | # 刷新攻击速度
|
| | | self.__SetAtkInterval()
|
| | | GameWorld.DebugLog("Buff层属性: %s" % allAttrListBuffs)
|
| | | GameWorld.DebugLog("Buff层属性: %s" % allAttrListBuffs, playerID)
|
| | | return
|
| | |
|
| | | def __DoRefreshGMAttr(self):
|
| | |
| | | def SendModuleFightPowerPack(self, curPlayer, mfpDict):
|
| | | mfpDataList = []
|
| | | totalFightPower = 0
|
| | | GameWorld.DebugLog("战力功能点: %s" % ChConfig.MFPTypeAttrFuncIndexDict)
|
| | | GameWorld.DebugLog("模块战力: %s" % mfpDict)
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | GameWorld.DebugLog("战力功能点: %s" % ChConfig.MFPTypeAttrFuncIndexDict, playerID)
|
| | | GameWorld.DebugLog("模块战力: %s" % mfpDict, playerID)
|
| | | for mfpType, fightPower in mfpDict.items():
|
| | | SetMFPFightPower(curPlayer, mfpType, fightPower)
|
| | | mfpData = ChPyNetSendPack.tagMCModuleFightPower()
|
| | |
| | | ChConfig.Def_PDictType_FightPower)
|
| | | NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FightPower_HighestEx, highestFightPower / ChConfig.Def_PerPointValue,
|
| | | ChConfig.Def_PDictType_FightPower)
|
| | | GameWorld.DebugLog("总战力: %s, 历史最高战力: %s, beforeFightPower=%s" % (totalFightPower, highestFightPower, beforeFightPower))
|
| | | GameWorld.DebugLog("总战力: %s, 历史最高战力: %s, beforeFightPower=%s" % (totalFightPower, highestFightPower, beforeFightPower), playerID)
|
| | | PlayerBillboard.UpdatePlayerFPTotalBillboard(curPlayer)
|
| | | # 记录开服活动数据,开服活动前X天理论上不会超过20E,暂不处理
|
| | | OpenServerCampaign.UpdOpenServerCampaignRecordData(curPlayer, ShareDefine.Def_Campaign_Type_FightPower, min(totalFightPower, ChConfig.Def_UpperLimit_DWord))
|
| | |
| | | def __RefreshMoveSpeed(self, allAttrListBuffs):
|
| | | ## 刷新移动速度
|
| | | curPlayer = self.__Player
|
| | | playerID = curPlayer.GetPlayerID()
|
| | |
|
| | | moveSpeedFormat = IpyGameDataPY.GetFuncCfg("MoveSpeed")
|
| | |
|
| | | if PlayerTruck.GetHaveAutoTruck(curPlayer):
|
| | | speed = IpyGameDataPY.GetFuncCfg("MoveSpeed", 3)
|
| | | GameWorld.DebugLog("运镖固定速度值: speed=%s" % speed)
|
| | | GameWorld.DebugLog("运镖固定速度值: speed=%s" % speed, playerID)
|
| | | else:
|
| | | speed = GetSpeedNotBuff(curPlayer)
|
| | | GameWorld.DebugLog("功能移动速度值: speed=%s" % speed)
|
| | | GameWorld.DebugLog("功能移动速度值: speed=%s" % speed, playerID)
|
| | |
|
| | | # 骑乘状态加上骑乘附加速度
|
| | | if curPlayer.GetPlayerVehicle() == IPY_GameWorld.pvHorse:
|
| | | speedHorse = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_SpeedHorse)
|
| | | speed += speedHorse
|
| | | GameWorld.DebugLog(" 骑乘状态附加值: %s, speed=%s" % (speedHorse, speed))
|
| | | GameWorld.DebugLog(" 骑乘状态附加值: %s, speed=%s" % (speedHorse, speed), playerID)
|
| | |
|
| | |
|
| | | buffBattleAttr = allAttrListBuffs[ChConfig.CalcAttr_Battle]
|
| | |
| | |
|
| | | if buffSpeed or buffSpeedPer:
|
| | | speed = int(speed * (ShareDefine.Def_MaxRateValue + buffSpeedPer) / float(ShareDefine.Def_MaxRateValue) + buffSpeed)
|
| | | GameWorld.DebugLog(" buff影响后速度值: speed=%s,buffSpeedPer=%s,buffSpeed=%s" % (speed, buffSpeedPer, buffSpeed))
|
| | | GameWorld.DebugLog(" buff影响后速度值: speed=%s,buffSpeedPer=%s,buffSpeed=%s" % (speed, buffSpeedPer, buffSpeed), playerID)
|
| | |
|
| | | speed = max(speed, 0) #防小于0错误
|
| | | if GetSpeedValue(curPlayer) != speed:
|
| | | SetSpeedValue(curPlayer, speed)
|
| | | moveSpeed = eval(FormulaControl.GetCompileFormula("MoveSpeed", moveSpeedFormat))
|
| | | curPlayer.SetSpeed(moveSpeed)
|
| | | GameWorld.DebugLog("公式计算后移动频率: moveSpeed=%s 毫秒/格" % moveSpeed)
|
| | | GameWorld.DebugLog("公式计算后移动频率: moveSpeed=%s 毫秒/格" % moveSpeed, playerID)
|
| | |
|
| | | fightPet = curPlayer.GetPetMgr().GetFightPet()
|
| | | #无出战宠物
|
| | |
| | | # @return 返回值无意义
|
| | | # @remarks 刷新玩家所有行为BUFF状态
|
| | | def RefreshPlayerActionState(self):
|
| | | GameWorld.DebugLog("Start RefreshPlayerActionState!!!")
|
| | | #curTime = time.clock()
|
| | | curPlayer = self.__Player
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | GameWorld.DebugLog("Start RefreshPlayerActionState!!!", playerID)
|
| | | #curTime = time.clock()
|
| | |
|
| | | #先清除所有状态
|
| | | OperControlManager.ClearObjActionState(curPlayer)
|
| | |
| | |
|
| | | #PlayerTJG.PlayerTJGReborn(curPlayer, tick)
|
| | | GameObj.ClearPyPlayerState(curPlayer)
|
| | | |
| | | MirrorAttack.OnPlayerDead(curPlayer)
|
| | | return
|
| | |
|
| | |
|