【灵兽】后端数据解析添加

gaoxin 2020-10-26 14:03:59 +08:00
parent 7b64ca48d3
commit 8a455e2c9e
1 changed files with 55 additions and 0 deletions

View File

@ -6,6 +6,7 @@ local HeroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
local MonsterGroup = ConfigManager.GetConfig(ConfigName.MonsterGroup)
local MonsterConfig = ConfigManager.GetConfig(ConfigName.MonsterConfig)
local CombatControl = ConfigManager.GetConfig(ConfigName.CombatControl)
local SpiritAnimalSkill = ConfigManager.GetConfig(ConfigName.SpiritAnimalSkill)
local FEAConfig = require("Modules/Battle/Config/FightEffectAudioConfig")
local function pairsByKeys(t)
@ -212,6 +213,49 @@ function this.GetMonsterData(monsterId)
}
end
--
function this.MonsterSkillAdapter(MSkillId)
local skill = {}
local monsterSkill = SpiritAnimalSkill[MSkillId]
skill.effect = {}
for index, skillId in ipairs(monsterSkill.SkillIDList) do
skill.effect[index] = this.GetSkillData(tonumber(skillId))
skill.triggerId = monsterSkill.ReleasePoint[index]
skill.triggerCondition = {0}
if monsterSkill.ReleaseLimit and monsterSkill.ReleaseLimit[index] then
for k, v in ipairs(monsterSkill.ReleaseLimit[index]) do
skill.triggerCondition[index][k] = v
end
end
skill.maxCount = monsterSkill.ReleaseLimit[index] or 999
skill.maxRoundCount = monsterSkill.ReleaseLimit[index] or 999
end
return skill
end
function this.PokemonUnitAdapter(pokemonUnit)
-- 基础数据
local role = {
id = tonumber(pokemonUnit.unitId),
position = tonumber(pokemonUnit.position),
star = tonumber(pokemonUnit.star),
camp = 0,
skill = {},
property = {},
}
-- 技能
local skills = string.split(pokemonUnit.unitSkillIds, "#")
for i = 1, #skills do
role.skill[i] = this.MonsterSkillAdapter(skills[i])
end
-- 属性
local propertys = string.split(pokemonUnit.property, "#")
for j = 1, #propertys do
role.property[j] = tonumber(propertys[j])
end
return role
end
---获取服务端传过来的战斗数据和随机数种子
---参数2 isFightPlayer 0和怪物对战 1和玩家对战
function this.GetBattleServerData(msg, isFightPlayer)
@ -282,6 +326,12 @@ function this.GetBattleServerData(msg, isFightPlayer)
-- 一些战斗外数据
fightData.playerData.outData = data.specialPassive
LogRed(Language[10221]..data.specialPassive)
-- 灵兽数据
fightData.playerData.monsterList ={}
for i = 1, #data.pokemonUnitList do
fightData.playerData.monsterList[i] = this.PokemonUnitAdapter(data.pokemonUnitList[i])
end
@ -365,6 +415,11 @@ function this.GetBattleServerData(msg, isFightPlayer)
-- 一些战斗外数据
fightData.enemyData[i].outData = data2.specialPassive
-- 灵兽数据
fightData.enemyData[i].monsterList ={}
for i = 1, #data2.pokemonUnitList do
fightData.enemyData[i].monsterList[i] = this.PokemonUnitAdapter(data2.pokemonUnitList[i])
end
end
local data = {
fightData = fightData,