#!/usr/bin/python
|
# -*- coding: GBK -*-
|
#-------------------------------------------------------------------------------
|
#
|
##@package GameWorldLogic.FBProcess.GameLogic_MainLevelBoss
|
#
|
# @todo:Ö÷Ï߹ؿ¨boss
|
# @author hxp
|
# @date 2025-9-2
|
# @version 1.0
|
#
|
# ÏêϸÃèÊö: Ö÷Ï߹ؿ¨boss
|
#
|
#-------------------------------------------------------------------------------
|
#"""Version = 2025-9-2 ÏÂÎç5:07:12"""
|
#-------------------------------------------------------------------------------
|
|
import GameWorld
|
import IpyGameDataPY
|
import PlayerControl
|
import ItemControler
|
|
import FBCommon
|
|
def OnTurnFightRequest(curPlayer, mapID, funcLineID, tagType, tagID, valueList):
|
## »ØºÏÕ½¶·ÇëÇó
|
playerID = curPlayer.GetPlayerID()
|
chapterID, levelNum, wave = PlayerControl.GetMainLevelPassInfo(curPlayer)
|
#levelID = chapterID * 100 + levelNum
|
#if funcLineID != levelID:
|
# return
|
GameWorld.DebugLog("ÇëÇóÌôÕ½¹Ø¿¨Boss! passInfo: chapterID=%s,levelNum=%s,wave=%s" % (chapterID, levelNum, wave), playerID)
|
chapterIpyData = IpyGameDataPY.GetIpyGameData("MainChapter", chapterID)
|
if not chapterIpyData:
|
return
|
levelIpyData = IpyGameDataPY.GetIpyGameData("MainLevel", chapterID, levelNum)
|
if not levelIpyData:
|
return
|
|
nowChapterID, nowLevelNum, _ = PlayerControl.GetMainLevelNowInfo(curPlayer)
|
if chapterID != nowChapterID or levelNum != nowLevelNum:
|
'''Ò»°ãÓÐÁ½ÖÖÇé¿ö»áµ¼ÖÂ
|
1. ÀíÂÛÉÏÍæ¼Òµ±Ç°Ë¢¹ÖµÄÕ½ڹؿ¨Ò»¶¨ÊÇÓë¹ý¹ØµÄÕ½ڹؿ¨ÊÇÒ»Öµģ¬³ýÁËÈ«²¿Õ½ÚÒÑͨ¹Ø
|
µ±Í¨¹ØÊ±£¬Òѹý¹ØµÄ¼Ç¼»á±»ÉèÖÃΪÏÂÒ»Õ½ڵÚ1¹Ø£¨°æ±¾¹Ø¿¨±íʵ¼Ê²»´æÔڸùؿ¨£©
|
µ«Êǵ±Ç°Ë¢¹ÖµÄ»¹Êǰ汾µÄ×îºóÒ»¹Ø£¬¹Ì»á³öÏÖ²»Ò»ÖµÄÇé¿ö
|
ÔÚÔö¼ÓÕ½ڹؿ¨Ð°汾¸üкóÍæ¼ÒÖØµÇ»á×Ô¶¯½øÐÐÐÞ¸´µ±Ç°Ë¢¹Ö½ø¶ÈΪ×îÐÂÕ½ڵÚ1¹Ø
|
2. ÕæµÄ³öÏÖÎÊÌâÁË£¬¿ÉÄÜÊÇbugÒýÆð£¬ÕâÖÖÇé¿öÖ»ÄܽøÐÐbugÐÞ¸´¼°Õë¶ÔÒì³£Õ˺ÅÌØÊâ´¦Àí£¬»òÕßÖØµÇºóÒ²»á×Ô¶¯½øÐÐÐÞÕý
|
'''
|
GameWorld.ErrLog("µ±Ç°Ë¢¹ÖÕ½ڹؿ¨ÓëÌôÕ½µÄbossÕ½ڹؿ¨²»Ò»Ö£¬ÎÞ·¨ÌôÕ½! chapterID=%s,levelNum=%s,nowChapterID=%s,nowLevelNum=%s"
|
% (chapterID, levelNum, nowChapterID, nowLevelNum), playerID)
|
return
|
|
# ±¾¹Ø¿¨×î´ó²¨Êý
|
waveMax = 6
|
while waveMax >= 1 and (not hasattr(levelIpyData, "GetWaveLineupIDList%s" % waveMax) or not getattr(levelIpyData, "GetWaveLineupIDList%s" % waveMax)()):
|
waveMax -= 1
|
|
if wave < waveMax:
|
GameWorld.DebugLog("×îºóÒ»²¨Î´Í¨¹ý£¬ÎÞ·¨ÌôÕ½±¾¹Øboss! passWave=%s < %s" % (wave, waveMax))
|
return
|
|
return True
|
|
def GetFBNPCLineupInfo(curPlayer, mapID, funcLineID):
|
## »ñÈ¡NPCÕóÈÝÏà¹Ø
|
# @return: npcLineupIDList, strongerLV, difficulty
|
|
chapterID, levelNum, _ = PlayerControl.GetMainLevelPassInfo(curPlayer)
|
levelIpyData = IpyGameDataPY.GetIpyGameData("MainLevel", chapterID, levelNum)
|
if not levelIpyData:
|
return
|
|
npcLineupIDList = levelIpyData.GetBossLineupIDList() # Boss²¨ÕóÈÝIDÁÐ±í£¬Ð¡¶Ó1ÕóÈÝID|С¶Ó2ÕóÈÝID|...
|
strongerLV = levelIpyData.GetNPCLV()
|
difficulty = levelIpyData.GetDifficulty()
|
|
return npcLineupIDList, strongerLV, difficulty
|
|
def OnTurnFightOver(curPlayer, turnFight, mapID, funcLineID, overMsg):
|
## »ØºÏÕ½¶·½áÊø
|
if not curPlayer:
|
return
|
|
playerID = curPlayer.GetPlayerID()
|
#winFaction = turnFight.winFaction
|
isWin = turnFight.isWin
|
|
chapterID, levelNum, _ = PlayerControl.GetMainLevelPassInfo(curPlayer)
|
if not isWin:
|
nowValue = PlayerControl.GetMainLevelNowValue(curPlayer)
|
GameWorld.DebugLog("Ö÷ÏßbossÕ½¶·Ê§°Ü£¡±£³Öµ±Ç°Ë¢¹Ö²¨½ø¶È²»±ä! nowValue=%s" % nowValue, playerID)
|
return
|
|
if turnFight.haveNextLineup():
|
GameWorld.DebugLog("Ö÷ÏßbossС¶ÓÕ½¶·Ê¤Àû£¬ÓÐÏÂһС¶Ó! chapterID=%s,levelNum=%s,lineupIndex=%s,lineupIDList=%s"
|
% (chapterID, levelNum, turnFight.lineupIndex, turnFight.lineupIDList), playerID)
|
return
|
|
isAllPass = False # ÊÇ·ñͨ¹Ø
|
if IpyGameDataPY.GetIpyGameDataNotLog("MainLevel", chapterID, levelNum + 1):
|
nextChapterID, nextLevelNum = chapterID, levelNum + 1
|
GameWorld.DebugLog("Ö÷Ïßboss²¨Õ½¶·Ê¤Àû£¡ÏÂÒ»¹Ø! chapterID=%s,levelNum=%s,nextLevelNum=%s"
|
% (chapterID, levelNum, nextLevelNum), playerID)
|
elif IpyGameDataPY.GetIpyGameDataNotLog("MainLevel", chapterID + 1, 1):
|
nextChapterID, nextLevelNum = chapterID + 1, 1
|
GameWorld.DebugLog("Ö÷Ïßboss²¨Õ½¶·Ê¤Àû£¡ÏÂÒ»ÕÂ! chapterID=%s,levelNum=%s,nextChapterID=%s,nextLevelNum=%s"
|
% (chapterID, levelNum, nextChapterID, nextLevelNum), playerID)
|
else:
|
# ÒÑͨ¹ØµÄÔÝʱÏȱ£³Ö²»±ä
|
# ×¢Òâ·À·¶×îºóÒ»¹Ø½±ÀøÖظ´»ñµÃ
|
nextChapterID, nextLevelNum = chapterID + 1, 1
|
GameWorld.DebugLog("Ö÷Ïßboss²¨Õ½¶·Ê¤Àû£¡ÒÑͨ¹Ø! chapterID=%s,levelNum=%s,nextChapterID=%s,nextLevelNum=%s"
|
% (chapterID, levelNum, nextChapterID, nextLevelNum), playerID)
|
isAllPass = True
|
|
updPassValue = PlayerControl.SetMainLevelPassInfo(curPlayer, nextChapterID, nextLevelNum, 0)
|
if isAllPass:
|
# ÒÑͨ¹ØµÄË¢¹Ö½ø¶È±£³Ö²»±ä
|
updNowValue = PlayerControl.GetMainLevelNowValue(curPlayer)
|
GameWorld.DebugLog("ÒÑͨ¹ØµÄË¢¹Ö½ø¶È±£³Ö²»±ä: updNowValue=%s" % updNowValue, playerID)
|
else:
|
updNowValue = PlayerControl.SetMainLevelNowInfo(curPlayer, nextChapterID, nextLevelNum, 1)
|
GameWorld.DebugLog("Ϊͨ¹ØµÄË¢¹Ö½ø¶ÈÉèÖÃΪÏÂÒ»¹ØµÄµÚ1²¨: updNowValue=%s" % updNowValue, playerID)
|
GameWorld.DebugLog("updPassValue=%s,updNowValue=%s" % (updPassValue, updNowValue), playerID)
|
|
# ·¢·Å¹ý¹Ø½±Àø
|
levelIpyData = IpyGameDataPY.GetIpyGameData("MainLevel", chapterID, levelNum)
|
if not levelIpyData:
|
return
|
itemList = levelIpyData.GetAwardItemList()
|
GameWorld.DebugLog("¹ý¹Ø½±Àø: chapterID=%s,levelNum=%s,itemList=%s" % (chapterID, levelNum, itemList), playerID)
|
|
ItemControler.GivePlayerItemOrMail(curPlayer, itemList, event=["MainLevelBoss", False, {}], isNotifyAward=False)
|
|
overMsg.update({FBCommon.Over_itemInfo:FBCommon.GetJsonItemList(itemList)})
|
return
|