From b1353d74e017ec3e286a056d9fb5625207d9d550 Mon Sep 17 00:00:00 2001 From: chenxi Date: Tue, 18 Apr 2023 20:09:51 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A2=AB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/config/monster_base.lua | 24 +-- lua/app/config/skill.lua | 71 +++++--- lua/app/config/skill_rogue.lua | 164 ++++++++++-------- lua/app/module/battle/battle_const.lua | 10 ++ .../battle/component/battle_unit_comp.lua | 50 +++++- .../battle/controller/battle_controller.lua | 3 + .../battle/helper/battle_buff_handle.lua | 9 +- .../module/battle/helper/battle_passive.lua | 30 ++++ lua/app/module/battle/team/battle_team.lua | 9 + .../battle/skill/battle_skill_entity.lua | 4 + 10 files changed, 254 insertions(+), 120 deletions(-) diff --git a/lua/app/config/monster_base.lua b/lua/app/config/monster_base.lua index d0af53fb..84e4b840 100644 --- a/lua/app/config/monster_base.lua +++ b/lua/app/config/monster_base.lua @@ -73,51 +73,51 @@ local monster_base = { }, [20001]={ ["hurt_num"]=1, - ["model_id"]="m0001" + ["model_id"]="m10010" }, [20002]={ ["hurt_num"]=1, - ["model_id"]="m0001" + ["model_id"]="m10010" }, [20003]={ ["hurt_num"]=3, - ["model_id"]="m0001" + ["model_id"]="m10010" }, [20004]={ ["hurt_num"]=3, - ["model_id"]="m0001" + ["model_id"]="m10010" }, [20005]={ ["hurt_num"]=3, - ["model_id"]="m0001" + ["model_id"]="m10010" }, [20006]={ ["hurt_num"]=3, - ["model_id"]="m0001" + ["model_id"]="m10010" }, [20007]={ ["hurt_num"]=3, - ["model_id"]="m0001" + ["model_id"]="m10010" }, [20008]={ ["hurt_num"]=3, - ["model_id"]="m0001" + ["model_id"]="m10010" }, [20009]={ ["hurt_num"]=3, - ["model_id"]="m0001" + ["model_id"]="m10010" }, [20010]={ ["hurt_num"]=3, - ["model_id"]="m0001" + ["model_id"]="m10010" }, [20011]={ ["hurt_num"]=3, - ["model_id"]="m0001" + ["model_id"]="m10010" }, [20012]={ ["hurt_num"]=3, - ["model_id"]="m0001" + ["model_id"]="m10010" } } local config = { diff --git a/lua/app/config/skill.lua b/lua/app/config/skill.lua index d89faeac..62f00ba9 100644 --- a/lua/app/config/skill.lua +++ b/lua/app/config/skill.lua @@ -142,6 +142,9 @@ local skill = { [11]={ ["effect_type"]=2, ["trigger"]=4, + ["trigger_value"]={ + 5000 + }, ["effect"]={ { ["type"]="dmg_addition_all_add", @@ -154,7 +157,7 @@ local skill = { }, [12]={ ["effect_type"]=2, - ["trigger"]=4, + ["trigger"]=3, ["effect"]={ { ["type"]="wavehealp", @@ -162,7 +165,21 @@ local skill = { ["ratio"]=10000, ["round"]=0 } - } + }, + ["skill_position"]=2 + }, + [13]={ + ["effect_type"]=2, + ["trigger"]=5, + ["effect"]={ + { + ["type"]="stun", + ["num"]=0, + ["ratio"]=1000, + ["round"]=1 + } + }, + ["skill_position"]=2 }, [320010]={ ["position"]=3, @@ -180,7 +197,7 @@ local skill = { ["name_act"]="support01" }, [320011]={ - ["energy"]=2, + ["energy"]=10, ["position"]=3, ["method"]=2, ["skill_type"]=1, @@ -195,7 +212,7 @@ local skill = { } }, ["icon"]=10, - ["battle_icon"]=1, + ["battle_icon"]="1", ["skill_position"]=1, ["name_act"]="skill01" }, @@ -215,12 +232,12 @@ local skill = { ["name_act"]="support01" }, [220011]={ - ["energy"]=2, + ["energy"]=10, ["position"]=2, ["method"]=2, ["skill_type"]=0, ["icon"]=20, - ["battle_icon"]=2, + ["battle_icon"]="2", ["effect_type"]=1, ["trigger"]=1, ["effect"]={ @@ -236,7 +253,7 @@ local skill = { ["name_act"]="skill01" }, [220012]={ - ["energy"]=2, + ["energy"]=10, ["position"]=2, ["method"]=1, ["skill_type"]=2, @@ -262,7 +279,7 @@ local skill = { } }, ["icon"]=20, - ["battle_icon"]=2, + ["battle_icon"]="2", ["effect_type"]=1, ["trigger"]=1, ["effect"]={ @@ -292,7 +309,7 @@ local skill = { ["name_act"]="support01" }, [420011]={ - ["energy"]=2, + ["energy"]=10, ["position"]=4, ["method"]=2, ["skill_type"]=1, @@ -303,7 +320,7 @@ local skill = { } }, ["icon"]=30, - ["battle_icon"]=3, + ["battle_icon"]="3", ["skill_position"]=2, ["name_act"]="skill01" }, @@ -323,12 +340,12 @@ local skill = { ["name_act"]="support01" }, [520011]={ - ["energy"]=2, + ["energy"]=10, ["position"]=5, ["method"]=2, ["skill_type"]=0, ["icon"]=40, - ["battle_icon"]=4, + ["battle_icon"]="4", ["effect_type"]=1, ["trigger"]=1, ["effect"]={ @@ -359,7 +376,7 @@ local skill = { ["name_act"]="support01" }, [120011]={ - ["energy"]=2, + ["energy"]=10, ["position"]=1, ["method"]=2, ["skill_type"]=1, @@ -374,7 +391,7 @@ local skill = { } }, ["icon"]=50, - ["battle_icon"]=5, + ["battle_icon"]="5", ["skill_position"]=2, ["name_act"]="skill01" }, @@ -394,12 +411,12 @@ local skill = { ["name_act"]="support01" }, [330011]={ - ["energy"]=2, + ["energy"]=10, ["position"]=3, ["method"]=2, ["skill_type"]=0, ["icon"]=60, - ["battle_icon"]=6, + ["battle_icon"]="6", ["effect_type"]=1, ["trigger"]=1, ["effect"]={ @@ -430,12 +447,12 @@ local skill = { ["name_act"]="support01" }, [230011]={ - ["energy"]=2, + ["energy"]=10, ["position"]=2, ["method"]=2, ["skill_type"]=0, ["icon"]=70, - ["battle_icon"]=7, + ["battle_icon"]="7", ["effect_type"]=2, ["trigger"]=3, ["effect"]={ @@ -450,7 +467,7 @@ local skill = { ["skill_position"]=2 }, [230012]={ - ["energy"]=2, + ["energy"]=10, ["position"]=2, ["method"]=1, ["skill_type"]=2, @@ -476,7 +493,7 @@ local skill = { } }, ["icon"]=70, - ["battle_icon"]=7, + ["battle_icon"]="7", ["effect_type"]=2, ["trigger"]=3, ["effect"]={ @@ -491,7 +508,7 @@ local skill = { ["skill_position"]=2 }, [230013]={ - ["energy"]=2, + ["energy"]=10, ["position"]=2, ["method"]=1, ["skill_type"]=2, @@ -533,7 +550,7 @@ local skill = { } }, ["icon"]=70, - ["battle_icon"]=7, + ["battle_icon"]="7", ["effect_type"]=2, ["trigger"]=3, ["effect"]={ @@ -563,12 +580,12 @@ local skill = { ["name_act"]="support01" }, [430011]={ - ["energy"]=2, + ["energy"]=10, ["position"]=4, ["method"]=2, ["skill_type"]=0, ["icon"]=80, - ["battle_icon"]=8, + ["battle_icon"]="8", ["effect_type"]=1, ["trigger"]=1, ["effect"]={ @@ -589,7 +606,7 @@ local skill = { ["name_act"]="skill01" }, [430012]={ - ["energy"]=2, + ["energy"]=10, ["position"]=4, ["method"]=2, ["skill_type"]=1, @@ -612,7 +629,7 @@ local skill = { } }, ["icon"]=80, - ["battle_icon"]=8, + ["battle_icon"]="8", ["effect_type"]=1, ["trigger"]=1, ["effect"]={ @@ -1087,6 +1104,6 @@ local skill = { } } local config = { -data=skill,count=62 +data=skill,count=63 } return config \ No newline at end of file diff --git a/lua/app/config/skill_rogue.lua b/lua/app/config/skill_rogue.lua index 3d68b6e7..5f4db2c0 100644 --- a/lua/app/config/skill_rogue.lua +++ b/lua/app/config/skill_rogue.lua @@ -13,7 +13,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=1 + ["icon"]="1" }, [2]={ ["universal"]=1, @@ -29,7 +29,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=1 + ["icon"]="1" }, [3]={ ["universal"]=1, @@ -45,7 +45,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=1 + ["icon"]="1" }, [4]={ ["universal"]=1, @@ -61,7 +61,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=2 + ["icon"]="2" }, [5]={ ["universal"]=1, @@ -77,7 +77,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=2 + ["icon"]="2" }, [6]={ ["universal"]=1, @@ -93,7 +93,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=2 + ["icon"]="2" }, [7]={ ["universal"]=1, @@ -109,7 +109,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=3 + ["icon"]="3" }, [8]={ ["universal"]=1, @@ -125,7 +125,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=3 + ["icon"]="3" }, [9]={ ["universal"]=1, @@ -141,7 +141,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=3 + ["icon"]="3" }, [10]={ ["universal"]=1, @@ -157,7 +157,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=4 + ["icon"]="4" }, [11]={ ["universal"]=1, @@ -173,7 +173,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=4 + ["icon"]="4" }, [12]={ ["universal"]=1, @@ -189,7 +189,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=4 + ["icon"]="4" }, [13]={ ["universal"]=1, @@ -205,7 +205,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=5 + ["icon"]="5" }, [14]={ ["universal"]=1, @@ -221,7 +221,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=5 + ["icon"]="5" }, [15]={ ["universal"]=1, @@ -237,7 +237,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=5 + ["icon"]="5" }, [16]={ ["universal"]=1, @@ -253,7 +253,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=6 + ["icon"]="6" }, [17]={ ["universal"]=1, @@ -269,7 +269,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=6 + ["icon"]="6" }, [18]={ ["universal"]=1, @@ -285,7 +285,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=6 + ["icon"]="6" }, [19]={ ["universal"]=1, @@ -302,7 +302,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=7 + ["icon"]="7" }, [20]={ ["universal"]=1, @@ -318,7 +318,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=8 + ["icon"]="8" }, [21]={ ["universal"]=1, @@ -334,7 +334,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=9 + ["icon"]="9" }, [22]={ ["universal"]=1, @@ -350,7 +350,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=9 + ["icon"]="9" }, [23]={ ["universal"]=1, @@ -366,7 +366,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=9 + ["icon"]="9" }, [24]={ ["universal"]=1, @@ -383,7 +383,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=10 + ["icon"]="10" }, [25]={ ["universal"]=1, @@ -399,7 +399,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=11 + ["icon"]="11" }, [26]={ ["universal"]=1, @@ -415,7 +415,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=12 + ["icon"]="12" }, [27]={ ["universal"]=1, @@ -431,7 +431,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=13 + ["icon"]="13" }, [28]={ ["universal"]=1, @@ -447,7 +447,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=14 + ["icon"]="14" }, [29]={ ["universal"]=1, @@ -462,7 +462,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=20 + ["icon"]="30" }, [30]={ ["universal"]=1, @@ -478,7 +478,7 @@ local skill_rogue = { ["range"]=2 } }, - ["icon"]=15 + ["icon"]="15" }, [31]={ ["universal"]=1, @@ -494,7 +494,7 @@ local skill_rogue = { ["range"]=4 } }, - ["icon"]=15 + ["icon"]="16" }, [32]={ ["universal"]=1, @@ -510,7 +510,7 @@ local skill_rogue = { ["range"]=5 } }, - ["icon"]=15 + ["icon"]="17" }, [33]={ ["universal"]=1, @@ -526,7 +526,7 @@ local skill_rogue = { ["range"]=2 } }, - ["icon"]=16 + ["icon"]="18" }, [34]={ ["universal"]=1, @@ -542,7 +542,7 @@ local skill_rogue = { ["range"]=4 } }, - ["icon"]=16 + ["icon"]="19" }, [35]={ ["universal"]=1, @@ -558,7 +558,7 @@ local skill_rogue = { ["range"]=5 } }, - ["icon"]=16 + ["icon"]="20" }, [36]={ ["universal"]=1, @@ -574,7 +574,7 @@ local skill_rogue = { ["range"]=2 } }, - ["icon"]=17 + ["icon"]="21" }, [37]={ ["universal"]=1, @@ -590,7 +590,7 @@ local skill_rogue = { ["range"]=4 } }, - ["icon"]=17 + ["icon"]="22" }, [38]={ ["universal"]=1, @@ -606,7 +606,7 @@ local skill_rogue = { ["range"]=5 } }, - ["icon"]=17 + ["icon"]="23" }, [39]={ ["universal"]=1, @@ -622,7 +622,7 @@ local skill_rogue = { ["range"]=2 } }, - ["icon"]=18 + ["icon"]="24" }, [40]={ ["universal"]=1, @@ -638,7 +638,7 @@ local skill_rogue = { ["range"]=4 } }, - ["icon"]=18 + ["icon"]="25" }, [41]={ ["universal"]=1, @@ -654,7 +654,7 @@ local skill_rogue = { ["range"]=5 } }, - ["icon"]=18 + ["icon"]="26" }, [42]={ ["universal"]=1, @@ -670,7 +670,7 @@ local skill_rogue = { ["range"]=2 } }, - ["icon"]=19 + ["icon"]="27" }, [43]={ ["universal"]=1, @@ -686,7 +686,7 @@ local skill_rogue = { ["range"]=4 } }, - ["icon"]=19 + ["icon"]="28" }, [44]={ ["universal"]=1, @@ -702,7 +702,7 @@ local skill_rogue = { ["range"]=5 } }, - ["icon"]=19 + ["icon"]="29" }, [200101]={ ["limit_times"]=1, @@ -720,7 +720,7 @@ local skill_rogue = { ["range"]=1 } }, - ["icon"]=200101 + ["icon"]="31" }, [200102]={ ["limit_times"]=2, @@ -737,24 +737,24 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=200102 + ["icon"]="32" }, [200103]={ ["limit_times"]=1, ["weight"]=1000, ["qlt"]=4, - ["type"]=12, + ["type"]=9, ["skill_position"]=3, ["effect"]={ { - ["type"]="stun", - ["num"]=0, - ["ratio"]=1000, + ["type"]="skill_add", + ["num"]=13, + ["ratio"]=10000, ["round"]=1 } }, ["obj"]=2, - ["icon"]=200103 + ["icon"]="33" }, [200201]={ ["limit_times"]=1, @@ -765,7 +765,7 @@ local skill_rogue = { 220012 }, ["skill_position"]=2, - ["icon"]=200201 + ["icon"]="34" }, [200202]={ ["limit_times"]=2, @@ -782,18 +782,30 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=200202 + ["icon"]="35" }, [200203]={ ["limit_times"]=1, ["weight"]=1000, ["qlt"]=4, - ["type"]=6, - ["parameter"]={ - 1 - }, + ["type"]=9, ["skill_position"]=2, - ["icon"]=200203 + ["effect"]={ + { + ["type"]="skill_fire_times", + ["num"]=220011, + ["ratio"]=10000, + ["round"]=1 + }, + { + ["type"]="skill_fire_times", + ["num"]=220012, + ["ratio"]=10000, + ["round"]=1 + } + }, + ["obj"]=1, + ["icon"]="36" }, [200301]={ ["limit_times"]=1, @@ -801,7 +813,7 @@ local skill_rogue = { ["qlt"]=3, ["type"]=4, ["skill_position"]=4, - ["icon"]=200301 + ["icon"]="37" }, [200302]={ ["limit_times"]=3, @@ -818,7 +830,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=200302 + ["icon"]="38" }, [200303]={ ["limit_times"]=2, @@ -832,7 +844,7 @@ local skill_rogue = { ["range"]=2 } }, - ["icon"]=200303 + ["icon"]="39" }, [200401]={ ["limit_times"]=1, @@ -840,7 +852,7 @@ local skill_rogue = { ["qlt"]=3, ["type"]=4, ["skill_position"]=5, - ["icon"]=200401 + ["icon"]="40" }, [200402]={ ["limit_times"]=2, @@ -852,7 +864,7 @@ local skill_rogue = { 1000 }, ["skill_position"]=5, - ["icon"]=200402 + ["icon"]="41" }, [200403]={ ["limit_times"]=1, @@ -864,7 +876,7 @@ local skill_rogue = { 1 }, ["skill_position"]=5, - ["icon"]=200403 + ["icon"]="42" }, [200501]={ ["limit_times"]=1, @@ -882,7 +894,7 @@ local skill_rogue = { ["range"]=1 } }, - ["icon"]=200501 + ["icon"]="43" }, [200502]={ ["limit_times"]=2, @@ -899,7 +911,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=200502 + ["icon"]="44" }, [200503]={ ["limit_times"]=1, @@ -916,7 +928,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=200503 + ["icon"]="45" }, [200601]={ ["limit_times"]=1, @@ -924,7 +936,7 @@ local skill_rogue = { ["qlt"]=3, ["type"]=4, ["skill_position"]=3, - ["icon"]=200601 + ["icon"]="46" }, [200602]={ ["limit_times"]=2, @@ -941,7 +953,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=200602 + ["icon"]="47" }, [200603]={ ["limit_times"]=1, @@ -958,7 +970,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=200603 + ["icon"]="48" }, [200701]={ ["limit_times"]=1, @@ -969,7 +981,7 @@ local skill_rogue = { 230012 }, ["skill_position"]=2, - ["icon"]=200701 + ["icon"]="49" }, [200702]={ ["limit_times"]=2, @@ -986,7 +998,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=200702 + ["icon"]="50" }, [200703]={ ["limit_times"]=1, @@ -997,7 +1009,7 @@ local skill_rogue = { 230013 }, ["skill_position"]=2, - ["icon"]=200703 + ["icon"]="51" }, [200801]={ ["limit_times"]=1, @@ -1008,7 +1020,7 @@ local skill_rogue = { 430012 }, ["skill_position"]=4, - ["icon"]=200801 + ["icon"]="52" }, [200802]={ ["limit_times"]=2, @@ -1025,7 +1037,7 @@ local skill_rogue = { } }, ["obj"]=1, - ["icon"]=200802 + ["icon"]="53" }, [200803]={ ["limit_times"]=1, @@ -1037,7 +1049,7 @@ local skill_rogue = { 1 }, ["skill_position"]=4, - ["icon"]=200803 + ["icon"]="54" } } local config = { diff --git a/lua/app/module/battle/battle_const.lua b/lua/app/module/battle/battle_const.lua index 531a3591..8fcf179b 100644 --- a/lua/app/module/battle/battle_const.lua +++ b/lua/app/module/battle/battle_const.lua @@ -121,6 +121,16 @@ BattleConst.EFFECT_TYPE = { HOT = 102, } +BattleConst.SKILL_RECORD_DATA_NAME = { + HP_LOWER_THAN = 1 +} + +BattleConst.PASSIVE_EVENT = { + ON_UNIT_PREPARE_OVER = 2, -- 新单位出场时 + ON_UNI_ATTACK_START = 3, -- 攻击开始前 + HP_LOWER_THAN = 4, -- 血量低于X% +} + local BUFF_NAME = { ATKP_ADD = "atkp_add", ATKP_COLOR_ADD = "atkp_color_add", diff --git a/lua/app/module/battle/component/battle_unit_comp.lua b/lua/app/module/battle/component/battle_unit_comp.lua index caa1e355..3c8f9edc 100644 --- a/lua/app/module/battle/component/battle_unit_comp.lua +++ b/lua/app/module/battle/component/battle_unit_comp.lua @@ -9,6 +9,7 @@ local UNIT_STATE = BattleConst.UNIT_STATE local SIDE_ATK = BattleConst.SIDE_ATK local SPINE_ANIMATION_NAME = BattleConst.SPINE_ANIMATION_NAME local DEFAULT_FACTOR = BattleConst.DEFAULT_FACTOR +local PASSIVE_EVENT = BattleConst.PASSIVE_EVENT function BattleUnitComp:ctor() end @@ -82,6 +83,11 @@ function BattleUnitComp:initWithEntity(modelId, entity, battleController, target self:playBorn() end +function BattleUnitComp:prepare() + self:checkPassiveEvent(PASSIVE_EVENT.ON_UNIT_PREPARE_OVER, self) + self:checkPassiveEvent(PASSIVE_EVENT.HP_LOWER_THAN, nil, self.unitEntity:getHpPercent()) +end + function BattleUnitComp:initPassiveSkills() local pasSkills = self.unitEntity:getPassiveSkills() if pasSkills and #pasSkills > 0 then @@ -207,6 +213,10 @@ function BattleUnitComp:getAnimationKeyFrameTime(animationName) return time end +function BattleUnitComp:beforeAttack() + self:checkPassiveEvent(PASSIVE_EVENT.ON_UNI_ATTACK_START, self) +end + function BattleUnitComp:useAssistingSkill(count, callback) local skill = self.unitEntity:getAssistingSkill() if skill == nil then @@ -826,6 +836,17 @@ function BattleUnitComp:takeEffect(buff, target) return false end +function BattleUnitComp:removeEffect(buff, target) + local round = buff:getRound() + if round > 0 then + return + end + local func = BattleBuffHandle.removeEffect[buff:getBuffType()] + if func then + func(self, target, buff) + end +end + function BattleUnitComp:takeDamageOrCure(atker, buff, num, effectType, effectStatus) if num == 0 then return 0 @@ -838,11 +859,16 @@ function BattleUnitComp:takeDamageOrCure(atker, buff, num, effectType, effectSta end local x, y, z = self.baseObject:fastGetLocalPosition() self:showEffectNumber(num, x, y) - self.battleController:refreshHp(self.side, self.unitEntity:getHp(), self.unitEntity:getHpPercent()) + local hp = self.unitEntity:getHp() + local hpPercent = self.unitEntity:getHpPercent() + self.battleController:refreshHp(self.side, hp, hpPercent) if self.currState == UNIT_STATE.IDLE then self:playHurt() end + if hp > 0 then + self:checkPassiveEvent(PASSIVE_EVENT.HP_LOWER_THAN, atker, hpPercent) + end end function BattleUnitComp:showEffectNumber(num, x, y) @@ -911,6 +937,11 @@ function BattleUnitComp:checkPassiveEvent(eventId, targetComp, ...) for i = 1, count do self:usePassiveSkill(skill) end + elseif count < 0 then + count = -count + for i = 1, count do + self:cancelPassiveSkillEffect(skill) + end end end end @@ -921,6 +952,23 @@ function BattleUnitComp:usePassiveSkill(skill) self:onSkillTakeEffect(skill) end +function BattleUnitComp:cancelPassiveSkillEffect(skill) + local effectList = skill:getEffectList() + if effectList == nil then + return + end + local targetType = skill:getTargetType() + local target + if targetType == 1 then -- 自己 + target = self + else + target = self.battleController:getOtherSideMainUnit(self.side) + end + for k, effect in ipairs(effectList) do + self:removeEffect(effect, target) + end +end + function BattleUnitComp:getIsClear() return self.isClear end diff --git a/lua/app/module/battle/controller/battle_controller.lua b/lua/app/module/battle/controller/battle_controller.lua index 72671be4..5cabfa9a 100644 --- a/lua/app/module/battle/controller/battle_controller.lua +++ b/lua/app/module/battle/controller/battle_controller.lua @@ -232,6 +232,8 @@ function BattleController:onLoadComplete() end function BattleController:battleStart() + self.atkTeam:prepare() + self.defTeam:prepare() self.isBattleStart = true self.tickSid = BattleScheduler:scheduleGlobal(function(dt) self:_tick(dt) @@ -264,6 +266,7 @@ function BattleController:enterNextWave() return end + self.defTeam:prepare() if self.isBossWave then -- 如果上一波是boss波次,则重新生成棋盘 self:putBoardCacheSkill(function() self:generateBoard() diff --git a/lua/app/module/battle/helper/battle_buff_handle.lua b/lua/app/module/battle/helper/battle_buff_handle.lua index cb402156..fc39f1a4 100644 --- a/lua/app/module/battle/helper/battle_buff_handle.lua +++ b/lua/app/module/battle/helper/battle_buff_handle.lua @@ -136,13 +136,14 @@ BattleBuffHandle.takeBuffEffect = { -- 还原改变的属性 local function _removeEffectAttr(buffSender, target, buff, buffEffect) - if buffEffect == nil then - return - end local buffName = buff:getName() local attr = BUFF_NAME_TO_ATTR[buffName] if attr then - target.unitEntity:addAttr(attr[1], -buffEffect.result, false) + if buffEffect then + target.unitEntity:addAttr(attr[1], -buffEffect.result, false) + else + target.unitEntity:addAttr(attr[1], -buff:getEffectNum(), attr[2]) + end else local func = BattleBuffHandle.addAttribute[buffName] if func then diff --git a/lua/app/module/battle/helper/battle_passive.lua b/lua/app/module/battle/helper/battle_passive.lua index f3e653d2..183da36b 100644 --- a/lua/app/module/battle/helper/battle_passive.lua +++ b/lua/app/module/battle/helper/battle_passive.lua @@ -14,7 +14,37 @@ end function BattlePassive:clear() end +local function _checkOnUnitPrepareOver(unitComp, skill, targetComp) + return 1 +end + +local function _checkOnUniAttackStart(unitComp, skill, targetComp) + return 1 +end + +local function _checkhpLowerThan(unitComp, skill, targetComp, hpPercent) + local triggerValue = skill:getPassiveTriggerValue() or 0 + if hpPercent*DEFAULT_FACTOR < triggerValue then -- 低于指定血量,触发技能 + local data = skill:getRecordData(SKILL_RECORD_DATA_NAME.HP_LOWER_THAN) or 0 + if data == 1 then -- 已经触发过了 + return 0 + end + skill:setRecordData(SKILL_RECORD_DATA_NAME.HP_LOWER_THAN, 1) + return 1 + else + local data = skill:getRecordData(SKILL_RECORD_DATA_NAME.HP_LOWER_THAN) or 0 + if data == 1 then -- 已经触发过了,那么需要取消 + skill:setRecordData(SKILL_RECORD_DATA_NAME.HP_LOWER_THAN, 0) + return -1 + end + end + return 0 +end + BattlePassive.checkTrigger = { + [PASSIVE_EVENT.ON_UNIT_PREPARE_OVER] = _checkOnUnitPrepareOver, + [PASSIVE_EVENT.ON_UNI_ATTACK_START] = _checkOnUniAttackStart, + [PASSIVE_EVENT.HP_LOWER_THAN] = _checkhpLowerThan, } return BattlePassive \ No newline at end of file diff --git a/lua/app/module/battle/team/battle_team.lua b/lua/app/module/battle/team/battle_team.lua index 89de0560..4a27121c 100644 --- a/lua/app/module/battle/team/battle_team.lua +++ b/lua/app/module/battle/team/battle_team.lua @@ -20,6 +20,12 @@ function BattleTeam:addUnit(unit, isMainUnit) end end +function BattleTeam:prepare() + for k, v in ipairs(self.unitList) do + v:prepare() + end +end + function BattleTeam:getMainUnit() return self.mainUnit end @@ -47,6 +53,7 @@ function BattleTeam:useNormalSkill(matchType, count, callback) return callback() end self.mainUnit = unit + unit:beforeAttack() unit:useNormalSkill(count, callback) end @@ -61,6 +68,7 @@ function BattleTeam:useSkill(matchType, count, callback) return callback() end self.mainUnit = unit + unit:beforeAttack() unit:useSkill(1, count, callback) end @@ -86,6 +94,7 @@ function BattleTeam:useAssistingSkill(assistingList, callback) end function BattleTeam:mainUnitUseAllSkills(callback) + self.mainUnit:beforeAttack() self.mainUnit:useAllSkills(callback) end diff --git a/lua/app/userdata/battle/skill/battle_skill_entity.lua b/lua/app/userdata/battle/skill/battle_skill_entity.lua index 2df0259f..db387a03 100644 --- a/lua/app/userdata/battle/skill/battle_skill_entity.lua +++ b/lua/app/userdata/battle/skill/battle_skill_entity.lua @@ -151,6 +151,10 @@ function BattleSkillEntity:getSid() return self.sid end +function BattleSkillEntity:getPassiveTriggerValue() + return self.skillInfo.trigger_value +end + function BattleSkillEntity:getPassiveTriggerId() return self.skillInfo.trigger end