From 8316e48633d1815c10f4614276f7a9bd88483ba5 Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Fri, 19 May 2023 15:15:02 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9A=8F=E6=9C=BA=E6=8A=80=E8=83=BD=E6=9C=BA?= =?UTF-8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../battle/component/battle_unit_comp.lua | 2 - .../battle/controller/battle_controller.lua | 162 +---------- .../helper/battle_instructions_helper.lua | 253 ++++++++++++++++++ .../skill/battle_rogue_skill_handle.lua | 100 +++++-- .../skill/battle_board_skill_entity.lua | 105 ++++++-- lua/app/userdata/hero/hero_entity.lua | 6 +- 6 files changed, 420 insertions(+), 208 deletions(-) create mode 100644 lua/app/module/battle/helper/battle_instructions_helper.lua diff --git a/lua/app/module/battle/component/battle_unit_comp.lua b/lua/app/module/battle/component/battle_unit_comp.lua index cd934bd3..8297dcb7 100644 --- a/lua/app/module/battle/component/battle_unit_comp.lua +++ b/lua/app/module/battle/component/battle_unit_comp.lua @@ -490,8 +490,6 @@ function BattleUnitComp:changeState(state) self:enterAssistingAttackState() elseif state == UNIT_STATE.DEAD then self:enterDeadState() - elseif state == UNIT_STATE.BORN then - self:enterBornState() elseif state == UNIT_STATE.ENTER_BATTLEFIELD then self:enterEnterBattlefieldState() elseif state == UNIT_STATE.SWITCH_IN then diff --git a/lua/app/module/battle/controller/battle_controller.lua b/lua/app/module/battle/controller/battle_controller.lua index daeff18d..1622ffd6 100644 --- a/lua/app/module/battle/controller/battle_controller.lua +++ b/lua/app/module/battle/controller/battle_controller.lua @@ -9,6 +9,7 @@ local BattleController = class("BattleController") local BATTLE_BOARD_SKILL_HANDLE = require "app/module/battle/skill/battle_board_skill_handle" local BATTLE_ROGUE_SKILL_HANDLE = require "app/module/battle/skill/battle_rogue_skill_handle" local BATTLE_GRID_EFFECT_HANDLE = require "app/module/battle/skill/battle_grid_effect_handle" +local BATTLE_INSTRUCTIONS_HELPER = require "app/module/battle/helper/battle_instructions_helper" local BattleBuffHandle = require "app/module/battle/helper/battle_buff_handle" local ELIMINATION_TOUCH_EVENT = GConst.ELIMINATION_TOUCH_EVENT @@ -1164,163 +1165,7 @@ function BattleController:onFillBoardOver(isRoundBeginCheck) end function BattleController:generateInstructions(skillEntity, elementType, lineCount, influenceElementTypeMap, elementTypeMap) - local elementTypeCount = 0 - -- local assistingList = nil - ---- 援助 - for element, count in pairs(elementTypeMap) do - -- if element == elementType then - elementTypeCount = elementTypeCount + count - -- else - -- if assistingList == nil then - -- assistingList = {} - -- end - -- local obj = { - -- count = count, - -- skillMatch = element, - -- } - -- table.insert(assistingList, obj) - -- end - end - - ---- 技能 - if skillEntity then - if elementType == skillEntity:getPosition() then - table.insert(self.instructions, { - name = BattleConst.INSTRUCTION_NAME.PLAY_SKILL, - skillMatch = elementType, - count = elementTypeCount, - }) - else - if skillEntity:getEffect() ~= nil then - table.insert(self.instructions, { - name = BattleConst.INSTRUCTION_NAME.PLAY_SKILL, - skillMatch = skillEntity:getPosition(), - count = 0, - }) - end - if elementTypeCount > 0 then - table.insert(self.instructions, { - name = BattleConst.INSTRUCTION_NAME.GENERAL_ATTACK, - skillMatch = elementType, - count = elementTypeCount, - }) - end - end - else - ---- 普攻 - if elementTypeCount > 0 then - table.insert(self.instructions, { - name = BattleConst.INSTRUCTION_NAME.GENERAL_ATTACK, - skillMatch = elementType, - count = elementTypeCount, - }) - end - end - - -- if assistingList then - -- table.insert(self.instructions, { - -- name = BattleConst.INSTRUCTION_NAME.ASSISTING, - -- assistingList = assistingList, - -- }) - -- end - - ---- 加buff - if skillEntity then - local eliminateEffects = skillEntity:getEliminateEffects(self) - if eliminateEffects then - local effectList - for _, buffEntity in ipairs(eliminateEffects) do - if not effectList then - effectList = {} - end - table.insert(effectList, buffEntity) - end - if effectList then - local unit = { - name = BattleConst.INSTRUCTION_NAME.ADD_CUR_ROUND_ATTR, - effectList = effectList - } - table.insert(self.instructions, unit) - end - end - if skillEntity:getLinkEffects() and elementType then - local effectList - for type, buffEntities in pairs(skillEntity:getLinkEffects()) do - local buffEntity = buffEntities[elementType] - if buffEntity then - if not effectList then - effectList = {} - end - table.insert(effectList, buffEntity) - end - end - if effectList then - local unit = { - name = BattleConst.INSTRUCTION_NAME.ADD_CUR_ROUND_ATTR, - effectList = effectList - } - table.insert(self.instructions, unit) - end - end - - if skillEntity:getInInfluenceEffects() and influenceElementTypeMap then - for influenceElementType , _ in pairs(influenceElementTypeMap) do - local effectList - for type, buffEntities in pairs(skillEntity:getInInfluenceEffects()) do - local buffEntity = buffEntities[influenceElementType] - if buffEntity then - if not effectList then - effectList = {} - end - table.insert(effectList, buffEntity) - end - end - if effectList then - table.insert(self.instructions, { - name = BattleConst.INSTRUCTION_NAME.ADD_CUR_ROUND_ATTR, - effectList = effectList - }) - end - end - end - - if skillEntity:getElementCountEffect() and elementType then - local effectList - for type, buffEntities in pairs(skillEntity:getElementCountEffect()) do - local originBuffEntity = buffEntities.origin - local useBuffEntity = buffEntities.use - if not effectList then - effectList = {} - end - local newNum = originBuffEntity:getEffectNum() * lineCount - useBuffEntity:setEffectNum(newNum) - table.insert(effectList, useBuffEntity) - end - if effectList then - table.insert(self.instructions, { - name = BattleConst.INSTRUCTION_NAME.ADD_CUR_ROUND_ATTR, - effectList = effectList - }) - end - end - - -- - if skillEntity:getSkillAttackBeforeEffects() and elementType then - local effectList - for type, buffEntity in pairs(skillEntity:getSkillAttackBeforeEffects()) do - if not effectList then - effectList = {} - end - table.insert(effectList, buffEntity) - end - if effectList then - table.insert(self.instructions, { - name = BattleConst.INSTRUCTION_NAME.ADD_CUR_ROUND_ATTR, - effectList = effectList - }) - end - end - end + self.instructions = BATTLE_INSTRUCTIONS_HELPER.generateInstructions(skillEntity, elementType, lineCount, influenceElementTypeMap, elementTypeMap, self) end function BattleController:exeInstructions(callback) @@ -1792,7 +1637,8 @@ function BattleController:getRandomSkillList(getCount, onlyCommonSkill) for _, skillId in ipairs(list) do local skillCfg = cfg[skillId] if skillCfg and (not skillCfg.limit_times or self.battleData:getSkillCount(skillId) < skillCfg.limit_times) then - if not map[skillId] then + + if not map[skillId] and (not skillCfg.unlock or self.battleData:getSkillCount(skillCfg.unlock) > 0) then table.insert(newSkillPool, skillId) table.insert(skillWeight, skillCfg.weight) count = count + 1 diff --git a/lua/app/module/battle/helper/battle_instructions_helper.lua b/lua/app/module/battle/helper/battle_instructions_helper.lua new file mode 100644 index 00000000..3c2eacee --- /dev/null +++ b/lua/app/module/battle/helper/battle_instructions_helper.lua @@ -0,0 +1,253 @@ +local BattleConst = GConst.BattleConst +local BattleInstructionsHelper = {} + +BattleInstructionsHelper._generateAttackInstructions = function(instructions, skillEntity, elementType, elementTypeCount) + if skillEntity then + if elementType == skillEntity:getPosition() then + table.insert(instructions, { + name = BattleConst.INSTRUCTION_NAME.PLAY_SKILL, + skillMatch = elementType, + count = elementTypeCount, + }) + else + if skillEntity:getEffect() ~= nil then + table.insert(instructions, { + name = BattleConst.INSTRUCTION_NAME.PLAY_SKILL, + skillMatch = skillEntity:getPosition(), + count = 0, + }) + end + if elementTypeCount > 0 then + table.insert(instructions, { + name = BattleConst.INSTRUCTION_NAME.GENERAL_ATTACK, + skillMatch = elementType, + count = elementTypeCount, + }) + end + end + else + ---- 普攻 + if elementTypeCount > 0 then + table.insert(instructions, { + name = BattleConst.INSTRUCTION_NAME.GENERAL_ATTACK, + skillMatch = elementType, + count = elementTypeCount, + }) + end + end + + -- if assistingList then + -- table.insert(self.instructions, { + -- name = BattleConst.INSTRUCTION_NAME.ASSISTING, + -- assistingList = assistingList, + -- }) + -- end +end + +local generateEliminateEffects = function(instructions, skillEntity, battleController) + local eliminateEffects = skillEntity:getEliminateEffects(battleController) + if not eliminateEffects then + return + end + local effectList + for _, buffEntity in ipairs(eliminateEffects) do + if not effectList then + effectList = {} + end + table.insert(effectList, buffEntity) + end + if effectList then + local unit = { + name = BattleConst.INSTRUCTION_NAME.ADD_CUR_ROUND_ATTR, + effectList = effectList + } + table.insert(instructions, unit) + end +end + +local generateLinkEffects = function(instructions, skillEntity, elementType) + if not skillEntity:getLinkEffects() or not elementType then + return + end + + local effectList + for type, buffEntities in pairs(skillEntity:getLinkEffects()) do + local buffEntity = buffEntities[elementType] + if buffEntity then + if not effectList then + effectList = {} + end + table.insert(effectList, buffEntity) + end + end + if effectList then + local unit = { + name = BattleConst.INSTRUCTION_NAME.ADD_CUR_ROUND_ATTR, + effectList = effectList + } + table.insert(instructions, unit) + end +end + +local generateInfluenceEffects = function(instructions, skillEntity, influenceElementTypeMap) + if not skillEntity:getInInfluenceEffects() or not influenceElementTypeMap then + return + end + for influenceElementType , _ in pairs(influenceElementTypeMap) do + local effectList + for type, buffEntities in pairs(skillEntity:getInInfluenceEffects()) do + local buffEntity = buffEntities[influenceElementType] + if buffEntity then + if not effectList then + effectList = {} + end + table.insert(effectList, buffEntity) + end + end + if effectList then + table.insert(instructions, { + name = BattleConst.INSTRUCTION_NAME.ADD_CUR_ROUND_ATTR, + effectList = effectList + }) + end + end +end + +local generateElementCountEffect = function(instructions, skillEntity, elementType, lineCount) + if not skillEntity:getElementCountEffect() or not elementType then + return + end + + local effectList + for rogueSkill, list in pairs(skillEntity:getElementCountEffect()) do + for index, buffEntities in pairs(list) do + local originBuffEntity = buffEntities.origin + local useBuffEntity = buffEntities.use + if not effectList then + effectList = {} + end + local newNum = originBuffEntity:getEffectNum() * lineCount + useBuffEntity:setEffectNum(newNum) + table.insert(effectList, useBuffEntity) + end + end + if effectList then + table.insert(instructions, { + name = BattleConst.INSTRUCTION_NAME.ADD_CUR_ROUND_ATTR, + effectList = effectList + }) + end +end + +local generateSkillAttackBeforeEffects = function(instructions, skillEntity) + if not skillEntity:getSkillAttackBeforeEffects() then + return + end + + local effectList + for rogueSkill, list in pairs(skillEntity:getSkillAttackBeforeEffects()) do + for index, buffEntity in pairs(list) do + if not effectList then + effectList = {} + end + table.insert(effectList, buffEntity) + end + end + if effectList then + table.insert(instructions, { + name = BattleConst.INSTRUCTION_NAME.ADD_CUR_ROUND_ATTR, + effectList = effectList + }) + end +end + +local generateLinkCountMoreEffects = function(instructions, skillEntity, lineCount) + if not skillEntity:getLinkCountMoreEffects() then + return + end + + local effectList + for rogueSkill, list in pairs(skillEntity:getLinkCountMoreEffects()) do + for index, info in pairs(list) do + if info.paramsCount and info.paramsCount <= lineCount then + if not effectList then + effectList = {} + end + table.insert(effectList, info.buffEntity) + end + end + end + if effectList then + table.insert(instructions, { + name = BattleConst.INSTRUCTION_NAME.ADD_CUR_ROUND_ATTR, + effectList = effectList + }) + end +end + +local generateLinkCountPowerEffects = function(instructions, skillEntity, lineCount) + if not skillEntity:getLinkCountMoreEffects() then + return + end + + local effectList + for rogueSkill, list in pairs(skillEntity:getLinkCountMoreEffects()) do + for index, info in pairs(list) do + if info.paramsCount and info.paramsCount <= lineCount then + local poser = lineCount // info.paramsCount + for i = 1, poser do + if not effectList then + effectList = {} + end + table.insert(effectList, info.buffEntity) + end + end + end + end + if effectList then + table.insert(instructions, { + name = BattleConst.INSTRUCTION_NAME.ADD_CUR_ROUND_ATTR, + effectList = effectList + }) + end +end + +BattleInstructionsHelper._generateBuffInstructions = function(instructions, skillEntity, elementType, lineCount, influenceElementTypeMap, battleController) + if skillEntity then + generateEliminateEffects(instructions, skillEntity, battleController) + generateLinkEffects(instructions, skillEntity, elementType) + generateInfluenceEffects(instructions, skillEntity, influenceElementTypeMap) + generateElementCountEffect(instructions, skillEntity, elementType, lineCount) + generateSkillAttackBeforeEffects(instructions, skillEntity) + generateLinkCountMoreEffects(instructions, skillEntity, lineCount) + generateLinkCountPowerEffects(instructions, skillEntity, lineCount) + end +end + +BattleInstructionsHelper.generateInstructions = function(skillEntity, elementType, lineCount, influenceElementTypeMap, elementTypeMap, battleController) + local elementTypeCount = 0 + local instructions = {} + -- local assistingList = nil + ---- 援助 + for element, count in pairs(elementTypeMap) do + -- if element == elementType then + elementTypeCount = elementTypeCount + count + -- else + -- if assistingList == nil then + -- assistingList = {} + -- end + -- local obj = { + -- count = count, + -- skillMatch = element, + -- } + -- table.insert(assistingList, obj) + -- end + end + + -- 攻击 + BattleInstructionsHelper._generateAttackInstructions(instructions, skillEntity, elementType, elementTypeCount) + ---- 加buff + BattleInstructionsHelper._generateBuffInstructions(instructions, skillEntity, elementType, lineCount, influenceElementTypeMap, battleController) +end + +return BattleInstructionsHelper diff --git a/lua/app/module/battle/skill/battle_rogue_skill_handle.lua b/lua/app/module/battle/skill/battle_rogue_skill_handle.lua index c910328a..a4700259 100644 --- a/lua/app/module/battle/skill/battle_rogue_skill_handle.lua +++ b/lua/app/module/battle/skill/battle_rogue_skill_handle.lua @@ -4,7 +4,7 @@ local BattleBuffEntity = require "app/userdata/battle/skill/battle_buff_entity" local BattleRogueSkillHandle = {} -local _changeBaseSkill = function(skillInfo, battleData, battleController) +local _changeBaseSkill = function(skillId, skillInfo, battleData, battleController) local elementType = skillInfo.skill_position if not elementType or not skillInfo.parameter then return @@ -27,7 +27,7 @@ local _changeBaseSkill = function(skillInfo, battleData, battleController) end end -local _addEliminationRange = function(skillInfo, battleData, battleController) +local _addEliminationRange = function(skillId, skillInfo, battleData, battleController) local elementType = skillInfo.skill_position if not elementType or not skillInfo.boardrange then return @@ -39,7 +39,7 @@ local _addEliminationRange = function(skillInfo, battleData, battleController) end end -local _canLinkAnyElement = function(skillInfo, battleData, battleController) +local _canLinkAnyElement = function(skillId, skillInfo, battleData, battleController) local elementType = skillInfo.skill_position if not elementType then return @@ -51,7 +51,7 @@ local _canLinkAnyElement = function(skillInfo, battleData, battleController) end end -local _addLinkAtkp = function(skillInfo, battleData, battleController) +local _addLinkAtkp = function(skillId, skillInfo, battleData, battleController) local elementType = skillInfo.skill_position if not elementType or not skillInfo.effect then return @@ -74,7 +74,7 @@ local _addLinkAtkp = function(skillInfo, battleData, battleController) end end -local _changeElementType = function(skillInfo, battleData, battleController) +local _changeElementType = function(skillId, skillInfo, battleData, battleController) if not skillInfo.boardrange or not skillInfo.parameter then return end @@ -88,7 +88,7 @@ local _changeElementType = function(skillInfo, battleData, battleController) battleController:changeElementType(count, elementType) end -local _addAttr = function(skillInfo, battleData, battleController, value) +local _addAttr = function(skillId, skillInfo, battleData, battleController, value) if not skillInfo.attr then return end @@ -99,7 +99,7 @@ local _addAttr = function(skillInfo, battleData, battleController, value) battleController:addHeroAttr(skillInfo.attr.type, value) end -local _unlockSkill = function(skillInfo, battleData, battleController, value) +local _unlockSkill = function(skillId, skillInfo, battleData, battleController, value) if not skillInfo.skill_position then return end @@ -107,7 +107,7 @@ local _unlockSkill = function(skillInfo, battleData, battleController, value) battleData:unlockSkillEntity(skillInfo.skill_position) end -local _addSkillEffectParams = function(skillInfo, battleData, battleController) +local _addSkillEffectParams = function(skillId, skillInfo, battleData, battleController) local elementType = skillInfo.skill_position if not elementType or not skillInfo.parameter then return @@ -144,7 +144,7 @@ local _addSkillEffectParams = function(skillInfo, battleData, battleController) end end -local _addSkillRound = function(skillInfo, battleData, battleController) +local _addSkillRound = function(skillId, skillInfo, battleData, battleController) local elementType = skillInfo.skill_position if not elementType or not skillInfo.parameter then return @@ -182,7 +182,7 @@ local _addSkillRound = function(skillInfo, battleData, battleController) end end -local _addSkillEffect = function(skillInfo, battleData, battleController) +local _addSkillEffect = function(skillId, skillInfo, battleData, battleController) if not skillInfo.effect then return end @@ -222,7 +222,7 @@ local _addSkillEffect = function(skillInfo, battleData, battleController) end end -local _addSkillInInfluenceAtkp = function(skillInfo, battleData, battleController) +local _addSkillInInfluenceAtkp = function(skillId, skillInfo, battleData, battleController) local elementType = skillInfo.skill_position if not elementType or not skillInfo.effect then return @@ -243,7 +243,7 @@ local _addSkillInInfluenceAtkp = function(skillInfo, battleData, battleControlle end end -local _addSkillAttackBeforeEffect = function(skillInfo, battleData, battleController) +local _addSkillAttackBeforeEffect = function(skillId, skillInfo, battleData, battleController) local elementType = skillInfo.skill_position if not elementType or not skillInfo.effect then return @@ -260,13 +260,16 @@ local _addSkillAttackBeforeEffect = function(skillInfo, battleData, battleContro local entity = battleData:getSkillEntityByElement(elementType) if entity then + if skillInfo.cover_unlock then + entity:removeSkillAttackBeforeEffect(skillInfo.cover_unlock) + end for k, effect in ipairs(skillInfo.effect) do - entity:addSkillAttackBeforeEffect(k, effect, unitEntity, skillInfo.obj) + entity:addSkillAttackBeforeEffect(skillId, k, effect, unitEntity, skillInfo.obj) end end end -local _addSkillElementCountEffect = function(skillInfo, battleData, battleController) +local _addSkillElementCountEffect = function(skillId, skillInfo, battleData, battleController) local elementType = skillInfo.skill_position if not elementType or not skillInfo.effect then return @@ -283,8 +286,69 @@ local _addSkillElementCountEffect = function(skillInfo, battleData, battleContro local entity = battleData:getSkillEntityByElement(elementType) if entity then - for _, effect in ipairs(skillInfo.effect) do - entity:addElementCountEffect(effect, unitEntity, skillInfo.obj) + if skillInfo.cover_unlock then + entity:removeElementCountEffect(skillInfo.cover_unlock) + end + for k, effect in ipairs(skillInfo.effect) do + entity:addElementCountEffect(skillId, k, effect, unitEntity, skillInfo.obj) + end + end +end + +local _addLinkCountMoreEffect = function(skillId, skillInfo, battleData, battleController) + local elementType = skillInfo.skill_position + if not elementType or not skillInfo.effect or not skillInfo.parameter then + return + end + + if not battleController.battleData or not battleController.battleData.atkTeam then + return + end + + local unitEntity = battleController.battleData.atkTeam:getAllMembers()[elementType] + if not unitEntity then + return + end + + local entity = battleData:getSkillEntityByElement(elementType) + if entity then + if skillInfo.cover_unlock then + entity:removeLinkCountMoreEffects(skillInfo.cover_unlock) + end + for k, effect in ipairs(skillInfo.effect) do + local paramsCount = skillInfo.parameter[k] + if paramsCount then + entity:addLinkCountMoreEffects(skillId, k, effect, unitEntity, skillInfo.obj, paramsCount) + end + end + end +end + +local _addLinkCountPowerEffect = function(skillId, skillInfo, battleData, battleController) + local elementType = skillInfo.skill_position + if not elementType or not skillInfo.effect or not skillInfo.parameter then + return + end + + if not battleController.battleData or not battleController.battleData.atkTeam then + return + end + + local unitEntity = battleController.battleData.atkTeam:getAllMembers()[elementType] + if not unitEntity then + return + end + + local entity = battleData:getSkillEntityByElement(elementType) + if entity then + if skillInfo.cover_unlock then + entity:removeLinkCountPowerEffects(skillInfo.cover_unlock) + end + for k, effect in ipairs(skillInfo.effect) do + local paramsCount = skillInfo.parameter[k] + if paramsCount then + entity:addLinkCountPowerEffects(skillId, k, effect, unitEntity, skillInfo.obj, paramsCount) + end end end end @@ -303,6 +367,8 @@ BattleRogueSkillHandle._effectOn = { [11] = _addSkillInInfluenceAtkp, -- 技能消除的增加伤害 [12] = _addSkillAttackBeforeEffect, -- 技能触发前的技能效果 [13] = _addSkillElementCountEffect, -- 技能链接中每一个元素累加的技能效果 + [14] = _addLinkCountMoreEffect, -- 链接超过x元素获得一次技能效果 + [15] = _addLinkCountPowerEffect, -- 链接超过x元素获得倍数技能效果 } function BattleRogueSkillHandle.takeEffect(skillId, battleData, battleController, value) @@ -313,7 +379,7 @@ function BattleRogueSkillHandle.takeEffect(skillId, battleData, battleController local func = BattleRogueSkillHandle._effectOn[cfg.type] if func then - func(cfg, battleData, battleController, value) + func(skillId, cfg, battleData, battleController, value) end end diff --git a/lua/app/userdata/battle/skill/battle_board_skill_entity.lua b/lua/app/userdata/battle/skill/battle_board_skill_entity.lua index fb828706..1808f29e 100644 --- a/lua/app/userdata/battle/skill/battle_board_skill_entity.lua +++ b/lua/app/userdata/battle/skill/battle_board_skill_entity.lua @@ -5,11 +5,12 @@ function BattleBoardSkillEntity:ctor(skillId) self:refreshSkillId(skillId) self.curEnergy = 0 self.addRange = {} - self.linkEffectEntities = {} - self.inInfluenceEntities = {} - self.skillAttackBeforeEffectEntities = {} - self.elementCountEffectEntities = {} - self.cacheBuffEntities = {} + self.linkEffectEntities = {} -- 链接攻击伤害 type = 3 + self.inInfluenceEntities = {} -- 技能消除攻击伤害 type = 11 + self.skillAttackBeforeEffectEntities = {} -- 战斗开始前获得技能效果 type = 12 + self.elementCountEffectEntities = {} -- 根据消除数量获得次数的技能效果 type = 13 + self.linkCountMoreEffects = {} -- 链接超过x元素获得一次技能效果 type = 14 + self.linkCountPowerEffects = {} -- 链接超过x元素获得倍数技能效果 type = 15 self.upSkillIdMap = {} self.getUpSkillKind = 0 @@ -280,27 +281,38 @@ function BattleBoardSkillEntity:addInInfluenceEffect(effect, unitEntity, targetS end end -function BattleBoardSkillEntity:addSkillAttackBeforeEffect(index, effect, unitEntity, targetSide) - local buffEntity = self.skillAttackBeforeEffectEntities[index] +function BattleBoardSkillEntity:addSkillAttackBeforeEffect(rogueSkill, index, effect, unitEntity, targetSide) + if not self.skillAttackBeforeEffectEntities[rogueSkill] then + self.skillAttackBeforeEffectEntities[rogueSkill] = {} + end + local buffEntity = self.skillAttackBeforeEffectEntities[rogueSkill][index] if not buffEntity then buffEntity = BattleBuffEntity:create() buffEntity:init(effect, unitEntity) - self.skillAttackBeforeEffectEntities[index] = buffEntity + self.skillAttackBeforeEffectEntities[rogueSkill][index] = buffEntity else buffEntity:init(effect, unitEntity) end buffEntity:setTargetSide(targetSide) end +function BattleBoardSkillEntity:removeSkillAttackBeforeEffect(rogueSkill) + self.skillAttackBeforeEffectEntities[rogueSkill] = nil +end + function BattleBoardSkillEntity:getSkillAttackBeforeEffects() return self.skillAttackBeforeEffectEntities end -function BattleBoardSkillEntity:addElementCountEffect(effect, unitEntity, targetSide) - local buffEntities = self.elementCountEffectEntities[effect.type] +function BattleBoardSkillEntity:addElementCountEffect(rogueSkill, index, effect, unitEntity, targetSide) + if not self.elementCountEffectEntities[rogueSkill] then + self.elementCountEffectEntities[rogueSkill] = {} + end + local buffEntities = self.elementCountEffectEntities[rogueSkill][index] if not buffEntities then - self.elementCountEffectEntities[effect.type] = {} - buffEntities = self.elementCountEffectEntities[effect.type] + self.elementCountEffectEntities[rogueSkill][index] = {} + buffEntities = self.elementCountEffectEntities[rogueSkill][index] + local originBuffEntity = BattleBuffEntity:create() originBuffEntity:init(effect, unitEntity) originBuffEntity:setTargetSide(targetSide) @@ -325,27 +337,14 @@ function BattleBoardSkillEntity:addElementCountEffect(effect, unitEntity, target end end +function BattleBoardSkillEntity:removeElementCountEffect(rogueSkill) + self.elementCountEffectEntities[rogueSkill] = nil +end + function BattleBoardSkillEntity:getElementCountEffect() return self.elementCountEffectEntities end -function BattleBoardSkillEntity:addBuffEffect(buff, unitEntity) - local buffEntity = self.cacheBuffEntities[buff.type] - if not buffEntity then - buffEntity = BattleBuffEntity:create() - buffEntity:init(buff, unitEntity) - self.cacheBuffEntities[buff.type] = buffEntity - else - local buffNum = buffEntity:getEffectNum() - buffEntity:init(buff, unitEntity) - buffEntity:setEffectNum(buffEntity:getEffectNum() + buffNum) - end -end - -function BattleBoardSkillEntity:getBuffEffects() - return self.cacheBuffEntities -end - function BattleBoardSkillEntity:getEliminateEffects(battleController) local unitEntity = battleController.battleData.atkTeam:getAllMembers()[self:getPosition()] if not unitEntity or not self.config.eliminate_effect then @@ -390,4 +389,52 @@ function BattleBoardSkillEntity:gotUpSKill(skillId) return true end +function BattleBoardSkillEntity:addLinkCountMoreEffects(rogueSkill, index, effect, unitEntity, targetSide, paramsCount) + if not self.linkCountMoreEffects[rogueSkill] then + self.linkCountMoreEffects[rogueSkill] = {} + end + local info = self.linkCountMoreEffects[rogueSkill][index] + if not info then + info = {paramsCount = paramsCount} + info.buffEntity = BattleBuffEntity:create() + info.buffEntity:init(effect, unitEntity) + self.linkCountMoreEffects[rogueSkill][index] = info + else + info.buffEntity:init(effect, unitEntity) + end + info.buffEntity:setTargetSide(targetSide) +end + +function BattleBoardSkillEntity:removeLinkCountMoreEffects(rogueSkill) + self.linkCountMoreEffects[rogueSkill] = nil +end + +function BattleBoardSkillEntity:getLinkCountMoreEffects() + return self.linkCountMoreEffects +end + +function BattleBoardSkillEntity:addLinkCountPowerEffects(rogueSkill, index, effect, unitEntity, targetSide, paramsCount) + if not self.linkCountPowerEffects[rogueSkill] then + self.linkCountPowerEffects[rogueSkill] = {} + end + local info = self.linkCountPowerEffects[rogueSkill][index] + if not info then + info = {paramsCount = paramsCount} + info.buffEntity = BattleBuffEntity:create() + info.buffEntity:init(effect, unitEntity) + self.linkCountPowerEffects[rogueSkill][index] = info + else + info.buffEntity:init(effect, unitEntity) + end + info.buffEntity:setTargetSide(targetSide) +end + +function BattleBoardSkillEntity:removeLinkCountPowerEffects(rogueSkill) + self.linkCountPowerEffects[rogueSkill] = nil +end + +function BattleBoardSkillEntity:getLinkCountPowerEffects() + return self.linkCountPowerEffects +end + return BattleBoardSkillEntity \ No newline at end of file diff --git a/lua/app/userdata/hero/hero_entity.lua b/lua/app/userdata/hero/hero_entity.lua index 98291d5a..92608019 100644 --- a/lua/app/userdata/hero/hero_entity.lua +++ b/lua/app/userdata/hero/hero_entity.lua @@ -240,13 +240,15 @@ end function HeroEntity:getRogueSkillList() if not self.rogueSkillList then self.rogueSkillList = {} - for i = 1, 3 do - local id = self.config["rouge_skill_" .. i] + local count = 1 + while true do + local id = self.config["rouge_skill_" .. count] if id then table.insert(self.rogueSkillList, id) else break end + count = count + 1 end end