#!/usr/bin/python
|
# -*- coding: GBK -*-
|
#-------------------------------------------------------------------------------
|
#
|
#-------------------------------------------------------------------------------
|
#
|
##@package GameWorldLogic.FBProcess.GameLogic_PersonalBoss
|
#
|
# @todo:¸öÈËBOSS
|
# @author xdh
|
# @date 2017-05-05
|
# @version 1.0
|
# ÏêϸÃèÊö: ¸öÈËBOSS
|
#
|
#---------------------------------------------------------------------
|
#"""Version = 2017-05-05 11:00"""
|
#---------------------------------------------------------------------
|
|
import FBCommon
|
import GameWorld
|
import IPY_GameWorld
|
import NPCCustomRefresh
|
import IpyGameDataPY
|
import PlayerBossReborn
|
import PlayerFairyCeremony
|
import ChConfig
|
import ChPlayer
|
import EventReport
|
|
|
|
# ¸±±¾Í¨ÓÃÅäÖÃ
|
(
|
Def_PrepareTime, # ×¼±¸Ê±¼ä£¬Ãë
|
Def_FightTime, # Õ½¶·Ê±¼ä£¬Ãë
|
Def_ExitTime, # Í˳öʱ¼ä, Ãë
|
Def_RefreshBossMark, # Ë¢¹Ö±êʶµã
|
) = range(4)
|
|
|
|
|
# ¸±±¾×´Ì¬
|
(
|
FB_State_Open, # ¸±±¾¿ªÆô
|
FB_State_FightPrepare, # Õ½¶·×¼±¸Ê±¼ä
|
FB_State_Fighting, # Õ½¶·
|
FB_State_FreeTime, # »î¶¯½áÊø×¼±¸£¨Ê¤Àû/ʧ°Ü£©
|
FB_State_Close, # ¹Ø±Õ¸±±¾
|
) = range(5)
|
|
## ÊÇ·ñ¿É½øÈë
|
# @param curPlayer
|
# @param mapID µØÍ¼ID
|
# @param lineId ·ÖÏßID
|
# @param tick
|
# @return ÊÇ·ñ¿É½øÈë
|
def OnEnterFBEvent(curPlayer, mapID, lineId, tick):
|
return True
|
|
|
## ¼ì²é¿É·ñ½øÐÐÌôÕ½
|
def __CheckCanChallenge(curPlayer, bossID):
|
ipyData = IpyGameDataPY.GetIpyGameData('PersonalBoss', bossID)
|
|
if not ipyData:
|
return False
|
needLV = ipyData.GetChanllengeLv()
|
if curPlayer.GetLV() < needLV:
|
GameWorld.DebugLog(' ¼ì²é¿É·ñ½øÐÐÌôÕ½ bossID-%s µÈ¼¶²»×ã %s'%(needLV))
|
return False
|
delResult = FBCommon.DelFBEnterTicket(curPlayer, ChConfig.Def_FBMapID_PersonalBoss)
|
isOK = delResult[0]
|
if not isOK:
|
return False
|
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 ask ÇëÇóÐÅÏ¢
|
# @param tick
|
# @return »Ø¸´ÊÇ·ñͨ¹ýÇëÇó
|
def OnChangeMapAsk(ask, tick):
|
return IPY_GameWorld.cmeAccept
|
|
## ½ø¸±±¾
|
# @param curPlayer
|
# @param tick
|
# @return None
|
def DoEnterFB(curPlayer, tick):
|
# ²»×ö´¦Àí£¬Óи±±¾ÐÐΪ¿Í»§¶Ë·¢°üÑ¡ÔñÌôÕ½¹Ø¿¨
|
return
|
|
|
## ¸±±¾Ê±¼äµ½¹Ø±Õ
|
# @param tick µ±Ç°Ê±¼ä
|
# @return None
|
# @remarks º¯ÊýÏêϸ˵Ã÷.
|
def OnCloseFB(tick):
|
return
|
|
|
##Íæ¼ÒÍ˳ö¸±±¾.
|
# @param curPlayer Íæ¼ÒʵÀý
|
# @param tick ʱ¼ä´Á
|
# @return ·µ»ØÖµÎÞÒâÒå
|
# @remarks Íæ¼ÒÖ÷¶¯À뿪¸±±¾.
|
def DoExitFB(curPlayer, tick):
|
# Íæ¼ÒÍ˳öĬÈϹرո±±¾
|
#GameWorldProcess.CloseFB(tick)
|
return
|
|
|
##¸±±¾×ÜÂß¼¼ÆÊ±Æ÷
|
# @param tick ʱ¼ä´Á
|
# @return ÎÞÒâÒå
|
# @remarks ¸±±¾×ÜÂß¼¼ÆÊ±Æ÷
|
def OnProcess(tick):
|
gameFB = GameWorld.GetGameFB()
|
fbStep = gameFB.GetFBStep()
|
|
if fbStep == FB_State_FightPrepare:
|
__DoLogic_FightPrepare(tick)
|
elif fbStep == FB_State_Fighting:
|
__DoLogic_Fighting(tick)
|
elif fbStep == FB_State_FreeTime:
|
__DoLogic_FreeTime(tick)
|
elif fbStep == FB_State_Close:
|
pass
|
|
return
|
|
|
##Õ½¶·×¼±¸Ê±¼ä
|
# @param tick ʱÖÓ
|
# @return ÎÞÒâÒå
|
def __DoLogic_FightPrepare(tick):
|
gameFB = GameWorld.GetGameFB()
|
mapID = GameWorld.GetMap().GetMapID()
|
trialCfg = FBCommon.GetFBLineStepTime(mapID)
|
if tick - gameFB.GetFBStepTick() < trialCfg[Def_PrepareTime] * 1000:
|
return
|
|
bossID = FBCommon.GetFBPropertyMark()
|
if not bossID:
|
FBCommon.DoLogic_FBKickAllPlayer()
|
return
|
|
FBCommon.Sync_Player_TimeTick(IPY_GameWorld.tttTowerTake, trialCfg[Def_FightTime] * 1000)
|
NPCCustomRefresh.SetNPCRefresh(FBCommon.GetFBLineStepTime(mapID)[Def_RefreshBossMark], [bossID])
|
|
#תÈëÕ½¶·
|
FBCommon.SetFBStep(FB_State_Fighting, tick)
|
return
|
|
## ¿ªÊ¼¸±±¾¹Ø¿¨
|
def StartFBLevel(curPlayer, bossID, tick):
|
FBCommon.SetFBPropertyMark(bossID)
|
if curPlayer.GetPlayerAction() == IPY_GameWorld.paDie:
|
GameWorld.DebugLog("¸´»îÍæ¼Ò...", curPlayer.GetPlayerID())
|
ChPlayer.PlayerRebornByType(curPlayer, ChConfig.rebornType_City, tick)
|
#Ôö¼Ó½øÈë´ÎÊý
|
FBCommon.AddEnterFBCount(curPlayer, ChConfig.Def_FBMapID_PersonalBoss)
|
EventReport.WriteEvent_FB(curPlayer, ChConfig.Def_FBMapID_PersonalBoss, 0, ChConfig.CME_Log_Start)
|
PlayerBossReborn.AddBossRebornActionCnt(curPlayer, ChConfig.Def_BRAct_VIPBOSS, 1)
|
PlayerFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_VIPBoss, 1)
|
|
FBCommon.ClearFBNPC()
|
|
#gameFB = GameWorld.GetGameFB()
|
mapID = GameWorld.GetMap().GetMapID()
|
prepareTick = FBCommon.GetFBLineStepTime(mapID)[Def_PrepareTime] * 1000
|
FBCommon.Sync_Player_TimeTick(IPY_GameWorld.tttAddUpTime, prepareTick)
|
FBCommon.Sync_Player_TimeTick(IPY_GameWorld.tttWaitStart, prepareTick)
|
FBCommon.SetFBStep(FB_State_FightPrepare, tick)
|
helpDict = {FBCommon.Help_npcTotal:0}
|
FBCommon.Notify_FBHelp(curPlayer, helpDict)
|
GameWorld.DebugLog("StartFBLevel, fbLevel=%s, helpDict=%s"
|
% (bossID, str(helpDict)), curPlayer.GetPlayerID())
|
return
|
|
|
##Õ½¶·Ê±¼ä
|
# @param tick ʱÖÓ
|
# @return ÎÞÒâÒå
|
def __DoLogic_Fighting(tick):
|
gameFB = GameWorld.GetGameFB()
|
mapID = GameWorld.GetMap().GetMapID()
|
#ÅжÏʱ¼ä½áÊø
|
if tick - gameFB.GetFBStepTick() < FBCommon.GetFBLineStepTime(mapID)[Def_FightTime] * 1000:
|
return
|
|
#ÓÎÏ·½áÊø
|
__SetFBToFreeTime(tick)
|
return
|
|
##ÉèÖø±±¾½øÈëÀ뿪״̬
|
# @param tick ʱÖÓ
|
# @return ÎÞÒâÒå
|
def __SetFBToFreeTime(tick):
|
mapID = GameWorld.GetMap().GetMapID()
|
FBCommon.Sync_Player_TimeTick(IPY_GameWorld.tttLeaveMap, FBCommon.GetFBLineStepTime(mapID)[Def_ExitTime] * 1000)
|
FBCommon.SetFBStep(FB_State_FreeTime, tick)
|
return
|
|
##±ÈÈü½áÊøµÄ¿ÕÏÐʱ¼ä
|
# @param tick ʱÖÓ
|
# @return ÎÞÒâÒå
|
# @remarks ±ÈÈü½áÊøµÄ¿ÕÏÐʱ¼ä
|
def __DoLogic_FreeTime(tick):
|
mapID = GameWorld.GetMap().GetMapID()
|
if tick - GameWorld.GetGameFB().GetFBStepTick() < FBCommon.GetFBLineStepTime(mapID)[Def_ExitTime] * 1000:
|
return
|
|
FBCommon.DoLogic_FBKickAllPlayer()
|
return
|
|
## ɱ¹Ö
|
# @param curPlayer
|
# @param curNPC ±»É±µÄ¹Ö
|
# @param tick
|
# @return None
|
def DoFB_Player_KillNPC(curPlayer, curNPC, tick):
|
|
bossID = FBCommon.GetFBPropertyMark()
|
if bossID != curNPC.GetNPCID():
|
return
|
helpDict = {FBCommon.Help_npcTotal:1}
|
FBCommon.Notify_FBHelp(curPlayer, helpDict)
|
|
__SetFBToFreeTime(tick)
|
return
|
|
## ¼ì²éÊÇ·ñ¿É¹¥»÷£¬ Ö÷Åж¨²»¿É¹¥»÷µÄÇé¿ö£¬ÆäËûÂß¼ÓÉÍâ²ã¾ö¶¨
|
# @param attacker ¹¥»÷·½
|
# @param defender ·ÀÊØ·½
|
# @return bool
|
def CheckCanAttackTagObjInFB(attacker, defender):
|
gameFB = GameWorld.GetGameFB()
|
if gameFB.GetFBStep() != FB_State_Fighting:
|
return False
|
return True
|
|
|
## ÊÇ·ñ¸±±¾¸´»î
|
# @param None
|
# @return ÊÇ·ñ¸±±¾¸´»î
|
def OnPlayerReborn():
|
return True
|
|
## ¸±±¾ÐÐΪ
|
# @param curPlayer Íæ¼Ò
|
# @param actionType ÐÐΪÀàÐÍ
|
# @param actionInfo ÐÐΪÐÅÏ¢
|
# @param tick µ±Ç°Ê±¼ä
|
# @return None
|
def DoFBAction(curPlayer, actionType, actionInfo, tick):
|
# ĬÈÏΪѡÔñ¹Ø¿¨£¬Óɿͻ§¶Ë¾ö¶¨£¬½ø³¡¼°¸±±¾Ñ¡¹ØÍ¨ÓôËÐÐΪ
|
if actionInfo <= 0:
|
return
|
|
gameFB = GameWorld.GetGameFB()
|
fbStep = gameFB.GetFBStep()
|
|
if fbStep in [FB_State_FightPrepare, FB_State_Fighting]:
|
GameWorld.DebugLog("×¼±¸»òÕ½¶·ÖÐ, ÎÞ·¨±ä¸ü¹Ø¿¨!")
|
return
|
|
bossid = actionInfo
|
if not __CheckCanChallenge(curPlayer, bossid):
|
FBCommon.DoLogic_FBKickAllPlayer()
|
return
|
|
StartFBLevel(curPlayer, bossid, tick)
|
return
|