Update - 1.13.0.124
EN: 1.13.0.124 CN: 1.13.0.124 JP: 1.13.0.128 KR: 1.13.0.130
This commit is contained in:
@@ -197,11 +197,11 @@ function JointDrillLevelData_1:CacheTempData(bCharacter, bBoss, bChangeTeam, bCh
|
||||
table.insert(self.mapTempData.mapCharacterTempData.skillInfo, {
|
||||
nCharId = charTid,
|
||||
nSkillId = clsSkillInfo.skillId,
|
||||
nCd = FP.ToInt(clsSkillInfo.currentUseInterval),
|
||||
nCd = clsSkillInfo.currentUseInterval.RawValue,
|
||||
nSectionAmount = clsSkillInfo.currentSectionAmount,
|
||||
nSectionResumeTime = FP.ToInt(clsSkillInfo.currentResumeTime),
|
||||
nUseTimeHint = FP.ToInt(clsSkillInfo.currentUseTimeHint),
|
||||
nEnergy = FP.ToInt(clsSkillInfo.currentEnergy)
|
||||
nSectionResumeTime = clsSkillInfo.currentResumeTime.RawValue,
|
||||
nUseTimeHint = clsSkillInfo.currentUseTimeHint.RawValue,
|
||||
nEnergy = clsSkillInfo.currentEnergy._raw
|
||||
})
|
||||
end
|
||||
end
|
||||
@@ -342,10 +342,10 @@ function JointDrillLevelData_1:ResetSkill()
|
||||
local stSkillInfo = CS.Lua2CSharpInfo_ResetSkillInfo()
|
||||
stSkillInfo.skillId = skillInfo.nSkillId
|
||||
stSkillInfo.currentSectionAmount = skillInfo.nSectionAmount
|
||||
stSkillInfo.cd = FP.FromFloat(skillInfo.nCd).RawValue
|
||||
stSkillInfo.currentResumeTime = FP.FromFloat(skillInfo.nSectionResumeTime).RawValue
|
||||
stSkillInfo.currentUseTimeHint = FP.FromFloat(skillInfo.nUseTimeHint).RawValue
|
||||
stSkillInfo.energy = FP.FromFloat(skillInfo.nEnergy).RawValue
|
||||
stSkillInfo.cd = skillInfo.nCd
|
||||
stSkillInfo.currentResumeTime = skillInfo.nSectionResumeTime
|
||||
stSkillInfo.currentUseTimeHint = skillInfo.nUseTimeHint
|
||||
stSkillInfo.energy = skillInfo.nEnergy
|
||||
if ret[skillInfo.nCharId] == nil then
|
||||
ret[skillInfo.nCharId] = {}
|
||||
end
|
||||
|
||||
@@ -156,14 +156,12 @@ function ScoreBossLevel:OnEvent_HpChanged(hp, hpMax)
|
||||
self.parent:DamageToScore(hpMax - hp, self.SwitchRate, self.BattleLv)
|
||||
return
|
||||
end
|
||||
if hp > self.BossCurLvMinHp then
|
||||
self.BossCurLvMinHp = hp
|
||||
if hp >= self.BossCurLvMinHp then
|
||||
printError("联合讨伐血量hp出现抖动" .. hp .. " " .. hpMax .. " " .. self.BattleLv)
|
||||
return
|
||||
end
|
||||
if hp <= self.BossCurLvMinHp then
|
||||
self.BossCurLvMinHp = hp
|
||||
self.parent:DamageToScore(hpMax - hp, self.SwitchRate, self.BattleLv)
|
||||
end
|
||||
self.BossCurLvMinHp = hp
|
||||
self.parent:DamageToScore(hpMax - hp, self.SwitchRate, self.BattleLv)
|
||||
end
|
||||
function ScoreBossLevel:OnEvent_BossRushMonsterLevelChanged(oldLevel, battleLevel)
|
||||
if self.isSettlement then
|
||||
|
||||
@@ -0,0 +1,209 @@
|
||||
local SoldierBattle = class("SoldierBattle")
|
||||
local AdventureModuleHelper = CS.AdventureModuleHelper
|
||||
local SoldierAttrData = require("GameCore.Data.DataClass.Soldier.SoldierAttrData")
|
||||
local mapEventConfig = {
|
||||
LoadLevelRefresh = "OnEvent_LoadLevelRefresh",
|
||||
AdventureModuleEnter = "OnEvent_AdventureModuleEnter",
|
||||
BattlePause = "OnEvent_Pause",
|
||||
ADVENTURE_LEVEL_UNLOAD_COMPLETE = "OnEvent_UnloadComplete",
|
||||
InputEnable = "OnEvent_InputEnable",
|
||||
Soldier_Result = "OnEvent_Result",
|
||||
SettleSoldierBattle = "OnEvent_SettleSoldierBattle",
|
||||
RestartSoldier = "OnEvent_RestartSoldier",
|
||||
LeaveSoldier = "OnEvent_LeaveSoldier",
|
||||
SoldierLevel_Gameplay_Time = "OnEvent_GamePlayTime",
|
||||
EnemyBattle_TotalHP = "OnEvent_EnemyHp",
|
||||
SoldierLevel_AddItem = "OnEvent_AddItem",
|
||||
Soldier_CastSkill = "OnEvent_CastSkill",
|
||||
SoldierActor_Spawn = "OnEvent_ActorSpawn",
|
||||
Soldier_DamageValue = "OnEvent_Damage"
|
||||
}
|
||||
function SoldierBattle:EnterLevel()
|
||||
self.nTotalHp = 0
|
||||
self.tbItems = {}
|
||||
self.nBattleTime = 0
|
||||
self.bRestart = false
|
||||
for _, v in ipairs(self.tbChess) do
|
||||
v.nUId = 0
|
||||
v.nDamage = 0
|
||||
end
|
||||
local sJson = self:GetSoldierLevelMsg()
|
||||
AdventureModuleHelper.EnterDynamic(self.nFloorId, {}, GameEnum.dynamicLevelType.SoldierChess, {
|
||||
tostring(self.nTemplateId),
|
||||
sJson
|
||||
})
|
||||
end
|
||||
function SoldierBattle:Init(parent, tbChess, nFloorId, nTemplateId)
|
||||
self:BindEvent()
|
||||
self.parent = parent
|
||||
self.tbChess = tbChess
|
||||
self.nFloorId = nFloorId
|
||||
self.nTemplateId = nTemplateId
|
||||
self.tbCharDamage = {}
|
||||
self.tbPartner = SoldierAttrData.CalcActivePartners(tbChess)
|
||||
self:EnterLevel()
|
||||
NovaAPI.EnterModule("AdventureModuleScene", true, 17)
|
||||
end
|
||||
function SoldierBattle:Exit()
|
||||
self:UnBindEvent()
|
||||
end
|
||||
function SoldierBattle:BindEvent()
|
||||
if type(mapEventConfig) ~= "table" then
|
||||
return
|
||||
end
|
||||
for nEventId, sCallbackName in pairs(mapEventConfig) do
|
||||
local callback = self[sCallbackName]
|
||||
if type(callback) == "function" then
|
||||
EventManager.Add(nEventId, self, callback)
|
||||
end
|
||||
end
|
||||
end
|
||||
function SoldierBattle:UnBindEvent()
|
||||
if type(mapEventConfig) ~= "table" then
|
||||
return
|
||||
end
|
||||
for nEventId, sCallbackName in pairs(mapEventConfig) do
|
||||
local callback = self[sCallbackName]
|
||||
if type(callback) == "function" then
|
||||
EventManager.Remove(nEventId, self, callback)
|
||||
end
|
||||
end
|
||||
end
|
||||
function SoldierBattle:GetSoldierLevelMsg()
|
||||
local soldierLevelMsg = CS.SoldierLevelController.SoldierLevelMsg(1)
|
||||
local tbServerBuff = self.parent:GetClientBuffList()
|
||||
local mapAll = SoldierAttrData.CalcAttrForBattle(self.tbChess, self.tbPartner, tbServerBuff)
|
||||
for _, v in ipairs(self.tbChess) do
|
||||
local mapAttr = CS.SoldierLevelController.SoldierAttr()
|
||||
if v.nId ~= 0 then
|
||||
mapAttr = mapAll[v.nId]
|
||||
end
|
||||
local bMain = v.nPositionType == GameEnum.SoldierPositionType.FightPosition
|
||||
local nIndex = v.nIndex
|
||||
if not bMain then
|
||||
nIndex = v.nIndex + 3
|
||||
end
|
||||
soldierLevelMsg.SoldierData:Add(CS.SoldierLevelController.SoldierMsg(v.nId, bMain, nIndex, v.nStar, mapAttr))
|
||||
end
|
||||
for _, nId in pairs(self.tbPartner) do
|
||||
if 0 < nId then
|
||||
soldierLevelMsg.PartnerArr:Add(nId)
|
||||
end
|
||||
end
|
||||
return soldierLevelMsg:ToJson()
|
||||
end
|
||||
function SoldierBattle:OnEvent_LoadLevelRefresh()
|
||||
EventManager.Hit("OpenSoldierRoomInfo", self.nFloorId)
|
||||
end
|
||||
function SoldierBattle:OnEvent_AdventureModuleEnter()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.SoldierBattlePanel, self.tbChess, self.tbPartner)
|
||||
end
|
||||
function SoldierBattle:OnEvent_UnloadComplete()
|
||||
if self.bRestart then
|
||||
self:EnterLevel()
|
||||
end
|
||||
end
|
||||
function SoldierBattle:OnEvent_Result(bResult)
|
||||
local tbDamage = {}
|
||||
for nId, nValue in pairs(self.tbCharDamage) do
|
||||
local nStar = 0
|
||||
for _, v in ipairs(self.tbChess) do
|
||||
if v.nId == nId then
|
||||
nStar = v.nStar
|
||||
break
|
||||
end
|
||||
end
|
||||
tbDamage[nId] = {nStar = nStar, nDamage = nValue}
|
||||
end
|
||||
local nCoin = self.tbItems[AllEnum.CoinItemId.SoldierCurrency] or 0
|
||||
nCoin = math.min(nCoin, ConfigTable.GetConfigNumber("SoldierSkillCoinMax"))
|
||||
self.parent:BattleEnd(bResult, {
|
||||
nTime = self.nBattleTime,
|
||||
tbDamage = tbDamage,
|
||||
nCoin = nCoin
|
||||
})
|
||||
end
|
||||
function SoldierBattle:OnEvent_SettleSoldierBattle()
|
||||
local tbDamage = {}
|
||||
for nId, nValue in pairs(self.tbCharDamage) do
|
||||
local nStar = 0
|
||||
for _, v in ipairs(self.tbChess) do
|
||||
if v.nId == nId then
|
||||
nStar = v.nStar
|
||||
break
|
||||
end
|
||||
end
|
||||
tbDamage[nId] = {nStar = nStar, nDamage = nValue}
|
||||
end
|
||||
local nCoin = self.tbItems[AllEnum.CoinItemId.SoldierCurrency] or 0
|
||||
nCoin = math.min(nCoin, ConfigTable.GetConfigNumber("SoldierSkillCoinMax"))
|
||||
self.parent:BattleEnd(false, {
|
||||
nTime = self.nBattleTime,
|
||||
tbDamage = tbDamage,
|
||||
nCoin = nCoin
|
||||
})
|
||||
end
|
||||
function SoldierBattle:OnEvent_RestartSoldier()
|
||||
self.bRestart = true
|
||||
AdventureModuleHelper.LevelStateChanged(false)
|
||||
EventManager.Hit("ResetBossHUD")
|
||||
end
|
||||
function SoldierBattle:OnEvent_LeaveSoldier()
|
||||
if NovaAPI.GetCurrentModuleName() == "MainMenuModuleScene" then
|
||||
EventManager.Hit(EventId.CloesCurPanel)
|
||||
PlayerData.Base:OnBackToMainMenuModule()
|
||||
else
|
||||
local function levelEndCallback()
|
||||
EventManager.Remove("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, levelEndCallback)
|
||||
NovaAPI.EnterModule("MainMenuModuleScene", true, 17)
|
||||
end
|
||||
EventManager.Add("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, levelEndCallback)
|
||||
CS.AdventureModuleHelper.LevelStateChanged(true, 0, true)
|
||||
end
|
||||
end
|
||||
function SoldierBattle:OnEvent_ActorSpawn(nDataId, nUId)
|
||||
for _, v in ipairs(self.tbChess) do
|
||||
if v.nId == nDataId then
|
||||
v.nUId = nUId
|
||||
EventManager.Hit("SoldierCharSpawn", nDataId, nUId)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
function SoldierBattle:OnEvent_Damage(nUId, nDamage)
|
||||
for _, v in ipairs(self.tbChess) do
|
||||
if v.nUId == nUId then
|
||||
v.nDamage = nDamage
|
||||
self.tbCharDamage[v.nId] = v.nDamage
|
||||
EventManager.Hit("RefreshChessDamage", v.nId, v.nDamage)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
function SoldierBattle:OnEvent_GamePlayTime(nTime)
|
||||
self.nBattleTime = nTime
|
||||
if 0 < nTime then
|
||||
EventManager.Hit("RefreshSoldierBattleTime", nTime)
|
||||
end
|
||||
end
|
||||
function SoldierBattle:OnEvent_EnemyHp(nHp)
|
||||
if self.nTotalHp == 0 then
|
||||
self.nTotalHp = nHp
|
||||
end
|
||||
EventManager.Hit("RefreshSoldierProgress", self.nTotalHp, nHp)
|
||||
end
|
||||
function SoldierBattle:OnEvent_AddItem(nId, nCount)
|
||||
if self.tbItems[nId] == nil then
|
||||
self.tbItems[nId] = 0
|
||||
end
|
||||
self.tbItems[nId] = self.tbItems[nId] + nCount
|
||||
local nCount = self.tbItems[AllEnum.CoinItemId.SoldierCurrency] or 0
|
||||
EventManager.Hit("RefreshSoldierCoin", nCount)
|
||||
if nId == AllEnum.CoinItemId.SoldierCurrency then
|
||||
printError("[Soldier]战斗内技能获得金币数量:" .. nCount)
|
||||
end
|
||||
end
|
||||
function SoldierBattle:OnEvent_CastSkill(nUId, nId, nSkillId)
|
||||
EventManager.Hit("SoldierSkillDisPlay", nId, nSkillId)
|
||||
end
|
||||
return SoldierBattle
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,6 +5,7 @@ local PATH = "Game.Adventure.StarTower.StarTowerRoom."
|
||||
local ConfigData = require("GameCore.Data.ConfigData")
|
||||
local PB = require("pb")
|
||||
local FP = CS.TrueSync.FP
|
||||
local FDP = CS.TrueSync.FDP
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
local ModuleManager = require("GameCore.Module.ModuleManager")
|
||||
local SDKManager = CS.SDKManager.Instance
|
||||
@@ -1956,11 +1957,11 @@ function StarTowerLevelData:CacheTempData()
|
||||
table.insert(self.mapCharacterTempData.skillInfo, {
|
||||
nCharId = charTid,
|
||||
nSkillId = clsSkillInfo.skillId,
|
||||
nCd = FP.ToInt(clsSkillInfo.currentUseInterval),
|
||||
nCd = clsSkillInfo.currentUseInterval.RawValue,
|
||||
nSectionAmount = clsSkillInfo.currentSectionAmount,
|
||||
nSectionResumeTime = FP.ToInt(clsSkillInfo.currentResumeTime),
|
||||
nUseTimeHint = FP.ToInt(clsSkillInfo.currentUseTimeHint),
|
||||
nEnergy = FP.ToInt(clsSkillInfo.currentEnergy)
|
||||
nSectionResumeTime = clsSkillInfo.currentResumeTime.RawValue,
|
||||
nUseTimeHint = clsSkillInfo.currentUseTimeHint.RawValue,
|
||||
nEnergy = clsSkillInfo.currentEnergy._raw
|
||||
})
|
||||
end
|
||||
end
|
||||
@@ -2370,10 +2371,10 @@ function StarTowerLevelData:ResetSkill()
|
||||
local stSkillInfo = CS.Lua2CSharpInfo_ResetSkillInfo()
|
||||
stSkillInfo.skillId = skillInfo.nSkillId
|
||||
stSkillInfo.currentSectionAmount = skillInfo.nSectionAmount
|
||||
stSkillInfo.cd = FP.FromFloat(skillInfo.nCd).RawValue
|
||||
stSkillInfo.currentResumeTime = FP.FromFloat(skillInfo.nSectionResumeTime).RawValue
|
||||
stSkillInfo.currentUseTimeHint = FP.FromFloat(skillInfo.nUseTimeHint).RawValue
|
||||
stSkillInfo.energy = FP.FromFloat(skillInfo.nEnergy).RawValue
|
||||
stSkillInfo.cd = skillInfo.nCd
|
||||
stSkillInfo.currentResumeTime = skillInfo.nSectionResumeTime
|
||||
stSkillInfo.currentUseTimeHint = skillInfo.nUseTimeHint
|
||||
stSkillInfo.energy = skillInfo.nEnergy
|
||||
if ret[skillInfo.nCharId] == nil then
|
||||
ret[skillInfo.nCharId] = {}
|
||||
end
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local SDKManager = CS.SDKManager.Instance
|
||||
local PB = require("pb")
|
||||
local FP = CS.TrueSync.FP
|
||||
local FDP = CS.TrueSync.FDP
|
||||
local mapPrologueConfig = {
|
||||
nDifficulty = 1,
|
||||
tbStage = {99901},
|
||||
@@ -1338,7 +1340,7 @@ function StarTowerPrologueLevel:CacheTempData()
|
||||
nSectionAmount = clsSkillInfo.currentSectionAmount,
|
||||
nSectionResumeTime = clsSkillInfo.currentResumeTime.RawValue,
|
||||
nUseTimeHint = clsSkillInfo.currentUseTimeHint.RawValue,
|
||||
nEnergy = clsSkillInfo.currentEnergy.RawValue
|
||||
nEnergy = clsSkillInfo.currentEnergy._raw
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,233 @@
|
||||
local TraceHuntLevel = class("TraceHuntLevel")
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local mapEventConfig = {
|
||||
LoadLevelRefresh = "OnEvent_LoadLevelRefresh",
|
||||
AdventureModuleEnter = "OnEvent_AdventureModuleEnter",
|
||||
BattlePause = "OnEvent_Pause",
|
||||
[EventId.AbandonBattle] = "OnEvent_AbandonBattle",
|
||||
TraceHunt_Spawn_Id = "OnEvent_TraceHuntSpawnId",
|
||||
TraceHunt_Result_Time = "TraceHuntResultTime",
|
||||
LevelStateChanged = "TraceHuntResult",
|
||||
TraceHuntSettleSuccess = "OnEvent_TraceHuntSettleSuccess",
|
||||
ADVENTURE_LEVEL_UNLOAD_COMPLETE = "OnEvent_UnloadComplete"
|
||||
}
|
||||
function TraceHuntLevel:Init(parent, nLevelId, nBuildId, isAgain)
|
||||
self.isSettlement = false
|
||||
self.parent = parent
|
||||
self.LevelId = nLevelId
|
||||
self.BossId = 0
|
||||
self.BossMaxHp = 0
|
||||
self.BossCurLvMinHp = -1
|
||||
self.BossCurLvTotalChangeHp = 0
|
||||
self.BattleLv = 1
|
||||
self.nTime = 0
|
||||
self.isCanPause = true
|
||||
local leveData = ConfigTable.GetData("TraceHuntBoss", nLevelId)
|
||||
if leveData == nil then
|
||||
printError("TraceHuntBoss 表不存在 id ==== " .. nLevelId)
|
||||
return
|
||||
end
|
||||
self.ScoreGetSwitchGroupId = leveData.ScoreGetSwitchGroup
|
||||
self.SwitchRate = 300
|
||||
local getSwitchData = ConfigTable.GetData("TraceHuntScoreSwitch", self.ScoreGetSwitchGroupId * 1000 + 1)
|
||||
if getSwitchData ~= nil then
|
||||
self.SwitchRate = getSwitchData.SwitchRate
|
||||
end
|
||||
local GetBuildCallback = function(mapBuildData)
|
||||
self.mapBuildData = mapBuildData
|
||||
self.tbCharId = {}
|
||||
for _, mapChar in ipairs(self.mapBuildData.tbChar) do
|
||||
table.insert(self.tbCharId, mapChar.nTid)
|
||||
end
|
||||
self.tbDiscId = {}
|
||||
for _, nDiscId in ipairs(self.mapBuildData.tbDisc) do
|
||||
if 0 < nDiscId then
|
||||
table.insert(self.tbDiscId, nDiscId)
|
||||
end
|
||||
end
|
||||
self.mapActorInfo = {}
|
||||
for idx, nTid in ipairs(self.tbCharId) do
|
||||
local stActorInfo = self:CalCharFixedEffect(nTid, idx == 1, self.tbDiscId)
|
||||
self.mapActorInfo[nTid] = stActorInfo
|
||||
end
|
||||
PlayerData.nCurGameType = AllEnum.WorldMapNodeType.TraceHunt
|
||||
local params = NovaAPI.GetDynamicLevelParamsBootConfig()
|
||||
CS.AdventureModuleHelper.EnterDynamic(self.LevelId, self.tbCharId, GameEnum.dynamicLevelType.TraceHunt, params)
|
||||
if not isAgain then
|
||||
NovaAPI.EnterModule("AdventureModuleScene", true, 17)
|
||||
else
|
||||
self:OnEvent_AdventureModuleEnter()
|
||||
end
|
||||
end
|
||||
PlayerData.Build:GetBuildDetailData(GetBuildCallback, nBuildId)
|
||||
end
|
||||
function TraceHuntLevel:CalCharFixedEffect(nCharId, bMainChar, tbDiscId)
|
||||
local stActorInfo = CS.Lua2CSharpInfo_CharAttribute()
|
||||
PlayerData.Char:CalCharacterAttrBattle(nCharId, stActorInfo, bMainChar, tbDiscId, self.mapBuildData.nBuildId)
|
||||
return stActorInfo
|
||||
end
|
||||
function TraceHuntLevel:OnEvent_LoadLevelRefresh()
|
||||
self.isCanPause = true
|
||||
local mapAllEft, mapDiscEft, mapNoteEffect, tbNoteInfo = PlayerData.Build:GetBuildAllEft(self.mapBuildData.nBuildId)
|
||||
safe_call_cs_func(CS.AdventureModuleHelper.SetNoteInfo, tbNoteInfo)
|
||||
self.mapEftData = UTILS.AddBuildEffect(mapAllEft, mapDiscEft, mapNoteEffect)
|
||||
end
|
||||
function TraceHuntLevel:OnEvent_AdventureModuleEnter()
|
||||
PlayerData.Achievement:SetSpecialBattleAchievement(GameEnum.levelType.TraceHunt)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.TraceHuntBattle, self.tbCharId)
|
||||
self:SetPersonalPerk()
|
||||
self:SetDiscInfo()
|
||||
for idx, nCharId in ipairs(self.tbCharId) do
|
||||
local stActorInfo = self:CalCharFixedEffect(nCharId, idx == 1, self.tbDiscId)
|
||||
safe_call_cs_func(CS.AdventureModuleHelper.SetActorAttribute, nCharId, stActorInfo)
|
||||
end
|
||||
end
|
||||
function TraceHuntLevel:SetPersonalPerk()
|
||||
if self.mapBuildData ~= nil then
|
||||
for nCharId, tbPerk in pairs(self.mapBuildData.tbPotentials) do
|
||||
local mapAddLevel = PlayerData.Char:GetCharEnhancedPotential(nCharId)
|
||||
local tbPerkInfo = {}
|
||||
for _, mapPerkInfo in ipairs(tbPerk) do
|
||||
local nAddLv = mapAddLevel[mapPerkInfo.nPotentialId] or 0
|
||||
local stPerkInfo = CS.Lua2CSharpInfo_TPPerkInfo()
|
||||
stPerkInfo.perkId = mapPerkInfo.nPotentialId
|
||||
stPerkInfo.nCount = mapPerkInfo.nLevel + nAddLv
|
||||
table.insert(tbPerkInfo, stPerkInfo)
|
||||
end
|
||||
safe_call_cs_func(CS.AdventureModuleHelper.ChangePersonalPerkIds, tbPerkInfo, nCharId)
|
||||
end
|
||||
end
|
||||
end
|
||||
function TraceHuntLevel:SetDiscInfo()
|
||||
local tbDiscInfo = {}
|
||||
for k, nDiscId in ipairs(self.mapBuildData.tbDisc) do
|
||||
if k <= 3 then
|
||||
local discInfo = PlayerData.Disc:CalcDiscInfoInBuild(nDiscId, self.mapBuildData.tbSecondarySkill)
|
||||
table.insert(tbDiscInfo, discInfo)
|
||||
end
|
||||
end
|
||||
safe_call_cs_func(CS.AdventureModuleHelper.SetDiscInfo, tbDiscInfo)
|
||||
end
|
||||
function TraceHuntLevel:OnEvent_Pause()
|
||||
if self.isCanPause then
|
||||
EventManager.Hit("OpenTraceHuntPause", self.LevelId, self.tbCharId, self.parent.bSelfBoss)
|
||||
end
|
||||
end
|
||||
function TraceHuntLevel:OnEvent_AbandonBattle()
|
||||
self.parent:QuiteLevel()
|
||||
end
|
||||
function TraceHuntLevel:OnEvent_TraceHuntSpawnId(bossId)
|
||||
self.BossId = bossId
|
||||
local healthInfo = CS.AdventureModuleHelper.GetEntityHealthInfo(bossId)
|
||||
self.BossMaxHp = healthInfo ~= nil and healthInfo.hpMax or 0
|
||||
EventManager.AddEntityEvent("HpChanged", self.BossId, self, self.OnEvent_HpChanged)
|
||||
EventManager.AddEntityEvent("BossRushMonsterLevelChanged", self.BossId, self, self.OnEvent_TraceHuntMonsterLevelChanged)
|
||||
EventManager.AddEntityEvent("BossRushMonsterBattleAttrChanged", self.BossId, self, self.OnEvent_TraceHuntMonsterBattleAttrChanged)
|
||||
end
|
||||
function TraceHuntLevel:OnEvent_HpChanged(hp, hpMax)
|
||||
if self.isSettlement then
|
||||
return
|
||||
end
|
||||
if self.isDontChangeHp then
|
||||
return
|
||||
end
|
||||
if self.BossCurLvMinHp == -1 then
|
||||
self.BossCurLvMinHp = hp
|
||||
self.parent:DamageToScore(hpMax - hp, self.SwitchRate, self.BattleLv)
|
||||
return
|
||||
end
|
||||
if hp > self.BossCurLvMinHp then
|
||||
self.BossCurLvMinHp = hp
|
||||
return
|
||||
end
|
||||
if hp <= self.BossCurLvMinHp then
|
||||
self.BossCurLvMinHp = hp
|
||||
self.parent:DamageToScore(hpMax - hp, self.SwitchRate, self.BattleLv)
|
||||
end
|
||||
end
|
||||
function TraceHuntLevel:OnEvent_TraceHuntMonsterLevelChanged(oldLevel, battleLevel)
|
||||
if self.isSettlement then
|
||||
return
|
||||
end
|
||||
self.isDontChangeHp = true
|
||||
self.BossCurLvTotalChangeHp = self.BossCurLvTotalChangeHp + self.BossCurLvMinHp
|
||||
self.BossCurLvMinHp = -1
|
||||
self.BattleLv = battleLevel
|
||||
self.parent:DamageToScore(self.BossMaxHp, self.SwitchRate, self.BattleLv)
|
||||
self.BossCurLvTotalChangeHp = 0
|
||||
if battleLevel <= 100 then
|
||||
local getSwitchData = ConfigTable.GetData("TraceHuntScoreSwitch", self.ScoreGetSwitchGroupId * 1000 + battleLevel)
|
||||
if getSwitchData ~= nil then
|
||||
self.SwitchRate = getSwitchData.SwitchRate
|
||||
end
|
||||
end
|
||||
self.parent:HPLevelChanged()
|
||||
end
|
||||
function TraceHuntLevel:OnEvent_TraceHuntMonsterBattleAttrChanged()
|
||||
local healthInfo = CS.AdventureModuleHelper.GetEntityHealthInfo(self.BossId)
|
||||
self.BossMaxHp = healthInfo ~= nil and healthInfo.hpMax or 0
|
||||
self.isDontChangeHp = false
|
||||
end
|
||||
function TraceHuntLevel:TraceHuntResultTime(nTime)
|
||||
self.nTime = nTime
|
||||
end
|
||||
function TraceHuntLevel:TraceHuntResult(levelState, totalTime)
|
||||
if self.isSettlement then
|
||||
return
|
||||
end
|
||||
self.isSettlement = true
|
||||
local nLeft = self.parent:GetControlLeftTime()
|
||||
if nLeft <= 0 then
|
||||
local bEmpty = self.parent:GetSelfHuntCount() == 0
|
||||
local sTip = bEmpty and ConfigTable.GetUIText("TraceHunt_ControlTimeOverInFirstBattle") or ConfigTable.GetUIText("TraceHunt_ControlTimeOverInBattle")
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Alert,
|
||||
sContent = sTip,
|
||||
callbackConfirm = function()
|
||||
self.parent:QuiteLevel()
|
||||
end
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
return
|
||||
end
|
||||
self.parent:SendTraceHuntSettleReq(self.LevelId)
|
||||
end
|
||||
function TraceHuntLevel:RefreshCharDamageData()
|
||||
self.tbCharDamage = UTILS.GetCharDamageResult(self.tbCharId)
|
||||
end
|
||||
function TraceHuntLevel:OnEvent_TraceHuntSettleSuccess(entryLevelId, totalStar, nExp, bSelfBoss, mapChangeInfo, bUpgrade, nBeforeMaxStar)
|
||||
self:RefreshCharDamageData()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.TraceHuntResult, entryLevelId, totalStar, nExp, bSelfBoss, mapChangeInfo, bUpgrade, nBeforeMaxStar, self.tbCharDamage)
|
||||
end
|
||||
function TraceHuntLevel:BindEvent()
|
||||
if type(mapEventConfig) ~= "table" then
|
||||
return
|
||||
end
|
||||
for nEventId, sCallbackName in pairs(mapEventConfig) do
|
||||
local callback = self[sCallbackName]
|
||||
if type(callback) == "function" then
|
||||
EventManager.Add(nEventId, self, callback)
|
||||
end
|
||||
end
|
||||
end
|
||||
function TraceHuntLevel:UnBindEvent()
|
||||
if type(mapEventConfig) ~= "table" then
|
||||
return
|
||||
end
|
||||
for nEventId, sCallbackName in pairs(mapEventConfig) do
|
||||
local callback = self[sCallbackName]
|
||||
if type(callback) == "function" then
|
||||
EventManager.Remove(nEventId, self, callback)
|
||||
end
|
||||
end
|
||||
if self.BossId then
|
||||
EventManager.RemoveEntityEvent("HpChanged", self.BossId, self, self.OnEvent_HpChanged)
|
||||
EventManager.RemoveEntityEvent("BossRushMonsterLevelChanged", self.BossId, self, self.OnEvent_TraceHuntMonsterLevelChanged)
|
||||
EventManager.RemoveEntityEvent("BossRushMonsterBattleAttrChanged", self.BossId, self, self.OnEvent_TraceHuntMonsterBattleAttrChanged)
|
||||
self.BossId = nil
|
||||
end
|
||||
end
|
||||
function TraceHuntLevel:OnEvent_UnloadComplete()
|
||||
self.parent:EntryLvAgain()
|
||||
end
|
||||
return TraceHuntLevel
|
||||
Reference in New Issue
Block a user