Merge branch 'dev' of git.juzugame.com:b6-client/b6-lua into dev
This commit is contained in:
commit
89497ab68e
186
lua/app/config/battle_exp.lua
Normal file
186
lua/app/config/battle_exp.lua
Normal file
@ -0,0 +1,186 @@
|
|||||||
|
local battle_exp = {
|
||||||
|
[1]={
|
||||||
|
["exp"]=2
|
||||||
|
},
|
||||||
|
[2]={
|
||||||
|
["exp"]=18
|
||||||
|
},
|
||||||
|
[3]={
|
||||||
|
["exp"]=58
|
||||||
|
},
|
||||||
|
[4]={
|
||||||
|
["exp"]=108
|
||||||
|
},
|
||||||
|
[5]={
|
||||||
|
["exp"]=188
|
||||||
|
},
|
||||||
|
[6]={
|
||||||
|
["exp"]=298
|
||||||
|
},
|
||||||
|
[7]={
|
||||||
|
["exp"]=448
|
||||||
|
},
|
||||||
|
[8]={
|
||||||
|
["exp"]=658
|
||||||
|
},
|
||||||
|
[9]={
|
||||||
|
["exp"]=948
|
||||||
|
},
|
||||||
|
[10]={
|
||||||
|
["exp"]=1318
|
||||||
|
},
|
||||||
|
[11]={
|
||||||
|
["exp"]=1858
|
||||||
|
},
|
||||||
|
[12]={
|
||||||
|
["exp"]=2568
|
||||||
|
},
|
||||||
|
[13]={
|
||||||
|
["exp"]=3448
|
||||||
|
},
|
||||||
|
[14]={
|
||||||
|
["exp"]=4498
|
||||||
|
},
|
||||||
|
[15]={
|
||||||
|
["exp"]=5718
|
||||||
|
},
|
||||||
|
[16]={
|
||||||
|
["exp"]=7138
|
||||||
|
},
|
||||||
|
[17]={
|
||||||
|
["exp"]=8758
|
||||||
|
},
|
||||||
|
[18]={
|
||||||
|
["exp"]=10628
|
||||||
|
},
|
||||||
|
[19]={
|
||||||
|
["exp"]=12748
|
||||||
|
},
|
||||||
|
[20]={
|
||||||
|
["exp"]=15118
|
||||||
|
},
|
||||||
|
[21]={
|
||||||
|
["exp"]=17738
|
||||||
|
},
|
||||||
|
[22]={
|
||||||
|
["exp"]=20608
|
||||||
|
},
|
||||||
|
[23]={
|
||||||
|
["exp"]=23728
|
||||||
|
},
|
||||||
|
[24]={
|
||||||
|
["exp"]=27098
|
||||||
|
},
|
||||||
|
[25]={
|
||||||
|
["exp"]=30718
|
||||||
|
},
|
||||||
|
[26]={
|
||||||
|
["exp"]=34588
|
||||||
|
},
|
||||||
|
[27]={
|
||||||
|
["exp"]=38708
|
||||||
|
},
|
||||||
|
[28]={
|
||||||
|
["exp"]=43078
|
||||||
|
},
|
||||||
|
[29]={
|
||||||
|
["exp"]=47798
|
||||||
|
},
|
||||||
|
[30]={
|
||||||
|
["exp"]=52868
|
||||||
|
},
|
||||||
|
[31]={
|
||||||
|
["exp"]=58288
|
||||||
|
},
|
||||||
|
[32]={
|
||||||
|
["exp"]=64058
|
||||||
|
},
|
||||||
|
[33]={
|
||||||
|
["exp"]=70178
|
||||||
|
},
|
||||||
|
[34]={
|
||||||
|
["exp"]=76648
|
||||||
|
},
|
||||||
|
[35]={
|
||||||
|
["exp"]=83468
|
||||||
|
},
|
||||||
|
[36]={
|
||||||
|
["exp"]=90638
|
||||||
|
},
|
||||||
|
[37]={
|
||||||
|
["exp"]=98158
|
||||||
|
},
|
||||||
|
[38]={
|
||||||
|
["exp"]=106028
|
||||||
|
},
|
||||||
|
[39]={
|
||||||
|
["exp"]=114248
|
||||||
|
},
|
||||||
|
[40]={
|
||||||
|
["exp"]=122918
|
||||||
|
},
|
||||||
|
[41]={
|
||||||
|
["exp"]=132038
|
||||||
|
},
|
||||||
|
[42]={
|
||||||
|
["exp"]=141608
|
||||||
|
},
|
||||||
|
[43]={
|
||||||
|
["exp"]=151628
|
||||||
|
},
|
||||||
|
[44]={
|
||||||
|
["exp"]=162098
|
||||||
|
},
|
||||||
|
[45]={
|
||||||
|
["exp"]=173018
|
||||||
|
},
|
||||||
|
[46]={
|
||||||
|
["exp"]=184388
|
||||||
|
},
|
||||||
|
[47]={
|
||||||
|
["exp"]=196208
|
||||||
|
},
|
||||||
|
[48]={
|
||||||
|
["exp"]=208478
|
||||||
|
},
|
||||||
|
[49]={
|
||||||
|
["exp"]=221198
|
||||||
|
},
|
||||||
|
[50]={
|
||||||
|
["exp"]=234368
|
||||||
|
},
|
||||||
|
[51]={
|
||||||
|
["exp"]=247988
|
||||||
|
},
|
||||||
|
[52]={
|
||||||
|
["exp"]=262058
|
||||||
|
},
|
||||||
|
[53]={
|
||||||
|
["exp"]=276578
|
||||||
|
},
|
||||||
|
[54]={
|
||||||
|
["exp"]=291548
|
||||||
|
},
|
||||||
|
[55]={
|
||||||
|
["exp"]=306968
|
||||||
|
},
|
||||||
|
[56]={
|
||||||
|
["exp"]=322838
|
||||||
|
},
|
||||||
|
[57]={
|
||||||
|
["exp"]=339158
|
||||||
|
},
|
||||||
|
[58]={
|
||||||
|
["exp"]=355928
|
||||||
|
},
|
||||||
|
[59]={
|
||||||
|
["exp"]=373148
|
||||||
|
},
|
||||||
|
[60]={
|
||||||
|
["exp"]=390368
|
||||||
|
}
|
||||||
|
}
|
||||||
|
local config = {
|
||||||
|
data=battle_exp,count=60
|
||||||
|
}
|
||||||
|
return config
|
||||||
10
lua/app/config/battle_exp.lua.meta
Normal file
10
lua/app/config/battle_exp.lua.meta
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0969bad6920b66d43b567117507a49e7
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||||
@ -102,6 +102,10 @@ local buff = {
|
|||||||
["decr"]=3,
|
["decr"]=3,
|
||||||
["is_percent"]=2,
|
["is_percent"]=2,
|
||||||
["v_buf"]="heal"
|
["v_buf"]="heal"
|
||||||
|
},
|
||||||
|
[14]={
|
||||||
|
["name"]="block_hurt_dec",
|
||||||
|
["buff_type"]=1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
local keys = {
|
local keys = {
|
||||||
@ -118,12 +122,13 @@ local keys = {
|
|||||||
["block"]=buff[10],
|
["block"]=buff[10],
|
||||||
["hit_block"]=buff[11],
|
["hit_block"]=buff[11],
|
||||||
["heal"]=buff[12],
|
["heal"]=buff[12],
|
||||||
["hit_heal"]=buff[13]
|
["hit_heal"]=buff[13],
|
||||||
|
["block_hurt_dec"]=buff[14]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
local config = {
|
local config = {
|
||||||
data=buff,
|
data=buff,
|
||||||
keys=keys,
|
keys=keys,
|
||||||
count=13
|
count=14
|
||||||
}
|
}
|
||||||
return config
|
return config
|
||||||
File diff suppressed because it is too large
Load Diff
7148
lua/app/config/chapter_board.lua
Normal file
7148
lua/app/config/chapter_board.lua
Normal file
File diff suppressed because it is too large
Load Diff
10
lua/app/config/chapter_board.lua.meta
Normal file
10
lua/app/config/chapter_board.lua.meta
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8e2b7e3534b15dc4aa3b72501a87f467
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||||
@ -7,6 +7,10 @@ local LocalizationGlobalConst =
|
|||||||
QLT_DESC_4 = "QLT_DESC_4",
|
QLT_DESC_4 = "QLT_DESC_4",
|
||||||
QLT_DESC_5 = "QLT_DESC_5",
|
QLT_DESC_5 = "QLT_DESC_5",
|
||||||
QLT_DESC_6 = "QLT_DESC_6",
|
QLT_DESC_6 = "QLT_DESC_6",
|
||||||
|
MESSAGE_BOX_TITLE = "MESSAGE_BOX_TITLE",
|
||||||
|
BTN_TEXT_CANCEL = "BTN_TEXT_CANCEL",
|
||||||
|
BTN_TEXT_OK = "BTN_TEXT_OK",
|
||||||
|
BATTLE_DESC_1 = "BATTLE_DESC_1",
|
||||||
}
|
}
|
||||||
|
|
||||||
return LocalizationGlobalConst
|
return LocalizationGlobalConst
|
||||||
120
lua/app/config/monster_base.lua
Normal file
120
lua/app/config/monster_base.lua
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
local monster_base = {
|
||||||
|
[10001]={
|
||||||
|
["model_id"]="m10001"
|
||||||
|
},
|
||||||
|
[10002]={
|
||||||
|
["model_id"]="m10002"
|
||||||
|
},
|
||||||
|
[10003]={
|
||||||
|
["model_id"]="m10003"
|
||||||
|
},
|
||||||
|
[10004]={
|
||||||
|
["model_id"]="m10004"
|
||||||
|
},
|
||||||
|
[10005]={
|
||||||
|
["model_id"]="m10005"
|
||||||
|
},
|
||||||
|
[10006]={
|
||||||
|
["model_id"]="m10006"
|
||||||
|
},
|
||||||
|
[10007]={
|
||||||
|
["model_id"]="m10007"
|
||||||
|
},
|
||||||
|
[10008]={
|
||||||
|
["model_id"]="m10008"
|
||||||
|
},
|
||||||
|
[10009]={
|
||||||
|
["model_id"]="m10009"
|
||||||
|
},
|
||||||
|
[10010]={
|
||||||
|
["model_id"]="m10010"
|
||||||
|
},
|
||||||
|
[10011]={
|
||||||
|
["model_id"]="m10011"
|
||||||
|
},
|
||||||
|
[10012]={
|
||||||
|
["model_id"]="m10012"
|
||||||
|
},
|
||||||
|
[10013]={
|
||||||
|
["model_id"]="m10013"
|
||||||
|
},
|
||||||
|
[10014]={
|
||||||
|
["model_id"]="m10014"
|
||||||
|
},
|
||||||
|
[10015]={
|
||||||
|
["model_id"]="m10015"
|
||||||
|
},
|
||||||
|
[10016]={
|
||||||
|
["model_id"]="m10016"
|
||||||
|
},
|
||||||
|
[10017]={
|
||||||
|
["model_id"]="m10017"
|
||||||
|
},
|
||||||
|
[10018]={
|
||||||
|
["model_id"]="m10018"
|
||||||
|
},
|
||||||
|
[10019]={
|
||||||
|
["model_id"]="m10019"
|
||||||
|
},
|
||||||
|
[10020]={
|
||||||
|
["model_id"]="m10020"
|
||||||
|
},
|
||||||
|
[10021]={
|
||||||
|
["model_id"]="m10021"
|
||||||
|
},
|
||||||
|
[10022]={
|
||||||
|
["model_id"]="m10022"
|
||||||
|
},
|
||||||
|
[20001]={
|
||||||
|
["model_id"]="m20001"
|
||||||
|
},
|
||||||
|
[20002]={
|
||||||
|
["model_id"]="m20002"
|
||||||
|
},
|
||||||
|
[20003]={
|
||||||
|
["model_id"]="m20003"
|
||||||
|
},
|
||||||
|
[20004]={
|
||||||
|
["model_id"]="m20004"
|
||||||
|
},
|
||||||
|
[20005]={
|
||||||
|
["model_id"]="m20005"
|
||||||
|
},
|
||||||
|
[20006]={
|
||||||
|
["model_id"]="m20006"
|
||||||
|
},
|
||||||
|
[20007]={
|
||||||
|
["model_id"]="m20007"
|
||||||
|
},
|
||||||
|
[20008]={
|
||||||
|
["model_id"]="m20008"
|
||||||
|
},
|
||||||
|
[20009]={
|
||||||
|
["model_id"]="m20009"
|
||||||
|
},
|
||||||
|
[20010]={
|
||||||
|
["model_id"]="m20010"
|
||||||
|
},
|
||||||
|
[20011]={
|
||||||
|
["model_id"]="m20011"
|
||||||
|
},
|
||||||
|
[20012]={
|
||||||
|
["model_id"]="m20012"
|
||||||
|
},
|
||||||
|
[20013]={
|
||||||
|
["model_id"]="m20013"
|
||||||
|
},
|
||||||
|
[20014]={
|
||||||
|
["model_id"]="m20014"
|
||||||
|
},
|
||||||
|
[20015]={
|
||||||
|
["model_id"]="m20015"
|
||||||
|
},
|
||||||
|
[20016]={
|
||||||
|
["model_id"]="m20016"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
local config = {
|
||||||
|
data=monster_base,count=38
|
||||||
|
}
|
||||||
|
return config
|
||||||
10
lua/app/config/monster_base.lua.meta
Normal file
10
lua/app/config/monster_base.lua.meta
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d719904ab37d95c409385663201f45af
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||||
86
lua/app/config/monster_chapter.lua
Normal file
86
lua/app/config/monster_chapter.lua
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
local monster_chapter = {
|
||||||
|
[101]={
|
||||||
|
["monster_base"]=10001,
|
||||||
|
["hp"]=10000000,
|
||||||
|
["atk"]=10000,
|
||||||
|
["atk_times"]=2,
|
||||||
|
["skill"]={
|
||||||
|
100001
|
||||||
|
},
|
||||||
|
["monster_exp"]=10000
|
||||||
|
},
|
||||||
|
[201]={
|
||||||
|
["monster_base"]=10002,
|
||||||
|
["hp"]=10000000,
|
||||||
|
["atk"]=10000,
|
||||||
|
["atk_times"]=3,
|
||||||
|
["skill"]={
|
||||||
|
100001
|
||||||
|
},
|
||||||
|
["monster_exp"]=10000
|
||||||
|
},
|
||||||
|
[301]={
|
||||||
|
["monster_base"]=10003,
|
||||||
|
["hp"]=10000000,
|
||||||
|
["atk"]=10000,
|
||||||
|
["atk_times"]=2,
|
||||||
|
["skill"]={
|
||||||
|
100001
|
||||||
|
},
|
||||||
|
["monster_exp"]=10000
|
||||||
|
},
|
||||||
|
[401]={
|
||||||
|
["monster_base"]=10004,
|
||||||
|
["hp"]=10000000,
|
||||||
|
["atk"]=10000,
|
||||||
|
["atk_times"]=3,
|
||||||
|
["skill"]={
|
||||||
|
100001
|
||||||
|
},
|
||||||
|
["monster_exp"]=10000
|
||||||
|
},
|
||||||
|
[501]={
|
||||||
|
["monster_base"]=10005,
|
||||||
|
["hp"]=10000000,
|
||||||
|
["atk"]=10000,
|
||||||
|
["atk_times"]=2,
|
||||||
|
["skill"]={
|
||||||
|
100001
|
||||||
|
},
|
||||||
|
["monster_exp"]=10000
|
||||||
|
},
|
||||||
|
[601]={
|
||||||
|
["monster_base"]=10006,
|
||||||
|
["hp"]=10000000,
|
||||||
|
["atk"]=10000,
|
||||||
|
["atk_times"]=3,
|
||||||
|
["skill"]={
|
||||||
|
100001
|
||||||
|
},
|
||||||
|
["monster_exp"]=10000
|
||||||
|
},
|
||||||
|
[701]={
|
||||||
|
["monster_base"]=10007,
|
||||||
|
["hp"]=10000000,
|
||||||
|
["atk"]=10000,
|
||||||
|
["atk_times"]=2,
|
||||||
|
["skill"]={
|
||||||
|
100001
|
||||||
|
},
|
||||||
|
["monster_exp"]=10000
|
||||||
|
},
|
||||||
|
[801]={
|
||||||
|
["monster_base"]=10008,
|
||||||
|
["hp"]=10000000,
|
||||||
|
["atk"]=10000,
|
||||||
|
["atk_times"]=3,
|
||||||
|
["skill"]={
|
||||||
|
100001
|
||||||
|
},
|
||||||
|
["monster_exp"]=10000
|
||||||
|
}
|
||||||
|
}
|
||||||
|
local config = {
|
||||||
|
data=monster_chapter,count=8
|
||||||
|
}
|
||||||
|
return config
|
||||||
10
lua/app/config/monster_chapter.lua.meta
Normal file
10
lua/app/config/monster_chapter.lua.meta
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 779a2880a816b4243bf908b3812de050
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||||
32
lua/app/config/skill_monster.lua
Normal file
32
lua/app/config/skill_monster.lua
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
local skill_monster = {
|
||||||
|
[100001]={
|
||||||
|
["cd"]=3,
|
||||||
|
["cd_start"]=3
|
||||||
|
},
|
||||||
|
[100002]={
|
||||||
|
["cd"]=4,
|
||||||
|
["cd_start"]=4
|
||||||
|
},
|
||||||
|
[100003]={
|
||||||
|
|
||||||
|
},
|
||||||
|
[100004]={
|
||||||
|
|
||||||
|
},
|
||||||
|
[100005]={
|
||||||
|
|
||||||
|
},
|
||||||
|
[100006]={
|
||||||
|
|
||||||
|
},
|
||||||
|
[100007]={
|
||||||
|
|
||||||
|
},
|
||||||
|
[100008]={
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
local config = {
|
||||||
|
data=skill_monster,count=8
|
||||||
|
}
|
||||||
|
return config
|
||||||
10
lua/app/config/skill_monster.lua.meta
Normal file
10
lua/app/config/skill_monster.lua.meta
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5bb9a5e5ecdd2844bb315067b877a3a5
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||||
@ -7,6 +7,10 @@ local localization_global =
|
|||||||
["QLT_DESC_4"] = "史诗",
|
["QLT_DESC_4"] = "史诗",
|
||||||
["QLT_DESC_5"] = "传说",
|
["QLT_DESC_5"] = "传说",
|
||||||
["QLT_DESC_6"] = "神话",
|
["QLT_DESC_6"] = "神话",
|
||||||
|
["MESSAGE_BOX_TITLE"] = "提示",
|
||||||
|
["BTN_TEXT_CANCEL"] = "取消",
|
||||||
|
["BTN_TEXT_OK"] = "确定",
|
||||||
|
["BATTLE_DESC_1"] = "是否退出战斗",
|
||||||
}
|
}
|
||||||
|
|
||||||
return localization_global
|
return localization_global
|
||||||
@ -125,20 +125,20 @@ function BattleManager:getFirstLineLastRowPosId(row, column)
|
|||||||
return self:getPosId(1 - row, column)
|
return self:getPosId(1 - row, column)
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleManager:getAroundPosIdsByList(posId, boardrange, cludePosIdsMap)
|
function BattleManager:getAroundPosIdsByList(posId, boardrange, cludePosIdsMap, randomExclusion)
|
||||||
local ids = {}
|
local posIdInfos = {}
|
||||||
for _, info in ipairs(boardrange) do
|
for _, info in ipairs(boardrange) do
|
||||||
local list = self:getAroundPosIds(posId, info.type, info.range, cludePosIdsMap)
|
local list = self:getAroundPosIds(posId, info.type, info.range, cludePosIdsMap, randomExclusion)
|
||||||
for _, posId in ipairs(list) do
|
for _, info in ipairs(list) do
|
||||||
table.insert(ids, posId)
|
table.insert(posIdInfos, info)
|
||||||
cludePosIdsMap[posId] = nil
|
cludePosIdsMap[info.posId] = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return ids
|
return posIdInfos
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleManager:getAroundPosIds(posId, direction, range, cludePosIdsMap)
|
function BattleManager:getAroundPosIds(posId, direction, range, cludePosIdsMap, randomExclusion)
|
||||||
local rc = self:getPosRC(posId)
|
local rc = self:getPosRC(posId)
|
||||||
local r = rc.r
|
local r = rc.r
|
||||||
local c = rc.c
|
local c = rc.c
|
||||||
@ -148,36 +148,38 @@ function BattleManager:getAroundPosIds(posId, direction, range, cludePosIdsMap)
|
|||||||
if cludePosIdsMap then
|
if cludePosIdsMap then
|
||||||
local cludePosIds = {}
|
local cludePosIds = {}
|
||||||
for posId, _ in pairs(cludePosIdsMap) do
|
for posId, _ in pairs(cludePosIdsMap) do
|
||||||
table.insert(cludePosIds, posId)
|
if not randomExclusion or not randomExclusion[posId] then
|
||||||
|
table.insert(cludePosIds, posId)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local count = math.min(#cludePosIds, range)
|
local count = math.min(#cludePosIds, range)
|
||||||
for i = 1, count do
|
for i = 1, count do
|
||||||
table.insert(posIdList, cludePosIds[math.random(1, #cludePosIds)])
|
table.insert(posIdList, {posId = cludePosIds[math.random(1, #cludePosIds)], direction = direction})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif direction == BattleConst.BOARD_RANGE_TYPE.UP then
|
elseif direction == BattleConst.BOARD_RANGE_TYPE.UP then
|
||||||
for i = r - 1, r - range, -1 do
|
for i = r - 1, r - range, -1 do
|
||||||
if i >= 1 then
|
if i >= 1 then
|
||||||
table.insert(posIdList, self:getPosId(i, c))
|
table.insert(posIdList, {posId = self:getPosId(i, c), direction = direction})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif direction == BattleConst.BOARD_RANGE_TYPE.DOWN then
|
elseif direction == BattleConst.BOARD_RANGE_TYPE.DOWN then
|
||||||
for i = r + 1, r + range do
|
for i = r + 1, r + range do
|
||||||
if i <= BattleConst.ROW_COUNT then
|
if i <= BattleConst.ROW_COUNT then
|
||||||
table.insert(posIdList, self:getPosId(i, c))
|
table.insert(posIdList, {posId = self:getPosId(i, c), direction = direction})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif direction == BattleConst.BOARD_RANGE_TYPE.LEFT then
|
elseif direction == BattleConst.BOARD_RANGE_TYPE.LEFT then
|
||||||
for i = c - 1, c - range, -1 do
|
for i = c - 1, c - range, -1 do
|
||||||
if i >= 1 then
|
if i >= 1 then
|
||||||
table.insert(posIdList, self:getPosId(r, i))
|
table.insert(posIdList, {posId = self:getPosId(r, i), direction = direction})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif direction == BattleConst.BOARD_RANGE_TYPE.RIGHT then
|
elseif direction == BattleConst.BOARD_RANGE_TYPE.RIGHT then
|
||||||
for i = c + 1, c + range do
|
for i = c + 1, c + range do
|
||||||
if i <= BattleConst.COLUMN_COUNT then
|
if i <= BattleConst.COLUMN_COUNT then
|
||||||
table.insert(posIdList, self:getPosId(r, i))
|
table.insert(posIdList, {posId = self:getPosId(r, i), direction = direction})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif direction == BattleConst.BOARD_RANGE_TYPE.LEFT_UP then
|
elseif direction == BattleConst.BOARD_RANGE_TYPE.LEFT_UP then
|
||||||
@ -185,7 +187,7 @@ function BattleManager:getAroundPosIds(posId, direction, range, cludePosIdsMap)
|
|||||||
if i >= 1 then
|
if i >= 1 then
|
||||||
for j = r - 1, r - range, -1 do
|
for j = r - 1, r - range, -1 do
|
||||||
if j >= 1 then
|
if j >= 1 then
|
||||||
table.insert(posIdList, self:getPosId(j, i))
|
table.insert(posIdList, {posId = self:getPosId(j, i), direction = direction})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -195,7 +197,7 @@ function BattleManager:getAroundPosIds(posId, direction, range, cludePosIdsMap)
|
|||||||
if i >= 1 then
|
if i >= 1 then
|
||||||
for j = r + 1, r + range do
|
for j = r + 1, r + range do
|
||||||
if j <= BattleConst.ROW_COUNT then
|
if j <= BattleConst.ROW_COUNT then
|
||||||
table.insert(posIdList, self:getPosId(j, i))
|
table.insert(posIdList, {posId = self:getPosId(j, i), direction = direction})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -205,7 +207,7 @@ function BattleManager:getAroundPosIds(posId, direction, range, cludePosIdsMap)
|
|||||||
if i <= BattleConst.COLUMN_COUNT then
|
if i <= BattleConst.COLUMN_COUNT then
|
||||||
for j = r - 1, r - range, -1 do
|
for j = r - 1, r - range, -1 do
|
||||||
if j >= 1 then
|
if j >= 1 then
|
||||||
table.insert(posIdList, self:getPosId(j, i))
|
table.insert(posIdList, {posId = self:getPosId(j, i), direction = direction})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -215,7 +217,7 @@ function BattleManager:getAroundPosIds(posId, direction, range, cludePosIdsMap)
|
|||||||
if i <= BattleConst.COLUMN_COUNT then
|
if i <= BattleConst.COLUMN_COUNT then
|
||||||
for j = r + 1, r + range do
|
for j = r + 1, r + range do
|
||||||
if j <= BattleConst.ROW_COUNT then
|
if j <= BattleConst.ROW_COUNT then
|
||||||
table.insert(posIdList, self:getPosId(j, i))
|
table.insert(posIdList, {posId = self:getPosId(j, i), direction = direction})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -224,9 +226,9 @@ function BattleManager:getAroundPosIds(posId, direction, range, cludePosIdsMap)
|
|||||||
|
|
||||||
if cludePosIdsMap then
|
if cludePosIdsMap then
|
||||||
local newList = {}
|
local newList = {}
|
||||||
for _, posId in ipairs(posIdList) do
|
for _, info in ipairs(posIdList) do
|
||||||
if cludePosIdsMap[posId] then
|
if cludePosIdsMap[info.posId] then
|
||||||
table.insert(newList, posId)
|
table.insert(newList, info)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return newList
|
return newList
|
||||||
|
|||||||
@ -9,11 +9,15 @@ local ELIMINATION_TOUCH_EVENT = GConst.ELIMINATION_TOUCH_EVENT
|
|||||||
local BattleConst = GConst.BattleConst
|
local BattleConst = GConst.BattleConst
|
||||||
|
|
||||||
-- *************各个子模块的战斗需要重写的方法 START*************
|
-- *************各个子模块的战斗需要重写的方法 START*************
|
||||||
|
function BattleController:getChapterId()
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
function BattleController:getInitBoard()
|
function BattleController:getInitBoard()
|
||||||
return {}
|
return {}
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleController:getFixedRandomGrid()
|
function BattleController:getNotInvolvedSkills()
|
||||||
return {}
|
return {}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -40,22 +44,24 @@ function BattleController:loadOtherRes(callback)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function BattleController:onLinkChange()
|
function BattleController:onLinkChange()
|
||||||
for posId, entity in pairs(DataManager.BattleData:getGridEnties()) do
|
for posId, entity in pairs(self.battleData:getGridEnties()) do
|
||||||
if entity:getCell() then
|
if entity:getCell() then
|
||||||
entity:getCell():showHighLight(false)
|
entity:getCell():showHighLight(false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local sequence = DataManager.BattleData:getGridSequence()
|
local sequence = self.battleData:getGridSequence()
|
||||||
local elementTypeMap = {}
|
local elementTypeMap = {}
|
||||||
local posIdMap = {}
|
local posIdMap = {}
|
||||||
|
local mainElementType
|
||||||
for _, info in ipairs(sequence) do
|
for _, info in ipairs(sequence) do
|
||||||
posIdMap[info.posId] = true
|
posIdMap[info.posId] = true
|
||||||
local entity = DataManager.BattleData:getGridEntity(info.posId)
|
local entity = self.battleData:getGridEntity(info.posId)
|
||||||
|
|
||||||
if not entity:getSkillId() then
|
if not entity:getSkillId() then
|
||||||
local elementType = entity:getElementType()
|
local elementType = entity:getElementType()
|
||||||
elementTypeMap[elementType] = (elementTypeMap[elementType] or 0) + 1
|
elementTypeMap[elementType] = (elementTypeMap[elementType] or 0) + 1
|
||||||
|
mainElementType = elementType
|
||||||
end
|
end
|
||||||
|
|
||||||
if entity:getCell() then
|
if entity:getCell() then
|
||||||
@ -63,35 +69,39 @@ function BattleController:onLinkChange()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
for posId, _ in pairs(DataManager.BattleData:getSkillInfluenceGrids()) do
|
for posId, info in pairs(self.battleData:getSkillInfluenceGrids()) do
|
||||||
|
local entity = self.battleData:getGridEntity(posId)
|
||||||
if not posIdMap[posId] then
|
if not posIdMap[posId] then
|
||||||
posIdMap[posId] = true
|
posIdMap[posId] = true
|
||||||
local entity = DataManager.BattleData:getGridEntity(posId)
|
|
||||||
if not entity:getSkillId() then
|
if not entity:getSkillId() then
|
||||||
local elementType = entity:getElementType()
|
local elementType = entity:getElementType()
|
||||||
elementTypeMap[elementType] = (elementTypeMap[elementType] or 0) + 1
|
elementTypeMap[elementType] = (elementTypeMap[elementType] or 0) + 1
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if entity:getCell() then
|
if entity:getCell() and info.direction ~= BattleConst.BOARD_RANGE_TYPE.RANDOM then
|
||||||
entity:getCell():showCircle(true)
|
entity:getCell():showCircle(true)
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
self.battleUI:refreshSkill(elementTypeMap)
|
self.battleUI:refreshSkill(elementTypeMap)
|
||||||
Logger.logHighlight("---------onLinkChange--------------")
|
Logger.logHighlight("---------onLinkChange--------------")
|
||||||
Logger.printTable(elementTypeMap)
|
Logger.printTable(elementTypeMap)
|
||||||
|
if mainElementType then
|
||||||
|
Logger.logHighlight("mainElementType " .. mainElementType)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- *************各个子模块的战斗需要重写的方法 END*************
|
-- *************各个子模块的战斗需要重写的方法 END*************
|
||||||
|
|
||||||
function BattleController:ctor()
|
function BattleController:ctor()
|
||||||
|
self.battleData = DataManager.BattleData
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleController:init(params)
|
function BattleController:init(params)
|
||||||
params = params or {}
|
params = params or {}
|
||||||
DataManager.BattleData:init(self:getInitBoard())
|
self.chapterId = self:getChapterId()
|
||||||
|
self.battleData:init()
|
||||||
BattleHelper:init()
|
BattleHelper:init()
|
||||||
self:prepareFight()
|
self:prepareFight()
|
||||||
end
|
end
|
||||||
@ -110,6 +120,7 @@ function BattleController:prepareFight()
|
|||||||
self.battleUI:setController(self)
|
self.battleUI:setController(self)
|
||||||
self.battleUI:addLoadUICompleteListener(function()
|
self.battleUI:addLoadUICompleteListener(function()
|
||||||
self:initAllUnits(onPreloadFinished)
|
self:initAllUnits(onPreloadFinished)
|
||||||
|
self:generateBoard()
|
||||||
end)
|
end)
|
||||||
self:loadOtherRes(onPreloadFinished)
|
self:loadOtherRes(onPreloadFinished)
|
||||||
end
|
end
|
||||||
@ -117,7 +128,7 @@ end
|
|||||||
function BattleController:initAllUnits(callback)
|
function BattleController:initAllUnits(callback)
|
||||||
self.atkUnits = {}
|
self.atkUnits = {}
|
||||||
self.defUnits = {}
|
self.defUnits = {}
|
||||||
local atkTeam = DataManager.BattleData:getAtkTeam()
|
local atkTeam = self.battleData:getAtkTeam()
|
||||||
local count = 0
|
local count = 0
|
||||||
local totalCount = atkTeam:getMembersCount()
|
local totalCount = atkTeam:getMembersCount()
|
||||||
local function onloadFinished()
|
local function onloadFinished()
|
||||||
@ -148,23 +159,23 @@ function BattleController:onLoadComplete()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function BattleController:onTouchEvent(eventType, posId)
|
function BattleController:onTouchEvent(eventType, posId)
|
||||||
local entity = DataManager.BattleData:getGridEntity(posId)
|
local entity = self.battleData:getGridEntity(posId)
|
||||||
if not entity:canLink() then
|
if not entity:canLink() then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if eventType == ELIMINATION_TOUCH_EVENT.DOWN then
|
if eventType == ELIMINATION_TOUCH_EVENT.DOWN then
|
||||||
if #DataManager.BattleData:getGridSequence() > 0 then
|
if #self.battleData:getGridSequence() > 0 then
|
||||||
DataManager.BattleData:clearGridSequence()
|
self.battleData:clearGridSequence()
|
||||||
end
|
end
|
||||||
DataManager.BattleData:insertGridSequence(posId, self:snapshotBoard())
|
self.battleData:insertGridSequence(posId, self:snapshotBoard())
|
||||||
local skillEntity = DataManager.BattleData:getSkillEntityBySkillId(entity:getSkillId())
|
local skillEntity = self.battleData:getSkillEntityBySkillId(entity:getSkillId())
|
||||||
local maskElementType = entity:getElementType(skillEntity)
|
local maskElementType = entity:getElementType(skillEntity)
|
||||||
self.battleUI:showBoardMask(maskElementType)
|
self.battleUI:showBoardMask(maskElementType)
|
||||||
self:findSkillInfluenceGrids()
|
self:findSkillInfluenceGrids()
|
||||||
self:onLinkChange()
|
self:onLinkChange()
|
||||||
elseif eventType == ELIMINATION_TOUCH_EVENT.ENTER then
|
elseif eventType == ELIMINATION_TOUCH_EVENT.ENTER then
|
||||||
local sequence = DataManager.BattleData:getGridSequence()
|
local sequence = self.battleData:getGridSequence()
|
||||||
local info = sequence[#sequence]
|
local info = sequence[#sequence]
|
||||||
local lastPosId = info and info.posId
|
local lastPosId = info and info.posId
|
||||||
if not lastPosId then
|
if not lastPosId then
|
||||||
@ -175,25 +186,25 @@ function BattleController:onTouchEvent(eventType, posId)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if DataManager.BattleData:alreadyInsertSequence(posId) then
|
if self.battleData:alreadyInsertSequence(posId) then
|
||||||
local info = sequence[#sequence - 1]
|
local info = sequence[#sequence - 1]
|
||||||
local beforePosId = info and info.posId
|
local beforePosId = info and info.posId
|
||||||
if not beforePosId then
|
if not beforePosId then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if beforePosId == posId then -- 进入的是倒数第二个,则移除倒数第一个
|
if beforePosId == posId then -- 进入的是倒数第二个,则移除倒数第一个
|
||||||
local snapshot = DataManager.BattleData:removeGridSequence(lastPosId)
|
local snapshot = self.battleData:removeGridSequence(lastPosId)
|
||||||
if snapshot then -- 如果有快照,则恢复一次
|
if snapshot then -- 如果有快照,则恢复一次
|
||||||
for posId, info in pairs(snapshot) do
|
for posId, info in pairs(snapshot) do
|
||||||
local entity = DataManager.BattleData:getGridEntity(posId)
|
local entity = self.battleData:getGridEntity(posId)
|
||||||
if entity then
|
if entity then
|
||||||
entity:setInfoBySnapshop(info)
|
entity:setInfoBySnapshop(info)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local lastEntity = DataManager.BattleData:getGridEntity(beforePosId)
|
local lastEntity = self.battleData:getGridEntity(beforePosId)
|
||||||
local lastSkillEntity = DataManager.BattleData:getSkillEntityBySkillId(lastEntity:getSkillId())
|
local lastSkillEntity = self.battleData:getSkillEntityBySkillId(lastEntity:getSkillId())
|
||||||
local maskElementType = lastEntity:getElementType(lastSkillEntity)
|
local maskElementType = lastEntity:getElementType(lastSkillEntity)
|
||||||
self.battleUI:showBoardMask(maskElementType)
|
self.battleUI:showBoardMask(maskElementType)
|
||||||
|
|
||||||
@ -204,15 +215,15 @@ function BattleController:onTouchEvent(eventType, posId)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local skillId = entity:getSkillId()
|
local skillId = entity:getSkillId()
|
||||||
local skillEntity = DataManager.BattleData:getSkillEntityBySkillId(skillId)
|
local skillEntity = self.battleData:getSkillEntityBySkillId(skillId)
|
||||||
local elementType = entity:getElementType(skillEntity)
|
local elementType = entity:getElementType(skillEntity)
|
||||||
|
|
||||||
local lastEntity = DataManager.BattleData:getGridEntity(lastPosId)
|
local lastEntity = self.battleData:getGridEntity(lastPosId)
|
||||||
local lastSkillId = lastEntity:getSkillId()
|
local lastSkillId = lastEntity:getSkillId()
|
||||||
local lastSkillEntity = DataManager.BattleData:getSkillEntityBySkillId(lastSkillId)
|
local lastSkillEntity = self.battleData:getSkillEntityBySkillId(lastSkillId)
|
||||||
local lastElementType = lastEntity:getElementType(lastSkillEntity)
|
local lastElementType = lastEntity:getElementType(lastSkillEntity)
|
||||||
|
|
||||||
if skillEntity and DataManager.BattleData:getSequenceHadSkill() then
|
if skillEntity and self.battleData:getSequenceHadSkill() then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -226,7 +237,7 @@ function BattleController:onTouchEvent(eventType, posId)
|
|||||||
local maskElementType = elementType or lastElementType
|
local maskElementType = elementType or lastElementType
|
||||||
self.battleUI:showBoardMask(maskElementType)
|
self.battleUI:showBoardMask(maskElementType)
|
||||||
|
|
||||||
DataManager.BattleData:insertGridSequence(posId, self:snapshotBoard())
|
self.battleData:insertGridSequence(posId, self:snapshotBoard())
|
||||||
if lastEntity:getNeedChangePos() and not entity:getNeedChangePos() then -- 需要移动到队列末尾
|
if lastEntity:getNeedChangePos() and not entity:getNeedChangePos() then -- 需要移动到队列末尾
|
||||||
local lastSkillId = lastEntity:getSkillId()
|
local lastSkillId = lastEntity:getSkillId()
|
||||||
local skillId = entity:getSkillId()
|
local skillId = entity:getSkillId()
|
||||||
@ -248,26 +259,26 @@ function BattleController:onTouchEvent(eventType, posId)
|
|||||||
|
|
||||||
else -- 取消和抬起
|
else -- 取消和抬起
|
||||||
self.battleUI:showBoardMask(nil)
|
self.battleUI:showBoardMask(nil)
|
||||||
local sequence = DataManager.BattleData:getGridSequence()
|
local sequence = self.battleData:getGridSequence()
|
||||||
local count = #sequence
|
local count = #sequence
|
||||||
if count < BattleConst.ELIMINATION_MIN_COUNT then
|
if count < BattleConst.ELIMINATION_MIN_COUNT then
|
||||||
if count <= 0 then
|
if count <= 0 then
|
||||||
DataManager.BattleData:clearGridSequence()
|
self.battleData:clearGridSequence()
|
||||||
self:onLinkChange()
|
self:onLinkChange()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local snapshot = DataManager.BattleData:removeGridSequence(sequence[1].posId)
|
local snapshot = self.battleData:removeGridSequence(sequence[1].posId)
|
||||||
if snapshot then -- 如果有快照,则恢复一次
|
if snapshot then -- 如果有快照,则恢复一次
|
||||||
for posId, info in pairs(snapshot) do
|
for posId, info in pairs(snapshot) do
|
||||||
local entity = DataManager.BattleData:getGridEntity(posId)
|
local entity = self.battleData:getGridEntity(posId)
|
||||||
if entity then
|
if entity then
|
||||||
entity:setInfoBySnapshop(info)
|
entity:setInfoBySnapshop(info)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
DataManager.BattleData:clearGridSequence()
|
self.battleData:clearGridSequence()
|
||||||
self:onLinkChange()
|
self:onLinkChange()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -277,18 +288,18 @@ function BattleController:onTouchEvent(eventType, posId)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function BattleController:onLinkOver()
|
function BattleController:onLinkOver()
|
||||||
local sequence = DataManager.BattleData:getGridSequence()
|
local sequence = self.battleData:getGridSequence()
|
||||||
local count = #sequence
|
local count = #sequence
|
||||||
if count < BattleConst.ELIMINATION_MIN_COUNT then
|
if count < BattleConst.ELIMINATION_MIN_COUNT then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local skillId = DataManager.BattleData:getSequenceHadSkill()
|
local skillId = self.battleData:getSequenceHadSkill()
|
||||||
local skillEntity
|
local skillEntity
|
||||||
local linkElementType
|
local linkElementType
|
||||||
local influenceElementType
|
local influenceElementType
|
||||||
if skillId then
|
if skillId then
|
||||||
skillEntity = DataManager.BattleData:getSkillEntityBySkillId(skillId)
|
skillEntity = self.battleData:getSkillEntityBySkillId(skillId)
|
||||||
end
|
end
|
||||||
|
|
||||||
local elementTypeMap = {}
|
local elementTypeMap = {}
|
||||||
@ -297,7 +308,7 @@ function BattleController:onLinkOver()
|
|||||||
|
|
||||||
for _, info in ipairs(sequence) do
|
for _, info in ipairs(sequence) do
|
||||||
if not eliminationPosIds[info.posId] then
|
if not eliminationPosIds[info.posId] then
|
||||||
local entity = DataManager.BattleData:getGridEntity(info.posId)
|
local entity = self.battleData:getGridEntity(info.posId)
|
||||||
if not entity:getSkillId() then
|
if not entity:getSkillId() then
|
||||||
local elementType = entity:getElementType()
|
local elementType = entity:getElementType()
|
||||||
elementTypeMap[elementType] = (elementTypeMap[elementType] or 0) + 1
|
elementTypeMap[elementType] = (elementTypeMap[elementType] or 0) + 1
|
||||||
@ -309,14 +320,14 @@ function BattleController:onLinkOver()
|
|||||||
boomGridIds[aroundPosId] = true
|
boomGridIds[aroundPosId] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
local entity = DataManager.BattleData:getGridEntity(info.posId)
|
local entity = self.battleData:getGridEntity(info.posId)
|
||||||
entity:setIsIdle(true)
|
entity:setIsIdle(true)
|
||||||
eliminationPosIds[info.posId] = true
|
eliminationPosIds[info.posId] = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
for posId, _ in pairs(DataManager.BattleData:getSkillInfluenceGrids()) do
|
for posId, _ in pairs(self.battleData:getSkillInfluenceGrids()) do
|
||||||
local entity = DataManager.BattleData:getGridEntity(posId)
|
local entity = self.battleData:getGridEntity(posId)
|
||||||
if not entity:getIsIdle() then
|
if not entity:getIsIdle() then
|
||||||
if entity:isEmptyIdle() then
|
if entity:isEmptyIdle() then
|
||||||
entity:setIsIdle(true)
|
entity:setIsIdle(true)
|
||||||
@ -340,7 +351,7 @@ function BattleController:onLinkOver()
|
|||||||
|
|
||||||
for posId, status in pairs(boomGridIds) do
|
for posId, status in pairs(boomGridIds) do
|
||||||
if not eliminationPosIds[posId] then
|
if not eliminationPosIds[posId] then
|
||||||
local entity = DataManager.BattleData:getGridEntity(posId)
|
local entity = self.battleData:getGridEntity(posId)
|
||||||
if entity then
|
if entity then
|
||||||
local elementTypeInvalid = entity:isElmentTypeInvalid()
|
local elementTypeInvalid = entity:isElmentTypeInvalid()
|
||||||
entity:addAroundEliminationCount()
|
entity:addAroundEliminationCount()
|
||||||
@ -356,8 +367,8 @@ function BattleController:onLinkOver()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
DataManager.BattleData:addSkillEnergy(elementTypeMap)
|
self.battleData:addSkillEnergy(elementTypeMap)
|
||||||
DataManager.BattleData:clearGridSequence()
|
self.battleData:clearGridSequence()
|
||||||
|
|
||||||
self.battleUI:disableUITouch()
|
self.battleUI:disableUITouch()
|
||||||
self.battleUI:eliminationAni(sequence, function()
|
self.battleUI:eliminationAni(sequence, function()
|
||||||
@ -376,7 +387,7 @@ function BattleController:fillBoard()
|
|||||||
for c = 1, BattleConst.COLUMN_COUNT do
|
for c = 1, BattleConst.COLUMN_COUNT do
|
||||||
for r = BattleConst.ROW_COUNT, 1, -1 do
|
for r = BattleConst.ROW_COUNT, 1, -1 do
|
||||||
local posId = ModuleManager.BattleManager:getPosId(r, c)
|
local posId = ModuleManager.BattleManager:getPosId(r, c)
|
||||||
local entity = DataManager.BattleData:getGridEntity(posId)
|
local entity = self.battleData:getGridEntity(posId)
|
||||||
if entity:getIsIdle() then
|
if entity:getIsIdle() then
|
||||||
self:fillThisPos(posId, columnCount, gridMap)
|
self:fillThisPos(posId, columnCount, gridMap)
|
||||||
end
|
end
|
||||||
@ -390,7 +401,7 @@ function BattleController:fillBoard()
|
|||||||
if list and list[1] then -- 此列有需要填充的元素
|
if list and list[1] then -- 此列有需要填充的元素
|
||||||
local entity = table.remove(list, 1)
|
local entity = table.remove(list, 1)
|
||||||
if entity then
|
if entity then
|
||||||
DataManager.BattleData:setGridInfo(entity:getPosId(), self:getRandomGridInfo())
|
self.battleData:setGridInfo(entity:getPosId(), self:getRandomGridInfo())
|
||||||
end
|
end
|
||||||
find = true
|
find = true
|
||||||
end
|
end
|
||||||
@ -405,7 +416,7 @@ function BattleController:fillBoard()
|
|||||||
for c = 1, BattleConst.COLUMN_COUNT do
|
for c = 1, BattleConst.COLUMN_COUNT do
|
||||||
for r = BattleConst.ROW_COUNT, 1, -1 do
|
for r = BattleConst.ROW_COUNT, 1, -1 do
|
||||||
local posId = ModuleManager.BattleManager:getPosId(r, c)
|
local posId = ModuleManager.BattleManager:getPosId(r, c)
|
||||||
local entity = DataManager.BattleData:getGridEntity(posId)
|
local entity = self.battleData:getGridEntity(posId)
|
||||||
if #entity:getPath() > 0 then
|
if #entity:getPath() > 0 then
|
||||||
pathMap[posId] = entity:getPath()
|
pathMap[posId] = entity:getPath()
|
||||||
entity:clearPath()
|
entity:clearPath()
|
||||||
@ -506,9 +517,25 @@ function BattleController:exeInstructions(instructions, callback)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleController:generateBoard()
|
||||||
|
local boardList, _ = self:getInitBoard()
|
||||||
|
if self.curBoardIndex and self.curBoardIndex >= #boardList then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if not self.battleUI then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
self.curBoardIndex = (self.curBoardIndex or 0) + 1
|
||||||
|
local board = boardList[self.curBoardIndex]
|
||||||
|
self.battleData:refreshBoard(board)
|
||||||
|
self.battleUI:initGridCell()
|
||||||
|
end
|
||||||
|
|
||||||
function BattleController:generateSkill()
|
function BattleController:generateSkill()
|
||||||
local map = {}
|
local map = {}
|
||||||
for _, skillEntity in pairs(DataManager.BattleData:getSkillEntities()) do
|
for _, skillEntity in pairs(self.battleData:getSkillEntities()) do
|
||||||
if skillEntity:getEnergyEnough() then
|
if skillEntity:getEnergyEnough() then
|
||||||
map[skillEntity:getPosition()] = skillEntity:getSkillId()
|
map[skillEntity:getPosition()] = skillEntity:getSkillId()
|
||||||
end
|
end
|
||||||
@ -517,7 +544,7 @@ function BattleController:generateSkill()
|
|||||||
for elementType, skillId in pairs(map) do
|
for elementType, skillId in pairs(map) do
|
||||||
local list = self:getSkillElementList(elementType, 1, true)
|
local list = self:getSkillElementList(elementType, 1, true)
|
||||||
for _, posId in ipairs(list) do
|
for _, posId in ipairs(list) do
|
||||||
local entity = DataManager.BattleData:getGridEntity(posId)
|
local entity = self.battleData:getGridEntity(posId)
|
||||||
if entity then
|
if entity then
|
||||||
entity:setSkilId(skillId)
|
entity:setSkilId(skillId)
|
||||||
if entity:getElementType() ~= elementType then
|
if entity:getElementType() ~= elementType then
|
||||||
@ -535,7 +562,7 @@ function BattleController:generateGridType(gridType)
|
|||||||
|
|
||||||
local list = {}
|
local list = {}
|
||||||
local count = 0
|
local count = 0
|
||||||
for posId, entity in pairs(DataManager.BattleData:getGridEnties()) do
|
for posId, entity in pairs(self.battleData:getGridEnties()) do
|
||||||
if entity:isEmptyIdle() then
|
if entity:isEmptyIdle() then
|
||||||
table.insert(list, entity)
|
table.insert(list, entity)
|
||||||
count = count + 1
|
count = count + 1
|
||||||
@ -543,13 +570,13 @@ function BattleController:generateGridType(gridType)
|
|||||||
end
|
end
|
||||||
if count > 0 then
|
if count > 0 then
|
||||||
local entity = list[math.random(1, count)]
|
local entity = list[math.random(1, count)]
|
||||||
DataManager.BattleData:setGridInfo(entity:getPosId(), {gridType = gridType, elementType = entity:getElementType()})
|
self.battleData:setGridInfo(entity:getPosId(), {gridType = gridType, elementType = entity:getElementType()})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleController:getSkillElementList(elementType, count, useAlternate)
|
function BattleController:getSkillElementList(elementType, count, useAlternate)
|
||||||
local result = {}
|
local result = {}
|
||||||
local gridEntities = DataManager.BattleData:getGridEnties()
|
local gridEntities = self.battleData:getGridEnties()
|
||||||
if not gridEntities then
|
if not gridEntities then
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
@ -610,7 +637,7 @@ end
|
|||||||
|
|
||||||
---- 从一个点直接遍历所有相关的路径
|
---- 从一个点直接遍历所有相关的路径
|
||||||
function BattleController:fillThisPos(posId, columnCount, gridMap)
|
function BattleController:fillThisPos(posId, columnCount, gridMap)
|
||||||
local entity = DataManager.BattleData:getGridEntity(posId)
|
local entity = self.battleData:getGridEntity(posId)
|
||||||
if not entity or not entity:getIsIdle() then
|
if not entity or not entity:getIsIdle() then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -625,7 +652,7 @@ function BattleController:fillThisPos(posId, columnCount, gridMap)
|
|||||||
columnCount[c] = columnCount[c] + 1
|
columnCount[c] = columnCount[c] + 1
|
||||||
|
|
||||||
local fallPosId = posId
|
local fallPosId = posId
|
||||||
local fallEntity = DataManager.BattleData:getGridEntity(fallPosId)
|
local fallEntity = self.battleData:getGridEntity(fallPosId)
|
||||||
if not fallEntity then -- 异常情况,理论上不可能不存在
|
if not fallEntity then -- 异常情况,理论上不可能不存在
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -640,14 +667,14 @@ function BattleController:fillThisPos(posId, columnCount, gridMap)
|
|||||||
local curPos = ModuleManager.BattleManager:getPosInfo(posId)
|
local curPos = ModuleManager.BattleManager:getPosInfo(posId)
|
||||||
fallEntity:addPath({x = curPos.x, y = curPos.y})
|
fallEntity:addPath({x = curPos.x, y = curPos.y})
|
||||||
|
|
||||||
DataManager.BattleData:exchangeGridEntities(posId, fallPosId)
|
self.battleData:exchangeGridEntities(posId, fallPosId)
|
||||||
if not gridMap[c] then
|
if not gridMap[c] then
|
||||||
gridMap[c] = {}
|
gridMap[c] = {}
|
||||||
end
|
end
|
||||||
table.insert(gridMap[c], fallEntity)
|
table.insert(gridMap[c], fallEntity)
|
||||||
else
|
else
|
||||||
for index, fallPosId in ipairs(list) do
|
for index, fallPosId in ipairs(list) do
|
||||||
local fallEntity = DataManager.BattleData:getGridEntity(fallPosId)
|
local fallEntity = self.battleData:getGridEntity(fallPosId)
|
||||||
if not fallEntity then -- 异常情况,理论上不可能不存在
|
if not fallEntity then -- 异常情况,理论上不可能不存在
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -656,7 +683,7 @@ function BattleController:fillThisPos(posId, columnCount, gridMap)
|
|||||||
if fallEntity:getIsIdle() then
|
if fallEntity:getIsIdle() then
|
||||||
self:fillThisPos(fallPosId, columnCount, gridMap)
|
self:fillThisPos(fallPosId, columnCount, gridMap)
|
||||||
end
|
end
|
||||||
fallEntity = DataManager.BattleData:getGridEntity(fallPosId)
|
fallEntity = self.battleData:getGridEntity(fallPosId)
|
||||||
if not fallEntity:getIsIdle() then
|
if not fallEntity:getIsIdle() then
|
||||||
if not fallEntity:getPath()[1] then
|
if not fallEntity:getPath()[1] then
|
||||||
local curPos = ModuleManager.BattleManager:getPosInfo(fallPosId)
|
local curPos = ModuleManager.BattleManager:getPosInfo(fallPosId)
|
||||||
@ -666,7 +693,7 @@ function BattleController:fillThisPos(posId, columnCount, gridMap)
|
|||||||
local curPos = ModuleManager.BattleManager:getPosInfo(posId)
|
local curPos = ModuleManager.BattleManager:getPosInfo(posId)
|
||||||
fallEntity:addPath({x = curPos.x, y = curPos.y})
|
fallEntity:addPath({x = curPos.x, y = curPos.y})
|
||||||
|
|
||||||
DataManager.BattleData:exchangeGridEntities(posId, fallPosId)
|
self.battleData:exchangeGridEntities(posId, fallPosId)
|
||||||
self:fillThisPos(fallPosId, columnCount, gridMap)
|
self:fillThisPos(fallPosId, columnCount, gridMap)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -677,19 +704,15 @@ function BattleController:fillThisPos(posId, columnCount, gridMap)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function BattleController:getRandomGridInfo()
|
function BattleController:getRandomGridInfo()
|
||||||
if not self.fixedRandomList then
|
local list, fixedRandomGrid = self:getInitBoard()
|
||||||
self.fixedRandomList = {}
|
local fixedRandomList = fixedRandomGrid[self.curBoardIndex]
|
||||||
for _, elementType in ipairs(self:getFixedRandomGrid()) do
|
|
||||||
table.insert(self.fixedRandomList, elementType)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local gridType = 0
|
local gridType = 0
|
||||||
local elementType
|
local elementType
|
||||||
if self.fixedRandomList[1] then
|
if fixedRandomList and fixedRandomList[1] then
|
||||||
elementType = table.remove(self.fixedRandomList, 1)
|
elementType = table.remove(fixedRandomList, 1)
|
||||||
else
|
else
|
||||||
local map = DataManager.BattleData:getElementTypeMap()
|
local map = self.battleData:getElementTypeMap()
|
||||||
local indexs = {}
|
local indexs = {}
|
||||||
local typeList = {}
|
local typeList = {}
|
||||||
for typeName, typeNum in pairs(BattleConst.ELEMENT_TYPE) do
|
for typeName, typeNum in pairs(BattleConst.ELEMENT_TYPE) do
|
||||||
@ -711,20 +734,28 @@ function BattleController:getRandomGridInfo()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function BattleController:findSkillInfluenceGrids()
|
function BattleController:findSkillInfluenceGrids()
|
||||||
local girds = DataManager.BattleData:clearSkillInfluenceGrids()
|
local girds = self.battleData:clearSkillInfluenceGrids()
|
||||||
for posId, _ in pairs(girds) do
|
for posId, _ in pairs(girds) do
|
||||||
local entity = DataManager.BattleData:getGridEntity(posId)
|
local entity = self.battleData:getGridEntity(posId)
|
||||||
entity:setNeedElimination(false)
|
if entity:getCell() then
|
||||||
|
entity:getCell():showCircle(false)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local sequence = DataManager.BattleData:getGridSequence()
|
local sequence = self.battleData:getGridSequence()
|
||||||
|
local sequenceEntities = {}
|
||||||
for _, info in ipairs(sequence) do
|
for _, info in ipairs(sequence) do
|
||||||
local entity = DataManager.BattleData:getGridEntity(info.posId)
|
local entity = self.battleData:getGridEntity(info.posId)
|
||||||
|
table.insert(sequenceEntities, entity)
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, info in ipairs(sequence) do
|
||||||
|
local entity = self.battleData:getGridEntity(info.posId)
|
||||||
local skillId = entity:getSkillId()
|
local skillId = entity:getSkillId()
|
||||||
if skillId then
|
if skillId then
|
||||||
local skillEntity = DataManager.BattleData:getSkillEntityBySkillId(skillId)
|
local skillEntity = self.battleData:getSkillEntityBySkillId(skillId)
|
||||||
if skillEntity then
|
if skillEntity then
|
||||||
BATTLE_BOARD_SKILL_HANDLE.activeBoardSkill(info.posId, skillEntity, DataManager.BattleData:getGridEnties())
|
BATTLE_BOARD_SKILL_HANDLE.activeBoardSkill(info.posId, skillEntity, self.battleData:getGridEnties(), sequenceEntities)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -734,7 +765,7 @@ function BattleController:getRandomSkillList(getCount)
|
|||||||
getCount = getCount or BattleConst.SKILL_SELECT_COUNT
|
getCount = getCount or BattleConst.SKILL_SELECT_COUNT
|
||||||
local result = {}
|
local result = {}
|
||||||
local cfg = ConfigManager:getConfig("skill_rogue")
|
local cfg = ConfigManager:getConfig("skill_rogue")
|
||||||
local skillPool = DataManager.BattleData:getSkillPool()
|
local skillPool = self.battleData:getSkillPool()
|
||||||
local map = {}
|
local map = {}
|
||||||
|
|
||||||
local count = 0
|
local count = 0
|
||||||
@ -742,7 +773,7 @@ function BattleController:getRandomSkillList(getCount)
|
|||||||
local skillWeight = {}
|
local skillWeight = {}
|
||||||
for _, skillId in ipairs(skillPool) do
|
for _, skillId in ipairs(skillPool) do
|
||||||
local skillCfg = cfg[skillId]
|
local skillCfg = cfg[skillId]
|
||||||
if skillCfg and not skillCfg.limit_times or DataManager.BattleData:getSkillCount(skillId) < skillCfg.limit_times then
|
if skillCfg and not skillCfg.limit_times or self.battleData:getSkillCount(skillId) < skillCfg.limit_times then
|
||||||
if not map[skillId] then
|
if not map[skillId] then
|
||||||
table.insert(newSkillPool, skillId)
|
table.insert(newSkillPool, skillId)
|
||||||
table.insert(skillWeight, skillCfg.weight)
|
table.insert(skillWeight, skillCfg.weight)
|
||||||
@ -762,12 +793,14 @@ function BattleController:getRandomSkillList(getCount)
|
|||||||
end
|
end
|
||||||
|
|
||||||
for skillId, info in ipairs(cfg) do
|
for skillId, info in ipairs(cfg) do
|
||||||
if info.universal then
|
if not self:getNotInvolvedSkills()[skillId] then
|
||||||
if not info.limit_times or DataManager.BattleData:getSkillCount(skillId) < info.limit_times then
|
if info.universal then
|
||||||
if not map[skillId] then
|
if not info.limit_times or self.battleData:getSkillCount(skillId) < info.limit_times then
|
||||||
table.insert(newSkillPool, skillId)
|
if not map[skillId] then
|
||||||
table.insert(skillWeight, info.weight)
|
table.insert(newSkillPool, skillId)
|
||||||
count = count + 1
|
table.insert(skillWeight, info.weight)
|
||||||
|
count = count + 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -786,13 +819,13 @@ function BattleController:getRandomSkillList(getCount)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function BattleController:onSelectSkill(skillId)
|
function BattleController:onSelectSkill(skillId)
|
||||||
DataManager.BattleData:addSkillCount(skillId)
|
self.battleData:addSkillCount(skillId)
|
||||||
BATTLE_ROGUE_SKILL_HANDLE.takeEffect(skillId, DataManager.BattleData, self)
|
BATTLE_ROGUE_SKILL_HANDLE.takeEffect(skillId, self.battleData, self)
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleController:changeElementType(count, elementType)
|
function BattleController:changeElementType(count, elementType)
|
||||||
local list = {}
|
local list = {}
|
||||||
for _, entity in pairs(DataManager.BattleData:getGridEnties()) do
|
for _, entity in pairs(self.battleData:getGridEnties()) do
|
||||||
if entity:canChangeInfo() and entity:getElementType() ~= elementType then
|
if entity:canChangeInfo() and entity:getElementType() ~= elementType then
|
||||||
table.insert(list, entity)
|
table.insert(list, entity)
|
||||||
end
|
end
|
||||||
@ -849,7 +882,7 @@ end
|
|||||||
---- 快照一次棋盘
|
---- 快照一次棋盘
|
||||||
function BattleController:snapshotBoard()
|
function BattleController:snapshotBoard()
|
||||||
local snapshot = {}
|
local snapshot = {}
|
||||||
for _, entity in pairs(DataManager.BattleData:getGridEnties()) do
|
for _, entity in pairs(self.battleData:getGridEnties()) do
|
||||||
snapshot[entity:getPosId()] = entity:getSnapshoptInfo()
|
snapshot[entity:getPosId()] = entity:getSnapshoptInfo()
|
||||||
end
|
end
|
||||||
return snapshot
|
return snapshot
|
||||||
|
|||||||
@ -1,20 +1,32 @@
|
|||||||
local BattleController = require "app/module/battle/controller/battle_controller"
|
local BattleController = require "app/module/battle/controller/battle_controller"
|
||||||
local BattleControllerStage = class("BattleControllerStage", BattleController)
|
local BattleControllerStage = class("BattleControllerStage", BattleController)
|
||||||
|
|
||||||
function BattleControllerStage:getInitBoard()
|
function BattleController:getChapterId()
|
||||||
local config = ConfigManager:getConfig("chapter")[1]
|
return 1 -- 临时
|
||||||
return config.board
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleControllerStage:getFixedRandomGrid()
|
function BattleControllerStage:getInitBoard()
|
||||||
local config = ConfigManager:getConfig("chapter")[1]
|
if not self.boradList then
|
||||||
return config.control_element
|
self.boradList = {}
|
||||||
|
self.fixedRandomGrid = {}
|
||||||
|
local config = ConfigManager:getConfig("chapter")[self.chapterId]
|
||||||
|
local boardCfg = ConfigManager:getConfig("chapter_board")
|
||||||
|
for _, boardId in ipairs(config.board) do
|
||||||
|
local cfg = boardCfg[boardId]
|
||||||
|
if cfg then
|
||||||
|
table.insert(self.boradList, GFunc.getTable(cfg.board))
|
||||||
|
table.insert(self.fixedRandomGrid, GFunc.getTable(cfg.control_element))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return self.boradList, self.fixedRandomGrid
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleControllerStage:getSealElementType()
|
function BattleControllerStage:getSealElementType()
|
||||||
if not self.sealElementType then
|
if not self.sealElementType then
|
||||||
self.sealElementType = {}
|
self.sealElementType = {}
|
||||||
local config = ConfigManager:getConfig("chapter")[1]
|
local config = ConfigManager:getConfig("chapter")[self.chapterId]
|
||||||
if config.seal_element then
|
if config.seal_element then
|
||||||
for _, elementType in ipairs(config.seal_element) do
|
for _, elementType in ipairs(config.seal_element) do
|
||||||
self.sealElementType[elementType] = true
|
self.sealElementType[elementType] = true
|
||||||
@ -25,4 +37,18 @@ function BattleControllerStage:getSealElementType()
|
|||||||
return self.sealElementType
|
return self.sealElementType
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleControllerStage:getNotInvolvedSkills()
|
||||||
|
if not self.notInvolvedSkills then
|
||||||
|
self.notInvolvedSkills = {}
|
||||||
|
local config = ConfigManager:getConfig("chapter")[self.chapterId]
|
||||||
|
if config.not_involved_skill then
|
||||||
|
for _, skillId in ipairs(config.not_involved_skill) do
|
||||||
|
self.notInvolvedSkills[skillId] = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return self.notInvolvedSkills
|
||||||
|
end
|
||||||
|
|
||||||
return BattleControllerStage
|
return BattleControllerStage
|
||||||
@ -5,7 +5,7 @@ local BattleBoardSkillHandle = {}
|
|||||||
local SKILL_TYPE = BattleConst.SKILL_TYPE
|
local SKILL_TYPE = BattleConst.SKILL_TYPE
|
||||||
local SKILL_METHOD_TYPE = BattleConst.SKILL_METHOD_TYPE
|
local SKILL_METHOD_TYPE = BattleConst.SKILL_METHOD_TYPE
|
||||||
|
|
||||||
local function _takeElimination(posId, skillEntity, gridEntities)
|
local function _takeElimination(posId, skillEntity, gridEntities, sequenceEntities)
|
||||||
local boardrange = skillEntity:getBoardRange()
|
local boardrange = skillEntity:getBoardRange()
|
||||||
if boardrange then
|
if boardrange then
|
||||||
local cludePosIdsMap = {}
|
local cludePosIdsMap = {}
|
||||||
@ -14,16 +14,20 @@ local function _takeElimination(posId, skillEntity, gridEntities)
|
|||||||
cludePosIdsMap[posId] = true
|
cludePosIdsMap[posId] = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local ids = ModuleManager.BattleManager:getAroundPosIdsByList(posId, boardrange, cludePosIdsMap)
|
local randomExclusion = {}
|
||||||
|
for _, entity in ipairs(sequenceEntities) do
|
||||||
|
randomExclusion[entity:getPosId()] = true
|
||||||
|
end
|
||||||
|
local posIdInfos = ModuleManager.BattleManager:getAroundPosIdsByList(posId, boardrange, cludePosIdsMap, randomExclusion)
|
||||||
cludePosIdsMap = {}
|
cludePosIdsMap = {}
|
||||||
for _, posId in ipairs(ids) do
|
for _, info in ipairs(posIdInfos) do
|
||||||
cludePosIdsMap[posId] = true
|
cludePosIdsMap[info.posId] = info
|
||||||
end
|
end
|
||||||
DataManager.BattleData:cacheSkillInfluenceGrids(cludePosIdsMap)
|
DataManager.BattleData:cacheSkillInfluenceGrids(cludePosIdsMap)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function _takeChangeAround(posId, skillEntity, gridEntities)
|
local function _takeChangeAround(posId, skillEntity, gridEntities, sequenceEntities)
|
||||||
local boardrange = skillEntity:getBoardRange()
|
local boardrange = skillEntity:getBoardRange()
|
||||||
if boardrange then
|
if boardrange then
|
||||||
local cludePosIdsMap = {}
|
local cludePosIdsMap = {}
|
||||||
@ -32,9 +36,9 @@ local function _takeChangeAround(posId, skillEntity, gridEntities)
|
|||||||
cludePosIdsMap[posId] = true
|
cludePosIdsMap[posId] = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local ids = ModuleManager.BattleManager:getAroundPosIdsByList(posId, boardrange, cludePosIdsMap)
|
local posIdInfos = ModuleManager.BattleManager:getAroundPosIdsByList(posId, boardrange, cludePosIdsMap)
|
||||||
for _, posId in ipairs(ids) do
|
for _, info in ipairs(posIdInfos) do
|
||||||
local entity = gridEntities[posId]
|
local entity = gridEntities[info.posId]
|
||||||
if entity then
|
if entity then
|
||||||
entity:setElementType(skillEntity:getSkillTypeParameter())
|
entity:setElementType(skillEntity:getSkillTypeParameter())
|
||||||
end
|
end
|
||||||
@ -47,21 +51,14 @@ BattleBoardSkillHandle._activeBoardSkill = {
|
|||||||
[SKILL_TYPE.CHANGE_AROUND] = _takeChangeAround,
|
[SKILL_TYPE.CHANGE_AROUND] = _takeChangeAround,
|
||||||
}
|
}
|
||||||
|
|
||||||
function BattleBoardSkillHandle.activeBoardSkill(posId, skillEntity, gridEntities)
|
function BattleBoardSkillHandle.activeBoardSkill(posId, skillEntity, gridEntities, sequenceEntities)
|
||||||
if not skillEntity then
|
if not skillEntity then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if skillEntity:getMethond() == SKILL_METHOD_TYPE.ON_FINAL then
|
local func = BattleBoardSkillHandle._activeBoardSkill[skillEntity:getSkillType()]
|
||||||
local func = BattleBoardSkillHandle._activeBoardSkill[skillEntity:getSkillType()]
|
if func then
|
||||||
if func then
|
func(posId, skillEntity, gridEntities, sequenceEntities)
|
||||||
func(posId, skillEntity, gridEntities)
|
|
||||||
end
|
|
||||||
elseif skillEntity:getMethond() == SKILL_METHOD_TYPE.ON_ENTER then
|
|
||||||
local func = BattleBoardSkillHandle._activeBoardSkill[skillEntity:getSkillType()]
|
|
||||||
if func then
|
|
||||||
func(posId, skillEntity, gridEntities)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,8 @@ end
|
|||||||
function BattleUI:_display()
|
function BattleUI:_display()
|
||||||
local uiMap = self.root:genAllChildren()
|
local uiMap = self.root:genAllChildren()
|
||||||
self.boardMask2D = uiMap["battle_ui.bg_2.board_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_RECT_MASK_2D)
|
self.boardMask2D = uiMap["battle_ui.bg_2.board_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_RECT_MASK_2D)
|
||||||
self:initGridCell()
|
self.boardMask = uiMap["battle_ui.bg_2.board_mask"]
|
||||||
|
self.boardMask:setVisible(false)
|
||||||
self:initSkill()
|
self:initSkill()
|
||||||
self:initBattlefield()
|
self:initBattlefield()
|
||||||
end
|
end
|
||||||
@ -31,7 +32,16 @@ end
|
|||||||
function BattleUI:_addListeners()
|
function BattleUI:_addListeners()
|
||||||
local uiMap = self.root:genAllChildren()
|
local uiMap = self.root:genAllChildren()
|
||||||
uiMap["battle_ui.close_btn"]:addClickListener(function()
|
uiMap["battle_ui.close_btn"]:addClickListener(function()
|
||||||
ModuleManager.BattleManager:endBattleAndExit()
|
local params = {
|
||||||
|
content = I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_1),
|
||||||
|
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK_CANCEL,
|
||||||
|
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
|
||||||
|
cancelText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_CANCEL),
|
||||||
|
okFunc = function()
|
||||||
|
ModuleManager.BattleManager:endBattleAndExit()
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
GFunc.showMessageBox(params)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -171,6 +181,8 @@ function BattleUI:eliminationAni(sequence, callback)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
self.boardMask:setVisible(true)
|
||||||
|
self.boardMask:getTransform():SetAsLastSibling()
|
||||||
if self.eliminationAniSeq then
|
if self.eliminationAniSeq then
|
||||||
self.eliminationAniSeq:Kill()
|
self.eliminationAniSeq:Kill()
|
||||||
self.eliminationAniSeq = nil
|
self.eliminationAniSeq = nil
|
||||||
@ -216,6 +228,7 @@ function BattleUI:eliminationAni(sequence, callback)
|
|||||||
callback()
|
callback()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
self.boardMask:setVisible(false)
|
||||||
self:refreshSkill()
|
self:refreshSkill()
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -76,7 +76,7 @@ function MessageBox:showMessageBox(params)
|
|||||||
prefabObject._closeByAndroidBackspace = true
|
prefabObject._closeByAndroidBackspace = true
|
||||||
end
|
end
|
||||||
uiMap["message_box.title_bg_img.ok_btn"]:setVisible(true)
|
uiMap["message_box.title_bg_img.ok_btn"]:setVisible(true)
|
||||||
uiMap["message_box.title_bg_img.ok_btn"]:setAnchoredPositionX(139)
|
uiMap["message_box.title_bg_img.ok_btn"]:setAnchoredPositionX(-124)
|
||||||
uiMap["message_box.title_bg_img.cancel_btn"]:setVisible(true)
|
uiMap["message_box.title_bg_img.cancel_btn"]:setVisible(true)
|
||||||
uiMap["message_box.title_bg_img.cancel_btn"]:addClickListener(function()
|
uiMap["message_box.title_bg_img.cancel_btn"]:addClickListener(function()
|
||||||
self:closeAndClear(prefabObject, uiMap)
|
self:closeAndClear(prefabObject, uiMap)
|
||||||
|
|||||||
@ -10,11 +10,32 @@ local BATTLE_BOARD_SKILL_ENTITY = require "app/userdata/battle/skill/battle_bora
|
|||||||
local ATTR_TYPE = GConst.ATTR_TYPE
|
local ATTR_TYPE = GConst.ATTR_TYPE
|
||||||
local DEFAULT_FACTOR = BattleConst.DEFAULT_FACTOR
|
local DEFAULT_FACTOR = BattleConst.DEFAULT_FACTOR
|
||||||
|
|
||||||
function BattleData:init(board, skillIds, skillPool)
|
function BattleData:init(skillIds, skillPool)
|
||||||
self:clear()
|
self:clear()
|
||||||
self.atkTeam = self:initTeam(BattleConst.SIDE_ATK)
|
self.atkTeam = self:initTeam(BattleConst.SIDE_ATK)
|
||||||
self.defTeam = self:initTeam(BattleConst.SIDE_DEF)
|
self.defTeam = self:initTeam(BattleConst.SIDE_DEF)
|
||||||
|
|
||||||
|
--- todo
|
||||||
|
skillIds = {
|
||||||
|
10, 21, 30, 40, 50
|
||||||
|
}
|
||||||
|
for _, skillId in ipairs(skillIds) do
|
||||||
|
local cfg = SKILL_HERO_CFG[skillId]
|
||||||
|
self.skillMap[cfg.position] = BATTLE_BOARD_SKILL_ENTITY:create(skillId)
|
||||||
|
end
|
||||||
|
|
||||||
|
---- skillPool
|
||||||
|
self.skillPool = skillPool or {}
|
||||||
|
|
||||||
|
for id, info in pairs(ConfigManager:getConfig("skill_rogue")) do
|
||||||
|
if not info.universal then
|
||||||
|
table.insert(self.skillPool, id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function BattleData:refreshBoard(board)
|
||||||
|
self.elementTypeMap = {}
|
||||||
for i, info in ipairs(board) do
|
for i, info in ipairs(board) do
|
||||||
local r = 1
|
local r = 1
|
||||||
local c = 1
|
local c = 1
|
||||||
@ -34,29 +55,16 @@ function BattleData:init(board, skillIds, skillPool)
|
|||||||
gridType = info[1],
|
gridType = info[1],
|
||||||
elementType = info[2]
|
elementType = info[2]
|
||||||
}
|
}
|
||||||
self.gridEntities[data.posId] = BATTLE_GRID_ENTITY:create(data)
|
if self.gridEntities[data.posId] then
|
||||||
|
self.gridEntities[data.posId]:setGridType(data.gridType)
|
||||||
|
self.gridEntities[data.posId]:setElementType(data.elementType)
|
||||||
|
else
|
||||||
|
self.gridEntities[data.posId] = BATTLE_GRID_ENTITY:create(data)
|
||||||
|
end
|
||||||
if self.gridEntities[data.posId]:canLink() then
|
if self.gridEntities[data.posId]:canLink() then
|
||||||
self.elementTypeMap[data.elementType] = (self.elementTypeMap[data.elementType] or 0) + 1
|
self.elementTypeMap[data.elementType] = (self.elementTypeMap[data.elementType] or 0) + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- todo
|
|
||||||
skillIds = {
|
|
||||||
10, 21, 30, 40, 50
|
|
||||||
}
|
|
||||||
for _, skillId in ipairs(skillIds) do
|
|
||||||
local cfg = SKILL_HERO_CFG[skillId]
|
|
||||||
self.skillMap[cfg.position] = BATTLE_BOARD_SKILL_ENTITY:create(skillId)
|
|
||||||
end
|
|
||||||
|
|
||||||
---- skillPool
|
|
||||||
self.skillPool = skillPool or {}
|
|
||||||
|
|
||||||
for id, info in pairs(ConfigManager:getConfig("skill_rogue")) do
|
|
||||||
if not info.universal then
|
|
||||||
table.insert(self.skillPool, id)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleData:clear()
|
function BattleData:clear()
|
||||||
@ -121,8 +129,8 @@ function BattleData:cacheSkillInfluenceGrids(grids)
|
|||||||
if not self.skillInfluenceGrids then
|
if not self.skillInfluenceGrids then
|
||||||
self.skillInfluenceGrids = {}
|
self.skillInfluenceGrids = {}
|
||||||
end
|
end
|
||||||
for posId, status in pairs(grids) do
|
for posId, info in pairs(grids) do
|
||||||
self.skillInfluenceGrids[posId] = true
|
self.skillInfluenceGrids[posId] = info
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -185,11 +185,6 @@ function BattleGridEntity:isEmptyIdle()
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleGridEntity:setNeedElimination(need)
|
|
||||||
self.needElimination = need
|
|
||||||
self:setDirty()
|
|
||||||
end
|
|
||||||
|
|
||||||
function BattleGridEntity:getNeedElimination()
|
function BattleGridEntity:getNeedElimination()
|
||||||
return self.needElimination
|
return self.needElimination
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user