From 66542a24f9a2a1373c5348a4bba3b0b6b3688b2f Mon Sep 17 00:00:00 2001 From: chenxi Date: Sun, 23 Apr 2023 16:09:53 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A2=AB=E5=8A=A8=E6=8A=80=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/module/battle/battle_const.lua | 1 + lua/app/module/battle/component/battle_unit_comp.lua | 8 ++++++-- lua/app/module/battle/helper/battle_passive.lua | 5 +++++ lua/app/userdata/battle/skill/battle_skill_entity.lua | 4 ++++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lua/app/module/battle/battle_const.lua b/lua/app/module/battle/battle_const.lua index 2a8b1613..15ae8e24 100644 --- a/lua/app/module/battle/battle_const.lua +++ b/lua/app/module/battle/battle_const.lua @@ -154,6 +154,7 @@ BattleConst.PASSIVE_EVENT = { ON_UNI_ATTACK_START = 3, -- 攻击开始前 HP_LOWER_THAN = 4, -- 血量低于X% USE_NORMAL_SKILL = 5, -- 使用普攻 + ACTIVE_SKILL_HIT = 6, -- 主动技能命中 } local BUFF_NAME = { diff --git a/lua/app/module/battle/component/battle_unit_comp.lua b/lua/app/module/battle/component/battle_unit_comp.lua index 4e9aa8dd..70d434b4 100644 --- a/lua/app/module/battle/component/battle_unit_comp.lua +++ b/lua/app/module/battle/component/battle_unit_comp.lua @@ -1010,8 +1010,12 @@ function BattleUnitComp:onSkillTakeEffect(skill) succ = true end end - if succ and skill:getIsNormalType() then -- 普攻攻击成功的话 - self:checkPassiveEvent(PASSIVE_EVENT.USE_NORMAL_SKILL, target) + if succ then + if skill:getIsNormalType() then -- 普攻攻击成功的话 + self:checkPassiveEvent(PASSIVE_EVENT.USE_NORMAL_SKILL, target) + elseif skill:getIsActiveType() then + self:checkPassiveEvent(PASSIVE_EVENT.ACTIVE_SKILL_HIT, target) + end local shakeType = skill:getShakeType() if shakeType then local shakeTime = skill:getShakeTime() or 0 diff --git a/lua/app/module/battle/helper/battle_passive.lua b/lua/app/module/battle/helper/battle_passive.lua index 12beb35e..8a2ae9e5 100644 --- a/lua/app/module/battle/helper/battle_passive.lua +++ b/lua/app/module/battle/helper/battle_passive.lua @@ -45,11 +45,16 @@ local function _checkUseNormalSkill(unitComp, skill, targetComp) return 1 end +local function _checkActiveSkillHit(unitComp, skill, targetComp) + return 1 +end + BattlePassive.checkTrigger = { [PASSIVE_EVENT.ON_UNIT_PREPARE_OVER] = _checkOnUnitPrepareOver, [PASSIVE_EVENT.ON_UNI_ATTACK_START] = _checkOnUniAttackStart, [PASSIVE_EVENT.HP_LOWER_THAN] = _checkhpLowerThan, [PASSIVE_EVENT.USE_NORMAL_SKILL] = _checkUseNormalSkill, + [PASSIVE_EVENT.ACTIVE_SKILL_HIT] = _checkActiveSkillHit, } return BattlePassive \ No newline at end of file diff --git a/lua/app/userdata/battle/skill/battle_skill_entity.lua b/lua/app/userdata/battle/skill/battle_skill_entity.lua index 4b436c24..84eb8e1e 100644 --- a/lua/app/userdata/battle/skill/battle_skill_entity.lua +++ b/lua/app/userdata/battle/skill/battle_skill_entity.lua @@ -117,6 +117,10 @@ function BattleSkillEntity:getIsNormalType() return self.skillType == BattleConst.SKILL_TYPE_NORMAL end +function BattleSkillEntity:getIsActiveType() + return self.skillType == BattleConst.SKILL_TYPE_ACTIVE +end + function BattleSkillEntity:changeSkillId(skillId) self.skillId = skillId self:init()