From 8262e09b6dbb9e955cf19ef880eaae459a1ff111 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期四, 27 六月 2019 10:04:55 +0800 Subject: [PATCH] 7584 【后端】【主干】神兽装备评分(暴击抗性参数 SuperHitRateReduce) --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/ChNPC.py | 21 ++++++++++++++++++++- 1 files changed, 20 insertions(+), 1 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/ChNPC.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/ChNPC.py index 4fcdbd0..dbaf5d3 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/ChNPC.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/ChNPC.py @@ -127,6 +127,7 @@ # @return None # @remarks 函数详细说明. def OnNPCAttacked(atkObj, curNPC, skill, tick): + NPCCommon.OnNPCAttacked(atkObj, curNPC, skill, tick) callFunc = GameWorld.GetExecFunc(NPCAI, "AIType_%d.%s"%(curNPC.GetAIType(), "OnAttacked")) if callFunc == None: return None @@ -134,6 +135,7 @@ callFunc(atkObj, curNPC, skill, tick) PlayerActivity.OnAttackNPCActivity(atkObj, curNPC) + return def OnCheckCanDie(atkObj, curNPC, skill, tick): callFunc = GameWorld.GetExecFunc(NPCAI, "AIType_%d.%s"%(curNPC.GetAIType(), "OnCheckCanDie")) @@ -358,7 +360,19 @@ for curNPC in gameTruck_List: ProcessNPCAI(curNPC, tick) + # 宠物AI + ProcessPetAI(gameWorld, gameNPC, tick) + +# 宠物AI需求减弱特殊处理, 减少性能消耗 +def ProcessPetAI(gameWorld, gameNPC, tick): #---处理宠物的AI--- + #未到刷新间隔 + if tick - gameWorld.GetTickByType(ChConfig.TYPE_Map_Tick_PetAITick) < \ + ChConfig.TYPE_Map_Tick_Time[ChConfig.TYPE_Map_Tick_PetAITick]: + return + + gameWorld.SetTickByType(ChConfig.TYPE_Map_Tick_PetAITick, tick) + gamePet_List = [] for index in range(0, gameNPC.GetPetCount()): @@ -425,7 +439,7 @@ GameWorld.GetGameFB().SetGameFBDict(ChConfig.Def_FBDict_NPCShowEndTick % npcID, 0) GameWorld.DebugLog("NPC秀结束,开始处理AI!npcID=%s,tick=%s,endTick=%s" % (npcID, tick, endTick)) - callFunc = GameWorld.GetExecFunc(NPCAI, "AIType_%d.%s"%(curNPC.GetAIType(), "ProcessAI")) + callFunc = GameWorld.GetExecFunc(NPCAI, "AIType_%s.%s"%(GetAIName(curNPC), "ProcessAI")) if callFunc == None: #NPCAI不可使用 # #默认call类型1的AI @@ -435,7 +449,12 @@ return callFunc(curNPC, tick) + return +def GetAIName(curNPC): + if curNPC.GetType() in [ChConfig.ntPriWoodPilePVE, ChConfig.ntPriWoodPilePVP]: + return "PriWood" + return curNPC.GetAIType() ##################################################logic -- Gitblit v1.8.0