From d3c0c9671bec0dc4cf3c767b7dc52e6dc6b3aadf Mon Sep 17 00:00:00 2001 From: wangzhenxing Date: Tue, 4 Apr 2023 16:49:58 +0800 Subject: [PATCH] =?UTF-8?q?battlemanager=20=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../~Lua/Modules/Battle/BattleManager.lua | 96 ++++++++++++++++++- .../Battle/Logic/Misc/BattleDefine.lua | 5 +- 2 files changed, 97 insertions(+), 4 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/BattleManager.lua b/Assets/ManagedResources/~Lua/Modules/Battle/BattleManager.lua index 24484920c0..1825514754 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/BattleManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/BattleManager.lua @@ -8,6 +8,7 @@ local MonsterConfig = ConfigManager.GetConfig(ConfigName.MonsterConfig) local duoDuiTowerHero=ConfigManager.GetConfig(ConfigName.DuoDuiTowerHero) local CombatControl = ConfigManager.GetConfig(ConfigName.CombatControl) local SpiritAnimalSkill = ConfigManager.GetConfig(ConfigName.SpiritAnimalSkill) +local ShenBingSkill=ConfigManager.GetConfig(ConfigName.ShenBingSkill) local playerSkill = ConfigManager.GetConfig(ConfigName.PlayerSkill) local FakeBattleNew = ConfigManager.GetConfig(ConfigName.FakeBattleNew) local FEAConfig = require("Modules/Battle/Config/FightEffectAudioConfig") @@ -21,6 +22,7 @@ local function pairsByKeys(t) end table.sort(a, function( op1, op2 ) local type1, type2 = type(op1), type(op2) + -- LogError("op1=="..op1.." op2=="..op2) local num1, num2 = tonumber(op1), tonumber(op2) if ( num1 ~= nil) and (num2 ~= nil) then @@ -243,6 +245,32 @@ function this.MonsterSkillAdapter(MSkillId) return skill end +function this.WeaponSkillAdapter(MSkillId) + local skill = {} + if MSkillId then + LogError("mskillid======"..MSkillId) + local monsterSkill = ShenBingSkill[tonumber(MSkillId)] + for index, skillId in ipairs(monsterSkill.SkillIDList) do + skill[index] = {} + skill[index].effect = this.GetSkillData(tonumber(skillId)) + skill[index].triggerId = monsterSkill.ReleasePoint[index] + skill[index].triggerCondition = {0} + if monsterSkill.ReleaseLimit and monsterSkill.ReleaseLimit[index] then + for k, v in ipairs(monsterSkill.ReleaseLimit[index]) do + skill[index].triggerCondition[k] = v + end + end + skill[index].maxCount = monsterSkill.WarEffectCount[index] or 999 + skill[index].maxRoundCount = monsterSkill.TurnEffectCount[index] or 999 + end + end + + return skill +end + + + + function this.PlayerSkillAdapter(MSkillId) local skill = {} local monsterSkill = playerSkill[tonumber(MSkillId)] @@ -314,6 +342,54 @@ function this.PokemonUnitAdapter(pokemonUnit,camp,_teamDamage) return role end +function this.GodWeaponUnitAdapter(pokemonUnit,camp,_teamDamage) + -- 基础数据 + --LogError("teamdamage=="..tonumber(pokemonUnit.forceScore)) + local role = { + id = tonumber(pokemonUnit.unitId), + position = tonumber(pokemonUnit.position), + star = tonumber(pokemonUnit.star), + teamDamage = tonumber(pokemonUnit.forceScore), + sex= tonumber(pokemonUnit.playerSex), + camp = camp, + skill = {}, + property = {}, + } + -- 技能 + LogError("pokemonUnit.unitSkillIds=="..pokemonUnit.unitSkillIds) + if pokemonUnit.unitSkillIds~=nil and tonumber(pokemonUnit.unitSkillIds)~=0 then + local skills = string.split(pokemonUnit.unitSkillIds, "|") + if skills then + if skills[1] then + local actives=string.split(skills[1], "#") + + for i = 1, #actives do + role.skill[i]= this.WeaponSkillAdapter(tonumber(actives[i])) + local shenbing=ShenBingSkill[tonumber(actives[i])] + if shenbing and shenbing.PassiveSkill then + local passs=string.split(shenbing.PassiveSkill, "#") + local passivityList = {} + for j = 1, #passs do + table.insert(passivityList, tonumber(passs[j])) + end + role.passivity = this.GetPassivityData(passivityList) + end + end + end + end + 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) @@ -391,8 +467,8 @@ function this.GetBattleServerData(msg, isFightPlayer) end -- 一些战斗外数据 + fightData.playerData.outData = data.specialPassive - -- LogRed("战斗外数据 ==================== "..data.specialPassive) -- 灵兽数据 fightData.playerData.monsterList ={} if data.pokemonUnitList then @@ -402,9 +478,15 @@ function this.GetBattleServerData(msg, isFightPlayer) end end + -- 神兵数据 + fightData.playerData.weaponList ={} + if data.MagicSoldierList then + for i = 1, #data.MagicSoldierList do + local weaponData=data.MagicSoldierList[i] + fightData.playerData.weaponList[i] = this.GodWeaponUnitAdapter(weaponData,0,data.forceScore) + end + end -- 敌方 - - -- for i = 1, #msg.fightData.monsterList do local data2 = msg.fightData.monsterList[i] fightData.enemyData[i] = { teamSkill = {}, teamPassive = {} , firstCamp = 0, } @@ -514,6 +596,14 @@ function this.GetBattleServerData(msg, isFightPlayer) fightData.enemyData[i].monsterList[k] = this.PokemonUnitAdapter(data2.pokemonUnitList[k],1,data2.forceScore) end end + --神兵数据 + fightData.enemyData[i].weaponList ={} + if data2.MagicSoldierList then + for k = 1, #data2.MagicSoldierList do + local weaponData=data2.MagicSoldierList[k] + fightData.enemyData[i].weaponList[k] = this.GodWeaponUnitAdapter(weaponData,1,data.forceScore) + end + end end --精英副本关卡id fightData.nodeId = msg.fightData.nodeId diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleDefine.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleDefine.lua index e2536d8ec0..9f435ff0b0 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleDefine.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Misc/BattleDefine.lua @@ -43,6 +43,7 @@ BattleEventName = { BattleEnd = indexAdd(), AddRole = indexAdd(), AddMonster = indexAdd(), + AddWeapon = indexAdd(), RemoveRole = indexAdd(), RemoveMonster = indexAdd(), MpChanged = indexAdd(), @@ -201,7 +202,8 @@ BattleEventName = { CheckDamageIsImmune = indexAdd(),--检测伤害是否免疫 BloodValueGetZero = indexAdd(), --御甲值清零 RoleAddBuffCheckBan = indexAdd(),--角色添加buff检测是否被禁止 - + WeaponSkillCast = indexAdd(), --神兵技能释放 + CheckFalseNoDead = indexAdd(), --检测伪不灭 } BattleMaxFrame = 1000000 @@ -288,6 +290,7 @@ BuffName = { AddAttack = 18, Suppress = 19, BuDongSign = 20, + FalseNoDead=21, --伪不灭 } DotType = {