diff --git a/lua/app/config/act_chapter_store.lua.meta b/lua/app/config/act_chapter_store.lua.meta index bc404500..701fda05 100644 --- a/lua/app/config/act_chapter_store.lua.meta +++ b/lua/app/config/act_chapter_store.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: d80f30e1b6ebad0419987a4a0b835f9b +guid: e1c21d8a7d40ea54bac5ddca0ef0eab8 ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/act_gift.lua b/lua/app/config/act_gift.lua index fd9e2ad8..960dd925 100644 --- a/lua/app/config/act_gift.lua +++ b/lua/app/config/act_gift.lua @@ -815,29 +815,29 @@ local act_gift = { } } }, - [20000]={ - ["type"]=2, + [60102]={ + ["type"]=6, ["recharge_id"]=13, ["time_type"]=3, ["limit"]=1, ["value"]=25 }, - [20001]={ - ["type"]=2, + [60202]={ + ["type"]=6, ["recharge_id"]=5, ["time_type"]=3, ["limit"]=1, ["value"]=21 }, - [20002]={ - ["type"]=2, + [60302]={ + ["type"]=6, ["recharge_id"]=15, ["time_type"]=3, ["limit"]=1, ["value"]=25 }, - [20003]={ - ["type"]=2, + [60402]={ + ["type"]=6, ["recharge_id"]=10, ["time_type"]=3, ["limit"]=1, diff --git a/lua/app/config/act_growup_gift.lua.meta b/lua/app/config/act_growup_gift.lua.meta index b29a810a..94dfdd0f 100644 --- a/lua/app/config/act_growup_gift.lua.meta +++ b/lua/app/config/act_growup_gift.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: b2751a9c036ef454a9051e7031ad4172 +guid: 956a66427f61d674b86d5c5b729862d6 ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/act_level_fund.lua.meta b/lua/app/config/act_level_fund.lua.meta index c61b8d6b..fdf7c206 100644 --- a/lua/app/config/act_level_fund.lua.meta +++ b/lua/app/config/act_level_fund.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 141b166c533817e4b8927d2505c393c7 +guid: 3a0a8659f7e6f7948b80b5e939bea1de ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/act_sevenday_quest.lua b/lua/app/config/act_sevenday_quest.lua index 04e537cd..28b66881 100644 --- a/lua/app/config/act_sevenday_quest.lua +++ b/lua/app/config/act_sevenday_quest.lua @@ -15,7 +15,7 @@ local act_sevenday_quest = { [2]={ ["day"]=1, ["number"]=1, - ["type"]=25, + ["type"]=24, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -28,7 +28,7 @@ local act_sevenday_quest = { [3]={ ["day"]=1, ["number"]=1, - ["type"]=29, + ["type"]=28, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -42,7 +42,7 @@ local act_sevenday_quest = { [4]={ ["day"]=1, ["number"]=3, - ["type"]=26, + ["type"]=25, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -55,7 +55,7 @@ local act_sevenday_quest = { [5]={ ["day"]=1, ["number"]=5, - ["type"]=28, + ["type"]=27, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -68,7 +68,7 @@ local act_sevenday_quest = { [6]={ ["day"]=1, ["number"]=3, - ["type"]=26, + ["type"]=23, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -81,7 +81,7 @@ local act_sevenday_quest = { [7]={ ["day"]=1, ["number"]=30, - ["type"]=27, + ["type"]=26, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -148,7 +148,7 @@ local act_sevenday_quest = { [12]={ ["day"]=2, ["number"]=1, - ["type"]=25, + ["type"]=24, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -161,7 +161,7 @@ local act_sevenday_quest = { [13]={ ["day"]=2, ["number"]=1, - ["type"]=29, + ["type"]=28, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -175,7 +175,7 @@ local act_sevenday_quest = { [14]={ ["day"]=2, ["number"]=3, - ["type"]=26, + ["type"]=25, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -188,7 +188,7 @@ local act_sevenday_quest = { [15]={ ["day"]=2, ["number"]=5, - ["type"]=28, + ["type"]=27, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -201,7 +201,7 @@ local act_sevenday_quest = { [16]={ ["day"]=2, ["number"]=3, - ["type"]=26, + ["type"]=23, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -214,7 +214,7 @@ local act_sevenday_quest = { [17]={ ["day"]=2, ["number"]=30, - ["type"]=27, + ["type"]=26, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -281,7 +281,7 @@ local act_sevenday_quest = { [22]={ ["day"]=3, ["number"]=1, - ["type"]=25, + ["type"]=24, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -294,7 +294,7 @@ local act_sevenday_quest = { [23]={ ["day"]=3, ["number"]=1, - ["type"]=29, + ["type"]=28, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -308,7 +308,7 @@ local act_sevenday_quest = { [24]={ ["day"]=3, ["number"]=3, - ["type"]=26, + ["type"]=25, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -321,7 +321,7 @@ local act_sevenday_quest = { [25]={ ["day"]=3, ["number"]=5, - ["type"]=28, + ["type"]=27, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -334,7 +334,7 @@ local act_sevenday_quest = { [26]={ ["day"]=3, ["number"]=3, - ["type"]=26, + ["type"]=23, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -347,7 +347,7 @@ local act_sevenday_quest = { [27]={ ["day"]=3, ["number"]=30, - ["type"]=27, + ["type"]=26, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -414,7 +414,7 @@ local act_sevenday_quest = { [32]={ ["day"]=4, ["number"]=1, - ["type"]=25, + ["type"]=24, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -427,7 +427,7 @@ local act_sevenday_quest = { [33]={ ["day"]=4, ["number"]=1, - ["type"]=29, + ["type"]=28, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -441,7 +441,7 @@ local act_sevenday_quest = { [34]={ ["day"]=4, ["number"]=3, - ["type"]=26, + ["type"]=25, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -454,7 +454,7 @@ local act_sevenday_quest = { [35]={ ["day"]=4, ["number"]=5, - ["type"]=28, + ["type"]=27, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -467,7 +467,7 @@ local act_sevenday_quest = { [36]={ ["day"]=4, ["number"]=3, - ["type"]=26, + ["type"]=23, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -480,7 +480,7 @@ local act_sevenday_quest = { [37]={ ["day"]=4, ["number"]=30, - ["type"]=27, + ["type"]=26, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -547,7 +547,7 @@ local act_sevenday_quest = { [42]={ ["day"]=5, ["number"]=1, - ["type"]=25, + ["type"]=24, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -560,7 +560,7 @@ local act_sevenday_quest = { [43]={ ["day"]=5, ["number"]=1, - ["type"]=29, + ["type"]=28, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -574,7 +574,7 @@ local act_sevenday_quest = { [44]={ ["day"]=5, ["number"]=3, - ["type"]=26, + ["type"]=25, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -587,7 +587,7 @@ local act_sevenday_quest = { [45]={ ["day"]=5, ["number"]=5, - ["type"]=28, + ["type"]=27, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -600,7 +600,7 @@ local act_sevenday_quest = { [46]={ ["day"]=5, ["number"]=3, - ["type"]=26, + ["type"]=23, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -613,7 +613,7 @@ local act_sevenday_quest = { [47]={ ["day"]=5, ["number"]=30, - ["type"]=27, + ["type"]=26, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -680,7 +680,7 @@ local act_sevenday_quest = { [52]={ ["day"]=6, ["number"]=1, - ["type"]=25, + ["type"]=24, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -693,7 +693,7 @@ local act_sevenday_quest = { [53]={ ["day"]=6, ["number"]=1, - ["type"]=29, + ["type"]=28, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -707,7 +707,7 @@ local act_sevenday_quest = { [54]={ ["day"]=6, ["number"]=3, - ["type"]=26, + ["type"]=25, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -720,7 +720,7 @@ local act_sevenday_quest = { [55]={ ["day"]=6, ["number"]=5, - ["type"]=28, + ["type"]=27, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -733,7 +733,7 @@ local act_sevenday_quest = { [56]={ ["day"]=6, ["number"]=3, - ["type"]=26, + ["type"]=23, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -746,7 +746,7 @@ local act_sevenday_quest = { [57]={ ["day"]=6, ["number"]=30, - ["type"]=27, + ["type"]=26, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -813,7 +813,7 @@ local act_sevenday_quest = { [62]={ ["day"]=7, ["number"]=1, - ["type"]=25, + ["type"]=24, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -826,7 +826,7 @@ local act_sevenday_quest = { [63]={ ["day"]=7, ["number"]=1, - ["type"]=29, + ["type"]=28, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -840,7 +840,7 @@ local act_sevenday_quest = { [64]={ ["day"]=7, ["number"]=3, - ["type"]=26, + ["type"]=25, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -853,7 +853,7 @@ local act_sevenday_quest = { [65]={ ["day"]=7, ["number"]=5, - ["type"]=28, + ["type"]=27, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -866,7 +866,7 @@ local act_sevenday_quest = { [66]={ ["day"]=7, ["number"]=3, - ["type"]=26, + ["type"]=23, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", @@ -879,7 +879,7 @@ local act_sevenday_quest = { [67]={ ["day"]=7, ["number"]=30, - ["type"]=27, + ["type"]=26, ["reward"]={ ["type"]=1, ["type_for_nothing"]="Vw==", diff --git a/lua/app/config/act_sevenday_quest.lua.meta b/lua/app/config/act_sevenday_quest.lua.meta index 1316d2fe..5590af84 100644 --- a/lua/app/config/act_sevenday_quest.lua.meta +++ b/lua/app/config/act_sevenday_quest.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: c8a9e4cff2241c547a34c834f99d1ffa +guid: 77f4e766031f9c1439ca129341fb3a41 ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/act_sevenday_quest_reward.lua.meta b/lua/app/config/act_sevenday_quest_reward.lua.meta index 3dd4bfb0..75590633 100644 --- a/lua/app/config/act_sevenday_quest_reward.lua.meta +++ b/lua/app/config/act_sevenday_quest_reward.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: f7467b1a396aa0a4587d0e3fa7aee74f +guid: dddcc322d60209544bf40bb227cb1bcf ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/buff.lua b/lua/app/config/buff.lua index d5b5c88f..d34024ef 100644 --- a/lua/app/config/buff.lua +++ b/lua/app/config/buff.lua @@ -239,6 +239,7 @@ local buff = { ["stack"]=2, ["decr"]=2, ["icon"]="stun", + ["control_priority"]=2, ["fx_continued"]={ 13 } @@ -357,8 +358,9 @@ local buff = { }, [50]={ ["name"]="frozen", - ["buff_type"]=8, - ["decr"]=2 + ["buff_type"]=7, + ["decr"]=2, + ["control_priority"]=1 }, [51]={ ["name"]="poison", @@ -370,7 +372,8 @@ local buff = { [52]={ ["name"]="imprison", ["buff_type"]=7, - ["decr"]=2 + ["decr"]=2, + ["control_priority"]=4 }, [53]={ ["name"]="corrupt", @@ -392,7 +395,8 @@ local buff = { ["name"]="lethargy", ["buff_type"]=8, ["stack"]=1, - ["decr"]=2 + ["decr"]=2, + ["control_priority"]=3 }, [57]={ ["name"]="curse", @@ -480,6 +484,11 @@ local buff = { ["name"]="be_dmg_to_heal", ["buff_type"]=1, ["decr"]=2 + }, + [72]={ + ["name"]="death_summon", + ["buff_type"]=1, + ["decr"]=3 } } local keys = { @@ -554,12 +563,13 @@ local keys = { ["dmg_dec_purple_add"]=buff[68], ["dmg_dec_all_add"]=buff[69], ["be_sucked"]=buff[70], - ["be_dmg_to_heal"]=buff[71] + ["be_dmg_to_heal"]=buff[71], + ["death_summon"]=buff[72] } } local config = { data=buff, keys=keys, -count=71 +count=72 } return config \ No newline at end of file diff --git a/lua/app/config/player_exp.lua.meta b/lua/app/config/player_exp.lua.meta index 15a0e9df..30653494 100644 --- a/lua/app/config/player_exp.lua.meta +++ b/lua/app/config/player_exp.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 81efcd0562ba9bd4b826603119845aa2 +guid: 85f5b906b8e175845a014ee91a965ce5 ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/cn/task.lua.meta b/lua/app/config/strings/cn/task.lua.meta index acb75638..4c4c14c4 100644 --- a/lua/app/config/strings/cn/task.lua.meta +++ b/lua/app/config/strings/cn/task.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 377c59e44ca929244956e29bf5102a53 +guid: 3087058d22208d243a56270aa7dfd940 ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/de/task.lua.meta b/lua/app/config/strings/de/task.lua.meta index 28324d9e..c29213e3 100644 --- a/lua/app/config/strings/de/task.lua.meta +++ b/lua/app/config/strings/de/task.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 31c4ab50968111747ae7bd5f271711b6 +guid: bd05fc1d5ec40624a816431545fe0db3 ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/en/task.lua.meta b/lua/app/config/strings/en/task.lua.meta index a912049d..cfce37ad 100644 --- a/lua/app/config/strings/en/task.lua.meta +++ b/lua/app/config/strings/en/task.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: b0fd59c46acd3eb49a4c73ada835ffcb +guid: 269bb4bead3ca8843b236b17154ade58 ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/fr/task.lua.meta b/lua/app/config/strings/fr/task.lua.meta index b6dace19..37137300 100644 --- a/lua/app/config/strings/fr/task.lua.meta +++ b/lua/app/config/strings/fr/task.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 088e4ec3106f7bf47bede1316999e8ea +guid: acb5227dbd28ad14b8310e02e335096a ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/ja/task.lua.meta b/lua/app/config/strings/ja/task.lua.meta index f9495651..8fb8163c 100644 --- a/lua/app/config/strings/ja/task.lua.meta +++ b/lua/app/config/strings/ja/task.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 017495af721781f4d8dcb79c051be1a0 +guid: eb4dee21223abde4f8c34b174867f26c ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/ko/task.lua.meta b/lua/app/config/strings/ko/task.lua.meta index 76b323f0..f8726deb 100644 --- a/lua/app/config/strings/ko/task.lua.meta +++ b/lua/app/config/strings/ko/task.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: aa304b73189e7ad4b9dccfc53b1587ac +guid: 36b9e2ac52678d44f8fb50c7ec6d4c6d ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/zh/task.lua.meta b/lua/app/config/strings/zh/task.lua.meta index e5b36d06..c410ed77 100644 --- a/lua/app/config/strings/zh/task.lua.meta +++ b/lua/app/config/strings/zh/task.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: fc6e774792de35c4b8f5530d9fc51a2f +guid: af8ae60c031a3304a87cdd73f26b131e ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/module/battle/battle_const.lua b/lua/app/module/battle/battle_const.lua index f50c61c6..69064439 100644 --- a/lua/app/module/battle/battle_const.lua +++ b/lua/app/module/battle/battle_const.lua @@ -53,11 +53,11 @@ BattleConst.BATTLE_ROUND_STEP = { ON_BEGIN = 1, -- 回合开始 ON_ELIMINATION_BEGIN = 3, -- 消除开始 ON_ELIMINATION = 4, -- 等待消除 - ON_ATK_STEP = 5, -- 攻击方行动 - ON_ATK_STEP_OVER = 6, -- 攻击方行动结束(可能直接跳转到刷新棋盘/回合结束) - ON_DEF_STEP = 7, -- 防守方行动 - ON_DEF_STEP_OVER = 8, -- 防守方行动结束(可能直接跳转到刷新棋盘/回合结束) - ON_REFRESH_BOARD = 9, -- 刷新棋盘 + ON_REFRESH_BOARD = 5, -- 刷新棋盘 + ON_TEAM_ACTION = 6, -- 队伍行动 + ON_ATK_STEP = 7, -- 攻击方行动 + ON_DEF_STEP = 8, -- 防守方行动 + ON_TEAM_ACTION_OVER = 9, -- 攻击方行动结束(可能直接跳转到刷新棋盘/回合结束/进入下一个队伍行动) ON_END = 10, -- 回合结束 } @@ -90,6 +90,18 @@ BattleConst.BUFF_TYPE = { DIRECT_HURT = 3 } +BattleConst.BUFF_STACK_TYPE = { + CANT_ADD = 0, + ADD_ROUND = 1, + ADD = 2 +} + +BattleConst.BUFF_DECR_TYPE = { + INCREASE_GAIN = 1, + REDUCE_GAIN = 2, + NOT_INCREASE_DECREASE_GAIN = 3 +} + BattleConst.SKILL_MOVE_TYPE = { MOVE = 1, -- 移动到目标跟前使用 STAND = 2, -- 原地使用 @@ -119,6 +131,15 @@ BattleConst.MATCH_DMG_ADDITION_NAME = { } BattleConst.MATCH_DMG_DEC_NAME = { + [0] = "dmg_dec_none", + [1] = "dmg_dec_red", + [2] = "dmg_dec_yellow", + [3] = "dmg_dec_green", + [4] = "dmg_dec_blue", + [5] = "dmg_dec_purple", +} + +BattleConst.MATCH_DEC_DMG_NAME = { [0] = "dec_dmg_none", [1] = "dec_dmg_red", [2] = "dec_dmg_yellow", @@ -161,6 +182,8 @@ BattleConst.EFFECT_TYPE = { DOT = 2, -- 间接伤害 HEAL = 101, HOT = 102, + REBOUND = 201, -- 反弹 + COUNTERATTACK = 301, -- 反击 } BattleConst.SKILL_RECORD_DATA_NAME = { @@ -173,6 +196,7 @@ BattleConst.PASSIVE_EVENT = { HP_LOWER_THAN = 4, -- 血量低于X% USE_NORMAL_SKILL = 5, -- 使用普攻 ACTIVE_SKILL_HIT = 6, -- 主动技能命中 + ON_DEAD = 7, -- 死亡时 } local BUFF_NAME = { @@ -210,9 +234,27 @@ local BUFF_NAME = { CRIT_TIME_ADD = "crit_time_add", EXP_TIME_ADD = "exp_time_add", CURED_ADD = "cured_add", + CURED_DEC = "cured_dec", ADD_SKILL = "add_skill", SKILL_FIRE_TIMES = "skill_fire_times", SHIELD_REBOUND_200 = "shield_rebound_200", + BURN = "burn", + VULNERABLE = "vulnerable", + FROZEN = "frozen", + POISON = "poison", + IMPRISON = "imprison", + CORRUPT = "corrupt", + BLEED = "bleed", + WEAKEN = "weaken", + LETHARGY = "lethargy", + CURSE = "curse", + LOCK = "lock", + UNDEAD = "undead", + THORNS = "thorns", + FIRST_HAND = "first_hand", + COUNTER_ATTACK = "counterattack", + SKILL_HURT_ADD = "skill_hurt_add", + DEATH_SUMMON = "death_summon", } BattleConst.BUFF_NAME = BUFF_NAME @@ -241,13 +283,29 @@ local ATTR_NAME = { DMG_ADDITION_BLUE = "dmg_addition_blue", DMG_ADDITION_PURPLE = "dmg_addition_purple", DMG_ADDITION_ALL = "dmg_addition_all", + DMG_DEC_RED = "dmg_dec_red", + DMG_DEC_YELLOW = "dmg_dec_yellow", + DMG_DEC_GREEN = "dmg_dec_green", + DMG_DEC_BLUE = "dmg_dec_blue", + DMG_DEC_PURPLE = "dmg_dec_purple", + DMG_DEC_ALL = "dmg_dec_all", NORMAL_ATTACK_COUNT = "normal_attack_count", BLOCK = "block", CRIT = "crit", CRIT_TIME = "crit_time", EXP_TIME = "exp_time", CURE_ADDITION = "cure_addition", + CURE_DEC = "cure_dec", SHIELD_REBOUND = "shield_rebound", + BE_DMG_TO_HEAL = "be_dmg_to_heal", + BE_SUCKED = "be_sucked", + LETHARGY = "lethargy", + UNDEAD = "undead", + THORNS = "thorns", + FIRST_HAND = "first_hand", + COUNTER_ATTACK = "counterattack", + SKILL_HURT = "skill_hurt", + DEATH_SUMMON = "death_summon", } BattleConst.ATTR_NAME = ATTR_NAME @@ -282,6 +340,15 @@ BattleConst.BUFF_NAME_TO_ATTR = { [BUFF_NAME.CRIT_TIME_ADD] = {ATTR_NAME.CRIT_TIME, false}, [BUFF_NAME.EXP_TIME_ADD] = {ATTR_NAME.EXP_TIME, false}, [BUFF_NAME.CURED_ADD] = {ATTR_NAME.CURE_ADDITION, false}, + [BUFF_NAME.VULNERABLE] = {ATTR_NAME.WEAKNESS_ALL, false}, + [BUFF_NAME.CORRUPT] = {ATTR_NAME.CURE_DEC, false}, + [BUFF_NAME.CURED_DEC] = {ATTR_NAME.CURE_DEC, false}, + [BUFF_NAME.WEAKEN] = {ATTR_NAME.DMG_DEC_ALL, false}, + [BUFF_NAME.CURSE] = {ATTR_NAME.BE_DMG_TO_HEAL, false}, + [BUFF_NAME.THORNS] = {ATTR_NAME.THORNS, false}, + [BUFF_NAME.FIRST_HAND] = {ATTR_NAME.FIRST_HAND, false}, + [BUFF_NAME.COUNTER_ATTACK] = {ATTR_NAME.COUNTER_ATTACK, false}, + [BUFF_NAME.SKILL_HURT_ADD] = {ATTR_NAME.SKILL_HURT, false}, } ---- 格子类型 @@ -292,6 +359,7 @@ BattleConst.GRID_TYPE = { SOLID_SNOW = 3, VINES = 4, ICE = 5, + LOCK = 6, } BattleConst.GRID_TYPE_ICON = { @@ -617,8 +685,22 @@ BattleConst.SKILL_TYPE = { NORMAL = 0, ELIMINATION = 1, CHANGE_AROUND = 2, - -- 3 暂不处理 + RELEASE_GRID_TYPE = 3, ELIMINATION_GRID_AND_ELEMENT = 4, + CHANGE_ALL_ELEMENT_TYPE = 5, + RANDOM_KILL_SKILL_GRID = 6, + SHUFFLE_BOARD = 7, + RANDOM_KILL_ROW_OR_COLUMN = 8, + RANDOM_KILL_ELEMENT_AND_HEAL = 9, +} + +BattleConst.ATTACK_OVER_ACTIVE_SKILL_TYPE = { + [BattleConst.SKILL_TYPE.RELEASE_GRID_TYPE] = true, + [BattleConst.SKILL_TYPE.CHANGE_ALL_ELEMENT_TYPE] = true, + [BattleConst.SKILL_TYPE.RANDOM_KILL_SKILL_GRID] = true, + [BattleConst.SKILL_TYPE.SHUFFLE_BOARD] = true, + [BattleConst.SKILL_TYPE.RANDOM_KILL_ROW_OR_COLUMN] = true, + [BattleConst.SKILL_TYPE.RANDOM_KILL_ELEMENT_AND_HEAL] = true, } BattleConst.SKILL_METHOD_TYPE = { @@ -643,6 +725,7 @@ BattleConst.OUTLINE_SFX = { } BattleConst.LINE_SFX = "assets/prefabs/effects/battle/sfx_piece_line_b01.prefab" +BattleConst.CHANGE_ELEMENT_SFX = "assets/prefabs/effects/battle/sfx_skill_b02.prefab" BattleConst.GRID_TYPE_BREAK_SFX = { [BattleConst.GRID_TYPE.SNOW_BOX] = "assets/prefabs/effects/battle/sfx_piece_za_b01.prefab", [BattleConst.GRID_TYPE.SOLID_SNOW] = "assets/prefabs/effects/battle/sfx_piece_za_b01.prefab", diff --git a/lua/app/module/battle/component/battle_unit_comp.lua b/lua/app/module/battle/component/battle_unit_comp.lua index 25d3188f..2d02f26d 100644 --- a/lua/app/module/battle/component/battle_unit_comp.lua +++ b/lua/app/module/battle/component/battle_unit_comp.lua @@ -1,6 +1,7 @@ local BattleConst = require "app/module/battle/battle_const" local BattleHelper = require "app/module/battle/helper/battle_helper" local BattleBuffHandle = require "app/module/battle/helper/battle_buff_handle" +local BATTLE_BOARD_SKILL_HANDLE = require "app/module/battle/skill/battle_board_skill_handle" local BattlePassive = require "app/module/battle/helper/battle_passive" local BattleUnitComp = class("BattleUnitComp", LuaComponent) @@ -59,6 +60,14 @@ function BattleUnitComp:getIsLimit() return self.unitEntity:getIsLimit() end +function BattleUnitComp:getIsLethargy() + return self.unitEntity:getIsLethargy() +end + +function BattleUnitComp:getActiveSkillLimit() + return self.unitEntity:getActiveSkillLimit() +end + function BattleUnitComp:setTeam(team) self.team = team end @@ -249,10 +258,12 @@ function BattleUnitComp:getIsCentralizedAttack() return self.team:getCentralizedAttack() end -function BattleUnitComp:beforeAttack() +function BattleUnitComp:beforeAttack(effectType) self.team:setCentralizedAttack(true) self.battleController:setIsPauseHpProgress(true) - self:checkPassiveEvent(PASSIVE_EVENT.ON_UNI_ATTACK_START, self) + if effectType == BattleConst.EFFECT_TYPE.DIRECT then + self:checkPassiveEvent(PASSIVE_EVENT.ON_UNI_ATTACK_START, self) + end end function BattleUnitComp:useAssistingSkill(count, delay, callback) @@ -293,6 +304,9 @@ function BattleUnitComp:useSkill(index, count, callback) self.actionOverCallback = callback self.activeSkillIndex = nil self.currActiveSkill = self.unitEntity:getAvailableActiveSkill(index) + if self:getActiveSkillLimit() then + self.currActiveSkill = nil + end if count <= 0 then self.normalSkillCount = 0 else @@ -339,6 +353,9 @@ function BattleUnitComp:useAllSkills(callback) self.activeSkillIndex = 1 self.currActiveSkill = nil local activeSkillCount = self.unitEntity:getActiveSkillCount() + if self:getActiveSkillLimit() then + activeSkillCount = 0 + end while self.activeSkillIndex <= activeSkillCount do self.currActiveSkill = self.unitEntity:getAvailableActiveSkill(self.activeSkillIndex) if self.currActiveSkill then @@ -370,9 +387,12 @@ function BattleUnitComp:useAllSkills(callback) end end -function BattleUnitComp:useNormalSkill(count, callback) +function BattleUnitComp:useNormalSkill(count, effectType, callback) self.actionOverCallback = callback - self.normalSkillCount = count + self.unitEntity:getNormalAttackAddCount() + self.normalSkillCount = count + if effectType == BattleConst.EFFECT_TYPE.DIRECT then + self.normalSkillCount = self.normalSkillCount + self.unitEntity:getNormalAttackAddCount() + end if not self:changeState(UNIT_STATE.NORMAL_ATTACK) then self.actionOverCallback = nil self.battleController:setIsPauseHpProgress(false) @@ -644,6 +664,9 @@ function BattleUnitComp:updateRecoverHpWaveState(dt) self.recoverHpCount = self.recoverHpCount - 1 self.recoverHpTime = BattleConst.RECOVER_HP_INTERVAL local healNum = BattleConst.RECOVER_HP_PERCENT * self.unitEntity:getMaxHp() // DEFAULT_FACTOR + if healNum < 0 then -- 治疗效果不能为负数 + healNum = 0 + end self:takeDamageOrCure(self, healNum, EFFECT_TYPE.HEAL, 0) if self.recoverHpCount <= 0 then if self.finishRecoverHpCallback then @@ -1067,7 +1090,7 @@ function BattleUnitComp:addMaxHp(percent) end function BattleUnitComp:addBuff(buffEffect) - self.team:addBuff(buffEffect) + return self.team:addBuff(buffEffect) end function BattleUnitComp:updateBuffState(buff, num) @@ -1078,10 +1101,26 @@ function BattleUnitComp:removeAllBuff() self.team:removeAllBuff() end +function BattleUnitComp:removeBuffByName(buffName) + self.team:removeBuffByName(buffName) +end + +function BattleUnitComp:putCacheBuff(buffEffect) + self.team:putCacheBuff(buffEffect) +end + +function BattleUnitComp:putCacheBuffByDecr(buffDecr) + self.team:putCacheBuffByDecr(buffDecr) +end + +function BattleUnitComp:popCacheBuffByDecr(buffDecr) + self.team:popCacheBuffByDecr(buffDecr) +end + function BattleUnitComp:onSkillTakeEffect(skill) skill:endUse() - if skill:getIsEliminateType() then - self.battleController:generateGridType(skill:getEliminateSkillParameter(), self.baseObject:getTransform().position) + if skill:isAttackOverActive() then + BATTLE_BOARD_SKILL_HANDLE.activeAttackOverSkill(self, skill, self.battleController) end local effectList = skill:getEffectList() if effectList == nil then @@ -1142,6 +1181,18 @@ function BattleUnitComp:takeEffect(buff, target) return false end end + if self.unitEntity:getIsFrozen() and buff:getDecr() == BattleConst.BUFF_DECR_TYPE.INCREASE_GAIN then -- 冻结状态,缓存增益buff + if buff:getRound() > 0 then + local buffEffect = BattleHelper:getBuffEffect() + buffEffect.buff = buff + buffEffect.result = nil + buffEffect.round = buff:getRound() + buffEffect.target = target + buffEffect.sender = self + target:putCacheBuff(buffEffect) + end + return + end local round = buff:getRound() local buffEffect if round > 0 then @@ -1151,7 +1202,41 @@ function BattleUnitComp:takeEffect(buff, target) buffEffect.round = round buffEffect.target = target buffEffect.sender = self - target:addBuff(buffEffect) + buffEffect = target:addBuff(buffEffect) + end + if buffEffect and buffEffect.result then + return + end + local func = BattleBuffHandle.takeBuffEffect[buff:getBuffType()] + if func then + local result = func(self, buff, target, buffEffect) + if buffEffect then + buffEffect.result = result + end + local success = result ~= nil + if success then + local fxList = buff:getFxGet() + if fxList then + for _, v in ipairs(fxList) do + target:playFx(v, 0) + end + end + end + return success + end + return false +end + +function BattleUnitComp:reTakeEffectByBuffEffect(buffEffect) + local round = buffEffect.round + local target = buffEffect.target + local buff = buffEffect.buff + if round > 0 then + buffEffect.result = nil + buffEffect = target:addBuff(buffEffect) + end + if buffEffect and buffEffect.result then + return end local func = BattleBuffHandle.takeBuffEffect[buff:getBuffType()] if func then @@ -1194,6 +1279,9 @@ function BattleUnitComp:takeDamageOrCure(atker, num, effectType, effectStatus) if num == 0 then return 0 end + if num < 0 and atker.unitEntity:getBeDmgToHeal() > 0 then + num = -num * atker.unitEntity:getBeDmgToHeal() // DEFAULT_FACTOR + end atker.unitEntity:addDamageCount(num) local shieldHpBefore = self.unitEntity:getShieldHp() local hpRealReduce = self.unitEntity:takeDamageOrCure(num) @@ -1237,8 +1325,25 @@ function BattleUnitComp:takeDamageOrCure(atker, num, effectType, effectStatus) end end end - if hp > 0 and self.unitEntity:getShieldRebound() then -- 伤害反弹 - atker:takeDamageOrCure(self, num*self.unitEntity:getShieldRebound() // DEFAULT_FACTOR, EFFECT_TYPE.DIRECT, 0) + if effectType == EFFECT_TYPE.DIRECT then + if hp > 0 and self.unitEntity:getShieldRebound() then -- 伤害反弹 + atker:takeDamageOrCure(self, num*self.unitEntity:getShieldRebound() // DEFAULT_FACTOR, EFFECT_TYPE.REBOUND, 0) + end + if self.unitEntity:getBeSucked() > 0 then -- 吸血 + atker:takeDamageOrCure(self, -num*self.unitEntity:getBeSucked() // DEFAULT_FACTOR, EFFECT_TYPE.HEAL, 0) + end + if self.unitEntity:getIsLethargy() then -- 移除昏睡 + self:removeBuffByName(BattleConst.BUFF_NAME.LETHARGY) + end + if self.unitEntity:getThorns() > 0 then -- 反伤 + atker:takeDamageOrCure(self, num*self.unitEntity:getThorns() // DEFAULT_FACTOR, EFFECT_TYPE.REBOUND, 0) + end + if self.unitEntity:getCounterAttack() > 0 then -- 触发反击 + local counterattack = self.unitEntity:getCounterAttack() + if counterattack > DEFAULT_FACTOR or BattleHelper:random(1, DEFAULT_FACTOR) <= counterattack then -- 通过命中概率 + self.unitEntity:addCounterAttackCount(1) + end + end end elseif num > 0 then -- 治疗 self:showEffectNumber(BattleConst.EFFECT_COLOR_GREEN, BattleConst.EFFECT_TYPE_BUFF, "+" .. num, x, y, 0) @@ -1258,6 +1363,8 @@ function BattleUnitComp:takeDamageOrCure(atker, num, effectType, effectStatus) end if hp > 0 then self.team:checkPassiveEvent(PASSIVE_EVENT.HP_LOWER_THAN, atker, hpPercent) + else + self.team:checkPassiveEvent(PASSIVE_EVENT.ON_DEAD, atker) end end @@ -1432,7 +1539,7 @@ function BattleUnitComp:getEffectAndPlay(fxInfo, isLoop) end) end -function BattleUnitComp:removeEffect(res) +function BattleUnitComp:removeFx(res) local effect = self.loopFxMap[res] if effect then self.loopFxMap[res] = nil diff --git a/lua/app/module/battle/controller/battle_controller.lua b/lua/app/module/battle/controller/battle_controller.lua index fce378e1..0df29d44 100644 --- a/lua/app/module/battle/controller/battle_controller.lua +++ b/lua/app/module/battle/controller/battle_controller.lua @@ -66,11 +66,24 @@ function BattleController:initDefUnits(callback) end function BattleController:findNextDefUnit() - self:enterRefreshBoard() + self:enterRoundEnd() end -function BattleController:onDefDead() - self.defTeam:getMainUnit():playDead() +function BattleController:onDefDead(callback) + self.defTeam:getMainUnit():playDead(function() + local monsterId = self.defTeam:getMainUnit().unitEntity:getDeathSummon() + if monsterId > 0 then + self:generateMonsterById(monsterId, function() + if callback then + callback() + end + end) + else + if callback then + callback() + end + end + end) end function BattleController:tick(dt) @@ -441,9 +454,7 @@ end function BattleController:enterEliminationBegin() self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_BEGIN self:onEliminationBegin() - self:popBoardCacheSkill(function() - self:enterElimination(true) - end) + self:enterRefreshBoard(true) end function BattleController:enterElimination(needDelay) @@ -471,43 +482,9 @@ function BattleController:enterElimination(needDelay) -- 检查棋盘 local find, pathList = self:findAttention() if not find then -- 如果没找到,就要打乱棋盘 - local changeInfo = self:shuffleBoard() - if changeInfo then - self.battleData:setGridEntitiesPosId(changeInfo) - self.battleUI:shuffleBoard(changeInfo, function() - self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ELIMINATION - end) - else - local resetList = {} - for posId, entity in pairs(self.battleData:getGridEnties()) do - if entity:isEmptyIdle() then - table.insert(resetList, posId) - end - end - local resetInfo = self:resetGrids(resetList) - if not resetInfo then - if EDITOR_MODE then - Logger.logHighlight("----- 处于无法消除状态 -----") - end - self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ELIMINATION - else - if self.resetGridSid then - ModuleManager.BattleManager:unscheduleGlobal(self.resetGridSid) - self.resetGridSid = nil - end - - self.resetGridSid = ModuleManager.BattleManager:performWithDelayGlobal(function() - local count = 1 - for posId, info in pairs(resetInfo) do - self.battleData:setGridInfo(posId, info) - self.battleUI:playChangeElementSfx(posId, count) - count = count + 1 - end - self.resetGridSid = nil - self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ELIMINATION - end, 0.5) - end - end + self:shuffleBoard(function() + self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ELIMINATION + end) else self.attentionList = pathList -- ModuleManager.BattleManager:performWithDelayGlobal(function() @@ -523,77 +500,107 @@ function BattleController:enterElimination(needDelay) end end -function BattleController:enterAtkStep() - self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ATK_STEP - self:exeInstructions(function() - self:enterAtkStepOver() - end) +function BattleController:enterBattleStep() + self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_TEAM_ACTION + if not self.battleTeamActionList then + self.battleTeamActionList = {} + else + for i = #self.battleTeamActionList, 1, -1 do + self.battleTeamActionList[i] = nil + end + end + + local atkAction = function() + self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ATK_STEP + self:exeInstructions(function() + self:enterNextTeamAction() + end) + end + + local defAction = function() + self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_DEF_STEP + self.defTeam:mainUnitUseAllSkills(function() + self:enterNextTeamAction() + end) + end + + if self.battleData:getAtkTeam():getFirstHand() < self.battleData:getDefTeam():getFirstHand() then + self:addTeamActionList(defAction, 1) + self:addTeamActionList(atkAction, 2) + else + self:addTeamActionList(atkAction, 1) + self:addTeamActionList(defAction, 2) + end + + self:enterNextTeamAction() +end + +function BattleController:addTeamActionList(func, index) + if not self.battleTeamActionList then + self.battleTeamActionList = {} + end + + index = index or 1 + table.insert(self.battleTeamActionList, index, func) +end + +function BattleController:enterNextTeamAction() + self.atkTeam:onActionOver() + self.defTeam:onActionOver() + + self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_TEAM_ACTION_OVER + self:hideCombo() + + if self:checkTeamIsDead(function() self:enterRoundEnd() end) then + return + end + + if not self.battleTeamActionList or not self.battleTeamActionList[1] then + self:enterRoundEnd() + return + end + + local action = table.remove(self.battleTeamActionList, 1) + action() +end + +function BattleController:checkTeamIsDead(callback) + local atkTeam = self.battleData:getAtkTeam() + if not atkTeam or atkTeam:getIsDead() then -- 英雄死了, 直接结算 + self:enterNextWave() + return true + end + + local defTeam = self.battleData:getDefTeam() + if not defTeam or defTeam:getIsDead() then -- 怪物死了, 直接进入刷新逻辑 + if self.waveIndex >= self.maxWaveIndex then + if callback then + callback() + end + else + self:onDefDead(function() + self.defTeam:removeAllBuff() + if self.battleData:getDefTeam():getIsDead() then + self:_findNextDefUnit() + else + if callback() then + callback() + end + end + end) + end + return true + end + return false end function BattleController:getIsAtkStep() return self.roundStep == BattleConst.BATTLE_ROUND_STEP.ON_ATK_STEP end -function BattleController:enterAtkStepOver() - self:hideCombo() - self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ATK_STEP_OVER - - local defTeam = self.battleData:getDefTeam() - if not defTeam or defTeam:getIsDead() then -- 怪物死了, 直接进入刷新逻辑 - if self.waveIndex >= self.maxWaveIndex then - self:enterRoundEnd() - else - self.defTeam:removeAllBuff() - self:onDefDead() - self:enterRefreshBoard() - end - return - end - - local atkTeam = self.battleData:getAtkTeam() - if not atkTeam or atkTeam:getIsDead() then -- 英雄死了, 直接结算 - self:enterNextWave() - return - end - - self:enterDefStep() -end - -function BattleController:enterDefStep() - self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_DEF_STEP - - self.defTeam:mainUnitUseAllSkills(function() - self:enterDefStepOver() - end) -end - -function BattleController:enterDefStepOver() - self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_DEF_STEP_OVER - - local atkTeam = self.battleData:getAtkTeam() - if not atkTeam or atkTeam:getIsDead() then -- 英雄死了, 直接结算 - self:enterNextWave() - return - end - - local defTeam = self.battleData:getDefTeam() - if not defTeam or defTeam:getIsDead() then -- 怪物死了, 直接进入刷新逻辑 - if self.waveIndex >= self.maxWaveIndex then - self:enterRoundEnd() - else - self.defTeam:removeAllBuff() - self:onDefDead() - self:enterRefreshBoard() - end - return - end - - self:enterRefreshBoard() -end - -function BattleController:enterRefreshBoard() +function BattleController:enterRefreshBoard(isRoundBeginCheck) self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_REFRESH_BOARD - self:fillBoard() + self:fillBoard(isRoundBeginCheck) end function BattleController:enterRoundEnd() @@ -611,9 +618,14 @@ function BattleController:enterRoundEnd() self:enterNextWave() return end + self.atkTeam:onRoundEnd() self.defTeam:onRoundEnd() + if self:checkTeamIsDead(function() self:enterNextWave() end) then + return + end + self:onRoundEnd() end @@ -996,14 +1008,14 @@ function BattleController:onLinkOver() self.battleUI:disableUITouch() self.battleUI:eliminationAni(sequence, function() self:generateInstructions(skillEntity, linkElementType, lineCount, influenceElementType, elementTypeMap) - self:enterAtkStep() + self:enterRefreshBoard() end) self.eliminateCount = self.eliminateCount + 1 self.eliminateTotalCount = self.eliminateTotalCount + 1 end -function BattleController:fillBoard() +function BattleController:fillBoard(isRoundBeginCheck) local pathMap = {} local columnCount = {} local gridMap = {} @@ -1046,29 +1058,24 @@ function BattleController:fillBoard() end end - self.battleUI:fallGrid(pathMap, function() - self:onFillBoardOver() + self.battleUI:fallGrid(pathMap, isRoundBeginCheck, function() + self:onFillBoardOver(isRoundBeginCheck) self.battleUI:enableUITouch() end) end -function BattleController:onFillBoardOver() - EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.BOARD_FILL_OVER) - - self:generateSkill(function() - self.battleUI:refreshSkill() - local defTeam = self.battleData:getDefTeam() - if not defTeam or defTeam:getIsDead() then -- 怪物死了, 直接进入刷新逻辑 - if self.waveIndex >= self.maxWaveIndex then - self:enterRoundEnd() - else - self:_findNextDefUnit() - end - return - else - self:enterRoundEnd() - end - end) +function BattleController:onFillBoardOver(isRoundBeginCheck) + if isRoundBeginCheck then + EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.BOARD_FILL_OVER) + self:popBoardCacheSkill(function() + self:enterElimination(true) + end) + else + self:generateSkill(function() + self.battleUI:refreshSkill() + self:enterBattleStep() + end) + end end function BattleController:generateInstructions(skillEntity, elementType, lineCount, influenceElementTypeMap, elementTypeMap) @@ -1567,7 +1574,7 @@ function BattleController:findSkillInfluenceGrids() if skillId then local skillEntity = self.battleData:getSkillEntityBySkillId(skillId) if skillEntity then - BATTLE_BOARD_SKILL_HANDLE.activeBoardSkill(info.posId, skillEntity, self.battleData:getGridEnties(), sequenceEntities) + BATTLE_BOARD_SKILL_HANDLE.activeBoardSkill(info.posId, skillEntity, self.battleData:getGridEnties(), sequenceEntities, self) end end end @@ -1702,21 +1709,54 @@ function BattleController:onSelectSkill(skillId, value, pos) end function BattleController:changeElementType(count, elementType) - local list = {} + local map = {} for _, entity in pairs(self.battleData:getGridEnties()) do if entity:canChangeInfo() and entity:getElementType() ~= elementType then - table.insert(list, entity) + map[entity] = elementType + count = count - 1 + if count <= 0 then + break + end end end - for i = 1, count do - if not list[1] then - break - end - local entity = table.remove(list, math.random(1, #list)) - if entity then - self.battleData:setGridInfo(entity:getPosId(), {gridType = entity:getGridType(), elementType = elementType}) - self.battleUI:playChangeElementSfx(entity:getPosId(), i) + self:changeElementTypeByMap(map) +end + +function BattleController:changeElementTypeByMap(changeMap) + local index = 1 + for entity, elementType in pairs(changeMap) do + self.battleData:setGridInfo(entity:getPosId(), {gridType = entity:getGridType(), elementType = elementType}) + self.battleUI:playChangeElementSfx(entity:getPosId(), index) + index = index + 1 + end +end + +function BattleController:killGrids(posIdList) + if not posIdList[1] then + return + end + + for _, posId in ipairs(posIdList) do + local entity = DataManager.BattleData:getGridEntity(posId) + entity:setIsIdle(true) + end + + self.battleUI:removeGridOutOfScreen(posIdList) +end + +function BattleController:killRowOrColumn(infoList) + local map = {} + for _, info in ipairs(infoList) do + if info.posList then + for i, posId in ipairs(info.posList) do + if not map[posId] then + map[posId] = true + local entity = DataManager.BattleData:getGridEntity(posId) + entity:setIsIdle(true) + end + end + self.battleUI:removeGridOutOfScreen(info.posList) end end end @@ -1773,7 +1813,49 @@ function BattleController:showAttention() end, 2) end -function BattleController:shuffleBoard() +function BattleController:shuffleBoard(callback) + local changeInfo = self:getShuffleBoardInfo() + if changeInfo then + self.battleData:setGridEntitiesPosId(changeInfo) + self.battleUI:shuffleBoard(changeInfo, callback) + else + local resetList = {} + for posId, entity in pairs(self.battleData:getGridEnties()) do + if entity:isEmptyIdle() then + table.insert(resetList, posId) + end + end + local resetInfo = self:resetGrids(resetList) + if not resetInfo then + if EDITOR_MODE then + Logger.logHighlight("----- 处于无法消除状态 -----") + end + if callback then + callback() + end + else + if self.resetGridSid then + ModuleManager.BattleManager:unscheduleGlobal(self.resetGridSid) + self.resetGridSid = nil + end + + self.resetGridSid = ModuleManager.BattleManager:performWithDelayGlobal(function() + local count = 1 + for posId, info in pairs(resetInfo) do + self.battleData:setGridInfo(posId, info) + self.battleUI:playChangeElementSfx(posId, count) + count = count + 1 + end + self.resetGridSid = nil + if callback then + callback() + end + end, 0.5) + end + end +end + +function BattleController:getShuffleBoardInfo() local posList = {} local gridEntityList = {} local anySkillList = {} @@ -2111,8 +2193,17 @@ function BattleController:findLinkLine(posId, posIdMap, hadSkill, mainElementTyp return hadSkill end -function BattleController:randomDisruptionBoard() - +function BattleController:generateMonsterById(monsterId, callback) + local unitEntity = DataManager.BattleData:addMonster(monsterId, true) + local modelId = unitEntity:getModelId() + BattleHelper:loadBattleHeroModel(modelId, self.battleUI:getBattleNode(), function(spineObject) + self.defTeam:removeAllUnits() + local monsterComp = spineObject:addLuaComponent(GConst.BattleConst.TYPEOF_LUA_COMP.BATTLE_MONSTER_COMPONENT) + monsterComp:initWithEntity(modelId, unitEntity, self) + self.defTeam:addUnit(monsterComp, true) + self.battleUI:refreshDefHp(unitEntity:getHp(), unitEntity:getHpPercent()) + monsterComp:playEnterBattlefield(false, callback) + end) end function BattleController:addBattleExp(exp) @@ -2274,7 +2365,7 @@ local function _assisting(self, instruction, callback) end local function _generalAttack(self, instruction, callback) - self.atkTeam:useNormalSkill(instruction.skillMatch, instruction.count, #self.instructions == 0, callback) + self.atkTeam:useNormalSkill(instruction.skillMatch, instruction.count, #self.instructions == 0, BattleConst.EFFECT_TYPE.DIRECT, callback) end local function _playSkill(self, instruction, callback) diff --git a/lua/app/module/battle/helper/battle_buff_handle.lua b/lua/app/module/battle/helper/battle_buff_handle.lua index 74e9b46c..d59f4d39 100644 --- a/lua/app/module/battle/helper/battle_buff_handle.lua +++ b/lua/app/module/battle/helper/battle_buff_handle.lua @@ -36,6 +36,8 @@ function BattleBuffHandle.doBuffWork(unitComp, buffEffect) _doDotWork(unitComp, buffEffect, buff) elseif buffType == 6 then _doHotWork(unitComp, buffEffect, buff) + elseif buffType == 7 then -- 特殊buff + BattleBuffSpecial.specialBuffWork(unitComp, buffEffect, buff) end local fxList = buff:getFxTake() if fxList then @@ -45,14 +47,16 @@ function BattleBuffHandle.doBuffWork(unitComp, buffEffect) end end -function BattleBuffHandle.removeBuff(unitComp, buffEffect) +function BattleBuffHandle.removeBuff(unitComp, buffEffect, noRecycle) local buff = buffEffect.buff local buffType = buff:getBuffType() local func = BattleBuffHandle.removeEffect[buffType] if func then func(buffEffect.sender, unitComp, buff, buffEffect) end - BattleHelper:recycleBuffEffect(buffEffect) + if not noRecycle then + BattleHelper:recycleBuffEffect(buffEffect) + end end BattleBuffHandle.addAttribute = { @@ -73,6 +77,12 @@ BattleBuffHandle.addAttribute = { [BUFF_NAME.HPP_ADD] = function(target, num) target:addMaxHp(num) end, + [BUFF_NAME.DEATH_SUMMON] = function(target, num) + if num < 0 then + num = 0 + end + target.unitEntity:setAttr(ATTR_NAME.DEATH_SUMMON, num) + end } local function _takeEffectDirectHurt(unitComp, buff, target, buffEffect) @@ -118,7 +128,7 @@ local function _takeEffectAttr(unitComp, buff, target, buffEffect) end local function _takeEffectControl(unitComp, buff, target, buffEffect) - target.unitEntity:addLimit(buff:getName()) + target.unitEntity:addLimit(buff:getName(), buffEffect) return true end diff --git a/lua/app/module/battle/helper/battle_buff_special.lua b/lua/app/module/battle/helper/battle_buff_special.lua index 91946990..2aa6940e 100644 --- a/lua/app/module/battle/helper/battle_buff_special.lua +++ b/lua/app/module/battle/helper/battle_buff_special.lua @@ -1,9 +1,11 @@ local BattleConst = require "app/module/battle/battle_const" +local BattleFormula = require "app/module/battle/helper/battle_formula" local BattleBuffSpecial = {} local BUFF_NAME = BattleConst.BUFF_NAME local ATTR_NAME = BattleConst.ATTR_NAM +local EFFECT_TYPE = BattleConst.EFFECT_TYPE local function _addSkillOn(unitComp, buff, target, buffEffect) return target:addSkill(buff:getEffectNum()) @@ -25,14 +27,81 @@ local function _skillFireTimesOff(buffSender, target, buff, buffEffect) return 1 end +local function _bleedOn(buffSender, buff, target, buffEffect) + return target.unitEntity:addAttr(BattleConst.ATTR_NAME.BE_SUCKED, 1000, false) -- 写死10% +end + +local function _bleedOff(buffSender, target, buff, buffEffect) + target.unitEntity:addAttr(BattleConst.ATTR_NAME.BE_SUCKED, -1000, false) -- 写死10% + return 1 +end + +local function _bleedWork(unitComp, buffEffect, buff) + local damage, hurtStatus = BattleFormula:getDamageOrCureResult(buffEffect.sender, buff, unitComp) + if damage <= 0 then + damage = -1 + else + damage = -damage + end + unitComp:takeDamageOrCure(buffEffect.sender, damage, EFFECT_TYPE.DOT, hurtStatus) + return 1 +end + +local function _undeadOn(buffSender, buff, target, buffEffect) + return target.unitEntity:setUndeadHp(1) -- 写死1 +end + +local function _undeadOff(buffSender, target, buff, buffEffect) + target.unitEntity:setUndeadHp(0) -- 写死0 + return 1 +end + +local function _imprisonOn(buffSender, buff, target, buffEffect) + target.unitEntity:addActiveSkillLimit(buff:getName()) + return 1 +end + +local function _imprisonOff(buffSender, target, buff, buffEffect) + target.unitEntity:removeActiveSkillLimit(buff:getName()) + return 1 +end + +local function _frozenOn(buffSender, buff, target, buffEffect) + if not target.unitEntity:getIsFrozen() then + target:putCacheBuffByDecr(BattleConst.BUFF_DECR_TYPE.INCREASE_GAIN) + end + target.unitEntity:addLimit(buff:getName(), buffEffect) + return 1 +end + +local function _frozenOff(buffSender, target, buff, buffEffect) + target.unitEntity:removeLimit(buff:getName(), buffEffect) + if not target.unitEntity:getIsFrozen() then + target:popCacheBuffByDecr(BattleConst.BUFF_DECR_TYPE.INCREASE_GAIN) + end + return 1 +end + local _handleOn = { [BUFF_NAME.ADD_SKILL] = _addSkillOn, -- 添加技能 [BUFF_NAME.SKILL_FIRE_TIMES] = _skillFireTimesOn, -- 技能额外使用次数 + [BUFF_NAME.BLEED] = _bleedOn, -- 流血 + [BUFF_NAME.UNDEAD] = _undeadOn, -- 不死 + [BUFF_NAME.IMPRISON] = _imprisonOn, -- 禁锢 + [BUFF_NAME.FROZEN] = _frozenOn, -- 冻结 } local _handleOff = { [BUFF_NAME.ADD_SKILL] = _addSkillOff, -- 添加技能 [BUFF_NAME.SKILL_FIRE_TIMES] = _skillFireTimesOff, -- 技能额外使用次数 + [BUFF_NAME.BLEED] = _bleedOff, -- 流血 + [BUFF_NAME.UNDEAD] = _undeadOff, -- 不死 + [BUFF_NAME.IMPRISON] = _imprisonOff, -- 禁锢 + [BUFF_NAME.FROZEN] = _frozenOff, -- 冻结 +} + +local _handleWork = { + [BUFF_NAME.BLEED] = _bleedWork, -- 流血 } -- 特殊buff添加时 @@ -52,4 +121,12 @@ function BattleBuffSpecial.specialBuffOff(buffSender, target, buff, buffEffect) end end +-- 特殊buff生效 +function BattleBuffSpecial.specialBuffWork(unitComp, buffEffect, buff) + local func = _handleWork[buff:getName()] + if func then + func(unitComp, buffEffect, buff) + end +end + return BattleBuffSpecial \ No newline at end of file diff --git a/lua/app/module/battle/helper/battle_formula.lua b/lua/app/module/battle/helper/battle_formula.lua index 03f9e73e..a2a48839 100644 --- a/lua/app/module/battle/helper/battle_formula.lua +++ b/lua/app/module/battle/helper/battle_formula.lua @@ -15,11 +15,16 @@ function BattleFormula:getDamageOrCureResult(unitComp, buff, targetUnitComp) end BattleFormula.calculateFormula = { - -- (攻击)*技能倍率*(1+(攻击者元素伤害增加+所有伤害增加)(攻击者)+(受到元素伤害增加+受到所有伤害增加(受击)-受到元素伤害降低-受到所有伤害降低(受击)*暴击伤害 + -- (攻击)*技能倍率*(1+(攻击者元素伤害增加+所有伤害增加)(攻击者)- (攻击者元素伤害降低+所有伤害降低) +(受到元素伤害增加+受到所有伤害增加(受击)-受到元素伤害降低-受到所有伤害降低(受击) + 主动技能增伤)*暴击伤害 [1] = function(unitComp, buff, targetUnit) + local skillHurtAdd = 0 + local hostSkill = buff:getHostSkill() + if hostSkill and hostSkill:getIsActiveType() and unitComp.unitEntity:getSkillHurt() > 0 then -- 是主动技能携带的buff,且拥有技能伤害加成 + skillHurtAdd = unitComp.unitEntity:getSkillHurt() + end local matchType = unitComp.unitEntity:getMatchType() local result = unitComp.unitEntity:getAtk() * buff:getEffectNum() // DEFAULT_FACTOR * - (DEFAULT_FACTOR + unitComp.unitEntity:getDmgAddition() + targetUnit.unitEntity:getWeakness(matchType) - targetUnit.unitEntity:getDmgDec(matchType)) // DEFAULT_FACTOR + (DEFAULT_FACTOR + unitComp.unitEntity:getDmgAddition() - unitComp.unitEntity:getDmgDec() + targetUnit.unitEntity:getWeakness(matchType) - targetUnit.unitEntity:getDecDmg(matchType) + skillHurtAdd) // DEFAULT_FACTOR local hurtState = 0 local crit = unitComp.unitEntity:getCrit() if crit > 0 then @@ -32,14 +37,21 @@ BattleFormula.calculateFormula = { end, -- 生命值*回合开始时的回血系数*(1 + 治疗效果增加) [2] = function(unitComp, buff, targetUnit) - local result = targetUnit.unitEntity:getMaxHp() * buff:getEffectNum() // DEFAULT_FACTOR * (unitComp.unitEntity:getCureAddition() + DEFAULT_FACTOR) // DEFAULT_FACTOR + local result = targetUnit.unitEntity:getMaxHp() * buff:getEffectNum() // DEFAULT_FACTOR * (unitComp.unitEntity:getCureAddition() - unitComp.unitEntity:getCureDec() + DEFAULT_FACTOR) // DEFAULT_FACTOR return result, 0 end, -- 角色攻击力*技能倍率*(1+治疗效果增加) [3] = function(unitComp, buff, targetUnit) - local result = unitComp.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() - unitComp.unitEntity:getCureDec() + DEFAULT_FACTOR) // DEFAULT_FACTOR return result, 0 - end + end, + -- 释放者攻击*技能系数*(1+(攻击者元素伤害增加+所有伤害增加-攻击者元素伤害降低-所有伤害降低+受到元素伤害增加+受到所有伤害增加(受击)-受到元素伤害降低-受到所有伤害降低(受击)) + [4] = function(unitComp, buff, targetUnit) + local matchType = unitComp.unitEntity:getMatchType() + local result = unitComp.unitEntity:getAtk() * buff:getEffectNum() // DEFAULT_FACTOR * + (DEFAULT_FACTOR + unitComp.unitEntity:getDmgAddition() - unitComp.unitEntity:getDmgDec() + targetUnit.unitEntity:getWeakness(matchType) - targetUnit.unitEntity:getDecDmg(matchType)) // DEFAULT_FACTOR + return result, 0 + end, } return BattleFormula \ No newline at end of file diff --git a/lua/app/module/battle/helper/battle_passive.lua b/lua/app/module/battle/helper/battle_passive.lua index 8a2ae9e5..a023ba49 100644 --- a/lua/app/module/battle/helper/battle_passive.lua +++ b/lua/app/module/battle/helper/battle_passive.lua @@ -49,12 +49,17 @@ local function _checkActiveSkillHit(unitComp, skill, targetComp) return 1 end +local function _checkOnDead(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, + [PASSIVE_EVENT.ON_DEAD] = _checkOnDead, } return BattlePassive \ No newline at end of file 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 429b586e..d4f61ced 100644 --- a/lua/app/module/battle/skill/battle_board_skill_handle.lua +++ b/lua/app/module/battle/skill/battle_board_skill_handle.lua @@ -5,7 +5,7 @@ local BattleBoardSkillHandle = {} local SKILL_TYPE = BattleConst.SKILL_TYPE local SKILL_METHOD_TYPE = BattleConst.SKILL_METHOD_TYPE -local function _takeElimination(posId, skillEntity, gridEntities, sequenceEntities) +local function _takeElimination(posId, skillEntity, gridEntities, sequenceEntities, battleController) local boardrange = skillEntity:getBoardRange() if boardrange then local cludePosIdsMap = {} @@ -27,7 +27,7 @@ local function _takeElimination(posId, skillEntity, gridEntities, sequenceEntiti end end -local function _takeChangeAround(posId, skillEntity, gridEntities, sequenceEntities) +local function _takeChangeAround(posId, skillEntity, gridEntities, sequenceEntities, battleController) local boardrange = skillEntity:getBoardRange() if boardrange then local cludePosIdsMap = {} @@ -46,7 +46,13 @@ local function _takeChangeAround(posId, skillEntity, gridEntities, sequenceEntit end end -local function _takeEliminationGridAndElement(posId, skillEntity, gridEntities, sequenceEntities) +local function _taleReleaseGridType(atkUnitComp, skillEntity, battleController) + if skillEntity:getEliminateSkillParameter() then + battleController:generateGridType(skillEntity:getEliminateSkillParameter(), atkUnitComp:getBaseObject():getTransform().position) + end +end + +local function _takeEliminationGridAndElement(posId, skillEntity, gridEntities, sequenceEntities, battleController) local boardrange = skillEntity:getBoardRange() if boardrange then local cludePosIdsMap = {} @@ -68,20 +74,204 @@ local function _takeEliminationGridAndElement(posId, skillEntity, gridEntities, end end +local function _takeChangeAllElementType(atkUnitComp, skillEntity, battleController) + local battleData = battleController.battleData + if not battleData or not battleData:getGridEnties() then + return + end + + local elementMap = {} + for k, v in pairs(BattleConst.ELEMENT_TYPE) do + if v ~= BattleConst.ELEMENT_TYPE.NONE then + elementMap[v] = {list = {}, count = 0} + for k2, v2 in pairs(BattleConst.ELEMENT_TYPE) do + if v2 ~= BattleConst.ELEMENT_TYPE.NONE and v2 ~= v then + table.insert(elementMap[v].list, v2) + elementMap[v].count = elementMap[v].count + 1 + end + end + end + end + + local map = {} + for posId, entity in pairs(battleData:getGridEnties()) do + if entity:isEmptyIdle() then + local eType = entity:getElementType() + if elementMap[eType] and elementMap[eType].count > 0 then + map[entity] = elementMap[eType].list[math.random(1, elementMap[eType].count)] + end + end + end + + battleController:changeElementTypeByMap(map) +end + +local function _takeRandomKillSkillGrid(atkUnitComp, skillEntity, battleController) + local battleData = battleController.battleData + if not battleData or not battleData:getGridEnties() or not skillEntity:getEliminateSkillParameter() then + return + end + + local count = skillEntity:getEliminateSkillParameter()[1] + if count <= 0 then + return + end + + local list = {} + local listCount = 0 + for posId, entity in pairs(battleData:getGridEnties()) do + if entity:getSkillId() and not entity:getIsIdle() then + table.insert(list, posId) + listCount = listCount + 1 + end + end + + if listCount > count then + local removeCount = listCount - count + for i = 1, removeCount do + table.remove(list, math.random(1, listCount)) + listCount = listCount - 1 + end + end + + battleController:killGrids(list) +end + +local function _takeShuffleBoard(atkUnitComp, skillEntity, battleController) + local battleData = battleController.battleData + if not battleData or not battleData:getGridEnties() then + return + end + + battleController:shuffleBoard() +end + +local function _takeRandomKillRowOrColumn(atkUnitComp, skillEntity, battleController) + local battleData = battleController.battleData + if not battleData or not battleData:getGridEnties() or not skillEntity:getEliminateSkillParameter() then + return + end + + local count = skillEntity:getEliminateSkillParameter()[1] + if count <= 0 then + return + end + + local listCount = 0 + local list = {} + local rowMap = {} + local columnMap = {} + for posId, entity in pairs(battleData:getGridEnties()) do + if entity:isEmptyIdle() then + local rc = ModuleManager.BattleManager:getPosRC(posId) + local r = rc.r + local c = rc.c + if not rowMap[r] then + table.insert(list, {r = r}) + listCount = listCount + 1 + rowMap[r] = {} + end + if not columnMap[c] then + table.insert(list, {c = c}) + listCount = listCount + 1 + columnMap[c] = {} + end + table.insert(rowMap[r], posId) + table.insert(columnMap[c], posId) + end + end + + local infoList = {} + for i = 1, count do + if not list[1] then + break + end + local info = table.remove(list, math.random(1, listCount)) + listCount = listCount - 1 + if info.r then + info.posList = rowMap[info.r] + elseif info.c then + info.posList = columnMap[info.c] + end + if info.posList then + table.insert(infoList, info) + end + end + + battleController:killRowOrColumn(infoList) +end + +local function _takeRandomKillElementAndHeal(atkUnitComp, skillEntity, battleController) + local battleData = battleController.battleData + if not battleData or not battleData:getGridEnties() or not skillEntity:getEliminateSkillParameter() then + return + end + + local effectNum = skillEntity:getEliminateSkillParameter()[1] + if not effectNum or effectNum <= 0 then + return + end + + local elementMap = {} + local list = {} + for posId, entity in pairs(battleData:getGridEnties()) do + if entity:isEmptyIdle() then + local elementType = entity:getElementType() + if not elementMap[elementType] then + elementMap[elementType] = {} + table.insert(list, elementType) + end + table.insert(elementMap[elementType], posId) + end + end + + if not list[1] then + return + end + + local elementType = list[math.random(1, #list)] + list = elementMap[elementType] + local count = #list + local heal = count * effectNum * atkUnitComp.unitEntity:getAtk() // GConst.BattleConst.DEFAULT_FACTOR + atkUnitComp:takeDamageOrCure(atkUnitComp, heal, BattleConst.EFFECT_TYPE.HEAL, 0) + + battleController:killGrids(list) +end + BattleBoardSkillHandle._activeBoardSkill = { [SKILL_TYPE.ELIMINATION] = _takeElimination, [SKILL_TYPE.CHANGE_AROUND] = _takeChangeAround, [SKILL_TYPE.ELIMINATION_GRID_AND_ELEMENT] = _takeEliminationGridAndElement, } -function BattleBoardSkillHandle.activeBoardSkill(posId, skillEntity, gridEntities, sequenceEntities) +BattleBoardSkillHandle._activeAttackOverSkill = { + [SKILL_TYPE.RELEASE_GRID_TYPE] = _taleReleaseGridType, + [SKILL_TYPE.CHANGE_ALL_ELEMENT_TYPE] = _takeChangeAllElementType, + [SKILL_TYPE.RANDOM_KILL_SKILL_GRID] = _takeRandomKillSkillGrid, + [SKILL_TYPE.SHUFFLE_BOARD] = _takeShuffleBoard, + [SKILL_TYPE.RANDOM_KILL_ROW_OR_COLUMN] = _takeRandomKillRowOrColumn, + [SKILL_TYPE.RANDOM_KILL_ELEMENT_AND_HEAL] = _takeRandomKillElementAndHeal, +} + +function BattleBoardSkillHandle.activeBoardSkill(posId, skillEntity, gridEntities, sequenceEntities, battleController) if not skillEntity then return end local func = BattleBoardSkillHandle._activeBoardSkill[skillEntity:getSkillType()] if func then - func(posId, skillEntity, gridEntities, sequenceEntities) + func(posId, skillEntity, gridEntities, sequenceEntities, battleController) + end +end + +function BattleBoardSkillHandle.activeAttackOverSkill(atkUnitComp, skillEntity, battleController) + if not skillEntity then + return + end + + local func = BattleBoardSkillHandle._activeAttackOverSkill[skillEntity:getEliminateSkillType()] + if func then + func(atkUnitComp, skillEntity, battleController) 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 4e19551d..c910328a 100644 --- a/lua/app/module/battle/skill/battle_rogue_skill_handle.lua +++ b/lua/app/module/battle/skill/battle_rogue_skill_handle.lua @@ -180,7 +180,6 @@ local _addSkillRound = function(skillInfo, battleData, battleController) battleData.atkTeam:getAllMembers()[elementType]:addSkillRound(skillId, effect) end end - Logger.logHighlight("------addSkillRound------ " .. elementType .. " " .. json.encode(effect)) end local _addSkillEffect = function(skillInfo, battleData, battleController) diff --git a/lua/app/module/battle/team/battle_team.lua b/lua/app/module/battle/team/battle_team.lua index 41253e69..7b56959e 100644 --- a/lua/app/module/battle/team/battle_team.lua +++ b/lua/app/module/battle/team/battle_team.lua @@ -14,6 +14,7 @@ function BattleTeam:init(side, battleController) self.shieldBuffList = {} self.loopFxMap = {} self.comboCount = 0 + self.cacheBuffDecr = {} end function BattleTeam:addUnit(unit, isMainUnit) @@ -57,7 +58,7 @@ function BattleTeam:removeAllUnits() self.mainUnit = nil end -function BattleTeam:useNormalSkill(matchType, count, isFinalAction, callback) +function BattleTeam:useNormalSkill(matchType, count, isFinalAction, effectType, callback) self.isFinalAction = isFinalAction local unit = nil if matchType == nil then @@ -72,9 +73,9 @@ function BattleTeam:useNormalSkill(matchType, count, isFinalAction, callback) return callback() end self.mainUnit = unit - unit:beforeAttack() + unit:beforeAttack(effectType) unit:resetBeforeAttack() - unit:useNormalSkill(count, callback) + unit:useNormalSkill(count, effectType, callback) end function BattleTeam:useSkill(matchType, count, isFinalAction, callback) @@ -228,11 +229,62 @@ function BattleTeam:handleShield(reduceShield, unit) end function BattleTeam:addBuff(buffEffect) - table.insert(self.buffList, buffEffect) - self:updateBuffState(buffEffect.buff, 1) - if buffEffect.buff:getIcon() then - self.battleController:refreshBuff(self.side, self.buffList) + local stack = buffEffect.buff:getStack() + local needRecycle + if not stack or stack == BattleConst.BUFF_STACK_TYPE.CANT_ADD then + local buffName = buffEffect.buff:getName() + local buffNum = self.sameBuffCount[buffName] + if buffNum and buffNum > 0 then + for _, bEffect in ipairs(self.buffList) do + if bEffect.buff:getName() == buffName then + if bEffect.round < buffEffect.round then + bEffect.round = buffEffect.round + for fieldName, v in pairs(bEffect) do + if fieldName ~= "buff" and fieldName ~= "round" and fieldName ~= "result" then + bEffect[fieldName] = buffEffect[fieldName] + end + end + needRecycle = bEffect + break + else + return bEffect + end + end + end + end + elseif stack == BattleConst.BUFF_STACK_TYPE.ADD_ROUND then + local buffName = buffEffect.buff:getName() + local buffNum = self.sameBuffCount[buffName] + if buffNum and buffNum > 0 then + for _, bEffect in ipairs(self.buffList) do + if bEffect.buff:getName() == buffName then + bEffect.round = bEffect.round + buffEffect.round + for fieldName, v in pairs(bEffect) do + if fieldName ~= "buff" and fieldName ~= "round" and fieldName ~= "result" then + bEffect[fieldName] = buffEffect[fieldName] + end + end + needRecycle = bEffect + break + end + end + end + elseif stack == BattleConst.BUFF_STACK_TYPE.ADD then end + + if needRecycle then + BattleHelper:recycleBuffEffect(buffEffect) + else + table.insert(self.buffList, buffEffect) + self:updateBuffState(buffEffect.buff, 1) + if buffEffect.buff:getIcon() then + self.battleController:refreshBuff(self.side, self.buffList) + end + + needRecycle = buffEffect + end + + return needRecycle end function BattleTeam:removeAllBuff() @@ -246,10 +298,119 @@ function BattleTeam:removeAllBuff() BattleBuffHandle.removeBuff(self.mainUnit, buffEffect) end end + + if self.cacheBuffDecr then + for decr, list in pairs(self.cacheBuffDecr) do + count = #list + for i = count, 1, -1 do + buffEffect = self.cacheBuffDecr[decr][i] + table.remove(self.cacheBuffDecr[decr], i) + BattleHelper:recycleBuffEffect(buffEffect) + end + end + end + self.battleController:clearBuff(self.side) end +function BattleTeam:putCacheBuff(buffEffect) + local buffDecr = buffEffect.buff:getDecr() + if not self.cacheBuffDecr[buffDecr] then + self.cacheBuffDecr[buffDecr] = {} + end + table.insert(self.cacheBuffDecr[buffDecr], buffEffect) +end + +function BattleTeam:putCacheBuffByDecr(buffDecr) + if not buffDecr then + return + end + + local needRefresh = false + local buffEffect = nil + local count = #self.buffList + for i = count, 1, -1 do + buffEffect = self.buffList[i] + if buffEffect and buffEffect.buff:getDecr() == buffDecr then + self:updateBuffState(buffEffect.buff, -1) + table.remove(self.buffList, i) + BattleBuffHandle.removeBuff(self.mainUnit, buffEffect, true) + if not self.cacheBuffDecr[buffDecr] then + self.cacheBuffDecr[buffDecr] = {} + end + + table.insert(self.cacheBuffDecr[buffDecr], buffEffect) + if buffEffect.buff:getIcon() then + needRefresh = true + end + end + end + + if needRefresh then + self.battleController:refreshBuff(self.side, self.buffList) + end +end + +function BattleTeam:popCacheBuffByDecr(buffDecr) + if not buffDecr or not self.cacheBuffDecr or not self.cacheBuffDecr[buffDecr] then + return + end + + local list = self.cacheBuffDecr[buffDecr] + + local needRefresh = false + local count = #list + local buffEffect + for i = count, 1, -1 do + buffEffect = self.cacheBuffDecr[buffDecr][i] + self:getMainUnit():reTakeEffectByBuffEffect(buffEffect) + table.remove(self.cacheBuffDecr[buffDecr]) + if buffEffect.buff:getIcon() then + needRefresh = true + end + end + + if needRefresh then + self.battleController:refreshBuff(self.side, self.buffList) + end +end + function BattleTeam:doBuffWork() + local count = nil + local buffEffect = nil + if self.cacheBuffDecr then + for decr, list in pairs(self.cacheBuffDecr) do + count = #list + for i = count, 1, -1 do + buffEffect = self.cacheBuffDecr[decr][i] + buffEffect.round = buffEffect.round - 1 + if buffEffect.round <= 0 then + table.remove(self.cacheBuffDecr[decr], i) + BattleHelper:recycleBuffEffect(buffEffect) + end + end + end + end + + count = #self.buffList + if count <= 0 then + return + end + buffEffect = nil + for i = count, 1, -1 do + buffEffect = self.buffList[i] + buffEffect.round = buffEffect.round - 1 + BattleBuffHandle.doBuffWork(self.mainUnit, buffEffect) + if buffEffect.round <= 0 then + self:updateBuffState(buffEffect.buff, -1) + table.remove(self.buffList, i) + BattleBuffHandle.removeBuff(self.mainUnit, buffEffect) + end + end + self.battleController:refreshBuff(self.side, self.buffList) +end + +function BattleTeam:removeBuffByName(buffName) local count = #self.buffList if count <= 0 then return @@ -257,9 +418,7 @@ function BattleTeam:doBuffWork() local buffEffect = nil for i = count, 1, -1 do buffEffect = self.buffList[i] - buffEffect.round = buffEffect.round - 1 - BattleBuffHandle.doBuffWork(self.mainUnit, buffEffect) - if buffEffect.round <= 0 then + if buffEffect.buff:getName() == buffName then self:updateBuffState(buffEffect.buff, -1) table.remove(self.buffList, i) BattleBuffHandle.removeBuff(self.mainUnit, buffEffect) @@ -284,7 +443,7 @@ function BattleTeam:updateBuffState(buff, num) self.loopFxMap[res] = count - 1 if count == 1 then for k2, v2 in ipairs(self.unitList) do - v2:removeEffect(res) + v2:removeFx(res) end end end @@ -378,6 +537,27 @@ function BattleTeam:addCombo() self.battleController:showCombo(self.comboCount) end +function BattleTeam:onActionOver() + -- 处理反击 + local counterAttackCount = self:getMainUnit().unitEntity:getCounterAttackCount() + if counterAttackCount <= 0 then + return + end + self:getMainUnit().unitEntity:clearCounterAttackCount() + + local teamAction = function() + self.battleController.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ATK_STEP + self.battleController.curTeam = self.battleController.atkTeam + ---- 普攻 + local skillMatch = self:getMainUnit().unitEntity:getMatchType() + self:useNormalSkill(skillMatch, counterAttackCount, true, BattleConst.EFFECT_TYPE.COUNTERATTACK, function() + self.battleController:enterNextTeamAction() + end) + end + self.battleController:addTeamActionList(teamAction, 1) + self.comboCount = 0 +end + function BattleTeam:tick(dt) for k, v in ipairs(self.unitList) do v:tick(dt) diff --git a/lua/app/ui/battle/battle_ui.lua b/lua/app/ui/battle/battle_ui.lua index aff5a1fd..d28929cf 100644 --- a/lua/app/ui/battle/battle_ui.lua +++ b/lua/app/ui/battle/battle_ui.lua @@ -1112,8 +1112,20 @@ function BattleUI:shuffleBoard(changeInfo, callback) end) end -function BattleUI:fallGrid(listInfo, callback) - self:showMask(false) +function BattleUI:removeGridOutOfScreen(posIdList) + for _, posId in ipairs(posIdList) do + local entity = DataManager.BattleData:getGridEntity(posId) + local cell = entity:getCell() + cell:getBaseObject():setAnchoredPositionX(DEFAULT_X) + end +end + +function BattleUI:fallGrid(listInfo, isRoundBeginCheck, callback) + if isRoundBeginCheck then + self:showMask(false) + else + self.boardMask:getTransform():SetAsLastSibling() + end self.fallAniCount = 0 for posId, info in pairs(listInfo) do self.fallAniCount = self.fallAniCount + 1 @@ -1573,14 +1585,6 @@ function BattleUI:initSkillLineSfx() self.skillLightSfxs[25] = uiMap["battle_ui.bg_2.board_node.grid_node.sfx_skill_b05_5"] end - if not self.changeElementSfxs then - self.changeElementSfxs = {} - self.changeElementSfxs[1] = uiMap["battle_ui.bg_2.board_node.grid_node.sfx_skill_b02_1"] - self.changeElementSfxs[2] = uiMap["battle_ui.bg_2.board_node.grid_node.sfx_skill_b02_2"] - self.changeElementSfxs[3] = uiMap["battle_ui.bg_2.board_node.grid_node.sfx_skill_b02_3"] - self.changeElementSfxs[4] = uiMap["battle_ui.bg_2.board_node.grid_node.sfx_skill_b02_4"] - end - for _, obj in pairs(self.skillLineSfxs) do obj:setActive(true) obj:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_EFFECT_HELPER):SetSortingOrder(self:getUIOrder(), GConst.UI_EFFECT_ORDER.LEVEL2) @@ -1592,12 +1596,6 @@ function BattleUI:initSkillLineSfx() obj:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_EFFECT_HELPER):SetSortingOrder(self:getUIOrder(), GConst.UI_EFFECT_ORDER.LEVEL2) obj:setActive(false) end - - for _, obj in pairs(self.changeElementSfxs) do - obj:setActive(true) - obj:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_EFFECT_HELPER):SetSortingOrder(self:getUIOrder(), GConst.UI_EFFECT_ORDER.LEVEL2) - obj:setActive(false) - end end function BattleUI:playSkillLineSfx(posId, boradRangeList, randomPosList) @@ -1666,16 +1664,28 @@ function BattleUI:playSkillLineSfx(posId, boradRangeList, randomPosList) end function BattleUI:playChangeElementSfx(posId, index) - if not self.changeElementSfxs then - return + if not self.root.changeElementSfxs then + self.root.changeElementSfxs = {} end local pos = ModuleManager.BattleManager:getPosInfo(posId) - local obj = self.changeElementSfxs[index] - if obj then - obj:setAnchoredPosition(pos.x, pos.y) - obj:setActive(true) - obj:play() + local info = self.root.changeElementSfxs[index] + if info then + local obj = info.obj + if obj then + obj:setAnchoredPosition(pos.x, pos.y) + obj:setActive(true) + obj:play() + end + else + self.root.changeElementSfxs[index] = { + isLoaded = true + } + EffectManager:loadUIEffectAsync(GConst.BattleConst.CHANGE_ELEMENT_SFX, self, self.gridNode, GConst.UI_EFFECT_ORDER.LEVEL2, function(obj) + self.root.changeElementSfxs[index].obj = obj + obj:setAnchoredPosition(pos.x, pos.y) + obj:play() + end) end end @@ -1718,6 +1728,16 @@ function BattleUI:initUISfxs() end end end + + if self.root.changeElementSfxs then + for index, info in pairs(self.root.changeElementSfxs) do + if info.obj then + info.obj:setActive(true) + info.obj:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_EFFECT_HELPER):SetSortingOrder(self:getUIOrder(), GConst.UI_EFFECT_ORDER.LEVEL2) + info.obj:setActive(false) + end + end + end end function BattleUI:showTutorialFinger(posIdList) 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 915e858f..fb828706 100644 --- a/lua/app/userdata/battle/skill/battle_board_skill_entity.lua +++ b/lua/app/userdata/battle/skill/battle_board_skill_entity.lua @@ -74,6 +74,10 @@ function BattleBoardSkillEntity:getSkillType() return self.config.skill_type end +function BattleBoardSkillEntity:isAttackOverActive() + return GConst.BattleConst.ATTACK_OVER_ACTIVE_SKILL_TYPE[self:getSkillType()] +end + function BattleBoardSkillEntity:getSkillTypeParameter() if not self.config then return diff --git a/lua/app/userdata/battle/skill/battle_buff_entity.lua b/lua/app/userdata/battle/skill/battle_buff_entity.lua index 7bdc6a5e..31a0cd1d 100644 --- a/lua/app/userdata/battle/skill/battle_buff_entity.lua +++ b/lua/app/userdata/battle/skill/battle_buff_entity.lua @@ -6,12 +6,13 @@ local BUFF_TYPE_DIRECT_HURT = BattleConst.BUFF_TYPE.DIRECT_HURT function BattleBuffEntity:ctor() end -function BattleBuffEntity:init(effectParams, owner) +function BattleBuffEntity:init(effectParams, owner, hostSkill) self.name = effectParams.type self.effectNum = effectParams.num self.round = effectParams.round self.ratio = effectParams.ratio self.owner = owner + self.hostSkill = hostSkill self.targetSide = nil self.buffInfo = ConfigManager:getConfigWithOtherKey("buff", "name")[self.name] self.buffType = self.buffInfo.buff_type @@ -25,6 +26,10 @@ function BattleBuffEntity:getName() return self.name end +function BattleBuffEntity:getHostSkill() + return self.hostSkill +end + function BattleBuffEntity:getDesc() if self.desc == nil then local buff18NInfo = I18N:getConfigWithOtherKey("buff", "name")[self.name] @@ -81,6 +86,14 @@ function BattleBuffEntity:setTargetSide(side) self.targetSide = side end +function BattleBuffEntity:getStack() + return self.buffInfo.stack +end + +function BattleBuffEntity:getDecr() + return self.buffInfo.decr +end + function BattleBuffEntity:getIcon() return self.buffInfo.icon end diff --git a/lua/app/userdata/battle/skill/battle_skill_entity.lua b/lua/app/userdata/battle/skill/battle_skill_entity.lua index b8645253..05aa89cc 100644 --- a/lua/app/userdata/battle/skill/battle_skill_entity.lua +++ b/lua/app/userdata/battle/skill/battle_skill_entity.lua @@ -37,7 +37,7 @@ function BattleSkillEntity:initSkillEffect() if self.skillInfo.effect then for k, v in ipairs(self.skillInfo.effect) do local buffEntity = BattleBuffEntity:create() - buffEntity:init(v, self.owner) + buffEntity:init(v, self.owner, self) if buffEntity:getIsHurtType() then self.isHurtType = true end @@ -89,7 +89,7 @@ function BattleSkillEntity:addSkillEffectParams(effect) end if not buffEntity then buffEntity = BattleBuffEntity:create() - buffEntity:init(effect, self.owner) + buffEntity:init(effect, self.owner, self) table.insert(self.effectList, buffEntity) else buffEntity:setEffectNum(buffEntity:getEffectNum() + effect.num) @@ -106,7 +106,7 @@ function BattleSkillEntity:addSkillEffectRound(effect) end if not buffEntity then buffEntity = BattleBuffEntity:create() - buffEntity:init(effect, self.owner) + buffEntity:init(effect, self.owner, self) table.insert(self.effectList, buffEntity) else buffEntity:setRound(buffEntity:getRound() + effect.round) @@ -130,8 +130,12 @@ function BattleSkillEntity:getIsActiveType() end -- 消除类技能 -function BattleSkillEntity:getIsEliminateType() - return self.skillInfo.skill_type == 3 +function BattleSkillEntity:getEliminateSkillType() + return self.skillInfo.skill_type +end + +function BattleSkillEntity:isAttackOverActive() + return GConst.BattleConst.ATTACK_OVER_ACTIVE_SKILL_TYPE[self:getEliminateSkillType()] end -- 消除类技能参数 diff --git a/lua/app/userdata/battle/team/battle_team_entity.lua b/lua/app/userdata/battle/team/battle_team_entity.lua index 4834417e..5cda5537 100644 --- a/lua/app/userdata/battle/team/battle_team_entity.lua +++ b/lua/app/userdata/battle/team/battle_team_entity.lua @@ -6,6 +6,7 @@ local BattleTeamEntity = class("BattleTeamEntity", BaseData) local MATCH_ATTACK_NAME = GConst.MATCH_ATTACK_NAME local MATCH_DMG_ADDITION_NAME = BattleConst.MATCH_DMG_ADDITION_NAME +local MATCH_DEC_DMG_NAME = BattleConst.MATCH_DEC_DMG_NAME local MATCH_DMG_DEC_NAME = BattleConst.MATCH_DMG_DEC_NAME local MATCH_WEAKNESS_NAME = BattleConst.MATCH_WEAKNESS_NAME local DEFAULT_FACTOR = BattleConst.DEFAULT_FACTOR @@ -15,6 +16,7 @@ local ATTR_NAME = BattleConst.ATTR_NAME function BattleTeamEntity:ctor() self.members = {} self.membersCount = 0 + self.counterAttackCount = 0 -- 反击次数 end function BattleTeamEntity:init(side, data) @@ -35,8 +37,12 @@ function BattleTeamEntity:init(side, data) end self.isDead = false self.stunCount = 0 + self.lethargyCount = 0 + self.frozenCount = 0 self.limitAll = 0 + self.activeSkillLimit = 0 self.shieldHp = 0 + self.undeadHp = 0 if data then table.sort(data.units, function(a, b) if a.level == b.level then @@ -117,6 +123,10 @@ function BattleTeamEntity:addAttr(name, num, isPercent) return addNum end +function BattleTeamEntity:setAttr(name, num) + self.attr[name] = num +end + function BattleTeamEntity:getAllMembers() return self.members end @@ -146,7 +156,11 @@ function BattleTeamEntity:getDmgAddition(matchType) end function BattleTeamEntity:getDmgDec(matchType) - return (self.attr.dec_dmg_all or 0) + (self.attr[MATCH_DMG_DEC_NAME[matchType]] or 0) + return (self.attr.dmg_dec_all or 0) + (self.attr[MATCH_DMG_DEC_NAME[matchType]] or 0) +end + +function BattleTeamEntity:getDecDmg(matchType) + return (self.attr.dec_dmg_all or 0) + (self.attr[MATCH_DEC_DMG_NAME[matchType]] or 0) end function BattleTeamEntity:getWeakness(matchType) @@ -165,14 +179,46 @@ function BattleTeamEntity:getCureAddition() return self.attr.cure_addition or 0 end +function BattleTeamEntity:getCureDec() + return self.attr.cure_dec or 0 +end + +function BattleTeamEntity:getBeDmgToHeal() + return self.attr.be_dmg_to_heal or 0 +end + +function BattleTeamEntity:getBeSucked() + return self.attr.be_sucked or 0 +end + +function BattleTeamEntity:getUndeadHp() + return self.undeadHp +end + +function BattleTeamEntity:setUndeadHp(hp) + self.undeadHp = hp +end + function BattleTeamEntity:getNormalAttackAddCount() return self.attr[ATTR_NAME.NORMAL_ATTACK_COUNT] or 0 end +function BattleTeamEntity:getThorns() + return self.attr[ATTR_NAME.THORNS] or 0 +end + function BattleTeamEntity:getExpTime() return self.attr.exp_time or 0 end +function BattleTeamEntity:getFirstHand() + return self.attr.first_hand or 0 +end + +function BattleTeamEntity:getDeathSummon() + return self.attr.death_summon or 0 +end + function BattleTeamEntity:addMaxHp(num) local hpBefore = self.attr.hp local currPercent = hpBefore * DEFAULT_FACTOR // self.attr.max_hp @@ -183,9 +229,19 @@ function BattleTeamEntity:addMaxHp(num) end end -function BattleTeamEntity:addLimit(name) +function BattleTeamEntity:addLimit(name, buffEffect) if name == BUFF_NAME.STUN then self.stunCount = self.stunCount + 1 + elseif name == BUFF_NAME.LETHARGY then + if buffEffect.result then + return + end + self.lethargyCount = self.lethargyCount + 1 + elseif name == BUFF_NAME.FROZEN then + if buffEffect.result then + return + end + self.frozenCount = self.frozenCount + 1 end self.limitAll = self.limitAll + 1 end @@ -193,6 +249,10 @@ end function BattleTeamEntity:removeLimit(name) if name == BUFF_NAME.STUN then self.stunCount = self.stunCount - 1 + elseif name == BUFF_NAME.LETHARGY then + self.lethargyCount = self.lethargyCount - 1 + elseif name == BUFF_NAME.FROZEN then + self.frozenCount = self.frozenCount - 1 end self.limitAll = self.limitAll - 1 end @@ -201,6 +261,26 @@ function BattleTeamEntity:getIsLimit() return self.limitAll > 0 end +function BattleTeamEntity:getActiveSkillLimit() + return self.activeSkillLimit > 0 +end + +function BattleTeamEntity:addActiveSkillLimit(name) + self.activeSkillLimit = self.activeSkillLimit + 1 +end + +function BattleTeamEntity:removeActiveSkillLimit(name) + self.activeSkillLimit = self.activeSkillLimit - 1 +end + +function BattleTeamEntity:getIsLethargy() + return self.lethargyCount > 0 +end + +function BattleTeamEntity:getIsFrozen() + return self.frozenCount > 0 +end + function BattleTeamEntity:addShield(num) self.shieldHp = self.shieldHp + num end @@ -217,6 +297,14 @@ function BattleTeamEntity:getBlock() return self.attr.block or 0 end +function BattleTeamEntity:getCounterAttack() + return self.attr.counterattack or 0 +end + +function BattleTeamEntity:getSkillHurt() + return self.attr.skill_hurt or 0 +end + function BattleTeamEntity:takeDamageOrCure(num) if self.isDead then return 0 @@ -230,6 +318,10 @@ function BattleTeamEntity:takeDamageOrCure(num) local hpBefore = self.attr.hp self.attr.hp = self.attr.hp + num local hurtEventNum = 0 + if self:getUndeadHp() > 0 and self.attr.hp <= 0 then + self.attr.hp = self:getUndeadHp() + num = self:getUndeadHp() - hpBefore + end if self.attr.hp <= 0 then -- 死了 hurtEventNum = -hpBefore self.attr.hp = 0 @@ -255,6 +347,19 @@ function BattleTeamEntity:handleShield(damageNum) end end +function BattleTeamEntity:getCounterAttackCount() + return self.counterAttackCount or 0 +end + +function BattleTeamEntity:addCounterAttackCount(count) + count = count or 1 + self.counterAttackCount = self.counterAttackCount + count +end + +function BattleTeamEntity:clearCounterAttackCount() + self.counterAttackCount = 0 +end + function BattleTeamEntity:getRecordData(name) if self.recordData == nil then self.recordData = {} diff --git a/lua/app/userdata/battle/team/battle_unit_entity.lua b/lua/app/userdata/battle/team/battle_unit_entity.lua index d2b32e1f..c7f308a4 100644 --- a/lua/app/userdata/battle/team/battle_unit_entity.lua +++ b/lua/app/userdata/battle/team/battle_unit_entity.lua @@ -100,6 +100,10 @@ function BattleUnitEntity:addAttr(name, num, isPercent) return self.team:addAttr(name, num, isPercent) end +function BattleUnitEntity:setAttr(name, num) + return self.team:setAttr(name, num) +end + function BattleUnitEntity:getModelId() return self.unitData.modelId end @@ -258,8 +262,12 @@ function BattleUnitEntity:getDmgAddition() return self.team:getDmgAddition(self.unitData.matchType) end -function BattleUnitEntity:getDmgDec(matchType) - return self.team:getDmgDec(matchType) +function BattleUnitEntity:getDmgDec() + return self.team:getDmgDec(self.unitData.matchType) +end + +function BattleUnitEntity:getDecDmg(matchType) + return self.team:getDecDmg(matchType) end function BattleUnitEntity:getWeakness(matchType) @@ -278,22 +286,82 @@ function BattleUnitEntity:getCureAddition() return self.team:getCureAddition() end +function BattleUnitEntity:getCureDec() + return self.team:getCureDec() +end + +function BattleUnitEntity:getBeDmgToHeal() + return self.team:getBeDmgToHeal() +end + +function BattleUnitEntity:getBeSucked() + return self.team:getBeSucked() +end + +function BattleUnitEntity:getUndeadHp() + return self.team:getUndeadHp() +end + +function BattleUnitEntity:setUndeadHp(hp) + return self.team:setUndeadHp(hp) +end + function BattleUnitEntity:getNormalAttackAddCount() return self.team:getNormalAttackAddCount() end -function BattleUnitEntity:addLimit(name) - self.team:addLimit(name) +function BattleUnitEntity:getThorns() + return self.team:getThorns() +end + +function BattleUnitEntity:getFirstHand() + return self.team:getFirstHand() +end + +function BattleUnitEntity:getDeathSummon() + return self.team:getDeathSummon() +end + +function BattleUnitEntity:getCounterAttack() + return self.team:getCounterAttack() +end + +function BattleUnitEntity:getSkillHurt() + return self.team:getSkillHurt() +end + +function BattleUnitEntity:addLimit(name, buffEffect) + return self.team:addLimit(name, buffEffect) end function BattleUnitEntity:removeLimit(name) - self.team:removeLimit(name) + return self.team:removeLimit(name) end function BattleUnitEntity:getIsLimit() return self.team:getIsLimit() end +function BattleUnitEntity:getActiveSkillLimit() + return self.team:getActiveSkillLimit() +end + +function BattleUnitEntity:addActiveSkillLimit(name) + return self.team:addActiveSkillLimit(name) +end + +function BattleUnitEntity:removeActiveSkillLimit(name) + self.team:removeActiveSkillLimit(name) +end + +function BattleUnitEntity:getIsLethargy() + return self.team:getIsLethargy() +end + +function BattleUnitEntity:getIsFrozen() + return self.team:getIsFrozen() +end + function BattleUnitEntity:addShield(num) self.team:addShield(num) end @@ -340,6 +408,18 @@ function BattleUnitEntity:getSkillExtraUseTimes(skillId) return self.skillExtraUseTimes[skillId] or 0 end +function BattleUnitEntity:addCounterAttackCount(count) + self.team:addCounterAttackCount(count) +end + +function BattleUnitEntity:getCounterAttackCount() + return self.team:getCounterAttackCount() +end + +function BattleUnitEntity:clearCounterAttackCount() + self.team:clearCounterAttackCount() +end + function BattleUnitEntity:getTeamRecordData(name) return self.team:getRecordData(name) end @@ -350,7 +430,9 @@ end function BattleUnitEntity:onRoundEnd() for k, v in ipairs(self.activeSkills) do - v:cooldown() + if not self:getActiveSkillLimit() then + v:cooldown() + end end end