From 46ce4580fdcf6c8e62ceeeaa52694d201ad50c50 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 11 九月 2018 20:00:29 +0800
Subject: [PATCH] 3414 【后端】骑宠争夺对boss伤害衰减buff

---
 ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py                |    3 +
 ServerPython/CoreServerGroup/GameServer/Script/PyGameData.py                                           |    1 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py                     |    1 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py                 |    9 ++-
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyGameData.py                      |    1 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FamilyRobBoss.py    |   63 +++++++++++++++++++++
 ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldBoss.py                         |   37 +++++++++++-
 ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py                                          |    1 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py       |    6 ++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py |   12 +++-
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py                        |    1 
 11 files changed, 126 insertions(+), 9 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py
index c003942..53e77ae 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py
@@ -1129,6 +1129,9 @@
     #守卫人皇
     elif dictName == ShareDefine.Def_Notify_WorldKey_FBFuncState % ChConfig.Def_FBMapID_FamilyInvade:
         PlayerFamilySWRH.OnSWRHStateChange(dictName, isOpen)
+    #骑宠争夺
+    elif dictName == ShareDefine.Def_Notify_WorldKey_DailyActionState % ShareDefine.DailyActionID_FamilyRobBoss:
+        GameWorldBoss.OnHorsePetRobBossActionChange(isOpen)
     return
 
 #------------------------------------------------------------------------------ 
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldBoss.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldBoss.py
index f822b27..9490f73 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldBoss.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldBoss.py
@@ -112,8 +112,8 @@
     isMapNeedShunt = IsMapNeedBossShunt(mapID)
     isAlive = __GetIsAlive(bossID)
     
-    GameWorld.DebugLog("击杀世界boss DoGameWorldBossOnKilled...bossID=%s,hurtValue=%s,mapID=%s,tick=%s,isMapNeedShunt=%s,isAlive=%s" 
-                       % (bossID, hurtValue, mapID, tick, isMapNeedShunt, isAlive))
+    GameWorld.Log("击杀世界boss DoGameWorldBossOnKilled...bossID=%s,hurtValue=%s,mapID=%s,tick=%s,isMapNeedShunt=%s,isAlive=%s" 
+                  % (bossID, hurtValue, mapID, tick, isMapNeedShunt, isAlive))
     if isMapNeedShunt and not isAlive:
         GameWorld.DebugLog("需要分流的地图boss被击杀,但是当前boss全局状态为死亡状态,不再更新boss击杀信息!")
         return
@@ -134,7 +134,10 @@
         # 全服广播世界boss变更信息
         Sync_BossInfo(None, [bossID])
         SendMapServerBossKilledCnt(bossID)
-
+        
+    horsePetRobBossIDList = IpyGameDataPY.GetFuncEvalCfg("FairyGrabBossID", 1)
+    if bossID in horsePetRobBossIDList:
+        OnFamilyKillHorsePetRobBoss(killPlayerName)
     return
 
 def __UpdateBossRefreshList(bossID, killedTime=0, refreshTime=0):
@@ -483,6 +486,10 @@
     bossID = IpyGameDataPY.GetFuncCfg('DogzFBRefreshCfg', 2)
     onlineCnt = __GetBossOnlineHeroCnt(bossID)[0]
     GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_BossOnlineHeroCnt % bossID, onlineCnt)
+    
+    #仙盟击杀骑宠boss数
+    if PyGameData.g_familyKillHorsePetRobBossCntDict:
+        GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_FamilyKillHorsePetRobBossCnt, PyGameData.g_familyKillHorsePetRobBossCntDict)
     return
 
 
@@ -1053,6 +1060,30 @@
 
 ## -----------------------------------------------------------------------------------------------
 
+def OnFamilyKillHorsePetRobBoss(killFamilyName):
+    ## 仙盟击杀骑宠boss
+    
+    family = GameWorld.GetFamilyManager().FindFamilyByName(killFamilyName)
+    if not family:
+        GameWorld.ErrLog("找不到该仙盟名: killFamilyName=%s" % killFamilyName)
+        return
+    
+    familyID = family.GetID()
+    PyGameData.g_familyKillHorsePetRobBossCntDict[familyID] = PyGameData.g_familyKillHorsePetRobBossCntDict.get(familyID, 0) + 1
+    GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_FamilyKillHorsePetRobBossCnt, PyGameData.g_familyKillHorsePetRobBossCntDict)
+    GameWorld.Log("骑宠争夺仙盟击杀Boss数统计: %s" % PyGameData.g_familyKillHorsePetRobBossCntDict)
+    return
+
+def OnHorsePetRobBossActionChange(isOpen):
+    ## 骑宠争夺活动状态变更
+    
+    # 无论开关都重置, 服务器活动中维护暂时不处理
+    PyGameData.g_familyKillHorsePetRobBossCntDict = {}
+    GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_FamilyKillHorsePetRobBossCnt, PyGameData.g_familyKillHorsePetRobBossCntDict)
+    
+    
+    return
+
 def MapServer_HorsePetRobBossHurtPlayer(msgInfo):
     ## 骑宠争夺boss伤血玩家同步
     GameWorld.Log("骑宠争夺boss伤血玩家同步: %s" % str(msgInfo))
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/PyGameData.py b/ServerPython/CoreServerGroup/GameServer/Script/PyGameData.py
index da04198..aaf032d 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/PyGameData.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/PyGameData.py
@@ -64,6 +64,7 @@
 
 g_familyOwnerBossInfo = {} # 地图同步上来的仙盟归属boss信息 {bossID:[curHp, maxHP, ownerFamilyID, ownerFamilyName], ...}
 g_horsePetRobBossHurtPlayerIDInfo = {} # 骑宠争夺有对boss伤血过的玩家ID信息 {bossID:{familyID:[playerID, ...], ...}, ...}
+g_familyKillHorsePetRobBossCntDict = {} # 骑宠争夺仙盟已击杀boss数 {familyID:击杀数, ...}
 
 g_todayPlayerLVDict = {} #今日玩家等级字典 {playerID:lv,..}
 g_yesterdayPlayerLVDict = {} #昨日玩家等级字典{playerID:lv,..}
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
index eb4bc97..e3c2a13 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
@@ -189,6 +189,7 @@
 Def_Notify_WorldKey_BossShuntPlayer = 'BossShuntPlayer'   # boss分流玩家信息
 Def_Notify_WorldKey_BossShuntDeadLine = 'BossShuntDeadLine'   # boss分流线路已死亡的线路
 Def_Notify_WorldKey_BossOnlineHeroCnt = 'BossOnlineHeroCnt_%s'  # boss刷新时间用的在线人数, 参数为NPCID
+Def_Notify_WorldKey_FamilyKillHorsePetRobBossCnt = 'FamilyKillHorsePetRobBossCnt'   # boss分流线路已死亡的线路
 
 Def_Notify_WorldKey_FamilyActivityDayState = "FamilyActivityDayState"  #战盟相关活动今日开启状态, 按位存储代表今日是否开启过
 
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 deaab62..35c5823 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
@@ -1748,7 +1748,7 @@
         
         aNPCHurtAddPer = PlayerControl.GetNPCHurtAddPer(atkObj)     # PVE伤害加成
         aDamagePerPVP = PlayerControl.GetDamagePerPVP(atkObj)     # 外层PVP伤害加成
-        aFinalHurtPer = PlayerControl.GetFinalHurtPer(atkObj) # 最外层伤害加成
+        aFinalHurtPer = PlayerControl.GetFinalHurtPer(atkObj) # 最外层伤害加成, 可能为负值
         aFinalHurt = PlayerControl.GetFinalHurt(atkObj)     # 最终固定伤害
         # 被动增加最终伤害
         aFinalHurt += PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(atkObj, defObj, curSkill, ChConfig.TriggerType_AttackAddFinalValue)
@@ -1765,7 +1765,7 @@
         aNPCHurtAddPer = 0  # PVE伤害加成
         aDamagePer = 0      # 外层伤害加成
         aDamagePerPVP = 0   # 外层PVP伤害加成
-        aFinalHurtPer = 0 # 最外层伤害加成
+        aFinalHurtPer = 0 # 最外层伤害加成, 可能为负值
         aFinalHurt = NPCCommon.GetFinalHurt(atkObj) # 最终固定伤害
         aFightPower = NPCCommon.GetSuppressFightPower(atkObj)
         
@@ -1845,7 +1845,13 @@
             if suppressFormulaKeyRealm in hurtDist:
                 SuppressValueRealmRate = int(eval(FormulaControl.GetCompileFormula(suppressFormulaKeyRealm, hurtDist[suppressFormulaKeyRealm])))
             
-
+        # 骑宠争夺最终伤害衰减           
+        if FamilyRobBoss.IsHorsePetRobBoss(defObj.GetNPCID()):
+            findBuff = SkillCommon.FindBuffByID(atkObj, ChConfig.Def_SkillID_HorsePetRobBossKillCntBuff)[0]
+            if findBuff:
+                reduceFinalHurtPer = findBuff.GetSkill().GetEffect(0).GetEffectValue(0)
+                aFinalHurtPer -= reduceFinalHurtPer
+                
     atkStateMark = GetObjAtkStateMark(atkObj)
     defStateMark = GetObjAtkStateMark(defObj)
     hurtFormulaKey = "%sV%s_%s" % (atkStateMark, defStateMark, atkType)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index bb34606..671c1f7 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -705,6 +705,7 @@
 Def_SkillID_DropOwnerBuff = 20040   # 掉落归属buff
 Def_SkillID_PetSignDay = 47111   # 灵宠签到属性技能, 单次签到的加成
 Def_SkillID_LFZ = 47100   # 龙凤镯技能(打怪概率经验加成)
+Def_SkillID_HorsePetRobBossKillCntBuff = 21020   # 骑宠的怨念buff
 
 
 Def_SkillID_FamilyWar_CWinBuff = 22101 # 仙盟联赛 - 连胜buff, 由连胜次数决定等级
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FamilyRobBoss.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FamilyRobBoss.py
index 2c45b06..c9c2859 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FamilyRobBoss.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FamilyRobBoss.py
@@ -23,6 +23,10 @@
 import PlayerActivity
 import PlayerControl
 import IpyGameDataPY
+import SkillCommon
+import PyGameData
+import BuffSkill
+import PlayerTJG
 import NPCCommon
 import ChConfig
 import GameObj
@@ -81,6 +85,11 @@
     if not g_familyOwnerBossHurt:
         g_familyOwnerBossHurt = FamilyOwnerBossHurt()
     return g_familyOwnerBossHurt
+
+def OnPlayerLogin(curPlayer):
+    if GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_DailyActionState % ShareDefine.DailyActionID_FamilyRobBoss):
+        __DoCheckHorsePetRobBossKillCntBuff(curPlayer, GameWorld.GetGameWorld().GetTick())
+    return
 
 def IsHorsePetRobBoss(bossID):
     ## 是否骑宠争夺bossID
@@ -577,4 +586,58 @@
     return hurtPack
 
 
+def OnFamilyKillHorsePetRobBossCntChange(tick):
+    ## 仙盟击杀骑宠boss个数变更
+    
+    playerManager = GameWorld.GetPlayerManager()
+    for i in xrange(playerManager.OnlineCount()):
+        curPlayer = playerManager.OnlineAt(i)
+        if curPlayer.IsEmpty():
+            continue
+        __DoCheckHorsePetRobBossKillCntBuff(curPlayer, tick)
+        
+    return
+
+def __DoCheckHorsePetRobBossKillCntBuff(curPlayer, tick):
+    familyID = curPlayer.GetFamilyID()
+    if not familyID:
+        return
+    
+    if PlayerTJG.GetIsTJG(curPlayer):
+        return
+    
+    killCount = PyGameData.g_familyKillHorsePetRobBossCntDict.get(familyID, 0)
+    skillTypeID = ChConfig.Def_SkillID_HorsePetRobBossKillCntBuff
+    
+    skillInfo = SkillCommon.FindBuffByID(curPlayer, skillTypeID)
+    findBuff, buffManager, buffType, findSkill = skillInfo
+    if not findSkill:
+        return
+    killLV = min(killCount, findSkill.GetSkillMaxLV())
+    
+    if findBuff:
+        buffSkill = findBuff.GetSkill()
+        if not buffSkill:
+            return
+        curBuffLV = buffSkill.GetSkillLV()
+        if curBuffLV == killLV:
+            #GameWorld.DebugLog("骑宠怨念buff等级不变: familyID=%s,killLV=%s,curBuffLV=%s" % (familyID, killLV, curBuffLV), curPlayer.GetPlayerID())
+            return
+        
+    elif not killLV:
+        #GameWorld.DebugLog("无骑宠怨念buff: familyID=%s,killLV=%s" % (familyID, killLV), curPlayer.GetPlayerID())
+        return
+    
+    if not killLV:
+        #GameWorld.DebugLog("删除骑宠怨念buff: familyID=%s,killLV=%s" % (familyID, killLV), curPlayer.GetPlayerID())
+        BuffSkill.DelBuffBySkillID(curPlayer, skillTypeID, tick)
+    else:
+        #GameWorld.DebugLog("变更骑宠怨念buff等级: familyID=%s,killLV=%s" % (familyID, killLV), curPlayer.GetPlayerID())
+        curSkill = GameWorld.GetGameData().FindSkillByType(skillTypeID, killLV)
+        BuffSkill.AddBuffNoRefreshState(curPlayer, buffType, curSkill, tick, [], curPlayer)
+        
+    return
+
+
+
 
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
index 58f3f7b..d7caf38 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
@@ -108,6 +108,7 @@
 import PlayerSpringSale
 import PlayerFairyCeremony
 import ChNetSendPack
+import FamilyRobBoss
 import PyGameData
 import PlayerCoin
 import PlayerGeTui
@@ -537,11 +538,13 @@
     SyncPackDownloadAward(curPlayer)
     # 登录触发功能开启(老号处理)
     GameFuncComm.DoFuncOpenLogic(curPlayer)
-	# 神兽
+    # 神兽
     PlayerDogz.OnPlayerLogin(curPlayer)
-	# 神兽副本
+    # 神兽副本
     GameLogic_Dogz.SyncNPCRefreshTime(curPlayer.GetID())
-
+    # 骑宠
+    FamilyRobBoss.OnPlayerLogin(curPlayer)
+    
     # 上线查询一次充值订单
     curPlayer.SendDBQueryRecharge()
     
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py
index 761b7fd..1d6e6af 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py
@@ -93,6 +93,7 @@
 import PlayerVip
 import PlayerDiceEx
 import IpyGameDataPY
+import FamilyRobBoss
 import QuestManager
 import PyGameData
 import PlayerTJG
@@ -1228,6 +1229,11 @@
             PyGameData.g_bossShuntDeadLine = eval(msgValue)
             return
         
+        if key == ShareDefine.Def_Notify_WorldKey_FamilyKillHorsePetRobBossCnt:
+            PyGameData.g_familyKillHorsePetRobBossCntDict = eval(msgValue)
+            FamilyRobBoss.OnFamilyKillHorsePetRobBossCntChange(tick)
+            return
+        
         if key == ShareDefine.Def_Notify_WorldKey_FBEnterTimeLimiitMapID:
             PyGameData.FBEnterTimeLimiitMapID = eval(msgValue)
             return
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyGameData.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyGameData.py
index d742a57..fb5dc4c 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyGameData.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyGameData.py
@@ -42,6 +42,7 @@
 VSFamilyInfo = [] # 仙盟联赛开启的副本信息 [是否最终决赛场次, roundNum, groupID, [familyIDA, failyIDB], [familyNameA, familyNameB], [familyRankA, familyRankB]]
 g_familyBossOpenCountDict = {} # 仙盟boss开启次数 {familyID:次数, ...}
 g_familyBossPlayer = {} # 仙盟boss参与玩家 {familyID:[playerID, ...], ...}
+g_familyKillHorsePetRobBossCntDict = {} # 骑宠争夺仙盟已击杀boss数 {familyID:击杀数, ...}
 
 g_PassiveEffManager = None  # 被动技能(效果)单例
 
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
index eb4bc97..e3c2a13 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
@@ -189,6 +189,7 @@
 Def_Notify_WorldKey_BossShuntPlayer = 'BossShuntPlayer'   # boss分流玩家信息
 Def_Notify_WorldKey_BossShuntDeadLine = 'BossShuntDeadLine'   # boss分流线路已死亡的线路
 Def_Notify_WorldKey_BossOnlineHeroCnt = 'BossOnlineHeroCnt_%s'  # boss刷新时间用的在线人数, 参数为NPCID
+Def_Notify_WorldKey_FamilyKillHorsePetRobBossCnt = 'FamilyKillHorsePetRobBossCnt'   # boss分流线路已死亡的线路
 
 Def_Notify_WorldKey_FamilyActivityDayState = "FamilyActivityDayState"  #战盟相关活动今日开启状态, 按位存储代表今日是否开启过
 

--
Gitblit v1.8.0