From 7a58a47083cb8c7920733c8378ca41964e9330e4 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 02 三月 2020 20:07:26 +0800
Subject: [PATCH] 8389 【后端开发】天星塔挑战榜
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_ZhuXianBoss.py | 310 +++++++++++++++++----------------------------------
1 files changed, 104 insertions(+), 206 deletions(-)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_ZhuXianBoss.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_ZhuXianBoss.py
index c436a58..2ed99be 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_ZhuXianBoss.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_ZhuXianBoss.py
@@ -4,7 +4,7 @@
#
##@package GameWorldLogic.FBProcess.GameLogic_ZhuXianBoss
#
-# @todo:诛仙boss
+# @todo:诛仙boss/雷罚BOSS
# @author xdh
# @date 2019-01-18
# @version 1.0
@@ -18,7 +18,7 @@
import FBCommon
import GameWorld
import IPY_GameWorld
-import GameWorldProcess
+import PlayerActivity
import IpyGameDataPY
import ChConfig
import PyGameData
@@ -27,28 +27,18 @@
import ItemCommon
import ChPyNetSendPack
import ShareDefine
-import EventShell
-import NPCCustomRefresh
import PlayerSuccess
-import PlayerActivity
+import GameObj
import NetPackCommon
import ItemControler
-import PlayerMagicWeapon
-import PlayerBossReborn
-import PlayerFairyCeremony
-import PlayerWeekParty
+import PlayerActLogin
import EventReport
-FBDict_StartTick = 'FBDict_StartTick%s' #开始时间
-FBDict_Speed = 'FBDict_Speed%s' #掉血速度 /s
-FBDict_RemainHP = 'FBDict_RemainHP%s' #剩余时间
FBPlayerDict_EncourageLV = 'FBPlayerDict_EncourageLV' # 鼓舞等级
FBDict_IsOver = 'FBDict_IsOver' #是否已结算, 结算时的tick
-FBDict_IsReduceing = 'FBDict_IsReduceing%s' #是否掉血中
FBPlayerDict_Rank = "FBPlayerDict_Rank" # 玩家排名
-FBDict_BossTotalHP = 'FBDict_BossTotalHP%s' #BOSS血量
-g_npcHurtDict = {}
+g_heroHurtDict = {} #{playerID:hurt}
def OnFBPlayerOnLogin(curPlayer):
@@ -81,11 +71,9 @@
if curPlayer.GetOfficialRank() < ipyData.GetRealmLV():
return
- #诛仙总评分
-
enterCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_EnterFbCntDay % ChConfig.Def_FBMapID_ZhuXianBoss)
- if enterCnt >= FBCommon.GetEnterFBMaxCnt:
+ if enterCnt >= FBCommon.GetEnterFBMaxCnt(curPlayer, ChConfig.Def_FBMapID_ZhuXianBoss):
if not curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ZhuXianBossHelpCnt):
return
if not curPlayer.GetFamilyID():
@@ -134,15 +122,7 @@
# @return 返回值无意义
# @remarks 开启副本
def OnOpenFB(tick):
- lineID = GameWorld.GetGameWorld().GetPropertyID() - 1
- bossID = CurFBLineBOSSID(lineID)
- if not bossID:
- return
- key = ShareDefine.Def_Notify_WorldKey_GameWorldBossReborn % bossID
- GameWorld.GetGameWorld().SetGameWorldDict(key, 1)
- GameWorld.DebugLog(' 刷BOSSbossID=%s' % bossID)
- ipyData = IpyGameDataPY.GetIpyGameData('ZhuXianBoss', lineID)
- GameWorld.GetGameWorld().SetGameWorldDict(FBDict_BossTotalHP%lineID, ipyData.GetKillTime() * 1000)
+
return
## 进副本
@@ -150,30 +130,30 @@
# @param tick
# @return None
def DoEnterFB(curPlayer, tick):
+ global g_heroHurtDict
playerID = curPlayer.GetPlayerID()
- mapID = GameWorld.GetMap().GetMapID()
-
+
lineID = GameWorld.GetGameWorld().GetPropertyID() - 1
-
+ gameFB = GameWorld.GetGameFB()
playerCnt = GameWorld.GetGameWorld().GetMapCopyPlayerManager().GetPlayerCount()
GameWorld.DebugLog("DoEnterFB...playerCnt=%s,lineID=%s" % (playerCnt, lineID), playerID)
-
- if lineID < 0:
+ overTick = gameFB.GetGameFBDictByKey(FBDict_IsOver)
+ if lineID < 0 or overTick:
PlayerControl.PlayerLeaveFB(curPlayer)
return
hadDelTicket = FBCommon.GetHadDelTicket(curPlayer)
if not hadDelTicket:
FBCommon.SetHadDelTicket(curPlayer)
PyGameData.g_fbPickUpItemDict.pop(playerID, 0)
+ g_heroHurtDict.pop(playerID, 0)
# if playerCnt == 1:
# posX, posY = IpyGameDataPY.GetFuncEvalCfg('ZhuXianBossFirstPos')
# GameWorld.ResetPlayerPos(curPlayer, posX, posY)
EventReport.WriteEvent_FB(curPlayer, ChConfig.Def_FBMapID_ZhuXianBoss, 0, ChConfig.CME_Log_Start)
UpdateHurtInfo(curPlayer, 0, True)
+
- UpdateHPReduceSpeed(tick)
- gameFB = GameWorld.GetGameFB()
# 上鼓舞buff
encourageLV = gameFB.GetPlayerGameFBDictByKey(playerID, FBPlayerDict_EncourageLV)
if encourageLV > 0:
@@ -181,7 +161,7 @@
else:
FBCommon.SendFBEncourageInfo(curPlayer, encourageLV)
- #DoFBHelp(curPlayer, tick)
+ DoFBHelp(curPlayer, tick)
return
##关闭副本
@@ -191,10 +171,7 @@
def OnCloseFB(tick):
gameWorld = GameWorld.GetGameWorld()
lineID = gameWorld.GetPropertyID() - 1
- gameWorld.SetGameWorldDict(FBDict_StartTick % lineID, 0)
- gameWorld.SetGameWorldDict(FBDict_Speed % lineID, 0)
- gameWorld.SetGameWorldDict(FBDict_RemainHP % lineID, 0)
-
+ PyGameData.g_ZhuXianBossPlayerHurtDict[lineID] = {}
gameWorld.SetPropertyID(0)
return
@@ -203,22 +180,9 @@
# @param tick 时间戳
# @return 无意义
def DoExitFB(curPlayer, tick):
- global g_npcHurtDict
gameWorld = GameWorld.GetGameWorld()
# 清除鼓舞buff
FBCommon.ClearEncourageBuff(curPlayer, tick)
- #最后一人
- if gameWorld.GetMapCopyPlayerManager().GetPlayerCount() == 1:
- lineID = gameWorld.GetPropertyID() - 1
- PyGameData.g_ZhuXianBossPlayerHurtDict[lineID] = {}
- g_npcHurtDict[lineID] = {}
- gameWorld.SetGameWorldDict(FBDict_StartTick % lineID, 0)
- GameWorld.GetGameFB().ClearGameFBDict()
- GameWorldProcess.CloseFB(tick)
- return
-
- UpdateHPReduceSpeed(tick, True)
-
return
##玩家主动离开副本.
@@ -232,8 +196,6 @@
playerHurtDict = PyGameData.g_ZhuXianBossPlayerHurtDict.get(lineID, {})
playerHurtDict.pop(curPlayer.GetPlayerID(), 0)
PyGameData.g_ZhuXianBossPlayerHurtDict[lineID] = playerHurtDict
- if not playerHurtDict: #榜上没人,停止掉血
- StopReduceHP(lineID, tick)
return
##玩家切换地图
@@ -254,12 +216,13 @@
# @return None
def DoFBHelp(curPlayer, tick):
#伤害排行信息
+ if GameWorld.GetGameFB().GetGameFBDictByKey(FBDict_IsOver):
+ return
hurtInfo = []
lineID = GameWorld.GetGameWorld().GetPropertyID() - 1
playerHurtList = PyGameData.g_ZhuXianBossPlayerHurtDict.get(lineID, {}).items()
- npcHurtList = g_npcHurtDict.get(lineID, {}).items()
-
- syncHurtList = (playerHurtList + npcHurtList)[:5]
+
+ syncHurtList = playerHurtList[:5]
syncHurtList.sort(key=lambda asd:asd[1][1], reverse=True)
for i, info in enumerate(syncHurtList, 1):
@@ -270,24 +233,13 @@
hurtDict["hurt"] = hurt % ChConfig.Def_PerPointValue
hurtDict["hurtEx"] = hurt / ChConfig.Def_PerPointValue
hurtInfo.append(hurtDict)
- myRank = __GetSelfHurtRank(curPlayer)
- if myRank and myRank > 5:
- hurtDict = {}
- hurtDict["rank"] = myRank
- info = playerHurtList[myRank - 1]
- playerName, hurt = info[1][:2]
- hurtDict["playerName"] = playerName
- hurtDict["hurt"] = hurt % ChConfig.Def_PerPointValue
- hurtDict["hurtEx"] = hurt / ChConfig.Def_PerPointValue
- hurtInfo.append(hurtDict)
+
- curSpeed = GameWorld.GetGameWorld().GetGameWorldDictByKey(FBDict_Speed % lineID)
- isReduceing = GameWorld.GetGameWorld().GetGameWorldDictByKey(FBDict_IsReduceing % lineID)
- remainHP = GetBossRemainHP(lineID, tick)
- totalHP = __GetBossTotalHP(lineID)
- hpReduceSpeed = curSpeed * 10000 / totalHP if totalHP else 0
- remainHPPer = min(100, remainHP * 100 / totalHP) if totalHP else 0
- fbHelpDict = {FBCommon.Help_lineID:lineID, "hurtInfo":hurtInfo, 'hpReduceSpeed':hpReduceSpeed, 'remainHPPer':remainHPPer, 'isReduceing':isReduceing}
+ myHurt = g_heroHurtDict.get(curPlayer.GetID(), 0)
+ fbHelpDict = {FBCommon.Help_lineID:lineID, "hurtInfo":hurtInfo,
+ 'myHurt':myHurt % ChConfig.Def_PerPointValue,
+ 'myHurtEx':myHurt / ChConfig.Def_PerPointValue
+ }
GameWorld.DebugLog("DoFBHelp: %s" % fbHelpDict, curPlayer.GetPlayerID())
FBCommon.Notify_FBHelp(curPlayer, fbHelpDict)
return
@@ -327,14 +279,18 @@
return
#
def UpdateHurtInfo(curPlayer, hurtHP, isAdd=False):
+ global g_heroHurtDict
+ playerID = curPlayer.GetPlayerID()
+ g_heroHurtDict[playerID] = g_heroHurtDict.get(playerID, 0) + hurtHP
+
enterCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_EnterFbCntDay % ChConfig.Def_FBMapID_ZhuXianBoss)
- if enterCnt >= FBCommon.GetEnterFBMaxCnt:
+ if enterCnt >= FBCommon.GetEnterFBMaxCnt(curPlayer, ChConfig.Def_FBMapID_ZhuXianBoss):
#没归属的不进伤害榜
return
lineID = GameWorld.GetGameWorld().GetPropertyID() - 1
playerName = curPlayer.GetName()
- playerID = curPlayer.GetPlayerID()
+
familyID = curPlayer.GetFamilyID()
playerHurtDict = PyGameData.g_ZhuXianBossPlayerHurtDict.get(lineID, {})
if playerID not in playerHurtDict:
@@ -344,8 +300,6 @@
else:
playerHurtDict[playerID][1] += hurtHP
PyGameData.g_ZhuXianBossPlayerHurtDict[lineID] = playerHurtDict
- #有人上榜开始掉血
- StartReduceHP(lineID, GameWorld.GetGameWorld().GetTick())
return
##---副本总逻辑计时器---
@@ -360,19 +314,16 @@
GameWorld.Log("强制踢出玩家关闭副本: overTick=%s,tick=%s" % (overTick, tick))
FBCommon.DoLogic_FBKickAllPlayer()
return
- mapID = GameWorld.GetMap().GetMapID()
-
+
lineID = GameWorld.GetGameWorld().GetPropertyID() - 1
if lineID <0:
return
- gameWorld = GameWorld.GetGameWorld()
- startTick = gameWorld.GetGameWorldDictByKey(FBDict_StartTick % lineID)
- if not startTick:
+
+ if overTick:
return
+
FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 5000)
- __CheckBossHP(tick)
-
-
+
return
@@ -404,10 +355,10 @@
playerManager = GameWorld.GetMapCopyPlayerManager()#GameWorld.GetPlayerManager()
firstPlayer = playerManager.FindPlayerByID(firstPlayerID)
if firstPlayer:
- #gameFB.SetPlayerGameFBDict(playerID, FBPlayerDict_Rank, rank)
+ gameFB.SetPlayerGameFBDict(firstPlayerID, FBPlayerDict_Rank, 1)
if not dropPosX or not dropPosY:
dropPosX, dropPosY = firstPlayer.GetPosX(), firstPlayer.GetPosY()
- prizeItemList = GiveZhuXianBossAward(firstPlayer, lineID, dropItemMapInfo=[dropPosX, dropPosY, True])
+ prizeItemList = GiveZhuXianBossAward(firstPlayer, lineID, dropItemMapInfo=[dropPosX, dropPosY, True, True])
if not prizeItemList:
# 没有掉落时直接通知结算,防止卡副本
firstPlayer.Sync_TimeTick(IPY_GameWorld.tttLeaveMap, 0, leaveTick, True)
@@ -420,11 +371,10 @@
if leaveServerTick and tick - leaveServerTick < ChConfig.Def_PlayerOfflineProtectTime:
#离线超过3分钟的不给奖励
msgStr = str([ShareDefine.Def_UniversalGameRecType_ZhuXianBossRecord, [firstPlayerID, lineID], [], 0, 0])
- playerManager.GameServer_QueryPlayerResult(0, 0, 0, 'AddUniversalGameRec', msgStr, len(msgStr))
+ GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'AddUniversalGameRec', msgStr, len(msgStr))
helpItemList = FBCommon.GetFBLineReward(mapID, lineID)
if helpItemList: #同盟协助奖励
- needSpace = len(helpItemList)
jsonItemList = FBCommon.GetJsonItemList(helpItemList)
for index in range(0 , playerManager.GetPlayerCount()):
curPlayer = playerManager.GetPlayerByIndex(index)
@@ -433,24 +383,19 @@
continue
if curPlayerID == firstPlayerID:
continue
- if curPlayer.GetFamilyID() != firstPlayerFamilyID:
- continue
- remainCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ZhuXianBossHelpCnt)
- if not remainCnt:
- continue
- PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ZhuXianBossHelpCnt, remainCnt-1)
- NotifyZXHelpCnt(curPlayer)
curPlayer.Sync_TimeTick(IPY_GameWorld.tttLeaveMap, 0, leaveTick, True)
- overDict = {FBCommon.Over_rank:0, FBCommon.Over_itemInfo:jsonItemList}
- FBCommon.NotifyFBOver(curPlayer, ChConfig.Def_FBMapID_ZhuXianBoss, lineID, isPass, overDict)
-
- packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace)
- if needSpace > packSpace:
- PlayerControl.SendMailByKey('ZXBossHelperReward', [curPlayerID], helpItemList)
+ remainCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ZhuXianBossHelpCnt)
+ if curPlayer.GetFamilyID() == firstPlayerFamilyID and remainCnt:
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ZhuXianBossHelpCnt, remainCnt-1)
+ NotifyZXHelpCnt(curPlayer)
+ ItemControler.GivePlayerItemOrMail(curPlayer, helpItemList, 'ZXBossHelperReward')
+ overDict = {FBCommon.Over_rank:0, FBCommon.Over_itemInfo:jsonItemList}
+ FBCommon.NotifyFBOver(curPlayer, ChConfig.Def_FBMapID_ZhuXianBoss, lineID, isPass, overDict)
+ PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_LeiFaBoss, 1)
else:
- for itemID, itemCount, isBind in helpItemList:
- ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, isBind, [IPY_GameWorld.rptItem])
-
+ overDict = {FBCommon.Over_rank:0}
+ FBCommon.NotifyFBOver(curPlayer, ChConfig.Def_FBMapID_ZhuXianBoss, lineID, 0, overDict)
+
return
def GiveZhuXianBossAward(curPlayer, lineID, isMail=False, dropItemMapInfo=[]):
@@ -480,7 +425,8 @@
PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_KillSpecificNPC, addCnt, [bossID])
FBCommon.AddEnterFBCount(curPlayer, ChConfig.Def_FBMapID_ZhuXianBoss, addCnt)
# 每日活动
- PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_ZhuXianBoss, addCnt)
+ PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_LeiFaBoss, addCnt)
+ PlayerActLogin.AddLoginAwardActionCnt(curPlayer, ChConfig.Def_LoginAct_ZhuXianBOSS, addCnt)
return prizeItemList
def OnPickUpItem(curPlayer, curItem, tick):
@@ -532,114 +478,43 @@
FBCommon.NotifyFBOver(curPlayer, ChConfig.Def_FBMapID_ZhuXianBoss, lineID, isPass, overDict)
return
-
-def __CheckBossHP(tick):
- gameFB = GameWorld.GetGameFB()
- isOver = gameFB.GetGameFBDictByKey(FBDict_IsOver)
- lineID = GameWorld.GetGameWorld().GetPropertyID() - 1
-
- if not isOver and GetBossRemainHP(lineID, tick) == 0:
-
- bossID = CurFBLineBOSSID(lineID)
- curBoss = GameWorld.FindNPCByNPCID(bossID)
- dropPosX, dropPosY = 0, 0
- if curBoss:
- dropPosX, dropPosY = curBoss.GetPosX(), curBoss.GetPosY()
-
- #结束 设置BOSS死亡
-
- FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 0)
- GameWorld.DebugLog('结束 设置BOSS死亡 lineID=%s' % lineID)
- playerHurtList = __GetSortHurtList(lineID)
-
- if playerHurtList:
- killerName, hurtValue = playerHurtList[0][1][:2]
- NPCCommon.GameServer_KillGameWorldBoss(bossID, killerName, hurtValue)
-
- NPCCommon.GameServe_GameWorldBossState(bossID, 0)
-
- __DoLogicZhuXianBossOver(1, tick, dropPosX, dropPosY)
- gameFB.SetGameFBDict(FBDict_IsOver, tick)
+def DoFB_Npc_KillNPC(attacker, curNPC, tick):
+ __FBNPCOnKilled(curNPC, tick)
+ return
+def DoFB_Player_KillNPC(curPlayer, curNPC, tick):
+ __FBNPCOnKilled(curNPC, tick)
return
-def UpdateHPReduceSpeed(tick, isExit=False):
- gameWorld = GameWorld.GetGameWorld()
- playerCnt = gameWorld.GetMapCopyPlayerManager().GetPlayerCount()
- playerCnt = playerCnt - 1 if isExit else playerCnt
- if playerCnt <=0:
- return
+## 执行副本杀怪逻辑
+def __FBNPCOnKilled(curNPC, tick):
lineID = GameWorld.GetGameWorld().GetPropertyID() - 1
- if lineID < 0:
+ bossID = CurFBLineBOSSID(lineID)
+ if curNPC.GetNPCID() != bossID:
return
- curSpeed = int(min(1 + 0.08 * (playerCnt - 1), 1.8) * 1000)
- gameWorld.SetGameWorldDict(FBDict_Speed % lineID, curSpeed)
- if not gameWorld.GetGameWorldDictByKey(FBDict_IsReduceing%lineID):
- return
+ dropPosX, dropPosY = curNPC.GetPosX(), curNPC.GetPosY()
- startTick = gameWorld.GetGameWorldDictByKey(FBDict_StartTick % lineID)
- remainHP = gameWorld.GetGameWorldDictByKey(FBDict_RemainHP % lineID)
- lastSpeed = gameWorld.GetGameWorldDictByKey(FBDict_Speed % lineID)
- if not startTick:
- startTick = tick
- lastSpeed = curSpeed
- remainHP = __GetBossTotalHP(lineID)
- remainHP = max(0, int((remainHP - (tick - startTick) / 1000.0 * lastSpeed)))
- gameWorld.SetGameWorldDict(FBDict_StartTick % lineID, tick)
-
- gameWorld.SetGameWorldDict(FBDict_RemainHP % lineID, remainHP)
- GameWorld.DebugLog(' curSpeed=%s, remainHP=%s, passTime=%s, lastSpeed=%s' % (curSpeed, remainHP, tick - startTick, lastSpeed))
+ #结束 设置BOSS死亡
FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 0)
+ GameWorld.DebugLog('结束 设置BOSS死亡 lineID=%s' % lineID)
+ playerHurtList = __GetSortHurtList(lineID)
+
+ if playerHurtList:
+ killerName, hurtValue = playerHurtList[0][1][:2]
+ NPCCommon.GameServer_KillGameWorldBoss(bossID, killerName, hurtValue)
+
+ NPCCommon.GameServe_GameWorldBossState(bossID, 0)
+
+ __DoLogicZhuXianBossOver(1, tick, dropPosX, dropPosY)
+ GameWorld.GetGameFB().SetGameFBDict(FBDict_IsOver, tick)
return
-def StopReduceHP(lineID, tick):
- ##暂停BOSS血量减少
- gameWorld = GameWorld.GetGameWorld()
- if not gameWorld.GetGameWorldDictByKey(FBDict_IsReduceing%lineID):
- return
- remainHP = GetBossRemainHP(lineID, tick)
- if not remainHP:
- return
- gameWorld.SetGameWorldDict(FBDict_IsReduceing % lineID, 0)
- gameWorld.SetGameWorldDict(FBDict_RemainHP % lineID, remainHP)
- return
-
-def StartReduceHP(lineID, tick):
- ##开始BOSS掉血
- gameWorld = GameWorld.GetGameWorld()
- if gameWorld.GetGameWorldDictByKey(FBDict_IsReduceing%lineID):
- return
- gameWorld.SetGameWorldDict(FBDict_IsReduceing % lineID, 1)
- startTick = gameWorld.GetGameWorldDictByKey(FBDict_StartTick % lineID)
- if not startTick:
- gameWorld.SetGameWorldDict(FBDict_RemainHP % lineID, __GetBossTotalHP(lineID))
- gameWorld.SetGameWorldDict(FBDict_StartTick % lineID, tick)
- return
-
-def __GetBossTotalHP(lineID):return GameWorld.GetGameWorld().GetGameWorldDictByKey(FBDict_BossTotalHP%lineID)
-
-
-def GetBossRemainHP(lineID, tick):
- gameWorld = GameWorld.GetGameWorld()
-
- startTick = gameWorld.GetGameWorldDictByKey(FBDict_StartTick % lineID)
- lastSpeed = gameWorld.GetGameWorldDictByKey(FBDict_Speed % lineID)
- remainHP = gameWorld.GetGameWorldDictByKey(FBDict_RemainHP % lineID)
- if not gameWorld.GetGameWorldDictByKey(FBDict_IsReduceing%lineID):
- return remainHP
- if not startTick:
- startTick = tick
- remainHP = __GetBossTotalHP(lineID)
- else:
- remainHP = max(0, int((remainHP - (tick - startTick) / 1000.0 * lastSpeed)))
- return remainHP
-
-def GetBossRemainHPPer(lineID, tick):
- remainHP = GetBossRemainHP(lineID, tick)
- totalHP = __GetBossTotalHP(lineID)
- if not totalHP:
- return 0
- return remainHP * 100 / totalHP
+def GetBossRemainHPPer(copyMapID, funcLineID, tick):
+ bossID = CurFBLineBOSSID(funcLineID)
+ curBoss = GameWorld.FindNPCByNPCIDEx(copyMapID, bossID)
+ if not curBoss:
+ return 100
+ return GameObj.GetHP(curBoss) * 100 / GameObj.GetMaxHP(curBoss)
def CurFBLineBOSSID(lineID= -1):
#该分线刷的BOSSID
@@ -661,4 +536,27 @@
def DoPlayerDead(curPlayer):
return
+## 检查是否可攻击, 主判定不可攻击的情况,其他逻辑由外层决定
+# @param attacker 攻击方
+# @param defender 防守方
+# @return bool
+def CheckCanAttackTagObjInFB(attacker, defender):
+ atkObjType = attacker.GetGameObjType()
+ defObjType = defender.GetGameObjType()
+ gameWorld = GameWorld.GetGameWorld()
+ lineID = gameWorld.GetPropertyID() - 1
+ if defObjType == IPY_GameWorld.gotNPC and defender.GetNPCID() == CurFBLineBOSSID(lineID):
+ if not PyGameData.g_ZhuXianBossPlayerHurtDict.get(lineID, {}):
+ if atkObjType == IPY_GameWorld.gotPlayer:
+ PlayerControl.NotifyCode(attacker, 'TryEnterJadeDynastyBossError_7')
+ return False
+ return True
+##处理副本中杀死玩家逻辑
+# @param curPlayer 玩家实例
+# @param defender 防守者
+# @param tick 时间戳
+# @return 布尔值
+# @remarks 处理副本中杀死玩家逻辑
+def DoFBOnKill_Player(atkobj, defender, tick):
+ return True
\ No newline at end of file
--
Gitblit v1.8.0