diff --git a/lua/app/bf/unity/character_spine_object.lua b/lua/app/bf/unity/character_spine_object.lua index 42d0d618..e7059913 100644 --- a/lua/app/bf/unity/character_spine_object.lua +++ b/lua/app/bf/unity/character_spine_object.lua @@ -163,6 +163,12 @@ function CharacterSpineObject:playAnimation(animName, loop, forceRefresh) end end +function CharacterSpineObject:setDefaultMix(mixDuration) + if self.characterSpineHelper then + self.characterSpineHelper:SetDefaultMix(mixDuration) + end +end + -- 战斗里面粒子特效和spine特效混用,统一调用的stop接口,这里先放一个空方法 function CharacterSpineObject:stop() end diff --git a/lua/app/config/hero.lua b/lua/app/config/hero.lua index 1f244062..d730cef4 100644 --- a/lua/app/config/hero.lua +++ b/lua/app/config/hero.lua @@ -5,6 +5,7 @@ local hero = { ["hurt_skill"]=1, ["hurt_num"]=3, ["base_skill"]=120011, + ["support_skill"]=120010, ["rouge_skill_1"]=200501, ["rouge_skill_2"]=200502, ["rouge_skill_3"]=200503, @@ -53,6 +54,7 @@ local hero = { ["hurt_skill"]=2, ["hurt_num"]=3, ["base_skill"]=220011, + ["support_skill"]=220010, ["rouge_skill_1"]=200201, ["rouge_skill_2"]=200202, ["rouge_skill_3"]=200203, @@ -101,6 +103,7 @@ local hero = { ["hurt_skill"]=2, ["hurt_num"]=3, ["base_skill"]=230011, + ["support_skill"]=230010, ["rouge_skill_1"]=200701, ["rouge_skill_2"]=200702, ["rouge_skill_3"]=200703, @@ -149,6 +152,7 @@ local hero = { ["hurt_skill"]=3, ["hurt_num"]=3, ["base_skill"]=320011, + ["support_skill"]=320010, ["rouge_skill_1"]=200101, ["rouge_skill_2"]=200102, ["rouge_skill_3"]=200103, @@ -197,6 +201,7 @@ local hero = { ["hurt_skill"]=3, ["hurt_num"]=3, ["base_skill"]=330011, + ["support_skill"]=330010, ["rouge_skill_1"]=200601, ["rouge_skill_2"]=200602, ["rouge_skill_3"]=200603, @@ -245,6 +250,7 @@ local hero = { ["hurt_skill"]=9, ["hurt_num"]=3, ["base_skill"]=420011, + ["support_skill"]=420010, ["rouge_skill_1"]=200301, ["rouge_skill_2"]=200302, ["rouge_skill_3"]=200303, @@ -293,6 +299,7 @@ local hero = { ["hurt_skill"]=4, ["hurt_num"]=3, ["base_skill"]=430011, + ["support_skill"]=430010, ["rouge_skill_1"]=200801, ["rouge_skill_2"]=200802, ["rouge_skill_3"]=200803, @@ -341,6 +348,7 @@ local hero = { ["hurt_skill"]=5, ["hurt_num"]=3, ["base_skill"]=520011, + ["support_skill"]=520010, ["rouge_skill_1"]=200401, ["rouge_skill_2"]=200402, ["rouge_skill_3"]=200403, diff --git a/lua/app/config/skill.lua b/lua/app/config/skill.lua index 96a9a779..d89faeac 100644 --- a/lua/app/config/skill.lua +++ b/lua/app/config/skill.lua @@ -164,8 +164,23 @@ local skill = { } } }, + [320010]={ + ["position"]=3, + ["effect_type"]=1, + ["trigger"]=1, + ["effect"]={ + { + ["type"]="hurt_green", + ["num"]=10000, + ["ratio"]=10000, + ["round"]=0 + } + }, + ["skill_position"]=2, + ["name_act"]="support01" + }, [320011]={ - ["energy"]=10, + ["energy"]=2, ["position"]=3, ["method"]=2, ["skill_type"]=1, @@ -184,8 +199,23 @@ local skill = { ["skill_position"]=1, ["name_act"]="skill01" }, + [220010]={ + ["position"]=2, + ["effect_type"]=1, + ["trigger"]=1, + ["effect"]={ + { + ["type"]="hurt_yellow", + ["num"]=10000, + ["ratio"]=10000, + ["round"]=0 + } + }, + ["skill_position"]=2, + ["name_act"]="support01" + }, [220011]={ - ["energy"]=10, + ["energy"]=2, ["position"]=2, ["method"]=2, ["skill_type"]=0, @@ -206,7 +236,7 @@ local skill = { ["name_act"]="skill01" }, [220012]={ - ["energy"]=10, + ["energy"]=2, ["position"]=2, ["method"]=1, ["skill_type"]=2, @@ -246,8 +276,23 @@ local skill = { ["skill_position"]=1, ["name_act"]="skill01" }, + [420010]={ + ["position"]=4, + ["effect_type"]=1, + ["trigger"]=1, + ["effect"]={ + { + ["type"]="hurt_blue", + ["num"]=10000, + ["ratio"]=10000, + ["round"]=0 + } + }, + ["skill_position"]=2, + ["name_act"]="support01" + }, [420011]={ - ["energy"]=10, + ["energy"]=2, ["position"]=4, ["method"]=2, ["skill_type"]=1, @@ -262,8 +307,23 @@ local skill = { ["skill_position"]=2, ["name_act"]="skill01" }, + [520010]={ + ["position"]=5, + ["effect_type"]=1, + ["trigger"]=1, + ["effect"]={ + { + ["type"]="hurt_purple", + ["num"]=10000, + ["ratio"]=10000, + ["round"]=0 + } + }, + ["skill_position"]=2, + ["name_act"]="support01" + }, [520011]={ - ["energy"]=10, + ["energy"]=2, ["position"]=5, ["method"]=2, ["skill_type"]=0, @@ -283,8 +343,23 @@ local skill = { ["skill_position"]=2, ["name_act"]="skill01" }, + [120010]={ + ["position"]=1, + ["effect_type"]=1, + ["trigger"]=1, + ["effect"]={ + { + ["type"]="hurt_red", + ["num"]=10000, + ["ratio"]=10000, + ["round"]=0 + } + }, + ["skill_position"]=2, + ["name_act"]="support01" + }, [120011]={ - ["energy"]=10, + ["energy"]=2, ["position"]=1, ["method"]=2, ["skill_type"]=1, @@ -303,8 +378,23 @@ local skill = { ["skill_position"]=2, ["name_act"]="skill01" }, + [330010]={ + ["position"]=3, + ["effect_type"]=1, + ["trigger"]=1, + ["effect"]={ + { + ["type"]="hurt_green", + ["num"]=10000, + ["ratio"]=10000, + ["round"]=0 + } + }, + ["skill_position"]=2, + ["name_act"]="support01" + }, [330011]={ - ["energy"]=10, + ["energy"]=2, ["position"]=3, ["method"]=2, ["skill_type"]=0, @@ -324,8 +414,23 @@ local skill = { ["skill_position"]=2, ["name_act"]="skill01" }, + [230010]={ + ["position"]=2, + ["effect_type"]=1, + ["trigger"]=1, + ["effect"]={ + { + ["type"]="hurt_yellow", + ["num"]=10000, + ["ratio"]=10000, + ["round"]=0 + } + }, + ["skill_position"]=2, + ["name_act"]="support01" + }, [230011]={ - ["energy"]=10, + ["energy"]=2, ["position"]=2, ["method"]=2, ["skill_type"]=0, @@ -345,7 +450,7 @@ local skill = { ["skill_position"]=2 }, [230012]={ - ["energy"]=10, + ["energy"]=2, ["position"]=2, ["method"]=1, ["skill_type"]=2, @@ -386,7 +491,7 @@ local skill = { ["skill_position"]=2 }, [230013]={ - ["energy"]=10, + ["energy"]=2, ["position"]=2, ["method"]=1, ["skill_type"]=2, @@ -442,8 +547,23 @@ local skill = { ["obj"]=1, ["skill_position"]=2 }, + [430010]={ + ["position"]=4, + ["effect_type"]=1, + ["trigger"]=1, + ["effect"]={ + { + ["type"]="hurt_blue", + ["num"]=10000, + ["ratio"]=10000, + ["round"]=0 + } + }, + ["skill_position"]=2, + ["name_act"]="support01" + }, [430011]={ - ["energy"]=10, + ["energy"]=2, ["position"]=4, ["method"]=2, ["skill_type"]=0, @@ -469,7 +589,7 @@ local skill = { ["name_act"]="skill01" }, [430012]={ - ["energy"]=10, + ["energy"]=2, ["position"]=4, ["method"]=2, ["skill_type"]=1, @@ -967,6 +1087,6 @@ local skill = { } } local config = { -data=skill,count=54 +data=skill,count=62 } 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 031d670d..1f666bd8 100644 --- a/lua/app/module/battle/battle_const.lua +++ b/lua/app/module/battle/battle_const.lua @@ -14,6 +14,8 @@ BattleConst.MAX_ELEMENT_WIGHT = 500 BattleConst.SIDE_ATK = 1 BattleConst.SIDE_DEF = 2 BattleConst.SKILL_TYPE_ACTIVE = 1 +BattleConst.SKILL_TYPE_NORMAL = 2 +BattleConst.SKILL_TYPE_ASSISTING = 3 BattleConst.SKILL_SELECT_COUNT = 3 BattleConst.DEFAULT_FACTOR = 10000 BattleConst.INIT_POS_X = 200 -- 战斗单位初始化的坐标 @@ -62,6 +64,7 @@ BattleConst.UNIT_STATE = { ENTER_BATTLEFIELD = 6, -- 进入战场 SWITCH_IN = 7, -- 入场 SWITCH_OUT = 8, -- 离场 + ASSISTING_ATTACK = 9, -- 协助攻击 } BattleConst.MATCH_DMG_ADDITION_NAME = { diff --git a/lua/app/module/battle/component/battle_unit_comp.lua b/lua/app/module/battle/component/battle_unit_comp.lua index 200fb639..6d97599b 100644 --- a/lua/app/module/battle/component/battle_unit_comp.lua +++ b/lua/app/module/battle/component/battle_unit_comp.lua @@ -61,6 +61,7 @@ function BattleUnitComp:_initBase() self.activeSkillIndex = nil self.currActiveSkill = nil self.targetX = nil + self.assistingDmgAddition = 0 self.currState = UNIT_STATE.INIT end @@ -103,6 +104,23 @@ function BattleUnitComp:getAnimationDuration(aniName) return duration or 0 end +function BattleUnitComp:useAssistingSkill(count, callback) + local skill = self.unitEntity:getAssistingSkill() + if skill == nil then + callback() + return + end + self.assistingDmgAddition = count + local attrName = GConst.MATCH_ATTACK_NAME[self:getMatchType()] + self.assistingDmgAddCount = self.unitEntity:addAttr(attrName, count*DEFAULT_FACTOR, true) + self.actionOverCallback = callback + if not self:changeState(UNIT_STATE.ASSISTING_ATTACK) then + self.actionOverCallback = nil + self.unitEntity:addAttr(attrName, -self.assistingDmgAddCount, false) + callback() + end +end + function BattleUnitComp:useSkill(index, count, callback) self.actionOverCallback = callback self.activeSkillIndex = index @@ -181,6 +199,8 @@ function BattleUnitComp:changeState(state) self:exitNormalAttackState() elseif self.currState == UNIT_STATE.SKILL_ATTACK then self:exitSkillAttackState() + elseif self.currState == UNIT_STATE.ASSISTING_ATTACK then + self:exitAssistingAttackState() elseif self.currState == UNIT_STATE.DEAD then self:exitDeadState() elseif self.currState == UNIT_STATE.ENTER_BATTLEFIELD then @@ -198,6 +218,8 @@ function BattleUnitComp:changeState(state) self:enterNormalAttackState() elseif state == UNIT_STATE.SKILL_ATTACK then self:enterSkillAttackState() + elseif self.currState == UNIT_STATE.ASSISTING_ATTACK then + self:enterAssistingAttackState() elseif state == UNIT_STATE.DEAD then self:enterDeadState() elseif self.currState == UNIT_STATE.BORN then @@ -344,6 +366,42 @@ function BattleUnitComp:updateHurt(dt) end end +function BattleUnitComp:enterAssistingAttackState() + self.attackOver = false + self.attackTime = 0 + self.isMove = false + self.currAttackKeyTime = 0.3 + local skill = self.unitEntity:getAssistingSkill() + local attackName = skill:getSkillAttackName() + self.currAttackDuration = self:getAnimationDuration(attackName) + self:playAnimation(attackName, false, false) + self:initPosition() +end + +function BattleUnitComp:exitAssistingAttackState() + self:hideOutsideScreen() + if self.assistingDmgAddition > 0 then + local attrName = GConst.MATCH_ATTACK_NAME[self:getMatchType()] + self.unitEntity:addAttr(attrName, -self.assistingDmgAddCount, false) + self.assistingDmgAddition = 0 + self.assistingDmgAddCount = 0 + end +end + +function BattleUnitComp:updateAssistingAttackState(dt) + self.attackTime = self.attackTime + dt + if self.attackTime >= self.currAttackDuration then + self.attackOver = true + self:onAttackOver() + else + if self.currAttackKeyTime > 0 and self.attackTime >= self.currAttackKeyTime then -- 到达关键后使用 + self.currAttackKeyTime = 0 + local skill = self.unitEntity:getAssistingSkill() + self:onSkillTakeEffect(skill) + end + end +end + function BattleUnitComp:enterSkillAttackState() self.attackOver = false self.attackTime = 0 @@ -701,6 +759,8 @@ function BattleUnitComp:tick(dt) self:updateNormalAttack(dt) elseif self.currState == UNIT_STATE.SKILL_ATTACK then self:updateSkillAttack(dt) + elseif self.currState == UNIT_STATE.ASSISTING_ATTACK then + self:updateAssistingAttackState(dt) elseif self.currState == UNIT_STATE.ENTER_BATTLEFIELD then self:updateEnterBattlefieldState(dt) elseif self.currState == 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 3f3487d3..b421ffa9 100644 --- a/lua/app/module/battle/controller/battle_controller.lua +++ b/lua/app/module/battle/controller/battle_controller.lua @@ -681,16 +681,20 @@ function BattleController:generateInstructions(skillEntity, elementType, influen end local elementTypeCount = 0 + local assistingList = nil ---- 援助 for element, count in pairs(elementTypeMap) do if element == elementType then elementTypeCount = count else - table.insert(self.instructions, { - name = BattleConst.INSTRUCTION_NAME.ASSISTING, + if assistingList == nil then + assistingList = {} + end + local obj = { count = count, skillMatch = element, - }) + } + table.insert(assistingList, obj) end end @@ -711,6 +715,13 @@ function BattleController:generateInstructions(skillEntity, elementType, influen }) end end + + if assistingList then + table.insert(self.instructions, { + name = BattleConst.INSTRUCTION_NAME.ASSISTING, + assistingList = assistingList, + }) + end end function BattleController:exeInstructions(callback) @@ -1223,12 +1234,11 @@ local function _addCurRoundAttr(self, instruction, callback) end local function _assisting(self, instruction, callback) - self:addBattleExp(instruction.count) - callback() + Logger.logHighlight("援助攻击") + self.atkTeam:useAssistingSkill(instruction.assistingList, callback) end local function _generalAttack(self, instruction, callback) - self:addBattleExp(instruction.count) -- 先直接加 self.atkTeam:useNormalSkill(instruction.skillMatch, instruction.count, callback) end diff --git a/lua/app/module/battle/helper/battle_formula.lua b/lua/app/module/battle/helper/battle_formula.lua index 98042802..aa03b2c6 100644 --- a/lua/app/module/battle/helper/battle_formula.lua +++ b/lua/app/module/battle/helper/battle_formula.lua @@ -36,7 +36,7 @@ BattleFormula.calculateFormula = { end, -- 角色攻击力*技能倍率*(1+治疗效果增加) [3] = function(unitComp, buff, targetUnit) - local result = targetUnit.unitEntity:getAtk() * buff:getEffectNum() // DEFAULT_FACTOR * (unitComp.unitEntity:getCureAddition() + DEFAULT_FACTOR) // DEFAULT_FACTOR + local result = unitComp.unitEntity:getAtk() * buff:getEffectNum() // DEFAULT_FACTOR * (unitComp.unitEntity:getCureAddition() + DEFAULT_FACTOR) // DEFAULT_FACTOR return result, 0 end } diff --git a/lua/app/module/battle/helper/battle_helper.lua b/lua/app/module/battle/helper/battle_helper.lua index 42e9a9f7..f5a5155f 100644 --- a/lua/app/module/battle/helper/battle_helper.lua +++ b/lua/app/module/battle/helper/battle_helper.lua @@ -28,6 +28,7 @@ function BattleHelper:loadBattleHeroModel(id, parent, callback) callback(spineObject) else SpineManager:loadHeroAsync(id, parent, function(spineObject) + spineObject:setDefaultMix(0) if self.characterMap then self.characterMap[spineObject:getInstanceID()] = spineObject callback(spineObject) diff --git a/lua/app/module/battle/team/battle_team.lua b/lua/app/module/battle/team/battle_team.lua index 1a4fca04..828316e1 100644 --- a/lua/app/module/battle/team/battle_team.lua +++ b/lua/app/module/battle/team/battle_team.lua @@ -58,6 +58,27 @@ function BattleTeam:useSkill(matchType, count, callback) unit:useSkill(1, count, callback) end +function BattleTeam:useAssistingSkill(assistingList, callback) + local count = #assistingList + if count <= 0 then + return callback() + end + local function finish() + count = count - 1 + if count == 0 then + callback() + end + end + for _, v in ipairs(assistingList) do + local unit = self.unitMap[v.skillMatch] + if unit then + unit:useAssistingSkill(v.count, finish) + else + finish() + end + end +end + function BattleTeam:mainUnitUseAllSkills(callback) self.mainUnit:useAllSkills(callback) end diff --git a/lua/app/userdata/battle/battle_data.lua b/lua/app/userdata/battle/battle_data.lua index 0bdcdcd9..221b8f34 100644 --- a/lua/app/userdata/battle/battle_data.lua +++ b/lua/app/userdata/battle/battle_data.lua @@ -378,6 +378,7 @@ function BattleData:initHeroData() normalSkill = heroEntity:getHurtSkill(), activeSkills = {activeSkill}, normalSkillCount = heroEntity:getHurtNum(), + assistingSkill = heroEntity:getAssistingSkill(), attr = { hp = hp, max_hp = hp, @@ -389,7 +390,6 @@ function BattleData:initHeroData() atk_purple = heroAttr[ATTR_TYPE.atk_purple] // DEFAULT_FACTOR, } } - Logger.printTable(unitData) table.insert(units, unitData) end end @@ -411,6 +411,7 @@ function BattleData:addMonster(monsterId, newTeam) normalSkill = monsterInfo.hurt_skill, activeSkills = monsterInfo.skill, normalSkillCount = monsterInfo.hurt_num, + assistingSkill = nil, attr = { hp = hp, max_hp = hp, diff --git a/lua/app/userdata/battle/team/battle_unit_entity.lua b/lua/app/userdata/battle/team/battle_unit_entity.lua index fd35daf6..a42c2cad 100644 --- a/lua/app/userdata/battle/team/battle_unit_entity.lua +++ b/lua/app/userdata/battle/team/battle_unit_entity.lua @@ -15,7 +15,10 @@ end function BattleUnitEntity:initSkill() self.activeSkills = {} if self.unitData.normalSkill then - self.normalSkill = BattleSkillEntity:create(self.unitData.normalSkill, GConst.BattleConst.SKILL_TYPE_ACTIVE, self) + self.normalSkill = BattleSkillEntity:create(self.unitData.normalSkill, GConst.BattleConst.SKILL_TYPE_NORMAL, self) + end + if self.unitData.assistingSkill then + self.assistingSkill = BattleSkillEntity:create(self.unitData.assistingSkill, GConst.BattleConst.SKILL_TYPE_ASSISTING, self) end if self.unitData.activeSkills then for k, v in ipairs(self.unitData.activeSkills) do @@ -53,6 +56,10 @@ function BattleUnitEntity:getNormalSkill() return self.normalSkill end +function BattleUnitEntity:getAssistingSkill() + return self.assistingSkill +end + function BattleUnitEntity:getActiveSkill(index) return self.activeSkills[index] end diff --git a/lua/app/userdata/hero/hero_entity.lua b/lua/app/userdata/hero/hero_entity.lua index 75620cd7..c14696e6 100644 --- a/lua/app/userdata/hero/hero_entity.lua +++ b/lua/app/userdata/hero/hero_entity.lua @@ -185,6 +185,10 @@ function HeroEntity:getActiveSkill() return self.config.base_skill end +function HeroEntity:getAssistingSkill() + return self.config.support_skill +end + function HeroEntity:getHurtSkill() return self.config.hurt_skill end