| New file |
| | |
| | | #!/usr/bin/python
|
| | | # -*- coding: GBK -*-
|
| | | #-------------------------------------------------------------------------------
|
| | | #
|
| | | ##@package GameWorldLogic.FBProcess.GameLogic_HorsePetBoss
|
| | | #
|
| | | # @todo:骑宠boss
|
| | | # @author xdh
|
| | | # @date 2019-03-22
|
| | | # @version 1.0
|
| | | #
|
| | | # 详细描述: 骑宠boss
|
| | | #
|
| | | #-------------------------------------------------------------------------------
|
| | | #"""Version = 2019-03-22 14:30"""
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | import FBCommon
|
| | | import GameWorld
|
| | | import IPY_GameWorld
|
| | | import GameWorldProcess
|
| | | import IpyGameDataPY
|
| | | import ChConfig
|
| | | import PyGameData
|
| | | import PlayerControl
|
| | | import ShareDefine
|
| | | import PlayerActivity
|
| | | import NPCCustomRefresh
|
| | | import ItemControler
|
| | | import EventReport
|
| | | import NPCCommon
|
| | |
|
| | | 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时间
|
| | | Def_LeaveTime, #离开时间
|
| | | Def_HPSpeed, #掉血速度公式
|
| | | ) = range(3)
|
| | | |
| | | #当前副本地图的状态
|
| | | (
|
| | | FB_Step_Open, # 副本开启
|
| | | FB_Step_Fighting, # 副本进行中
|
| | | FB_Step_Over, # 副本结束
|
| | | FB_Step_Close, # 副本关闭
|
| | | ) = range(4)
|
| | | |
| | | def OnFBPlayerOnLogin(curPlayer):
|
| | | return
|
| | |
|
| | | def OnFBPlayerOnDay(curPlayer):
|
| | | return
|
| | |
|
| | |
|
| | | ## 是否能够通过活动查询进入
|
| | | # @param curPlayer 玩家实例
|
| | | # @param mapID 地图ID
|
| | | # @param lineID 线路id
|
| | | # @param tick 时间戳
|
| | | # @return 布尔值
|
| | | def OnEnterFBEvent(curPlayer, mapID, lineID, tick):
|
| | | return True
|
| | |
|
| | | ##副本玩家进入点
|
| | | # @param curPlayer 玩家实例
|
| | | # @param mapID 地图ID
|
| | | # @param lineId 分线ID
|
| | | # @param ipyEnterPosInfo 功能线路IPY配置坐标信息
|
| | | # @param tick 时间戳
|
| | | # @return posX, posY, 随机半径(可选)
|
| | | def OnGetFBEnterPos(curPlayer, mapID, lineId, ipyEnterPosInfo, tick):
|
| | | return ipyEnterPosInfo
|
| | |
|
| | | ### 查询地图是否开启
|
| | | ## @param tick 时间戳
|
| | | ## @return 布尔值
|
| | | #def OnCanOpen(tick):
|
| | | # return True
|
| | |
|
| | | ##查询是否可以进入地图
|
| | | # @param ask:请求结构体(IPY_BMChangeMapAsk)
|
| | | # @param tick:时间戳
|
| | | # @return IPY_GameWorld.cme 枚举
|
| | | def OnChangeMapAsk(ask, tick):
|
| | | return IPY_GameWorld.cmeAccept
|
| | |
|
| | | ##开启副本
|
| | | # @param tick 时间戳
|
| | | # @return 返回值无意义
|
| | | # @remarks 开启副本
|
| | | def OnOpenFB(tick):
|
| | | lineID = GameWorld.GetGameWorld().GetPropertyID() - 1
|
| | | bossID = CurFBLineBOSSID(lineID)
|
| | | 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):
|
| | | #活动状态变更
|
| | | mapID = GameWorld.GetMap().GetMapID()
|
| | | if mapID != ChConfig.Def_FBMapID_HorsePetBoss:
|
| | | return
|
| | | GameWorld.DebugLog(' 骑宠BOSS活动状态变更 state=%s' % state)
|
| | |
|
| | | if not state:
|
| | | if GameWorld.GetGameFB().GetFBStep() == FB_Step_Fighting:
|
| | | GameWorld.GetGameFB().SetGameFBDict(FBDict_IsOver, tick)
|
| | | __DoLogicHorsePetBossOver(0, tick, 0, 0)
|
| | | return
|
| | |
|
| | | ## 进副本
|
| | | # @param curPlayer
|
| | | # @param tick
|
| | | # @return None
|
| | | def DoEnterFB(curPlayer, tick):
|
| | | playerID = curPlayer.GetPlayerID()
|
| | |
|
| | | lineID = GameWorld.GetGameWorld().GetPropertyID() - 1 |
| | | |
| | | playerCnt = GameWorld.GetGameWorld().GetMapCopyPlayerManager().GetPlayerCount()
|
| | | GameWorld.DebugLog("DoEnterFB...playerCnt=%s,lineID=%s" % (playerCnt, lineID), playerID)
|
| | | |
| | | if lineID < 0:
|
| | | PlayerControl.PlayerLeaveFB(curPlayer)
|
| | | return
|
| | | fbStep = GameWorld.GetGameFB().GetFBStep()
|
| | | if fbStep >= FB_Step_Over:
|
| | | PlayerControl.PlayerLeaveFB(curPlayer)
|
| | | return
|
| | | hadDelTicket = FBCommon.GetHadDelTicket(curPlayer)
|
| | | if not hadDelTicket:
|
| | | FBCommon.SetHadDelTicket(curPlayer)
|
| | | PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_HorsePetBoss, 1)
|
| | | EventReport.WriteEvent_FB(curPlayer, ChConfig.Def_FBMapID_HorsePetBoss, 0, ChConfig.CME_Log_Start)
|
| | |
|
| | | 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)
|
| | | if encourageLV > 0:
|
| | | FBCommon.AddFbEncourageBuff(curPlayer, FBPlayerDict_EncourageLV, tick)
|
| | | else:
|
| | | FBCommon.SendFBEncourageInfo(curPlayer, encourageLV)
|
| | | |
| | | DoFBHelp(curPlayer, tick)
|
| | | return
|
| | |
|
| | | ##关闭副本
|
| | | # @param tick 时间戳
|
| | | # @return 无意义
|
| | | # @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
|
| | |
|
| | | ##玩家退出副本
|
| | | # @param curPlayer 玩家实例
|
| | | # @param tick 时间戳
|
| | | # @return 无意义
|
| | | def DoExitFB(curPlayer, tick):
|
| | | gameWorld = GameWorld.GetGameWorld()
|
| | | # 清除鼓舞buff
|
| | | FBCommon.ClearEncourageBuff(curPlayer, tick)
|
| | | # #最后一人
|
| | | # if gameWorld.GetMapCopyPlayerManager().GetPlayerCount() == 1:
|
| | | # lineID = gameWorld.GetPropertyID() - 1
|
| | | # PyGameData.g_horsePetBossPlayerHurtDict[lineID] = {}
|
| | | # gameWorld.SetGameWorldDict(FBDict_StartTick % lineID, 0)
|
| | | # GameWorld.GetGameFB().ClearGameFBDict()
|
| | | # GameWorldProcess.CloseFB(tick)
|
| | | # return
|
| | | |
| | | UpdateHPReduceSpeed(tick, True)
|
| | | |
| | | return
|
| | |
|
| | | ##玩家主动离开副本.
|
| | | # @param curPlayer 玩家实例
|
| | | # @param tick 时间戳
|
| | | # @return 返回值无意义
|
| | | def DoPlayerLeaveFB(curPlayer, tick):
|
| | | #FBCommon.SetHadDelTicket(curPlayer, 0)
|
| | | #主动退出的去掉排行榜信息
|
| | | lineID = GameWorld.GetGameWorld().GetPropertyID() - 1
|
| | | playerHurtDict = PyGameData.g_horsePetBossPlayerHurtDict.get(lineID, {})
|
| | | playerHurtDict.pop(curPlayer.GetPlayerID(), 0)
|
| | | PyGameData.g_horsePetBossPlayerHurtDict[lineID] = playerHurtDict
|
| | | if not playerHurtDict: #榜上没人,停止掉血
|
| | | StopReduceHP(lineID, tick)
|
| | | return
|
| | |
|
| | | ##玩家切换地图
|
| | | def DoPlayerChangeMapLogic(curPlayer):
|
| | | #FBCommon.SetHadDelTicket(curPlayer, 0)
|
| | | return
|
| | |
|
| | | ## 是否副本复活
|
| | | # @param None
|
| | | # @return 是否副本复活
|
| | | def OnPlayerReborn():
|
| | | return True
|
| | |
|
| | |
|
| | | ## 获得副本帮助信息
|
| | | # @param curPlayer 当前玩家(被通知对象)
|
| | | # @param tick 当前时间
|
| | | # @return None
|
| | | def DoFBHelp(curPlayer, tick):
|
| | | #伤害排行信息
|
| | | if GameWorld.GetGameFB().GetGameFBDictByKey(FBDict_IsOver):
|
| | | return
|
| | | hurtInfo = []
|
| | | lineID = GameWorld.GetGameWorld().GetPropertyID() - 1
|
| | | |
| | | playerHurtList = __GetSortHurtList(lineID)
|
| | | myPlayerID = curPlayer.GetPlayerID()
|
| | | myRank, myHurt = 0, 0
|
| | | for i, info in enumerate(playerHurtList, 1):
|
| | | playerID = info[0]
|
| | | playerName, hurt = info[1][:2]
|
| | | if playerID == myPlayerID:
|
| | | myRank, myHurt = i, hurt
|
| | | if i <= 5:
|
| | | hurtDict = {}
|
| | | hurtDict["rank"] = i
|
| | | 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
|
| | |
|
| | | 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
|
| | | }
|
| | | GameWorld.DebugLog("DoFBHelp: %s" % fbHelpDict, curPlayer.GetPlayerID())
|
| | | FBCommon.Notify_FBHelp(curPlayer, fbHelpDict)
|
| | | return
|
| | |
|
| | |
|
| | | ## 副本行为
|
| | | # @param curPlayer 玩家
|
| | | # @param actionType 行为类型
|
| | | # @param actionInfo 行为信息
|
| | | # @param tick 当前时间
|
| | | # @return None
|
| | | def DoFBAction(curPlayer, actionType, actionInfo, tick):
|
| | | if actionType == 0:
|
| | | FBCommon.FbEncourageBuff(curPlayer, FBPlayerDict_EncourageLV, actionInfo, tick)
|
| | | return
|
| | |
|
| | |
|
| | |
|
| | | ## 玩家对NPC造成伤害
|
| | | # @param curPlayer 当前玩家
|
| | | # @param curNPC |
| | | # @param hurtHP |
| | | # @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):
|
| | | playerID = curPlayer.GetPlayerID()
|
| | |
|
| | | lineID = GameWorld.GetGameWorld().GetPropertyID() - 1
|
| | | playerName = curPlayer.GetName() |
| | |
|
| | | playerHurtDict = PyGameData.g_horsePetBossPlayerHurtDict.get(lineID, {})
|
| | | if playerID not in playerHurtDict:
|
| | | if not isAdd:
|
| | | return
|
| | | playerHurtDict[playerID] = [playerName, hurtHP]
|
| | | else:
|
| | | playerHurtDict[playerID][1] += hurtHP
|
| | | PyGameData.g_horsePetBossPlayerHurtDict[lineID] = playerHurtDict
|
| | | return
|
| | |
|
| | | ##---副本总逻辑计时器---
|
| | | # @param tick:时间戳
|
| | | # @return 无意义
|
| | | # @remarks 副本总逻辑计时器
|
| | | def OnProcess(tick):
|
| | | gameFB = GameWorld.GetGameFB()
|
| | | gameWorld = GameWorld.GetGameWorld()
|
| | | overTick = gameFB.GetGameFBDictByKey(FBDict_IsOver)
|
| | | fbStep = gameFB.GetFBStep()
|
| | | lineID = gameWorld.GetPropertyID() - 1
|
| | | if lineID < 0:
|
| | | return
|
| | | if fbStep == FB_Step_Over:
|
| | | mapID = GameWorld.GetMap().GetMapID()
|
| | | leaveTick = FBCommon.GetFBLineStepTime(mapID, lineID)[Def_LeaveTime] * 1000
|
| | | if tick - GameWorld.GetGameFB().GetFBStepTick() > leaveTick:
|
| | | GameWorld.Log("强制踢出玩家关闭副本: overTick=%s,tick=%s" % (overTick, tick))
|
| | | GameWorldProcess.CloseFB(tick)
|
| | | FBCommon.SetFBStep(FB_Step_Close, tick)
|
| | | return
|
| | | |
| | | elif fbStep == FB_Step_Fighting:
|
| | | startTick = gameWorld.GetGameWorldDictByKey(FBDict_StartTick % lineID)
|
| | | if not startTick or 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
|
| | |
|
| | |
|
| | | def __GetSortHurtList(lineID):
|
| | | playerHurtDict = PyGameData.g_horsePetBossPlayerHurtDict.get(lineID, {})
|
| | | playerHurtList = sorted(playerHurtDict.iteritems(), key=lambda asd:asd[1][1], reverse=True)
|
| | | return playerHurtList
|
| | |
|
| | |
|
| | | def __DoLogicHorsePetBossOver(isPass, tick, dropPosX, dropPosY):
|
| | | #结算
|
| | | FBCommon.SetFBStep(FB_Step_Over, tick)
|
| | | |
| | |
|
| | | mapID = GameWorld.GetMap().GetMapID()
|
| | | lineID = GameWorld.GetGameWorld().GetPropertyID() - 1
|
| | | msgStr = str(lineID)
|
| | | GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'HorsePetBossOver', msgStr, len(msgStr))
|
| | | |
| | | leaveTick = FBCommon.GetFBLineStepTime(mapID, lineID)[Def_LeaveTime] * 1000
|
| | | playerHurtList = __GetSortHurtList(lineID)
|
| | | if not playerHurtList:
|
| | | GameWorld.Log(' __DoLogicHorsePetBossOver, 伤害榜上没有人!!lineID=%s'%lineID)
|
| | | return
|
| | | |
| | | event = ["HorsePetBoss", False, {}]
|
| | | batchPlayerIDList, batchAddItemList, batchParamList, batchDetailList = [], [], [], []
|
| | | playerManager = GameWorld.GetMapCopyPlayerManager()
|
| | | worldLV = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_WorldAverageLv)
|
| | | for rank, hurtInfo in enumerate(playerHurtList, 1):
|
| | | playerID = hurtInfo[0]
|
| | | if isPass:
|
| | | auctionItemList, itemList = __GetHorsePetBossAward(lineID, rank, worldLV)
|
| | | else:
|
| | | auctionItemList, itemList = [], []
|
| | | GameWorld.Log('auctionItemList=%s,itemList=%s'%(auctionItemList, itemList))
|
| | | giveItemList = auctionItemList+itemList
|
| | | player = playerManager.FindPlayerByID(playerID)
|
| | | if player:
|
| | | overDict = {FBCommon.Over_rank:rank}
|
| | | if auctionItemList:
|
| | | overDict['AuctionItem'] = FBCommon.GetJsonItemList(auctionItemList)
|
| | | if itemList:
|
| | | overDict[FBCommon.Over_itemInfo] = FBCommon.GetJsonItemList(itemList)
|
| | | if giveItemList:
|
| | | NPCCommon.DoVirtualItemDrop(player, giveItemList, dropPosX, dropPosY)
|
| | | |
| | | ItemControler.GivePlayerItemOrMail(player, giveItemList, 'QCBOSS1', event)
|
| | | player.Sync_TimeTick(IPY_GameWorld.tttLeaveMap, 0, leaveTick, True)
|
| | | FBCommon.NotifyFBOver(player, ChConfig.Def_FBMapID_HorsePetBoss, lineID, isPass, overDict)
|
| | | elif giveItemList:
|
| | | batchPlayerIDList.append([playerID])
|
| | | batchAddItemList.append(giveItemList)
|
| | | batchParamList.append([])
|
| | | batchDetailList.append({'rank':rank, 'lineID':lineID})
|
| | | if batchPlayerIDList:
|
| | | PlayerControl.SendMailBatch("QCBOSS2", batchPlayerIDList, batchAddItemList, batchParamList, batchDetail=batchDetailList)
|
| | | return
|
| | |
|
| | | def __GetHorsePetBossAward(lineID, rank, worldLV):
|
| | | auctionItemList, itemList = [], []
|
| | | |
| | | ipyDataList = IpyGameDataPY.GetIpyGameDataList('HorsePetBossAward', lineID)
|
| | | if not ipyDataList:
|
| | | return auctionItemList, itemList
|
| | | awardRateList = []
|
| | | 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奖励表 未配置该奖励 lineID=%s, rank=%s,worldLV=%s' % (lineID, rank, worldLV))
|
| | | return auctionItemList, itemList
|
| | | for rate, itemInfo in awardRateList:
|
| | | if not GameWorld.CanHappen(rate, 10000):
|
| | | continue
|
| | | if len(itemInfo) != 3:
|
| | | GameWorld.ErrLog('骑宠Boss奖励表 配置错误 itemInfo=%s' % itemInfo)
|
| | | continue
|
| | | if itemInfo[2]:
|
| | | auctionItemList.append(itemInfo)
|
| | | else:
|
| | | itemList.append(itemInfo)
|
| | | |
| | | return auctionItemList, itemList
|
| | |
|
| | |
|
| | |
|
| | | def __CheckBossHP(tick):
|
| | | gameFB = GameWorld.GetGameFB()
|
| | | isOver = gameFB.GetGameFBDictByKey(FBDict_IsOver)
|
| | | 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, remainPer])
|
| | | 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 = eval(FBCommon.GetFBLineStepTime(ChConfig.Def_FBMapID_HorsePetBoss, lineID)[Def_HPSpeed])
|
| | | 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 CurFBLineBOSSID(lineID= -1):
|
| | | #该分线刷的BOSSID
|
| | | if lineID == -1:
|
| | | lineID = GameWorld.GetGameWorld().GetPropertyID() - 1
|
| | | refreshNPCInfo = FBCommon.GetFBLineRefreshNPC(ChConfig.Def_FBMapID_HorsePetBoss, lineID)
|
| | | if not refreshNPCInfo:
|
| | | return 0
|
| | | bossID = int(refreshNPCInfo)
|
| | | return bossID
|
| | |
|
| | | ##玩家死亡.
|
| | | # @param curPlayer:死亡的玩家 |
| | | # @param tick 时间戳
|
| | | # @return 返回值无意义
|
| | | # @remarks 玩家主动离开副本.
|
| | | def DoPlayerDead(curPlayer):
|
| | | return
|
| | |
|
| | | ## 检查是否可攻击, 主判定不可攻击的情况,其他逻辑由外层决定
|
| | | # @param attacker 攻击方
|
| | | # @param defender 防守方
|
| | | # @return bool
|
| | | def CheckCanAttackTagObjInFB(attacker, defender):
|
| | | |
| | | return True
|
| | |
|
| | | ##处理副本中杀死玩家逻辑
|
| | | # @param curPlayer 玩家实例
|
| | | # @param defender 防守者
|
| | | # @param tick 时间戳
|
| | | # @return 布尔值
|
| | | # @remarks 处理副本中杀死玩家逻辑
|
| | | def DoFBOnKill_Player(atkobj, defender, tick):
|
| | | return True |