From 6cd31ef1136372f735384a9e9422de256bbf813d Mon Sep 17 00:00:00 2001 From: hch <305670599@qq.com> Date: 星期一, 03 十二月 2018 19:11:57 +0800 Subject: [PATCH] 5186 【测试】【1.3.100起】减少战斗广播量 --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AICommon.py | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 52 insertions(+), 8 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AICommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AICommon.py index d449a62..3a486b0 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AICommon.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AICommon.py @@ -395,6 +395,44 @@ #--------------------------------------------------------------------- + + +def GetCanUseRealmSuppressSkll(curNPC, curSkill): + if curSkill.GetFuncType() != ChConfig.Def_SkillFuncType_RealmSuppress: + # 非境界压制技能返回可用 + return True + + # 境界压制技能需判断 周围是否有低境界玩家 + npcRealmLV = NPCCommon.GetRealmLV(curNPC) + angryManager = curNPC.GetNPCAngry() + + for i in range(0, angryManager.GetAngryCount()) : + curAngry = angryManager.GetAngryValueTag(i) + if curAngry == None or curAngry.GetObjID() == 0: + continue + + #仇恨值 + curAngryValue = curAngry.GetAngryValue() + if curAngryValue == 0: + continue + + if curAngry.GetIsDisable(): + continue + + angryID = curAngry.GetObjID() + angryObjType = curAngry.GetObjType() + if angryObjType != IPY_GameWorld.gotPlayer: + continue + + curTag = GameWorld.GetObj(angryID, angryObjType) + if not curTag: + continue + if curTag.GetOfficialRank() < npcRealmLV: + return True + + return False + + ##NPC自动释放技能 # @param curNPC NPC实例 # @param curTag 攻击目标 @@ -442,17 +480,22 @@ if SkillShell.GetSkillFireAim(useSkill) == ChConfig.Def_UseSkillAim_Obj: # 主目标对象判定, 不能释放则不进入队列 curSkillUseTag = SkillShell.GetSkillAffectTag(useSkill) - hurtTypeList = ChConfig.Def_Dict_UseSkillTag_ObjType.get(curSkillUseTag) - if not hurtTypeList: - continue - - if tagObjType not in hurtTypeList: - continue + if curSkillUseTag != ChConfig.Def_UseSkillTag_AppointNPC: + hurtTypeList = ChConfig.Def_Dict_UseSkillTag_ObjType.get(curSkillUseTag) + if not hurtTypeList: + continue + + if tagObjType not in hurtTypeList: + continue if triggerDict != {}: if not CheckSkillTrigger(curNPC, triggerDict, index, tick): continue + # 境界压制需要根据仇恨列表中的玩家是否有压制 + if not GetCanUseRealmSuppressSkll(curNPC, useSkill): + continue + useCnt = curNPC.GetDictByKey(ChConfig.Def_NPC_Dict_SkillUseCnt % useSkill.GetSkillTypeID()) # 该技能已使用次数 useSkillList.append([useCnt, index, useSkill]) @@ -460,7 +503,7 @@ return False useSkillList.sort() # 按使用次数优先升序排,使用次数低的优先判断使用 - #GameWorld.DebugLog('技能使用顺序 = useSkillList%s' % str(useSkillList), curNPC.GetID()) + GameWorld.DebugLog('技能使用顺序 = useSkillList%s' % str(useSkillList), curNPC.GetID()) for useCnt, index, useSkill in useSkillList: if DoNPCUseSkill(curNPC, curTag, useSkill, tagDist, tick): @@ -477,9 +520,10 @@ # @return 布尔值 def CheckSkillTrigger(curNPC, triggerDict, npcSkillindex, tick): skillInfo = triggerDict.get(npcSkillindex) + if skillInfo != None: #当前血量 - hpPercent = int(curNPC.GetHP()/float(GameObj.GetMaxHP(curNPC))*100) + hpPercent = int(GameObj.GetHP(curNPC)/float(GameObj.GetMaxHP(curNPC))*100) checkHP = skillInfo[0] #血量未到 -- Gitblit v1.8.0