pvp战斗和整合pve战斗
This commit is contained in:
parent
f17eeb8e68
commit
d4d92cf97d
@ -464,7 +464,7 @@ function BIReport:postFightBegin(battleType, wave, chapterId, maxChapter, startT
|
||||
self:report(EVENT_NAME_FIGHT, args)
|
||||
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 进入关卡编号
|
||||
-- LevelType 进入关卡类型
|
||||
-- MaxLevel 已解锁最大关卡
|
||||
@ -473,7 +473,7 @@ function BIReport:postFightEnd(battleType, chapterId, wave, duration, totalTime,
|
||||
|
||||
local skillStr = GConst.EMPTY_STRING
|
||||
local skillNum = 0
|
||||
local skillMap = DataManager.BattleData:getSelectSkillMap()
|
||||
local skillMap = battleData:getSelectSkillMap()
|
||||
if skillMap then
|
||||
for skillId, info in pairs(skillMap) do
|
||||
skillStr = skillStr .. skillId .. "|"
|
||||
@ -505,9 +505,9 @@ function BIReport:postFightEnd(battleType, chapterId, wave, duration, totalTime,
|
||||
self:report(EVENT_NAME_FIGHT, args)
|
||||
end
|
||||
|
||||
function BIReport:postShowFightSkillSelect(battleType, skillList, chapterId, totalTime, wave)
|
||||
function BIReport:postShowFightSkillSelect(battleType, battleData, skillList, chapterId, totalTime, wave)
|
||||
local skillNum = 0
|
||||
local skillMap = DataManager.BattleData:getSelectSkillMap()
|
||||
local skillMap = battleData:getSelectSkillMap()
|
||||
if skillMap then
|
||||
for skillId, info in pairs(skillMap) do
|
||||
skillNum = skillNum + (info.count or 0)
|
||||
@ -533,9 +533,9 @@ function BIReport:postShowFightSkillSelect(battleType, skillList, chapterId, tot
|
||||
self:report(EVENT_NAME_FIGHT, args)
|
||||
end
|
||||
|
||||
function BIReport:postFightSkillSelect(battleType, skillList, chapterId, totalTime, wave)
|
||||
function BIReport:postFightSkillSelect(battleType, battleData, skillList, chapterId, totalTime, wave)
|
||||
local skillNum = 0
|
||||
local skillMap = DataManager.BattleData:getSelectSkillMap()
|
||||
local skillMap = battleData:getSelectSkillMap()
|
||||
if skillMap then
|
||||
for skillId, info in pairs(skillMap) do
|
||||
skillNum = skillNum + (info.count or 0)
|
||||
|
||||
@ -512,9 +512,214 @@ local act_gift = {
|
||||
["recharge_id"]=14,
|
||||
["time_type"]=3,
|
||||
["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 = {
|
||||
data=act_gift,count=22
|
||||
data=act_gift,count=27
|
||||
}
|
||||
return config
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -313,9 +313,21 @@ local const = {
|
||||
},
|
||||
["arena_bounty_senior_rise"]={
|
||||
["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 = {
|
||||
data=const,count=63
|
||||
data=const,count=67
|
||||
}
|
||||
return config
|
||||
@ -70,9 +70,13 @@ local func_open = {
|
||||
["arena_open"]={
|
||||
["stage"]=10,
|
||||
["pop_ups"]=1
|
||||
},
|
||||
["act_arena_gift"]={
|
||||
["stage"]=10,
|
||||
["pop_ups"]=1
|
||||
}
|
||||
}
|
||||
local config = {
|
||||
data=func_open,count=18
|
||||
data=func_open,count=19
|
||||
}
|
||||
return config
|
||||
@ -258,6 +258,49 @@ local LocalizationGlobalConst =
|
||||
NOTICE_TITLE = "NOTICE_TITLE",
|
||||
MAINTENANCE_NOTICE_DEFAULT = "MAINTENANCE_NOTICE_DEFAULT",
|
||||
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
|
||||
File diff suppressed because it is too large
Load Diff
@ -258,6 +258,49 @@ local localization_global =
|
||||
["NOTICE_TITLE"] = "公告",
|
||||
["MAINTENANCE_NOTICE_DEFAULT"] = "服务器正在加紧链接中,目前元素较多,请稍后重试进入。",
|
||||
["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
|
||||
@ -455,7 +455,7 @@ local tutorial = {
|
||||
[50000]={
|
||||
["next_id"]=50010,
|
||||
["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_offset"]={
|
||||
0,
|
||||
@ -489,7 +489,7 @@ local tutorial = {
|
||||
0,
|
||||
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_offset"]={
|
||||
0,
|
||||
|
||||
@ -390,13 +390,17 @@ if NOT_PUBLISH then
|
||||
end
|
||||
|
||||
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 = {}
|
||||
for posId, entity in pairs(DataManager.BattleData.gridEntities) do
|
||||
for posId, entity in pairs(battleController.battleData.gridEntities) do
|
||||
map[tostring(posId)] = entity:getSnapshoptInfo()
|
||||
end
|
||||
Logger.logHighlight("——————————战斗棋盘快照如下————————")
|
||||
Logger.logHighlight("——————————当前战斗回合步骤————————" .. ModuleManager.BattleManager.battleController.roundStep)
|
||||
Logger.logHighlight("——————————当前战斗回合步骤————————" .. battleController.roundStep)
|
||||
Logger.logHighlight(json.encode(map))
|
||||
end
|
||||
end
|
||||
|
||||
@ -85,6 +85,10 @@ BattleConst.BATTLE_TYPE = {
|
||||
ARENA = "5",
|
||||
}
|
||||
|
||||
BattleConst.IS_PVP_BATTLE = {
|
||||
[BattleConst.BATTLE_TYPE.ARENA] = true,
|
||||
}
|
||||
|
||||
BattleConst.TYPEOF_LUA_COMP = {
|
||||
BATTLE_HERO_COMPONENT = "app/module/battle/component/battle_hero_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_PURPLE_ADD = "dmg_addition_purple_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",
|
||||
SHIELD = "shield",
|
||||
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_PURPLE_ADD] = {ATTR_NAME.DMG_ADDITION_PURPLE, 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.CRIT_ADD] = {ATTR_NAME.CRIT, 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},
|
||||
[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},
|
||||
[71] = {[72] = true, [61] = true, [62] = true},
|
||||
[72] = {[71] = true, [73] = true, [61] = true, [62] = true, [63] = true},
|
||||
[73] = {[72] = true, [74] = true, [62] = true, [63] = true, [64] = true},
|
||||
[74] = {[73] = true, [75] = true, [63] = true, [64] = true, [65] = true},
|
||||
[75] = {[74] = true, [76] = true, [64] = true, [65] = true, [66] = true},
|
||||
[76] = {[75] = true, [77] = true, [65] = true, [66] = true, [67] = true},
|
||||
[77] = {[76] = true, [66] = true, [67] = true},
|
||||
[71] = {[81] = true, [82] = true, [72] = true, [61] = true, [62] = true},
|
||||
[72] = {[81] = true, [82] = true, [83] = true, [71] = true, [73] = true, [61] = true, [62] = true, [63] = true},
|
||||
[73] = {[82] = true, [83] = true, [84] = true, [72] = true, [74] = true, [62] = true, [63] = true, [64] = true},
|
||||
[74] = {[83] = true, [84] = true, [85] = true, [73] = true, [75] = true, [63] = true, [64] = true, [65] = true},
|
||||
[75] = {[84] = true, [85] = true, [86] = true, [74] = true, [76] = true, [64] = true, [65] = true, [66] = true},
|
||||
[76] = {[85] = true, [86] = true, [87] = true, [75] = true, [77] = true, [65] = 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 = {
|
||||
@ -601,6 +638,27 @@ BattleConst.UP_DOWN_LEFT_RIGHT = {
|
||||
[75] = {65, 74, 76},
|
||||
[76] = {66, 75, 77},
|
||||
[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},
|
||||
[76] = {66, 65, 67},
|
||||
[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 = {
|
||||
|
||||
@ -11,6 +11,7 @@ local BATTLE_CONTROLLER = {
|
||||
[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_SHARDS] = "app/module/battle/controller/battle_controller_dungeon_shards",
|
||||
[BattleConst.BATTLE_TYPE.ARENA] = "app/module/battle/controller/battle_controller_arena"
|
||||
}
|
||||
|
||||
function BattleManager:showPauseUI(battleType)
|
||||
@ -38,7 +39,9 @@ end
|
||||
|
||||
function BattleManager:rspSkillRefresh(result)
|
||||
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)
|
||||
end
|
||||
end
|
||||
@ -118,11 +121,9 @@ function BattleManager:clear()
|
||||
GFunc.killDOTween(GConst.DOTWEEN_IDS.BATTLE)
|
||||
self.battleController:clear()
|
||||
self.battleController = nil
|
||||
DataManager.BattleData:clear()
|
||||
self.bindUnitAttributeData = nil
|
||||
end
|
||||
|
||||
|
||||
----------------------- start 一些公共相关的方法 -----------------------------
|
||||
function BattleManager:getPosInfo(posId, rowCount)
|
||||
rowCount = rowCount or BattleConst.ROW_COUNT
|
||||
@ -134,9 +135,16 @@ function BattleManager:getPosInfo(posId, rowCount)
|
||||
local r = self:getPosRC(posId).r
|
||||
local c = self:getPosRC(posId).c
|
||||
|
||||
local offsetC = c - (rowCount + 1) / 2
|
||||
local offsetR = BattleConst.HALF_ROW_COUNT - r
|
||||
local offset = self:posNeedOffset(rowCount)
|
||||
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}
|
||||
if r > halfR then
|
||||
info.y = info.y - offset
|
||||
else
|
||||
info.y = info.y + offset
|
||||
end
|
||||
|
||||
GConst.BattleConst.GRID_POS[rowCount][posId] = info
|
||||
posInfo = GConst.BattleConst.GRID_POS[rowCount][posId]
|
||||
@ -144,6 +152,13 @@ function BattleManager:getPosInfo(posId, rowCount)
|
||||
return posInfo
|
||||
end
|
||||
|
||||
function BattleManager:posNeedOffset(rowCount)
|
||||
if rowCount == GConst.BattleConst.PVP_ROW_COUNT then
|
||||
return 23
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
function BattleManager:getElementIcon(elementType)
|
||||
local icon = GConst.BattleConst.ELEMENT_ICON[elementType]
|
||||
if not icon then
|
||||
@ -174,6 +189,10 @@ function BattleManager:getFirstLineLastRowPosId(row, column)
|
||||
return self:getPosId(1 - row, column)
|
||||
end
|
||||
|
||||
function BattleManager:getLastLineLastRowPosId(row, column, maxRow)
|
||||
return self:getPosId(maxRow + row, column)
|
||||
end
|
||||
|
||||
function BattleManager:getAroundPosIdsByList(posId, boardrange, cludePosIdsMap)
|
||||
local posIdInfos = {}
|
||||
local randomExclusion = {}
|
||||
|
||||
@ -66,6 +66,14 @@ function BattleUnitComp:getIsLethargy()
|
||||
return self.unitEntity:getIsLethargy()
|
||||
end
|
||||
|
||||
function BattleUnitComp:getIsStun()
|
||||
return self.unitEntity:getIsStun()
|
||||
end
|
||||
|
||||
function BattleUnitComp:getIsFrozen()
|
||||
return self.unitEntity:getIsFrozen()
|
||||
end
|
||||
|
||||
function BattleUnitComp:getActiveSkillLimit()
|
||||
return self.unitEntity:getActiveSkillLimit()
|
||||
end
|
||||
@ -483,9 +491,9 @@ function BattleUnitComp:changeState(state)
|
||||
|
||||
-- 进入目标状态
|
||||
if state == UNIT_STATE.IDLE then -- idle为默认状态,其状态下判定特殊状态
|
||||
if self.unitEntity:getIsFrozen() then -- 有冰冻buff
|
||||
if self:getIsFrozen() then -- 有冰冻buff
|
||||
state = UNIT_STATE.FROZEN
|
||||
elseif self.unitEntity:getIsLethargy() or self.unitEntity:getIsStun() then
|
||||
elseif self:getIsLethargy() or self:getIsStun() then
|
||||
state = UNIT_STATE.VERITGO
|
||||
end
|
||||
end
|
||||
@ -1489,7 +1497,7 @@ function BattleUnitComp:takeEffect(buff, target, conditionResult)
|
||||
end
|
||||
end
|
||||
|
||||
if self.unitEntity:getIsFrozen() and buff:isIncreaseGain() then -- 冻结状态,缓存增益buff
|
||||
if self:getIsFrozen() and buff:isIncreaseGain() then -- 冻结状态,缓存增益buff
|
||||
if buff:getRound() > 0 then
|
||||
local buffEffect = BattleHelper:getBuffEffect()
|
||||
buffEffect.buff = buff
|
||||
@ -1683,7 +1691,7 @@ function BattleUnitComp:takeDamageOrCure(atker, num, effectType, effectStatus, d
|
||||
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)
|
||||
end
|
||||
if self.unitEntity:getIsLethargy() then -- 移除昏睡
|
||||
if self:getIsLethargy() then -- 移除昏睡
|
||||
self:removeBuffByName(BattleConst.BUFF_NAME.LETHARGY)
|
||||
end
|
||||
if self.unitEntity:getThorns() > 0 then -- 反伤
|
||||
@ -1802,7 +1810,7 @@ function BattleUnitComp:addBattleExp(atker, hpRealReduce)
|
||||
self.battleController:addBattleExp(addExp)
|
||||
else
|
||||
local exp = self.unitEntity:getExp()
|
||||
if exp > 0 then
|
||||
if exp and exp > 0 then
|
||||
local expTime = atker.unitEntity:getExpTime()
|
||||
local addExp = math.floor(exp/self.unitEntity:getMaxHp()*-hpRealReduce)
|
||||
if expTime > 0 then
|
||||
|
||||
@ -8,13 +8,54 @@ local BATTLE_BOARD_SKILL_HANDLE = require "app/module/battle/skill/battle_board_
|
||||
local BATTLE_ROGUE_SKILL_HANDLE = require "app/module/battle/skill/battle_rogue_skill_handle"
|
||||
local BATTLE_GRID_EFFECT_HANDLE = require "app/module/battle/skill/battle_grid_effect_handle"
|
||||
local BATTLE_INSTRUCTIONS_HELPER = require "app/module/battle/helper/battle_instructions_helper"
|
||||
local BattleBoardTouchHelper = require "app/module/battle/helper/battle_board_touch_helper"
|
||||
local BattleBuffHandle = require "app/module/battle/helper/battle_buff_handle"
|
||||
local BattleBaseController = class("BattleBaseController")
|
||||
local BattleConst = GConst.BattleConst
|
||||
local ELIMINATION_TOUCH_EVENT = GConst.ELIMINATION_TOUCH_EVENT
|
||||
local BUFF_NAME_TO_ATTR = BattleConst.BUFF_NAME_TO_ATTR
|
||||
local GRID_BREAK_CONDITION = BattleConst.GRID_BREAK_CONDITION
|
||||
local SIDE_ATK = BattleConst.SIDE_ATK
|
||||
local SIDE_DEF = BattleConst.SIDE_DEF
|
||||
|
||||
function BattleBaseController:getPosInfo(posId)
|
||||
return ModuleManager.BattleManager:getPosInfo(posId, self:getRowCount())
|
||||
end
|
||||
|
||||
function BattleBaseController:getRowCount()
|
||||
return self.battleData:getRowCount()
|
||||
end
|
||||
|
||||
function BattleBaseController:getSkillEntityBySkillId(skillId)
|
||||
return self.battleData:getSkillEntityBySkillId(skillId, self.curActionSide)
|
||||
end
|
||||
|
||||
function BattleBaseController:getSkillEntityByElement(elementType)
|
||||
return self.battleData:getSkillEntityByElement(elementType, self.curActionSide)
|
||||
end
|
||||
|
||||
function BattleBaseController:isUnlockedSkillElementType(elementType)
|
||||
return self.battleData:isUnlockedSkillElementType(elementType, self.curActionSide)
|
||||
end
|
||||
|
||||
function BattleBaseController:getSkillCount(skillId)
|
||||
return self.battleData:getSkillCount(skillId, self.curActionSide)
|
||||
end
|
||||
|
||||
function BattleBaseController:getSkillPool()
|
||||
return self.battleData:getSkillPool(self.curActionSide)
|
||||
end
|
||||
|
||||
function BattleBaseController:getSkillEntities(side)
|
||||
side = side or self.curActionSide
|
||||
return self.battleData:getSkillEntities(side)
|
||||
end
|
||||
|
||||
function BattleBaseController:addSkillEnergy(elementMap, side)
|
||||
side = side or self.curActionSide
|
||||
self.battleData:addSkillEnergy(elementMap, side)
|
||||
end
|
||||
|
||||
-- *************各个子模块的战斗需要重写的方法 START*************
|
||||
function BattleBaseController:getBoardConfig()
|
||||
return {}
|
||||
end
|
||||
@ -52,6 +93,14 @@ function BattleBaseController:getChessBoardBgName()
|
||||
return chapterInfo.chess_board
|
||||
end
|
||||
|
||||
function BattleBaseController:getScene()
|
||||
local chapterInfo = self:getChapterConfig()[self.chapterId]
|
||||
if not chapterInfo then
|
||||
return "bg_1"
|
||||
end
|
||||
return chapterInfo.scene
|
||||
end
|
||||
|
||||
function BattleBaseController:refreshWave()
|
||||
if not self.battleUI then
|
||||
return
|
||||
@ -69,12 +118,12 @@ end
|
||||
|
||||
-- 怪物攻击力加成
|
||||
function BattleBaseController:getMonsterAtkAddition()
|
||||
return BattleConst.DEFAULT_FACTOR
|
||||
return 0
|
||||
end
|
||||
|
||||
-- 怪物血量加成
|
||||
function BattleBaseController:getMonsterHpAddition()
|
||||
return BattleConst.DEFAULT_FACTOR
|
||||
return 0
|
||||
end
|
||||
|
||||
-- 需要额外加载的资源
|
||||
@ -108,7 +157,7 @@ function BattleBaseController:generateNextMonster()
|
||||
return self:enterNextWave()
|
||||
end
|
||||
local isBoss = self.defTeam:getIsBoss()
|
||||
local unitEntity = self.battleData:addMonster(monsterId, true)
|
||||
local unitEntity = self.battleData:addMonster(monsterId, true, self)
|
||||
local modelId = unitEntity:getModelId()
|
||||
BattleHelper:loadBattleHeroModel(modelId, self.battleUI:getBattleNode(), function(spineObject)
|
||||
self.defTeam:removeAllUnits()
|
||||
@ -220,8 +269,8 @@ function BattleBaseController:onLinkChange()
|
||||
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 curPos = self:getPosInfo(info.posId)
|
||||
local nextPos = self:getPosInfo(nextPosId)
|
||||
local pos, z = ModuleManager.BattleManager:getPosCenterAndDir(curPos, nextPos)
|
||||
obj:setLocalScale(25, 25, 25)
|
||||
obj:setLocalPosition(pos.x, pos.y, 0)
|
||||
@ -248,13 +297,13 @@ function BattleBaseController:onLinkChange()
|
||||
end
|
||||
end
|
||||
|
||||
if not self.atkTeam:getMainUnit().unitEntity:getActiveSkillLimit() then
|
||||
if not self:getCurActionUnitComp():getActiveSkillLimit() then
|
||||
local aniSequence, influenceElementType, lineCount, elementTypeMap, linkElementType = self:calculateCurElimination(true)
|
||||
self.battleUI:refreshSkill(elementTypeMap, count > 0)
|
||||
self.battleUI:refreshSkill(elementTypeMap, count > 0, self.curActionSide)
|
||||
end
|
||||
|
||||
if mainElementType then
|
||||
self.atkTeam:changeMainUnit(mainElementType)
|
||||
self:getSideTeam(self.curActionSide):changeMainUnit(mainElementType)
|
||||
end
|
||||
end
|
||||
|
||||
@ -314,6 +363,12 @@ function BattleBaseController:getSealElementType()
|
||||
return self.sealElementType
|
||||
end
|
||||
|
||||
function BattleBaseController:getAtkMinRow()
|
||||
return 0
|
||||
end
|
||||
|
||||
-- *************各个子模块的战斗需要重写的方法 end*************
|
||||
|
||||
function BattleBaseController:handleBuffs(side)
|
||||
for _, buffInfo in ipairs(self:getBuffs()) do
|
||||
local buffEntity = buffInfo.buffEntity
|
||||
@ -373,6 +428,7 @@ function BattleBaseController:init(params)
|
||||
self.needWaitingBoardOver = nil
|
||||
self.curWaveMonsterDead = false
|
||||
|
||||
self.curActionSide = SIDE_ATK
|
||||
self.chapterId = self:getChapterId()
|
||||
self.waveIndex = 0
|
||||
self.maxWaveIndex = self:getMaxWave()
|
||||
@ -414,10 +470,18 @@ function BattleBaseController:initBattleTeam()
|
||||
self.defTeam:init(BattleConst.SIDE_DEF, self)
|
||||
end
|
||||
|
||||
function BattleBaseController:setCurActionSide(side)
|
||||
self.curActionSide = side or SIDE_ATK
|
||||
end
|
||||
|
||||
function BattleBaseController:setIsPauseHpProgress(value)
|
||||
self.battleUI:setIsPauseHpProgress(value)
|
||||
end
|
||||
|
||||
function BattleBaseController:getIsPvpBattle()
|
||||
return BattleConst.IS_PVP_BATTLE[self.battleType] == true
|
||||
end
|
||||
|
||||
function BattleBaseController:moveBattlefield(time)
|
||||
self.battleUI:moveBattlefield(time)
|
||||
end
|
||||
@ -472,7 +536,7 @@ function BattleBaseController:prepareFight()
|
||||
end
|
||||
end
|
||||
UIManager:closeAllUI()
|
||||
self.battleUI = UIManager:showUI(self:getBattleUIPath(), {battleControllerPVP = self})
|
||||
self.battleUI = UIManager:showUI(self:getBattleUIPath(), {battleController = self})
|
||||
self.battleUI:addLoadUICompleteListener(function()
|
||||
BattleHelper:setEffectTextCache(self.battleUI:getBattleNumberRed(),
|
||||
self.battleUI:getBattleNumberGreen(),
|
||||
@ -482,8 +546,11 @@ function BattleBaseController:prepareFight()
|
||||
self:initAtkUnits(onPreloadFinished)
|
||||
self:initDefUnits(onPreloadFinished)
|
||||
self.battleUI:refreshChessBoard(self:getChessBoardBgName())
|
||||
self.battleUI:loadBg(self:getScene())
|
||||
end)
|
||||
BattleHelper:setBaseOrder(self.battleUI:getUIOrder())
|
||||
BattleHelper:setBattleData(self.battleData)
|
||||
BattleBoardTouchHelper:init(self)
|
||||
self:loadOtherRes(onPreloadFinished)
|
||||
end
|
||||
|
||||
@ -520,8 +587,7 @@ end
|
||||
|
||||
function BattleBaseController:initDefUnits(callback)
|
||||
local config = self:getChapterConfig()[self.chapterId]
|
||||
self.battleUI:loadBg(config.scene)
|
||||
local unitEntity = self.battleData:addMonster(config.monster[1])
|
||||
local unitEntity = self.battleData:addMonster(config.monster[1], nil, self)
|
||||
local modelId = unitEntity:getModelId()
|
||||
BattleHelper:loadBattleHeroModel(modelId, self.battleUI:getBattleNode(), function(spineObject)
|
||||
local monsterComp = spineObject:addLuaComponent(BattleConst.TYPEOF_LUA_COMP.BATTLE_MONSTER_COMPONENT)
|
||||
@ -556,6 +622,48 @@ function BattleBaseController:getOtherSideTeam(side)
|
||||
end
|
||||
end
|
||||
|
||||
function BattleBaseController:getSideTeam(side)
|
||||
if side == BattleConst.SIDE_ATK then
|
||||
return self.atkTeam
|
||||
else
|
||||
return self.defTeam
|
||||
end
|
||||
end
|
||||
|
||||
function BattleBaseController:getCurActionTeam(side)
|
||||
side = side or self.curActionSide
|
||||
local isAtkAction = side == SIDE_ATK
|
||||
local team = isAtkAction and self.atkTeam or self.defTeam
|
||||
return team
|
||||
end
|
||||
|
||||
function BattleBaseController:getCurActionSide()
|
||||
return self.curActionSide
|
||||
end
|
||||
|
||||
function BattleBaseController:getCurActionUnitComp()
|
||||
return self:getCurActionTeam():getMainUnit()
|
||||
end
|
||||
|
||||
function BattleBaseController:getCurActionBoardRowRange()
|
||||
local isAtkAction = self.curActionSide == SIDE_ATK
|
||||
if isAtkAction then
|
||||
return self:getAtkMinRow() + 1, self:getRowCount()
|
||||
else
|
||||
return 1, self:getAtkMinRow()
|
||||
end
|
||||
end
|
||||
|
||||
function BattleBaseController:getPosIdInCurActionBoardRowRange(posId)
|
||||
local min, max = self:getCurActionBoardRowRange()
|
||||
local r = ModuleManager.BattleManager:getPosRC(posId).r
|
||||
if r < min or r > max then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function BattleBaseController:onLoadComplete()
|
||||
UIManager:closeLoading()
|
||||
self:handleBuffs()
|
||||
@ -671,10 +779,13 @@ function BattleBaseController:enterNextWave()
|
||||
end
|
||||
|
||||
function BattleBaseController:enterRoundBegin()
|
||||
self:setCurActionSide(SIDE_ATK)
|
||||
self.needWaitingBoardOver = nil
|
||||
self.waveRoundCount[self.waveIndex] = (self.waveRoundCount[self.waveIndex] or 0) + 1
|
||||
self.battleUI:enterShowBoardAni(function()
|
||||
self:takeGridEffect()
|
||||
self:enterEliminationBegin()
|
||||
end)
|
||||
table.clear(self.lastRoundBreakedGridType)
|
||||
end
|
||||
|
||||
@ -719,7 +830,6 @@ end
|
||||
|
||||
function BattleBaseController:enterEliminationBegin()
|
||||
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_BEGIN
|
||||
self:onEliminationBegin()
|
||||
self:enterRefreshBoard(true)
|
||||
end
|
||||
|
||||
@ -758,19 +868,13 @@ end
|
||||
|
||||
function BattleBaseController:enterBattleStep()
|
||||
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_TEAM_ACTION
|
||||
if not self.battleTeamActionList then
|
||||
self.battleTeamActionList = {}
|
||||
else
|
||||
for i = #self.battleTeamActionList, 1, -1 do
|
||||
self.battleTeamActionList[i] = nil
|
||||
end
|
||||
end
|
||||
self.battleTeamActionList = table.clearOrCreate(self.battleTeamActionList)
|
||||
|
||||
local atkAction = function()
|
||||
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ATK_STEP
|
||||
self:exeInstructions(function()
|
||||
self:enterNextTeamAction()
|
||||
end)
|
||||
end, self.curActionSide)
|
||||
end
|
||||
|
||||
local defAction = function()
|
||||
@ -909,198 +1013,7 @@ end
|
||||
|
||||
---- end回合步骤
|
||||
function BattleBaseController:onTouchEvent(eventType, posId, isVirtual)
|
||||
if self.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 BattleBaseController: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:clearGridSequence()
|
||||
end
|
||||
self.battleData:insertGridSequence(posId, self:snapshotBoard(), isVirtual)
|
||||
local skillEntity = self.battleData:getSkillEntityBySkillId(entity:getSkillId())
|
||||
local maskElementType = entity:getElementType(skillEntity)
|
||||
self.battleUI:showBoardMask(maskElementType, skillEntity and entity:getPosId())
|
||||
self:findSkillInfluenceGrids()
|
||||
self: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 BattleBaseController: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.battleData:getSkillEntityBySkillId(lastEntity:getSkillId())
|
||||
local maskElementType = lastEntity:getElementType(lastSkillEntity)
|
||||
|
||||
local _, skillPosId = self.battleData:getSequenceHadSkill()
|
||||
self.battleUI:showBoardMask(maskElementType, skillPosId)
|
||||
|
||||
self:findSkillInfluenceGrids()
|
||||
self:onLinkChange()
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
local skillId = entity:getSkillId()
|
||||
local skillEntity = self.battleData:getSkillEntityBySkillId(skillId)
|
||||
local elementType = entity:getElementType(skillEntity)
|
||||
|
||||
local lastEntity = self.battleData:getGridEntity(lastPosId)
|
||||
local lastSkillId = lastEntity:getSkillId()
|
||||
local lastSkillEntity = self.battleData: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:snapshotBoard(), isVirtual)
|
||||
if lastEntity:getNeedChangePos() and not entity:getNeedChangePos() then -- 需要移动到队列末尾
|
||||
local lastSkillId = lastEntity:getSkillId()
|
||||
local skillId = entity:getSkillId()
|
||||
self:setGridSkillId(lastPosId, skillId)
|
||||
self:setGridSkillId(posId, lastSkillId)
|
||||
end
|
||||
|
||||
local newElementType = elementType or lastElementType
|
||||
if newElementType then
|
||||
entity:setElementType(newElementType)
|
||||
lastEntity:setElementType(newElementType)
|
||||
end
|
||||
|
||||
entity:addLinkSkillCount()
|
||||
|
||||
self:findSkillInfluenceGrids()
|
||||
self:onLinkChange()
|
||||
|
||||
if not isVirtual then
|
||||
if sequenceCount + 1 == self: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 BattleBaseController: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:getMinEliminationCount() then
|
||||
self: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:onLinkOver()
|
||||
end
|
||||
BattleBoardTouchHelper:onTouchEvent(eventType, posId, isVirtual)
|
||||
end
|
||||
|
||||
function BattleBaseController:clearGridSequence()
|
||||
@ -1131,25 +1044,31 @@ function BattleBaseController:onLinkOver()
|
||||
return
|
||||
end
|
||||
|
||||
local isAtkAction = self.curActionSide == SIDE_ATK
|
||||
local skillId = self.battleData:getSequenceHadSkill()
|
||||
local skillEntity
|
||||
if skillId then
|
||||
skillEntity = self.battleData:getSkillEntityBySkillId(skillId)
|
||||
skillEntity = self:getSkillEntityBySkillId(skillId)
|
||||
if isAtkAction then
|
||||
self:addTaskProgress(BattleConst.BATTLE_TASK_FIELD.BOARD_SKILL_RELEASE_COUNT, 1)
|
||||
end
|
||||
end
|
||||
|
||||
local aniSequence, influenceElementTypeMap, lineCount, elementTypeMap, linkElementType, effectGridMap = self:calculateCurElimination()
|
||||
|
||||
if not self.atkTeam:getMainUnit().unitEntity:getActiveSkillLimit() then
|
||||
self.battleData:addSkillEnergy(elementTypeMap)
|
||||
if not self:getCurActionUnitComp():getActiveSkillLimit() then
|
||||
self:addSkillEnergy(elementTypeMap)
|
||||
end
|
||||
self.battleData:clearGridSequence()
|
||||
self.battleUI:disableUITouch()
|
||||
self.battleUI:eliminationAni(aniSequence, effectGridMap, function()
|
||||
self:enterRefreshBoard(nil, function()
|
||||
self.battleUI:enterHideBoardAni(function()
|
||||
self:generateInstructions(skillEntity, linkElementType, lineCount, influenceElementTypeMap, elementTypeMap)
|
||||
self:enterBattleStep()
|
||||
end)
|
||||
end)
|
||||
end, self.curActionSide)
|
||||
|
||||
self.eliminateCount = self.eliminateCount + 1
|
||||
self.eliminateTotalCount = self.eliminateTotalCount + 1
|
||||
@ -1163,7 +1082,7 @@ function BattleBaseController:calculateCurElimination(onlyCheck)
|
||||
local skillId = self.battleData:getSequenceHadSkill()
|
||||
local skillEntity
|
||||
if skillId then
|
||||
skillEntity = self.battleData:getSkillEntityBySkillId(skillId)
|
||||
skillEntity = self:getSkillEntityBySkillId(skillId)
|
||||
end
|
||||
self.breakedMap = table.clearOrCreate(self.breakedMap)
|
||||
self.boomGridIds = table.clearOrCreate(self.boomGridIds)
|
||||
@ -1253,9 +1172,11 @@ function BattleBaseController:dealGridBreak(posId, condition, time, breakedMap,
|
||||
if condition == GRID_BREAK_CONDITION.LINE then
|
||||
local outline = BattleConst.UP_DOWN_LEFT_RIGHT[posId]
|
||||
for _, id in ipairs(outline) do
|
||||
if self.battleData:getGridEntity(id) then
|
||||
self:dealGridBreak(id, GRID_BREAK_CONDITION.AROUND, time, breakedMap, sequenceMap, aniSequence, gridMap, onlyCheck)
|
||||
end
|
||||
end
|
||||
end
|
||||
if entity:getEffectType() then
|
||||
local succ, list = BATTLE_GRID_EFFECT_HANDLE.gridEffectOn(posId, gridEntities, BattleConst.GRID_EFFECT_TRIGGER_TYPE.ON_GRID_BREAK, self, onlyCheck)
|
||||
if list then
|
||||
@ -1357,20 +1278,34 @@ function BattleBaseController:tryShowSelectSkillComp(needDelay, onlyCommonSkill)
|
||||
self.battleUI:showSelectSkillComp(skillList, onlyCommonSkill)
|
||||
end
|
||||
|
||||
BIReport:postShowFightSkillSelect(self.battleType, skillList, self.chapterId, self.totalDurationTime, self.waveIndex)
|
||||
BIReport:postShowFightSkillSelect(self.battleType, self.battleData, skillList, self.chapterId, self.totalDurationTime, self.waveIndex)
|
||||
end
|
||||
|
||||
|
||||
function BattleBaseController:fillBoard(isRoundBeginCheck)
|
||||
local reverse = self.curActionSide == SIDE_DEF
|
||||
self.fillBoardPathMap = table.clearOrCreate(self.fillBoardPathMap)
|
||||
self.fillColumnCount = table.clearOrCreate(self.fillColumnCount)
|
||||
self.fillGridMap = table.clearOrCreate(self.fillGridMap)
|
||||
|
||||
if reverse then
|
||||
for c = 1, BattleConst.COLUMN_COUNT do
|
||||
for r = BattleConst.ROW_COUNT, 1, -1 do
|
||||
for r = 1, self:getRowCount() do
|
||||
local posId = ModuleManager.BattleManager:getPosId(r, c)
|
||||
local entity = self.battleData:getGridEntity(posId)
|
||||
if entity:getIsIdle() then
|
||||
self:fillThisPos(posId, self.fillColumnCount, self.fillGridMap)
|
||||
if entity and entity:getIsIdle() then
|
||||
self:fillThisPos(posId, self.fillColumnCount, self.fillGridMap, reverse)
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
for c = 1, BattleConst.COLUMN_COUNT do
|
||||
for r = self:getRowCount(), 1, -1 do
|
||||
local posId = ModuleManager.BattleManager:getPosId(r, c)
|
||||
local entity = self.battleData:getGridEntity(posId)
|
||||
if entity and entity:getIsIdle() then
|
||||
self:fillThisPos(posId, self.fillColumnCount, self.fillGridMap, reverse)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -1393,16 +1328,12 @@ function BattleBaseController:fillBoard(isRoundBeginCheck)
|
||||
end
|
||||
end
|
||||
|
||||
for c = 1, BattleConst.COLUMN_COUNT do
|
||||
for r = BattleConst.ROW_COUNT, 1, -1 do
|
||||
local posId = ModuleManager.BattleManager:getPosId(r, c)
|
||||
local entity = self.battleData:getGridEntity(posId)
|
||||
for posId, entity in pairs(self.battleData:getGridEnties()) do
|
||||
if #entity:getPath() > 0 then
|
||||
self.fillBoardPathMap[posId] = entity:getPath()
|
||||
entity:clearPath()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
self.battleUI:fallGrid(self.fillBoardPathMap, isRoundBeginCheck, function()
|
||||
self:onFillBoardOver(isRoundBeginCheck)
|
||||
@ -1431,21 +1362,26 @@ function BattleBaseController:onFillBoardOver(isRoundBeginCheck)
|
||||
end
|
||||
end
|
||||
|
||||
if self.onFillBoardOverCallback then
|
||||
self.onFillBoardOverCallback()
|
||||
end
|
||||
|
||||
if isRoundBeginCheck then
|
||||
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.BOARD_FILL_OVER)
|
||||
self:popBoardCacheSkill(function()
|
||||
self:generateSkill(function()
|
||||
self:enterElimination(true)
|
||||
if self.onFillBoardOverCallback then
|
||||
local callback = self.onFillBoardOverCallback
|
||||
self.onFillBoardOverCallback = nil
|
||||
callback()
|
||||
end
|
||||
end)
|
||||
end)
|
||||
else
|
||||
self:generateSkill(function()
|
||||
self.battleUI:refreshSkill()
|
||||
self:enterBattleStep()
|
||||
if self.onFillBoardOverCallback then
|
||||
local callback = self.onFillBoardOverCallback
|
||||
self.onFillBoardOverCallback = nil
|
||||
callback()
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
@ -1454,8 +1390,8 @@ function BattleBaseController:generateInstructions(skillEntity, elementType, lin
|
||||
self.instructions = BATTLE_INSTRUCTIONS_HELPER.generateInstructions(skillEntity, elementType, lineCount, influenceElementTypeMap, elementTypeMap, self)
|
||||
end
|
||||
|
||||
|
||||
function BattleBaseController:exeInstructions(callback)
|
||||
function BattleBaseController:exeInstructions(callback, side)
|
||||
side = side or self:getCurActionSide()
|
||||
if not self.instructions or #self.instructions <= 0 then
|
||||
callback()
|
||||
return
|
||||
@ -1463,12 +1399,12 @@ function BattleBaseController:exeInstructions(callback)
|
||||
local instruction = table.remove(self.instructions)
|
||||
local func = BattleBaseController._doInstruction[instruction.name]
|
||||
if func then
|
||||
func(self, instruction, function()
|
||||
func(self, side, instruction, function()
|
||||
self.battleData:resetTimeSpeed()
|
||||
self:exeInstructions(callback)
|
||||
self:exeInstructions(callback, side)
|
||||
end)
|
||||
else
|
||||
self:exeInstructions(callback)
|
||||
self:exeInstructions(callback, side)
|
||||
end
|
||||
end
|
||||
|
||||
@ -1576,7 +1512,7 @@ end
|
||||
function BattleBaseController:generateSkill(callback)
|
||||
self.generateSkillMap = table.clearOrCreate(self.generateSkillMap)
|
||||
self.generateExcludeMap = table.clearOrCreate(self.generateExcludeMap)
|
||||
for _, skillEntity in pairs(self.battleData:getSkillEntities()) do
|
||||
for _, skillEntity in pairs(self:getSkillEntities()) do
|
||||
if skillEntity:getEnergyEnough() then
|
||||
local list = self:getSkillElementList(skillEntity:getPosition(), 1, true, self.generateExcludeMap)
|
||||
if list[1] then
|
||||
@ -1605,14 +1541,14 @@ function BattleBaseController:generateSkill(callback)
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
end)
|
||||
end, self.curActionSide)
|
||||
end
|
||||
|
||||
function BattleBaseController:setGridSkillId(posId, skillId, noDirty)
|
||||
local entity = self.battleData:getGridEntity(posId)
|
||||
if entity then
|
||||
entity:setSkilId(skillId, noDirty)
|
||||
local skillEntity = self.battleData:getSkillEntityBySkillId(skillId)
|
||||
entity:setSkilId(skillId, noDirty, self.curActionSide)
|
||||
local skillEntity = self:getSkillEntityBySkillId(skillId)
|
||||
if skillEntity and entity:getElementType() ~= skillEntity:getPosition() then
|
||||
entity:setElementType(skillEntity:getPosition(), noDirty)
|
||||
end
|
||||
@ -1727,6 +1663,14 @@ function BattleBaseController:lockElement(lcokElementType, isUnlock)
|
||||
end
|
||||
end
|
||||
|
||||
function BattleBaseController:getSkillElementListRow()
|
||||
self.skillElementListRow = table.clearOrCreate(self.skillElementListRow)
|
||||
local min, max = self:getCurActionBoardRowRange()
|
||||
for row = min, max do
|
||||
table.insert(self.skillElementListRow, row)
|
||||
end
|
||||
return self.skillElementListRow
|
||||
end
|
||||
|
||||
function BattleBaseController:getSkillElementList(elementType, count, useAlternate, excludeMap)
|
||||
self.getSkillElementListResult = table.clearOrCreate(self.getSkillElementListResult)
|
||||
@ -1739,7 +1683,7 @@ function BattleBaseController:getSkillElementList(elementType, count, useAlterna
|
||||
self.getSkillElementListAlternateList = table.clearOrCreate(self.getSkillElementListAlternateList)
|
||||
local addCount = 0
|
||||
|
||||
for row = 1, BattleConst.ROW_COUNT do
|
||||
for _, row in ipairs(self:getSkillElementListRow()) do
|
||||
for column = 1, BattleConst.COLUMN_COUNT do
|
||||
local posId = ModuleManager.BattleManager:getPosId(row, column)
|
||||
local entity = gridEntities[posId]
|
||||
@ -1791,13 +1735,18 @@ end
|
||||
|
||||
|
||||
---- 从一个点直接遍历所有相关的路径
|
||||
function BattleBaseController:fillThisPos(posId, columnCount, gridMap)
|
||||
function BattleBaseController:fillThisPos(posId, columnCount, gridMap, reverse)
|
||||
local entity = self.battleData:getGridEntity(posId)
|
||||
if not entity or not entity:getIsIdle() then
|
||||
return
|
||||
end
|
||||
|
||||
local list = BattleConst.UP_LINE_FILL_LIST[posId]
|
||||
local list
|
||||
if reverse then
|
||||
list = BattleConst.DOWN_LINE_FILL_LIST[posId]
|
||||
else
|
||||
list = BattleConst.UP_LINE_FILL_LIST[posId]
|
||||
end
|
||||
if not list[1] then -- 第一排
|
||||
local rc = ModuleManager.BattleManager:getPosRC(posId)
|
||||
local c = rc.c
|
||||
@ -1814,12 +1763,17 @@ function BattleBaseController:fillThisPos(posId, columnCount, gridMap)
|
||||
|
||||
local newStartPosId
|
||||
for i = columnCount[c], 1, -1 do
|
||||
if reverse then
|
||||
newStartPosId = ModuleManager.BattleManager:getLastLineLastRowPosId(i, c, self:getRowCount())
|
||||
else
|
||||
newStartPosId = ModuleManager.BattleManager:getFirstLineLastRowPosId(i, c)
|
||||
local curPos = ModuleManager.BattleManager:getPosInfo(newStartPosId)
|
||||
end
|
||||
|
||||
local curPos = self:getPosInfo(newStartPosId)
|
||||
fallEntity:addPath({x = curPos.x, y = curPos.y})
|
||||
end
|
||||
|
||||
local curPos = ModuleManager.BattleManager:getPosInfo(posId)
|
||||
local curPos = self:getPosInfo(posId)
|
||||
fallEntity:addPath({x = curPos.x, y = curPos.y})
|
||||
|
||||
self.battleData:exchangeGridEntities(posId, fallPosId)
|
||||
@ -1835,20 +1789,20 @@ function BattleBaseController:fillThisPos(posId, columnCount, gridMap)
|
||||
end
|
||||
if not fallEntity:isCantFallType() then
|
||||
if fallEntity:getIsIdle() then
|
||||
self:fillThisPos(fallPosId, columnCount, gridMap)
|
||||
self:fillThisPos(fallPosId, columnCount, gridMap, reverse)
|
||||
end
|
||||
fallEntity = self.battleData:getGridEntity(fallPosId)
|
||||
if not fallEntity:getIsIdle() then
|
||||
if not fallEntity:getPath()[1] then
|
||||
local curPos = ModuleManager.BattleManager:getPosInfo(fallPosId)
|
||||
local curPos = self:getPosInfo(fallPosId)
|
||||
fallEntity:addPath({x = curPos.x, y = curPos.y})
|
||||
end
|
||||
|
||||
local curPos = ModuleManager.BattleManager:getPosInfo(posId)
|
||||
local curPos = self:getPosInfo(posId)
|
||||
fallEntity:addPath({x = curPos.x, y = curPos.y})
|
||||
|
||||
self.battleData:exchangeGridEntities(posId, fallPosId)
|
||||
self:fillThisPos(fallPosId, columnCount, gridMap)
|
||||
self:fillThisPos(fallPosId, columnCount, gridMap, reverse)
|
||||
return
|
||||
end
|
||||
end
|
||||
@ -1870,7 +1824,7 @@ function BattleBaseController:getRandomGridInfo()
|
||||
self.getRandomGridInfoIndexs = table.clearOrCreate(self.getRandomGridInfoIndexs)
|
||||
self.getRandomGridInfoTypeList = table.clearOrCreate(self.getRandomGridInfoTypeList)
|
||||
for typeName, typeNum in pairs(BattleConst.ELEMENT_TYPE) do
|
||||
if not self:getSealElementType()[typeNum] and self.battleData:getSkillEntityByElement(typeNum) then
|
||||
if not self:getSealElementType()[typeNum] and self:getSkillEntityByElement(typeNum) then
|
||||
local weight = ((map[typeNum] or 0) + 1) * BattleConst.ELEMENT_WIGHT
|
||||
if weight > BattleConst.MAX_ELEMENT_WIGHT then
|
||||
weight = BattleConst.MAX_ELEMENT_WIGHT
|
||||
@ -1908,7 +1862,7 @@ function BattleBaseController:findSkillInfluenceGrids()
|
||||
local entity = self.battleData:getGridEntity(info.posId)
|
||||
local skillId = entity:getSkillId()
|
||||
if skillId then
|
||||
local skillEntity = self.battleData:getSkillEntityBySkillId(skillId)
|
||||
local skillEntity = self:getSkillEntityBySkillId(skillId)
|
||||
if skillEntity then
|
||||
BATTLE_BOARD_SKILL_HANDLE.activeBoardSkill(info.posId, skillEntity, self.battleData:getGridEnties(), self.skillInfluenceGridsSequenceEntities, self)
|
||||
end
|
||||
@ -1928,13 +1882,13 @@ function BattleBaseController:getRandomSkillList(getCount, onlyCommonSkill, excl
|
||||
self.randomSkillNewSkillPool = table.clearOrCreate(self.randomSkillNewSkillPool)
|
||||
self.randomSkillSkillWeight = table.clearOrCreate(self.randomSkillSkillWeight)
|
||||
local cfg = ConfigManager:getConfig("skill_rogue")
|
||||
local skillPool = self.battleData:getSkillPool()
|
||||
local skillPool = self:getSkillPool()
|
||||
local count = 0
|
||||
|
||||
if not onlyCommonSkill then
|
||||
for elementType, list in pairs(skillPool) do -- 先遍历一下未解锁的技能
|
||||
if not self.battleData:isUnlockedSkillElementType(elementType) then
|
||||
local skillEntity = self.battleData:getSkillEntityByElement(elementType)
|
||||
if not self:isUnlockedSkillElementType(elementType) then
|
||||
local skillEntity = self:getSkillEntityByElement(elementType)
|
||||
if skillEntity then
|
||||
local skillId = skillEntity:getUnlockId()
|
||||
if skillId and not self.randomSkillMap[skillId] then
|
||||
@ -1967,12 +1921,12 @@ function BattleBaseController:getRandomSkillList(getCount, onlyCommonSkill, excl
|
||||
end
|
||||
|
||||
for elementType, list in pairs(skillPool) do
|
||||
if self.battleData:isUnlockedSkillElementType(elementType) then
|
||||
if self:isUnlockedSkillElementType(elementType) then
|
||||
for _, skillId in ipairs(list) do
|
||||
local skillCfg = cfg[skillId]
|
||||
if skillCfg and (not skillCfg.limit_times or self.battleData:getSkillCount(skillId) < skillCfg.limit_times) then
|
||||
if skillCfg and (not skillCfg.limit_times or self:getSkillCount(skillId) < skillCfg.limit_times) then
|
||||
|
||||
if not self.randomSkillMap[skillId] and (not skillCfg.unlock or self.battleData:getSkillCount(skillCfg.unlock) > 0) then
|
||||
if not self.randomSkillMap[skillId] and (not skillCfg.unlock or self:getSkillCount(skillCfg.unlock) > 0) then
|
||||
table.insert(self.randomSkillNewSkillPool, skillId)
|
||||
table.insert(self.randomSkillSkillWeight, skillCfg.weight)
|
||||
count = count + 1
|
||||
@ -1996,7 +1950,7 @@ function BattleBaseController:getRandomSkillList(getCount, onlyCommonSkill, excl
|
||||
for skillId, info in pairs(cfg) do
|
||||
if not self:getNotInvolvedSkills()[skillId] then
|
||||
if info.universal then
|
||||
if not info.limit_times or self.battleData:getSkillCount(skillId) < info.limit_times then
|
||||
if not info.limit_times or self:getSkillCount(skillId) < info.limit_times then
|
||||
if not self.randomSkillMap[skillId] then
|
||||
table.insert(self.randomSkillNewSkillPool, skillId)
|
||||
table.insert(self.randomSkillSkillWeight, info.weight)
|
||||
@ -2022,19 +1976,24 @@ function BattleBaseController:getRandomSkillList(getCount, onlyCommonSkill, excl
|
||||
return result
|
||||
end
|
||||
|
||||
function BattleBaseController:onSelectSkill(skillId, value, pos)
|
||||
self.battleData:addSkillCount(skillId, value)
|
||||
BATTLE_ROGUE_SKILL_HANDLE.takeEffect(skillId, self.battleData, self, value)
|
||||
function BattleBaseController:dealSelectSkill(skillId, value, side)
|
||||
side = side or self:getCurActionSide()
|
||||
self.battleData:addSkillCount(skillId, value, side)
|
||||
BATTLE_ROGUE_SKILL_HANDLE.takeEffect(skillId, self.battleData, self, value, side)
|
||||
|
||||
local skillEntities = self.battleData:getSkillEntities()
|
||||
local skillEntities = self:getSkillEntities(side)
|
||||
for _, entity in pairs(skillEntities) do
|
||||
entity:gotUpSKill(skillId)
|
||||
end
|
||||
end
|
||||
|
||||
BIReport:postFightSkillSelect(self.battleType, {skillId}, self.chapterId, self.totalDurationTime, self.waveIndex)
|
||||
function BattleBaseController:onSelectSkill(skillId, value, pos, side)
|
||||
side = side or self:getCurActionSide()
|
||||
self:dealSelectSkill(skillId, value, side)
|
||||
|
||||
BIReport:postFightSkillSelect(self.battleType, self.battleData, {skillId}, self.chapterId, self.totalDurationTime, self.waveIndex)
|
||||
|
||||
local elementType = ModuleManager.HeroManager:getSkillRoguePosition(skillId)
|
||||
|
||||
if elementType then
|
||||
if self.battleUI then
|
||||
self.battleUI:gotOneSkillAni(skillId, elementType, function()
|
||||
@ -2124,19 +2083,19 @@ function BattleBaseController:killRowOrColumn(infoList)
|
||||
end
|
||||
end
|
||||
|
||||
function BattleBaseController:addHeroAttr(attrName, value)
|
||||
function BattleBaseController:addHeroAttr(attrName, value, side)
|
||||
if not self.battleData or not self.battleData.atkTeam then
|
||||
return
|
||||
end
|
||||
|
||||
local attr = BUFF_NAME_TO_ATTR[attrName]
|
||||
if attr then
|
||||
self.battleData.atkTeam:addAttr(attr[1], value, attr[2])
|
||||
self.battleData:getTeamBySide(side):addAttr(attr[1], value, attr[2])
|
||||
else
|
||||
local func = BattleBuffHandle.addAttribute[attrName]
|
||||
if func then
|
||||
local unitComp
|
||||
for matchType, comp in pairs(self.atkTeam:getUnitComp()) do
|
||||
for matchType, comp in pairs(self:getCurActionTeam(side):getUnitComp()) do
|
||||
unitComp = comp
|
||||
break
|
||||
end
|
||||
@ -2185,7 +2144,7 @@ function BattleBaseController:shuffleBoard(callback)
|
||||
else
|
||||
self.resetList = table.clearOrCreate(self.resetList)
|
||||
for posId, entity in pairs(self.battleData:getGridEnties()) do
|
||||
if entity:isCanFallStatus() then
|
||||
if self:getPosIdInCurActionBoardRowRange(posId) and entity:isCanFallStatus() then
|
||||
table.insert(self.resetList, entity)
|
||||
end
|
||||
end
|
||||
@ -2234,9 +2193,9 @@ function BattleBaseController:getShuffleBoardInfo()
|
||||
end
|
||||
local anySkillCount = 0
|
||||
for posId, entity in pairs(self.battleData:getGridEnties()) do
|
||||
if entity:isCanFallStatus() then
|
||||
if self:getPosIdInCurActionBoardRowRange(posId) and entity:isCanFallStatus() then
|
||||
if entity:getSkillId() then
|
||||
local skillEntity = self.battleData:getSkillEntityBySkillId(entity:getSkillId())
|
||||
local skillEntity = self:getSkillEntityBySkillId(entity:getSkillId())
|
||||
local elementType = skillEntity:getPosition()
|
||||
if skillEntity:getIgnoreElementType() then
|
||||
table.insert(self.shuffleBoardAnySkillList, entity)
|
||||
@ -2373,7 +2332,8 @@ end
|
||||
|
||||
function BattleBaseController:findAttention()
|
||||
local find = false
|
||||
for r = 1, GConst.BattleConst.ROW_COUNT do
|
||||
local min, max = self:getCurActionBoardRowRange()
|
||||
for r = min, max do
|
||||
for c = 1, GConst.BattleConst.COLUMN_COUNT do
|
||||
local posId = ModuleManager.BattleManager:getPosId(r, c)
|
||||
local gridEntity = self.battleData:getGridEntity(posId)
|
||||
@ -2509,7 +2469,7 @@ function BattleBaseController:resetGrids(posList)
|
||||
|
||||
local elementCount = 0
|
||||
for typeName, typeNum in pairs(BattleConst.ELEMENT_TYPE) do
|
||||
if not lockElementMap[typeNum] and not self:getSealElementType()[typeNum] and self.battleData:getSkillEntityByElement(typeNum) then
|
||||
if not lockElementMap[typeNum] and not self:getSealElementType()[typeNum] and self:getSkillEntityByElement(typeNum) then
|
||||
table.insert(self.canRandomElmentList, typeNum)
|
||||
elementCount = elementCount + 1
|
||||
end
|
||||
@ -2591,7 +2551,7 @@ function BattleBaseController:findLinkLine(posId, posIdMap, hadSkill, mainElemen
|
||||
local maxPosIdMap
|
||||
local maxGotSkill
|
||||
for aroundposId, _ in pairs(list) do
|
||||
if not posIdMap[aroundposId] then
|
||||
if self:getPosIdInCurActionBoardRowRange(aroundposId) and not posIdMap[aroundposId] then
|
||||
local gridEntity = self.battleData:getGridEntity(aroundposId)
|
||||
if gridEntity then
|
||||
if gridEntity:canLink() and not gridEntity:getSkillId() then
|
||||
@ -2608,9 +2568,9 @@ function BattleBaseController:findLinkLine(posId, posIdMap, hadSkill, mainElemen
|
||||
maxGotSkill = gotSkill
|
||||
end
|
||||
end
|
||||
elseif gridEntity:getSkillId() and not hadSkill and mainElementType then
|
||||
elseif gridEntity:canLink() and gridEntity:getSkillId() and not hadSkill and mainElementType then
|
||||
local skillId = gridEntity:getSkillId()
|
||||
local skillEntity = self.battleData:getSkillEntityBySkillId(skillId)
|
||||
local skillEntity = self:getSkillEntityBySkillId(skillId)
|
||||
if skillEntity then
|
||||
if skillEntity:getIgnoreElementType() or skillEntity:getPosition() == mainElementType then
|
||||
local tempIdMap = GFunc.getTable(posIdMap)
|
||||
@ -2646,7 +2606,7 @@ function BattleBaseController:findLinkLine(posId, posIdMap, hadSkill, mainElemen
|
||||
end
|
||||
|
||||
function BattleBaseController:generateMonsterById(monsterId, callback)
|
||||
local unitEntity = self.battleData:addMonster(monsterId, true)
|
||||
local unitEntity = self.battleData:addMonster(monsterId, true, self)
|
||||
local modelId = unitEntity:getModelId()
|
||||
BattleHelper:loadBattleHeroModel(modelId, self.battleUI:getBattleNode(), function(spineObject)
|
||||
self.defTeam:removeAllUnits()
|
||||
@ -2752,6 +2712,7 @@ function BattleBaseController:clear()
|
||||
BattlePassive:clear()
|
||||
BattlePool:clear()
|
||||
self:unBindAll()
|
||||
self.battleData:clear()
|
||||
self.battleData:resetTimeSpeed()
|
||||
ModuleManager.BattleManager:unscheduleAll()
|
||||
end
|
||||
@ -2826,24 +2787,30 @@ function BattleBaseController:shakeScreen(shakeType, duration)
|
||||
self.battleUI:shakeScreen(shakeType, duration)
|
||||
end
|
||||
|
||||
local function _addCurRoundAttr(self, instruction, callback)
|
||||
local function _addCurRoundAttr(self, side, instruction, callback)
|
||||
if instruction.effectList then
|
||||
local defComp = self:getOtherSideMainUnit(BattleConst.SIDE_ATK)
|
||||
local mainComp = self:getOtherSideMainUnit(BattleConst.SIDE_DEF)
|
||||
local defComp = self.defTeam:getMainUnit()
|
||||
local atkComp = self.atkTeam:getMainUnit()
|
||||
local isAtkSide = side == SIDE_ATK
|
||||
local actionComp = isAtkSide and atkComp or defComp
|
||||
for _, effect in ipairs(instruction.effectList) do
|
||||
local target
|
||||
if effect:getTargetSide() == BattleConst.SIDE_DEF then
|
||||
target = defComp
|
||||
target = isAtkSide and defComp or atkComp
|
||||
elseif effect:getTargetSide() == BattleConst.SIDE_ATK then
|
||||
target = mainComp
|
||||
target = isAtkSide and atkComp or defComp
|
||||
else
|
||||
local matchType = BattleConst.SIDE_OBJ_TO_MATCH_TYPE[effect:getTargetSide()]
|
||||
if matchType then
|
||||
if isAtkSide then
|
||||
target = self.atkTeam:getUnitComp()[matchType]
|
||||
else
|
||||
target = self.defTeam:getUnitComp()[matchType]
|
||||
end
|
||||
end
|
||||
end
|
||||
if target then
|
||||
mainComp:takeEffect(effect, target)
|
||||
actionComp:takeEffect(effect, target)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -2851,16 +2818,28 @@ local function _addCurRoundAttr(self, instruction, callback)
|
||||
callback()
|
||||
end
|
||||
|
||||
local function _assisting(self, instruction, callback)
|
||||
self.atkTeam:useAssistingSkill(instruction.assistingList, #self.instructions == 0, callback)
|
||||
local function _assisting(self, side, instruction, callback)
|
||||
local actionTeam = self.atkTeam
|
||||
if side == SIDE_DEF then
|
||||
actionTeam = self.defTeam
|
||||
end
|
||||
actionTeam:useAssistingSkill(instruction.assistingList, #self.instructions == 0, callback)
|
||||
end
|
||||
|
||||
local function _generalAttack(self, instruction, callback)
|
||||
self.atkTeam:useNormalSkill(instruction.skillMatch, instruction.count, #self.instructions == 0, BattleConst.EFFECT_TYPE.DIRECT, BattleConst.ATTACK_ACTION_STATE.NORMAL, callback)
|
||||
local function _generalAttack(self, side, instruction, callback)
|
||||
local actionTeam = self.atkTeam
|
||||
if side == SIDE_DEF then
|
||||
actionTeam = self.defTeam
|
||||
end
|
||||
actionTeam:useNormalSkill(instruction.skillMatch, instruction.count, #self.instructions == 0, BattleConst.EFFECT_TYPE.DIRECT, BattleConst.ATTACK_ACTION_STATE.NORMAL, callback)
|
||||
end
|
||||
|
||||
local function _playSkill(self, instruction, callback)
|
||||
self.atkTeam:useSkill(instruction.skillMatch, instruction.count, #self.instructions == 0, BattleConst.EFFECT_TYPE.DIRECT, BattleConst.ATTACK_ACTION_STATE.NORMAL, callback)
|
||||
local function _playSkill(self, side, instruction, callback)
|
||||
local actionTeam = self.atkTeam
|
||||
if side == SIDE_DEF then
|
||||
actionTeam = self.defTeam
|
||||
end
|
||||
actionTeam:useSkill(instruction.skillMatch, instruction.count, #self.instructions == 0, BattleConst.EFFECT_TYPE.DIRECT, BattleConst.ATTACK_ACTION_STATE.NORMAL, callback)
|
||||
end
|
||||
|
||||
BattleBaseController._doInstruction = {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
123
lua/app/module/battle/controller/battle_controller_arena.lua
Normal file
123
lua/app/module/battle/controller/battle_controller_arena.lua
Normal 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
|
||||
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f700ac6962067a74d91df10905ad40ff
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
@ -89,7 +89,7 @@ function BattleControllerDailyChallenge:controllBattleEnd()
|
||||
victory = self.victory,
|
||||
}
|
||||
local atkReport = {}
|
||||
local teamEntity = DataManager.BattleData:getAtkTeam()
|
||||
local teamEntity = self.battleData:getAtkTeam()
|
||||
local members = teamEntity:getAllMembers()
|
||||
local heroInfo = {}
|
||||
for k, v in pairs(members) do
|
||||
@ -137,7 +137,7 @@ function BattleControllerDailyChallenge:postWaveOver(atkDead, isQuit)
|
||||
|
||||
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
|
||||
|
||||
function BattleControllerDailyChallenge:postFightStart()
|
||||
|
||||
@ -51,7 +51,7 @@ function BattleControllerDungeonGold:controllBattleEnd()
|
||||
remainRound = remainRound,
|
||||
}
|
||||
local atkReport = {}
|
||||
local teamEntity = DataManager.BattleData:getAtkTeam()
|
||||
local teamEntity = self.battleData:getAtkTeam()
|
||||
local members = teamEntity:getAllMembers()
|
||||
local totalDamage = 0
|
||||
for k, v in pairs(members) do
|
||||
@ -96,7 +96,7 @@ function BattleControllerDungeonGold:postWaveOver(atkDead, isQuit)
|
||||
|
||||
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
|
||||
|
||||
function BattleControllerDungeonGold:postFightStart()
|
||||
|
||||
@ -20,7 +20,7 @@ function BattleControllerDungeonShards:controllBattleEnd()
|
||||
victory = self.victory,
|
||||
}
|
||||
local atkReport = {}
|
||||
local teamEntity = DataManager.BattleData:getAtkTeam()
|
||||
local teamEntity = self.battleData:getAtkTeam()
|
||||
local members = teamEntity:getAllMembers()
|
||||
local totalDamage = 0
|
||||
for k, v in pairs(members) do
|
||||
@ -64,7 +64,7 @@ function BattleControllerDungeonShards:postWaveOver(atkDead, isQuit)
|
||||
|
||||
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
|
||||
|
||||
function BattleControllerDungeonShards:postFightStart()
|
||||
|
||||
@ -2,6 +2,8 @@ local BattleHelper = require "app/module/battle/helper/battle_helper"
|
||||
local BattleBaseController = require "app/module/battle/controller/battle_base_controller"
|
||||
local BattleControllerPVP = class("BattleControllerPVP", BattleBaseController)
|
||||
local BattleConst = GConst.BattleConst
|
||||
local SIDE_ATK = BattleConst.SIDE_ATK
|
||||
local SIDE_DEF = BattleConst.SIDE_DEF
|
||||
|
||||
-- *************各个子模块的战斗需要重写的方法 START*************
|
||||
function BattleControllerPVP:getBoardConfig()
|
||||
@ -38,80 +40,6 @@ function BattleControllerPVP:findNextDefUnit()
|
||||
self:enterRoundEnd(true)
|
||||
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)
|
||||
|
||||
end
|
||||
@ -120,15 +48,8 @@ function BattleControllerPVP:postFightStart()
|
||||
|
||||
end
|
||||
|
||||
function BattleControllerPVP:onEliminationBegin()
|
||||
|
||||
end
|
||||
|
||||
function BattleControllerPVP:refreshWave()
|
||||
if not self.battleUI then
|
||||
return
|
||||
end
|
||||
self.battleUI:refreshWave(self.waveIndex)
|
||||
function BattleControllerPVP:getMaxRoundCount()
|
||||
return 1
|
||||
end
|
||||
|
||||
-- *************各个子模块的战斗需要重写的方法 END*************
|
||||
@ -168,6 +89,209 @@ function BattleControllerPVP:initDefUnits(callback)
|
||||
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
|
||||
@ -61,7 +61,7 @@ function BattleControllerStage:controllBattleEnd()
|
||||
victory = self.victory,
|
||||
}
|
||||
local atkReport = {}
|
||||
local teamEntity = DataManager.BattleData:getAtkTeam()
|
||||
local teamEntity = self.battleData:getAtkTeam()
|
||||
local members = teamEntity:getAllMembers()
|
||||
for k, v in pairs(members) do
|
||||
local report = {
|
||||
@ -103,7 +103,7 @@ function BattleControllerStage:postWaveOver(atkDead, isQuit)
|
||||
|
||||
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
|
||||
|
||||
function BattleControllerStage:postFightStart()
|
||||
|
||||
205
lua/app/module/battle/helper/battle_board_touch_helper.lua
Normal file
205
lua/app/module/battle/helper/battle_board_touch_helper.lua
Normal 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
|
||||
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6d402be3730fc974bb074f1094b877d2
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
@ -59,16 +59,18 @@ local function _undeadOff(buffSender, target, buff, buffEffect)
|
||||
end
|
||||
|
||||
local function _imprisonOn(buffSender, buff, target, buffEffect)
|
||||
if target.side == GConst.BattleConst.SIDE_ATK then
|
||||
DataManager.BattleData:lockAllSkillGrid(true)
|
||||
local battleController = ModuleManager.BattleManager.battleController
|
||||
if battleController then
|
||||
battleController.battleData:lockAllSkillGrid(true, target.side)
|
||||
end
|
||||
target.unitEntity:addActiveSkillLimit(buff:getName())
|
||||
return 1
|
||||
end
|
||||
|
||||
local function _imprisonOff(buffSender, target, buff, buffEffect)
|
||||
if target.side == GConst.BattleConst.SIDE_ATK then
|
||||
DataManager.BattleData:lockAllSkillGrid(false)
|
||||
local battleController = ModuleManager.BattleManager.battleController
|
||||
if battleController then
|
||||
battleController.battleData:lockAllSkillGrid(false, target.side)
|
||||
end
|
||||
target.unitEntity:removeActiveSkillLimit(buff:getName())
|
||||
return 1
|
||||
|
||||
@ -31,6 +31,14 @@ function BattleHelper:getBaseOrder()
|
||||
return self.baseOrder
|
||||
end
|
||||
|
||||
function BattleHelper:setBattleData(battleBaseData)
|
||||
self.battleData = battleBaseData
|
||||
end
|
||||
|
||||
function BattleHelper:getBattleData()
|
||||
return self.battleData
|
||||
end
|
||||
|
||||
function BattleHelper:getFxConfig()
|
||||
if self.fxCfg == nil then
|
||||
self.fxCfg = ConfigManager:getConfig("fx")
|
||||
@ -78,7 +86,7 @@ function BattleHelper:loadBattleHeroModel(id, parent, callback)
|
||||
if self.characterMap then
|
||||
self.characterMap[spineObject:getInstanceID()] = spineObject
|
||||
end
|
||||
local timeScale = DataManager.BattleData:getTimeScale()
|
||||
local timeScale = self:getBattleData():getTimeScale()
|
||||
spineObject:setTimeScale(timeScale)
|
||||
callback(spineObject)
|
||||
else
|
||||
@ -86,7 +94,7 @@ function BattleHelper:loadBattleHeroModel(id, parent, callback)
|
||||
spineObject:setDefaultMix(0)
|
||||
if self.characterMap then
|
||||
self.characterMap[spineObject:getInstanceID()] = spineObject
|
||||
local timeScale = DataManager.BattleData:getTimeScale()
|
||||
local timeScale = self:getBattleData():getTimeScale()
|
||||
spineObject:setTimeScale(timeScale)
|
||||
callback(spineObject)
|
||||
end
|
||||
@ -126,7 +134,7 @@ function BattleHelper:getEffectAsync(name, parent, callback)
|
||||
if self.effectMap then
|
||||
self.effectMap[effect:getInstanceID()] = effect
|
||||
end
|
||||
local timeScale = DataManager.BattleData:getTimeScale()
|
||||
local timeScale = self:getBattleData():getTimeScale()
|
||||
effect:setTimeScale(timeScale)
|
||||
effect:setActive(true)
|
||||
callback(effect)
|
||||
@ -135,7 +143,7 @@ function BattleHelper:getEffectAsync(name, parent, callback)
|
||||
if self.effectMap then
|
||||
effect:initParticleSystemRendererList()
|
||||
self.effectMap[effect:getInstanceID()] = effect
|
||||
local timeScale = DataManager.BattleData:getTimeScale()
|
||||
local timeScale = self:getBattleData():getTimeScale()
|
||||
effect:setTimeScale(timeScale)
|
||||
callback(effect)
|
||||
end
|
||||
|
||||
@ -57,18 +57,10 @@ function BattleSkillConditionHandle.judgeSkillEffectCondition(buffConditions, co
|
||||
local func = BattleSkillConditionHandle._judgeSkillEffectCondition[condition.type]
|
||||
if func then
|
||||
local target
|
||||
if side == BattleConst.SIDE_ATK then
|
||||
if condition.side == 1 then
|
||||
target = battleController.atkTeam:getMainUnit()
|
||||
target = battleController.getCurActionTeam(side):getMainUnit()
|
||||
else
|
||||
target = battleController.defTeam:getMainUnit()
|
||||
end
|
||||
else
|
||||
if condition.side == 1 then
|
||||
target = battleController.defTeam:getMainUnit()
|
||||
else
|
||||
target = battleController.atkTeam:getMainUnit()
|
||||
end
|
||||
target = battleController.getOtherSideTeam(side):getMainUnit()
|
||||
end
|
||||
|
||||
if func(condition, conditionRel, target, battleController) then
|
||||
|
||||
@ -23,7 +23,7 @@ local function _takeElimination(posId, skillEntity, gridEntities, sequenceEntiti
|
||||
cludePosIdsMap[info.posId] = info
|
||||
end
|
||||
|
||||
DataManager.BattleData:cacheSkillInfluenceGrids(cludePosIdsMap)
|
||||
battleController.battleData:cacheSkillInfluenceGrids(cludePosIdsMap)
|
||||
end
|
||||
end
|
||||
|
||||
@ -80,7 +80,7 @@ local function _takeEliminationGridAndElement(posId, skillEntity, gridEntities,
|
||||
cludePosIdsMap[info.posId] = info
|
||||
end
|
||||
|
||||
DataManager.BattleData:cacheSkillInfluenceGrids(cludePosIdsMap)
|
||||
battleController.battleData:cacheSkillInfluenceGrids(cludePosIdsMap)
|
||||
end
|
||||
end
|
||||
|
||||
@ -418,7 +418,7 @@ local function _takeAddSkillEnergy(atkUnitComp, skillEntity, battleController)
|
||||
if elementType == BattleConst.ELEMENT_TYPE.NONE then
|
||||
local boardSkills
|
||||
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 not boardSkills then
|
||||
boardSkills = {}
|
||||
@ -434,7 +434,7 @@ local function _takeAddSkillEnergy(atkUnitComp, skillEntity, battleController)
|
||||
end
|
||||
|
||||
elementTypeMap = {[elementType] = addEnergy}
|
||||
battleController.battleData:addSkillEnergy(elementTypeMap)
|
||||
battleController:addSkillEnergy(elementTypeMap)
|
||||
battleController.battleUI:refreshSkill()
|
||||
end
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ local function _crossSpread(entity, gridEntities, battleController, onlyCheck)
|
||||
tempList = table.shuffle(GFunc.getTable(tempList))
|
||||
for _, posId in ipairs(tempList) do
|
||||
local gridEntity = gridEntities[posId]
|
||||
if gridEntity:isEmptyIdle() then
|
||||
if gridEntity and gridEntity:isEmptyIdle() then
|
||||
if battleController.battleUI and entity:getEffectSfx() then
|
||||
battleController.battleUI:showGridEffectSfx(posId, entity:getEffectSfx(), function()
|
||||
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))
|
||||
for _, posId in ipairs(tempList) do
|
||||
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)
|
||||
if battleController.battleUI and entity:getEffectSfx() then
|
||||
battleController.battleUI:showGridEffectSfx(posId, entity:getEffectSfx(), function()
|
||||
@ -124,7 +124,7 @@ local function _crossMoveNotBreak(entity, gridEntities, battleController, onlyCh
|
||||
tempList = table.shuffle(GFunc.getTable(tempList))
|
||||
for _, posId in ipairs(tempList) do
|
||||
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 cell = entity:getCell()
|
||||
if cell then
|
||||
|
||||
@ -18,10 +18,11 @@ local _changeBaseSkill = function(skillId, skillInfo, battleBaseData, battleCont
|
||||
if skillEntity then
|
||||
local skillId = skillEntity:getSkillId()
|
||||
battleBaseData:changeSkillId(elementType, newSkillId, side)
|
||||
if not battleBaseData.atkTeam then
|
||||
local actionTeam = battleBaseData:getTeamBySide(side)
|
||||
if not actionTeam then
|
||||
return
|
||||
end
|
||||
local unitEntity = battleBaseData.atkTeam:getAllMembers()[elementType]
|
||||
local unitEntity = actionTeam:getAllMembers()[elementType]
|
||||
if unitEntity then
|
||||
unitEntity:changeSkillId(skillId, newSkillId)
|
||||
for effectType, effect in pairs(skillEntity:getSkillRoundAdd()) do -- 技能回合数
|
||||
@ -39,54 +40,55 @@ local _changeBaseSkill = function(skillId, skillInfo, battleBaseData, battleCont
|
||||
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
|
||||
if not elementType or not skillInfo.boardrange then
|
||||
return
|
||||
end
|
||||
|
||||
local entity = battleData:getSkillEntityByElement(elementType, side)
|
||||
local entity = battleBaseData:getSkillEntityByElement(elementType, side)
|
||||
if entity then
|
||||
entity:addBoardRange(skillInfo.boardrange)
|
||||
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
|
||||
if not elementType then
|
||||
return
|
||||
end
|
||||
|
||||
local entity = battleData:getSkillEntityByElement(elementType, side)
|
||||
local entity = battleBaseData:getSkillEntityByElement(elementType, side)
|
||||
if entity then
|
||||
entity:setIgnoreElementType(true)
|
||||
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
|
||||
if not elementType or not skillInfo.effect then
|
||||
return
|
||||
end
|
||||
|
||||
if not battleData.atkTeam then
|
||||
local actionTeam = battleBaseData:getTeamBySide(side)
|
||||
if not actionTeam then
|
||||
return
|
||||
end
|
||||
|
||||
local unitEntity = battleData.atkTeam:getAllMembers()[elementType]
|
||||
local unitEntity = actionTeam:getAllMembers()[elementType]
|
||||
if not unitEntity then
|
||||
return
|
||||
end
|
||||
|
||||
for _, effect in ipairs(skillInfo.effect) do
|
||||
local entity = battleData:getSkillEntityByElement(elementType, side)
|
||||
local entity = actionTeam:getSkillEntityByElement(elementType, side)
|
||||
if entity then
|
||||
entity:addLinkEffect(effect, unitEntity, skillInfo.obj)
|
||||
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
|
||||
return
|
||||
end
|
||||
@ -100,7 +102,7 @@ local _changeElementType = function(skillId, skillInfo, battleData, battleContro
|
||||
battleController:changeElementType(count, elementType)
|
||||
end
|
||||
|
||||
local _addAttr = function(skillId, skillInfo, battleData, battleController, value, side)
|
||||
local _addAttr = function(skillId, skillInfo, battleBaseData, battleController, value, side)
|
||||
if not skillInfo.attr then
|
||||
return
|
||||
end
|
||||
@ -108,18 +110,18 @@ local _addAttr = function(skillId, skillInfo, battleData, battleController, valu
|
||||
if not value then
|
||||
value = math.random(skillInfo.attr.minnum, skillInfo.attr.maxnum)
|
||||
end
|
||||
battleController:addHeroAttr(skillInfo.attr.type, value)
|
||||
battleController:addHeroAttr(skillInfo.attr.type, value, side)
|
||||
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
|
||||
return
|
||||
end
|
||||
|
||||
battleData:unlockSkillEntity(skillInfo.skill_position, side)
|
||||
battleBaseData:unlockSkillEntity(skillInfo.skill_position, side)
|
||||
end
|
||||
|
||||
local _addSkillEffectParams = function(skillId, skillInfo, battleData, battleController, value, side)
|
||||
local _addSkillEffectParams = function(skillId, skillInfo, battleBaseData, battleController, value, side)
|
||||
local elementType = skillInfo.skill_position
|
||||
if not elementType or not skillInfo.parameter then
|
||||
return
|
||||
@ -131,7 +133,7 @@ local _addSkillEffectParams = function(skillId, skillInfo, battleData, battleCon
|
||||
end
|
||||
|
||||
local effect
|
||||
local entity = battleData:getSkillEntityByElement(elementType, side)
|
||||
local entity = battleBaseData:getSkillEntityByElement(elementType, side)
|
||||
if entity and entity:getEffect() then
|
||||
local effectCfg = entity:getEffect()[index]
|
||||
if effectCfg then
|
||||
@ -144,20 +146,21 @@ local _addSkillEffectParams = function(skillId, skillInfo, battleData, battleCon
|
||||
return
|
||||
end
|
||||
|
||||
local skillEntity = battleData:getSkillEntityByElement(elementType, side)
|
||||
local skillEntity = battleBaseData:getSkillEntityByElement(elementType, side)
|
||||
if skillEntity then
|
||||
local skillId = skillEntity:getSkillId()
|
||||
skillEntity:addSkillEffecuNumAdd(effect)
|
||||
if not battleData.atkTeam then
|
||||
local actionTeam = battleBaseData:getTeamBySide(side)
|
||||
if not actionTeam then
|
||||
return
|
||||
end
|
||||
if battleData.atkTeam:getAllMembers()[elementType] then
|
||||
battleData.atkTeam:getAllMembers()[elementType]:addSkillParams(skillId, effect)
|
||||
if actionTeam:getAllMembers()[elementType] then
|
||||
actionTeam:getAllMembers()[elementType]:addSkillParams(skillId, effect)
|
||||
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
|
||||
if not elementType or not skillInfo.parameter then
|
||||
return
|
||||
@ -170,7 +173,7 @@ local _addSkillRound = function(skillId, skillInfo, battleData, battleController
|
||||
end
|
||||
|
||||
local effect
|
||||
local entity = battleData:getSkillEntityByElement(elementType, side)
|
||||
local entity = battleBaseData:getSkillEntityByElement(elementType, side)
|
||||
if entity and entity:getEffect() then
|
||||
local effectCfg = entity:getEffect()[index]
|
||||
if effectCfg then
|
||||
@ -183,20 +186,21 @@ local _addSkillRound = function(skillId, skillInfo, battleData, battleController
|
||||
return
|
||||
end
|
||||
|
||||
local skillEntity = battleData:getSkillEntityByElement(elementType, side)
|
||||
local skillEntity = battleBaseData:getSkillEntityByElement(elementType, side)
|
||||
if skillEntity then
|
||||
local skillId = skillEntity:getSkillId()
|
||||
skillEntity:addSkillRoundAdd(effect)
|
||||
if not battleData.atkTeam then
|
||||
local actionTeam = battleBaseData:getTeamBySide(side)
|
||||
if not actionTeam then
|
||||
return
|
||||
end
|
||||
if battleData.atkTeam:getAllMembers()[elementType] then
|
||||
battleData.atkTeam:getAllMembers()[elementType]:addSkillRound(skillId, effect)
|
||||
if actionTeam:getAllMembers()[elementType] then
|
||||
actionTeam:getAllMembers()[elementType]:addSkillRound(skillId, effect)
|
||||
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
|
||||
return
|
||||
end
|
||||
@ -206,16 +210,15 @@ local _addSkillEffect = function(skillId, skillInfo, battleData, battleControlle
|
||||
return
|
||||
end
|
||||
|
||||
local atkComp = battleController.atkTeam:getMainUnit()
|
||||
local defComp = battleController.defTeam:getMainUnit()
|
||||
local actionTeam = battleController:getCurActionTeam(side)
|
||||
for _, effect in ipairs(effects) do
|
||||
local target = atkComp
|
||||
local target
|
||||
if skillInfo.obj == BattleConst.SIDE_DEF then
|
||||
target = defComp
|
||||
target = battleController:getOtherSideTeam(side):getMainUnit()
|
||||
elseif skillInfo.obj == BattleConst.SIDE_ATK then
|
||||
target = atkComp
|
||||
target = actionTeam
|
||||
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()
|
||||
buffEntity:init(effect, comp.unitEntity)
|
||||
buffEntity:setTargetSide(skillInfo.obj)
|
||||
@ -225,54 +228,59 @@ local _addSkillEffect = function(skillId, skillInfo, battleData, battleControlle
|
||||
else
|
||||
local matchType = BattleConst.SIDE_OBJ_TO_MATCH_TYPE[skillInfo.obj]
|
||||
if matchType then
|
||||
target = battleController.atkTeam:getUnitComp()[matchType]
|
||||
target = actionTeam:getUnitComp()[matchType]
|
||||
end
|
||||
end
|
||||
if not target then
|
||||
return
|
||||
end
|
||||
local buffEntity = BattleBuffEntity:create()
|
||||
buffEntity:init(effect, atkComp.unitEntity)
|
||||
buffEntity:init(effect, actionTeam:getUnitComp().unitEntity)
|
||||
buffEntity:setTargetSide(skillInfo.obj)
|
||||
|
||||
atkComp:takeEffect(buffEntity, target)
|
||||
actionTeam:getUnitComp():takeEffect(buffEntity, target)
|
||||
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
|
||||
if not elementType or not skillInfo.effect then
|
||||
return
|
||||
end
|
||||
|
||||
if not battleData.atkTeam then
|
||||
local actionTeam = battleBaseData:getTeamBySide(side)
|
||||
if not actionTeam then
|
||||
return
|
||||
end
|
||||
|
||||
local unitEntity = battleData.atkTeam:getAllMembers()[elementType]
|
||||
local unitEntity = actionTeam:getAllMembers()[elementType]
|
||||
if not unitEntity then
|
||||
return
|
||||
end
|
||||
|
||||
local entity = battleData:getSkillEntityByElement(elementType, side)
|
||||
local entity = battleBaseData:getSkillEntityByElement(elementType, side)
|
||||
for _, effect in ipairs(skillInfo.effect) do
|
||||
entity:addInInfluenceEffect(effect, unitEntity, skillInfo.obj)
|
||||
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
|
||||
if not elementType or not skillInfo.effect then
|
||||
return
|
||||
end
|
||||
|
||||
if not battleData.atkTeam then
|
||||
local actionTeam = battleBaseData:getTeamBySide(side)
|
||||
if not actionTeam then
|
||||
return
|
||||
end
|
||||
|
||||
local unitEntity = battleData.atkTeam:getAllMembers()[elementType]
|
||||
local unitEntity = actionTeam:getAllMembers()[elementType]
|
||||
if not unitEntity then
|
||||
return
|
||||
end
|
||||
|
||||
local entity = battleData:getSkillEntityByElement(elementType, side)
|
||||
local entity = battleBaseData:getSkillEntityByElement(elementType, side)
|
||||
if entity then
|
||||
if skillInfo.cover_unlock then
|
||||
entity:removeSkillAttackBeforeEffect(skillInfo.cover_unlock)
|
||||
@ -283,22 +291,23 @@ local _addSkillAttackBeforeEffect = function(skillId, skillInfo, battleData, bat
|
||||
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
|
||||
if not elementType or not skillInfo.effect then
|
||||
return
|
||||
end
|
||||
|
||||
if not battleData.atkTeam then
|
||||
local actionTeam = battleBaseData:getTeamBySide(side)
|
||||
if not actionTeam then
|
||||
return
|
||||
end
|
||||
|
||||
local unitEntity = battleData.atkTeam:getAllMembers()[elementType]
|
||||
local unitEntity = actionTeam:getAllMembers()[elementType]
|
||||
if not unitEntity then
|
||||
return
|
||||
end
|
||||
|
||||
local entity = battleData:getSkillEntityByElement(elementType, side)
|
||||
local entity = battleBaseData:getSkillEntityByElement(elementType, side)
|
||||
if entity then
|
||||
if skillInfo.cover_unlock then
|
||||
entity:removeElementCountEffect(skillInfo.cover_unlock)
|
||||
@ -309,22 +318,23 @@ local _addSkillElementCountEffect = function(skillId, skillInfo, battleData, bat
|
||||
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
|
||||
if not elementType or not skillInfo.effect or not skillInfo.parameter then
|
||||
return
|
||||
end
|
||||
|
||||
if not battleData.atkTeam then
|
||||
local actionTeam = battleBaseData:getTeamBySide(side)
|
||||
if not actionTeam then
|
||||
return
|
||||
end
|
||||
|
||||
local unitEntity = battleData.atkTeam:getAllMembers()[elementType]
|
||||
local unitEntity = actionTeam:getAllMembers()[elementType]
|
||||
if not unitEntity then
|
||||
return
|
||||
end
|
||||
|
||||
local entity = battleData:getSkillEntityByElement(elementType, side)
|
||||
local entity = battleBaseData:getSkillEntityByElement(elementType, side)
|
||||
if entity then
|
||||
if skillInfo.cover_unlock then
|
||||
entity:removeLinkCountMoreEffects(skillInfo.cover_unlock)
|
||||
@ -338,22 +348,23 @@ local _addLinkCountMoreEffect = function(skillId, skillInfo, battleData, battleC
|
||||
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
|
||||
if not elementType or not skillInfo.effect or not skillInfo.parameter then
|
||||
return
|
||||
end
|
||||
|
||||
if not battleData.atkTeam then
|
||||
local actionTeam = battleBaseData:getTeamBySide(side)
|
||||
if not actionTeam then
|
||||
return
|
||||
end
|
||||
|
||||
local unitEntity = battleData.atkTeam:getAllMembers()[elementType]
|
||||
local unitEntity = actionTeam:getAllMembers()[elementType]
|
||||
if not unitEntity then
|
||||
return
|
||||
end
|
||||
|
||||
local entity = battleData:getSkillEntityByElement(elementType, side)
|
||||
local entity = battleBaseData:getSkillEntityByElement(elementType, side)
|
||||
if entity then
|
||||
if skillInfo.cover_unlock then
|
||||
entity:removeLinkCountPowerEffects(skillInfo.cover_unlock)
|
||||
@ -367,7 +378,7 @@ local _addLinkCountPowerEffect = function(skillId, skillInfo, battleData, battle
|
||||
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
|
||||
if not elementType or not skillInfo.parameter then
|
||||
return
|
||||
@ -380,7 +391,7 @@ local _addSkillRatio = function(skillId, skillInfo, battleData, battleController
|
||||
end
|
||||
|
||||
local effect
|
||||
local skillEntity = battleData:getSkillEntityByElement(elementType, side)
|
||||
local skillEntity = battleBaseData:getSkillEntityByElement(elementType, side)
|
||||
if skillEntity and skillEntity:getEffect() then
|
||||
local effectCfg = skillEntity:getEffect()[index]
|
||||
if effectCfg then
|
||||
@ -396,11 +407,12 @@ local _addSkillRatio = function(skillId, skillInfo, battleData, battleController
|
||||
if skillEntity then
|
||||
local skillId = skillEntity:getSkillId()
|
||||
skillEntity:addSkillRatioAdd(effect)
|
||||
if not battleData.atkTeam then
|
||||
local actionTeam = battleBaseData:getTeamBySide(side)
|
||||
if not actionTeam then
|
||||
return
|
||||
end
|
||||
if battleData.atkTeam:getAllMembers()[elementType] then
|
||||
battleData.atkTeam:getAllMembers()[elementType]:addSkillRatio(skillId, effect)
|
||||
if actionTeam:getAllMembers()[elementType] then
|
||||
actionTeam:getAllMembers()[elementType]:addSkillRatio(skillId, effect)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -628,11 +628,9 @@ function BattleTeam:onActionOver()
|
||||
local skillMatch
|
||||
if self.side == BattleConst.SIDE_ATK then
|
||||
self.battleController.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_ATK_STEP
|
||||
self.battleController.curTeam = self.battleController.atkTeam
|
||||
skillMatch = self:getMainUnit().unitEntity:getMatchType()
|
||||
else
|
||||
self.battleController.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_DEF_STEP
|
||||
self.battleController.curTeam = self.battleController.defTeam
|
||||
end
|
||||
|
||||
self:useNormalSkill(skillMatch, counterAttackCount, true, BattleConst.EFFECT_TYPE.DIRECT, BattleConst.ATTACK_ACTION_STATE.COUNTERATTACK, function()
|
||||
|
||||
@ -121,9 +121,11 @@ function TipsManager:getRewardDesc(rewardId, rewardType)
|
||||
return GConst.EMPTY_STRING
|
||||
end
|
||||
|
||||
function TipsManager:showBattleBoardSkillTips(elementType, tarPrefabObj, alignType)
|
||||
function TipsManager:showBattleBoardSkillTips(heroEntity, battleController, side, tarPrefabObj, alignType)
|
||||
local params = {
|
||||
elementType = elementType,
|
||||
heroEntity = heroEntity,
|
||||
battleController = battleController,
|
||||
side = side,
|
||||
aniType = UIManager.ANI_TYPE.NONE,
|
||||
}
|
||||
if tarPrefabObj then
|
||||
|
||||
@ -27,6 +27,7 @@ function BattleBaseUI:initBaseInfo()
|
||||
-- local uiMap = self.root:genAllChildren()
|
||||
-- self.uiMap = uiMap
|
||||
-- self.gridNode = ?
|
||||
-- self.boardCenterNode = ?
|
||||
-- self.boardNode = ?
|
||||
-- self.boardNode:setAnchoredPositionX(DEFAULT_X)
|
||||
-- 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[25] = self.uiMap["battle_ui_pvp.board_root_node.ani_node.sfx_skill_b05_5"]
|
||||
end
|
||||
self:_initSkillLineSfx()
|
||||
end
|
||||
|
||||
function BattleBaseUI:initGenerateSkillEffect()
|
||||
@ -189,13 +191,43 @@ function BattleBaseUI:initBossEnterAni()
|
||||
-- self.bossEnterNode:setVisible(false)
|
||||
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按需重写的方法--------------------------------
|
||||
|
||||
function BattleBaseUI:getBGMId()
|
||||
return AudioManager.BGM_ID.BATTLE
|
||||
end
|
||||
|
||||
function BattleBaseUI:ctor(parmas)
|
||||
self.battleController = parmas.battleController
|
||||
self.battleData = self.battleController.battleData
|
||||
end
|
||||
|
||||
function BattleBaseUI:getPosInfo(posId)
|
||||
return ModuleManager.BattleManager:getPosInfo(posId, self.battleData:getRowCount())
|
||||
end
|
||||
|
||||
function BattleBaseUI:onPressBackspace()
|
||||
if self.battleBuffTipsRoot then
|
||||
if self.battleBuffTipsRoot:getTransform().localScale.x > 0 then
|
||||
@ -281,30 +313,32 @@ function BattleBaseUI:_initSkill(atkNode, atkCellPrefix, defNode, defCellPrefix)
|
||||
[SIDE_DEF] = {},
|
||||
}
|
||||
|
||||
local initSKillCell = function(obj, elementType, sideSkillCells)
|
||||
local initSKillCell = function(obj, elementType, sideSkillCells, side)
|
||||
sideSkillCells[elementType] = CellManager:addCellComp(obj, SKILL_NODE_CELL)
|
||||
local skillEntity = DataManager.BattleData:getSkillEntities()[elementType]
|
||||
local skillEntity = self.battleData:getSkillEntities(side)[elementType]
|
||||
if skillEntity then
|
||||
sideSkillCells[elementType]:refresh(skillEntity)
|
||||
end
|
||||
sideSkillCells[elementType]:getBaseObject():setActive(skillEntity ~= nil)
|
||||
if skillEntity then
|
||||
sideSkillCells[elementType]:addClickListener(function()
|
||||
ModuleManager.TipsManager:showBattleBoardSkillTips(elementType, obj)
|
||||
ModuleManager.TipsManager:showBattleBoardSkillTips(self.battleData:getHeroEntity(elementType, side), self.battleController, side)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
for name, elementType in pairs(GConst.BattleConst.ELEMENT_TYPE) do
|
||||
if defCellPrefix then
|
||||
local obj = self.uiMap[defCellPrefix .. elementType]
|
||||
if obj then
|
||||
initSKillCell(obj, elementType, self.skillNodeCells[SIDE_DEF])
|
||||
initSKillCell(obj, elementType, self.skillNodeCells[SIDE_DEF], SIDE_DEF)
|
||||
end
|
||||
end
|
||||
|
||||
if atkCellPrefix then
|
||||
local objDef = self.uiMap[atkCellPrefix .. elementType]
|
||||
if objDef then
|
||||
initSKillCell(objDef, elementType, self.skillNodeCells[SIDE_ATK])
|
||||
local obj = self.uiMap[atkCellPrefix .. elementType]
|
||||
if obj then
|
||||
initSKillCell(obj, elementType, self.skillNodeCells[SIDE_ATK], SIDE_ATK)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -330,6 +364,9 @@ function BattleBaseUI:_initBuff(atkBuffPrefix, defBuffPrefix, battleBuffTipsRoot
|
||||
local obj = self.uiMap[defBuffPrefix .. i]
|
||||
if obj then
|
||||
self.tinyBuffCells[SIDE_DEF][i] = CellManager:addCellComp(obj, TINY_BUFF_CELL)
|
||||
obj:addClickListener(function()
|
||||
self.battleController:showBuffTips(SIDE_DEF)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
@ -337,6 +374,9 @@ function BattleBaseUI:_initBuff(atkBuffPrefix, defBuffPrefix, battleBuffTipsRoot
|
||||
local obj = self.uiMap[atkBuffPrefix .. i]
|
||||
if obj then
|
||||
self.tinyBuffCells[SIDE_ATK][i] = CellManager:addCellComp(obj, TINY_BUFF_CELL)
|
||||
obj:addClickListener(function()
|
||||
self.battleController:showBuffTips(SIDE_ATK)
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -373,11 +413,12 @@ function BattleBaseUI:refreshBuff(side, buffList)
|
||||
local buffObj = nil
|
||||
local count = #buffList
|
||||
local buffCellCount = #self.tinyBuffCells[side]
|
||||
|
||||
local index = 1
|
||||
for i = 1, count do
|
||||
buffObj = buffList[i]
|
||||
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
|
||||
cell:getBaseObject():setVisible(true)
|
||||
cell:refresh(buffObj.buff:getIcon(), buffObj.round)
|
||||
@ -425,12 +466,6 @@ function BattleBaseUI:showRightBuffTips(buffList, autoClose)
|
||||
self:showBuffTips(buffList, autoClose)
|
||||
end
|
||||
|
||||
function BattleBaseUI:showTutorialFinger(posIdList)
|
||||
end
|
||||
|
||||
function BattleBaseUI:moveBattlefield(time)
|
||||
end
|
||||
|
||||
function BattleBaseUI:getBattleNode()
|
||||
return self.battleNode
|
||||
end
|
||||
@ -567,7 +602,7 @@ function BattleBaseUI:playSkillLineSfx(posId, boradRangeList, randomPosList)
|
||||
end
|
||||
end
|
||||
|
||||
local pos = ModuleManager.BattleManager:getPosInfo(posId)
|
||||
local pos = self:getPosInfo(posId)
|
||||
for dir, range in pairs(directionAndRange) do
|
||||
local index = range * 10 + dir
|
||||
local obj = self.skillLineSfxs[index]
|
||||
@ -585,7 +620,7 @@ function BattleBaseUI:playSkillLineSfx(posId, boradRangeList, randomPosList)
|
||||
self.skillLightSfxs.point:play()
|
||||
for i = 1, count do
|
||||
local tartgetPos = randomPosList[i]
|
||||
tartgetPos = ModuleManager.BattleManager:getPosInfo(tartgetPos)
|
||||
tartgetPos = self:getPosInfo(tartgetPos)
|
||||
local obj = self.skillLightSfxs[20 + i]
|
||||
if obj then
|
||||
obj:setAnchoredPosition(tartgetPos.x, tartgetPos.y)
|
||||
@ -613,7 +648,7 @@ function BattleBaseUI:playChangeElementSfx(posId, index)
|
||||
self.root.changeElementSfxs = {}
|
||||
end
|
||||
|
||||
local pos = ModuleManager.BattleManager:getPosInfo(posId)
|
||||
local pos = self:getPosInfo(posId)
|
||||
local info = self.root.changeElementSfxs[index]
|
||||
if info then
|
||||
local obj = info.obj
|
||||
@ -994,7 +1029,7 @@ function BattleBaseUI:refreshSkill(elementMap, showSfx, side)
|
||||
end
|
||||
|
||||
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]
|
||||
if skillCell then
|
||||
skillCell:refresh(skillEntity, elementMap, showSfx)
|
||||
@ -1173,7 +1208,7 @@ function BattleBaseUI:eliminationAni(aniSequence, effectGridMap, callback, side)
|
||||
local breakSfxNameIndexMap = {}
|
||||
for index, info in ipairs(aniSequence) do
|
||||
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
|
||||
local entity = self.battleData:getGridEntity(info.posId)
|
||||
|
||||
@ -1204,7 +1239,7 @@ function BattleBaseUI:eliminationAni(aniSequence, effectGridMap, callback, side)
|
||||
local posList = {}
|
||||
local count = 0
|
||||
for _, posId in ipairs(info.aniPosList) do
|
||||
table.insert(posList, ModuleManager.BattleManager:getPosInfo(posId))
|
||||
table.insert(posList, self:getPosInfo(posId))
|
||||
count = count + 1
|
||||
end
|
||||
anitime = count * GConst.BattleConst.GRID_BREAK_EFFECT_INTERVAL
|
||||
@ -1231,7 +1266,7 @@ function BattleBaseUI:eliminationAni(aniSequence, effectGridMap, callback, side)
|
||||
if info.breakFlyToCharacter then
|
||||
targetPos = self.battleController.atkTeam:getMainUnit():getBaseObject():getTransform().position
|
||||
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
|
||||
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))
|
||||
@ -1286,7 +1321,7 @@ function BattleBaseUI:eliminationAni(aniSequence, effectGridMap, callback, side)
|
||||
callback()
|
||||
end
|
||||
|
||||
self:refreshSkill()
|
||||
self:refreshSkill(nil, nil, side)
|
||||
self:resetParentAllSfxGridBreak()
|
||||
self.eliminationAniSeq = nil
|
||||
end)
|
||||
@ -1298,7 +1333,7 @@ function BattleBaseUI:dealGridBreakSfx(time, info, breakSfxNameIndexMap)
|
||||
local breakIndex = breakSfxNameIndexMap[info.breakSfxName]
|
||||
self.eliminationAniSeq:InsertCallback(time, function()
|
||||
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:play()
|
||||
end)
|
||||
@ -1327,7 +1362,7 @@ function BattleBaseUI:dealGridEffectSfx(time, info, breakSfxNameIndexMap, entity
|
||||
obj:play()
|
||||
table.insert(self.flowEffects, obj)
|
||||
else
|
||||
local pos = ModuleManager.BattleManager:getPosInfo(info.posId)
|
||||
local pos = self:getPosInfo(info.posId)
|
||||
obj:setLocalPosition(pos.x, pos.y, 0)
|
||||
obj:play()
|
||||
end
|
||||
@ -1350,7 +1385,7 @@ end
|
||||
function BattleBaseUI:showGridEffectSfx(posId, sfxName, callback, customTime, zEuler)
|
||||
self:getSfxGridEffect(sfxName, function(info)
|
||||
info.isIdle = false
|
||||
local pos = ModuleManager.BattleManager:getPosInfo(posId)
|
||||
local pos = self:getPosInfo(posId)
|
||||
customTime = customTime or info.obj:getDuration()
|
||||
info.obj:setLocalPosition(pos.x, pos.y, 0)
|
||||
info.obj:setLocalEulerAngles(0, 0, zEuler)
|
||||
@ -1382,7 +1417,7 @@ function BattleBaseUI:moveGridCells(gridEntityList, callback)
|
||||
for _, entity in pairs(gridEntityList) do
|
||||
local posId = entity:getPosId()
|
||||
local baseObject = entity:getCell():getBaseObject()
|
||||
local pos = ModuleManager.BattleManager:getPosInfo(posId)
|
||||
local pos = self:getPosInfo(posId)
|
||||
if entity:getEffectType() then
|
||||
baseObject:getTransform():SetAsLastSibling()
|
||||
end
|
||||
@ -1422,7 +1457,7 @@ function BattleBaseUI:generateSkillAni(map, callback, side)
|
||||
local pos = self:getElementSkillPos(elementType, side)
|
||||
cell:getBaseObject():setAnchoredPosition(pos.x, pos.y)
|
||||
end)
|
||||
local pos = ModuleManager.BattleManager:getPosInfo(info.posId)
|
||||
local pos = self:getPosInfo(info.posId)
|
||||
self.generateSkillAniSeq:Append(cell:getBaseObject():getTransform():DOAnchorPos(pos, 0.5))
|
||||
if self.generateSkillSfxs and self.generateSkillSfxs[count] then
|
||||
self.generateSkillSfxs[count]:setAnchoredPosition(pos.x, pos.y)
|
||||
@ -1512,7 +1547,7 @@ function BattleBaseUI:showMonsterSkillAni(map, monsterPos, callback)
|
||||
end
|
||||
|
||||
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()
|
||||
local count = 1
|
||||
@ -1526,7 +1561,7 @@ function BattleBaseUI:showMonsterSkillAni(map, monsterPos, callback)
|
||||
cell:refresh(entity)
|
||||
cell:getBaseObject():setAnchoredPosition(monsterPos.x, monsterPos.y)
|
||||
cell:getBaseObject():setLocalScale(0.3, 0.3, 0.3)
|
||||
local pos = ModuleManager.BattleManager:getPosInfo(posId)
|
||||
local pos = self:getPosInfo(posId)
|
||||
if count == 1 then
|
||||
self.monsterSkillAniSeq:Append(cell:getBaseObject():getTransform():DOAnchorPos(pos, 0.3))
|
||||
else
|
||||
@ -1551,7 +1586,7 @@ function BattleBaseUI:hideMonsterSkillGridCells()
|
||||
-- local obj = uiMap["battle_ui.bg_2.ani_node.grid_cell_m" .. elementType]
|
||||
-- if obj then
|
||||
-- local cell = CellManager:addCellComp(obj, GRID_CELL)
|
||||
-- local entity = DataManager.BattleData:getNewGridEntity()
|
||||
-- local entity = self.battleData:getNewGridEntity()
|
||||
-- entity:setCell(cell)
|
||||
-- table.insert(self.monsterSkillGridEntities, entity)
|
||||
-- end
|
||||
@ -1605,7 +1640,7 @@ function BattleBaseUI:shuffleBoard(changeInfo, callback)
|
||||
local cell = entity:getCell()
|
||||
local posId = entity:getPosId()
|
||||
if cell then
|
||||
local pos = ModuleManager.BattleManager:getPosInfo(posId)
|
||||
local pos = self:getPosInfo(posId)
|
||||
self.shuffleBoardSeq:Insert(0, cell:getBaseObject():getTransform():DOAnchorPos(pos, 1))
|
||||
end
|
||||
end
|
||||
@ -1743,7 +1778,7 @@ function BattleBaseUI:doCacheAni(skillInfo, callback)
|
||||
local entity = self.root.skillAniGridEntities[index]
|
||||
if entity then
|
||||
entity:setSkilId(info.skillId)
|
||||
local pos = ModuleManager.BattleManager:getPosInfo(info.posId)
|
||||
local pos = self:getPosInfo(info.posId)
|
||||
local cell = entity:getCell()
|
||||
if cell then
|
||||
cell:refresh(entity)
|
||||
@ -1818,7 +1853,6 @@ function BattleBaseUI:doCachePopAni(skillInfo, callback)
|
||||
local entity = self.root.skillAniGridEntities[index]
|
||||
if entity then
|
||||
entity:setSkilId(info.skillId)
|
||||
local pos = ModuleManager.BattleManager:getPosInfo(info.posId)
|
||||
local cell = entity:getCell()
|
||||
if cell then
|
||||
cell:refresh(entity)
|
||||
@ -1839,7 +1873,7 @@ function BattleBaseUI:doCachePopAni(skillInfo, callback)
|
||||
for index, info in ipairs(skillInfo) do
|
||||
local entity = self.root.skillAniGridEntities[index]
|
||||
if entity then
|
||||
local pos = ModuleManager.BattleManager:getPosInfo(info.posId)
|
||||
local pos = self:getPosInfo(info.posId)
|
||||
local cell = entity:getCell()
|
||||
if cell then
|
||||
local obj = cell:getBaseObject()
|
||||
@ -1884,7 +1918,7 @@ function BattleBaseUI:getElementSkillPos(elementType, side)
|
||||
else
|
||||
local targetPos = cell:getBaseObject():getTransform().position
|
||||
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
|
||||
end
|
||||
end
|
||||
@ -2092,7 +2126,7 @@ function BattleBaseUI:showCommonSkillTips(skillId)
|
||||
end
|
||||
|
||||
local value = 0
|
||||
local selectSkillMap = DataManager.BattleData:getSelectSkillMap()
|
||||
local selectSkillMap = self.battleData:getSelectSkillMap(self.battleController:getCurActionSide())
|
||||
if selectSkillMap[skillId] then
|
||||
value = selectSkillMap[skillId].value
|
||||
end
|
||||
@ -2160,6 +2194,13 @@ function BattleBaseUI:showBossEnterAni(bornTime, bossName, monsterComp, callback
|
||||
end)
|
||||
end
|
||||
|
||||
function BattleBaseUI:clearEnterShowBoardSeq()
|
||||
if self.enterShowBoardSeq then
|
||||
self.enterShowBoardSeq:Kill()
|
||||
self.enterShowBoardSeq = nil
|
||||
end
|
||||
end
|
||||
|
||||
function BattleBaseUI:clear()
|
||||
if self.alreadyClear then
|
||||
return
|
||||
@ -2275,6 +2316,8 @@ function BattleBaseUI:clear()
|
||||
self.moveGridCellsSeq:Kill()
|
||||
self.moveGridCellsSeq = nil
|
||||
end
|
||||
|
||||
self:clearEnterShowBoardSeq()
|
||||
end
|
||||
|
||||
return BattleBaseUI
|
||||
@ -28,7 +28,8 @@ end
|
||||
|
||||
function BattlePauseUI:ctor(params)
|
||||
self.battleType = params.battleType
|
||||
local map = DataManager.BattleData:getSelectSkillMap()
|
||||
local battleController = ModuleManager.BattleManager.battleController
|
||||
local map = battleController.battleData:getSelectSkillMap()
|
||||
self.skillList = {}
|
||||
for skillId, info in pairs(map) do
|
||||
local cfg = SKILL_ROGUE_CFG[skillId]
|
||||
|
||||
@ -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.diamond_btn.tx"]:setText(GFunc.getRewardNum(GFunc.getConstReward("refresh_skill_cost")))
|
||||
|
||||
local battleController = ModuleManager.BattleManager.battleController
|
||||
local cfgAdCount = GFunc.getConstIntValue("ad_refresh_skill")
|
||||
local cfgRefreshCount = GFunc.getConstIntValue("diamond_refresh_skill") + cfgAdCount
|
||||
local adCount = DataManager.BattleData:getADRefreshSkillCount()
|
||||
local refreshCount = DataManager.BattleData:getRefreshSkillCount()
|
||||
local adCount = battleController.battleData:getADRefreshSkillCount()
|
||||
local refreshCount =battleController.battleData:getRefreshSkillCount()
|
||||
local showAdBtn = cfgAdCount > adCount
|
||||
uiMap["battle_select_skill_comp.skill_node.ad_btn"]:setActive(showAdBtn)
|
||||
local showBtn = refreshCount < cfgRefreshCount
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -2,29 +2,28 @@ local BattleBaseUI = require "app/ui/battle/battle_base_ui"
|
||||
local BattleUIPVP = class("BattleUIPVP", BattleBaseUI)
|
||||
|
||||
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()
|
||||
self.uiMap = uiMap
|
||||
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.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.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.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.battleRoot = uiMap["battle_ui.battle_root"]
|
||||
self.maxLayerNode = uiMap["battle_ui.battle_root.battle_node.max_layer_show_node"]
|
||||
self.battleRoot = uiMap["battle_ui_pvp.battle_root"]
|
||||
self.maxLayerNode = uiMap["battle_ui_pvp.battle_root.battle_node.max_layer_show_node"]
|
||||
end
|
||||
|
||||
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)
|
||||
local width = self.bg:fastGetSizeDelta()
|
||||
self.bg:setAnchoredPositionX(width/4)
|
||||
@ -50,7 +49,7 @@ function BattleUIPVP:initBuff()
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
function BattleUIPVP:initNumberNode()
|
||||
@ -62,7 +61,7 @@ function BattleUIPVP:initNumberNode()
|
||||
self.battleNumberSpecial = self.uiMap["battle_ui_pvp.cache_node.battle_number_special"]
|
||||
end
|
||||
|
||||
function BattleBaseUI:initComboNode()
|
||||
function BattleUIPVP:initComboNode()
|
||||
self.comboNode = self.uiMap["battle_ui_pvp.battle_root.combo"]
|
||||
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"]
|
||||
@ -73,7 +72,7 @@ function BattleBaseUI:initComboNode()
|
||||
self:_initComboNode()
|
||||
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.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"]
|
||||
@ -84,7 +83,7 @@ function BattleBaseUI:initHpNode()
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
function BattleUIPVP:hideGenerateSkillGridCells()
|
||||
@ -92,7 +91,7 @@ function BattleUIPVP:hideGenerateSkillGridCells()
|
||||
self:_hideGenerateSkillGridCells(generateSkillCellPrefix)
|
||||
end
|
||||
|
||||
function BattleBaseUI:initSkillLineSfx()
|
||||
function BattleUIPVP:initSkillLineSfx()
|
||||
if not self.skillLineSfxs then
|
||||
self.skillLineSfxs = {}
|
||||
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[25] = self.uiMap["battle_ui_pvp.board_root_node.ani_node.sfx_skill_b05_5"]
|
||||
end
|
||||
|
||||
self:_initSkillLineSfx()
|
||||
end
|
||||
|
||||
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)
|
||||
end
|
||||
|
||||
@ -147,66 +148,40 @@ function BattleUIPVP:getPrefabPath()
|
||||
return "assets/prefabs/ui/battle/battle_ui_pvp.prefab"
|
||||
end
|
||||
|
||||
function BattleUIPVP:getBGMId()
|
||||
return AudioManager.BGM_ID.BATTLE
|
||||
end
|
||||
|
||||
function BattleUIPVP:_display()
|
||||
BattleBaseUI._display(self)
|
||||
self:refreshAvatar()
|
||||
|
||||
---- 适配
|
||||
local w, h = GFunc.getUIExpandScreenSize()
|
||||
local scale = math.min(1, h / 1280 * 0.84)
|
||||
self.boardCenterNode:setVisible(true, scale)
|
||||
end
|
||||
|
||||
function BattleUIPVP:_addListeners()
|
||||
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)
|
||||
end)
|
||||
end
|
||||
|
||||
function BattleUIPVP:getBoardRootNode()
|
||||
local uiMap = self.root:genAllChildren()
|
||||
return uiMap["battle_ui_pvp.board_root_node"]
|
||||
end
|
||||
|
||||
function BattleUIPVP:refreshAvatar()
|
||||
-- 等数据
|
||||
end
|
||||
|
||||
function BattleUIPVP:showLeftBuffTips(buffList, autoClose)
|
||||
local addY = self:showBuffTips(buffList, autoClose)
|
||||
self.battleBuffTipsBg:setAnchoredPosition(-175, -1018 + addY)
|
||||
self.battleBuffTipsBg:setAnchoredPosition(-175, -1050 + addY)
|
||||
end
|
||||
|
||||
function BattleUIPVP:showRightBuffTips(buffList, autoClose)
|
||||
self:showBuffTips(buffList, autoClose)
|
||||
self.battleBuffTipsBg:setAnchoredPosition(175, -188)
|
||||
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)
|
||||
self.battleBuffTipsBg:setAnchoredPosition(175, -200)
|
||||
end
|
||||
|
||||
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 desc = uiMap["battle_ui_pvp.bottom_node.round_text"]
|
||||
desc:setText(wave)
|
||||
GFunc.centerImgAndTx(icon, desc, 10)
|
||||
-- GFunc.centerImgAndTx(icon, desc, 10)
|
||||
|
||||
iconAtlas = iconAtlas or GConst.ATLAS_PATH.COMMON
|
||||
iconName = iconName or "common_dec_3"
|
||||
icon:setSprite(iconAtlas, iconName)
|
||||
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
|
||||
@ -67,7 +67,7 @@ function GridCell:refresh(gridEntity, curElement, skillPosId)
|
||||
skillIcon:setVisible(true)
|
||||
|
||||
local sprite
|
||||
local skillEntity = DataManager.BattleData:getSkillEntityBySkillId(skillId)
|
||||
local skillEntity = self:getSkillEntity()
|
||||
if skillEntity then
|
||||
sprite = skillEntity:getBattleIcon()
|
||||
else
|
||||
@ -91,7 +91,6 @@ function GridCell:refresh(gridEntity, curElement, skillPosId)
|
||||
end
|
||||
end
|
||||
|
||||
local skillEntity = DataManager.BattleData:getSkillEntityBySkillId(skillId)
|
||||
local ignoreElementType = skillEntity:getIgnoreElementType()
|
||||
local skillBg
|
||||
if ignoreElementType and not self.lastShowHlElementType then
|
||||
@ -108,7 +107,7 @@ function GridCell:refresh(gridEntity, curElement, skillPosId)
|
||||
skillIcon:setVisible(false)
|
||||
end
|
||||
|
||||
uiMap["grid_cell.touch_node.ani_node.mask"]:setVisible(showMask)
|
||||
self:showMask(showMask)
|
||||
self:showCircle(gridEntity:getNeedElimination())
|
||||
if self.gridEntity:getIsIdle() then
|
||||
self.lastShowHlElementType = nil
|
||||
@ -128,6 +127,11 @@ function GridCell:refresh(gridEntity, curElement, skillPosId)
|
||||
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)
|
||||
local uiMap = self:getUIMap()
|
||||
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)
|
||||
if skillId then
|
||||
show = true -- 有技能,强制显示特效
|
||||
local skillEntity = DataManager.BattleData:getSkillEntityBySkillId(skillId)
|
||||
local skillEntity = self:getSkillEntity()
|
||||
local ignoreElementType = skillEntity:getIgnoreElementType()
|
||||
local skillBg
|
||||
if ignoreElementType and not mainElementType then
|
||||
@ -284,4 +288,15 @@ function GridCell:playAnim(aniName, loop, forceRefresh, forceGetSG)
|
||||
spineObj:playAnim(aniName, loop, forceRefresh, forceGetSG)
|
||||
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
|
||||
@ -2,9 +2,9 @@ local TinyBuffCell = class("TinyBuffCell", BaseCell)
|
||||
|
||||
function TinyBuffCell:refresh(buffName, round)
|
||||
if round <= 1 or round > 9 then
|
||||
round:setText(GConst.EMPTY_STRING)
|
||||
round = GConst.EMPTY_STRING
|
||||
else
|
||||
round:setText(tostring(round))
|
||||
round = tostring(round)
|
||||
end
|
||||
|
||||
local uiMap = self:getUIMap()
|
||||
|
||||
@ -12,10 +12,12 @@ function BattleBoardSkillTips:onPressBackspace()
|
||||
end
|
||||
|
||||
function BattleBoardSkillTips:ctor(params)
|
||||
local elementType = params.elementType
|
||||
self.params = params
|
||||
self.boardSkillEntity = DataManager.BattleData:getSkillEntityByElement(elementType)
|
||||
self.battleUnitEntity = DataManager.BattleData:getAtkTeam():getAllMembers()[elementType]
|
||||
self.heroEntity = params.heroEntity
|
||||
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.location = params.location
|
||||
end
|
||||
@ -51,15 +53,11 @@ function BattleBoardSkillTips:onRefresh()
|
||||
self:closeUI()
|
||||
end)
|
||||
|
||||
local heroId = self.battleUnitEntity:getId()
|
||||
local heroEntity = DataManager.HeroData:getHeroById(heroId)
|
||||
if not heroEntity then
|
||||
return
|
||||
end
|
||||
local heroId = self.heroEntity:getCfgId()
|
||||
local heroNmae = ModuleManager.HeroManager:getHeroName(heroId)
|
||||
local atk = self.battleUnitEntity:getAtk()
|
||||
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))
|
||||
|
||||
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
|
||||
|
||||
local count = 0
|
||||
local rougeSkillList = heroEntity:getRogueSkillList()
|
||||
local rougeSkillList = self.heroEntity:getRogueSkillList()
|
||||
for index, cell in ipairs(self.selectSkillCells) do
|
||||
local rogueSkillId = rougeSkillList[index]
|
||||
cell:getBaseObject():setActive(rogueSkillId ~= nil)
|
||||
if rogueSkillId then
|
||||
local selectedCount = DataManager.BattleData:getSkillCount(rogueSkillId)
|
||||
local selectedCount = self.battleData:getSkillCount(rogueSkillId, self.side)
|
||||
if selectedCount > 0 then
|
||||
count = count + 1
|
||||
local skillId = rogueSkillId
|
||||
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:addClickListener(function()
|
||||
ModuleManager.TipsManager:showDescTips(ModuleManager.HeroManager:getSkillRogueDesc(skillId, value), cell:getBaseObject())
|
||||
|
||||
@ -41,6 +41,8 @@ function BattleBaseData:init(params)
|
||||
self.defTeam = self:initTeam(SIDE_DEF, params.defFormation)
|
||||
self:initRogueSkills(SIDE_ATK, params.atkFormation)
|
||||
self:initRogueSkills(SIDE_DEF, params.defFormation)
|
||||
self.atkFormation = params.atkFormation or {}
|
||||
self.defFormation = params.defFormation or {}
|
||||
end
|
||||
|
||||
function BattleBaseData:getTimeScale()
|
||||
@ -129,7 +131,7 @@ function BattleBaseData:initRogueSkills(side, formation)
|
||||
for matchType, heroEntity in pairs(formation) do
|
||||
local skillId = heroEntity:getBaseSkill()
|
||||
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]:setUnlockId(heroEntity:getUnlockRogueId())
|
||||
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]:setElementType(data.elementType)
|
||||
else
|
||||
self.gridEntities[data.posId] = BATTLE_GRID_ENTITY:create(data)
|
||||
self.gridEntities[data.posId] = self:getNewGridEntity(data.posId, data.gridType, data.elementType)
|
||||
end
|
||||
self.gridEntities[data.posId]:determineIdleStatus()
|
||||
self.gridEntities[data.posId]:setObstacleIcon(blockIcon)
|
||||
@ -180,7 +182,8 @@ function BattleBaseData:getNewGridEntity(posId, gridType, elementType)
|
||||
local data = {
|
||||
posId = posId or 0,
|
||||
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)
|
||||
end
|
||||
@ -191,6 +194,7 @@ function BattleBaseData:clear()
|
||||
|
||||
self.gridEntities = {}
|
||||
self.skillMap = {}
|
||||
self.skillPool = {}
|
||||
self.selectSkillMap = {}
|
||||
end
|
||||
|
||||
@ -366,13 +370,14 @@ function BattleBaseData:setGridDirty(posId)
|
||||
entity:setDirty()
|
||||
end
|
||||
|
||||
function BattleBaseData:lockAllSkillGrid(lock)
|
||||
function BattleBaseData:lockAllSkillGrid(lock, side)
|
||||
side = side or SIDE_ATK
|
||||
if not self.gridEntities then
|
||||
return
|
||||
end
|
||||
|
||||
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
|
||||
if lock then
|
||||
gridType = GConst.BattleConst.GRID_TYPE.LOCK
|
||||
@ -614,6 +619,14 @@ function BattleBaseData:initTeam(side, formation)
|
||||
return team
|
||||
end
|
||||
|
||||
function BattleBaseData:getTeamBySide(side)
|
||||
if side == SIDE_ATK then
|
||||
return self.atkTeam
|
||||
else
|
||||
return self.defTeam
|
||||
end
|
||||
end
|
||||
|
||||
function BattleBaseData:getAtkTeam()
|
||||
return self.atkTeam
|
||||
end
|
||||
@ -622,6 +635,14 @@ function BattleBaseData:getDefTeam()
|
||||
return self.defTeam
|
||||
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)
|
||||
local units = {}
|
||||
if formation then
|
||||
|
||||
@ -3,8 +3,8 @@ local BattleData = class("BattleData", BattleBaseData)
|
||||
|
||||
local BattleConst = GConst.BattleConst
|
||||
|
||||
function BattleBaseData:getRowCount()
|
||||
return BattleConst.PVP_ROW_COUNT
|
||||
function BattleData:getRowCount()
|
||||
return BattleConst.ROW_COUNT
|
||||
end
|
||||
|
||||
return BattleData
|
||||
@ -10,6 +10,7 @@ function BattleGridEntity:ctor(data)
|
||||
self.elementType = data.elementType or BattleConst.ELEMENT_TYPE.NONE
|
||||
self.skillId = data.skillId
|
||||
self.linkSkillCount = data.linkSkillCount or 0 -- 任意链接技能激活次数
|
||||
self.battleData = data.battleData
|
||||
self.isIdle = false
|
||||
self.breakCount = 0
|
||||
self.data.isDirty = false
|
||||
@ -26,6 +27,10 @@ function BattleGridEntity:clear()
|
||||
self.data.isDirty = false
|
||||
end
|
||||
|
||||
function BattleGridEntity:getBattleData()
|
||||
return self.battleData
|
||||
end
|
||||
|
||||
function BattleGridEntity:getSnapshoptInfo()
|
||||
return {
|
||||
posId = self.posId,
|
||||
@ -149,7 +154,7 @@ function BattleGridEntity:tryBreakGrid(condition, onlyCheck)
|
||||
end
|
||||
|
||||
function BattleGridEntity:getPos()
|
||||
return ModuleManager.BattleManager:getPosInfo(self.posId)
|
||||
return ModuleManager.BattleManager:getPosInfo(self.posId, self.battleData:getRowCount())
|
||||
end
|
||||
|
||||
function BattleGridEntity:setCell(cell)
|
||||
@ -203,7 +208,7 @@ end
|
||||
|
||||
function BattleGridEntity:setElementType(elementType, noDirty)
|
||||
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)
|
||||
end
|
||||
if not noDirty then
|
||||
@ -218,14 +223,36 @@ function BattleGridEntity:getSkillId()
|
||||
return self.skillId
|
||||
end
|
||||
|
||||
function BattleGridEntity:setSkilId(skillId, noDirty)
|
||||
function BattleGridEntity:setSkilId(skillId, noDirty, side)
|
||||
self.skillId = skillId
|
||||
self.linkSkillCount = 0
|
||||
self.skillSide = side or GConst.BattleConst.SIDE_ATK
|
||||
if not noDirty then
|
||||
self:setDirty()
|
||||
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()
|
||||
if self:canLink() and not self:getSkillId() then
|
||||
return true
|
||||
@ -267,7 +294,7 @@ function BattleGridEntity:getNeedChangePos()
|
||||
return false
|
||||
end
|
||||
|
||||
local skillEntity = DataManager.BattleData:getSkillEntityBySkillId(self:getSkillId())
|
||||
local skillEntity = self:getSkillEntity()
|
||||
if not skillEntity then
|
||||
return false
|
||||
end
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
local BattleBoardSkillEntity = class("BattleBoardSkillEntity", BaseData)
|
||||
local BattleBuffEntity = require "app/userdata/battle/skill/battle_buff_entity"
|
||||
|
||||
function BattleBoardSkillEntity:ctor(skillId)
|
||||
function BattleBoardSkillEntity:ctor(skillId, side)
|
||||
self:refreshSkillId(skillId)
|
||||
self.side = side
|
||||
self.curEnergy = 0
|
||||
self.addRange = {}
|
||||
self.linkEffectEntities = {} -- 链接攻击伤害 type = 3
|
||||
@ -349,7 +350,7 @@ function BattleBoardSkillEntity:getElementCountEffect()
|
||||
end
|
||||
|
||||
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
|
||||
return
|
||||
end
|
||||
|
||||
@ -36,8 +36,12 @@ end
|
||||
function BattleSkillEntity:initSkillEffect()
|
||||
self.effectList = {}
|
||||
self.isHurtType = false
|
||||
if self.skillInfo.effect then
|
||||
for k, v in ipairs(self.skillInfo.effect) do
|
||||
local effect = self.skillInfo.effect
|
||||
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()
|
||||
buffEntity:init(v, self.owner, self)
|
||||
if buffEntity:getIsHurtType() then
|
||||
@ -66,8 +70,12 @@ function BattleSkillEntity:initEffectBlock()
|
||||
end
|
||||
else
|
||||
local count = 0
|
||||
if self.skillInfo.effect then
|
||||
count = #self.skillInfo.effect
|
||||
local effect = self.skillInfo.effect
|
||||
if self:getUsePvpEffect() then
|
||||
effect = self.skillInfo.pvp_effect or effect
|
||||
end
|
||||
if effect then
|
||||
count = #effect
|
||||
end
|
||||
table.insert(self.effectBlock, count)
|
||||
end
|
||||
@ -78,6 +86,18 @@ function BattleSkillEntity:initEffectBlock()
|
||||
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()
|
||||
self.skillCanUseTimes = self.owner:getSkillExtraUseTimes(self.skillId) + 1
|
||||
end
|
||||
@ -156,6 +176,16 @@ function BattleSkillEntity:addSkillEffectRatio(effect)
|
||||
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()
|
||||
return self.skillId
|
||||
end
|
||||
@ -270,16 +300,24 @@ function BattleSkillEntity:getPassiveTriggerId()
|
||||
end
|
||||
|
||||
function BattleSkillEntity:getFxSelf()
|
||||
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
|
||||
|
||||
function BattleSkillEntity:getFxSelfDelay()
|
||||
return self.skillInfo.fx_self_delay
|
||||
end
|
||||
|
||||
function BattleSkillEntity:getFxTarget()
|
||||
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
|
||||
|
||||
function BattleSkillEntity:getFxTargetDelay()
|
||||
return self.skillInfo.fx_target_delay
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user