From e36d3d08ba14c81bfc159a2797d7c36b5f159ebc Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期五, 18 十月 2019 13:29:08 +0800 Subject: [PATCH] 4597 【主干】拍品装备无法兑换活跃令(拍品改为可兑换) --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_AllFamilyBoss.py | 293 +++++++++++++++++++++++----------------------------------- 1 files changed, 115 insertions(+), 178 deletions(-) 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 45f3a77..e969313 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 @@ -21,38 +21,39 @@ import GameWorldProcess import IpyGameDataPY import ChConfig +import PlayerBossReborn import PyGameData import PlayerControl import ShareDefine import NPCCustomRefresh import PlayerAuctionHouse import ItemControler +import PlayerWeekParty import PlayerActivity +import PlayerFairyCeremony +import PlayerNewFairyCeremony +import NPCCommon 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' #是否掉血中 -FBPlayerDict_Rank = "FBPlayerDict_Rank" # 玩家排名 -FBDict_BossTotalHP = 'FBDict_BossTotalHP' #BOSS血量 -FBDict_LastHurtTick = 'FBDict_LastHurtTick' #上次伤害时间 -FBDict_IsEncourage = 'FBDict_IsEncourage' #是否鼓舞过 +FBDict_EncourageCnt = 'FBDict_EncourageCnt' #鼓舞过次数 +Map_FB_StartTick = 'Map_FB_StartTick' #活动开始时间 ( - Def_BossTime, #BOSS时间 - Def_LeaveTime,#离开时间 + Def_BossTime, #BOSS时间 + Def_LeaveTime, #离开时间 ) = range(2) #当前副本地图的状态 ( -FB_Step_Open, # 副本开启 -FB_Step_Fighting, # 副本进行中 -FB_Step_Over, # 副本结束 -FB_Step_Close, # 副本关闭 +FB_Step_Open, # 副本开启 +FB_Step_Fighting, # 副本进行中 +FB_Step_Over, # 副本结束 +FB_Step_Close, # 副本关闭 ) = range(4) + def OnFBPlayerOnLogin(curPlayer): @@ -113,8 +114,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 @@ -124,13 +123,23 @@ if mapID != ChConfig.Def_FBMapID_AllFamilyBoss: return GameWorld.DebugLog(' 多仙盟BOSS活动状态变更 state=%s' % state) - - if not state: - if GameWorld.GetGameWorld().GetGameWorldDictByKey(FBDict_StartTick) and not GameWorld.GetGameFB().GetGameFBDictByKey(FBDict_IsOver): + + if state: + if not GameWorld.GetGameWorld().GetGameWorldDictByKey(Map_FB_StartTick): + GameWorld.GetGameWorld().SetGameWorldDict(Map_FB_StartTick, tick) + else: + GameWorld.GetGameWorld().SetGameWorldDict(Map_FB_StartTick, 0) + if not GameWorld.GetGameFB().GetGameFBDictByKey(FBDict_IsOver): GameWorld.GetGameFB().SetGameFBDict(FBDict_IsOver, tick) - __DoLogicAllFamilyBossOver(0, tick) + __DoLogicAllFamilyBossOver(0, tick, 0, 0) return +def __GetRemainTick(tick): + ##活动剩余毫秒 + mapID = GameWorld.GetMap().GetMapID() + startTick = GameWorld.GetGameWorld().GetGameWorldDictByKey(Map_FB_StartTick) + closeFB_RemainTick = max(0, FBCommon.GetFBLineStepTime(mapID)[Def_BossTime] * 1000 - (tick - startTick)) + return closeFB_RemainTick ## 进副本 # @param curPlayer @@ -149,24 +158,25 @@ if not hadDelTicket: FBCommon.SetHadDelTicket(curPlayer) FBCommon.AddEnterFBCount(curPlayer, ChConfig.Def_FBMapID_AllFamilyBoss, 1) - if lineID == 0: - PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_FamilyBoss1, 1) - else: - PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_FamilyBoss2, 1) + + PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_FamilyBoss1, 1) + PlayerBossReborn.AddBossRebornActionCnt(curPlayer, ChConfig.Def_BRAct_FamilyBoss, 1) + PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_FamilyBoss, 1) + PlayerFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_FamilyBoss, 1) + PlayerNewFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_FamilyBoss, 1) if fbStep == FB_Step_Open: FBCommon.SetFBStep(FB_Step_Fighting, tick) EventReport.WriteEvent_FB(curPlayer, ChConfig.Def_FBMapID_AllFamilyBoss, 0, ChConfig.CME_Log_Start) - if fbStep >= FB_Step_Over: - PlayerControl.PlayerLeaveFB(curPlayer) - return + if fbStep >= FB_Step_Over: + PlayerControl.PlayerLeaveFB(curPlayer) + return if familyID not in PyGameData.g_allfamilyBossDict: PyGameData.g_allfamilyBossDict[familyID] = [curPlayer.GetFamilyName(), 0, [playerID]] 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) @@ -174,7 +184,9 @@ FBCommon.AddFbEncourageBuff(curPlayer, FBPlayerDict_EncourageLV, tick, familyID) else: FBCommon.SendFBEncourageInfo(curPlayer, encourageLV, familyID) - + + closeFB_RemainTick = __GetRemainTick(tick) + curPlayer.Sync_TimeTick(IPY_GameWorld.tttTowerTake, 0, closeFB_RemainTick, True) DoFBHelp(curPlayer, tick) return @@ -186,10 +198,6 @@ def OnCloseFB(tick): gameWorld = GameWorld.GetGameWorld() - gameWorld.SetGameWorldDict(FBDict_StartTick, 0) - gameWorld.SetGameWorldDict(FBDict_Speed, 0) - gameWorld.SetGameWorldDict(FBDict_RemainHP, 0) - gameWorld.SetPropertyID(0) PyGameData.g_allfamilyBossDict = {} return @@ -211,8 +219,6 @@ # GameWorldProcess.CloseFB(tick) # return - UpdateHPReduceSpeed(tick, True) - return @@ -229,13 +235,6 @@ if playerID in familyHurtInfo[2]: familyHurtInfo[2].remove(playerID) FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 0) - return - - -##玩家切换地图 -def DoPlayerChangeMapLogic(curPlayer): - #FBCommon.SetHadDelTicket(curPlayer, 0) - return @@ -270,17 +269,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, + IsEncourage = GameWorld.GetGameFB().GetPlayerGameFBDictByKey(playerID, FBDict_EncourageCnt) + 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) @@ -298,15 +291,18 @@ if actionType == 0: playerID = curPlayer.GetID() gameFB = GameWorld.GetGameFB() - if gameFB.GetPlayerGameFBDictByKey(playerID, FBDict_IsEncourage): - GameWorld.DebugLog('只能鼓舞一次!', playerID) + maxEncourageCnt = IpyGameDataPY.GetFuncCfg('LeagueBOSSReward1', 2) + curEncourageCnt = gameFB.GetPlayerGameFBDictByKey(playerID, FBDict_EncourageCnt) + if curEncourageCnt >= maxEncourageCnt: + GameWorld.DebugLog('只能鼓舞%s次!'%maxEncourageCnt, playerID) return if FBCommon.FbEncourageBuff(curPlayer, FBPlayerDict_EncourageLV, actionInfo, tick, curPlayer.GetFamilyID()): - gameFB.SetPlayerGameFBDict(playerID, FBDict_IsEncourage, 1) + gameFB.SetPlayerGameFBDict(playerID, FBDict_EncourageCnt, curEncourageCnt+1) #给鼓舞奖励 itemList = IpyGameDataPY.GetFuncEvalCfg('LeagueBOSSReward1') giveItemList = [[itemID, itemCnt, 0] for itemID, itemCnt in itemList] ItemControler.GivePlayerItemOrMail(curPlayer, giveItemList) + DoFBHelp(curPlayer, tick) return @@ -317,7 +313,6 @@ # @return None def DoFB_Player_HurtNPC(curPlayer, curNPC, hurtHP): UpdateHurtInfo(curPlayer, hurtHP) - GameWorld.GetGameFB().SetGameFBDict(FBDict_LastHurtTick, GameWorld.GetGameWorld().GetTick()) return @@ -330,8 +325,6 @@ PyGameData.g_allfamilyBossDict[familyID][1] += hurtHP - #有人上榜开始掉血 - StartReduceHP(GameWorld.GetGameWorld().GetTick()) return @@ -356,19 +349,12 @@ GameWorldProcess.CloseFB(tick) FBCommon.SetFBStep(FB_Step_Close, tick) 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 @@ -378,7 +364,7 @@ return playerHurtList -def __DoLogicAllFamilyBossOver(isPass, tick): +def __DoLogicAllFamilyBossOver(isPass, tick, dropPosX, dropPosY): #结算 FBCommon.SetFBStep(FB_Step_Over, tick) msgStr = str([]) @@ -396,22 +382,25 @@ if isPass: worldLV = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_WorldAverageLv) - familyAuctionItemDict = {} #{仙盟ID:[[享受收益的成员ID, ...], [[拍品ID,总个数,拍品组数], ...]], ...} + familyAuctionItemDict = {} #{仙盟ID:[[享受收益的成员ID, ...], [[拍品ID,总个数,拍品组数], ...]], ...} batchPlayerIDList, batchAddItemList, batchParamList, batchDetailList = [], [], [], [] - event=["AllFamilyBoss", False, {}] + event = ["AllFamilyBoss", False, {}] needMemberCnt = IpyGameDataPY.GetFuncCfg('LeagueBOSSNumber1') + unlimitRank = IpyGameDataPY.GetFuncCfg('LeagueBOSSNumber1', 2) + bossID = CurFBLineBOSSID(lineID) for rank, hurtInfo in enumerate(playerHurtList, 1): familyID = hurtInfo[0] memberIDList = hurtInfo[1][2] memberCnt = len(memberIDList) - familyAuctionItemList, menberItemList = __GetFamilyBossAward(rank, worldLV) - GameWorld.Log('rank=%s,worldLV=%s,familyAuctionItemList=%s,menberItemList=%s,memberCnt=%s'%(rank, worldLV,familyAuctionItemList,menberItemList, memberCnt), familyID) - + familyAuctionItemList, menberItemList = __GetFamilyBossAward(bossID, rank, worldLV) + GameWorld.Log('rank=%s,worldLV=%s,familyAuctionItemList=%s,menberItemList=%s,memberCnt=%s' % (rank, worldLV, familyAuctionItemList, menberItemList, memberCnt), familyID) + extraVirtualItemList = [] #额外展示假掉落的物品 overDict = {FBCommon.Over_rank:rank, 'memberCnt':len(memberIDList)} - if memberCnt >= needMemberCnt and familyAuctionItemList:#仙盟拍品 + if familyAuctionItemList and (rank <= unlimitRank or memberCnt >= needMemberCnt): #仙盟拍品 familyAuctionItemDict[familyID] = [memberIDList, familyAuctionItemList] + extraVirtualItemList = familyAuctionItemList overDict['AuctionItem'] = FBCommon.GetJsonItemList(familyAuctionItemList) - if menberItemList: #成员奖励 + if menberItemList: #成员奖励 overDict[FBCommon.Over_itemInfo] = FBCommon.GetJsonItemList(menberItemList) mailPlayerIDList = [] @@ -419,7 +408,8 @@ member = playerManager.FindPlayerByID(memberID) if member: if menberItemList: - ItemControler.GivePlayerItemOrMail(member, menberItemList, 'LeagueBOSS1', event) + NPCCommon.DoGiveItemByVirtualDrop(member, menberItemList, bossID, dropPosX, dropPosY, False, 'LeagueBOSS1', extraVirtualItemList) + #ItemControler.GivePlayerItemOrMail(member, menberItemList, 'LeagueBOSS1', event) member.Sync_TimeTick(IPY_GameWorld.tttLeaveMap, 0, leaveTick, True) FBCommon.NotifyFBOver(member, ChConfig.Def_FBMapID_AllFamilyBoss, lineID, isPass, overDict) elif menberItemList: @@ -433,7 +423,7 @@ if batchPlayerIDList: PlayerControl.SendMailBatch("LeagueBOSS2", batchPlayerIDList, batchAddItemList, batchParamList, batchDetail=batchDetailList) if familyAuctionItemDict: - GameWorld.Log('familyAuctionItemDict=%s'%familyAuctionItemDict) + GameWorld.Log('familyAuctionItemDict=%s' % familyAuctionItemDict) PlayerAuctionHouse.DoAddFamilyAuctionItem(familyAuctionItemDict) else: playerCount = playerManager.GetPlayerCount() @@ -441,142 +431,89 @@ curPlayer = playerManager.GetPlayerByIndex(index) if not curPlayer: continue - member.Sync_TimeTick(IPY_GameWorld.tttLeaveMap, 0, leaveTick, True) - FBCommon.NotifyFBOver(member, ChConfig.Def_FBMapID_AllFamilyBoss, lineID, isPass) + curPlayer.Sync_TimeTick(IPY_GameWorld.tttLeaveMap, 0, leaveTick, True) + FBCommon.NotifyFBOver(curPlayer, ChConfig.Def_FBMapID_AllFamilyBoss, lineID, isPass) return -def __GetFamilyBossAward(rank, worldLV): + +def __GetFamilyBossAward(bossID, rank, worldLV): familyAuctionItemList, menberItemList = [], [] awardRateList = [] - ipyMgr = IpyGameDataPY.IPY_Data() - for i in xrange(ipyMgr.GetFamilyBossAwardCount()): - ipyData = ipyMgr.GetFamilyBossAwardByIndex(i) + awardPieRateDict = {} + ipyDataList = IpyGameDataPY.GetIpyGameDataList('FamilyBossAward', bossID) + if not ipyDataList: + return familyAuctionItemList, menberItemList + + for ipyData in ipyDataList: worldLVList = ipyData.GetWorldLV() if worldLV < worldLVList[0] or worldLV > worldLVList[1]: continue rankList = ipyData.GetRank() if rank < rankList[0] or rank > rankList[1]: continue - awardRateList = ipyData.GetAward() - if not awardRateList: - GameWorld.ErrLog('仙盟Boss奖励表 未配置该奖励 rank=%s,worldLV=%s'%(rank, worldLV)) + awardRateList = ipyData.GetAward1() + awardPieRateDict = ipyData.GetAward2() + if not awardRateList and not awardPieRateDict: + GameWorld.ErrLog('仙盟Boss奖励表 未配置该奖励 rank=%s,worldLV=%s' % (rank, worldLV)) return familyAuctionItemList, menberItemList for rate, itemInfo in awardRateList: if not GameWorld.CanHappen(rate, 10000): continue if len(itemInfo) != 3: - GameWorld.ErrLog('仙盟Boss奖励表配置错误 itemInfo=%s'%itemInfo) + GameWorld.ErrLog('仙盟Boss奖励表配置错误 itemInfo=%s' % itemInfo) + continue + if not itemInfo[0]: continue if itemInfo[2]: familyAuctionItemList.append(itemInfo) else: menberItemList.append(itemInfo) + for doCnt, awardPieRateList in awardPieRateDict.items(): + for _ in xrange(doCnt): + resultItem = GameWorld.GetResultByRandomList(awardPieRateList) + if len(resultItem) != 3: + GameWorld.ErrLog('仙盟Boss奖励表配置错误 itemInfo=%s' % resultItem) + continue + if not resultItem[0]: + continue + if resultItem[2]: + familyAuctionItemList.append(resultItem) + else: + menberItemList.append(resultItem) return familyAuctionItemList, menberItemList -def __CheckBossHP(tick): - gameFB = GameWorld.GetGameFB() - isOver = gameFB.GetGameFBDictByKey(FBDict_IsOver) - - if not isOver and GetBossRemainHP(tick) == 0: - - #结束 设置BOSS死亡 - FBCommon.ClearFBNPC() - FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 0) - GameWorld.DebugLog('结束 设置BOSS死亡') - - gameFB.SetGameFBDict(FBDict_IsOver, tick) - - __DoLogicAllFamilyBossOver(1, 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, 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) + GameWorld.DebugLog('结束 设置BOSS死亡') + + GameWorld.GetGameFB().SetGameFBDict(FBDict_IsOver, tick) + dropPosX, dropPosY = curNPC.GetPosX(), curNPC.GetPosY() + __DoLogicAllFamilyBossOver(1, tick, dropPosX, dropPosY) return -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) - - -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 not startTick: - startTick = tick - remainHP = __GetBossTotalHP() - else: - remainHP = max(0, int((remainHP - (tick - startTick) / 1000.0 * lastSpeed))) - return remainHP - - -def GetBossRemainHPPer(tick): - remainHP = GetBossRemainHP(tick) - totalHP = __GetBossTotalHP() - if not totalHP: - return 0 - return remainHP * 100 / totalHP +def GetBossRemainHPPer(copyMapID, tick): + bossID = CurFBLineBOSSID() + curBoss = GameWorld.FindNPCByNPCIDEx(copyMapID, bossID) + if not curBoss: + return 100 + return GameObj.GetHP(curBoss) * 100 / GameObj.GetMaxHP(curBoss) def CurFBLineBOSSID(lineID=-1): -- Gitblit v1.8.0