pvp战斗和整合pve战斗

This commit is contained in:
xiekaidong 2023-06-28 21:24:15 +08:00
parent f17eeb8e68
commit d4d92cf97d
46 changed files with 15849 additions and 12698 deletions

View File

@ -464,7 +464,7 @@ function BIReport:postFightBegin(battleType, wave, chapterId, maxChapter, startT
self:report(EVENT_NAME_FIGHT, args) self:report(EVENT_NAME_FIGHT, args)
end end
function BIReport:postFightEnd(battleType, chapterId, wave, duration, totalTime, eliminateCount, chapterEliminateCount, type, deathType, startTimes, isFirstWin, isFianlStep, maxLinkCount) function BIReport:postFightEnd(battleType, battleData, chapterId, wave, duration, totalTime, eliminateCount, chapterEliminateCount, type, deathType, startTimes, isFirstWin, isFianlStep, maxLinkCount)
-- wave 进入关卡编号 -- wave 进入关卡编号
-- LevelType 进入关卡类型 -- LevelType 进入关卡类型
-- MaxLevel 已解锁最大关卡 -- MaxLevel 已解锁最大关卡
@ -473,7 +473,7 @@ function BIReport:postFightEnd(battleType, chapterId, wave, duration, totalTime,
local skillStr = GConst.EMPTY_STRING local skillStr = GConst.EMPTY_STRING
local skillNum = 0 local skillNum = 0
local skillMap = DataManager.BattleData:getSelectSkillMap() local skillMap = battleData:getSelectSkillMap()
if skillMap then if skillMap then
for skillId, info in pairs(skillMap) do for skillId, info in pairs(skillMap) do
skillStr = skillStr .. skillId .. "|" skillStr = skillStr .. skillId .. "|"
@ -505,9 +505,9 @@ function BIReport:postFightEnd(battleType, chapterId, wave, duration, totalTime,
self:report(EVENT_NAME_FIGHT, args) self:report(EVENT_NAME_FIGHT, args)
end end
function BIReport:postShowFightSkillSelect(battleType, skillList, chapterId, totalTime, wave) function BIReport:postShowFightSkillSelect(battleType, battleData, skillList, chapterId, totalTime, wave)
local skillNum = 0 local skillNum = 0
local skillMap = DataManager.BattleData:getSelectSkillMap() local skillMap = battleData:getSelectSkillMap()
if skillMap then if skillMap then
for skillId, info in pairs(skillMap) do for skillId, info in pairs(skillMap) do
skillNum = skillNum + (info.count or 0) skillNum = skillNum + (info.count or 0)
@ -533,9 +533,9 @@ function BIReport:postShowFightSkillSelect(battleType, skillList, chapterId, tot
self:report(EVENT_NAME_FIGHT, args) self:report(EVENT_NAME_FIGHT, args)
end end
function BIReport:postFightSkillSelect(battleType, skillList, chapterId, totalTime, wave) function BIReport:postFightSkillSelect(battleType, battleData, skillList, chapterId, totalTime, wave)
local skillNum = 0 local skillNum = 0
local skillMap = DataManager.BattleData:getSelectSkillMap() local skillMap = battleData:getSelectSkillMap()
if skillMap then if skillMap then
for skillId, info in pairs(skillMap) do for skillId, info in pairs(skillMap) do
skillNum = skillNum + (info.count or 0) skillNum = skillNum + (info.count or 0)

View File

@ -512,9 +512,214 @@ local act_gift = {
["recharge_id"]=14, ["recharge_id"]=14,
["time_type"]=3, ["time_type"]=3,
["value"]=2000 ["value"]=2000
},
[30102]={
["type"]=3,
["recharge_id"]=3,
["reward"]={
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=2,
["id_for_nothing"]="VA==",
["num"]=30,
["num_for_nothing"]="VQg="
},
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=1,
["id_for_nothing"]="Vw==",
["num"]=500,
["num_for_nothing"]="Uwhc"
},
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=34001,
["id_for_nothing"]="VQxcA2Q=",
["num"]=3,
["num_for_nothing"]="VQ=="
}
},
["time_type"]=1,
["limit_time"]=72,
["limit"]=1
},
[90102]={
["type"]=9,
["recharge_id"]=13,
["reward"]={
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=1,
["id_for_nothing"]="Vw==",
["num"]=1000,
["num_for_nothing"]="VwhcAw=="
},
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=4,
["id_for_nothing"]="Ug==",
["num"]=100,
["num_for_nothing"]="Vwhc"
},
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=5,
["id_for_nothing"]="Uw==",
["num"]=50,
["num_for_nothing"]="Uwg="
},
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=6,
["id_for_nothing"]="UA==",
["num"]=1,
["num_for_nothing"]="Vw=="
}
},
["time_type"]=1,
["limit_time"]=24,
["cd"]=48,
["limit"]=1,
["value"]=200
},
[90202]={
["type"]=9,
["recharge_id"]=12,
["reward"]={
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=1,
["id_for_nothing"]="Vw==",
["num"]=1000,
["num_for_nothing"]="VwhcAw=="
},
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=4,
["id_for_nothing"]="Ug==",
["num"]=100,
["num_for_nothing"]="Vwhc"
},
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=5,
["id_for_nothing"]="Uw==",
["num"]=50,
["num_for_nothing"]="Uwg="
},
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=6,
["id_for_nothing"]="UA==",
["num"]=1,
["num_for_nothing"]="Vw=="
}
},
["time_type"]=1,
["limit_time"]=24,
["cd"]=48,
["limit"]=1,
["value"]=260
},
[90302]={
["type"]=9,
["recharge_id"]=10,
["reward"]={
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=1,
["id_for_nothing"]="Vw==",
["num"]=1000,
["num_for_nothing"]="VwhcAw=="
},
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=4,
["id_for_nothing"]="Ug==",
["num"]=100,
["num_for_nothing"]="Vwhc"
},
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=5,
["id_for_nothing"]="Uw==",
["num"]=50,
["num_for_nothing"]="Uwg="
},
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=6,
["id_for_nothing"]="UA==",
["num"]=1,
["num_for_nothing"]="Vw=="
}
},
["time_type"]=1,
["limit_time"]=24,
["cd"]=48,
["limit"]=1,
["value"]=400
},
[90402]={
["type"]=9,
["recharge_id"]=5,
["reward"]={
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=1,
["id_for_nothing"]="Vw==",
["num"]=1000,
["num_for_nothing"]="VwhcAw=="
},
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=4,
["id_for_nothing"]="Ug==",
["num"]=100,
["num_for_nothing"]="Vwhc"
},
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=5,
["id_for_nothing"]="Uw==",
["num"]=50,
["num_for_nothing"]="Uwg="
},
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=6,
["id_for_nothing"]="UA==",
["num"]=1,
["num_for_nothing"]="Vw=="
}
},
["time_type"]=1,
["limit_time"]=24,
["cd"]=48,
["limit"]=1,
["value"]=800
} }
} }
local config = { local config = {
data=act_gift,count=22 data=act_gift,count=27
} }
return config return config

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -313,9 +313,21 @@ local const = {
}, },
["arena_bounty_senior_rise"]={ ["arena_bounty_senior_rise"]={
["value"]=10 ["value"]=10
},
["arena_matching_limit_number"]={
["value"]=5
},
["arena_win_adbox"]={
["value"]=3
},
["arena_lose_adbox"]={
["value"]=3
},
["arena_max_round"]={
["value"]=30
} }
} }
local config = { local config = {
data=const,count=63 data=const,count=67
} }
return config return config

View File

@ -70,9 +70,13 @@ local func_open = {
["arena_open"]={ ["arena_open"]={
["stage"]=10, ["stage"]=10,
["pop_ups"]=1 ["pop_ups"]=1
},
["act_arena_gift"]={
["stage"]=10,
["pop_ups"]=1
} }
} }
local config = { local config = {
data=func_open,count=18 data=func_open,count=19
} }
return config return config

View File

@ -258,6 +258,49 @@ local LocalizationGlobalConst =
NOTICE_TITLE = "NOTICE_TITLE", NOTICE_TITLE = "NOTICE_TITLE",
MAINTENANCE_NOTICE_DEFAULT = "MAINTENANCE_NOTICE_DEFAULT", MAINTENANCE_NOTICE_DEFAULT = "MAINTENANCE_NOTICE_DEFAULT",
CANNOT_RENAME_DESC_5 = "CANNOT_RENAME_DESC_5", CANNOT_RENAME_DESC_5 = "CANNOT_RENAME_DESC_5",
ARENA_DESC_1 = "ARENA_DESC_1",
ARENA_DESC_2 = "ARENA_DESC_2",
ARENA_DESC_3 = "ARENA_DESC_3",
ARENA_DESC_4 = "ARENA_DESC_4",
ARENA_DESC_5 = "ARENA_DESC_5",
ARENA_DESC_6 = "ARENA_DESC_6",
ARENA_DESC_7 = "ARENA_DESC_7",
ARENA_DESC_8 = "ARENA_DESC_8",
ARENA_DESC_9 = "ARENA_DESC_9",
ARENA_DESC_10 = "ARENA_DESC_10",
ARENA_DESC_11 = "ARENA_DESC_11",
ARENA_DESC_12 = "ARENA_DESC_12",
ARENA_DESC_13 = "ARENA_DESC_13",
ARENA_DESC_14 = "ARENA_DESC_14",
ARENA_DESC_15 = "ARENA_DESC_15",
ARENA_DESC_16 = "ARENA_DESC_16",
ARENA_DESC_17 = "ARENA_DESC_17",
ARENA_DESC_18 = "ARENA_DESC_18",
ARENA_DESC_19 = "ARENA_DESC_19",
ARENA_DESC_20 = "ARENA_DESC_20",
ARENA_DESC_21 = "ARENA_DESC_21",
ARENA_DESC_22 = "ARENA_DESC_22",
ARENA_DESC_23 = "ARENA_DESC_23",
ARENA_DESC_24 = "ARENA_DESC_24",
ARENA_RANKNAME_1 = "ARENA_RANKNAME_1",
ARENA_RANKNAME_2 = "ARENA_RANKNAME_2",
ARENA_RANKNAME_3 = "ARENA_RANKNAME_3",
ARENA_RANKNAME_4 = "ARENA_RANKNAME_4",
ARENA_RANKNAME_5 = "ARENA_RANKNAME_5",
ARENA_RANKNAME_6 = "ARENA_RANKNAME_6",
ARENA_RANKNAME_7 = "ARENA_RANKNAME_7",
ARENA_RANKNAME_8 = "ARENA_RANKNAME_8",
ARENA_RANKNAME_9 = "ARENA_RANKNAME_9",
ARENA_RANKNAME_10 = "ARENA_RANKNAME_10",
ARENA_RANKNAME_11 = "ARENA_RANKNAME_11",
ARENA_RANKNAME_12 = "ARENA_RANKNAME_12",
SHOP_DESC_38 = "SHOP_DESC_38",
SHOP_DESC_39 = "SHOP_DESC_39",
ARENA_BATTLE_DESC_1 = "ARENA_BATTLE_DESC_1",
ARENA_BATTLE_DESC_2 = "ARENA_BATTLE_DESC_2",
ARENA_BATTLE_DESC_3 = "ARENA_BATTLE_DESC_3",
ARENA_BATTLE_DESC_4 = "ARENA_BATTLE_DESC_4",
ARENA_BATTLE_DESC_5 = "ARENA_BATTLE_DESC_5",
} }
return LocalizationGlobalConst return LocalizationGlobalConst

File diff suppressed because it is too large Load Diff

View File

@ -258,6 +258,49 @@ local localization_global =
["NOTICE_TITLE"] = "公告", ["NOTICE_TITLE"] = "公告",
["MAINTENANCE_NOTICE_DEFAULT"] = "服务器正在加紧链接中,目前元素较多,请稍后重试进入。", ["MAINTENANCE_NOTICE_DEFAULT"] = "服务器正在加紧链接中,目前元素较多,请稍后重试进入。",
["CANNOT_RENAME_DESC_5"] = "与当前昵称一致,无需更改", ["CANNOT_RENAME_DESC_5"] = "与当前昵称一致,无需更改",
["ARENA_DESC_1"] = "竞技场",
["ARENA_DESC_2"] = "匹配",
["ARENA_DESC_3"] = "第{0}赛季",
["ARENA_DESC_4"] = "军团竞技场",
["ARENA_DESC_5"] = "排行榜",
["ARENA_DESC_6"] = "竞技场战令",
["ARENA_DESC_7"] = "战报",
["ARENA_DESC_8"] = "暂时没有战报",
["ARENA_DESC_9"] = "防守阵容",
["ARENA_DESC_10"] = "进攻阵容",
["ARENA_DESC_11"] = "结算奖励",
["ARENA_DESC_12"] = "S{0}赛季结算时抵达相应段位可在下一赛季时来此领取奖励。",
["ARENA_DESC_13"] = "你在S{0}赛季时的段位",
["ARENA_DESC_14"] = "战况",
["ARENA_DESC_15"] = "对手",
["ARENA_DESC_16"] = "积分",
["ARENA_DESC_17"] = "防守胜利",
["ARENA_DESC_18"] = "防守失败",
["ARENA_DESC_19"] = "进攻胜利",
["ARENA_DESC_20"] = "进攻失败",
["ARENA_DESC_21"] = "S{0}赛季",
["ARENA_DESC_22"] = "寻找对手",
["ARENA_DESC_23"] = "重新匹配",
["ARENA_DESC_24"] = "保存并退出",
["ARENA_RANKNAME_1"] = "青铜骑士Ⅲ",
["ARENA_RANKNAME_2"] = "青铜骑士Ⅱ",
["ARENA_RANKNAME_3"] = "青铜骑士Ⅰ",
["ARENA_RANKNAME_4"] = "白银骑士Ⅳ",
["ARENA_RANKNAME_5"] = "白银骑士Ⅲ",
["ARENA_RANKNAME_6"] = "白银骑士Ⅱ",
["ARENA_RANKNAME_7"] = "白银骑士Ⅰ",
["ARENA_RANKNAME_8"] = "黄金龙骑Ⅴ",
["ARENA_RANKNAME_9"] = "黄金龙骑Ⅳ",
["ARENA_RANKNAME_10"] = "黄金龙骑Ⅲ",
["ARENA_RANKNAME_11"] = "黄金龙骑Ⅱ",
["ARENA_RANKNAME_12"] = "黄金龙骑Ⅰ",
["SHOP_DESC_38"] = "入门礼包",
["SHOP_DESC_39"] = "超值S级英雄,仅此一次!",
["ARENA_BATTLE_DESC_1"] = "我方回合",
["ARENA_BATTLE_DESC_2"] = "对方回合",
["ARENA_BATTLE_DESC_3"] = "眩晕中",
["ARENA_BATTLE_DESC_4"] = "冻结中",
["ARENA_BATTLE_DESC_5"] = "昏睡中",
} }
return localization_global return localization_global

View File

@ -455,7 +455,7 @@ local tutorial = {
[50000]={ [50000]={
["next_id"]=50010, ["next_id"]=50010,
["type"]=2, ["type"]=2,
["target_name"]="main_ui(Clone)/sub_ui_node/main_comp/left_btn", ["target_name"]="main_ui(Clone)/sub_ui_node/main_comp/left/daily_challenge",
["arrow_direction"]=2, ["arrow_direction"]=2,
["arrow_offset"]={ ["arrow_offset"]={
0, 0,
@ -489,7 +489,7 @@ local tutorial = {
0, 0,
180 180
}, },
["target_name"]="main_ui(Clone)/sub_ui_node/main_comp/right_btn", ["target_name"]="main_ui(Clone)/sub_ui_node/main_comp/right/dungeon",
["arrow_direction"]=1, ["arrow_direction"]=1,
["arrow_offset"]={ ["arrow_offset"]={
0, 0,

View File

@ -390,13 +390,17 @@ if NOT_PUBLISH then
end end
if Input.GetKeyDown(KeyCode.G) and Input.GetKey(KeyCode.LeftControl) then if Input.GetKeyDown(KeyCode.G) and Input.GetKey(KeyCode.LeftControl) then
if DataManager.BattleData.gridEntities then local battleController = ModuleManager.BattleManager.battleController
if not battleController then
return
end
if battleController.battleData.gridEntities then
local map = {} local map = {}
for posId, entity in pairs(DataManager.BattleData.gridEntities) do for posId, entity in pairs(battleController.battleData.gridEntities) do
map[tostring(posId)] = entity:getSnapshoptInfo() map[tostring(posId)] = entity:getSnapshoptInfo()
end end
Logger.logHighlight("——————————战斗棋盘快照如下————————") Logger.logHighlight("——————————战斗棋盘快照如下————————")
Logger.logHighlight("——————————当前战斗回合步骤————————" .. ModuleManager.BattleManager.battleController.roundStep) Logger.logHighlight("——————————当前战斗回合步骤————————" .. battleController.roundStep)
Logger.logHighlight(json.encode(map)) Logger.logHighlight(json.encode(map))
end end
end end

View File

@ -85,6 +85,10 @@ BattleConst.BATTLE_TYPE = {
ARENA = "5", ARENA = "5",
} }
BattleConst.IS_PVP_BATTLE = {
[BattleConst.BATTLE_TYPE.ARENA] = true,
}
BattleConst.TYPEOF_LUA_COMP = { BattleConst.TYPEOF_LUA_COMP = {
BATTLE_HERO_COMPONENT = "app/module/battle/component/battle_hero_comp", BATTLE_HERO_COMPONENT = "app/module/battle/component/battle_hero_comp",
BATTLE_MONSTER_COMPONENT = "app/module/battle/component/battle_monster_comp", BATTLE_MONSTER_COMPONENT = "app/module/battle/component/battle_monster_comp",
@ -275,6 +279,12 @@ local BUFF_NAME = {
DMG_ADDITION_BLUE_ADD = "dmg_addition_blue_add", DMG_ADDITION_BLUE_ADD = "dmg_addition_blue_add",
DMG_ADDITION_PURPLE_ADD = "dmg_addition_purple_add", DMG_ADDITION_PURPLE_ADD = "dmg_addition_purple_add",
DMG_ADDITION_ALL_ADD = "dmg_addition_all_add", DMG_ADDITION_ALL_ADD = "dmg_addition_all_add",
DMG_DEC_RED_ADD = "dmg_dec_red_add",
DMG_DEC_YELLOW_ADD = "dmg_dec_yellow_add",
DMG_DEC_GREEN_ADD = "dmg_dec_green_add",
DMG_DEC_BLUE_ADD = "dmg_dec_blue_add",
DMG_DEC_PURPLE_ADD = "dmg_dec_purple_add",
DMG_DEC_ALL_ADD = "dmg_dec_all_add",
STUN = "stun", STUN = "stun",
SHIELD = "shield", SHIELD = "shield",
NORMAL_ATTACK_DEC = "normal_attack_dec", NORMAL_ATTACK_DEC = "normal_attack_dec",
@ -393,6 +403,12 @@ BattleConst.BUFF_NAME_TO_ATTR = {
[BUFF_NAME.DMG_ADDITION_BLUE_ADD] = {ATTR_NAME.DMG_ADDITION_BLUE, false}, [BUFF_NAME.DMG_ADDITION_BLUE_ADD] = {ATTR_NAME.DMG_ADDITION_BLUE, false},
[BUFF_NAME.DMG_ADDITION_PURPLE_ADD] = {ATTR_NAME.DMG_ADDITION_PURPLE, false}, [BUFF_NAME.DMG_ADDITION_PURPLE_ADD] = {ATTR_NAME.DMG_ADDITION_PURPLE, false},
[BUFF_NAME.DMG_ADDITION_ALL_ADD] = {ATTR_NAME.DMG_ADDITION_ALL, false}, [BUFF_NAME.DMG_ADDITION_ALL_ADD] = {ATTR_NAME.DMG_ADDITION_ALL, false},
[BUFF_NAME.DMG_DEC_RED_ADD] = {ATTR_NAME.DMG_DEC_RED, false},
[BUFF_NAME.DMG_DEC_YELLOW_ADD] = {ATTR_NAME.DMG_DEC_YELLOW, false},
[BUFF_NAME.DMG_DEC_GREEN_ADD] = {ATTR_NAME.DMG_DEC_GREEN, false},
[BUFF_NAME.DMG_DEC_BLUE_ADD] = {ATTR_NAME.DMG_DEC_BLUE, false},
[BUFF_NAME.DMG_DEC_PURPLE_ADD] = {ATTR_NAME.DMG_DEC_PURPLE, false},
[BUFF_NAME.DMG_DEC_ALL_ADD] = {ATTR_NAME.DMG_DEC_ALL, false},
[BUFF_NAME.BLOCK] = {ATTR_NAME.BLOCK, false}, [BUFF_NAME.BLOCK] = {ATTR_NAME.BLOCK, false},
[BUFF_NAME.CRIT_ADD] = {ATTR_NAME.CRIT, false}, [BUFF_NAME.CRIT_ADD] = {ATTR_NAME.CRIT, false},
[BUFF_NAME.CRIT_TIME_ADD] = {ATTR_NAME.CRIT_TIME, false}, [BUFF_NAME.CRIT_TIME_ADD] = {ATTR_NAME.CRIT_TIME, false},
@ -542,13 +558,34 @@ BattleConst.GRID_OUT_LINE_POS_ID = {
[65] = {[74] = true, [75] = true, [76] = true, [64] = true, [66] = true, [54] = true, [55] = true, [56] = true}, [65] = {[74] = true, [75] = true, [76] = true, [64] = true, [66] = true, [54] = true, [55] = true, [56] = true},
[66] = {[75] = true, [76] = true, [77] = true, [65] = true, [67] = true, [55] = true, [56] = true, [57] = true}, [66] = {[75] = true, [76] = true, [77] = true, [65] = true, [67] = true, [55] = true, [56] = true, [57] = true},
[67] = {[76] = true, [77] = true, [66] = true, [56] = true, [57] = true}, [67] = {[76] = true, [77] = true, [66] = true, [56] = true, [57] = true},
[71] = {[72] = true, [61] = true, [62] = true}, [71] = {[81] = true, [82] = true, [72] = true, [61] = true, [62] = true},
[72] = {[71] = true, [73] = true, [61] = true, [62] = true, [63] = true}, [72] = {[81] = true, [82] = true, [83] = true, [71] = true, [73] = true, [61] = true, [62] = true, [63] = true},
[73] = {[72] = true, [74] = true, [62] = true, [63] = true, [64] = true}, [73] = {[82] = true, [83] = true, [84] = true, [72] = true, [74] = true, [62] = true, [63] = true, [64] = true},
[74] = {[73] = true, [75] = true, [63] = true, [64] = true, [65] = true}, [74] = {[83] = true, [84] = true, [85] = true, [73] = true, [75] = true, [63] = true, [64] = true, [65] = true},
[75] = {[74] = true, [76] = true, [64] = true, [65] = true, [66] = true}, [75] = {[84] = true, [85] = true, [86] = true, [74] = true, [76] = true, [64] = true, [65] = true, [66] = true},
[76] = {[75] = true, [77] = true, [65] = true, [66] = true, [67] = true}, [76] = {[85] = true, [86] = true, [87] = true, [75] = true, [77] = true, [65] = true, [66] = true, [67] = true},
[77] = {[76] = true, [66] = true, [67] = true}, [77] = {[86] = true, [87] = true, [76] = true, [66] = true, [67] = true},
[81] = {[91] = true, [92] = true, [82] = true, [71] = true, [72] = true},
[82] = {[91] = true, [92] = true, [93] = true, [81] = true, [83] = true, [71] = true, [72] = true, [73] = true},
[83] = {[92] = true, [93] = true, [94] = true, [82] = true, [84] = true, [72] = true, [73] = true, [74] = true},
[84] = {[93] = true, [94] = true, [95] = true, [83] = true, [85] = true, [73] = true, [74] = true, [75] = true},
[85] = {[94] = true, [95] = true, [96] = true, [84] = true, [86] = true, [74] = true, [75] = true, [76] = true},
[86] = {[95] = true, [96] = true, [97] = true, [85] = true, [87] = true, [75] = true, [76] = true, [77] = true},
[87] = {[96] = true, [97] = true, [86] = true, [76] = true, [77] = true},
[91] = {[101] = true, [102] = true, [92] = true, [81] = true, [82] = true},
[92] = {[101] = true, [102] = true, [103] = true, [91] = true, [93] = true, [81] = true, [82] = true, [83] = true},
[93] = {[102] = true, [103] = true, [104] = true, [92] = true, [94] = true, [82] = true, [83] = true, [84] = true},
[94] = {[103] = true, [104] = true, [105] = true, [93] = true, [95] = true, [83] = true, [84] = true, [85] = true},
[95] = {[104] = true, [105] = true, [106] = true, [94] = true, [96] = true, [84] = true, [85] = true, [86] = true},
[96] = {[105] = true, [106] = true, [107] = true, [95] = true, [97] = true, [85] = true, [86] = true, [87] = true},
[97] = {[106] = true, [107] = true, [96] = true, [86] = true, [87] = true},
[101] = {[102] = true, [91] = true, [92] = true},
[102] = {[101] = true, [103] = true, [91] = true, [92] = true, [93] = true},
[103] = {[102] = true, [104] = true, [92] = true, [93] = true, [94] = true},
[104] = {[103] = true, [105] = true, [93] = true, [94] = true, [95] = true},
[105] = {[104] = true, [106] = true, [94] = true, [95] = true, [96] = true},
[106] = {[105] = true, [107] = true, [95] = true, [96] = true, [97] = true},
[107] = {[106] = true, [96] = true, [97] = true},
} }
BattleConst.UP_DOWN_LEFT_RIGHT = { BattleConst.UP_DOWN_LEFT_RIGHT = {
@ -601,6 +638,27 @@ BattleConst.UP_DOWN_LEFT_RIGHT = {
[75] = {65, 74, 76}, [75] = {65, 74, 76},
[76] = {66, 75, 77}, [76] = {66, 75, 77},
[77] = {67, 76, }, [77] = {67, 76, },
[81] = {71, 82},
[82] = {72, 81, 83},
[83] = {73, 82, 84},
[84] = {74, 83, 85},
[85] = {75, 84, 86},
[86] = {76, 85, 87},
[87] = {77, 86, },
[91] = {81, 92},
[92] = {82, 91, 93},
[93] = {83, 92, 94},
[94] = {84, 93, 95},
[95] = {85, 94, 96},
[96] = {86, 95, 97},
[97] = {87, 96, },
[101] = {91, 102},
[102] = {92, 101, 103},
[103] = {93, 102, 104},
[104] = {94, 103, 105},
[105] = {95, 104, 106},
[106] = {96, 105, 107},
[107] = {97, 106, },
} }
@ -655,6 +713,101 @@ BattleConst.UP_LINE_FILL_LIST = {
[75] = {65, 64, 66}, [75] = {65, 64, 66},
[76] = {66, 65, 67}, [76] = {66, 65, 67},
[77] = {67, 66}, [77] = {67, 66},
[81] = {71, 72},
[82] = {72, 71, 73},
[83] = {73, 72, 74},
[84] = {74, 73, 75},
[85] = {75, 74, 76},
[86] = {76, 75, 77},
[87] = {77, 76},
[91] = {81, 82},
[92] = {82, 81, 83},
[93] = {83, 82, 84},
[94] = {84, 83, 85},
[95] = {85, 84, 86},
[96] = {86, 85, 87},
[97] = {87, 86},
[101] = {91, 92},
[102] = {92, 91, 93},
[103] = {93, 92, 94},
[104] = {94, 93, 95},
[105] = {95, 94, 96},
[106] = {96, 95, 97},
[107] = {97, 96},
}
---- 下一排填充的顺序
BattleConst.DOWN_LINE_FILL_LIST = {
[11] = {21, 22},
[12] = {22, 23, 21},
[13] = {23, 24, 22},
[14] = {24, 25, 23},
[15] = {25, 26, 24},
[16] = {26, 27, 25},
[17] = {27, 26},
[21] = {31, 32},
[22] = {32, 33, 31},
[23] = {33, 34, 32},
[24] = {34, 35, 33},
[25] = {35, 36, 34},
[26] = {36, 37, 35},
[27] = {37, 36},
[31] = {41, 42},
[32] = {42, 43, 41},
[33] = {43, 44, 42},
[34] = {44, 45, 43},
[35] = {45, 46, 44},
[36] = {46, 47, 45},
[37] = {47, 46},
[41] = {51, 52},
[42] = {52, 53, 51},
[43] = {53, 54, 52},
[44] = {54, 55, 53},
[45] = {55, 56, 54},
[46] = {56, 57, 55},
[47] = {57, 56},
[51] = {61, 62},
[52] = {62, 63, 61},
[53] = {63, 64, 62},
[54] = {64, 65, 63},
[55] = {65, 66, 64},
[56] = {66, 67, 65},
[57] = {67, 66},
[61] = {71, 72},
[62] = {72, 73, 71},
[63] = {73, 74, 72},
[64] = {74, 75, 73},
[65] = {75, 76, 74},
[66] = {76, 77, 75},
[67] = {77, 76},
[71] = {81, 82},
[72] = {82, 83, 81},
[73] = {83, 84, 82},
[74] = {84, 85, 83},
[75] = {85, 86, 84},
[76] = {86, 87, 85},
[77] = {87, 86},
[81] = {91, 92},
[82] = {92, 93, 91},
[83] = {93, 94, 92},
[84] = {94, 95, 93},
[85] = {95, 96, 94},
[86] = {96, 97, 95},
[87] = {97, 96},
[91] = {101, 102},
[92] = {102, 103, 101},
[93] = {103, 104, 102},
[94] = {104, 105, 103},
[95] = {105, 106, 104},
[96] = {106, 107, 105},
[97] = {107, 106},
[101] = {},
[102] = {},
[103] = {},
[104] = {},
[105] = {},
[106] = {},
[107] = {},
} }
BattleConst.BOARD_RANGE_TYPE = { BattleConst.BOARD_RANGE_TYPE = {

View File

@ -11,6 +11,7 @@ local BATTLE_CONTROLLER = {
[BattleConst.BATTLE_TYPE.DAILY_CHALLENGE] = "app/module/battle/controller/battle_controller_daily_challenge", [BattleConst.BATTLE_TYPE.DAILY_CHALLENGE] = "app/module/battle/controller/battle_controller_daily_challenge",
[BattleConst.BATTLE_TYPE.DUNGEON_GOLD] = "app/module/battle/controller/battle_controller_dungeon_gold", [BattleConst.BATTLE_TYPE.DUNGEON_GOLD] = "app/module/battle/controller/battle_controller_dungeon_gold",
[BattleConst.BATTLE_TYPE.DUNGEON_SHARDS] = "app/module/battle/controller/battle_controller_dungeon_shards", [BattleConst.BATTLE_TYPE.DUNGEON_SHARDS] = "app/module/battle/controller/battle_controller_dungeon_shards",
[BattleConst.BATTLE_TYPE.ARENA] = "app/module/battle/controller/battle_controller_arena"
} }
function BattleManager:showPauseUI(battleType) function BattleManager:showPauseUI(battleType)
@ -38,7 +39,9 @@ end
function BattleManager:rspSkillRefresh(result) function BattleManager:rspSkillRefresh(result)
if result.err_code == GConst.ERROR_STR.SUCCESS then if result.err_code == GConst.ERROR_STR.SUCCESS then
DataManager.BattleData:addRefreshSkillCount(result.reqData.ad) if self.battleController then
self.battleController.battleData:addRefreshSkillCount(result.reqData.ad)
end
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.SKILL_REFRESH_SUCC) EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.SKILL_REFRESH_SUCC)
end end
end end
@ -118,11 +121,9 @@ function BattleManager:clear()
GFunc.killDOTween(GConst.DOTWEEN_IDS.BATTLE) GFunc.killDOTween(GConst.DOTWEEN_IDS.BATTLE)
self.battleController:clear() self.battleController:clear()
self.battleController = nil self.battleController = nil
DataManager.BattleData:clear()
self.bindUnitAttributeData = nil self.bindUnitAttributeData = nil
end end
----------------------- start 一些公共相关的方法 ----------------------------- ----------------------- start 一些公共相关的方法 -----------------------------
function BattleManager:getPosInfo(posId, rowCount) function BattleManager:getPosInfo(posId, rowCount)
rowCount = rowCount or BattleConst.ROW_COUNT rowCount = rowCount or BattleConst.ROW_COUNT
@ -134,9 +135,16 @@ function BattleManager:getPosInfo(posId, rowCount)
local r = self:getPosRC(posId).r local r = self:getPosRC(posId).r
local c = self:getPosRC(posId).c local c = self:getPosRC(posId).c
local offsetC = c - (rowCount + 1) / 2 local offset = self:posNeedOffset(rowCount)
local offsetR = BattleConst.HALF_ROW_COUNT - r local offsetC = c - BattleConst.HALF_COLUMN_COUNT
local halfR = (rowCount + 1) / 2
local offsetR = (rowCount + 1) / 2 - r
local info = {x = offsetC * BattleConst.GRID_STEP_H, y = offsetR * BattleConst.GRID_STEP_H} local info = {x = offsetC * BattleConst.GRID_STEP_H, y = offsetR * BattleConst.GRID_STEP_H}
if r > halfR then
info.y = info.y - offset
else
info.y = info.y + offset
end
GConst.BattleConst.GRID_POS[rowCount][posId] = info GConst.BattleConst.GRID_POS[rowCount][posId] = info
posInfo = GConst.BattleConst.GRID_POS[rowCount][posId] posInfo = GConst.BattleConst.GRID_POS[rowCount][posId]
@ -144,6 +152,13 @@ function BattleManager:getPosInfo(posId, rowCount)
return posInfo return posInfo
end end
function BattleManager:posNeedOffset(rowCount)
if rowCount == GConst.BattleConst.PVP_ROW_COUNT then
return 23
end
return 0
end
function BattleManager:getElementIcon(elementType) function BattleManager:getElementIcon(elementType)
local icon = GConst.BattleConst.ELEMENT_ICON[elementType] local icon = GConst.BattleConst.ELEMENT_ICON[elementType]
if not icon then if not icon then
@ -174,6 +189,10 @@ function BattleManager:getFirstLineLastRowPosId(row, column)
return self:getPosId(1 - row, column) return self:getPosId(1 - row, column)
end end
function BattleManager:getLastLineLastRowPosId(row, column, maxRow)
return self:getPosId(maxRow + row, column)
end
function BattleManager:getAroundPosIdsByList(posId, boardrange, cludePosIdsMap) function BattleManager:getAroundPosIdsByList(posId, boardrange, cludePosIdsMap)
local posIdInfos = {} local posIdInfos = {}
local randomExclusion = {} local randomExclusion = {}

View File

@ -66,6 +66,14 @@ function BattleUnitComp:getIsLethargy()
return self.unitEntity:getIsLethargy() return self.unitEntity:getIsLethargy()
end end
function BattleUnitComp:getIsStun()
return self.unitEntity:getIsStun()
end
function BattleUnitComp:getIsFrozen()
return self.unitEntity:getIsFrozen()
end
function BattleUnitComp:getActiveSkillLimit() function BattleUnitComp:getActiveSkillLimit()
return self.unitEntity:getActiveSkillLimit() return self.unitEntity:getActiveSkillLimit()
end end
@ -483,9 +491,9 @@ function BattleUnitComp:changeState(state)
-- 进入目标状态 -- 进入目标状态
if state == UNIT_STATE.IDLE then -- idle为默认状态其状态下判定特殊状态 if state == UNIT_STATE.IDLE then -- idle为默认状态其状态下判定特殊状态
if self.unitEntity:getIsFrozen() then -- 有冰冻buff if self:getIsFrozen() then -- 有冰冻buff
state = UNIT_STATE.FROZEN state = UNIT_STATE.FROZEN
elseif self.unitEntity:getIsLethargy() or self.unitEntity:getIsStun() then elseif self:getIsLethargy() or self:getIsStun() then
state = UNIT_STATE.VERITGO state = UNIT_STATE.VERITGO
end end
end end
@ -1489,7 +1497,7 @@ function BattleUnitComp:takeEffect(buff, target, conditionResult)
end end
end end
if self.unitEntity:getIsFrozen() and buff:isIncreaseGain() then -- 冻结状态缓存增益buff if self:getIsFrozen() and buff:isIncreaseGain() then -- 冻结状态缓存增益buff
if buff:getRound() > 0 then if buff:getRound() > 0 then
local buffEffect = BattleHelper:getBuffEffect() local buffEffect = BattleHelper:getBuffEffect()
buffEffect.buff = buff buffEffect.buff = buff
@ -1683,7 +1691,7 @@ function BattleUnitComp:takeDamageOrCure(atker, num, effectType, effectStatus, d
if self.unitEntity:getBeSucked() > 0 then -- 吸血 if self.unitEntity:getBeSucked() > 0 then -- 吸血
atker:takeDamageOrCure(self, -num*self.unitEntity:getBeSucked() // DEFAULT_FACTOR, EFFECT_TYPE.HEAL, 0, BattleConst.SPECIAL_DAMAGE_OR_CURE_TYPE.BE_SUCKED) atker:takeDamageOrCure(self, -num*self.unitEntity:getBeSucked() // DEFAULT_FACTOR, EFFECT_TYPE.HEAL, 0, BattleConst.SPECIAL_DAMAGE_OR_CURE_TYPE.BE_SUCKED)
end end
if self.unitEntity:getIsLethargy() then -- 移除昏睡 if self:getIsLethargy() then -- 移除昏睡
self:removeBuffByName(BattleConst.BUFF_NAME.LETHARGY) self:removeBuffByName(BattleConst.BUFF_NAME.LETHARGY)
end end
if self.unitEntity:getThorns() > 0 then -- 反伤 if self.unitEntity:getThorns() > 0 then -- 反伤
@ -1802,7 +1810,7 @@ function BattleUnitComp:addBattleExp(atker, hpRealReduce)
self.battleController:addBattleExp(addExp) self.battleController:addBattleExp(addExp)
else else
local exp = self.unitEntity:getExp() local exp = self.unitEntity:getExp()
if exp > 0 then if exp and exp > 0 then
local expTime = atker.unitEntity:getExpTime() local expTime = atker.unitEntity:getExpTime()
local addExp = math.floor(exp/self.unitEntity:getMaxHp()*-hpRealReduce) local addExp = math.floor(exp/self.unitEntity:getMaxHp()*-hpRealReduce)
if expTime > 0 then if expTime > 0 then

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,123 @@
local BattleControllerPVP = require "app/module/battle/controller/battle_controller_pvp"
local BattleControllerArena = class("BattleControllerArena", BattleControllerPVP)
local BattleBuffEntity = require "app/userdata/battle/skill/battle_buff_entity"
function BattleControllerArena:getBoardConfig()
return ConfigManager:getConfig("arena_board")
end
function BattleControllerArena:getChapterConfig()
return ConfigManager:getConfig("arena_rank")
end
function BattleControllerArena:getChapterId()
return 101 -- 临时
end
function BattleControllerArena:getBuffs()
if not self.initBuffs then
self.initBuffs = {}
local buffList = {}
local config = self:getChapterConfig()[self.chapterId]
if config and config.effect then
for _, effect in ipairs(config.effect) do
local atkBuffInfo = {
buff = GFunc.getTable(effect),
obj = GConst.BattleConst.SIDE_ATK
}
local defBuffInfo = {
buff = GFunc.getTable(effect),
obj = GConst.BattleConst.SIDE_DEF
}
table.insert(buffList, atkBuffInfo)
table.insert(buffList, defBuffInfo)
end
end
for _, info in ipairs(buffList) do
local buffEntity = BattleBuffEntity:create()
buffEntity:init(info.buff)
buffEntity:setTargetSide(info.obj)
buffEntity:setIsCantRemove(true)
buffEntity:setNotShowIcon(true)
table.insert(self.initBuffs, {buffEntity = buffEntity, effect = info.buff})
end
end
return self.initBuffs
end
-- 战斗结束
function BattleControllerArena:controllBattleEnd()
end
-- 一共有多少波
function BattleControllerArena:getMaxWave()
return 1
end
function BattleControllerArena:getMaxRoundCount()
if not self.arenaMaxRound then
self.arenaMaxRound = GFunc.getConstIntValue("arena_max_round")
end
return self.arenaMaxRound
end
function BattleControllerArena:findNextDefUnit()
self:enterRoundEnd(true)
end
function BattleControllerArena:postWaveOver(atkDead, isQuit)
end
function BattleControllerArena:postFightStart()
end
function BattleControllerArena:getAtkMinRow()
return GConst.BattleConst.PVP_ROW_COUNT // 2
end
function BattleControllerArena:getInitBoard()
if not self.boradList then
self.boradList = {}
self.fixedRandomGrid = {}
self.mysteryBoxIndexMap = {}
local config = self:getChapterConfig()[self.chapterId]
local boardCfg = self:getBoardConfig()
local boardId = config.rand_board[math.random(1, #config.rand_board)]
local cfg = boardCfg[boardId]
if cfg then
local board = GFunc.getTable(cfg.board)
for index, info in ipairs(board) do
if info[2] == GConst.BattleConst.ELEMENT_TYPE.NONE then
board[index][2] = math.random(1, GConst.BattleConst.ELEMENT_TYPE_COUNT)
end
end
table.insert(self.boradList, {board = board, mysteryBoard = GFunc.getTable(cfg.mystery_box_board)})
table.insert(self.fixedRandomGrid, GFunc.getTable(cfg.control_element))
end
end
return self.boradList, self.fixedRandomGrid, self.mysteryBoxIndexMap
end
function BattleControllerArena:onTouchEvent(eventType, posId, isVirtual)
local isAtkAction = self.curActionSide == GConst.BattleConst.SIDE_ATK
local r = ModuleManager.BattleManager:getPosRC(posId).r
if isAtkAction then
if r <= self:getAtkMinRow() then
return
end
else
if r > self:getAtkMinRow() then
return
end
end
BattleControllerPVP.onTouchEvent(self, eventType, posId, isVirtual)
end
return BattleControllerArena

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: f700ac6962067a74d91df10905ad40ff
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -89,7 +89,7 @@ function BattleControllerDailyChallenge:controllBattleEnd()
victory = self.victory, victory = self.victory,
} }
local atkReport = {} local atkReport = {}
local teamEntity = DataManager.BattleData:getAtkTeam() local teamEntity = self.battleData:getAtkTeam()
local members = teamEntity:getAllMembers() local members = teamEntity:getAllMembers()
local heroInfo = {} local heroInfo = {}
for k, v in pairs(members) do for k, v in pairs(members) do
@ -137,7 +137,7 @@ function BattleControllerDailyChallenge:postWaveOver(atkDead, isQuit)
local isFianlStep = self.waveIndex >= self.maxWaveIndex local isFianlStep = self.waveIndex >= self.maxWaveIndex
BIReport:postFightEnd(GConst.BattleConst.BATTLE_TYPE.DAILY_CHALLENGE, self.chapterId, self.waveIndex, duration, totalTime, self.eliminateCount, self.eliminateTotalCount, waveEndType, deathType, startTimes, isFirstWin, isFianlStep, self.maxLinkCount) BIReport:postFightEnd(GConst.BattleConst.BATTLE_TYPE.DAILY_CHALLENGE, self.battleData, self.chapterId, self.waveIndex, duration, totalTime, self.eliminateCount, self.eliminateTotalCount, waveEndType, deathType, startTimes, isFirstWin, isFianlStep, self.maxLinkCount)
end end
function BattleControllerDailyChallenge:postFightStart() function BattleControllerDailyChallenge:postFightStart()

View File

@ -51,7 +51,7 @@ function BattleControllerDungeonGold:controllBattleEnd()
remainRound = remainRound, remainRound = remainRound,
} }
local atkReport = {} local atkReport = {}
local teamEntity = DataManager.BattleData:getAtkTeam() local teamEntity = self.battleData:getAtkTeam()
local members = teamEntity:getAllMembers() local members = teamEntity:getAllMembers()
local totalDamage = 0 local totalDamage = 0
for k, v in pairs(members) do for k, v in pairs(members) do
@ -96,7 +96,7 @@ function BattleControllerDungeonGold:postWaveOver(atkDead, isQuit)
local isFianlStep = self.waveIndex >= self.maxWaveIndex local isFianlStep = self.waveIndex >= self.maxWaveIndex
BIReport:postFightEnd(GConst.BattleConst.BATTLE_TYPE.DUNGEON_GOLD, self.chapterId, self.waveIndex, duration, totalTime, self.eliminateCount, self.eliminateTotalCount, waveEndType, deathType, startTimes, isFirstWin, isFianlStep, self.maxLinkCount) BIReport:postFightEnd(GConst.BattleConst.BATTLE_TYPE.DUNGEON_GOLD, self.battleData, self.chapterId, self.waveIndex, duration, totalTime, self.eliminateCount, self.eliminateTotalCount, waveEndType, deathType, startTimes, isFirstWin, isFianlStep, self.maxLinkCount)
end end
function BattleControllerDungeonGold:postFightStart() function BattleControllerDungeonGold:postFightStart()

View File

@ -20,7 +20,7 @@ function BattleControllerDungeonShards:controllBattleEnd()
victory = self.victory, victory = self.victory,
} }
local atkReport = {} local atkReport = {}
local teamEntity = DataManager.BattleData:getAtkTeam() local teamEntity = self.battleData:getAtkTeam()
local members = teamEntity:getAllMembers() local members = teamEntity:getAllMembers()
local totalDamage = 0 local totalDamage = 0
for k, v in pairs(members) do for k, v in pairs(members) do
@ -64,7 +64,7 @@ function BattleControllerDungeonShards:postWaveOver(atkDead, isQuit)
local isFianlStep = self.waveIndex >= self.maxWaveIndex local isFianlStep = self.waveIndex >= self.maxWaveIndex
BIReport:postFightEnd(GConst.BattleConst.BATTLE_TYPE.DUNGEON_SHARDS, self.chapterId, self.waveIndex, duration, totalTime, self.eliminateCount, self.eliminateTotalCount, waveEndType, deathType, startTimes, isFirstWin, isFianlStep, self.maxLinkCount) BIReport:postFightEnd(GConst.BattleConst.BATTLE_TYPE.DUNGEON_SHARDS, self.battleData, self.chapterId, self.waveIndex, duration, totalTime, self.eliminateCount, self.eliminateTotalCount, waveEndType, deathType, startTimes, isFirstWin, isFianlStep, self.maxLinkCount)
end end
function BattleControllerDungeonShards:postFightStart() function BattleControllerDungeonShards:postFightStart()

View File

@ -2,6 +2,8 @@ local BattleHelper = require "app/module/battle/helper/battle_helper"
local BattleBaseController = require "app/module/battle/controller/battle_base_controller" local BattleBaseController = require "app/module/battle/controller/battle_base_controller"
local BattleControllerPVP = class("BattleControllerPVP", BattleBaseController) local BattleControllerPVP = class("BattleControllerPVP", BattleBaseController)
local BattleConst = GConst.BattleConst local BattleConst = GConst.BattleConst
local SIDE_ATK = BattleConst.SIDE_ATK
local SIDE_DEF = BattleConst.SIDE_DEF
-- *************各个子模块的战斗需要重写的方法 START************* -- *************各个子模块的战斗需要重写的方法 START*************
function BattleControllerPVP:getBoardConfig() function BattleControllerPVP:getBoardConfig()
@ -38,80 +40,6 @@ function BattleControllerPVP:findNextDefUnit()
self:enterRoundEnd(true) self:enterRoundEnd(true)
end end
function BattleControllerPVP:onLinkChange()
self.battleUI:hideAllSfxLine()
self.linkChangeNeedFalsePosMap = table.clearOrCreate(self.linkChangeNeedFalsePosMap)
for posId, entity in pairs(self.battleData:getGridEnties()) do
if entity:getCell() then
self.linkChangeNeedFalsePosMap[posId] = entity:getCell()
end
end
local sequence = self.battleData:getGridSequence()
local mainElementType
for index, info in ipairs(sequence) do
local entity = self.battleData:getGridEntity(info.posId)
if not mainElementType then
local skillId = entity:getSkillId()
if not skillId then
mainElementType = entity:getElementType()
break
end
end
end
local count = #sequence
for index, info in ipairs(sequence) do
local entity = self.battleData:getGridEntity(info.posId)
if entity:getCell() then
entity:getCell():showHighLight(true, mainElementType, self.battleUI)
end
if self.linkChangeNeedFalsePosMap[info.posId] then
self.linkChangeNeedFalsePosMap[info.posId] = nil
end
if index < count then
local nextPosId = sequence[index + 1].posId
self.battleUI:getSfxLine(index, function(obj)
local curPos = ModuleManager.BattleManager:getPosInfo(info.posId)
local nextPos = ModuleManager.BattleManager:getPosInfo(nextPosId)
local pos, z = ModuleManager.BattleManager:getPosCenterAndDir(curPos, nextPos)
obj:setLocalScale(25, 25, 25)
obj:setLocalPosition(pos.x, pos.y, 0)
obj:setEulerAngles(0, 0, z)
end)
end
if index == count then
if entity:getCell() then
entity:getCell():showAni()
end
end
end
for posId, cell in pairs(self.linkChangeNeedFalsePosMap) do
cell:showHighLight(false)
end
for posId, info in pairs(self.battleData:getSkillInfluenceGrids()) do
local entity = self.battleData:getGridEntity(posId)
if info.direction ~= BattleConst.BOARD_RANGE_TYPE.RANDOM then
if entity:getCell() then
entity:getCell():showCircle(true)
end
end
end
if not self.atkTeam:getMainUnit().unitEntity:getActiveSkillLimit() then
local aniSequence, influenceElementType, lineCount, elementTypeMap, linkElementType = self:calculateCurElimination(true)
self.battleUI:refreshSkill(elementTypeMap, count > 0)
end
if mainElementType then
self.atkTeam:changeMainUnit(mainElementType)
end
end
function BattleControllerPVP:postWaveOver(atkDead, isQuit) function BattleControllerPVP:postWaveOver(atkDead, isQuit)
end end
@ -120,15 +48,8 @@ function BattleControllerPVP:postFightStart()
end end
function BattleControllerPVP:onEliminationBegin() function BattleControllerPVP:getMaxRoundCount()
return 1
end
function BattleControllerPVP:refreshWave()
if not self.battleUI then
return
end
self.battleUI:refreshWave(self.waveIndex)
end end
-- *************各个子模块的战斗需要重写的方法 END************* -- *************各个子模块的战斗需要重写的方法 END*************
@ -168,6 +89,209 @@ function BattleControllerPVP:initDefUnits(callback)
end end
end end
function BattleControllerPVP:onLoadComplete(...)
-- 处理技能
local unlockAllSkill = function(side)
local skillPool = self.battleData:getSkillPool(side)
if skillPool then
for elementType, list in pairs(skillPool) do -- 先遍历一下未解锁的技能
if not self.battleData:isUnlockedSkillElementType(elementType, side) then
local skillEntity = self.battleData:getSkillEntityByElement(elementType, side)
if skillEntity then
local skillId = skillEntity:getUnlockId()
if skillId then
self:dealSelectSkill(skillId, nil, side)
end
end
for _, skillId in ipairs(list) do
self:dealSelectSkill(skillId, nil, side)
end
end
end
self.battleUI:refreshSkill(nil, nil, side)
end
end
unlockAllSkill(SIDE_ATK)
unlockAllSkill(SIDE_DEF)
BattleBaseController.onLoadComplete(self, ...)
end
function BattleControllerPVP:enterBattleStep()
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_TEAM_ACTION
self.battleTeamActionList = table.clearOrCreate(self.battleTeamActionList)
local action = function()
if self.curActionSide == SIDE_ATK then
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ATK_STEP
else
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_DEF_STEP
end
self:exeInstructions(function()
self:enterNextTeamAction()
end, self.curActionSide)
end
self:addTeamActionList(action, 1)
self:enterNextTeamAction()
end
function BattleControllerPVP:enterNextTeamAction()
self.atkTeam:onActionOver()
self.defTeam:onActionOver()
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_TEAM_ACTION_OVER
self:hideCombo()
self:hideCounterAttack()
if self:checkTeamIsDead(function() self:enterRoundEnd() end) then
return
end
if not self.battleTeamActionList or not self.battleTeamActionList[1] then
if self.curActionSide == SIDE_DEF then -- 防守方行动结束 回合结束
self:enterRoundEnd()
else
self:setCurActionSide(SIDE_DEF)
self.battleUI:enterShowBoardAni(function()
self:enterElimination()
end)
end
return
end
local action = table.remove(self.battleTeamActionList, 1)
action()
end
function BattleControllerPVP:getSkillElementListRow()
self.skillElementListRow = table.clearOrCreate(self.skillElementListRow)
local min, max = self:getCurActionBoardRowRange()
if self.curActionSide == SIDE_ATK then
for row = max, min, -1 do
table.insert(self.skillElementListRow, row)
end
else
for row = min, max do
table.insert(self.skillElementListRow, row)
end
end
return self.skillElementListRow
end
function BattleControllerPVP:onFillBoardOver(...)
BattleBaseController.onFillBoardOver(self, ...)
--- 遍历
local index = 1
for posId, entity in pairs(self.battleData:getGridEnties()) do
if self:getPosIdInCurActionBoardRowRange(posId) and entity:getSkillId() then
if entity:getSkillSide() ~= self.curActionSide then
local skillMatchType = entity:getSkillMatchType()
if skillMatchType then
local skillEntity = self.battleData:getSkillEntityByElement(skillMatchType, self.curActionSide)
if skillEntity then
entity:setSkilId(skillEntity:getSkillId(), false, self.curActionSide)
self.battleUI:playChangeElementSfx(posId, index)
index = index + 1
end
end
end
end
end
end
function BattleControllerPVP:enterElimination(needDelay)
if self.showSelectSkillSid then
ModuleManager.BattleManager:unscheduleGlobal(self.showSelectSkillSid)
self.showSelectSkillSid = nil
end
if self.battleData:useAddlvCount() then
self:tryShowSelectSkillComp(needDelay)
return
end
self.battleUI:hideAllBoardSfxs()
local curActionUnitComp = self:getCurActionUnitComp()
if curActionUnitComp:getIsLimit() then
if curActionUnitComp:getIsFrozen() then
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.ARENA_BATTLE_DESC_4))
elseif curActionUnitComp:getIsLethargy() then
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.ARENA_BATTLE_DESC_5))
elseif curActionUnitComp:getIsStun() then
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.ARENA_BATTLE_DESC_3))
end
self:enterNextTeamAction()
return
end
-- 检查棋盘
local find, pathList = self:findAttention()
if not find then -- 如果没找到,就要打乱棋盘
self:shuffleBoard(function()
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ELIMINATION
end)
else
self.attentionList = pathList
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ELIMINATION
end
end
function BattleControllerPVP:enterRoundBegin(...)
local nextWaveRound = (self.waveRoundCount[self.waveIndex] or 0) + 1
if self:getMaxRoundCount() < nextWaveRound then -- 超过最大回合, 直接结算
self.victory = false
self:postWaveOver(false)
self:battleEnd()
return
end
BattleBaseController.enterRoundBegin(self, ...)
self:refreshWave()
end
function BattleControllerPVP:enterRoundEnd()
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_END
local defTeam = self.battleData:getDefTeam()
if not defTeam or defTeam:getIsDead() then -- 怪物死了, 直接进入刷新逻辑
self.curWaveMonsterDead = true
-- self.atkTeam:onRoundEnd()
self:enterNextWave()
return
end
local atkTeam = self.battleData:getAtkTeam()
if not atkTeam or atkTeam:getIsDead() then -- 英雄死了, 直接结算
-- self.defTeam:onRoundEnd()
self:enterNextWave()
return
end
-- self.atkTeam:onRoundEnd()
-- self.defTeam:onRoundEnd()
if self:checkTeamIsDead(function() self:enterNextWave() end) then
return
end
self:onRoundEnd()
end
function BattleControllerPVP:setCurActionSide(side)
self.curActionSide = side or SIDE_ATK
if self.curActionSide == SIDE_ATK then
self.atkTeam:onRoundEnd()
else
self.defTeam:onRoundEnd()
end
end
function BattleControllerPVP:refreshWave()
if not self.battleUI then
return
end
self.battleUI:refreshWave(self.waveRoundCount[self.waveIndex] or 0)
end
return BattleControllerPVP return BattleControllerPVP

View File

@ -61,7 +61,7 @@ function BattleControllerStage:controllBattleEnd()
victory = self.victory, victory = self.victory,
} }
local atkReport = {} local atkReport = {}
local teamEntity = DataManager.BattleData:getAtkTeam() local teamEntity = self.battleData:getAtkTeam()
local members = teamEntity:getAllMembers() local members = teamEntity:getAllMembers()
for k, v in pairs(members) do for k, v in pairs(members) do
local report = { local report = {
@ -103,7 +103,7 @@ function BattleControllerStage:postWaveOver(atkDead, isQuit)
local isFianlStep = self.waveIndex >= self.maxWaveIndex local isFianlStep = self.waveIndex >= self.maxWaveIndex
BIReport:postFightEnd(GConst.BattleConst.BATTLE_TYPE.STAGE, self.chapterId, self.waveIndex, duration, totalTime, self.eliminateCount, self.eliminateTotalCount, waveEndType, deathType, startTimes, isFirstWin, isFianlStep, self.maxLinkCount) BIReport:postFightEnd(GConst.BattleConst.BATTLE_TYPE.STAGE, self.battleData, self.chapterId, self.waveIndex, duration, totalTime, self.eliminateCount, self.eliminateTotalCount, waveEndType, deathType, startTimes, isFirstWin, isFianlStep, self.maxLinkCount)
end end
function BattleControllerStage:postFightStart() function BattleControllerStage:postFightStart()

View File

@ -0,0 +1,205 @@
local BattleBoardTouchHelper = class("BattleBoardTouchHelper")
local BattleConst = GConst.BattleConst
local ELIMINATION_TOUCH_EVENT = GConst.ELIMINATION_TOUCH_EVENT
function BattleBoardTouchHelper:init(battleController)
self.battleController = battleController
self.battleUI = battleController.battleUI
self.battleData = battleController.battleData
end
function BattleBoardTouchHelper:onTouchEvent(eventType, posId, isVirtual)
if self.battleController.roundStep ~= BattleConst.BATTLE_ROUND_STEP.ON_ELIMINATION then
return
end
local entity = self.battleData:getGridEntity(posId)
if not entity or not entity:canLink() then
return
end
if eventType == ELIMINATION_TOUCH_EVENT.DOWN then
self:onLinkStart(entity, posId, isVirtual)
elseif eventType == ELIMINATION_TOUCH_EVENT.ENTER then
if self.battleData:getIsVirtual() and not isVirtual then
return
end
self:onLinkEnter(entity, posId, isVirtual)
elseif eventType == ELIMINATION_TOUCH_EVENT.EXIT then
else -- 取消和抬起
self:onLinkCancelOrUp(entity, posId, isVirtual)
end
end
function BattleBoardTouchHelper:onLinkStart(entity, posId, isVirtual)
if DataManager.TutorialData:getIsInTutorial() then
local elementList = DataManager.TutorialData:getTargetElement()
if elementList then
local find = false
for _, curPosId in ipairs(elementList) do
if curPosId == posId then
find = true
break
end
end
if not find then
return
end
end
end
if not isVirtual then
self.battleUI:showTutorialFinger()
end
if #self.battleData:getGridSequence() > 0 then
self.battleController:clearGridSequence()
end
self.battleData:insertGridSequence(posId, self.battleController:snapshotBoard(), isVirtual)
local skillEntity = self.battleController:getSkillEntityBySkillId(entity:getSkillId())
local maskElementType = entity:getElementType(skillEntity)
self.battleUI:showBoardMask(maskElementType, skillEntity and entity:getPosId())
self.battleController:findSkillInfluenceGrids()
self.battleController:onLinkChange()
if not isVirtual then
AudioManager:playEffect(AudioManager.EFFECT_ID.LINK_BO_1)
if skillEntity then
AudioManager:playEffect(AudioManager.EFFECT_ID.LINK_SKILL)
end
end
end
function BattleBoardTouchHelper:onLinkEnter(entity, posId, isVirtual)
local sequence = self.battleData:getGridSequence()
local sequenceCount = #sequence
local info = sequence[sequenceCount]
local lastPosId = info and info.posId
if not lastPosId then
return
end
local outLineMap = BattleConst.GRID_OUT_LINE_POS_ID[lastPosId]
if not outLineMap or not outLineMap[posId] then
return
end
if self.battleData:alreadyInsertSequence(posId) then
local info = sequence[#sequence - 1]
local beforePosId = info and info.posId
if beforePosId == posId then -- 进入的是倒数第二个,则移除倒数第一个
local snapshot = self.battleData:removeGridSequence(lastPosId)
if snapshot then -- 如果有快照,则恢复一次
for posId, info in pairs(snapshot) do
self.battleData:setInfoBySnapshop(posId, info)
end
end
local lastEntity = self.battleData:getGridEntity(beforePosId)
local lastSkillEntity = self.battleController:getSkillEntityBySkillId(lastEntity:getSkillId())
local maskElementType = lastEntity:getElementType(lastSkillEntity)
local _, skillPosId = self.battleData:getSequenceHadSkill()
self.battleUI:showBoardMask(maskElementType, skillPosId)
self.battleController:findSkillInfluenceGrids()
self.battleController:onLinkChange()
end
return
end
local skillId = entity:getSkillId()
local skillEntity = self.battleController:getSkillEntityBySkillId(skillId)
local elementType = entity:getElementType(skillEntity)
local lastEntity = self.battleData:getGridEntity(lastPosId)
local lastSkillId = lastEntity:getSkillId()
local lastSkillEntity = self.battleController:getSkillEntityBySkillId(lastSkillId)
local lastElementType = lastEntity:getElementType(lastSkillEntity)
local hadSkillId, skillPosId = self.battleData:getSequenceHadSkill()
if skillEntity and hadSkillId then
return
end
if not elementType or not lastElementType then
else
if lastElementType ~= elementType then
return
end
end
local maskElementType = elementType or lastElementType
if not skillPosId then
if skillId then
skillPosId = posId
end
end
self.battleUI:showBoardMask(maskElementType, skillPosId)
self.battleData:insertGridSequence(posId, self.battleController:snapshotBoard(), isVirtual)
if lastEntity:getNeedChangePos() and not entity:getNeedChangePos() then -- 需要移动到队列末尾
local lastSkillId = lastEntity:getSkillId()
local skillId = entity:getSkillId()
self.battleController:setGridSkillId(lastPosId, skillId)
self.battleController:setGridSkillId(posId, lastSkillId)
end
local newElementType = elementType or lastElementType
if newElementType then
entity:setElementType(newElementType)
lastEntity:setElementType(newElementType)
end
entity:addLinkSkillCount()
self.battleController:findSkillInfluenceGrids()
self.battleController:onLinkChange()
if not isVirtual then
if sequenceCount + 1 == self.battleController:getMinEliminationCount() then
AudioManager:playEffect(AudioManager.EFFECT_ID.LINK_READY)
end
AudioManager:playEffect(AudioManager:getBoEffectID(sequenceCount + 1))
if skillEntity then
AudioManager:playEffect(AudioManager.EFFECT_ID.LINK_SKILL)
end
end
end
function BattleBoardTouchHelper:onLinkCancelOrUp(entity, posId, isVirtual)
if isVirtual then
return
end
local tutorialElementList
if DataManager.TutorialData:getIsInTutorial() then
tutorialElementList = DataManager.TutorialData:getTargetElement()
end
self.battleUI:showBoardMask(nil)
local sequence = self.battleData:getGridSequence()
local count = #sequence
if count < self.battleController:getMinEliminationCount() then
self.battleController:clearGridSequence()
AudioManager:playEffect(AudioManager.EFFECT_ID.LINK_CANCEL)
if tutorialElementList then
self.battleUI:showTutorialFinger(tutorialElementList)
end
return
end
AudioManager:playEffect(AudioManager.EFFECT_ID.LINK_OVER)
if tutorialElementList then
local posIdmap = {}
for _, info in ipairs(sequence) do
posIdmap[info.posId] = true
end
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.ELIMINATION_OVER, posIdmap)
else
self.battleController:onLinkOver()
end
end
return BattleBoardTouchHelper

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 6d402be3730fc974bb074f1094b877d2
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -59,16 +59,18 @@ local function _undeadOff(buffSender, target, buff, buffEffect)
end end
local function _imprisonOn(buffSender, buff, target, buffEffect) local function _imprisonOn(buffSender, buff, target, buffEffect)
if target.side == GConst.BattleConst.SIDE_ATK then local battleController = ModuleManager.BattleManager.battleController
DataManager.BattleData:lockAllSkillGrid(true) if battleController then
battleController.battleData:lockAllSkillGrid(true, target.side)
end end
target.unitEntity:addActiveSkillLimit(buff:getName()) target.unitEntity:addActiveSkillLimit(buff:getName())
return 1 return 1
end end
local function _imprisonOff(buffSender, target, buff, buffEffect) local function _imprisonOff(buffSender, target, buff, buffEffect)
if target.side == GConst.BattleConst.SIDE_ATK then local battleController = ModuleManager.BattleManager.battleController
DataManager.BattleData:lockAllSkillGrid(false) if battleController then
battleController.battleData:lockAllSkillGrid(false, target.side)
end end
target.unitEntity:removeActiveSkillLimit(buff:getName()) target.unitEntity:removeActiveSkillLimit(buff:getName())
return 1 return 1

View File

@ -31,6 +31,14 @@ function BattleHelper:getBaseOrder()
return self.baseOrder return self.baseOrder
end end
function BattleHelper:setBattleData(battleBaseData)
self.battleData = battleBaseData
end
function BattleHelper:getBattleData()
return self.battleData
end
function BattleHelper:getFxConfig() function BattleHelper:getFxConfig()
if self.fxCfg == nil then if self.fxCfg == nil then
self.fxCfg = ConfigManager:getConfig("fx") self.fxCfg = ConfigManager:getConfig("fx")
@ -78,7 +86,7 @@ function BattleHelper:loadBattleHeroModel(id, parent, callback)
if self.characterMap then if self.characterMap then
self.characterMap[spineObject:getInstanceID()] = spineObject self.characterMap[spineObject:getInstanceID()] = spineObject
end end
local timeScale = DataManager.BattleData:getTimeScale() local timeScale = self:getBattleData():getTimeScale()
spineObject:setTimeScale(timeScale) spineObject:setTimeScale(timeScale)
callback(spineObject) callback(spineObject)
else else
@ -86,7 +94,7 @@ function BattleHelper:loadBattleHeroModel(id, parent, callback)
spineObject:setDefaultMix(0) spineObject:setDefaultMix(0)
if self.characterMap then if self.characterMap then
self.characterMap[spineObject:getInstanceID()] = spineObject self.characterMap[spineObject:getInstanceID()] = spineObject
local timeScale = DataManager.BattleData:getTimeScale() local timeScale = self:getBattleData():getTimeScale()
spineObject:setTimeScale(timeScale) spineObject:setTimeScale(timeScale)
callback(spineObject) callback(spineObject)
end end
@ -126,7 +134,7 @@ function BattleHelper:getEffectAsync(name, parent, callback)
if self.effectMap then if self.effectMap then
self.effectMap[effect:getInstanceID()] = effect self.effectMap[effect:getInstanceID()] = effect
end end
local timeScale = DataManager.BattleData:getTimeScale() local timeScale = self:getBattleData():getTimeScale()
effect:setTimeScale(timeScale) effect:setTimeScale(timeScale)
effect:setActive(true) effect:setActive(true)
callback(effect) callback(effect)
@ -135,7 +143,7 @@ function BattleHelper:getEffectAsync(name, parent, callback)
if self.effectMap then if self.effectMap then
effect:initParticleSystemRendererList() effect:initParticleSystemRendererList()
self.effectMap[effect:getInstanceID()] = effect self.effectMap[effect:getInstanceID()] = effect
local timeScale = DataManager.BattleData:getTimeScale() local timeScale = self:getBattleData():getTimeScale()
effect:setTimeScale(timeScale) effect:setTimeScale(timeScale)
callback(effect) callback(effect)
end end

View File

@ -57,18 +57,10 @@ function BattleSkillConditionHandle.judgeSkillEffectCondition(buffConditions, co
local func = BattleSkillConditionHandle._judgeSkillEffectCondition[condition.type] local func = BattleSkillConditionHandle._judgeSkillEffectCondition[condition.type]
if func then if func then
local target local target
if side == BattleConst.SIDE_ATK then if condition.side == 1 then
if condition.side == 1 then target = battleController.getCurActionTeam(side):getMainUnit()
target = battleController.atkTeam:getMainUnit()
else
target = battleController.defTeam:getMainUnit()
end
else else
if condition.side == 1 then target = battleController.getOtherSideTeam(side):getMainUnit()
target = battleController.defTeam:getMainUnit()
else
target = battleController.atkTeam:getMainUnit()
end
end end
if func(condition, conditionRel, target, battleController) then if func(condition, conditionRel, target, battleController) then

View File

@ -23,7 +23,7 @@ local function _takeElimination(posId, skillEntity, gridEntities, sequenceEntiti
cludePosIdsMap[info.posId] = info cludePosIdsMap[info.posId] = info
end end
DataManager.BattleData:cacheSkillInfluenceGrids(cludePosIdsMap) battleController.battleData:cacheSkillInfluenceGrids(cludePosIdsMap)
end end
end end
@ -80,7 +80,7 @@ local function _takeEliminationGridAndElement(posId, skillEntity, gridEntities,
cludePosIdsMap[info.posId] = info cludePosIdsMap[info.posId] = info
end end
DataManager.BattleData:cacheSkillInfluenceGrids(cludePosIdsMap) battleController.battleData:cacheSkillInfluenceGrids(cludePosIdsMap)
end end
end end
@ -418,7 +418,7 @@ local function _takeAddSkillEnergy(atkUnitComp, skillEntity, battleController)
if elementType == BattleConst.ELEMENT_TYPE.NONE then if elementType == BattleConst.ELEMENT_TYPE.NONE then
local boardSkills local boardSkills
local count = 0 local count = 0
for eType, entity in pairs(battleController.battleData:getSkillEntities()) do for eType, entity in pairs(battleController:getSkillEntities()) do
if entity:getUnlocked() then if entity:getUnlocked() then
if not boardSkills then if not boardSkills then
boardSkills = {} boardSkills = {}
@ -434,7 +434,7 @@ local function _takeAddSkillEnergy(atkUnitComp, skillEntity, battleController)
end end
elementTypeMap = {[elementType] = addEnergy} elementTypeMap = {[elementType] = addEnergy}
battleController.battleData:addSkillEnergy(elementTypeMap) battleController:addSkillEnergy(elementTypeMap)
battleController.battleUI:refreshSkill() battleController.battleUI:refreshSkill()
end end

View File

@ -29,7 +29,7 @@ local function _crossSpread(entity, gridEntities, battleController, onlyCheck)
tempList = table.shuffle(GFunc.getTable(tempList)) tempList = table.shuffle(GFunc.getTable(tempList))
for _, posId in ipairs(tempList) do for _, posId in ipairs(tempList) do
local gridEntity = gridEntities[posId] local gridEntity = gridEntities[posId]
if gridEntity:isEmptyIdle() then if gridEntity and gridEntity:isEmptyIdle() then
if battleController.battleUI and entity:getEffectSfx() then if battleController.battleUI and entity:getEffectSfx() then
battleController.battleUI:showGridEffectSfx(posId, entity:getEffectSfx(), function() battleController.battleUI:showGridEffectSfx(posId, entity:getEffectSfx(), function()
battleController.battleData:setGridType(posId, entity:getGridType() or BattleConst.GRID_TYPE.JELLY) battleController.battleData:setGridType(posId, entity:getGridType() or BattleConst.GRID_TYPE.JELLY)
@ -63,7 +63,7 @@ local function _crossSpreadNotBreak(entity, gridEntities, battleController, only
tempList = table.shuffle(GFunc.getTable(tempList)) tempList = table.shuffle(GFunc.getTable(tempList))
for _, posId in ipairs(tempList) do for _, posId in ipairs(tempList) do
local gridEntity = gridEntities[posId] local gridEntity = gridEntities[posId]
if gridEntity:isEmptyIdle() then if gridEntity and gridEntity:isEmptyIdle() then
battleController.battleData:setGridType(posId, entity:getGridType() or BattleConst.GRID_TYPE.JELLY, true) battleController.battleData:setGridType(posId, entity:getGridType() or BattleConst.GRID_TYPE.JELLY, true)
if battleController.battleUI and entity:getEffectSfx() then if battleController.battleUI and entity:getEffectSfx() then
battleController.battleUI:showGridEffectSfx(posId, entity:getEffectSfx(), function() battleController.battleUI:showGridEffectSfx(posId, entity:getEffectSfx(), function()
@ -124,7 +124,7 @@ local function _crossMoveNotBreak(entity, gridEntities, battleController, onlyCh
tempList = table.shuffle(GFunc.getTable(tempList)) tempList = table.shuffle(GFunc.getTable(tempList))
for _, posId in ipairs(tempList) do for _, posId in ipairs(tempList) do
local gridEntity = gridEntities[posId] local gridEntity = gridEntities[posId]
if gridEntity:isEmptyIdle() and not map[posId] then if gridEntity and gridEntity:isEmptyIdle() and not map[posId] then
local direction = ModuleManager.BattleManager:getPosDirection(entity:getPosId(), posId) local direction = ModuleManager.BattleManager:getPosDirection(entity:getPosId(), posId)
local cell = entity:getCell() local cell = entity:getCell()
if cell then if cell then

View File

@ -18,10 +18,11 @@ local _changeBaseSkill = function(skillId, skillInfo, battleBaseData, battleCont
if skillEntity then if skillEntity then
local skillId = skillEntity:getSkillId() local skillId = skillEntity:getSkillId()
battleBaseData:changeSkillId(elementType, newSkillId, side) battleBaseData:changeSkillId(elementType, newSkillId, side)
if not battleBaseData.atkTeam then local actionTeam = battleBaseData:getTeamBySide(side)
if not actionTeam then
return return
end end
local unitEntity = battleBaseData.atkTeam:getAllMembers()[elementType] local unitEntity = actionTeam:getAllMembers()[elementType]
if unitEntity then if unitEntity then
unitEntity:changeSkillId(skillId, newSkillId) unitEntity:changeSkillId(skillId, newSkillId)
for effectType, effect in pairs(skillEntity:getSkillRoundAdd()) do -- 技能回合数 for effectType, effect in pairs(skillEntity:getSkillRoundAdd()) do -- 技能回合数
@ -39,54 +40,55 @@ local _changeBaseSkill = function(skillId, skillInfo, battleBaseData, battleCont
end end
end end
local _addEliminationRange = function(skillId, skillInfo, battleData, battleController, value, side) local _addEliminationRange = function(skillId, skillInfo, battleBaseData, battleController, value, side)
local elementType = skillInfo.skill_position local elementType = skillInfo.skill_position
if not elementType or not skillInfo.boardrange then if not elementType or not skillInfo.boardrange then
return return
end end
local entity = battleData:getSkillEntityByElement(elementType, side) local entity = battleBaseData:getSkillEntityByElement(elementType, side)
if entity then if entity then
entity:addBoardRange(skillInfo.boardrange) entity:addBoardRange(skillInfo.boardrange)
end end
end end
local _canLinkAnyElement = function(skillId, skillInfo, battleData, battleController, value, side) local _canLinkAnyElement = function(skillId, skillInfo, battleBaseData, battleController, value, side)
local elementType = skillInfo.skill_position local elementType = skillInfo.skill_position
if not elementType then if not elementType then
return return
end end
local entity = battleData:getSkillEntityByElement(elementType, side) local entity = battleBaseData:getSkillEntityByElement(elementType, side)
if entity then if entity then
entity:setIgnoreElementType(true) entity:setIgnoreElementType(true)
end end
end end
local _addLinkAtkp = function(skillId, skillInfo, battleData, battleController, value, side) local _addLinkAtkp = function(skillId, skillInfo, battleBaseData, battleController, value, side)
local elementType = skillInfo.skill_position local elementType = skillInfo.skill_position
if not elementType or not skillInfo.effect then if not elementType or not skillInfo.effect then
return return
end end
if not battleData.atkTeam then local actionTeam = battleBaseData:getTeamBySide(side)
if not actionTeam then
return return
end end
local unitEntity = battleData.atkTeam:getAllMembers()[elementType] local unitEntity = actionTeam:getAllMembers()[elementType]
if not unitEntity then if not unitEntity then
return return
end end
for _, effect in ipairs(skillInfo.effect) do for _, effect in ipairs(skillInfo.effect) do
local entity = battleData:getSkillEntityByElement(elementType, side) local entity = actionTeam:getSkillEntityByElement(elementType, side)
if entity then if entity then
entity:addLinkEffect(effect, unitEntity, skillInfo.obj) entity:addLinkEffect(effect, unitEntity, skillInfo.obj)
end end
end end
end end
local _changeElementType = function(skillId, skillInfo, battleData, battleController, value, side) local _changeElementType = function(skillId, skillInfo, battleBaseData, battleController, value, side)
if not skillInfo.boardrange or not skillInfo.parameter then if not skillInfo.boardrange or not skillInfo.parameter then
return return
end end
@ -100,7 +102,7 @@ local _changeElementType = function(skillId, skillInfo, battleData, battleContro
battleController:changeElementType(count, elementType) battleController:changeElementType(count, elementType)
end end
local _addAttr = function(skillId, skillInfo, battleData, battleController, value, side) local _addAttr = function(skillId, skillInfo, battleBaseData, battleController, value, side)
if not skillInfo.attr then if not skillInfo.attr then
return return
end end
@ -108,18 +110,18 @@ local _addAttr = function(skillId, skillInfo, battleData, battleController, valu
if not value then if not value then
value = math.random(skillInfo.attr.minnum, skillInfo.attr.maxnum) value = math.random(skillInfo.attr.minnum, skillInfo.attr.maxnum)
end end
battleController:addHeroAttr(skillInfo.attr.type, value) battleController:addHeroAttr(skillInfo.attr.type, value, side)
end end
local _unlockSkill = function(skillId, skillInfo, battleData, battleController, value, side) local _unlockSkill = function(skillId, skillInfo, battleBaseData, battleController, value, side)
if not skillInfo.skill_position then if not skillInfo.skill_position then
return return
end end
battleData:unlockSkillEntity(skillInfo.skill_position, side) battleBaseData:unlockSkillEntity(skillInfo.skill_position, side)
end end
local _addSkillEffectParams = function(skillId, skillInfo, battleData, battleController, value, side) local _addSkillEffectParams = function(skillId, skillInfo, battleBaseData, battleController, value, side)
local elementType = skillInfo.skill_position local elementType = skillInfo.skill_position
if not elementType or not skillInfo.parameter then if not elementType or not skillInfo.parameter then
return return
@ -131,7 +133,7 @@ local _addSkillEffectParams = function(skillId, skillInfo, battleData, battleCon
end end
local effect local effect
local entity = battleData:getSkillEntityByElement(elementType, side) local entity = battleBaseData:getSkillEntityByElement(elementType, side)
if entity and entity:getEffect() then if entity and entity:getEffect() then
local effectCfg = entity:getEffect()[index] local effectCfg = entity:getEffect()[index]
if effectCfg then if effectCfg then
@ -144,20 +146,21 @@ local _addSkillEffectParams = function(skillId, skillInfo, battleData, battleCon
return return
end end
local skillEntity = battleData:getSkillEntityByElement(elementType, side) local skillEntity = battleBaseData:getSkillEntityByElement(elementType, side)
if skillEntity then if skillEntity then
local skillId = skillEntity:getSkillId() local skillId = skillEntity:getSkillId()
skillEntity:addSkillEffecuNumAdd(effect) skillEntity:addSkillEffecuNumAdd(effect)
if not battleData.atkTeam then local actionTeam = battleBaseData:getTeamBySide(side)
if not actionTeam then
return return
end end
if battleData.atkTeam:getAllMembers()[elementType] then if actionTeam:getAllMembers()[elementType] then
battleData.atkTeam:getAllMembers()[elementType]:addSkillParams(skillId, effect) actionTeam:getAllMembers()[elementType]:addSkillParams(skillId, effect)
end end
end end
end end
local _addSkillRound = function(skillId, skillInfo, battleData, battleController, value, side) local _addSkillRound = function(skillId, skillInfo, battleBaseData, battleController, value, side)
local elementType = skillInfo.skill_position local elementType = skillInfo.skill_position
if not elementType or not skillInfo.parameter then if not elementType or not skillInfo.parameter then
return return
@ -170,7 +173,7 @@ local _addSkillRound = function(skillId, skillInfo, battleData, battleController
end end
local effect local effect
local entity = battleData:getSkillEntityByElement(elementType, side) local entity = battleBaseData:getSkillEntityByElement(elementType, side)
if entity and entity:getEffect() then if entity and entity:getEffect() then
local effectCfg = entity:getEffect()[index] local effectCfg = entity:getEffect()[index]
if effectCfg then if effectCfg then
@ -183,20 +186,21 @@ local _addSkillRound = function(skillId, skillInfo, battleData, battleController
return return
end end
local skillEntity = battleData:getSkillEntityByElement(elementType, side) local skillEntity = battleBaseData:getSkillEntityByElement(elementType, side)
if skillEntity then if skillEntity then
local skillId = skillEntity:getSkillId() local skillId = skillEntity:getSkillId()
skillEntity:addSkillRoundAdd(effect) skillEntity:addSkillRoundAdd(effect)
if not battleData.atkTeam then local actionTeam = battleBaseData:getTeamBySide(side)
if not actionTeam then
return return
end end
if battleData.atkTeam:getAllMembers()[elementType] then if actionTeam:getAllMembers()[elementType] then
battleData.atkTeam:getAllMembers()[elementType]:addSkillRound(skillId, effect) actionTeam:getAllMembers()[elementType]:addSkillRound(skillId, effect)
end end
end end
end end
local _addSkillEffect = function(skillId, skillInfo, battleData, battleController, value, side) local _addSkillEffect = function(skillId, skillInfo, battleBaseData, battleController, value, side)
if not skillInfo.effect then if not skillInfo.effect then
return return
end end
@ -206,16 +210,15 @@ local _addSkillEffect = function(skillId, skillInfo, battleData, battleControlle
return return
end end
local atkComp = battleController.atkTeam:getMainUnit() local actionTeam = battleController:getCurActionTeam(side)
local defComp = battleController.defTeam:getMainUnit()
for _, effect in ipairs(effects) do for _, effect in ipairs(effects) do
local target = atkComp local target
if skillInfo.obj == BattleConst.SIDE_DEF then if skillInfo.obj == BattleConst.SIDE_DEF then
target = defComp target = battleController:getOtherSideTeam(side):getMainUnit()
elseif skillInfo.obj == BattleConst.SIDE_ATK then elseif skillInfo.obj == BattleConst.SIDE_ATK then
target = atkComp target = actionTeam
elseif skillInfo.obj == BattleConst.SIDE_ATK_ALL then elseif skillInfo.obj == BattleConst.SIDE_ATK_ALL then
for matchtype, comp in pairs(battleController.atkTeam:getUnitComp()) do for matchtype, comp in pairs(actionTeam) do
local buffEntity = BattleBuffEntity:create() local buffEntity = BattleBuffEntity:create()
buffEntity:init(effect, comp.unitEntity) buffEntity:init(effect, comp.unitEntity)
buffEntity:setTargetSide(skillInfo.obj) buffEntity:setTargetSide(skillInfo.obj)
@ -225,54 +228,59 @@ local _addSkillEffect = function(skillId, skillInfo, battleData, battleControlle
else else
local matchType = BattleConst.SIDE_OBJ_TO_MATCH_TYPE[skillInfo.obj] local matchType = BattleConst.SIDE_OBJ_TO_MATCH_TYPE[skillInfo.obj]
if matchType then if matchType then
target = battleController.atkTeam:getUnitComp()[matchType] target = actionTeam:getUnitComp()[matchType]
end end
end end
if not target then
return
end
local buffEntity = BattleBuffEntity:create() local buffEntity = BattleBuffEntity:create()
buffEntity:init(effect, atkComp.unitEntity) buffEntity:init(effect, actionTeam:getUnitComp().unitEntity)
buffEntity:setTargetSide(skillInfo.obj) buffEntity:setTargetSide(skillInfo.obj)
atkComp:takeEffect(buffEntity, target) actionTeam:getUnitComp():takeEffect(buffEntity, target)
end end
end end
local _addSkillInInfluenceAtkp = function(skillId, skillInfo, battleData, battleController, value, side) local _addSkillInInfluenceAtkp = function(skillId, skillInfo, battleBaseData, battleController, value, side)
local elementType = skillInfo.skill_position local elementType = skillInfo.skill_position
if not elementType or not skillInfo.effect then if not elementType or not skillInfo.effect then
return return
end end
if not battleData.atkTeam then local actionTeam = battleBaseData:getTeamBySide(side)
if not actionTeam then
return return
end end
local unitEntity = battleData.atkTeam:getAllMembers()[elementType] local unitEntity = actionTeam:getAllMembers()[elementType]
if not unitEntity then if not unitEntity then
return return
end end
local entity = battleData:getSkillEntityByElement(elementType, side) local entity = battleBaseData:getSkillEntityByElement(elementType, side)
for _, effect in ipairs(skillInfo.effect) do for _, effect in ipairs(skillInfo.effect) do
entity:addInInfluenceEffect(effect, unitEntity, skillInfo.obj) entity:addInInfluenceEffect(effect, unitEntity, skillInfo.obj)
end end
end end
local _addSkillAttackBeforeEffect = function(skillId, skillInfo, battleData, battleController, value, side) local _addSkillAttackBeforeEffect = function(skillId, skillInfo, battleBaseData, battleController, value, side)
local elementType = skillInfo.skill_position local elementType = skillInfo.skill_position
if not elementType or not skillInfo.effect then if not elementType or not skillInfo.effect then
return return
end end
if not battleData.atkTeam then local actionTeam = battleBaseData:getTeamBySide(side)
if not actionTeam then
return return
end end
local unitEntity = battleData.atkTeam:getAllMembers()[elementType] local unitEntity = actionTeam:getAllMembers()[elementType]
if not unitEntity then if not unitEntity then
return return
end end
local entity = battleData:getSkillEntityByElement(elementType, side) local entity = battleBaseData:getSkillEntityByElement(elementType, side)
if entity then if entity then
if skillInfo.cover_unlock then if skillInfo.cover_unlock then
entity:removeSkillAttackBeforeEffect(skillInfo.cover_unlock) entity:removeSkillAttackBeforeEffect(skillInfo.cover_unlock)
@ -283,22 +291,23 @@ local _addSkillAttackBeforeEffect = function(skillId, skillInfo, battleData, bat
end end
end end
local _addSkillElementCountEffect = function(skillId, skillInfo, battleData, battleController, value, side) local _addSkillElementCountEffect = function(skillId, skillInfo, battleBaseData, battleController, value, side)
local elementType = skillInfo.skill_position local elementType = skillInfo.skill_position
if not elementType or not skillInfo.effect then if not elementType or not skillInfo.effect then
return return
end end
if not battleData.atkTeam then local actionTeam = battleBaseData:getTeamBySide(side)
if not actionTeam then
return return
end end
local unitEntity = battleData.atkTeam:getAllMembers()[elementType] local unitEntity = actionTeam:getAllMembers()[elementType]
if not unitEntity then if not unitEntity then
return return
end end
local entity = battleData:getSkillEntityByElement(elementType, side) local entity = battleBaseData:getSkillEntityByElement(elementType, side)
if entity then if entity then
if skillInfo.cover_unlock then if skillInfo.cover_unlock then
entity:removeElementCountEffect(skillInfo.cover_unlock) entity:removeElementCountEffect(skillInfo.cover_unlock)
@ -309,22 +318,23 @@ local _addSkillElementCountEffect = function(skillId, skillInfo, battleData, bat
end end
end end
local _addLinkCountMoreEffect = function(skillId, skillInfo, battleData, battleController, value, side) local _addLinkCountMoreEffect = function(skillId, skillInfo, battleBaseData, battleController, value, side)
local elementType = skillInfo.skill_position local elementType = skillInfo.skill_position
if not elementType or not skillInfo.effect or not skillInfo.parameter then if not elementType or not skillInfo.effect or not skillInfo.parameter then
return return
end end
if not battleData.atkTeam then local actionTeam = battleBaseData:getTeamBySide(side)
if not actionTeam then
return return
end end
local unitEntity = battleData.atkTeam:getAllMembers()[elementType] local unitEntity = actionTeam:getAllMembers()[elementType]
if not unitEntity then if not unitEntity then
return return
end end
local entity = battleData:getSkillEntityByElement(elementType, side) local entity = battleBaseData:getSkillEntityByElement(elementType, side)
if entity then if entity then
if skillInfo.cover_unlock then if skillInfo.cover_unlock then
entity:removeLinkCountMoreEffects(skillInfo.cover_unlock) entity:removeLinkCountMoreEffects(skillInfo.cover_unlock)
@ -338,22 +348,23 @@ local _addLinkCountMoreEffect = function(skillId, skillInfo, battleData, battleC
end end
end end
local _addLinkCountPowerEffect = function(skillId, skillInfo, battleData, battleController, value, side) local _addLinkCountPowerEffect = function(skillId, skillInfo, battleBaseData, battleController, value, side)
local elementType = skillInfo.skill_position local elementType = skillInfo.skill_position
if not elementType or not skillInfo.effect or not skillInfo.parameter then if not elementType or not skillInfo.effect or not skillInfo.parameter then
return return
end end
if not battleData.atkTeam then local actionTeam = battleBaseData:getTeamBySide(side)
if not actionTeam then
return return
end end
local unitEntity = battleData.atkTeam:getAllMembers()[elementType] local unitEntity = actionTeam:getAllMembers()[elementType]
if not unitEntity then if not unitEntity then
return return
end end
local entity = battleData:getSkillEntityByElement(elementType, side) local entity = battleBaseData:getSkillEntityByElement(elementType, side)
if entity then if entity then
if skillInfo.cover_unlock then if skillInfo.cover_unlock then
entity:removeLinkCountPowerEffects(skillInfo.cover_unlock) entity:removeLinkCountPowerEffects(skillInfo.cover_unlock)
@ -367,7 +378,7 @@ local _addLinkCountPowerEffect = function(skillId, skillInfo, battleData, battle
end end
end end
local _addSkillRatio = function(skillId, skillInfo, battleData, battleController, value, side) local _addSkillRatio = function(skillId, skillInfo, battleBaseData, battleController, value, side)
local elementType = skillInfo.skill_position local elementType = skillInfo.skill_position
if not elementType or not skillInfo.parameter then if not elementType or not skillInfo.parameter then
return return
@ -380,7 +391,7 @@ local _addSkillRatio = function(skillId, skillInfo, battleData, battleController
end end
local effect local effect
local skillEntity = battleData:getSkillEntityByElement(elementType, side) local skillEntity = battleBaseData:getSkillEntityByElement(elementType, side)
if skillEntity and skillEntity:getEffect() then if skillEntity and skillEntity:getEffect() then
local effectCfg = skillEntity:getEffect()[index] local effectCfg = skillEntity:getEffect()[index]
if effectCfg then if effectCfg then
@ -396,11 +407,12 @@ local _addSkillRatio = function(skillId, skillInfo, battleData, battleController
if skillEntity then if skillEntity then
local skillId = skillEntity:getSkillId() local skillId = skillEntity:getSkillId()
skillEntity:addSkillRatioAdd(effect) skillEntity:addSkillRatioAdd(effect)
if not battleData.atkTeam then local actionTeam = battleBaseData:getTeamBySide(side)
if not actionTeam then
return return
end end
if battleData.atkTeam:getAllMembers()[elementType] then if actionTeam:getAllMembers()[elementType] then
battleData.atkTeam:getAllMembers()[elementType]:addSkillRatio(skillId, effect) actionTeam:getAllMembers()[elementType]:addSkillRatio(skillId, effect)
end end
end end
end end

View File

@ -628,11 +628,9 @@ function BattleTeam:onActionOver()
local skillMatch local skillMatch
if self.side == BattleConst.SIDE_ATK then if self.side == BattleConst.SIDE_ATK then
self.battleController.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ATK_STEP self.battleController.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ATK_STEP
self.battleController.curTeam = self.battleController.atkTeam
skillMatch = self:getMainUnit().unitEntity:getMatchType() skillMatch = self:getMainUnit().unitEntity:getMatchType()
else else
self.battleController.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_DEF_STEP self.battleController.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_DEF_STEP
self.battleController.curTeam = self.battleController.defTeam
end end
self:useNormalSkill(skillMatch, counterAttackCount, true, BattleConst.EFFECT_TYPE.DIRECT, BattleConst.ATTACK_ACTION_STATE.COUNTERATTACK, function() self:useNormalSkill(skillMatch, counterAttackCount, true, BattleConst.EFFECT_TYPE.DIRECT, BattleConst.ATTACK_ACTION_STATE.COUNTERATTACK, function()

View File

@ -121,9 +121,11 @@ function TipsManager:getRewardDesc(rewardId, rewardType)
return GConst.EMPTY_STRING return GConst.EMPTY_STRING
end end
function TipsManager:showBattleBoardSkillTips(elementType, tarPrefabObj, alignType) function TipsManager:showBattleBoardSkillTips(heroEntity, battleController, side, tarPrefabObj, alignType)
local params = { local params = {
elementType = elementType, heroEntity = heroEntity,
battleController = battleController,
side = side,
aniType = UIManager.ANI_TYPE.NONE, aniType = UIManager.ANI_TYPE.NONE,
} }
if tarPrefabObj then if tarPrefabObj then

View File

@ -27,6 +27,7 @@ function BattleBaseUI:initBaseInfo()
-- local uiMap = self.root:genAllChildren() -- local uiMap = self.root:genAllChildren()
-- self.uiMap = uiMap -- self.uiMap = uiMap
-- self.gridNode = ? -- self.gridNode = ?
-- self.boardCenterNode = ?
-- self.boardNode = ? -- self.boardNode = ?
-- self.boardNode:setAnchoredPositionX(DEFAULT_X) -- self.boardNode:setAnchoredPositionX(DEFAULT_X)
-- self.boardMask2D = self.gridNode:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_RECT_MASK_2D) -- self.boardMask2D = self.gridNode:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_RECT_MASK_2D)
@ -143,6 +144,7 @@ function BattleBaseUI:initSkillLineSfx()
self.skillLightSfxs[24] = self.uiMap["battle_ui_pvp.board_root_node.ani_node.sfx_skill_b05_4"] self.skillLightSfxs[24] = self.uiMap["battle_ui_pvp.board_root_node.ani_node.sfx_skill_b05_4"]
self.skillLightSfxs[25] = self.uiMap["battle_ui_pvp.board_root_node.ani_node.sfx_skill_b05_5"] self.skillLightSfxs[25] = self.uiMap["battle_ui_pvp.board_root_node.ani_node.sfx_skill_b05_5"]
end end
self:_initSkillLineSfx()
end end
function BattleBaseUI:initGenerateSkillEffect() function BattleBaseUI:initGenerateSkillEffect()
@ -189,13 +191,43 @@ function BattleBaseUI:initBossEnterAni()
-- self.bossEnterNode:setVisible(false) -- self.bossEnterNode:setVisible(false)
end end
function BattleBaseUI:enterShowBoardAni(callback)
self:clearEnterShowBoardSeq()
if callback then
callback()
end
end
function BattleBaseUI:enterHideBoardAni(callback)
self:clearEnterShowBoardSeq()
if callback then
callback()
end
end
function BattleBaseUI:showTutorialFinger(posIdList)
end
function BattleBaseUI:moveBattlefield(time)
end
--------------------------------end按需重写的方法-------------------------------- --------------------------------end按需重写的方法--------------------------------
function BattleBaseUI:getBGMId()
return AudioManager.BGM_ID.BATTLE
end
function BattleBaseUI:ctor(parmas) function BattleBaseUI:ctor(parmas)
self.battleController = parmas.battleController self.battleController = parmas.battleController
self.battleData = self.battleController.battleData self.battleData = self.battleController.battleData
end end
function BattleBaseUI:getPosInfo(posId)
return ModuleManager.BattleManager:getPosInfo(posId, self.battleData:getRowCount())
end
function BattleBaseUI:onPressBackspace() function BattleBaseUI:onPressBackspace()
if self.battleBuffTipsRoot then if self.battleBuffTipsRoot then
if self.battleBuffTipsRoot:getTransform().localScale.x > 0 then if self.battleBuffTipsRoot:getTransform().localScale.x > 0 then
@ -281,30 +313,32 @@ function BattleBaseUI:_initSkill(atkNode, atkCellPrefix, defNode, defCellPrefix)
[SIDE_DEF] = {}, [SIDE_DEF] = {},
} }
local initSKillCell = function(obj, elementType, sideSkillCells) local initSKillCell = function(obj, elementType, sideSkillCells, side)
sideSkillCells[elementType] = CellManager:addCellComp(obj, SKILL_NODE_CELL) sideSkillCells[elementType] = CellManager:addCellComp(obj, SKILL_NODE_CELL)
local skillEntity = DataManager.BattleData:getSkillEntities()[elementType] local skillEntity = self.battleData:getSkillEntities(side)[elementType]
if skillEntity then if skillEntity then
sideSkillCells[elementType]:refresh(skillEntity) sideSkillCells[elementType]:refresh(skillEntity)
end end
sideSkillCells[elementType]:getBaseObject():setActive(skillEntity ~= nil) sideSkillCells[elementType]:getBaseObject():setActive(skillEntity ~= nil)
sideSkillCells[elementType]:addClickListener(function() if skillEntity then
ModuleManager.TipsManager:showBattleBoardSkillTips(elementType, obj) sideSkillCells[elementType]:addClickListener(function()
end) ModuleManager.TipsManager:showBattleBoardSkillTips(self.battleData:getHeroEntity(elementType, side), self.battleController, side)
end)
end
end end
for name, elementType in pairs(GConst.BattleConst.ELEMENT_TYPE) do for name, elementType in pairs(GConst.BattleConst.ELEMENT_TYPE) do
if defCellPrefix then if defCellPrefix then
local obj = self.uiMap[defCellPrefix .. elementType] local obj = self.uiMap[defCellPrefix .. elementType]
if obj then if obj then
initSKillCell(obj, elementType, self.skillNodeCells[SIDE_DEF]) initSKillCell(obj, elementType, self.skillNodeCells[SIDE_DEF], SIDE_DEF)
end end
end end
if atkCellPrefix then if atkCellPrefix then
local objDef = self.uiMap[atkCellPrefix .. elementType] local obj = self.uiMap[atkCellPrefix .. elementType]
if objDef then if obj then
initSKillCell(objDef, elementType, self.skillNodeCells[SIDE_ATK]) initSKillCell(obj, elementType, self.skillNodeCells[SIDE_ATK], SIDE_ATK)
end end
end end
end end
@ -330,6 +364,9 @@ function BattleBaseUI:_initBuff(atkBuffPrefix, defBuffPrefix, battleBuffTipsRoot
local obj = self.uiMap[defBuffPrefix .. i] local obj = self.uiMap[defBuffPrefix .. i]
if obj then if obj then
self.tinyBuffCells[SIDE_DEF][i] = CellManager:addCellComp(obj, TINY_BUFF_CELL) self.tinyBuffCells[SIDE_DEF][i] = CellManager:addCellComp(obj, TINY_BUFF_CELL)
obj:addClickListener(function()
self.battleController:showBuffTips(SIDE_DEF)
end)
end end
end end
@ -337,6 +374,9 @@ function BattleBaseUI:_initBuff(atkBuffPrefix, defBuffPrefix, battleBuffTipsRoot
local obj = self.uiMap[atkBuffPrefix .. i] local obj = self.uiMap[atkBuffPrefix .. i]
if obj then if obj then
self.tinyBuffCells[SIDE_ATK][i] = CellManager:addCellComp(obj, TINY_BUFF_CELL) self.tinyBuffCells[SIDE_ATK][i] = CellManager:addCellComp(obj, TINY_BUFF_CELL)
obj:addClickListener(function()
self.battleController:showBuffTips(SIDE_ATK)
end)
end end
end end
end end
@ -373,11 +413,12 @@ function BattleBaseUI:refreshBuff(side, buffList)
local buffObj = nil local buffObj = nil
local count = #buffList local count = #buffList
local buffCellCount = #self.tinyBuffCells[side] local buffCellCount = #self.tinyBuffCells[side]
local index = 1 local index = 1
for i = 1, count do for i = 1, count do
buffObj = buffList[i] buffObj = buffList[i]
if buffObj and buffObj.buff:getIcon() and not buffObj.buff:getNotShowIcon() then if buffObj and buffObj.buff:getIcon() and not buffObj.buff:getNotShowIcon() then
local cell = self.tinyBuffCells[side][i] local cell = self.tinyBuffCells[side][index]
if cell then if cell then
cell:getBaseObject():setVisible(true) cell:getBaseObject():setVisible(true)
cell:refresh(buffObj.buff:getIcon(), buffObj.round) cell:refresh(buffObj.buff:getIcon(), buffObj.round)
@ -425,12 +466,6 @@ function BattleBaseUI:showRightBuffTips(buffList, autoClose)
self:showBuffTips(buffList, autoClose) self:showBuffTips(buffList, autoClose)
end end
function BattleBaseUI:showTutorialFinger(posIdList)
end
function BattleBaseUI:moveBattlefield(time)
end
function BattleBaseUI:getBattleNode() function BattleBaseUI:getBattleNode()
return self.battleNode return self.battleNode
end end
@ -567,7 +602,7 @@ function BattleBaseUI:playSkillLineSfx(posId, boradRangeList, randomPosList)
end end
end end
local pos = ModuleManager.BattleManager:getPosInfo(posId) local pos = self:getPosInfo(posId)
for dir, range in pairs(directionAndRange) do for dir, range in pairs(directionAndRange) do
local index = range * 10 + dir local index = range * 10 + dir
local obj = self.skillLineSfxs[index] local obj = self.skillLineSfxs[index]
@ -585,7 +620,7 @@ function BattleBaseUI:playSkillLineSfx(posId, boradRangeList, randomPosList)
self.skillLightSfxs.point:play() self.skillLightSfxs.point:play()
for i = 1, count do for i = 1, count do
local tartgetPos = randomPosList[i] local tartgetPos = randomPosList[i]
tartgetPos = ModuleManager.BattleManager:getPosInfo(tartgetPos) tartgetPos = self:getPosInfo(tartgetPos)
local obj = self.skillLightSfxs[20 + i] local obj = self.skillLightSfxs[20 + i]
if obj then if obj then
obj:setAnchoredPosition(tartgetPos.x, tartgetPos.y) obj:setAnchoredPosition(tartgetPos.x, tartgetPos.y)
@ -613,7 +648,7 @@ function BattleBaseUI:playChangeElementSfx(posId, index)
self.root.changeElementSfxs = {} self.root.changeElementSfxs = {}
end end
local pos = ModuleManager.BattleManager:getPosInfo(posId) local pos = self:getPosInfo(posId)
local info = self.root.changeElementSfxs[index] local info = self.root.changeElementSfxs[index]
if info then if info then
local obj = info.obj local obj = info.obj
@ -994,7 +1029,7 @@ function BattleBaseUI:refreshSkill(elementMap, showSfx, side)
end end
local skillCellMap = self.skillNodeCells[side] local skillCellMap = self.skillNodeCells[side]
for elementType, skillEntity in pairs(self.battleData:getSkillEntities()) do for elementType, skillEntity in pairs(self.battleData:getSkillEntities(side)) do
local skillCell = skillCellMap[elementType] local skillCell = skillCellMap[elementType]
if skillCell then if skillCell then
skillCell:refresh(skillEntity, elementMap, showSfx) skillCell:refresh(skillEntity, elementMap, showSfx)
@ -1173,7 +1208,7 @@ function BattleBaseUI:eliminationAni(aniSequence, effectGridMap, callback, side)
local breakSfxNameIndexMap = {} local breakSfxNameIndexMap = {}
for index, info in ipairs(aniSequence) do for index, info in ipairs(aniSequence) do
if not self.posIdMap[info.posId] then if not self.posIdMap[info.posId] then
local pos = ModuleManager.BattleManager:getPosInfo(info.posId) local pos = self:getPosInfo(info.posId)
self.posIdMap[info.posId] = true self.posIdMap[info.posId] = true
local entity = self.battleData:getGridEntity(info.posId) local entity = self.battleData:getGridEntity(info.posId)
@ -1204,7 +1239,7 @@ function BattleBaseUI:eliminationAni(aniSequence, effectGridMap, callback, side)
local posList = {} local posList = {}
local count = 0 local count = 0
for _, posId in ipairs(info.aniPosList) do for _, posId in ipairs(info.aniPosList) do
table.insert(posList, ModuleManager.BattleManager:getPosInfo(posId)) table.insert(posList, self:getPosInfo(posId))
count = count + 1 count = count + 1
end end
anitime = count * GConst.BattleConst.GRID_BREAK_EFFECT_INTERVAL anitime = count * GConst.BattleConst.GRID_BREAK_EFFECT_INTERVAL
@ -1231,7 +1266,7 @@ function BattleBaseUI:eliminationAni(aniSequence, effectGridMap, callback, side)
if info.breakFlyToCharacter then if info.breakFlyToCharacter then
targetPos = self.battleController.atkTeam:getMainUnit():getBaseObject():getTransform().position targetPos = self.battleController.atkTeam:getMainUnit():getBaseObject():getTransform().position
local sPoint = UIManager:getUICameraComponent():WorldToScreenPoint(targetPos) local sPoint = UIManager:getUICameraComponent():WorldToScreenPoint(targetPos)
targetPos = CS.BF.Utils.RectTransformScreenPointToLocalPointInRectangle(self.boardNode:getTransform(), sPoint.x, sPoint.y, UIManager:getUICameraComponent()) targetPos = CS.BF.Utils.RectTransformScreenPointToLocalPointInRectangle(self.boardCenterNode:getTransform(), sPoint.x, sPoint.y, UIManager:getUICameraComponent())
end end
self.eliminationAniSeq:Insert(time + 0.2, baseObject:getTransform():DOAnchorPos(targetPos, 0.3)) self.eliminationAniSeq:Insert(time + 0.2, baseObject:getTransform():DOAnchorPos(targetPos, 0.3))
self.eliminationAniSeq:Insert(time + 0.2, baseObject:getTransform():DOScale(0.5, 0.3)) self.eliminationAniSeq:Insert(time + 0.2, baseObject:getTransform():DOScale(0.5, 0.3))
@ -1286,7 +1321,7 @@ function BattleBaseUI:eliminationAni(aniSequence, effectGridMap, callback, side)
callback() callback()
end end
self:refreshSkill() self:refreshSkill(nil, nil, side)
self:resetParentAllSfxGridBreak() self:resetParentAllSfxGridBreak()
self.eliminationAniSeq = nil self.eliminationAniSeq = nil
end) end)
@ -1298,7 +1333,7 @@ function BattleBaseUI:dealGridBreakSfx(time, info, breakSfxNameIndexMap)
local breakIndex = breakSfxNameIndexMap[info.breakSfxName] local breakIndex = breakSfxNameIndexMap[info.breakSfxName]
self.eliminationAniSeq:InsertCallback(time, function() self.eliminationAniSeq:InsertCallback(time, function()
self:getSfxGridBreak(info.breakSfxName, breakIndex, function(obj) self:getSfxGridBreak(info.breakSfxName, breakIndex, function(obj)
local pos = ModuleManager.BattleManager:getPosInfo(info.posId) local pos = self:getPosInfo(info.posId)
obj:setLocalPosition(pos.x, pos.y, 0) obj:setLocalPosition(pos.x, pos.y, 0)
obj:play() obj:play()
end) end)
@ -1327,7 +1362,7 @@ function BattleBaseUI:dealGridEffectSfx(time, info, breakSfxNameIndexMap, entity
obj:play() obj:play()
table.insert(self.flowEffects, obj) table.insert(self.flowEffects, obj)
else else
local pos = ModuleManager.BattleManager:getPosInfo(info.posId) local pos = self:getPosInfo(info.posId)
obj:setLocalPosition(pos.x, pos.y, 0) obj:setLocalPosition(pos.x, pos.y, 0)
obj:play() obj:play()
end end
@ -1350,7 +1385,7 @@ end
function BattleBaseUI:showGridEffectSfx(posId, sfxName, callback, customTime, zEuler) function BattleBaseUI:showGridEffectSfx(posId, sfxName, callback, customTime, zEuler)
self:getSfxGridEffect(sfxName, function(info) self:getSfxGridEffect(sfxName, function(info)
info.isIdle = false info.isIdle = false
local pos = ModuleManager.BattleManager:getPosInfo(posId) local pos = self:getPosInfo(posId)
customTime = customTime or info.obj:getDuration() customTime = customTime or info.obj:getDuration()
info.obj:setLocalPosition(pos.x, pos.y, 0) info.obj:setLocalPosition(pos.x, pos.y, 0)
info.obj:setLocalEulerAngles(0, 0, zEuler) info.obj:setLocalEulerAngles(0, 0, zEuler)
@ -1382,7 +1417,7 @@ function BattleBaseUI:moveGridCells(gridEntityList, callback)
for _, entity in pairs(gridEntityList) do for _, entity in pairs(gridEntityList) do
local posId = entity:getPosId() local posId = entity:getPosId()
local baseObject = entity:getCell():getBaseObject() local baseObject = entity:getCell():getBaseObject()
local pos = ModuleManager.BattleManager:getPosInfo(posId) local pos = self:getPosInfo(posId)
if entity:getEffectType() then if entity:getEffectType() then
baseObject:getTransform():SetAsLastSibling() baseObject:getTransform():SetAsLastSibling()
end end
@ -1422,7 +1457,7 @@ function BattleBaseUI:generateSkillAni(map, callback, side)
local pos = self:getElementSkillPos(elementType, side) local pos = self:getElementSkillPos(elementType, side)
cell:getBaseObject():setAnchoredPosition(pos.x, pos.y) cell:getBaseObject():setAnchoredPosition(pos.x, pos.y)
end) end)
local pos = ModuleManager.BattleManager:getPosInfo(info.posId) local pos = self:getPosInfo(info.posId)
self.generateSkillAniSeq:Append(cell:getBaseObject():getTransform():DOAnchorPos(pos, 0.5)) self.generateSkillAniSeq:Append(cell:getBaseObject():getTransform():DOAnchorPos(pos, 0.5))
if self.generateSkillSfxs and self.generateSkillSfxs[count] then if self.generateSkillSfxs and self.generateSkillSfxs[count] then
self.generateSkillSfxs[count]:setAnchoredPosition(pos.x, pos.y) self.generateSkillSfxs[count]:setAnchoredPosition(pos.x, pos.y)
@ -1512,7 +1547,7 @@ function BattleBaseUI:showMonsterSkillAni(map, monsterPos, callback)
end end
local sPoint = UIManager:getUICameraComponent():WorldToScreenPoint(monsterPos) local sPoint = UIManager:getUICameraComponent():WorldToScreenPoint(monsterPos)
monsterPos = CS.BF.Utils.RectTransformScreenPointToLocalPointInRectangle(self.boardNode:getTransform(), sPoint.x, sPoint.y, UIManager:getUICameraComponent()) monsterPos = CS.BF.Utils.RectTransformScreenPointToLocalPointInRectangle(self.boardCenterNode:getTransform(), sPoint.x, sPoint.y, UIManager:getUICameraComponent())
self.monsterSkillAniSeq = self.root:createBindTweenSequence() self.monsterSkillAniSeq = self.root:createBindTweenSequence()
local count = 1 local count = 1
@ -1526,7 +1561,7 @@ function BattleBaseUI:showMonsterSkillAni(map, monsterPos, callback)
cell:refresh(entity) cell:refresh(entity)
cell:getBaseObject():setAnchoredPosition(monsterPos.x, monsterPos.y) cell:getBaseObject():setAnchoredPosition(monsterPos.x, monsterPos.y)
cell:getBaseObject():setLocalScale(0.3, 0.3, 0.3) cell:getBaseObject():setLocalScale(0.3, 0.3, 0.3)
local pos = ModuleManager.BattleManager:getPosInfo(posId) local pos = self:getPosInfo(posId)
if count == 1 then if count == 1 then
self.monsterSkillAniSeq:Append(cell:getBaseObject():getTransform():DOAnchorPos(pos, 0.3)) self.monsterSkillAniSeq:Append(cell:getBaseObject():getTransform():DOAnchorPos(pos, 0.3))
else else
@ -1551,7 +1586,7 @@ function BattleBaseUI:hideMonsterSkillGridCells()
-- local obj = uiMap["battle_ui.bg_2.ani_node.grid_cell_m" .. elementType] -- local obj = uiMap["battle_ui.bg_2.ani_node.grid_cell_m" .. elementType]
-- if obj then -- if obj then
-- local cell = CellManager:addCellComp(obj, GRID_CELL) -- local cell = CellManager:addCellComp(obj, GRID_CELL)
-- local entity = DataManager.BattleData:getNewGridEntity() -- local entity = self.battleData:getNewGridEntity()
-- entity:setCell(cell) -- entity:setCell(cell)
-- table.insert(self.monsterSkillGridEntities, entity) -- table.insert(self.monsterSkillGridEntities, entity)
-- end -- end
@ -1605,7 +1640,7 @@ function BattleBaseUI:shuffleBoard(changeInfo, callback)
local cell = entity:getCell() local cell = entity:getCell()
local posId = entity:getPosId() local posId = entity:getPosId()
if cell then if cell then
local pos = ModuleManager.BattleManager:getPosInfo(posId) local pos = self:getPosInfo(posId)
self.shuffleBoardSeq:Insert(0, cell:getBaseObject():getTransform():DOAnchorPos(pos, 1)) self.shuffleBoardSeq:Insert(0, cell:getBaseObject():getTransform():DOAnchorPos(pos, 1))
end end
end end
@ -1743,7 +1778,7 @@ function BattleBaseUI:doCacheAni(skillInfo, callback)
local entity = self.root.skillAniGridEntities[index] local entity = self.root.skillAniGridEntities[index]
if entity then if entity then
entity:setSkilId(info.skillId) entity:setSkilId(info.skillId)
local pos = ModuleManager.BattleManager:getPosInfo(info.posId) local pos = self:getPosInfo(info.posId)
local cell = entity:getCell() local cell = entity:getCell()
if cell then if cell then
cell:refresh(entity) cell:refresh(entity)
@ -1818,7 +1853,6 @@ function BattleBaseUI:doCachePopAni(skillInfo, callback)
local entity = self.root.skillAniGridEntities[index] local entity = self.root.skillAniGridEntities[index]
if entity then if entity then
entity:setSkilId(info.skillId) entity:setSkilId(info.skillId)
local pos = ModuleManager.BattleManager:getPosInfo(info.posId)
local cell = entity:getCell() local cell = entity:getCell()
if cell then if cell then
cell:refresh(entity) cell:refresh(entity)
@ -1839,7 +1873,7 @@ function BattleBaseUI:doCachePopAni(skillInfo, callback)
for index, info in ipairs(skillInfo) do for index, info in ipairs(skillInfo) do
local entity = self.root.skillAniGridEntities[index] local entity = self.root.skillAniGridEntities[index]
if entity then if entity then
local pos = ModuleManager.BattleManager:getPosInfo(info.posId) local pos = self:getPosInfo(info.posId)
local cell = entity:getCell() local cell = entity:getCell()
if cell then if cell then
local obj = cell:getBaseObject() local obj = cell:getBaseObject()
@ -1884,7 +1918,7 @@ function BattleBaseUI:getElementSkillPos(elementType, side)
else else
local targetPos = cell:getBaseObject():getTransform().position local targetPos = cell:getBaseObject():getTransform().position
local sPoint = UIManager:getUICameraComponent():WorldToScreenPoint(targetPos) local sPoint = UIManager:getUICameraComponent():WorldToScreenPoint(targetPos)
targetPos = CS.BF.Utils.RectTransformScreenPointToLocalPointInRectangle(self.boardNode:getTransform(), sPoint.x, sPoint.y, UIManager:getUICameraComponent()) targetPos = CS.BF.Utils.RectTransformScreenPointToLocalPointInRectangle(self.boardCenterNode:getTransform(), sPoint.x, sPoint.y, UIManager:getUICameraComponent())
self.skillPoss[side][elementType] = targetPos self.skillPoss[side][elementType] = targetPos
end end
end end
@ -2092,7 +2126,7 @@ function BattleBaseUI:showCommonSkillTips(skillId)
end end
local value = 0 local value = 0
local selectSkillMap = DataManager.BattleData:getSelectSkillMap() local selectSkillMap = self.battleData:getSelectSkillMap(self.battleController:getCurActionSide())
if selectSkillMap[skillId] then if selectSkillMap[skillId] then
value = selectSkillMap[skillId].value value = selectSkillMap[skillId].value
end end
@ -2160,6 +2194,13 @@ function BattleBaseUI:showBossEnterAni(bornTime, bossName, monsterComp, callback
end) end)
end end
function BattleBaseUI:clearEnterShowBoardSeq()
if self.enterShowBoardSeq then
self.enterShowBoardSeq:Kill()
self.enterShowBoardSeq = nil
end
end
function BattleBaseUI:clear() function BattleBaseUI:clear()
if self.alreadyClear then if self.alreadyClear then
return return
@ -2275,6 +2316,8 @@ function BattleBaseUI:clear()
self.moveGridCellsSeq:Kill() self.moveGridCellsSeq:Kill()
self.moveGridCellsSeq = nil self.moveGridCellsSeq = nil
end end
self:clearEnterShowBoardSeq()
end end
return BattleBaseUI return BattleBaseUI

View File

@ -28,7 +28,8 @@ end
function BattlePauseUI:ctor(params) function BattlePauseUI:ctor(params)
self.battleType = params.battleType self.battleType = params.battleType
local map = DataManager.BattleData:getSelectSkillMap() local battleController = ModuleManager.BattleManager.battleController
local map = battleController.battleData:getSelectSkillMap()
self.skillList = {} self.skillList = {}
for skillId, info in pairs(map) do for skillId, info in pairs(map) do
local cfg = SKILL_ROGUE_CFG[skillId] local cfg = SKILL_ROGUE_CFG[skillId]

View File

@ -77,10 +77,11 @@ function BattleSkillSelectComp:refreshBtns()
uiMap["battle_select_skill_comp.skill_node.ad_btn.tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_3)) uiMap["battle_select_skill_comp.skill_node.ad_btn.tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_3))
uiMap["battle_select_skill_comp.skill_node.diamond_btn.tx"]:setText(GFunc.getRewardNum(GFunc.getConstReward("refresh_skill_cost"))) uiMap["battle_select_skill_comp.skill_node.diamond_btn.tx"]:setText(GFunc.getRewardNum(GFunc.getConstReward("refresh_skill_cost")))
local battleController = ModuleManager.BattleManager.battleController
local cfgAdCount = GFunc.getConstIntValue("ad_refresh_skill") local cfgAdCount = GFunc.getConstIntValue("ad_refresh_skill")
local cfgRefreshCount = GFunc.getConstIntValue("diamond_refresh_skill") + cfgAdCount local cfgRefreshCount = GFunc.getConstIntValue("diamond_refresh_skill") + cfgAdCount
local adCount = DataManager.BattleData:getADRefreshSkillCount() local adCount = battleController.battleData:getADRefreshSkillCount()
local refreshCount = DataManager.BattleData:getRefreshSkillCount() local refreshCount =battleController.battleData:getRefreshSkillCount()
local showAdBtn = cfgAdCount > adCount local showAdBtn = cfgAdCount > adCount
uiMap["battle_select_skill_comp.skill_node.ad_btn"]:setActive(showAdBtn) uiMap["battle_select_skill_comp.skill_node.ad_btn"]:setActive(showAdBtn)
local showBtn = refreshCount < cfgRefreshCount local showBtn = refreshCount < cfgRefreshCount

File diff suppressed because it is too large Load Diff

View File

@ -2,29 +2,28 @@ local BattleBaseUI = require "app/ui/battle/battle_base_ui"
local BattleUIPVP = class("BattleUIPVP", BattleBaseUI) local BattleUIPVP = class("BattleUIPVP", BattleBaseUI)
local DEFAULT_X = 10000 local DEFAULT_X = 10000
local BOARD_POS_UP = BF.Vector2(0, 47)
local BOARD_POS_DOWN = BF.Vector2(0, -740)
---------------------------------必须重写的方法---------------------------------- ---------------------------------必须重写的方法----------------------------------
function BattleBaseUI:initBaseInfo() function BattleUIPVP:initBaseInfo()
local uiMap = self.root:genAllChildren() local uiMap = self.root:genAllChildren()
self.uiMap = uiMap self.uiMap = uiMap
self.gridNode = uiMap["battle_ui_pvp.board_root_node.board_node_atk.grid_node"] self.gridNode = uiMap["battle_ui_pvp.board_root_node.board_node_atk.grid_node"]
self.boardNode = uiMap["battle_ui_pvp.board_root_node.board_node_atk"] self.boardNode = uiMap["battle_ui_pvp.board_root_node"]
self.boardCenterNode = uiMap["battle_ui_pvp.board_root_node.board_center_node"]
self.boardNode:setAnchoredPositionX(DEFAULT_X) self.boardNode:setAnchoredPositionX(DEFAULT_X)
self.boardMask2D = self.gridNode:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_RECT_MASK_2D) self.boardMask2D = self.gridNode:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_RECT_MASK_2D)
self.boardMask = uiMap["battle_ui_pvp.board_root_node.board_node_atk.grid_node.board_mask"] self.boardMask = uiMap["battle_ui_pvp.board_root_node.board_mask"]
self.boardMask:setVisible(false) self.boardMask:setVisible(false)
self.boardCacheNode = uiMap["battle_ui.bg_2.board_cache_node"] self.boardCacheNode = uiMap["battle_ui_pvp.board_root_node.board_cache_node"]
self.boardCacheNode:setVisible(false) self.boardCacheNode:setVisible(false)
self.boardCacheBox = uiMap["battle_ui.bg_2.board_cache_node.skill_box"] self.boardCacheBox = uiMap["battle_ui_pvp.board_root_node.board_cache_node.skill_box"]
self.boardCacheBox:setAnchoredPositionX(DEFAULT_X) self.boardCacheBox:setAnchoredPositionX(DEFAULT_X)
self.battleRoot = uiMap["battle_ui.battle_root"] self.battleRoot = uiMap["battle_ui_pvp.battle_root"]
self.maxLayerNode = uiMap["battle_ui.battle_root.battle_node.max_layer_show_node"] self.maxLayerNode = uiMap["battle_ui_pvp.battle_root.battle_node.max_layer_show_node"]
end end
function BattleUIPVP:initBg() function BattleUIPVP:initBg()
self.bg = self.uiMap["battle_ui.battle_root.bg"] self.bg = self.uiMap["battle_ui_pvp.battle_root.bg"]
self.bg:setLocalScale(0, 0, 0) self.bg:setLocalScale(0, 0, 0)
local width = self.bg:fastGetSizeDelta() local width = self.bg:fastGetSizeDelta()
self.bg:setAnchoredPositionX(width/4) self.bg:setAnchoredPositionX(width/4)
@ -50,7 +49,7 @@ function BattleUIPVP:initBuff()
end end
function BattleUIPVP:initBattlefield() function BattleUIPVP:initBattlefield()
self.battleNode = self.uiMap["battle_ui.battle_root.battle_node"] self.battleNode = self.uiMap["battle_ui_pvp.battle_root.battle_node"]
end end
function BattleUIPVP:initNumberNode() function BattleUIPVP:initNumberNode()
@ -62,7 +61,7 @@ function BattleUIPVP:initNumberNode()
self.battleNumberSpecial = self.uiMap["battle_ui_pvp.cache_node.battle_number_special"] self.battleNumberSpecial = self.uiMap["battle_ui_pvp.cache_node.battle_number_special"]
end end
function BattleBaseUI:initComboNode() function BattleUIPVP:initComboNode()
self.comboNode = self.uiMap["battle_ui_pvp.battle_root.combo"] self.comboNode = self.uiMap["battle_ui_pvp.battle_root.combo"]
self.comboBg1 = self.uiMap["battle_ui_pvp.battle_root.combo.bg.bg_1"] self.comboBg1 = self.uiMap["battle_ui_pvp.battle_root.combo.bg.bg_1"]
self.comboTx1 = self.uiMap["battle_ui_pvp.battle_root.combo.number.text.text_1"] self.comboTx1 = self.uiMap["battle_ui_pvp.battle_root.combo.number.text.text_1"]
@ -73,7 +72,7 @@ function BattleBaseUI:initComboNode()
self:_initComboNode() self:_initComboNode()
end end
function BattleBaseUI:initHpNode() function BattleUIPVP:initHpNode()
self.hpProgressLeft = self.uiMap["battle_ui_pvp.bottom_node.hp_node.hp_progress"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER) self.hpProgressLeft = self.uiMap["battle_ui_pvp.bottom_node.hp_node.hp_progress"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)
self.hpProgressRight = self.uiMap["battle_ui_pvp.top_node.hp_node.hp_progress"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER) self.hpProgressRight = self.uiMap["battle_ui_pvp.top_node.hp_node.hp_progress"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)
self.hpTextLeft = self.uiMap["battle_ui_pvp.bottom_node.hp_node.hp"] self.hpTextLeft = self.uiMap["battle_ui_pvp.bottom_node.hp_node.hp"]
@ -84,7 +83,7 @@ function BattleBaseUI:initHpNode()
end end
function BattleUIPVP:initFxNode() function BattleUIPVP:initFxNode()
self.fxNode = self.uiMap["battle_ui.battle_root.batttle_fx_node"] self.fxNode = self.uiMap["battle_ui_pvp.battle_root.batttle_fx_node"]
end end
function BattleUIPVP:hideGenerateSkillGridCells() function BattleUIPVP:hideGenerateSkillGridCells()
@ -92,7 +91,7 @@ function BattleUIPVP:hideGenerateSkillGridCells()
self:_hideGenerateSkillGridCells(generateSkillCellPrefix) self:_hideGenerateSkillGridCells(generateSkillCellPrefix)
end end
function BattleBaseUI:initSkillLineSfx() function BattleUIPVP:initSkillLineSfx()
if not self.skillLineSfxs then if not self.skillLineSfxs then
self.skillLineSfxs = {} self.skillLineSfxs = {}
self.skillLineSfxs[13] = self.uiMap["battle_ui_pvp.board_root_node.ani_node.sfx_skill_b01_2_1h"] self.skillLineSfxs[13] = self.uiMap["battle_ui_pvp.board_root_node.ani_node.sfx_skill_b01_2_1h"]
@ -126,10 +125,12 @@ function BattleBaseUI:initSkillLineSfx()
self.skillLightSfxs[24] = self.uiMap["battle_ui_pvp.board_root_node.ani_node.sfx_skill_b05_4"] self.skillLightSfxs[24] = self.uiMap["battle_ui_pvp.board_root_node.ani_node.sfx_skill_b05_4"]
self.skillLightSfxs[25] = self.uiMap["battle_ui_pvp.board_root_node.ani_node.sfx_skill_b05_5"] self.skillLightSfxs[25] = self.uiMap["battle_ui_pvp.board_root_node.ani_node.sfx_skill_b05_5"]
end end
self:_initSkillLineSfx()
end end
function BattleUIPVP:initGenerateSkillEffect() function BattleUIPVP:initGenerateSkillEffect()
local generateSkillEffecPrefix = "battle_ui_pvp.board_root_node.ani_node.grid_cell_" local generateSkillEffecPrefix = "battle_ui_pvp.board_root_node.ani_node.sfx_piece_skill_b01_"
self:_initGenerateSkillEffect(generateSkillEffecPrefix) self:_initGenerateSkillEffect(generateSkillEffecPrefix)
end end
@ -147,66 +148,40 @@ function BattleUIPVP:getPrefabPath()
return "assets/prefabs/ui/battle/battle_ui_pvp.prefab" return "assets/prefabs/ui/battle/battle_ui_pvp.prefab"
end end
function BattleUIPVP:getBGMId()
return AudioManager.BGM_ID.BATTLE
end
function BattleUIPVP:_display() function BattleUIPVP:_display()
BattleBaseUI._display(self) BattleBaseUI._display(self)
self:refreshAvatar() self:refreshAvatar()
---- 适配
local w, h = GFunc.getUIExpandScreenSize()
local scale = math.min(1, h / 1280 * 0.84)
self.boardCenterNode:setVisible(true, scale)
end end
function BattleUIPVP:_addListeners() function BattleUIPVP:_addListeners()
local uiMap = self.root:genAllChildren() local uiMap = self.root:genAllChildren()
uiMap["battle_ui.top_node.close_btn"]:addClickListener(function() uiMap["battle_ui_pvp.top_node.close_btn"]:addClickListener(function()
ModuleManager.BattleManager:showPauseUI(self.battleController.battleType) ModuleManager.BattleManager:showPauseUI(self.battleController.battleType)
end) end)
end end
function BattleUIPVP:getBoardRootNode()
local uiMap = self.root:genAllChildren()
return uiMap["battle_ui_pvp.board_root_node"]
end
function BattleUIPVP:refreshAvatar() function BattleUIPVP:refreshAvatar()
-- 等数据 -- 等数据
end end
function BattleUIPVP:showLeftBuffTips(buffList, autoClose) function BattleUIPVP:showLeftBuffTips(buffList, autoClose)
local addY = self:showBuffTips(buffList, autoClose) local addY = self:showBuffTips(buffList, autoClose)
self.battleBuffTipsBg:setAnchoredPosition(-175, -1018 + addY) self.battleBuffTipsBg:setAnchoredPosition(-175, -1050 + addY)
end end
function BattleUIPVP:showRightBuffTips(buffList, autoClose) function BattleUIPVP:showRightBuffTips(buffList, autoClose)
self:showBuffTips(buffList, autoClose) self:showBuffTips(buffList, autoClose)
self.battleBuffTipsBg:setAnchoredPosition(175, -188) self.battleBuffTipsBg:setAnchoredPosition(175, -200)
end
function BattleUIPVP:switchBoard(downCallback, callback, isFirst)
if self.switchBoardSeq then
self.switchBoardSeq:Kill()
self.switchBoardSeq = nil
end
if isFirst then
if downCallback then
downCallback()
end
if callback then
callback()
end
self.boardNode:setAnchoredPositionY(BOARD_POS_UP.y)
return
end
self.switchBoardSeq = self.root:createBindTweenSequence()
self.switchBoardSeq:Append(self.boardNode:getTransform():DOAnchorPos(BOARD_POS_DOWN, 0.5))
self.switchBoardSeq:AppendCallback(function()
if downCallback then
downCallback()
end
end)
self.switchBoardSeq:Append(self.boardNode:getTransform():DOAnchorPos(BOARD_POS_UP, 0.5))
self.switchBoardSeq:AppendCallback(function()
if callback then
callback()
end
end)
end end
function BattleUIPVP:refreshWave(wave, iconAtlas, iconName) function BattleUIPVP:refreshWave(wave, iconAtlas, iconName)
@ -214,11 +189,41 @@ function BattleUIPVP:refreshWave(wave, iconAtlas, iconName)
local icon = uiMap["battle_ui_pvp.bottom_node.round_icon"] local icon = uiMap["battle_ui_pvp.bottom_node.round_icon"]
local desc = uiMap["battle_ui_pvp.bottom_node.round_text"] local desc = uiMap["battle_ui_pvp.bottom_node.round_text"]
desc:setText(wave) desc:setText(wave)
GFunc.centerImgAndTx(icon, desc, 10) -- GFunc.centerImgAndTx(icon, desc, 10)
iconAtlas = iconAtlas or GConst.ATLAS_PATH.COMMON iconAtlas = iconAtlas or GConst.ATLAS_PATH.COMMON
iconName = iconName or "common_dec_3" iconName = iconName or "common_dec_3"
icon:setSprite(iconAtlas, iconName) icon:setSprite(iconAtlas, iconName)
end end
function BattleBaseUI:enterShowBoardAni(callback)
self:clearEnterShowBoardSeq()
self.enterShowBoardSeq = self.root:createBindTweenSequence()
self.enterShowBoardSeq:Append(self:getBoardRootNode():getTransform():DOLocalMoveX(0, 0.5))
self.enterShowBoardSeq:AppendCallback(function()
local str
if self.battleController.curActionSide == GConst.BattleConst.SIDE_ATK then
str = I18N:getGlobalText(I18N.GlobalConst.ARENA_BATTLE_DESC_1)
else
str = I18N:getGlobalText(I18N.GlobalConst.ARENA_BATTLE_DESC_2)
end
GFunc.showToast(str)
if callback then
callback()
end
end)
end
function BattleBaseUI:enterHideBoardAni(callback)
self:clearEnterShowBoardSeq()
self.enterShowBoardSeq = self.root:createBindTweenSequence()
local w, h = GFunc.getUIExpandScreenSize()
self.enterShowBoardSeq:Append(self:getBoardRootNode():getTransform():DOLocalMoveX(w / 2 + 360, 0.5))
self.enterShowBoardSeq:AppendCallback(function()
if callback then
callback()
end
end)
end
return BattleUIPVP return BattleUIPVP

View File

@ -67,7 +67,7 @@ function GridCell:refresh(gridEntity, curElement, skillPosId)
skillIcon:setVisible(true) skillIcon:setVisible(true)
local sprite local sprite
local skillEntity = DataManager.BattleData:getSkillEntityBySkillId(skillId) local skillEntity = self:getSkillEntity()
if skillEntity then if skillEntity then
sprite = skillEntity:getBattleIcon() sprite = skillEntity:getBattleIcon()
else else
@ -91,7 +91,6 @@ function GridCell:refresh(gridEntity, curElement, skillPosId)
end end
end end
local skillEntity = DataManager.BattleData:getSkillEntityBySkillId(skillId)
local ignoreElementType = skillEntity:getIgnoreElementType() local ignoreElementType = skillEntity:getIgnoreElementType()
local skillBg local skillBg
if ignoreElementType and not self.lastShowHlElementType then if ignoreElementType and not self.lastShowHlElementType then
@ -108,7 +107,7 @@ function GridCell:refresh(gridEntity, curElement, skillPosId)
skillIcon:setVisible(false) skillIcon:setVisible(false)
end end
uiMap["grid_cell.touch_node.ani_node.mask"]:setVisible(showMask) self:showMask(showMask)
self:showCircle(gridEntity:getNeedElimination()) self:showCircle(gridEntity:getNeedElimination())
if self.gridEntity:getIsIdle() then if self.gridEntity:getIsIdle() then
self.lastShowHlElementType = nil self.lastShowHlElementType = nil
@ -128,6 +127,11 @@ function GridCell:refresh(gridEntity, curElement, skillPosId)
end end
end end
function GridCell:showMask(showMask)
local uiMap = self:getUIMap()
uiMap["grid_cell.touch_node.ani_node.mask"]:setVisible(showMask)
end
function GridCell:addTouchListener(func) function GridCell:addTouchListener(func)
local uiMap = self:getUIMap() local uiMap = self:getUIMap()
uiMap["grid_cell.touch_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_ELIMINATION_TOUCH_EVENT):AddTouchEventListener(func) uiMap["grid_cell.touch_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_ELIMINATION_TOUCH_EVENT):AddTouchEventListener(func)
@ -150,7 +154,7 @@ function GridCell:showHighLight(show, mainElementType)
downBg:setVisible(skillId ~= nil) downBg:setVisible(skillId ~= nil)
if skillId then if skillId then
show = true -- 有技能,强制显示特效 show = true -- 有技能,强制显示特效
local skillEntity = DataManager.BattleData:getSkillEntityBySkillId(skillId) local skillEntity = self:getSkillEntity()
local ignoreElementType = skillEntity:getIgnoreElementType() local ignoreElementType = skillEntity:getIgnoreElementType()
local skillBg local skillBg
if ignoreElementType and not mainElementType then if ignoreElementType and not mainElementType then
@ -284,4 +288,15 @@ function GridCell:playAnim(aniName, loop, forceRefresh, forceGetSG)
spineObj:playAnim(aniName, loop, forceRefresh, forceGetSG) spineObj:playAnim(aniName, loop, forceRefresh, forceGetSG)
end end
function GridCell:getSkillEntity()
if not self.gridEntity then
return
end
local skillId = self.gridEntity:getSkillId()
if skillId then
local skillEntity = self.gridEntity:getBattleData():getSkillEntityBySkillId(skillId, self.gridEntity:getSkillSide())
return skillEntity
end
end
return GridCell return GridCell

View File

@ -2,9 +2,9 @@ local TinyBuffCell = class("TinyBuffCell", BaseCell)
function TinyBuffCell:refresh(buffName, round) function TinyBuffCell:refresh(buffName, round)
if round <= 1 or round > 9 then if round <= 1 or round > 9 then
round:setText(GConst.EMPTY_STRING) round = GConst.EMPTY_STRING
else else
round:setText(tostring(round)) round = tostring(round)
end end
local uiMap = self:getUIMap() local uiMap = self:getUIMap()

View File

@ -12,10 +12,12 @@ function BattleBoardSkillTips:onPressBackspace()
end end
function BattleBoardSkillTips:ctor(params) function BattleBoardSkillTips:ctor(params)
local elementType = params.elementType
self.params = params self.params = params
self.boardSkillEntity = DataManager.BattleData:getSkillEntityByElement(elementType) self.heroEntity = params.heroEntity
self.battleUnitEntity = DataManager.BattleData:getAtkTeam():getAllMembers()[elementType] self.battleData = params.battleController.battleData
self.side = params.side
self.boardSkillEntity = self.battleData:getSkillEntityByElement(self.heroEntity:getMatchType())
self.battleUnitEntity = self.battleData:getTeamBySide(self.side):getAllMembers()[self.heroEntity:getMatchType()]
self.tarCornerScreenPos = params.tarCornerScreenPos self.tarCornerScreenPos = params.tarCornerScreenPos
self.location = params.location self.location = params.location
end end
@ -51,15 +53,11 @@ function BattleBoardSkillTips:onRefresh()
self:closeUI() self:closeUI()
end) end)
local heroId = self.battleUnitEntity:getId() local heroId = self.heroEntity:getCfgId()
local heroEntity = DataManager.HeroData:getHeroById(heroId)
if not heroEntity then
return
end
local heroNmae = ModuleManager.HeroManager:getHeroName(heroId) local heroNmae = ModuleManager.HeroManager:getHeroName(heroId)
local atk = self.battleUnitEntity:getAtk() local atk = self.battleUnitEntity:getAtk()
self.atkDesc:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_9, heroNmae, atk)) self.atkDesc:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_9, heroNmae, atk))
self.skillDesc:setText(ModuleManager.HeroManager:getSkillDesc(heroEntity:getBaseSkill())) self.skillDesc:setText(ModuleManager.HeroManager:getSkillDesc(self.heroEntity:getBaseSkill()))
self.validEffectDesc:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_10)) self.validEffectDesc:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_10))
local addY = self.skillDesc:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).preferredHeight - self.skillDesc:fastGetSizeDeltaY() local addY = self.skillDesc:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).preferredHeight - self.skillDesc:fastGetSizeDeltaY()
@ -68,17 +66,17 @@ function BattleBoardSkillTips:onRefresh()
end end
local count = 0 local count = 0
local rougeSkillList = heroEntity:getRogueSkillList() local rougeSkillList = self.heroEntity:getRogueSkillList()
for index, cell in ipairs(self.selectSkillCells) do for index, cell in ipairs(self.selectSkillCells) do
local rogueSkillId = rougeSkillList[index] local rogueSkillId = rougeSkillList[index]
cell:getBaseObject():setActive(rogueSkillId ~= nil) cell:getBaseObject():setActive(rogueSkillId ~= nil)
if rogueSkillId then if rogueSkillId then
local selectedCount = DataManager.BattleData:getSkillCount(rogueSkillId) local selectedCount = self.battleData:getSkillCount(rogueSkillId, self.side)
if selectedCount > 0 then if selectedCount > 0 then
count = count + 1 count = count + 1
local skillId = rogueSkillId local skillId = rogueSkillId
local count = selectedCount local count = selectedCount
local value = DataManager.BattleData:getSelectSkillMap()[skillId].value or 0 local value = self.battleData:getSelectSkillMap(self.side)[skillId].value or 0
cell:refresh(skillId, count) cell:refresh(skillId, count)
cell:addClickListener(function() cell:addClickListener(function()
ModuleManager.TipsManager:showDescTips(ModuleManager.HeroManager:getSkillRogueDesc(skillId, value), cell:getBaseObject()) ModuleManager.TipsManager:showDescTips(ModuleManager.HeroManager:getSkillRogueDesc(skillId, value), cell:getBaseObject())

View File

@ -41,6 +41,8 @@ function BattleBaseData:init(params)
self.defTeam = self:initTeam(SIDE_DEF, params.defFormation) self.defTeam = self:initTeam(SIDE_DEF, params.defFormation)
self:initRogueSkills(SIDE_ATK, params.atkFormation) self:initRogueSkills(SIDE_ATK, params.atkFormation)
self:initRogueSkills(SIDE_DEF, params.defFormation) self:initRogueSkills(SIDE_DEF, params.defFormation)
self.atkFormation = params.atkFormation or {}
self.defFormation = params.defFormation or {}
end end
function BattleBaseData:getTimeScale() function BattleBaseData:getTimeScale()
@ -129,7 +131,7 @@ function BattleBaseData:initRogueSkills(side, formation)
for matchType, heroEntity in pairs(formation) do for matchType, heroEntity in pairs(formation) do
local skillId = heroEntity:getBaseSkill() local skillId = heroEntity:getBaseSkill()
local cfg = SKILL_CFG[skillId] local cfg = SKILL_CFG[skillId]
self.skillMap[side][cfg.position] = BATTLE_BOARD_SKILL_ENTITY:create(skillId) self.skillMap[side][cfg.position] = BATTLE_BOARD_SKILL_ENTITY:create(skillId, side)
self.skillMap[side][cfg.position]:addUpSkills(heroEntity:getRogueSkillList()) self.skillMap[side][cfg.position]:addUpSkills(heroEntity:getRogueSkillList())
self.skillMap[side][cfg.position]:setUnlockId(heroEntity:getUnlockRogueId()) self.skillMap[side][cfg.position]:setUnlockId(heroEntity:getUnlockRogueId())
for _, id in ipairs(heroEntity:getActiveRogueSkills()) do for _, id in ipairs(heroEntity:getActiveRogueSkills()) do
@ -168,7 +170,7 @@ function BattleBaseData:refreshBoard(board, blockIcon)
self.gridEntities[data.posId]:setGridType(data.gridType) self.gridEntities[data.posId]:setGridType(data.gridType)
self.gridEntities[data.posId]:setElementType(data.elementType) self.gridEntities[data.posId]:setElementType(data.elementType)
else else
self.gridEntities[data.posId] = BATTLE_GRID_ENTITY:create(data) self.gridEntities[data.posId] = self:getNewGridEntity(data.posId, data.gridType, data.elementType)
end end
self.gridEntities[data.posId]:determineIdleStatus() self.gridEntities[data.posId]:determineIdleStatus()
self.gridEntities[data.posId]:setObstacleIcon(blockIcon) self.gridEntities[data.posId]:setObstacleIcon(blockIcon)
@ -180,7 +182,8 @@ function BattleBaseData:getNewGridEntity(posId, gridType, elementType)
local data = { local data = {
posId = posId or 0, posId = posId or 0,
gridType = gridType or BattleConst.GRID_TYPE.EMPTY, gridType = gridType or BattleConst.GRID_TYPE.EMPTY,
elementType = elementType or BattleConst.ELEMENT_TYPE.RED elementType = elementType or BattleConst.ELEMENT_TYPE.RED,
battleData = self
} }
return BATTLE_GRID_ENTITY:create(data) return BATTLE_GRID_ENTITY:create(data)
end end
@ -191,6 +194,7 @@ function BattleBaseData:clear()
self.gridEntities = {} self.gridEntities = {}
self.skillMap = {} self.skillMap = {}
self.skillPool = {}
self.selectSkillMap = {} self.selectSkillMap = {}
end end
@ -366,13 +370,14 @@ function BattleBaseData:setGridDirty(posId)
entity:setDirty() entity:setDirty()
end end
function BattleBaseData:lockAllSkillGrid(lock) function BattleBaseData:lockAllSkillGrid(lock, side)
side = side or SIDE_ATK
if not self.gridEntities then if not self.gridEntities then
return return
end end
for posId, entity in pairs(self.gridEntities) do for posId, entity in pairs(self.gridEntities) do
if entity:getSkillId() then if entity:getSkillId() and (not entity:getSkillSide() or entity:getSkillSide() == side) then
local gridType = GConst.BattleConst.GRID_TYPE.EMPTY local gridType = GConst.BattleConst.GRID_TYPE.EMPTY
if lock then if lock then
gridType = GConst.BattleConst.GRID_TYPE.LOCK gridType = GConst.BattleConst.GRID_TYPE.LOCK
@ -614,6 +619,14 @@ function BattleBaseData:initTeam(side, formation)
return team return team
end end
function BattleBaseData:getTeamBySide(side)
if side == SIDE_ATK then
return self.atkTeam
else
return self.defTeam
end
end
function BattleBaseData:getAtkTeam() function BattleBaseData:getAtkTeam()
return self.atkTeam return self.atkTeam
end end
@ -622,6 +635,14 @@ function BattleBaseData:getDefTeam()
return self.defTeam return self.defTeam
end end
function BattleBaseData:getHeroEntity(elementType, side)
if side == SIDE_DEF then
return self.defFormation[elementType]
else
return self.atkFormation[elementType]
end
end
function BattleBaseData:initHeroData(formation) function BattleBaseData:initHeroData(formation)
local units = {} local units = {}
if formation then if formation then

View File

@ -3,8 +3,8 @@ local BattleData = class("BattleData", BattleBaseData)
local BattleConst = GConst.BattleConst local BattleConst = GConst.BattleConst
function BattleBaseData:getRowCount() function BattleData:getRowCount()
return BattleConst.PVP_ROW_COUNT return BattleConst.ROW_COUNT
end end
return BattleData return BattleData

View File

@ -10,6 +10,7 @@ function BattleGridEntity:ctor(data)
self.elementType = data.elementType or BattleConst.ELEMENT_TYPE.NONE self.elementType = data.elementType or BattleConst.ELEMENT_TYPE.NONE
self.skillId = data.skillId self.skillId = data.skillId
self.linkSkillCount = data.linkSkillCount or 0 -- 任意链接技能激活次数 self.linkSkillCount = data.linkSkillCount or 0 -- 任意链接技能激活次数
self.battleData = data.battleData
self.isIdle = false self.isIdle = false
self.breakCount = 0 self.breakCount = 0
self.data.isDirty = false self.data.isDirty = false
@ -26,6 +27,10 @@ function BattleGridEntity:clear()
self.data.isDirty = false self.data.isDirty = false
end end
function BattleGridEntity:getBattleData()
return self.battleData
end
function BattleGridEntity:getSnapshoptInfo() function BattleGridEntity:getSnapshoptInfo()
return { return {
posId = self.posId, posId = self.posId,
@ -149,7 +154,7 @@ function BattleGridEntity:tryBreakGrid(condition, onlyCheck)
end end
function BattleGridEntity:getPos() function BattleGridEntity:getPos()
return ModuleManager.BattleManager:getPosInfo(self.posId) return ModuleManager.BattleManager:getPosInfo(self.posId, self.battleData:getRowCount())
end end
function BattleGridEntity:setCell(cell) function BattleGridEntity:setCell(cell)
@ -203,7 +208,7 @@ end
function BattleGridEntity:setElementType(elementType, noDirty) function BattleGridEntity:setElementType(elementType, noDirty)
self.elementType = elementType self.elementType = elementType
if DataManager.BattleData:getCacheLockedElement(self.elementType) and not self.skillId then if self.battleData:getCacheLockedElement(self.elementType) and not self.skillId then
self:setGridType(BattleConst.GRID_TYPE.LOCK) self:setGridType(BattleConst.GRID_TYPE.LOCK)
end end
if not noDirty then if not noDirty then
@ -218,14 +223,36 @@ function BattleGridEntity:getSkillId()
return self.skillId return self.skillId
end end
function BattleGridEntity:setSkilId(skillId, noDirty) function BattleGridEntity:setSkilId(skillId, noDirty, side)
self.skillId = skillId self.skillId = skillId
self.linkSkillCount = 0 self.linkSkillCount = 0
self.skillSide = side or GConst.BattleConst.SIDE_ATK
if not noDirty then if not noDirty then
self:setDirty() self:setDirty()
end end
end end
function BattleGridEntity:getSkillSide()
return self.skillSide
end
function BattleGridEntity:getSkillMatchType()
if not self:getSkillId() then
return
end
local skillEntity = self:getSkillEntity()
return skillEntity and skillEntity:getPosition()
end
function BattleGridEntity:getSkillEntity()
if not self:getSkillId() then
return
end
local skillEntity = self.battleData:getSkillEntityBySkillId(self:getSkillId(), self.skillSide)
return skillEntity
end
function BattleGridEntity:canChangeInfo() function BattleGridEntity:canChangeInfo()
if self:canLink() and not self:getSkillId() then if self:canLink() and not self:getSkillId() then
return true return true
@ -267,7 +294,7 @@ function BattleGridEntity:getNeedChangePos()
return false return false
end end
local skillEntity = DataManager.BattleData:getSkillEntityBySkillId(self:getSkillId()) local skillEntity = self:getSkillEntity()
if not skillEntity then if not skillEntity then
return false return false
end end

View File

@ -1,8 +1,9 @@
local BattleBoardSkillEntity = class("BattleBoardSkillEntity", BaseData) local BattleBoardSkillEntity = class("BattleBoardSkillEntity", BaseData)
local BattleBuffEntity = require "app/userdata/battle/skill/battle_buff_entity" local BattleBuffEntity = require "app/userdata/battle/skill/battle_buff_entity"
function BattleBoardSkillEntity:ctor(skillId) function BattleBoardSkillEntity:ctor(skillId, side)
self:refreshSkillId(skillId) self:refreshSkillId(skillId)
self.side = side
self.curEnergy = 0 self.curEnergy = 0
self.addRange = {} self.addRange = {}
self.linkEffectEntities = {} -- 链接攻击伤害 type = 3 self.linkEffectEntities = {} -- 链接攻击伤害 type = 3
@ -349,7 +350,7 @@ function BattleBoardSkillEntity:getElementCountEffect()
end end
function BattleBoardSkillEntity:getEliminateEffects(battleController) function BattleBoardSkillEntity:getEliminateEffects(battleController)
local unitEntity = battleController.battleData.atkTeam:getAllMembers()[self:getPosition()] local unitEntity = battleController:getCurActionTeam(self.side):getAllMembers()[self:getPosition()]
if not unitEntity or not self.config.eliminate_effect then if not unitEntity or not self.config.eliminate_effect then
return return
end end

View File

@ -36,8 +36,12 @@ end
function BattleSkillEntity:initSkillEffect() function BattleSkillEntity:initSkillEffect()
self.effectList = {} self.effectList = {}
self.isHurtType = false self.isHurtType = false
if self.skillInfo.effect then local effect = self.skillInfo.effect
for k, v in ipairs(self.skillInfo.effect) do if self:getUsePvpEffect() then
effect = self.skillInfo.pvp_effect or effect
end
if effect then
for k, v in ipairs(effect) do
local buffEntity = BattleBuffEntity:create() local buffEntity = BattleBuffEntity:create()
buffEntity:init(v, self.owner, self) buffEntity:init(v, self.owner, self)
if buffEntity:getIsHurtType() then if buffEntity:getIsHurtType() then
@ -66,8 +70,12 @@ function BattleSkillEntity:initEffectBlock()
end end
else else
local count = 0 local count = 0
if self.skillInfo.effect then local effect = self.skillInfo.effect
count = #self.skillInfo.effect if self:getUsePvpEffect() then
effect = self.skillInfo.pvp_effect or effect
end
if effect then
count = #effect
end end
table.insert(self.effectBlock, count) table.insert(self.effectBlock, count)
end end
@ -78,6 +86,18 @@ function BattleSkillEntity:initEffectBlock()
end end
end end
function BattleSkillEntity:setUsePvpEffect(use)
self.usePvpEffect = use
end
function BattleSkillEntity:getUsePvpEffect()
if self.usePvpEffect == nil then
local battleController = ModuleManager.BattleManager.battleController
self.usePvpEffect = battleController:getIsPvpBattle() or false
end
return self.usePvpEffect
end
function BattleSkillEntity:startUse() function BattleSkillEntity:startUse()
self.skillCanUseTimes = self.owner:getSkillExtraUseTimes(self.skillId) + 1 self.skillCanUseTimes = self.owner:getSkillExtraUseTimes(self.skillId) + 1
end end
@ -156,6 +176,16 @@ function BattleSkillEntity:addSkillEffectRatio(effect)
end end
end end
function BattleSkillEntity:getSkillSide()
if self.owner then
return self.owner:getSide()
end
end
function BattleSkillEntity:getIsAtkSideSkill()
return self:getSkillSide() == GConst.BattleConst.SIDE_ATK
end
function BattleSkillEntity:getSkillId() function BattleSkillEntity:getSkillId()
return self.skillId return self.skillId
end end
@ -270,7 +300,11 @@ function BattleSkillEntity:getPassiveTriggerId()
end end
function BattleSkillEntity:getFxSelf() function BattleSkillEntity:getFxSelf()
return self.skillInfo.fx_self if not self:getIsAtkSideSkill() and self:getUsePvpEffect() then
return self.skillInfo.fx_self_mirror or self.skillInfo.fx_self
else
return self.skillInfo.fx_self
end
end end
function BattleSkillEntity:getFxSelfDelay() function BattleSkillEntity:getFxSelfDelay()
@ -278,7 +312,11 @@ function BattleSkillEntity:getFxSelfDelay()
end end
function BattleSkillEntity:getFxTarget() function BattleSkillEntity:getFxTarget()
return self.skillInfo.fx_target if not self:getIsAtkSideSkill() and self:getUsePvpEffect() then
return self.skillInfo.fx_target_mirror or self.skillInfo.fx_target
else
return self.skillInfo.fx_target
end
end end
function BattleSkillEntity:getFxTargetDelay() function BattleSkillEntity:getFxTargetDelay()