From 6c46579b5303aaf96f034964fc44e7c36ac4573b Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 18 三月 2025 15:10:19 +0800
Subject: [PATCH] 10263 【英文】【BT】【GM】后端支持NPC仿真实玩家战斗和快速战斗(镜像AI单次攻击触发被动死循环防范,暂时限制单次攻击累计触发50次不再触发并发送后台邮件警告;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/MirrorAttack.py |    2 ++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BaseAttack.py   |   16 +++++++++++++++-
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyGameData.py          |    2 ++
 3 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BaseAttack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BaseAttack.py
index 9469cd5..8a4e701 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BaseAttack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BaseAttack.py
@@ -42,6 +42,7 @@
 import PassiveBuffEffMng
 import PlayerGeTui
 import IpyGameDataPY
+import PyGameData
 #---------------------------------------------------------------------
 g_skillHurtList = IPY_GameWorld.IPY_HurtList()
 
@@ -1973,7 +1974,20 @@
     #PlayerControl.DoPlayerStand(curPlayer)
     #激活玩家
     PlayerControl.SetIsNeedProcess(curPlayer, True)
-
+    
+    #镜像单次攻击统计,查单次攻击无限触发被动死循环临时代码
+    if PyGameData.g_singleAtkRecordList != None and (attacker and attacker.GetDictByKey(ChConfig.Def_PlayerKey_MirrorBattleID)) \
+        and (curPlayer and curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_MirrorBattleID)):
+        atkID = attacker.GetID()
+        defID = curPlayer.GetID()
+        skillID = curSkill.GetSkillID() if curSkill else 0
+        PyGameData.g_singleAtkRecordList.append([atkID, defID, skillID])
+        #GameWorld.DebugLog("PyGameData.g_singleAtkRecordList: %s, %s" % (len(PyGameData.g_singleAtkRecordList), PyGameData.g_singleAtkRecordList))
+        if len(PyGameData.g_singleAtkRecordList) >= 50:
+            GameWorld.SendGameError("MirrorAIAtkDepthError", str(PyGameData.g_singleAtkRecordList))
+            PyGameData.g_singleAtkRecordList = None
+            return
+        
     # 暂且只有玩家被攻击触发
     if not curSkill or curSkill.GetSkillType() in ChConfig.Def_CanAttackSkill_List:
         # 优先触发,如无敌可以抵挡后续的被动伤害技能
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/MirrorAttack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/MirrorAttack.py
index dfa4d4f..e927225 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/MirrorAttack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/MirrorAttack.py
@@ -728,6 +728,7 @@
         #GameWorld.DebugLog("攻击间隔: %s < %s" % (tick - curPlayer.GetPlayerAttackTick(), curPlayer.GetAtkInterval()), playerID)
         return
     
+    PyGameData.g_singleAtkRecordList = []
     autoUseSkillList = battle.GetPlayerAutoUseSkillList(curPlayer)
     #GameWorld.DebugLog("镜像AI攻击: autoUseSkillList=%s" % (autoUseSkillList), playerID)
     
@@ -752,6 +753,7 @@
             if isOK:
                 break
             
+    PyGameData.g_singleAtkRecordList = None
     if isOK:
         # 每次处理仅执行一次成功行为
         return
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyGameData.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyGameData.py
index 7d2a050..395f224 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyGameData.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyGameData.py
@@ -132,3 +132,5 @@
 
 g_familyZhenfaInfo = {} # 仙盟阵法信息{familyID:{zhenfaType:{k:v, }, ...}, ...}
 
+g_singleAtkRecordList = None # 单次攻击记录
+

--
Gitblit v1.8.0