From 2c3def243f5d8df019c2c7059a3647489058c14e Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 26 七月 2022 16:37:28 +0800
Subject: [PATCH] 9673 【后端】【越南】【BT7】【主干】古神战场增加玩家掉落BUFF功能

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py                              |   10 +++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_CrossBattlefield.py |   80 +++++++++++++++++++++++++++++++++------
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventShell.py                                    |    4 ++
 3 files changed, 81 insertions(+), 13 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventShell.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventShell.py
index 53c4a67..fcfd00c 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventShell.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventShell.py
@@ -5163,6 +5163,10 @@
     
     if curNPC.GetType() != ChConfig.ntTouchKill:
         return
+    
+    if not FBLogic.OnCanMoveTouchNPC(curPlayer, curNPC, tick):
+        return
+    
     #副本
     FBLogic.OnMoveTouchNPC(curPlayer, curNPC, tick)
     
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py
index c4dcefd..e04dbeb 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py
@@ -2287,6 +2287,16 @@
     
     return
 
+def OnCanMoveTouchNPC(curPlayer, curNPC, tick):
+    ## 检查可否触碰NPC逻辑
+    do_FBLogic_ID = __GetFBLogic_MapID(GameWorld.GetMap().GetMapID())
+    
+    callFunc = GameWorld.GetExecFunc(FBProcess, "GameLogic_%s.%s" % (do_FBLogic_ID, "OnCanMoveTouchNPC"))
+    
+    if callFunc:
+        return callFunc(curPlayer, curNPC, tick)
+    return True
+
 def OnMoveTouchNPC(curPlayer, curNPC, tick):
     ## 触碰NPC处理逻辑
     do_FBLogic_ID = __GetFBLogic_MapID(GameWorld.GetMap().GetMapID())
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_CrossBattlefield.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_CrossBattlefield.py
index 32e3001..9d60245 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_CrossBattlefield.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_CrossBattlefield.py
@@ -121,12 +121,12 @@
     def getWorldAllHelpInfo(self, tick):
         worldInfo = {"superItemInfo":self.superItemInfo, "crystalFactionInfo":self.crystalFactionInfo,
                      "factionBuffNPCInfo":self.factionBuffNPCInfo, "crystalAtkedList":self.crystalAtkedDict.keys()}
-        worldInfo.update({"eventNPCID":self.eventNPCID, "eventNPCPos":self.eventNPCPos, 
+        worldInfo.update({"eventNPCID":self.eventNPCID, "eventNPCPos":self.eventNPCPos,
                           "eventEndTick":max(0, self.eventEndTick - tick), "eventNPCHP":self.eventNPCHP})
         return worldInfo
     
     def updEventNPCHelp(self, tick):
-        self.worldHelpDict.update({"eventNPCID":self.eventNPCID, "eventNPCPos":self.eventNPCPos, 
+        self.worldHelpDict.update({"eventNPCID":self.eventNPCID, "eventNPCPos":self.eventNPCPos,
                                    "eventEndTick":max(0, self.eventEndTick - tick), "eventNPCHP":self.eventNPCHP})
         return
     
@@ -1464,6 +1464,11 @@
     
     if atkObjType == IPY_GameWorld.gotPlayer:
         NotifyBattlefieldHelp(False, atkObj) # 击杀的暂只实时通知自己
+        
+        # 玩家被玩家击杀,掉落个人buff
+        if defObjType == IPY_GameWorld.gotPlayer:
+            DoDropPersonBuffOnKilled(atkObj, defObj, tick)
+            
     return
 
 def DoFB_NPCDead(curNPC):
@@ -1671,17 +1676,17 @@
     GameWorld.Log("zoneID=%s,hmNum=%s,allCallPlayerIDList=%s" % (zoneID, hmNum, allCallPlayerIDList), fbPropertyID)
     
     gameWorld = GameWorld.GetGameWorld()
-    drDict = {"mapID":GameWorld.GetMap().GetMapID(), "realMapID":gameWorld.GetRealMapID(), "copyMapID":gameWorld.GetCopyMapID(), 
-              "zoneID":zoneID, "funcLineID":funcLineID, "fbPropertyID":fbPropertyID, "hmNum":hmNum, 
-              "superItemInfo":worldObj.superItemInfo, "finalSuperItemPlayerID":finalSuperItemPlayerID, 
-              "crystalFactionInfo":worldObj.crystalFactionInfo, "callTeamInfo":callTeamInfo, 
+    drDict = {"mapID":GameWorld.GetMap().GetMapID(), "realMapID":gameWorld.GetRealMapID(), "copyMapID":gameWorld.GetCopyMapID(),
+              "zoneID":zoneID, "funcLineID":funcLineID, "fbPropertyID":fbPropertyID, "hmNum":hmNum,
+              "superItemInfo":worldObj.superItemInfo, "finalSuperItemPlayerID":finalSuperItemPlayerID,
+              "crystalFactionInfo":worldObj.crystalFactionInfo, "callTeamInfo":callTeamInfo,
               "winnerFaction":winnerFaction, "fightTimeTotal":(int(time.time()) - worldObj.startTime)}
     factionInfoList = []
     for faction in [ShareDefine.CampType_Justice, ShareDefine.CampType_Evil]:
         factionObj = GetBattleFactionObj(faction)
         rankPlayerList = []
         for battleObj in factionObj.battlePlayerSortList[:syncRankCount]:
-            rankPlayerList.append({"name":battleObj.name, "job":battleObj.job, "score":battleObj.score, 
+            rankPlayerList.append({"name":battleObj.name, "job":battleObj.job, "score":battleObj.score,
                                    "killCount":battleObj.killCount, "crystalCollCnt":battleObj.crystalCollCnt})
             
         callPlayerName = ""
@@ -1691,11 +1696,11 @@
                 callPlayerName = callBattleObj.name
                 break
             
-        factionInfoList.append({"faction":faction, "rankPlayerList":rankPlayerList, "callPlayerName":callPlayerName, 
+        factionInfoList.append({"faction":faction, "rankPlayerList":rankPlayerList, "callPlayerName":callPlayerName,
                                 "superItemPlayerName":factionObj.superItemPlayerName})
         
     costTime = int((tick - GameWorld.GetGameFB().GetFBStepTick()) / 1000.0)
-    overDict = {"winnerFaction":winnerFaction, "factionInfoList":factionInfoList, FBCommon.Over_costTime:costTime, 
+    overDict = {"winnerFaction":winnerFaction, "factionInfoList":factionInfoList, FBCommon.Over_costTime:costTime,
                 "finalSuperItemPlayerName":finalSuperItemPlayerName}
     
     scoreKingID, scoreKingName = 0, "" # 本场积分王: 获胜方在线第一名积分
@@ -1749,8 +1754,8 @@
                           factionBuffCollCnt, personBuffCollCnt, crystalCollCnt, wallCollCnt]
             battlePlayerList.append(playerInfo)
             
-            drPlayerList.append({"playerID":playerID, "accID":battleObj.accID, "fightPower":battleObj.fightPower, 
-                                 "score":score, "auraScore":auraScore, "wallCollCnt":wallCollCnt, 
+            drPlayerList.append({"playerID":playerID, "accID":battleObj.accID, "fightPower":battleObj.fightPower,
+                                 "score":score, "auraScore":auraScore, "wallCollCnt":wallCollCnt,
                                  "superItemAwardCnt":superItemAwardCnt, "superItemContribution":battleObj.superItemContribution})
             
             player = copyMapMgr.FindPlayerByID(playerID)
@@ -1762,8 +1767,8 @@
             overDict.update({FBCommon.Over_rank:rank, "score":score, "highScoreToday":highScoreToday, "onlineTimes":onlineTimes, "faction":faction})
             FBCommon.NotifyFBOver(player, ChConfig.Def_FBMapID_CrossBattlefield, lineID, isWinner, overDict)
             
-        drFactionInfo = {"faction":faction, "score":factionObj.score, "hurtBossPlayerDict":factionObj.hurtBossPlayerDict, 
-                         "superItemProgress":factionObj.superItemProgress, "superItemPlayerID":factionObj.superItemPlayerID, 
+        drFactionInfo = {"faction":faction, "score":factionObj.score, "hurtBossPlayerDict":factionObj.hurtBossPlayerDict,
+                         "superItemProgress":factionObj.superItemProgress, "superItemPlayerID":factionObj.superItemPlayerID,
                          "drPlayerList":drPlayerList}
         drDict["faction_%s" % faction] = drFactionInfo
         
@@ -1834,6 +1839,55 @@
             NotifyBattlefieldHelp()
     return
 
+def DoDropPersonBuffOnKilled(atkPlayer, defPlayer, tick):
+    dropPersonBuffNPCList = IpyGameDataPY.GetFuncEvalCfg("CrossBattlefieldDropPersonBuff", 1)
+    if not dropPersonBuffNPCList:
+        return
+    
+    dropNPCIDList = []
+    for npcID in dropPersonBuffNPCList:
+        npcData = GameWorld.GetGameData().FindNPCDataByID(npcID)
+        if not npcData:
+            continue
+        buffID = npcData.GetSkill1()
+        if not buffID:
+            continue
+        findBuff = SkillCommon.FindBuffByID(defPlayer, buffID)[0]
+        if not findBuff:
+            continue
+        
+        if findBuff.GetLayer():
+            dropNPCIDList.extend([npcID] * findBuff.GetLayer())
+        else:
+            dropNPCIDList.append(npcID)
+            
+    count = 0
+    defPosX, defPosY = defPlayer.GetPosX(), defPlayer.GetPosY()
+    while dropNPCIDList and count < 100:
+        count += 1
+        dropX, dropY = GameMap.GetNearbyPosByDis(defPosX, defPosY, 5)
+        if not dropX:
+            continue
+        npcID = dropNPCIDList.pop(0)
+        NPCCommon.SummonMapNpc(npcID, dropX, dropY, playerID=atkPlayer.GetPlayerID())
+        
+    return
+
+def OnCanMoveTouchNPC(curPlayer, curNPC, tick):
+    ## 检查可否触碰NPC逻辑
+    summonPlayerID = curNPC.GetDictByKey(ChConfig.Def_NPC_Dict_SummonMapNPCPlayerID)
+    if not summonPlayerID:
+        return True
+    if summonPlayerID == curPlayer.GetPlayerID():
+        #GameWorld.DebugLog("OnCanMoveTouchNPC summonPlayerID=%s,owner=True" % summonPlayerID, curNPC.GetID())
+        return True
+    protectTick = IpyGameDataPY.GetFuncCfg("CrossBattlefieldDropPersonBuff", 2) * 1000
+    passTick = tick - curNPC.GetActionTick()
+    if passTick < protectTick:
+        #GameWorld.DebugLog("OnCanMoveTouchNPC in protect! passTick=%s < protectTick=%s" % (passTick, protectTick), curNPC.GetID())
+        return False
+    return True
+
 def OnMoveTouchNPC(curPlayer, curNPC, tick):
     ## 触碰NPC处理逻辑
     npcID = curNPC.GetNPCID()

--
Gitblit v1.8.0