From bc855f2438ac3ebd2be32924e2273f9572678947 Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期三, 24 四月 2019 17:49:16 +0800
Subject: [PATCH] 6538 【后端】【2.0】原假掉血逻辑优化
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_FBLinePlayerCnt.py | 4
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_ZhuXianBoss.py | 202 +++-----------
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/KillScreenNPC.py | 30 -
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_EnterFB.py | 4
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_AllFamilyBoss.py | 175 +----------
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_SealDemon.py | 143 ++-------
ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerXMZZ.py | 1
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py | 25 -
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py | 11
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_HorsePetBoss.py | 186 ++-----------
10 files changed, 167 insertions(+), 614 deletions(-)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerXMZZ.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerXMZZ.py
index 5504b4a..3315d81 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerXMZZ.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerXMZZ.py
@@ -35,6 +35,7 @@
import random
import math
+import json
RecType = ShareDefine.Def_UniversalGameRecType_XMZZStageRecord
RecType1 = ShareDefine.Def_UniversalGameRecType_XMZZPKInfoRecord
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/KillScreenNPC.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/KillScreenNPC.py
index 12ff6a0..63682ab 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/KillScreenNPC.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/KillScreenNPC.py
@@ -16,7 +16,6 @@
#
# 模块详细说明
-import LogUI
import IPY_GameWorld
import GameWorld
import ChConfig
@@ -24,11 +23,8 @@
import AttackCommon
import GameObj
import NPCCommon
-import GameLogic_SealDemon
-import GameLogic_ZhuXianBoss
import GameLogic_ZhuXianTower
-import GameLogic_AllFamilyBoss
-import GameLogic_HorsePetBoss
+
## GM命令执行入口
# @param curPlayer 当前玩家
@@ -36,32 +32,12 @@
# @return None
# @remarks 函数详细说明.
def OnExec(curPlayer, playerList):
- if curPlayer.GetMapID() == ChConfig.Def_FBMapID_SealDemon:
- #封魔坛击杀怪
- gameWorld = GameWorld.GetGameWorld()
- lineID = gameWorld.GetPropertyID() - 1
- gameWorld.SetGameWorldDict(GameLogic_SealDemon.FBDict_RemainHP % lineID, 1)
- return
- if curPlayer.GetMapID() == ChConfig.Def_FBMapID_ZhuXianBoss:
- #诛仙BOSS击杀怪
- gameWorld = GameWorld.GetGameWorld()
- lineID = gameWorld.GetPropertyID() - 1
- gameWorld.SetGameWorldDict(GameLogic_ZhuXianBoss.FBDict_RemainHP % lineID, 1)
- return
+
if curPlayer.GetMapID() == ChConfig.Def_FBMapID_ZhuXianTower:
#诛仙塔击杀怪
GameWorld.GetGameFB().SetGameFBDict(GameLogic_ZhuXianTower.FBDict_RemainHP, 1)
return
- if curPlayer.GetMapID() == ChConfig.Def_FBMapID_AllFamilyBoss:
- #仙盟BOSS击杀怪
- GameWorld.GetGameWorld().SetGameWorldDict(GameLogic_AllFamilyBoss.FBDict_RemainHP, 1)
- return
- if curPlayer.GetMapID() == ChConfig.Def_FBMapID_HorsePetBoss:
- #骑宠BOSS击杀怪
- gameWorld = GameWorld.GetGameWorld()
- lineID = gameWorld.GetPropertyID() - 1
- gameWorld.SetGameWorldDict(GameLogic_HorsePetBoss.FBDict_RemainHP % lineID, 1)
- return
+
isMapAllNPC = 0
if len(playerList) > 0:
isMapAllNPC = playerList[0]
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py
index b57d21f..ade467b 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py
@@ -750,6 +750,17 @@
return curNPC
return
+def FindNPCByNPCIDEx(copyMapID, npcID):
+ #查询某条分线的npc
+ gameNPCManager = GetNPCManager()
+ for index in xrange(gameNPCManager.GetNPCCountByGWIndex(copyMapID)):
+ curNPC = gameNPCManager.GetNPCByIndexByGWIndex(copyMapID, index)
+ curID = curNPC.GetID()
+ if curID == 0:
+ continue
+ if npcID == curNPC.GetNPCID():
+ return curNPC
+ return
#---------------------------------------------------------------------
##根据NPC的类型选择返回对象
# @param npcIndex NPC索引
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_AllFamilyBoss.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_AllFamilyBoss.py
index 8a91e67..e7aa279 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_AllFamilyBoss.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_AllFamilyBoss.py
@@ -29,17 +29,12 @@
import ItemControler
import PlayerActivity
import EventReport
+import GameObj
-FBDict_StartTick = 'FBDict_StartTick' #开始时间
-FBDict_Speed = 'FBDict_Speed' #掉血速度 /s
-FBDict_RemainHP = 'FBDict_RemainHP' #剩余时间
FBPlayerDict_EncourageLV = 'FBPlayerDict_EncourageLV' # 鼓舞等级
FBDict_IsOver = 'FBDict_IsOver' #是否已结算, 结算时的tick
-FBDict_IsReduceing = 'FBDict_IsReduceing' #是否掉血中
-FBDict_BossTotalHP = 'FBDict_BossTotalHP' #BOSS血量
-FBDict_LastHurtTick = 'FBDict_LastHurtTick' #上次伤害时间
FBDict_IsEncourage = 'FBDict_IsEncourage' #是否鼓舞过
-FBDict_LastHPNotify = 'FBDict_LastHPNotify' #上一个血量广播
+
(
Def_BossTime, #BOSS时间
@@ -115,8 +110,6 @@
if not bossID:
return
NPCCustomRefresh.SetNPCRefresh(101, [bossID])
- BossTime = FBCommon.GetFBLineStepTime(ChConfig.Def_FBMapID_AllFamilyBoss, lineID)[Def_BossTime]
- GameWorld.GetGameWorld().SetGameWorldDict(FBDict_BossTotalHP, BossTime * 1000)
return
@@ -128,7 +121,7 @@
GameWorld.DebugLog(' 多仙盟BOSS活动状态变更 state=%s' % state)
if not state:
- if GameWorld.GetGameWorld().GetGameWorldDictByKey(FBDict_StartTick) and not GameWorld.GetGameFB().GetGameFBDictByKey(FBDict_IsOver):
+ if not GameWorld.GetGameFB().GetGameFBDictByKey(FBDict_IsOver):
GameWorld.GetGameFB().SetGameFBDict(FBDict_IsOver, tick)
__DoLogicAllFamilyBossOver(0, tick)
return
@@ -167,7 +160,6 @@
elif playerID not in PyGameData.g_allfamilyBossDict[familyID][2]:
PyGameData.g_allfamilyBossDict[familyID][2].append(playerID)
- UpdateHPReduceSpeed(tick)
gameFB = GameWorld.GetGameFB()
# 上鼓舞buff
encourageLV = gameFB.GetPlayerGameFBDictByKey(familyID, FBPlayerDict_EncourageLV)
@@ -187,10 +179,6 @@
def OnCloseFB(tick):
gameWorld = GameWorld.GetGameWorld()
- gameWorld.SetGameWorldDict(FBDict_StartTick, 0)
- gameWorld.SetGameWorldDict(FBDict_Speed, 0)
- gameWorld.SetGameWorldDict(FBDict_RemainHP, 0)
- gameWorld.SetGameWorldDict(FBDict_IsReduceing, 0)
gameWorld.SetPropertyID(0)
PyGameData.g_allfamilyBossDict = {}
return
@@ -212,8 +200,6 @@
# GameWorldProcess.CloseFB(tick)
# return
- UpdateHPReduceSpeed(tick, True)
-
return
@@ -230,13 +216,6 @@
if playerID in familyHurtInfo[2]:
familyHurtInfo[2].remove(playerID)
FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 0)
- return
-
-
-##玩家切换地图
-def DoPlayerChangeMapLogic(curPlayer):
- #FBCommon.SetHadDelTicket(curPlayer, 0)
-
return
@@ -271,17 +250,11 @@
hurtDict["hurt"] = hurt % ChConfig.Def_PerPointValue
hurtDict["hurtEx"] = hurt / ChConfig.Def_PerPointValue
hurtInfo.append(hurtDict)
-
- curSpeed = GameWorld.GetGameWorld().GetGameWorldDictByKey(FBDict_Speed)
- isReduceing = GameWorld.GetGameWorld().GetGameWorldDictByKey(FBDict_IsReduceing)
- remainHP = GetBossRemainHP(tick)
- totalHP = __GetBossTotalHP()
- hpReduceSpeed = curSpeed * 10000 / totalHP if totalHP else 0
- remainHPPer = min(1000000, remainHP * 1000000 / totalHP) if totalHP else 0
+ remainHPPer = GetBossRemainHPPer(0, tick)
playerID = curPlayer.GetPlayerID()
IsEncourage = GameWorld.GetGameFB().GetPlayerGameFBDictByKey(playerID, FBDict_IsEncourage)
- fbHelpDict = {"hurtInfo":hurtInfo, 'hpReduceSpeed':hpReduceSpeed, 'IsEncourage':IsEncourage,
- 'remainHPPer':remainHPPer, 'isReduceing':isReduceing, 'myHurt':myHurt % ChConfig.Def_PerPointValue,
+ fbHelpDict = {"hurtInfo":hurtInfo, 'IsEncourage':IsEncourage,'remainHPPer':remainHPPer,
+ 'myHurt':myHurt % ChConfig.Def_PerPointValue,
'myHurtEx':myHurt / ChConfig.Def_PerPointValue, 'myRank':myRank, 'myMenberCnt':myMenberCnt
}
GameWorld.DebugLog("DoFBHelp: %s" % fbHelpDict, playerID)
@@ -318,7 +291,6 @@
# @return None
def DoFB_Player_HurtNPC(curPlayer, curNPC, hurtHP):
UpdateHurtInfo(curPlayer, hurtHP)
- GameWorld.GetGameFB().SetGameFBDict(FBDict_LastHurtTick, GameWorld.GetGameWorld().GetTick())
return
@@ -331,8 +303,6 @@
PyGameData.g_allfamilyBossDict[familyID][1] += hurtHP
- #有人上榜开始掉血
- StartReduceHP(GameWorld.GetGameWorld().GetTick())
return
@@ -359,16 +329,10 @@
return
elif fbStep == FB_Step_Fighting:
- startTick = gameWorld.GetGameWorldDictByKey(FBDict_StartTick)
- if not startTick or overTick:
+ if overTick:
return
- lastHurtTick = gameFB.GetGameFBDictByKey(FBDict_LastHurtTick)
- if lastHurtTick and tick - lastHurtTick >= 2000:
- StopReduceHP(tick)
- gameFB.SetGameFBDict(FBDict_LastHurtTick, 0)
FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 5000)
- __CheckBossHP(tick)
return
@@ -489,122 +453,35 @@
return familyAuctionItemList, menberItemList
-def __CheckBossHP(tick):
- gameFB = GameWorld.GetGameFB()
- isOver = gameFB.GetGameFBDictByKey(FBDict_IsOver)
-
- if not isOver:
- if GetBossRemainHP(tick) == 0:
- #结束 设置BOSS死亡
- FBCommon.ClearFBNPC()
- FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 0)
- GameWorld.DebugLog('结束 设置BOSS死亡')
-
- gameFB.SetGameFBDict(FBDict_IsOver, tick)
-
- __DoLogicAllFamilyBossOver(1, tick)
- else:
- #血量广播
- needNotifyHPPerList = [50, 20]
- lastIndex = gameFB.GetGameFBDictByKey(FBDict_LastHPNotify)
- if lastIndex >= len(needNotifyHPPerList):
- return
- remainPer = GetBossRemainHPPer(tick)
- notifyHPPer = needNotifyHPPerList[lastIndex]
- if remainPer == notifyHPPer or remainPer - 1 == notifyHPPer:
- gameFB.SetGameFBDict(FBDict_LastHPNotify, lastIndex + 1)
- lineID = GameWorld.GetGameWorld().GetPropertyID() - 1
- bossID = CurFBLineBOSSID(lineID)
- msgMark = 'AllianceBossHP1' if lineID == 0 else 'AllianceBossHP2'
- PlayerControl.WorldNotify(0, msgMark, [bossID, notifyHPPer])
-
+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 = eval(FBCommon.GetFBLineStepTime(ChConfig.Def_FBMapID_AllFamilyBoss, lineID)[Def_HPSpeed])
- gameWorld.SetGameWorldDict(FBDict_Speed, curSpeed)
- if not gameWorld.GetGameWorldDictByKey(FBDict_IsReduceing):
- return
-
- startTick = gameWorld.GetGameWorldDictByKey(FBDict_StartTick)
- remainHP = gameWorld.GetGameWorldDictByKey(FBDict_RemainHP)
- lastSpeed = gameWorld.GetGameWorldDictByKey(FBDict_Speed)
- if not startTick:
- startTick = tick
- lastSpeed = curSpeed
- remainHP = __GetBossTotalHP()
- remainHP = max(0, int((remainHP - (tick - startTick) / 1000.0 * lastSpeed)))
- gameWorld.SetGameWorldDict(FBDict_StartTick, tick)
-
- gameWorld.SetGameWorldDict(FBDict_RemainHP, remainHP)
- GameWorld.DebugLog(' curSpeed=%s, remainHP=%s, passTime=%s, lastSpeed=%s' % (curSpeed, remainHP, tick - startTick, lastSpeed))
FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 0)
- return
+ GameWorld.DebugLog('结束 设置BOSS死亡')
-
-def StopReduceHP(tick):
- ##暂停BOSS血量减少
- gameWorld = GameWorld.GetGameWorld()
- if not gameWorld.GetGameWorldDictByKey(FBDict_IsReduceing):
- return
- remainHP = GetBossRemainHP(tick)
- if not remainHP:
- return
- gameWorld.SetGameWorldDict(FBDict_IsReduceing, 0)
- gameWorld.SetGameWorldDict(FBDict_RemainHP, remainHP)
- return
-
-
-def StartReduceHP(tick):
- ##开始BOSS掉血
- gameWorld = GameWorld.GetGameWorld()
- if gameWorld.GetGameWorldDictByKey(FBDict_IsReduceing):
- return
- gameWorld.SetGameWorldDict(FBDict_IsReduceing, 1)
- startTick = gameWorld.GetGameWorldDictByKey(FBDict_StartTick)
- if not startTick:
- gameWorld.SetGameWorldDict(FBDict_RemainHP, __GetBossTotalHP())
- gameWorld.SetGameWorldDict(FBDict_StartTick, tick)
- FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 0)
- return
-
-
-def __GetBossTotalHP():return GameWorld.GetGameWorld().GetGameWorldDictByKey(FBDict_BossTotalHP)
+ GameWorld.GetGameFB().SetGameFBDict(FBDict_IsOver, tick)
-
-def GetBossRemainHP(tick):
- gameWorld = GameWorld.GetGameWorld()
-
- startTick = gameWorld.GetGameWorldDictByKey(FBDict_StartTick)
- lastSpeed = gameWorld.GetGameWorldDictByKey(FBDict_Speed)
- remainHP = gameWorld.GetGameWorldDictByKey(FBDict_RemainHP)
- if not gameWorld.GetGameWorldDictByKey(FBDict_IsReduceing):
- return remainHP if startTick else __GetBossTotalHP()
- if not startTick:
- startTick = tick
- remainHP = __GetBossTotalHP()
- else:
- remainHP = max(0, int((remainHP - (tick - startTick) / 1000.0 * lastSpeed)))
- return remainHP
+ __DoLogicAllFamilyBossOver(1, tick)
+ return
-def GetBossRemainHPPer(tick):
- remainHP = GetBossRemainHP(tick)
- totalHP = __GetBossTotalHP()
- if not totalHP:
+
+def GetBossRemainHPPer(copyMapID, tick):
+ bossID = CurFBLineBOSSID()
+ curBoss = GameWorld.FindNPCByNPCIDEx(copyMapID, bossID)
+ if not curBoss:
return 100
- return remainHP * 100 / totalHP
+ return GameObj.GetHP(curBoss) * 100 / GameObj.GetMaxHP(curBoss)
def CurFBLineBOSSID(lineID=-1):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_HorsePetBoss.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_HorsePetBoss.py
index ae12159..ee9c4ae 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_HorsePetBoss.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_HorsePetBoss.py
@@ -29,18 +29,10 @@
import ItemControler
import EventReport
import NPCCommon
+import GameObj
-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血量
-FBDict_LastHurtTick = 'FBDict_LastHurtTick' #上次伤害时间
-FBDict_LastHPNotify = 'FBDict_LastHPNotify' #上一个血量广播
-
(
Def_BossTime, #BOSS时间
@@ -56,11 +48,6 @@
FB_Step_Close, # 副本关闭
) = range(4)
-def OnFBPlayerOnLogin(curPlayer):
- return
-
-def OnFBPlayerOnDay(curPlayer):
- return
## 是否能够通过活动查询进入
@@ -105,8 +92,6 @@
if not bossID:
return
NPCCustomRefresh.SetNPCRefresh(101, [bossID])
- BossTime = FBCommon.GetFBLineStepTime(ChConfig.Def_FBMapID_HorsePetBoss, lineID)[Def_BossTime]
- GameWorld.GetGameWorld().SetGameWorldDict(FBDict_BossTotalHP%lineID, BossTime * 1000)
return
def OnHorsePetBossStateChange(state, tick):
@@ -150,8 +135,7 @@
if fbStep == FB_Step_Open:
FBCommon.SetFBStep(FB_Step_Fighting, tick)
UpdateHurtInfo(curPlayer, 0, True)
-
- UpdateHPReduceSpeed(tick)
+
gameFB = GameWorld.GetGameFB()
# 上鼓舞buff
encourageLV = gameFB.GetPlayerGameFBDictByKey(playerID, FBPlayerDict_EncourageLV)
@@ -170,9 +154,6 @@
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_horsePetBossPlayerHurtDict[lineID] = {}
gameWorld.SetPropertyID(0)
return
@@ -194,8 +175,6 @@
# GameWorldProcess.CloseFB(tick)
# return
- UpdateHPReduceSpeed(tick, True)
-
return
##玩家主动离开副本.
@@ -209,8 +188,6 @@
playerHurtDict = PyGameData.g_horsePetBossPlayerHurtDict.get(lineID, {})
playerHurtDict.pop(curPlayer.GetPlayerID(), 0)
PyGameData.g_horsePetBossPlayerHurtDict[lineID] = playerHurtDict
- if not playerHurtDict: #榜上没人,停止掉血
- StopReduceHP(lineID, tick)
return
##玩家切换地图
@@ -251,18 +228,9 @@
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(1000000, remainHP * 1000000 / totalHP) if totalHP else 0
-
- fbHelpDict = {FBCommon.Help_lineID:lineID, "hurtInfo":hurtInfo, 'hpReduceSpeed':hpReduceSpeed,
- 'remainHPPer':remainHPPer, 'isReduceing':isReduceing,'myHurt':myHurt % ChConfig.Def_PerPointValue,
- 'myHurtEx':myHurt / ChConfig.Def_PerPointValue, 'myRank':myRank
+ remainHPPer = GetBossRemainHPPer(GameWorld.GetGameWorld().GetCopyMapID(), lineID, tick)
+ fbHelpDict = {FBCommon.Help_lineID:lineID, "hurtInfo":hurtInfo, 'myHurt':myHurt % ChConfig.Def_PerPointValue,
+ 'myHurtEx':myHurt / ChConfig.Def_PerPointValue, 'myRank':myRank, 'remainHPPer':remainHPPer
}
GameWorld.DebugLog("DoFBHelp: %s" % fbHelpDict, curPlayer.GetPlayerID())
FBCommon.Notify_FBHelp(curPlayer, fbHelpDict)
@@ -289,10 +257,6 @@
# @return None
def DoFB_Player_HurtNPC(curPlayer, curNPC, hurtHP):
UpdateHurtInfo(curPlayer, hurtHP)
- #有人上榜开始掉血
- lineID = GameWorld.GetGameWorld().GetPropertyID() - 1
- StartReduceHP(lineID, GameWorld.GetGameWorld().GetTick())
- GameWorld.GetGameFB().SetGameFBDict(FBDict_LastHurtTick, GameWorld.GetGameWorld().GetTick())
return
#
def UpdateHurtInfo(curPlayer, hurtHP, isAdd=False):
@@ -333,17 +297,11 @@
return
elif fbStep == FB_Step_Fighting:
- startTick = gameWorld.GetGameWorldDictByKey(FBDict_StartTick % lineID)
- if not startTick or overTick:
+ if overTick:
return
- lastHurtTick = gameFB.GetGameFBDictByKey(FBDict_LastHurtTick)
- if lastHurtTick and tick - lastHurtTick >= 2000:
- StopReduceHP(lineID, tick)
- gameFB.SetGameFBDict(FBDict_LastHurtTick, 0)
-
+
FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 5000)
- __CheckBossHP(tick)
-
+
return
@@ -447,123 +405,37 @@
return auctionItemList, itemList
+def DoFB_Npc_KillNPC(attacker, curNPC, tick):
+ __FBNPCOnKilled(curNPC, tick)
+ return
+def DoFB_Player_KillNPC(curPlayer, curNPC, tick):
+ __FBNPCOnKilled(curNPC, tick)
+ return
-def __CheckBossHP(tick):
- gameFB = GameWorld.GetGameFB()
- isOver = gameFB.GetGameFBDictByKey(FBDict_IsOver)
+## 执行副本杀怪逻辑
+def __FBNPCOnKilled(curNPC, tick):
lineID = GameWorld.GetGameWorld().GetPropertyID() - 1
-
- if not isOver:
- bossID = CurFBLineBOSSID(lineID)
- if GetBossRemainHP(lineID, tick) == 0:
-
-
- curBoss = GameWorld.FindNPCByNPCID(bossID)
- dropPosX, dropPosY = 0, 0
- if curBoss:
- dropPosX, dropPosY = curBoss.GetPosX(), curBoss.GetPosY()
-
- #结束 设置BOSS死亡
- FBCommon.ClearFBNPC()
- FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 0)
- GameWorld.DebugLog('结束 设置BOSS死亡 lineID=%s' % lineID)
-
- __DoLogicHorsePetBossOver(1, tick, dropPosX, dropPosY)
- gameFB.SetGameFBDict(FBDict_IsOver, tick)
- else:
- #血量广播
- needNotifyHPPerList = [50, 20]
- lastIndex = gameFB.GetGameFBDictByKey(FBDict_LastHPNotify)
- if lastIndex >= len(needNotifyHPPerList):
- return
- remainPer = GetBossRemainHPPer(lineID, tick)
- notifyHPPer = needNotifyHPPerList[lastIndex]
- if remainPer == notifyHPPer or remainPer - 1 == notifyHPPer:
- gameFB.SetGameFBDict(FBDict_LastHPNotify, lastIndex + 1)
- lineID = GameWorld.GetGameWorld().GetPropertyID() - 1
- msgMark = 'QCBOSSHP1'
- PlayerControl.WorldNotify(0, msgMark, [bossID, notifyHPPer])
- return
-
-def UpdateHPReduceSpeed(tick, isExit=False):
- gameWorld = GameWorld.GetGameWorld()
- playerCnt = gameWorld.GetMapCopyPlayerManager().GetPlayerCount()
- playerCnt = playerCnt - 1 if isExit else playerCnt
- if playerCnt <=0:
- return
- lineID = GameWorld.GetGameWorld().GetPropertyID() - 1
- if lineID < 0:
+ bossID = CurFBLineBOSSID(lineID)
+ if curNPC.GetNPCID() != bossID:
return
- curSpeed = eval(FBCommon.GetFBLineStepTime(ChConfig.Def_FBMapID_HorsePetBoss, lineID)[Def_HPSpeed])
- 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)
- 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)
- FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 0)
- return
-
-def __GetBossTotalHP(lineID):return GameWorld.GetGameWorld().GetGameWorldDictByKey(FBDict_BossTotalHP%lineID)
+ GameWorld.DebugLog('结束 设置BOSS死亡 lineID=%s' % lineID)
+ __DoLogicHorsePetBossOver(1, tick, dropPosX, dropPosY)
+ GameWorld.GetGameFB().SetGameFBDict(FBDict_IsOver, tick)
+ return
-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:
+def GetBossRemainHPPer(copyMapID, funcLineID, tick):
+ bossID = CurFBLineBOSSID(funcLineID)
+ curBoss = GameWorld.FindNPCByNPCIDEx(copyMapID, bossID)
+ if not curBoss:
return 100
- return remainHP * 100 / totalHP
+ return GameObj.GetHP(curBoss) * 100 / GameObj.GetMaxHP(curBoss)
def CurFBLineBOSSID(lineID= -1):
#该分线刷的BOSSID
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_SealDemon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_SealDemon.py
index 4f0e425..e0e96ac 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_SealDemon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_SealDemon.py
@@ -33,7 +33,7 @@
import PlayerActivity
import NetPackCommon
import PlayerVip
-import PlayerMagicWeapon
+import GameObj
import PlayerBossReborn
import PlayerFairyCeremony
import PlayerNewFairyCeremony
@@ -41,9 +41,7 @@
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
@@ -160,8 +158,7 @@
PlayerControl.PlayerLeaveFB(curPlayer)
return
UpdateHurtInfo(curPlayer, 0, True)
-
- UpdateHPReduceSpeed(tick)
+
gameFB = GameWorld.GetGameFB()
# 上鼓舞buff
encourageLV = gameFB.GetPlayerGameFBDictByKey(playerID, FBPlayerDict_EncourageLV)
@@ -170,7 +167,7 @@
else:
FBCommon.SendFBEncourageInfo(curPlayer, encourageLV)
- #DoFBHelp(curPlayer, tick)
+ DoFBHelp(curPlayer, tick)
return
##关闭副本
@@ -179,11 +176,7 @@
# @remarks
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)
-
+
gameWorld.SetPropertyID(0)
return
@@ -203,13 +196,10 @@
lineID = gameWorld.GetPropertyID() - 1
PyGameData.g_sealDemonPlayerHurtDict[lineID] = {}
g_npcHurtDict[lineID] = {}
- gameWorld.SetGameWorldDict(FBDict_StartTick % lineID, 0)
GameWorld.GetGameFB().ClearGameFBDict()
GameWorldProcess.CloseFB(tick)
return
- UpdateHPReduceSpeed(tick, True)
-
return
##玩家主动离开副本.
@@ -270,12 +260,8 @@
hurtDict["hurtEx"] = hurt / ChConfig.Def_PerPointValue
hurtInfo.append(hurtDict)
- curSpeed = GameWorld.GetGameWorld().GetGameWorldDictByKey(FBDict_Speed % lineID)
- remainHP = GetBossRemainHP(lineID, tick)
- totalHP = __GetBossTotalHP()
- hpReduceSpeed = curSpeed * 10000 / totalHP if totalHP else 0
- remainHPPer = min(1000000, remainHP * 1000000 / totalHP) if totalHP else 0
- fbHelpDict = {FBCommon.Help_lineID:lineID, "hurtInfo":hurtInfo, 'hpReduceSpeed':hpReduceSpeed, 'remainHPPer':remainHPPer}
+
+ fbHelpDict = {FBCommon.Help_lineID:lineID, "hurtInfo":hurtInfo}
GameWorld.DebugLog("DoFBHelp: %s" % fbHelpDict, curPlayer.GetPlayerID())
FBCommon.Notify_FBHelp(curPlayer, fbHelpDict)
return
@@ -384,46 +370,43 @@
lineID = GameWorld.GetGameWorld().GetPropertyID() - 1
if lineID <0:
return
- gameWorld = GameWorld.GetGameWorld()
- startTick = gameWorld.GetGameWorldDictByKey(FBDict_StartTick % lineID)
- if not startTick:
- return
+
FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 5000)
- __CheckBossHP(tick)
-
return
-def __CheckBossHP(tick):
- gameFB = GameWorld.GetGameFB()
- isOver = gameFB.GetGameFBDictByKey(FBDict_IsOver)
+def DoFB_Npc_KillNPC(attacker, curNPC, tick):
+ __FBNPCOnKilled(curNPC, tick)
+ return
+def DoFB_Player_KillNPC(curPlayer, curNPC, tick):
+ __FBNPCOnKilled(curNPC, tick)
+ return
+
+## 执行副本杀怪逻辑
+def __FBNPCOnKilled(curNPC, tick):
lineID = GameWorld.GetGameWorld().GetPropertyID() - 1
+ bossID = CurFBLineBOSSID(lineID)
+ if curNPC.GetNPCID() != bossID:
+ return
+
+ dropPosX, dropPosY = curNPC.GetPosX(), curNPC.GetPosY()
+
+ FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 0)
+ GameWorld.DebugLog('结束 设置BOSS死亡 lineID=%s' % lineID)
newbielineList = IpyGameDataPY.GetFuncEvalCfg('SealDemonNewbieLine')
isNewbieLine = lineID in newbielineList
- if not isOver and GetBossRemainHP(lineID, tick) == 0:
- guardNPCIDList = __GetGuardNPCIDList(lineID)
- bossID = CurFBLineBOSSID(lineID)
- curBoss = GameWorld.FindNPCByNPCID(bossID)
- dropPosX, dropPosY = 0, 0
- if curBoss:
- dropPosX, dropPosY = curBoss.GetPosX(), curBoss.GetPosY()
-
- #结束 设置BOSS死亡
- FBCommon.ClearFBNPC(guardNPCIDList)
- FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 0)
- GameWorld.DebugLog('结束 设置BOSS死亡 lineID=%s' % lineID)
+ if not isNewbieLine:
playerHurtList = __GetSortHurtList(lineID)
- if not isNewbieLine:
- if playerHurtList:
- killerName, hurtValue = playerHurtList[0][1]
- NPCCommon.GameServer_KillGameWorldBoss(bossID, killerName, hurtValue)
-
- NPCCommon.GameServe_GameWorldBossState(bossID, 0)
+ if playerHurtList:
+ killerName, hurtValue = playerHurtList[0][1]
+ NPCCommon.GameServer_KillGameWorldBoss(bossID, killerName, hurtValue)
- __DoLogicSealDemonOver(1, tick, dropPosX, dropPosY)
- gameFB.SetGameFBDict(FBDict_IsOver, tick)
+ NPCCommon.GameServe_GameWorldBossState(bossID, 0)
+ __DoLogicSealDemonOver(1, tick, dropPosX, dropPosY)
+ GameWorld.GetGameFB().SetGameFBDict(FBDict_IsOver, tick)
return
+
def __GetSortHurtList(lineID):
playerHurtDict = PyGameData.g_sealDemonPlayerHurtDict.get(lineID, {})
@@ -622,61 +605,13 @@
return
-def UpdateHPReduceSpeed(tick, isExit=False):
- mapID = GameWorld.GetMap().GetMapID()
- if mapID == ChConfig.Def_FBMapID_SealDemonEx:
- return
- playerCnt = GameWorld.GetGameWorld().GetMapCopyPlayerManager().GetPlayerCount()
- playerCnt = playerCnt - 1 if isExit else playerCnt
- if playerCnt <=0:
- return
- lineID = GameWorld.GetGameWorld().GetPropertyID() - 1
- if lineID < 0:
- return
- gameWorld = GameWorld.GetGameWorld()
- startTick = gameWorld.GetGameWorldDictByKey(FBDict_StartTick % lineID)
- lastSpeed = gameWorld.GetGameWorldDictByKey(FBDict_Speed % lineID)
- remainHP = gameWorld.GetGameWorldDictByKey(FBDict_RemainHP % lineID)
- curSpeed = int(min(1 + 0.08 * (playerCnt - 1), 1.8) * 1000)
- if not startTick:
- startTick = tick
- lastSpeed = curSpeed
- remainHP = __GetBossTotalHP()
- remainHP = max(0, int((remainHP - (tick - startTick) / 1000.0 * lastSpeed)))
- gameWorld.SetGameWorldDict(FBDict_StartTick % lineID, tick)
- gameWorld.SetGameWorldDict(FBDict_Speed % lineID, curSpeed)
- gameWorld.SetGameWorldDict(FBDict_RemainHP % lineID, remainHP)
- GameWorld.DebugLog(' curSpeed=%s, remainHP=%s, passTime=%s, lastSpeed=%s' % (curSpeed, remainHP, tick - startTick, lastSpeed))
- FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 0)
- return
-
-def __GetBossTotalHP():
- lineID = GameWorld.GetGameWorld().GetPropertyID() - 1
- bossID = CurFBLineBOSSID(lineID)
- ipyData = IpyGameDataPY.GetIpyGameData('SealDemon', bossID)
- if not ipyData:
- return 0
- return ipyData.GetKillTime() * 1000
-
-def GetBossRemainHP(lineID, tick):
- gameWorld = GameWorld.GetGameWorld()
+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)
- startTick = gameWorld.GetGameWorldDictByKey(FBDict_StartTick % lineID)
- lastSpeed = gameWorld.GetGameWorldDictByKey(FBDict_Speed % lineID)
- remainHP = gameWorld.GetGameWorldDictByKey(FBDict_RemainHP % lineID)
- if not startTick:
- startTick = tick
- remainHP = __GetBossTotalHP()
- else:
- remainHP = max(0, int((remainHP - (tick - startTick) / 1000.0 * lastSpeed)))
- return remainHP
-
-def GetBossRemainHPPer(lineID, tick):
- remainHP = GetBossRemainHP(lineID, tick)
- totalHP = __GetBossTotalHP()
- if not totalHP:
- return 0
- return remainHP * 100 / totalHP
def CurFBLineBOSSID(lineID= -1):
#该分线刷的BOSSID
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 6fe82c7..9fb347b 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
@@ -28,21 +28,15 @@
import ChPyNetSendPack
import ShareDefine
import PlayerSuccess
-import PlayerActivity
+import GameObj
import NetPackCommon
import ItemControler
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血量
-FBDict_LastHurtTick = 'FBDict_LastHurtTick' #上次伤害时间
g_heroHurtDict = {} #{playerID:hurt}
@@ -138,8 +132,6 @@
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
## 进副本
@@ -169,8 +161,7 @@
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)
@@ -179,7 +170,7 @@
else:
FBCommon.SendFBEncourageInfo(curPlayer, encourageLV)
- #DoFBHelp(curPlayer, tick)
+ DoFBHelp(curPlayer, tick)
return
##关闭副本
@@ -188,11 +179,7 @@
# @remarks
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)
-
+
gameWorld.SetPropertyID(0)
return
@@ -208,13 +195,11 @@
if gameWorld.GetMapCopyPlayerManager().GetPlayerCount() == 1:
lineID = gameWorld.GetPropertyID() - 1
PyGameData.g_ZhuXianBossPlayerHurtDict[lineID] = {}
- gameWorld.SetGameWorldDict(FBDict_StartTick % lineID, 0)
+
GameWorld.GetGameFB().ClearGameFBDict()
GameWorldProcess.CloseFB(tick)
return
-
- UpdateHPReduceSpeed(tick, True)
-
+
return
##玩家主动离开副本.
@@ -228,8 +213,6 @@
playerHurtDict = PyGameData.g_ZhuXianBossPlayerHurtDict.get(lineID, {})
playerHurtDict.pop(curPlayer.GetPlayerID(), 0)
PyGameData.g_ZhuXianBossPlayerHurtDict[lineID] = playerHurtDict
- if not playerHurtDict: #榜上没人,停止掉血
- StopReduceHP(lineID, tick)
return
##玩家切换地图
@@ -267,26 +250,11 @@
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(1000000, remainHP * 1000000 / totalHP) if totalHP else 0
myHurt = g_heroHurtDict.get(curPlayer.GetID(), 0)
- fbHelpDict = {FBCommon.Help_lineID:lineID, "hurtInfo":hurtInfo, 'hpReduceSpeed':hpReduceSpeed,
- 'remainHPPer':remainHPPer, 'isReduceing':isReduceing,'myHurt':myHurt % ChConfig.Def_PerPointValue,
+ fbHelpDict = {FBCommon.Help_lineID:lineID, "hurtInfo":hurtInfo,
+ 'myHurt':myHurt % ChConfig.Def_PerPointValue,
'myHurtEx':myHurt / ChConfig.Def_PerPointValue
}
GameWorld.DebugLog("DoFBHelp: %s" % fbHelpDict, curPlayer.GetPlayerID())
@@ -325,7 +293,6 @@
# @return None
def DoFB_Player_HurtNPC(curPlayer, curNPC, hurtHP):
UpdateHurtInfo(curPlayer, hurtHP)
- GameWorld.GetGameFB().SetGameFBDict(FBDict_LastHurtTick, GameWorld.GetGameWorld().GetTick())
return
#
def UpdateHurtInfo(curPlayer, hurtHP, isAdd=False):
@@ -350,8 +317,6 @@
else:
playerHurtDict[playerID][1] += hurtHP
PyGameData.g_ZhuXianBossPlayerHurtDict[lineID] = playerHurtDict
- #有人上榜开始掉血
- StartReduceHP(lineID, GameWorld.GetGameWorld().GetTick())
return
##---副本总逻辑计时器---
@@ -370,19 +335,12 @@
lineID = GameWorld.GetGameWorld().GetPropertyID() - 1
if lineID <0:
return
- gameWorld = GameWorld.GetGameWorld()
- startTick = gameWorld.GetGameWorldDictByKey(FBDict_StartTick % lineID)
- if not startTick or overTick:
+
+ if overTick:
return
- lastHurtTick = gameFB.GetGameFBDictByKey(FBDict_LastHurtTick)
- if lastHurtTick and tick - lastHurtTick >= 2000:
- StopReduceHP(lineID, tick)
- GameWorld.GetGameFB().SetGameFBDict(FBDict_LastHurtTick, 0)
-
+
FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 5000)
- __CheckBossHP(tick)
-
-
+
return
@@ -536,115 +494,43 @@
FBCommon.NotifyFBOver(curPlayer, ChConfig.Def_FBMapID_ZhuXianBoss, lineID, isPass, overDict)
return
+def DoFB_Npc_KillNPC(attacker, curNPC, tick):
+ __FBNPCOnKilled(curNPC, tick)
+ return
+def DoFB_Player_KillNPC(curPlayer, curNPC, tick):
+ __FBNPCOnKilled(curNPC, tick)
+ return
-def __CheckBossHP(tick):
- gameFB = GameWorld.GetGameFB()
- isOver = gameFB.GetGameFBDictByKey(FBDict_IsOver)
+## 执行副本杀怪逻辑
+def __FBNPCOnKilled(curNPC, tick):
lineID = GameWorld.GetGameWorld().GetPropertyID() - 1
+ bossID = CurFBLineBOSSID(lineID)
+ if curNPC.GetNPCID() != bossID:
+ return
+
+ dropPosX, dropPosY = curNPC.GetPosX(), curNPC.GetPosY()
+
+ #结束 设置BOSS死亡
+ FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 0)
+ GameWorld.DebugLog('结束 设置BOSS死亡 lineID=%s' % lineID)
+ playerHurtList = __GetSortHurtList(lineID)
- 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()
+ if playerHurtList:
+ killerName, hurtValue = playerHurtList[0][1][:2]
+ NPCCommon.GameServer_KillGameWorldBoss(bossID, killerName, hurtValue)
- #结束 设置BOSS死亡
- FBCommon.ClearFBNPC()
- 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)
+ NPCCommon.GameServe_GameWorldBossState(bossID, 0)
+
+ __DoLogicZhuXianBossOver(1, tick, dropPosX, dropPosY)
+ GameWorld.GetGameFB().SetGameFBDict(FBDict_IsOver, 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
- lineID = GameWorld.GetGameWorld().GetPropertyID() - 1
- if lineID < 0:
- 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
-
- 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))
- FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 0)
- 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)
- FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 0)
- 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
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
index 558a898..673aadb 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
@@ -3555,14 +3555,13 @@
def DoHPPerLogic(self, dropType, ownerID):
curNPC = self.__Instance
curNPCID = curNPC.GetNPCID()
- hpPerLogicNPCIDList = ReadChConfig.GetEvalChConfig('HPPerLogicNPCIDList')
- if curNPCID not in hpPerLogicNPCIDList:
+
+ hpPerLogicNPCIDDict = IpyGameDataPY.GetFuncEvalCfg('BossHPInformation', 1, {})
+ hpPerLogicList = GameWorld.GetDictValueByKey(hpPerLogicNPCIDDict, curNPCID)
+ if not hpPerLogicList:
return
-
- hpPerLogicDict = ReadChConfig.GetEvalChConfig('HPPerLogic_%s' % curNPCID)
-
- hpPerList = sorted(hpPerLogicDict.keys(), reverse=True)
-
+ hpPerList, sysMark = hpPerLogicList
+ hpPerList = sorted(hpPerList, reverse=True)
nowHPPer = GameObj.GetHP(curNPC) * 100 / GameObj.GetMaxHP(curNPC) # 当前百分比
hpPerLogicMark = curNPC.GetDictByKey(ChConfig.Def_NPC_Dict_HPPerLogicMark)
logicHPPerList = hpPerList[hpPerLogicMark:]
@@ -3575,16 +3574,12 @@
#GameWorld.DebugLog("DoHPPerLogic npcID=%s,hpPerLogicDict=%s,nowHPPer=%s,hpPerLogicMark=%s,logicHPPerList=%s"
# % (curNPCID, str(hpPerLogicDict), nowHPPer, hpPerLogicMark, str(logicHPPerList)))
- isNotify, dropItemTemplate, addPrestigeFormat = hpPerLogicDict[hpPer]
- if isNotify:
- PlayerControl.WorldNotify(0, "FB_liubo_0", [GameWorld.GetMap().GetMapID(), curNPCID, hpPer])
+
+ PlayerControl.WorldNotify(0, sysMark, [curNPCID, hpPer])
# if dropItemTemplate > 0:
# self.__DropItemByTemplate(dropItemTemplate, dropType, ownerID)
# PlayerControl.WorldNotify(0, "GeRen_admin_481766", [GameWorld.GetMap().GetMapID(), curNPCID, curNPCID])
-
- if addPrestigeFormat != '':
- self.__GiveNearbyPlayerPrestige(addPrestigeFormat, ChConfig.Def_Matrix_Six)
hpPerLogicMark += 1
#GameWorld.DebugLog("DoHPPerLogic update hpPerLogicMark=%s" % (hpPerLogicMark))
@@ -3894,11 +3889,11 @@
#杀死NPC, 触发任务
self.__EventKillNpc()
- #mapID = GameWorld.GetMap().GetMapID()
+ mapID = GameWorld.GetMap().GetMapID()
killerName = "" if not self.__Killer else self.__Killer.GetPlayerName()
# 记录boss击杀信息的NPC
bossIpyData = IpyGameDataPY.GetIpyGameDataListNotLog('BOSSInfo', npcID)
- if bossIpyData:
+ if bossIpyData and mapID not in [ChConfig.Def_FBMapID_ZhuXianBoss, ChConfig.Def_FBMapID_SealDemon]:
if GetDropOwnerType(curNPC) == ChConfig.DropOwnerType_Family:
killerName = FamilyRobBoss.FamilyOwnerBossOnKilled(curNPC, self.__OwnerHurtID)
#KillerJob = 0 if not self.__Killer else self.__Killer.GetJob()
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_EnterFB.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_EnterFB.py
index 6876be5..89a7e9c 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_EnterFB.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_EnterFB.py
@@ -166,13 +166,13 @@
# 如果不是同一线路属性的,则跳过
if propertyID == tagMapPropertyID:
if tagMapID == ChConfig.Def_FBMapID_SealDemon:
- if GameLogic_SealDemon.GetBossRemainHPPer(tagMapLineID, tick) < 15:
+ if GameLogic_SealDemon.GetBossRemainHPPer(index, tagMapLineID, tick) < 15:
findGameWord = None
findPlayerManager = None
notifyMark = "DemonJar_Text4"
break
elif tagMapID == ChConfig.Def_FBMapID_ZhuXianBoss:
- if GameLogic_ZhuXianBoss.GetBossRemainHPPer(tagMapLineID, tick) < 15:
+ if GameLogic_ZhuXianBoss.GetBossRemainHPPer(index, tagMapLineID, tick) < 15:
findGameWord = None
findPlayerManager = None
notifyMark = "DemonJar_Text4"
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_FBLinePlayerCnt.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_FBLinePlayerCnt.py
index bc9e4e7..e38ff46 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_FBLinePlayerCnt.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_FBLinePlayerCnt.py
@@ -105,7 +105,7 @@
if not isAllLine and tagFBLineID != fblineID:
continue
playerCnt = playerManager.GetPlayerCount()
- hpPer = GameLogic_HorsePetBoss.GetBossRemainHPPer(fblineID, tick)
+ hpPer = GameLogic_HorsePetBoss.GetBossRemainHPPer(index, fblineID, tick)
fbLinePlayerCntDict[fblineID] = [playerCnt, str(hpPer)]
if not isAllLine:
break
@@ -120,7 +120,7 @@
if not isAllLine and tagFBLineID != fblineID:
continue
playerCnt = playerManager.GetPlayerCount()
- hpPer = GameLogic_AllFamilyBoss.GetBossRemainHPPer(tick)
+ hpPer = GameLogic_AllFamilyBoss.GetBossRemainHPPer(index, tick)
fbLinePlayerCntDict[fblineID] = [playerCnt, str(hpPer)]
if not isAllLine:
break
--
Gitblit v1.8.0