diff --git a/lua/app/config/buff.lua b/lua/app/config/buff.lua index c4bb9029..ab7746ba 100644 --- a/lua/app/config/buff.lua +++ b/lua/app/config/buff.lua @@ -7,51 +7,61 @@ local buff = { [2]={ ["name"]="hurt_red", ["buff_type"]=3, + ["position"]=1, ["formula"]=1 }, [3]={ ["name"]="hurt_yellow", ["buff_type"]=3, + ["position"]=2, ["formula"]=1 }, [4]={ ["name"]="hurt_green", ["buff_type"]=3, + ["position"]=3, ["formula"]=1 }, [5]={ ["name"]="hurt_blue", ["buff_type"]=3, + ["position"]=4, ["formula"]=1 }, [6]={ ["name"]="hurt_purple", ["buff_type"]=3, + ["position"]=5, ["formula"]=1 }, [7]={ ["name"]="dec_dmg_red_add", ["buff_type"]=1, + ["position"]=1, ["icon"]="dec_dmg_red_add" }, [8]={ ["name"]="dec_dmg_yellow_add", ["buff_type"]=1, + ["position"]=2, ["icon"]="dec_dmg_yellow_add" }, [9]={ ["name"]="dec_dmg_green_add", ["buff_type"]=1, + ["position"]=3, ["icon"]="dec_dmg_green_add" }, [10]={ ["name"]="dec_dmg_blue_add", ["buff_type"]=1, + ["position"]=4, ["icon"]="dec_dmg_blue_add" }, [11]={ ["name"]="dec_dmg_purple_add", ["buff_type"]=1, + ["position"]=5, ["icon"]="dec_dmg_purple_add" }, [12]={ @@ -62,26 +72,31 @@ local buff = { [13]={ ["name"]="weakness_red_add", ["buff_type"]=1, + ["position"]=1, ["icon"]="weakness_red_add" }, [14]={ ["name"]="weakness_yellow_add", ["buff_type"]=1, + ["position"]=2, ["icon"]="weakness_yellow_add" }, [15]={ ["name"]="weakness_green_add", ["buff_type"]=1, + ["position"]=3, ["icon"]="weakness_green_add" }, [16]={ ["name"]="weakness_blue_add", ["buff_type"]=1, + ["position"]=4, ["icon"]="weakness_blue_add" }, [17]={ ["name"]="weakness_purple_add", ["buff_type"]=1, + ["position"]=5, ["icon"]="weakness_purple_add" }, [18]={ @@ -92,26 +107,31 @@ local buff = { [19]={ ["name"]="dmg_addition_red_add", ["buff_type"]=1, + ["position"]=1, ["icon"]="dmg_addition_red_add" }, [20]={ ["name"]="dmg_addition_yellow_add", ["buff_type"]=1, + ["position"]=2, ["icon"]="dmg_addition_yellow_add" }, [21]={ ["name"]="dmg_addition_green_add", ["buff_type"]=1, + ["position"]=3, ["icon"]="dmg_addition_green_add" }, [22]={ ["name"]="dmg_addition_blue_add", ["buff_type"]=1, + ["position"]=4, ["icon"]="dmg_addition_blue_add" }, [23]={ ["name"]="dmg_addition_purple_add", ["buff_type"]=1, + ["position"]=5, ["icon"]="dmg_addition_purple_add" }, [24]={ @@ -125,23 +145,28 @@ local buff = { }, [26]={ ["name"]="atkp_red_add", - ["buff_type"]=1 + ["buff_type"]=1, + ["position"]=1 }, [27]={ ["name"]="atkp_yellow_add", - ["buff_type"]=1 + ["buff_type"]=1, + ["position"]=2 }, [28]={ ["name"]="atkp_green_add", - ["buff_type"]=1 + ["buff_type"]=1, + ["position"]=3 }, [29]={ ["name"]="atkp_blue_add", - ["buff_type"]=1 + ["buff_type"]=1, + ["position"]=4 }, [30]={ ["name"]="atkp_purple_add", - ["buff_type"]=1 + ["buff_type"]=1, + ["position"]=5 }, [31]={ ["name"]="wavehealp", @@ -216,6 +241,10 @@ local buff = { [44]={ ["name"]="add_skill", ["buff_type"]=7 + }, + [45]={ + ["name"]="skill_fire_times", + ["buff_type"]=7 } } local keys = { @@ -263,12 +292,13 @@ local keys = { ["crit_time_add"]=buff[41], ["exp_time_add"]=buff[42], ["cured_add"]=buff[43], - ["add_skill"]=buff[44] + ["add_skill"]=buff[44], + ["skill_fire_times"]=buff[45] } } local config = { data=buff, keys=keys, -count=44 +count=45 } return config \ No newline at end of file diff --git a/lua/app/module/battle/battle_const.lua b/lua/app/module/battle/battle_const.lua index fe4ac0df..30aa0dfa 100644 --- a/lua/app/module/battle/battle_const.lua +++ b/lua/app/module/battle/battle_const.lua @@ -94,6 +94,16 @@ BattleConst.MATCH_WEAKNESS_NAME = { [5] = "weakness_purple", } +BattleConst.BUFF_MATCH_NAME = { + ["atkp"] = { + [1] = "atkp_red_add", + [2] = "atkp_yellow_add", + [3] = "atkp_green_add", + [4] = "atkp_blue_add", + [5] = "atkp_purple_add", + }, +} + BattleConst.SPINE_ANIMATION_NAME = { IDLE = "idle", ATTACK = "attack01", @@ -483,12 +493,4 @@ BattleConst.INSTRUCTION_NAME = { PLAY_SKILL = "play_skill", } -BattleConst.ELEMENT_TYPE_ATKP_NAME = { - [BattleConst.ELEMENT_TYPE.RED] = "red_atkp", - [BattleConst.ELEMENT_TYPE.YELLOW] = "yellow_atkp", - [BattleConst.ELEMENT_TYPE.GREEN] = "green_atkp", - [BattleConst.ELEMENT_TYPE.BLUE] = "blue_atkp", - [BattleConst.ELEMENT_TYPE.PURPLE] = "purple_atkp" -} - return BattleConst \ No newline at end of file diff --git a/lua/app/module/battle/battle_manager.lua b/lua/app/module/battle/battle_manager.lua index b9b401cb..1006ef01 100644 --- a/lua/app/module/battle/battle_manager.lua +++ b/lua/app/module/battle/battle_manager.lua @@ -260,6 +260,11 @@ function BattleManager:getPosRC(posId) return BattleConst.POS_ID_2_RC[posId] end +function BattleManager:getBuffElementType(buffName) + local cfg = ConfigManager:getConfigWithOtherKey("buff", "name")[buffName] + return cfg and cfg.position +end + ----------------------- end 一些公共相关的方法 ----------------------------- return BattleManager \ No newline at end of file diff --git a/lua/app/module/battle/component/battle_unit_comp.lua b/lua/app/module/battle/component/battle_unit_comp.lua index 8dbfd6d2..d2ef6d34 100644 --- a/lua/app/module/battle/component/battle_unit_comp.lua +++ b/lua/app/module/battle/component/battle_unit_comp.lua @@ -482,6 +482,7 @@ function BattleUnitComp:updateSkillAttack(dt) end return else + self.currActiveSkill:startUse() self:doNextSkillAttack() end else -- 继续普攻 @@ -489,7 +490,8 @@ function BattleUnitComp:updateSkillAttack(dt) end else local currActiveSkill = nil - if self.currActiveSkill:getSkillCanUseTimes() > 0 then -- 当前技能可以多次使用 + local skillCanUseTimes = self.currActiveSkill:getSkillCanUseTimes() + if skillCanUseTimes and skillCanUseTimes > 0 then -- 当前技能可以多次使用 currActiveSkill = self.currActiveSkill elseif self.activeSkillIndex then self.activeSkillIndex = self.activeSkillIndex + 1 @@ -664,7 +666,7 @@ end function BattleUnitComp:onSkillTakeEffect(skill) skill:endUse() - if skill == self.unitEntity:getNormalSkill() then + if self.side == GConst.BattleConst.SIDE_ATK and skill == self.unitEntity:getNormalSkill() then self.battleController:addBattleExp(self.side) end local effectList = skill:getEffectList() diff --git a/lua/app/module/battle/controller/battle_controller.lua b/lua/app/module/battle/controller/battle_controller.lua index 8b45982e..2552bb0f 100644 --- a/lua/app/module/battle/controller/battle_controller.lua +++ b/lua/app/module/battle/controller/battle_controller.lua @@ -374,7 +374,7 @@ function BattleController:onTouchEvent(eventType, posId) return end local entity = self.battleData:getGridEntity(posId) - if not entity:canLink() then + if not entity or not entity:canLink() then return end @@ -519,6 +519,7 @@ function BattleController:onLinkOver() local elementTypeMap = {} local eliminationPosIds = {} local boomGridIds = {} + local lineCount = 0 for _, info in ipairs(sequence) do if not eliminationPosIds[info.posId] then @@ -527,6 +528,7 @@ function BattleController:onLinkOver() local elementType = entity:getElementType() elementTypeMap[elementType] = (elementTypeMap[elementType] or 0) + 1 linkElementType = elementType + lineCount = lineCount + 1 end local outline = BattleConst.GRID_OUT_LINE_POS_ID[info.posId] @@ -586,7 +588,7 @@ function BattleController:onLinkOver() self.battleUI:disableUITouch() self.battleUI:eliminationAni(sequence, function() - self:generateInstructions(skillEntity, linkElementType, influenceElementType, elementTypeMap) + self:generateInstructions(skillEntity, linkElementType, lineCount, influenceElementType, elementTypeMap) self:enterAtkStep() end) end @@ -653,38 +655,7 @@ function BattleController:onFillBoardOver() end) end -function BattleController:generateInstructions(skillEntity, elementType, influenceElementType, elementTypeMap) - ---- 加buff - if skillEntity then - -- if skillEntity:getLinkEffects() > 0 and elementType then - -- local attrType = BattleConst.ELEMENT_TYPE_ATKP_NAME[elementType] - -- if attrType then - -- table.insert(self.instructions, { - -- name = BattleConst.INSTRUCTION_NAME.ADD_CUR_ROUND_ATTR, - -- attr = { - -- type = attrType, - -- num = skillEntity:getLinkEffects() - -- } - -- }) - -- end - -- end - - if skillEntity:getInInfluenceAtkp() > 0 and influenceElementType then - for elementType, _ in pairs(influenceElementType) do - local attrType = BattleConst.ELEMENT_TYPE_ATKP_NAME[elementType] - if attrType then - table.insert(self.instructions, { - name = BattleConst.INSTRUCTION_NAME.ADD_CUR_ROUND_ATTR, - attr = { - type = attrType, - num = skillEntity:getInInfluenceAtkp() - } - }) - end - end - end - end - +function BattleController:generateInstructions(skillEntity, elementType, lineCount, influenceElementTypeMap, elementTypeMap) local elementTypeCount = 0 local assistingList = nil ---- 援助 @@ -727,11 +698,76 @@ function BattleController:generateInstructions(skillEntity, elementType, influen assistingList = assistingList, }) end + + ---- 加buff + if skillEntity then + 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 + + -- 其他的buff + end end function BattleController:exeInstructions(callback) Logger.logHighlight("--------exeInstructions----------") - Logger.printTable(self.instructions) if not self.instructions or #self.instructions <= 0 then callback() return @@ -1083,7 +1119,7 @@ function BattleController:getRandomSkillList(getCount) getCount = getCount - 1 end - for skillId, info in ipairs(cfg) do + for skillId, info in pairs(cfg) do if not self:getNotInvolvedSkills()[skillId] then if info.universal then if not info.limit_times or self.battleData:getSkillCount(skillId) < info.limit_times then @@ -1116,6 +1152,9 @@ function BattleController:onSelectSkill(skillId) if self.battleData:useAddlvCount() then ModuleManager.BattleManager:showSelectSkillUI(self:getRandomSkillList()) end + if self.battleUI then + self.battleUI:refreshBoard() + end end function BattleController:changeElementType(count, elementType) @@ -1139,6 +1178,7 @@ end function BattleController:addHeroAttr(attrName, value) Logger.logHighlight("------addHeroAttr------ " .. attrName .. " " .. value) + Logger.logHighlight(self.battleData.atkTeam == nil) if not self.battleData or not self.battleData.atkTeam then return end @@ -1200,6 +1240,9 @@ function BattleController:_tick(dt) end function BattleController:battleEnd() + if self.battleUI then + self.battleUI:enableUITouch() + end self:controllBattleEnd() end @@ -1227,6 +1270,20 @@ function BattleController:showEffectNumber(num, x, y) end local function _addCurRoundAttr(self, instruction, callback) + if instruction.effectList then + local mainComp = self:getOtherSideMainUnit(BattleConst.SIDE_ATK) + local defComp = self:getOtherSideMainUnit(BattleConst.SIDE_DEF) + for _, effect in ipairs(instruction.effectList) do + local target + if effect:getTartgetSide() == BattleConst.SIDE_DEF then + target = defComp + else + target = mainComp + end + mainComp:takeEffect(effect, target) + end + end + callback() end diff --git a/lua/app/module/battle/helper/battle_buff_handle.lua b/lua/app/module/battle/helper/battle_buff_handle.lua index 5c193941..cb402156 100644 --- a/lua/app/module/battle/helper/battle_buff_handle.lua +++ b/lua/app/module/battle/helper/battle_buff_handle.lua @@ -142,7 +142,7 @@ local function _removeEffectAttr(buffSender, target, buff, buffEffect) local buffName = buff:getName() local attr = BUFF_NAME_TO_ATTR[buffName] if attr then - target.unitEntity:addAttr(attr[1], -buffEffect.effectResult, false) + target.unitEntity:addAttr(attr[1], -buffEffect.result, false) else local func = BattleBuffHandle.addAttribute[buffName] if func then diff --git a/lua/app/module/battle/helper/battle_helper.lua b/lua/app/module/battle/helper/battle_helper.lua index 20205c41..553c79b3 100644 --- a/lua/app/module/battle/helper/battle_helper.lua +++ b/lua/app/module/battle/helper/battle_helper.lua @@ -96,8 +96,7 @@ function BattleHelper:getBuffEffect() if #self.buffEffectPool > 0 then return table.remove(self.buffEffectPool) end - local sid = self.buffSid + 1 - return {sid = sid} + return {} end function BattleHelper:recycleBuffEffect(buffEffect) diff --git a/lua/app/module/battle/skill/battle_board_skill_handle.lua b/lua/app/module/battle/skill/battle_board_skill_handle.lua index 2757f439..eb9e9446 100644 --- a/lua/app/module/battle/skill/battle_board_skill_handle.lua +++ b/lua/app/module/battle/skill/battle_board_skill_handle.lua @@ -40,7 +40,7 @@ local function _takeChangeAround(posId, skillEntity, gridEntities, sequenceEntit for _, info in ipairs(posIdInfos) do local entity = gridEntities[info.posId] if entity then - entity:setElementType(skillEntity:getSkillTypeParameter()) + entity:setElementType(skillEntity:getSkillTypeParameter()[1]) end end end 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 0e5d72c4..0da147a6 100644 --- a/lua/app/module/battle/skill/battle_rogue_skill_handle.lua +++ b/lua/app/module/battle/skill/battle_rogue_skill_handle.lua @@ -68,7 +68,7 @@ local _addLinkAtkp = function(skillInfo, battleData, battleController) for _, effect in ipairs(skillInfo.effect) do local entity = battleData:getSkillEntityByElement(elementType) if entity then - entity:addLinkEffect(effect, unitEntity) + entity:addLinkEffect(effect, unitEntity, skillInfo.obj) end end end @@ -107,7 +107,16 @@ local _addSkillReleaseCount = function(skillInfo, battleData, battleController) return end - -- battleController:addSkillReleaseCount(elementType, count) + local unitEntity = battleController.battleData.atkTeam:getAllMembers()[elementType] + if not unitEntity then + return + end + + local skillEntity = battleData:getSkillEntityByElement(elementType) + if skillEntity then + local skillId = skillEntity:getSkillId() + unitEntity:addSkillExtraUseTimes(skillId, count) + end end local _addSkillEffectParams = function(skillInfo, battleData, battleController) @@ -142,7 +151,7 @@ local _addSkillEffectParams = function(skillInfo, battleData, battleController) return end if battleData.atkTeam:getAllMembers()[elementType] then - battleData.atkTeam:getAllMembers()[elementType]:addSkillEffectParams(skillId, effect) + battleData.atkTeam:getAllMembers()[elementType]:addActiveSkillParams(skillId, effect) end end end @@ -217,7 +226,7 @@ local _addSkillInInfluenceAtkp = function(skillInfo, battleData, battleControlle local entity = battleData:getSkillEntityByElement(elementType) for _, effect in ipairs(skillInfo.effect) do - entity:addInInfluenceEffect(effect, unitEntity) + entity:addInInfluenceEffect(effect, unitEntity, skillInfo.obj) end end @@ -239,7 +248,7 @@ local _addSkillGeneralAttackEffect = function(skillInfo, battleData, battleContr local entity = battleData:getSkillEntityByElement(elementType) if entity then for _, effect in ipairs(skillInfo.effect) do - entity:addGeneralAttackEffect(effect, unitEntity) + entity:addGeneralAttackEffect(effect, unitEntity, skillInfo.obj) end end end @@ -262,7 +271,7 @@ 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) + entity:addElementCountEffect(effect, unitEntity, skillInfo.obj) end end end @@ -280,7 +289,7 @@ BattleRogueSkillHandle._effectOn = { [10] = _changeElementType, -- 将场上随机几个元素变为某元素 [11] = _addSkillInInfluenceAtkp, -- 技能消除的增加伤害 [12] = _addSkillGeneralAttackEffect, -- 技能链接中的每一个元素,都触发的技能效果 - [11] = _addSkillElementCountEffect, -- 技能链接中每一个元素累加的技能效果 + [13] = _addSkillElementCountEffect, -- 技能链接中每一个元素累加的技能效果 } function BattleRogueSkillHandle.takeEffect(skillId, battleData, battleController) diff --git a/lua/app/module/battle/team/battle_team.lua b/lua/app/module/battle/team/battle_team.lua index c48ebf28..89de0560 100644 --- a/lua/app/module/battle/team/battle_team.lua +++ b/lua/app/module/battle/team/battle_team.lua @@ -124,15 +124,15 @@ function BattleTeam:handleShield(reduceShield, unit) local shieldNum = 0 local currShieldBuff = self.shieldBuffList[1] while currShieldBuff do - reduceShield = reduceShield + currShieldBuff.effectResult + reduceShield = reduceShield + currShieldBuff.result if reduceShield > 0 then - shieldNum = shieldNum + reduceShield - currShieldBuff.effectResult - currShieldBuff.effectResult = reduceShield + shieldNum = shieldNum + reduceShield - currShieldBuff.result + currShieldBuff.result = reduceShield reduceShield = 0 break else - shieldNum = shieldNum - currShieldBuff.effectResult - currShieldBuff.effectResult = 0 + shieldNum = shieldNum - currShieldBuff.result + currShieldBuff.result = 0 for k, v in ipairs(self.buffList) do if v == currShieldBuff then self:updateBuffState(currShieldBuff.buff, -1) diff --git a/lua/app/ui/battle/battle_skill_select_ui.lua b/lua/app/ui/battle/battle_skill_select_ui.lua index 313ca0ed..00da2f4d 100644 --- a/lua/app/ui/battle/battle_skill_select_ui.lua +++ b/lua/app/ui/battle/battle_skill_select_ui.lua @@ -73,9 +73,8 @@ function BattleSkillSelectUI:refreshRogueSkill() end function BattleSkillSelectUI:onClickSkill(skillId) - Logger.logHighlight(skillId) - ModuleManager.BattleManager:onSelectSkill(skillId) self:closeUI() + ModuleManager.BattleManager:onSelectSkill(skillId) end return BattleSkillSelectUI \ No newline at end of file diff --git a/lua/app/ui/battle/battle_ui.lua b/lua/app/ui/battle/battle_ui.lua index fad43cc4..35886858 100644 --- a/lua/app/ui/battle/battle_ui.lua +++ b/lua/app/ui/battle/battle_ui.lua @@ -189,6 +189,10 @@ function BattleUI:showBoardMask(elementType) end self.curElementType = elementType + self:refreshBoard() +end + +function BattleUI:refreshBoard() local entities = DataManager.BattleData:getGridEnties() for posId, entity in pairs(entities) do if entity and entity:getCell() then diff --git a/lua/app/ui/hero/cell/hero_list_cell.lua b/lua/app/ui/hero/cell/hero_list_cell.lua index b86ea7fa..57a47224 100644 --- a/lua/app/ui/hero/cell/hero_list_cell.lua +++ b/lua/app/ui/hero/cell/hero_list_cell.lua @@ -37,7 +37,11 @@ function HeroListCell:refresh(index, heroList, stageFormation, allHeroCount, act end local heroStartIndex = (index-1)*4 + 1 if heroStartIndex > activeCount then - heroStartIndex = heroStartIndex - (4 - activeCount%4) + local count = (4 - activeCount%4) + if count == 4 then + count = 0 + end + heroStartIndex = heroStartIndex - count end local heroIndex = heroStartIndex for i = 1, 4 do 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 549629eb..f1ab2804 100644 --- a/lua/app/userdata/battle/skill/battle_board_skill_entity.lua +++ b/lua/app/userdata/battle/skill/battle_board_skill_entity.lua @@ -5,8 +5,8 @@ function BattleBoardSkillEnity:ctor(skillId) self:refreshSkillId(skillId) self.curEnergy = 0 self.addRange = {} - self.linkEffectEntities = 0 - self.inInfluenceEntities = 0 + self.linkEffectEntities = {} + self.inInfluenceEntities = {} self.generalAttackEffectEntities = {} self.elementCountEffectEntities = {} self.cacheBuffEntities = {} @@ -159,37 +159,67 @@ function BattleBoardSkillEnity:getLinkEffects() return self.linkEffectEntities end -function BattleBoardSkillEnity:addLinkEffect(effect, unitEntity) - local buffEntity = self.linkEffectEntities[effect.type] - if not buffEntity then - buffEntity = BattleBuffEntity:create() - buffEntity:init(effect, unitEntity) - self.linkEffectEntities[effect.type] = buffEntity +function BattleBoardSkillEnity:addLinkEffect(effect, unitEntity, targetSide) + effect = GFunc.getTable(effect) + local buffEntities = self.linkEffectEntities[effect.type] + if not buffEntities then + self.linkEffectEntities[effect.type] = {} + buffEntities = self.linkEffectEntities[effect.type] + local list = GConst.BattleConst.BUFF_MATCH_NAME[effect.type] + if not list then + return + end + + for elementType, buffName in ipairs(list) do + local buffEntity = BattleBuffEntity:create() + effect.type = buffName + buffEntity:init(effect, unitEntity) + buffEntity:setTargetSide(targetSide) + buffEntities[elementType] = buffEntity + end else - local buffNum = buffEntity:getEffectNum() - buffEntity:init(effect, unitEntity) - buffEntity:setEffectNum(buffEntity:getEffectNum() + buffNum) + for elementType, buffEntity in pairs(buffEntities) do + local buffNum = buffEntity:getEffectNum() + buffEntity:setOwner(unitEntity) + buffEntity:setEffectNum(buffEntity:getEffectNum() + buffNum) + buffEntity:setTargetSide(targetSide) + end end end -function BattleBoardSkillEnity:getInInfluenceAtkp() +function BattleBoardSkillEnity:getInInfluenceEffects() return self.inInfluenceEntities end -function BattleBoardSkillEnity:addInInfluenceEffect(effect, unitEntity) - local buffEntity = self.inInfluenceEntities[effect.type] - if not buffEntity then - buffEntity = BattleBuffEntity:create() - buffEntity:init(effect, unitEntity) - self.inInfluenceEntities[effect.type] = buffEntity +function BattleBoardSkillEnity:addInInfluenceEffect(effect, unitEntity, targetSide) + effect = GFunc.getTable(effect) + local buffEntities = self.inInfluenceEntities[effect.type] + if not buffEntities then + self.inInfluenceEntities[effect.type] = {} + buffEntities = self.inInfluenceEntities[effect.type] + local list = GConst.BattleConst.BUFF_MATCH_NAME[effect.type] + if not list then + return + end + + for elementType, buffName in ipairs(list) do + local buffEntity = BattleBuffEntity:create() + effect.type = buffName + buffEntity:init(effect, unitEntity) + buffEntity:setTargetSide(targetSide) + buffEntities[elementType] = buffEntity + end else - local buffNum = buffEntity:getEffectNum() - buffEntity:init(effect, unitEntity) - buffEntity:setEffectNum(buffEntity:getEffectNum() + buffNum) + for elementType, buffEntity in pairs(buffEntities) do + local buffNum = buffEntity:getEffectNum() + buffEntity:setOwner(unitEntity) + buffEntity:setEffectNum(buffEntity:getEffectNum() + buffNum) + buffEntity:setTargetSide(targetSide) + end end end -function BattleBoardSkillEnity:addGeneralAttackEffect(effect, unitEntity) +function BattleBoardSkillEnity:addGeneralAttackEffect(effect, unitEntity, targetSide) local buffEntity = self.generalAttackEffectEntities[effect.type] if not buffEntity then buffEntity = BattleBuffEntity:create() @@ -200,22 +230,39 @@ function BattleBoardSkillEnity:addGeneralAttackEffect(effect, unitEntity) buffEntity:init(effect, unitEntity) buffEntity:setEffectNum(buffEntity:getEffectNum() + buffNum) end + buffEntity:setTargetSide(targetSide) end function BattleBoardSkillEnity:getGeneralAttackEffect() return self.generalAttackEffectEntities end -function BattleBoardSkillEnity:addElementCountEffect(effect, unitEntity) - local buffEntity = self.elementCountEffectEntities[effect.type] - if not buffEntity then - buffEntity = BattleBuffEntity:create() - buffEntity:init(effect, unitEntity) - self.elementCountEffectEntities[effect.type] = buffEntity +function BattleBoardSkillEnity:addElementCountEffect(effect, unitEntity, targetSide) + local buffEntities = self.elementCountEffectEntities[effect.type] + if not buffEntities then + self.elementCountEffectEntities[effect.type] = {} + buffEntities = self.elementCountEffectEntities[effect.type] + local originBuffEntity = BattleBuffEntity:create() + originBuffEntity:init(effect, unitEntity) + originBuffEntity:setTargetSide(targetSide) + + local useBuffEntity = BattleBuffEntity:create() + useBuffEntity:init(effect, unitEntity) + useBuffEntity:setTargetSide(targetSide) + + buffEntities.origin = originBuffEntity + buffEntities.use = useBuffEntity else - local buffNum = buffEntity:getEffectNum() - buffEntity:init(effect, unitEntity) - buffEntity:setEffectNum(buffEntity:getEffectNum() + buffNum) + local originBuffEntity = buffEntities.origin + local useBuffEntity = buffEntities.use + local buffNum = originBuffEntity:getEffectNum() + originBuffEntity:init(effect, unitEntity) + originBuffEntity:setEffectNum(originBuffEntity:getEffectNum() + buffNum) + originBuffEntity:setTargetSide(targetSide) + + useBuffEntity:init(effect, unitEntity) + useBuffEntity:setEffectNum(originBuffEntity:getEffectNum()) + useBuffEntity:setTargetSide(targetSide) end end diff --git a/lua/app/userdata/battle/skill/battle_buff_entity.lua b/lua/app/userdata/battle/skill/battle_buff_entity.lua index af467e3a..a124cbfd 100644 --- a/lua/app/userdata/battle/skill/battle_buff_entity.lua +++ b/lua/app/userdata/battle/skill/battle_buff_entity.lua @@ -9,6 +9,7 @@ function BattleBuffEntity:init(effectParams, owner) self.round = effectParams.round self.ratio = effectParams.ratio self.owner = owner + self.targetSide = nil self.buffInfo = ConfigManager:getConfigWithOtherKey("buff", "name")[self.name] self.buffType = self.buffInfo.buff_type end @@ -57,4 +58,12 @@ function BattleBuffEntity:getBuffHitFxId() return nil end +function BattleBuffEntity:getTartgetSide() + return self.targetSide +end + +function BattleBuffEntity:setTargetSide(side) + self.targetSide = side +end + return BattleBuffEntity \ No newline at end of file diff --git a/lua/app/userdata/battle/team/battle_unit_entity.lua b/lua/app/userdata/battle/team/battle_unit_entity.lua index df08bc57..2c9ef5b7 100644 --- a/lua/app/userdata/battle/team/battle_unit_entity.lua +++ b/lua/app/userdata/battle/team/battle_unit_entity.lua @@ -95,6 +95,10 @@ function BattleUnitEntity:changeActiveSkillId(originSkillId, tartgetSkillId) for _, skillEntity in ipairs(self.activeSkills) do if skillEntity:getSkillid() == originSkillId then skillEntity:changeSkillId(tartgetSkillId) + local extraCount = self.skillExtraUseTimes[originSkillId] + if extraCount then + self.skillExtraUseTimes[tartgetSkillId] = extraCount + end break end end