From b765ceca4dc1bbdb4e3ff595d5acc0fd04d15401 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期三, 30 一月 2019 20:09:34 +0800
Subject: [PATCH] 6154 【后端】【1.5.200】击晕属性优化

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_222.py |   60 +++++++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 41 insertions(+), 19 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_222.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_222.py
index 19a9280..33d750e 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_222.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_222.py
@@ -25,6 +25,10 @@
 import IPY_GameWorld
 import GameObj
 import GameMap
+import AttackCommon
+import SkillCommon
+import AICommon
+
 #---------------------------------------------------------------------
 
 #---------------------------------------------------------------------
@@ -58,7 +62,7 @@
     
     npcControl = NPCCommon.NPCControl(curNPC)
     #刷新自己仇恨度列表
-    npcControl.RefreshAngryList(tick, 1000) # 为确保踩陷阱体验,暂定1秒
+    npcControl.RefreshAngryList(tick, 500) # 为确保踩陷阱体验,
     #遍历仇恨列表找到最近的,并触发
     for i in range(0, curNPC.GetNPCAngry().GetAngryCount()):
         curAngry = curNPC.GetNPCAngry().GetAngryValueTag(i)
@@ -73,11 +77,12 @@
         
         #有NPC靠近,当超过攻击距离
         if GameWorld.GetDist(curNPC.GetPosX(), curNPC.GetPosY(), 
-                             curObj.GetPosX(), curObj.GetPosY()) > curNPC.GetSight():
+                             curObj.GetPosX(), curObj.GetPosY()) > curNPC.GetAtkDist():
             continue
         
         #进入战斗
-        NPCFight(curNPC, npcControl, curObj, tick)
+        if not NPCFight(curNPC, npcControl, curObj, tick):
+            continue
         return
            
     return
@@ -97,14 +102,24 @@
     
     if curSkill == None:
         GameWorld.Log("陷阱 = %s 数据库查找技能失败"%curNPC.GetName())
-        return
+        return True
+    
+    battleRelationType = AttackCommon.GetBattleRelationType(curNPC, curObj)
+    
+    skillBattleType = SkillCommon.GetSkillBattleType(curSkill)
+    if not AttackCommon.CheckBattleRelationType(skillBattleType, battleRelationType):
+        # PK模式的判定
+        return False
+    
+    curNPC.SetDict("traptagType", curObj.GetGameObjType())
+    curNPC.SetDict("traptagID", curObj.GetID())
     
     #触发技能, 改为统一在死亡时释放技能
     #SkillShell.NPCUseSkillTag(curNPC, curObj, curSkill, tick)
 
     #有玩家进入仇恨列表,,,自爆
     npcControl.SetKilled()
-    return
+    return True
 
 ## NPC死亡
 #  @param curNPC 当前npc
@@ -115,28 +130,35 @@
     
     #死亡NPC不能攻击, 这里设置NPC血量为1
     curNPC.SetHP(1)
-    
+
     #获得技能管理器
     skillManager = curNPC.GetSkillManager()
     curSkill = skillManager.GetSkillByIndex(0)
     if not curSkill:
         return
-    
+
+    curObj = GameWorld.GetObj(curNPC.GetDictByKey("traptagID"), curNPC.GetDictByKey("traptagType"))
     tick = GameWorld.GetGameWorld().GetTick()
-    SkillShell.NPCUseSkill(curNPC, curSkill, tick)
+    if curObj == None or GameObj.GetHP(curObj) <= 0:
+        SkillShell.NPCUseSkill(curNPC, curSkill, tick)
+        return
+    
+    AICommon.DoNPCUseSkill(curNPC, curObj, curSkill, 0, tick)
     
     GameObj.SetHP(curNPC, 0)
     return
 
-def OnGetOwnerRelation(curNPC, owner):
-    # 陷阱与主人的关系
-    
-    if owner.GetGameObjType() == IPY_GameWorld.gotPlayer:
-        #自由PK区 or 非安全区内开全体 时可攻击主人
-        if GameMap.GetAreaTypeByMapPos(owner.GetPosX(), owner.GetPosY()) == IPY_GameWorld.gatFreePK \
-            or (GameMap.GetAreaTypeByMapPos(owner.GetPosX(), owner.GetPosY()) != IPY_GameWorld.gatSafe and \
-                owner.GetAttackMode() == IPY_GameWorld.amAll):
-            return ChConfig.Type_Relation_Enemy , ChConfig.Def_PASysMessage_None
-        
-    return ChConfig.Type_Relation_Friend , ChConfig.Def_PASysMessage_None
+#===============================================================================
+# def OnGetOwnerRelation(curNPC, owner):
+#    # 陷阱与主人的关系
+#    
+#    if owner.GetGameObjType() == IPY_GameWorld.gotPlayer:
+#        #自由PK区 or 非安全区内开全体 时可攻击主人
+#        if GameMap.GetAreaTypeByMapPos(owner.GetPosX(), owner.GetPosY()) == IPY_GameWorld.gatFreePK \
+#            or (GameMap.GetAreaTypeByMapPos(owner.GetPosX(), owner.GetPosY()) != IPY_GameWorld.gatSafe and \
+#                owner.GetAttackMode() == IPY_GameWorld.amAll):
+#            return ChConfig.Type_Relation_Enemy , ChConfig.Def_PASysMessage_None
+#        
+#    return ChConfig.Type_Relation_Friend , ChConfig.Def_PASysMessage_None
+#===============================================================================
 

--
Gitblit v1.8.0