From d77abb724151826fbfcb23f6e1bc5d232f155535 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 21 十一月 2018 19:16:52 +0800
Subject: [PATCH] 4926 【后端】【1.2】【1.3】BOSS归属特殊规则

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/Player_Attack_NormalNPC.py    |    3 +++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/Pet_Attack_NormalNPC.py       |    4 ++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/SummonNPC_Attack_NormalNPC.py |    4 ++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_186.py                          |    8 ++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameSkills/SkillCommon.py                  |    2 +-
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py               |    7 ++++++-
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/ChNPC.py                                     |    8 +++++++-
 7 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py
index 07d6881..129f1b8 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py
@@ -58,6 +58,7 @@
 import NetPackCommon
 import FamilyRobBoss
 import FBCommon
+import ChNPC
 
 import datetime
 import math
@@ -2457,7 +2458,7 @@
 # @param curObjDetel 对象实例
 # @return 返回值无意义
 # @remarks 理对象死亡逻辑
-def DoLogic_ObjDead(curObjDetel):
+def DoLogic_ObjDead(atkObj, curObjDetel, curSkill, tick):
     if GameObj.GetHP(curObjDetel) > 0:
         return
     
@@ -2468,6 +2469,10 @@
         return
     
     #---NPC处理---
+    if not ChNPC.OnCheckCanDie(atkObj, curObjDetel, curSkill, tick):
+        GameObj.SetHP(curObjDetel, 1)
+        return
+    
     npcControl = NPCCommon.NPCControl(curObjDetel)
     npcControl.SetKilled()
     return
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/Pet_Attack_NormalNPC.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/Pet_Attack_NormalNPC.py
index e60831f..fabd3ff 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/Pet_Attack_NormalNPC.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/Pet_Attack_NormalNPC.py
@@ -110,6 +110,10 @@
         #执行击杀NPC逻辑
         curPlayer = PetControl.GetPetOwner(curPet)  # 宠物主人
         
+        if not ChNPC.OnCheckCanDie(curPlayer, curTagNPC, skill, tick):
+            GameObj.SetHP(curTagNPC, 1)
+            return
+        
         if curPlayer != None:
             FBLogic.DoFB_Player_KillNPC(curPlayer, curTagNPC, tick)
             NPCCommon.OnPlayerAttackNPCDie(curTagNPC, curPlayer, skill)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/Player_Attack_NormalNPC.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/Player_Attack_NormalNPC.py
index 11757cc..ae6aa90 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/Player_Attack_NormalNPC.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/Player_Attack_NormalNPC.py
@@ -110,6 +110,9 @@
         return
     
     if GameObj.GetHP(curTagNormalNPC) <= 0:
+        if not ChNPC.OnCheckCanDie(curPlayer, curTagNormalNPC, skill, tick):
+            GameObj.SetHP(curTagNormalNPC, 1)
+            return
         #执行击杀NPC逻辑
         FBLogic.DoFB_Player_KillNPC(curPlayer , curTagNormalNPC , tick)
         NPCCommon.OnPlayerAttackNPCDie(curTagNormalNPC, curPlayer, skill)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/SummonNPC_Attack_NormalNPC.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/SummonNPC_Attack_NormalNPC.py
index 36b3651..5d3bdc6 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/SummonNPC_Attack_NormalNPC.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/SummonNPC_Attack_NormalNPC.py
@@ -143,6 +143,10 @@
     #玩家击杀NPC副本触发器
     curPlayer = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotPlayer, curSummonNPC)
     
+    if not ChNPC.OnCheckCanDie(curPlayer, curTagNPC, skill, tick):
+        GameObj.SetHP(curTagNPC, 1)
+        return
+    
     #2011-05-12 chenxuewei 有没主人都只要通知一次即可,避免重复通知
     if curPlayer != None:
         FBLogic.DoFB_Player_KillNPC(curPlayer, curTagNPC, tick)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/ChNPC.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/ChNPC.py
index 7a50f53..4fcdbd0 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/ChNPC.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/ChNPC.py
@@ -134,7 +134,13 @@
     callFunc(atkObj, curNPC, skill, tick)
     
     PlayerActivity.OnAttackNPCActivity(atkObj, curNPC)
-    
+
+def OnCheckCanDie(atkObj, curNPC, skill, tick):
+    callFunc = GameWorld.GetExecFunc(NPCAI, "AIType_%d.%s"%(curNPC.GetAIType(), "OnCheckCanDie"))
+    if callFunc == None:
+        return True
+    return callFunc(atkObj, curNPC, skill, tick)
+
 #---------------------------------------------------------------------
 ## 初始化NPC 
 #  @param tick 当前时间
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_186.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_186.py
index 0df17e2..64a7047 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_186.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_186.py
@@ -381,6 +381,14 @@
         PlayerState.SetBossStateTick(atkObj, tick)
     return
 
+def OnCheckCanDie(atkObj, curNPC, skill, tick):
+    ## 检查NPC是否可死亡
+    tagObj = __RefreshDropOwner(curNPC, tick, 0)
+    if not atkObj or not tagObj:
+        GameWorld.ErrLog("Boss当前状态下不可以死亡!npcID=%s" % curNPC.GetNPCID())
+        return False
+    return True
+
 ## NPC被玩家杀死
 def OnAttackDieByPlayer(curNPC, curPlayer, skill):
     tick = GameWorld.GetGameWorld().GetTick()
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameSkills/SkillCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameSkills/SkillCommon.py
index 1913474..46478a0 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameSkills/SkillCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameSkills/SkillCommon.py
@@ -1252,7 +1252,7 @@
     
     #无法找到Buff拥有者
     if not buffOwner:
-        AttackCommon.DoLogic_ObjDead(curObj)
+        AttackCommon.DoLogic_ObjDead(None, curObj, curSkill, tick)
         return
         
     #NPC需要手动添加伤血和仇恨, 因为无调用DoAttack

--
Gitblit v1.8.0