From 4815a9626bce7740bb867f056f9694c4c2f858c9 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期二, 16 四月 2019 17:29:24 +0800
Subject: [PATCH] 860312 增加锁定模式 - 只对选中目标造成伤害,适用于部分BOSS争夺副本

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBattle.py             |   23 +++++++----------------
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BaseAttack.py               |   17 ++++++++++++-----
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameSkills/SkillCommon.py    |    4 ++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py |    1 +
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py                        |    2 ++
 5 files changed, 26 insertions(+), 21 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 e0aa2d8..e48063b 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
@@ -2576,6 +2576,7 @@
         1    全体模式    IPY_GameWorld.amAll              对所有玩家都是敌对,家族区域同盟玩家除外  
         2    防卫模式    IPY_GameWorld.amCountry          本服玩家友好,他服玩家都是敌对
         5    强制模式    IPY_GameWorld.amFamily           队友、仙盟成员、同阵营友好,其他玩家敌对
+        7    锁定单一目标模式 IPY_GameWorld.amContest       只对选中目标有伤害, 目前只用于部分BOSS争夺地图
         
     场景区域
         普通区域    IPY_GameWorld.gatNormal    可根据不同PK模式PK,击杀玩家有惩罚
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 70aa00c..fc48a11 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BaseAttack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BaseAttack.py
@@ -914,12 +914,19 @@
     if attacker.GetGameObjType() != IPY_GameWorld.gotPlayer:
         return None
     
-    useSkillTagID = attacker.GetUseSkillTagID()
-    useSkillTagType = attacker.GetUseSkillTagType()
-    
-    curTag = GameWorld.GetObj(useSkillTagID, useSkillTagType)
+    curTag = None
+    if attacker.GetAttackMode() == IPY_GameWorld.amContest:
+        # 单一目标锁定模式
+        curTag = GameWorld.GetObj(attacker.SetDict(ChConfig.Def_PlayerKey_SelectObjID), 
+                                  attacker.SetDict(ChConfig.Def_PlayerKey_SelectObjType))
+        
     if not curTag:
-        return None
+        useSkillTagID = attacker.GetUseSkillTagID()
+        useSkillTagType = attacker.GetUseSkillTagType()
+        
+        curTag = GameWorld.GetObj(useSkillTagID, useSkillTagType)
+        if not curTag:
+            return None
     
     if SkillShell.GetSkillAffectTag(curSkill) == ChConfig.Def_UseSkillTag_CanAttackNPC:
         if NPCCommon.GetNpcObjOwnerIsPlayer(curTag):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index 5f467ea..72f7417 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -3005,6 +3005,8 @@
 
 #---SetDict 玩家字典KEY,不存于数据库---
 # key的长度不能超过29个字节
+Def_PlayerKey_SelectObjID = "selectID"   # 锁定模式选中,不用SetActionObj
+Def_PlayerKey_SelectObjType = "selectType"   # 锁定模式选中
 Def_PlayerKey_LuckyHitPer = "LuckyHitPer"   # 会心一击伤害万分率
 Def_PlayerKey_SuperHitPer = "SuperHitPer" # 暴击伤害万分率
 Def_PlayerKey_NormalHurt = "NormalHurt"   # 属性普通攻击增伤:普通攻击附加的固定值伤害
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBattle.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBattle.py
index 4a7be2c..6e68615 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBattle.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBattle.py
@@ -298,37 +298,28 @@
     PlayerControl.ExitPlayerConfronting(curPlayer)
     return
 
-
-##没有了对峙,需要设置选中
+# 目标死亡和消失时发包取消对象,人物死亡取消选中
+##增加锁定模式amContest,锁定情况下只能攻击目标 
 # @param None
 # @return None
 def SelectObj(index, clientData, tick):
     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
-    if curPlayer.GetPlayerAction() == IPY_GameWorld.paEvent:
+    if curPlayer.GetPlayerAction() == IPY_GameWorld.paDie:
         return
     
     if clientData.isSelect == 0:
-        curPlayer.SetActionObj(None)
-        if curPlayer.GetPlayerAction() == IPY_GameWorld.paPreparing:
-            PlayerControl.ChangePlayerAction(curPlayer, IPY_GameWorld.paNull)
+        curPlayer.SetDict(ChConfig.Def_PlayerKey_SelectObjID, 0)
+        curPlayer.SetDict(ChConfig.Def_PlayerKey_SelectObjType, 0)
         return
     
     curTag = GameWorld.GetObj(clientData.ID, clientData.Type)
     if curTag == None or curTag.IsEmpty():
         return
     
-    if curPlayer.GetPlayerAction() not in ChConfig.Def_PlayerCanEnterConfronting:
-        #GameWorld.Log("状态不对%s"%curPlayer.GetPlayerAction())
-        return
-    
-    tagObj = curPlayer.GetActionObj()
-    if tagObj:
-        if curPlayer.GetPlayerAction() == IPY_GameWorld.paPreparing:
-            if tagObj.GetGameObjType() != clientData.Type or tagObj.GetID() != clientData.ID:
-                PlayerControl.ChangePlayerAction(curPlayer, IPY_GameWorld.paNull)
             
     #这里不验证是否死亡
-    curPlayer.SetActionObj(curTag)
+    curPlayer.SetDict(ChConfig.Def_PlayerKey_SelectObjID, clientData.ID)
+    curPlayer.SetDict(ChConfig.Def_PlayerKey_SelectObjType, clientData.Type)
     
     return
 
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 1350bb9..4716142 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
@@ -1975,6 +1975,10 @@
 # @return 返回值, 伤害数量
 # @remarks 获得区域技能伤害对象数量
 def GetSkillArea_Atk_Count(attacker, curSkill):
+    if attacker.GetGameObjType() ==  IPY_GameWorld.gotPlayer and attacker.GetAttackMode() == IPY_GameWorld.amContest:
+        # 单一目标锁定模式
+        return 1 
+    
     #默认攻击最大数
     hurtCount = 50
     

--
Gitblit v1.8.0