From 5695662b3131c45271dac81da7f45391570d8b4a Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 28 十一月 2018 11:25:06 +0800
Subject: [PATCH] 4762 【后端】优化机器人攻击顺序,防止动作一致;
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBHelpBattle.py | 1 +
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_20.py | 10 ++++++++++
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py | 4 ++++
3 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index 4bd73c9..6f46b30 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -2962,6 +2962,10 @@
Def_NPC_Dict_SpeedPer = "SpeedPer" # 移动速度变更百分比
+# 延迟攻击时长, 毫秒
+Def_NPC_Dict_AtkDelayTick = "AtkDelayTick" # 延迟攻击时长
+Def_NPC_Dict_AtkStartTick = "AtkStartTick" # 开始攻击tick
+
#玩家状态定义,不能超过31个,如超过,需扩展多个key支持
Def_PlayerStateList = (
Def_PlayerState_Normal, # 无 0
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBHelpBattle.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBHelpBattle.py
index 2cda424..7ef3fa7 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBHelpBattle.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBHelpBattle.py
@@ -226,6 +226,7 @@
objID = helpBattleNPC.GetID()
GameWorld.Log("召唤助战成功: calledPlayerID=%s,objID=%s,fightPower=%s" % (calledPlayerID, objID, fightPower), playerID)
gameFB.SetGameFBDict(ChConfig.Def_FB_HelpBattleFBObjID % calledPlayerID, objID)
+ helpBattleNPC.SetDict(ChConfig.Def_NPC_Dict_AtkDelayTick, calledCount * 1000) # 按转换顺序每个延长1秒攻击,防止动作一致
calledCount += 1
# 设置助战属性
npcControl = NPCCommon.NPCControl(helpBattleNPC)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_20.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_20.py
index 1541e78..4fc8b87 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_20.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_20.py
@@ -99,6 +99,16 @@
curNPC.ResetPos(resultPos.GetPosX(), resultPos.GetPosY())
tagDist = GameWorld.GetDist(curNPC.GetPosX(), curNPC.GetPosY(), curTag.GetPosX(), curTag.GetPosY())
+ delayTick = curNPC.GetDictByKey(ChConfig.Def_NPC_Dict_AtkDelayTick)
+ if delayTick:
+ startAtkTick = curNPC.GetDictByKey(ChConfig.Def_NPC_Dict_AtkStartTick)
+ if not startAtkTick:
+ curNPC.SetDict(ChConfig.Def_NPC_Dict_AtkStartTick, tick)
+ startAtkTick = tick
+ if tick - startAtkTick < delayTick:
+ GameWorld.DebugLog("未到攻击时间,暂不处理!objID=%s" % curNPC.GetID())
+ return
+
#---优先释放技能---
if AICommon.DoAutoUseSkill(curNPC, curTag, tagDist, tick):
return
--
Gitblit v1.8.0