From d86939995b8cfece66b936897dbbd3fa46571a21 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期五, 07 十二月 2018 12:37:22 +0800
Subject: [PATCH] 5200 【后端】【1.3.100】骑宠争夺boss每只boss伤害降低,增加灵宠的灵宠也要跟着降低

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/EffGetSet.py                 |    2 +-
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PetControl.py               |    1 +
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameObj.py                         |    6 ++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py            |   12 +++++++-----
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py |   21 +++++++++++++++++----
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTJG.py                |    3 ++-
 6 files changed, 34 insertions(+), 11 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 630dfbb..4b346e0 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
@@ -1875,13 +1875,14 @@
         
     else:
         aIgnoreDefRate = 0  # 无视防御比率
+        aFinalHurtPer = GameObj.GetPetDamPer(atkObj) # 最外层伤害加成, 可能为负值
         aSkillAtkRate = NPCCommon.GetSkillAtkRate(atkObj)   # 技能攻击力加成
         if atkObjType == IPY_GameWorld.gotNPC and atkObj.GetGameNPCObjType() == IPY_GameWorld.gnotPet:
             aSkillAtkRate += atkObj.GetSkillAtkRate()
+            
         aNPCHurtAddPer = 0  # PVE伤害加成
         aDamagePer = 0      # 外层伤害加成
         aDamagePerPVP = 0   # 外层PVP伤害加成
-        aFinalHurtPer = 0 # 最外层伤害加成, 可能为负值
         aFinalHurt = NPCCommon.GetFinalHurt(atkObj) # 最终固定伤害
         aFightPower = NPCCommon.GetSuppressFightPower(atkObj)
         
@@ -1960,10 +1961,22 @@
             suppressFormulaKeyRealm = "PVESuppressValueRealm"
             if suppressFormulaKeyRealm in hurtDist:
                 SuppressValueRealmRate = int(eval(FormulaControl.GetCompileFormula(suppressFormulaKeyRealm, hurtDist[suppressFormulaKeyRealm])))
+        
+        
+    # 骑宠争夺最终伤害衰减           
+    if defObjType == IPY_GameWorld.gotNPC and FamilyRobBoss.IsHorsePetRobBoss(defObj.GetNPCID()):
+        ownerPlayer = None
+        # 召唤兽和宠物需要从人物获取状态
+        if atkObj.GetGameObjType() == IPY_GameWorld.gotNPC:
+            if atkObj.GetGameNPCObjType() == IPY_GameWorld.gnotPet:
+                ownerPlayer = PetControl.GetPetOwner(atkObj)
+            elif atkObj.GetGameNPCObjType() == IPY_GameWorld.gnotSummon:
+                ownerPlayer = NPCCommon.GetSummonNPCOwner(IPY_GameWorld.gotPlayer, atkObj)
+        else:
+            ownerPlayer = atkObj
             
-        # 骑宠争夺最终伤害衰减           
-        if FamilyRobBoss.IsHorsePetRobBoss(defObj.GetNPCID()):
-            findBuff = SkillCommon.FindBuffByID(atkObj, ChConfig.Def_SkillID_HorsePetRobBossKillCntBuff)[0]
+        if ownerPlayer:
+            findBuff = SkillCommon.FindBuffByID(ownerPlayer, ChConfig.Def_SkillID_HorsePetRobBossKillCntBuff)[0]
             if findBuff:
                 reduceFinalHurtPer = findBuff.GetSkill().GetEffect(0).GetEffectValue(0)
                 aFinalHurtPer -= reduceFinalHurtPer
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameObj.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameObj.py
index c779b70..a212d18 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameObj.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameObj.py
@@ -86,3 +86,9 @@
     state = curState & pow(2, pyState) 
     return state
 
+
+def GetPetDamPer(gameObj): return gameObj.GetDictByKey(ChConfig.Def_PlayerKey_AttrPetDamPer)
+def SetPetDamPer(gameObj, value): 
+    gameObj.SetDict(ChConfig.Def_PlayerKey_AttrPetDamPer, value)
+    if gameObj.GetGameObjType() == IPY_GameWorld.gotPlayer:
+        gameObj.SendPropertyRefresh(ShareDefine.CDBPlayerRefresh_PetDamPer, value, False)
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 a43d19e..023be02 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PetControl.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PetControl.py
@@ -381,6 +381,7 @@
     rolePet.SetMinAtk(PlayerControl.GetPetMinAtk(curPlayer))
     rolePet.SetMaxAtk(PlayerControl.GetPetMaxAtk(curPlayer))
     rolePet.SetSkillAtkRate(PlayerControl.GetPetSkillAtkRate(curPlayer))
+    GameObj.SetPetDamPer(rolePet, GameObj.GetPetDamPer(curPlayer))
     #rolePet.SetMAtkMin(curPlayer.GetMAtkMin())
     #rolePet.SetMAtkMax(curPlayer.GetMAtkMax())
     rolePet.SetHit(curPlayer.GetHit())
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
index 4720867..638fcb1 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
@@ -6542,11 +6542,13 @@
 def GetPetMaxAtk(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_AttrPetMaxAtk)
 def SetPetMaxAtk(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_AttrPetMaxAtk, value)
 
-#---宠物伤害百分比提升----
-def GetPetDamPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_AttrPetDamPer)
-def SetPetDamPer(curPlayer, value): 
-    curPlayer.SetDict(ChConfig.Def_PlayerKey_AttrPetDamPer, value)
-    curPlayer.SendPropertyRefresh(ShareDefine.CDBPlayerRefresh_PetDamPer, value, False)
+#---宠物伤害百分比提升----移到GameObj下
+#===============================================================================
+# def GetPetDamPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_AttrPetDamPer)
+# def SetPetDamPer(curPlayer, value): 
+#    curPlayer.SetDict(ChConfig.Def_PlayerKey_AttrPetDamPer, value)
+#    curPlayer.SendPropertyRefresh(ShareDefine.CDBPlayerRefresh_PetDamPer, value, False)
+#===============================================================================
 #---宠物技能伤害百分比提升----
 def GetPetSkillAtkRate(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_PetSkillAtkRate)
 def SetPetSkillAtkRate(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_PetSkillAtkRate, value)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTJG.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTJG.py
index 41b58dd..32d3417 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTJG.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTJG.py
@@ -52,6 +52,7 @@
 import ChEquip
 import QuestCommon
 import random
+import GameObj
 
 # 可吞噬的装备位
 Def_EatItem_EquipPlace = [
@@ -326,7 +327,7 @@
     aSkillAtkRate = curPlayer.GetSkillAtkRate()    # 技能攻击力加成
     petMinAtk = PlayerControl.GetPetMinAtk(curPlayer)   #灵宠最小攻击
     petMaxAtk = PlayerControl.GetPetMaxAtk(curPlayer)   #灵宠最大攻击
-    petDamPer = PlayerControl.GetPetDamPer(curPlayer)   #灵宠增加伤害
+    petDamPer = GameObj.GetPetDamPer(curPlayer)   #灵宠增加伤害
     atkSpeed = PlayerControl.GetAtkSpeed(curPlayer) # 攻击速度
     aIgnoreDefRate = curPlayer.GetIgnoreDefRate()  # 无视防御比率
     aLuckyHit = curPlayer.GetLuckyHitVal()  # 会心一击
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/EffGetSet.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/EffGetSet.py
index bef1678..f19857e 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/EffGetSet.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/EffGetSet.py
@@ -81,7 +81,7 @@
    [lambda curObj:curObj.GetGoldFoundRate(), lambda curObj, value:curObj.SetGoldFoundRate(value), IPY_PlayerDefine.CDBPlayerRefresh_GoldFoundRate, 1, 0],                          # 掉落金钱值增加
    [lambda curObj:PlayerControl.GetPetMinAtk(curObj), lambda curObj, value:PlayerControl.SetPetMinAtk(curObj, value), 0, 0, 0],      # 宠物最小攻击
    [lambda curObj:PlayerControl.GetPetMaxAtk(curObj), lambda curObj, value:PlayerControl.SetPetMaxAtk(curObj, value), 0, 0, 0],      # 宠物最大攻击
-   [lambda curObj:PlayerControl.GetPetDamPer(curObj), lambda curObj, value:PlayerControl.SetPetDamPer(curObj, value), 0, 0, 0],      # 宠物伤害百分比提升
+   [lambda curObj:GameObj.GetPetDamPer(curObj), lambda curObj, value:GameObj.SetPetDamPer(curObj, value), 0, 0, 0],      # 宠物伤害百分比提升
    [lambda curObj:PlayerControl.GetPerLVAtk(curObj), lambda curObj, value:PlayerControl.SetPerLVAtk(curObj, value), 0, 0, 0],        # 每1级+%s攻击, 数值取万分率,支持小数算法
    [lambda curObj:PlayerControl.GetPerLVMaxHP(curObj), lambda curObj, value:PlayerControl.SetPerLVMaxHP(curObj, value), 0, 0, 0],    # 每1级+%s生命, 数值为固定值
    

--
Gitblit v1.8.0