From 143c55479cbb2f77883ca8a87c7f42c2ddcb8673 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 03 十二月 2024 15:31:51 +0800
Subject: [PATCH] 4999 【bt】【英文】【越南】优化灵宠战斗(主人不攻击时,灵宠达到攻击间隔也会主动攻击可攻击的目标;灵宠攻击目标增加可攻击视野内主动怪,攻击顺序为:主人攻击目标 > 攻击主人的目标 > 视野内主动怪)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PetControl.py |   29 ++++++++++++++++++++++++++++-
 1 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PetControl.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PetControl.py
index 371a3c2..33107f2 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PetControl.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PetControl.py
@@ -47,6 +47,7 @@
 import PassiveBuffEffMng
 import ChNetSendPack
 import IpyGameDataPY
+import AttackCommon
 #---------------------------------------------------------------------
 
 DefPetRebornHPRate = 100  # 宠物死亡复活血量百分比
@@ -92,7 +93,33 @@
             curTag = curPlayer.GetAngryNPCByIndex(i)
             if not curTag or GameObj.GetHP(curTag) <= 0:
                 continue
-        
+            
+        # 还没有就从视野中查找
+        if not curTag or GameObj.GetHP(curTag) <= 0:
+            seePlayerCount = rolePet.GetInSightObjCount()
+            for i in range(0, seePlayerCount):
+                seeObj = rolePet.GetInSightObjByIndex(i)
+                if seeObj == None:
+                    continue
+                seeObjID = seeObj.GetID()
+                seeObjType = seeObj.GetGameObjType()
+                # 只允许主动攻击NPC,且目标NPC是主动怪
+                if seeObjType != IPY_GameWorld.gotNPC:
+                    continue
+                seeObjDetail = GameWorld.GetObj(seeObjID, seeObjType)
+                if not seeObjDetail:
+                    continue
+                if seeObjDetail.GetAtkType() == 1:
+                    # 1为非主动怪
+                    continue
+                if not AttackCommon.CheckCanAttackTag(rolePet, seeObjDetail):
+                    continue
+                relation = BaseAttack.GetTagRelation(rolePet, seeObjDetail, None, tick)[0]
+                if relation != ChConfig.Type_Relation_Enemy:
+                    continue
+                curTag = seeObjDetail
+                break
+                
     if not curTag or GameObj.GetHP(curTag) <= 0:
         return
     

--
Gitblit v1.8.0