| #!/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 PlayerWeekParty  | 
| import EventReport  | 
| import NPCCommon  | 
| import GameObj  | 
| import EventShell  | 
|   | 
| FBPlayerDict_EncourageLV = 'FBPlayerDict_EncourageLV'   # ¹ÄÎèµÈ¼¶  | 
| FBDict_IsOver = 'FBDict_IsOver' #ÊÇ·ñÒѽáËã, ½áËãʱµÄtick  | 
| Map_FB_StartTick = 'Map_FB_StartTick' #»î¶¯¿ªÊ¼Ê±¼ä  | 
|   | 
| (  | 
| Def_BossTime,  #BOSSʱ¼ä  | 
| Def_LeaveTime,  #À뿪ʱ¼ä  | 
| ) = range(2)  | 
|       | 
| #µ±Ç°¸±±¾µØÍ¼µÄ״̬  | 
| (  | 
| FB_Step_Open,  # ¸±±¾¿ªÆô  | 
| FB_Step_Fighting,  # ¸±±¾½øÐÐÖÐ  | 
| FB_Step_Over,  # ¸±±¾½áÊø  | 
| FB_Step_Close,  # ¸±±¾¹Ø±Õ  | 
| ) = range(4)  | 
|       | 
|   | 
|   | 
| ## ÊÇ·ñÄܹ»Í¨¹ý»î¶¯²éѯ½øÈë  | 
| #  @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])  | 
|     return  | 
|   | 
| def OnHorsePetBossStateChange(state, tick):  | 
|     #»î¶¯×´Ì¬±ä¸ü  | 
|     mapID = GameWorld.GetMap().GetMapID()  | 
|     if mapID != ChConfig.Def_FBMapID_HorsePetBoss:  | 
|         return  | 
|     GameWorld.DebugLog('    Æï³èBOSS»î¶¯×´Ì¬±ä¸ü state=%s' % state)  | 
|               | 
|     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 GameWorld.GetGameFB().GetFBStep() == FB_Step_Fighting:  | 
|             GameWorld.GetGameFB().SetGameFBDict(FBDict_IsOver, tick)  | 
|             __DoLogicHorsePetBossOver(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  | 
| #  @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)  | 
|         PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_HorsePetBoss, 1)  | 
|         EventReport.WriteEvent_FB(curPlayer, ChConfig.Def_FBMapID_HorsePetBoss, 0, ChConfig.CME_Log_Start)  | 
|         EventShell.EventRespons_HorsePetBoss(curPlayer)  | 
|         if fbStep == FB_Step_Open:  | 
|             FBCommon.SetFBStep(FB_Step_Fighting, tick)  | 
|     UpdateHurtInfo(curPlayer, 0, True)  | 
|      | 
|     gameFB = GameWorld.GetGameFB()  | 
|     # ÉϹÄÎèbuff  | 
|     encourageLV = gameFB.GetPlayerGameFBDictByKey(playerID, FBPlayerDict_EncourageLV)  | 
|     if encourageLV > 0:  | 
|         FBCommon.AddFbEncourageBuff(curPlayer, FBPlayerDict_EncourageLV, tick)  | 
|     else:  | 
|         FBCommon.SendFBEncourageInfo(curPlayer, encourageLV)  | 
|       | 
|     closeFB_RemainTick = __GetRemainTick(tick)  | 
|     curPlayer.Sync_TimeTick(IPY_GameWorld.tttTowerTake, 0, closeFB_RemainTick, True)   | 
|     DoFBHelp(curPlayer, tick)  | 
|     return  | 
|   | 
| ##¹Ø±Õ¸±±¾  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ÎÞÒâÒå  | 
| # @remarks   | 
| def OnCloseFB(tick):  | 
|     gameWorld = GameWorld.GetGameWorld()  | 
|     lineID = gameWorld.GetPropertyID() - 1  | 
|     PyGameData.g_horsePetBossPlayerHurtDict[lineID] = {}  | 
|     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  | 
|           | 
|     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  | 
|     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)  | 
|     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)  | 
|     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)  | 
|     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:  | 
|         if overTick:  | 
|             return  | 
|           | 
|         FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 5000)  | 
|           | 
|     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  | 
|     bossID = CurFBLineBOSSID(lineID)  | 
|     #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, rank=%s'%(auctionItemList, itemList, rank), playerID)  | 
|         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.DoGiveItemByVirtualDrop(player, giveItemList, bossID, dropPosX, dropPosY, mailTypeKey='QCBOSS1')  | 
|   | 
|             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 = []  | 
|     awardPieRateDict = {}  | 
|     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.GetAward1()  | 
|         awardPieRateDict = ipyData.GetAward2()  | 
|     if not awardRateList and not awardPieRateDict:  | 
|         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 not itemInfo[0]:  | 
|             continue  | 
|         if itemInfo[2]:  | 
|             auctionItemList.append(itemInfo)  | 
|         else:  | 
|             itemList.append(itemInfo)  | 
|       | 
|     for awardPieRateList in awardPieRateDict:  | 
|         resultItem = GameWorld.GetResultByRandomList(awardPieRateList)  | 
|         if len(resultItem) != 3:  | 
|             GameWorld.ErrLog('Æï³èBoss½±Àø±íÅäÖôíÎó itemInfo=%s' % resultItem)  | 
|             continue  | 
|         if not resultItem[0]:  | 
|             continue  | 
|         if resultItem[2]:  | 
|             auctionItemList.append(resultItem)  | 
|         else:  | 
|             itemList.append(resultItem)  | 
|     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 __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)  | 
|       | 
|     __DoLogicHorsePetBossOver(1, tick, dropPosX, dropPosY)  | 
|     GameWorld.GetGameFB().SetGameFBDict(FBDict_IsOver, tick)  | 
|     return  | 
|   | 
|   | 
| 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  | 
|     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 |