This commit is contained in:
chenxi 2023-04-12 21:14:10 +08:00
parent 31bdd83dae
commit 25d13668e6
18 changed files with 1916 additions and 194 deletions

View File

@ -68,46 +68,42 @@ function ConfigManager:reloadAllConfig()
end end
function ConfigManager:preLoadConfig() function ConfigManager:preLoadConfig()
-- local monsterBase = self:_getConfig("monster_base") local monsterBase = self:_getConfig("monster_base")
-- self:clearConfigCache("monster_base") self:clearConfigCache("monster_base")
-- local baseData = monsterBase.data local baseData = monsterBase.data
-- local monsterFullData = {} local monsterFullData = {}
-- local count = 0 local count = 0
-- local function handleMonsterGrow(name) local function handleMonsterGrow(name)
-- local monsterGrowConfig = self:_getConfig(name) local monsterGrowConfig = self:_getConfig(name)
-- local growData = monsterGrowConfig.data local growData = monsterGrowConfig.data
-- for k, v in pairs(growData) do for k, v in pairs(growData) do
-- monsterFullData[k] = v monsterFullData[k] = v
-- local data = baseData[v.monster_baseid] local data = baseData[v.monster_base]
-- if data then if data then
-- monsterFullData[k].collision_radius = data.collision_radius monsterFullData[k].model_id = data.model_id
-- monsterFullData[k].model_id = data.model_id -- else
-- monsterFullData[k].model_fight = data.model_fight -- Logger.logHighlight("not data monster_baseid = " .. v.monster_baseid)
-- monsterFullData[k].fx_fight = data.fx_fight end
-- monsterFullData[k].size = data.size count = count + 1
-- -- else end
-- -- Logger.logHighlight("not data monster_baseid = " .. v.monster_baseid) self:clearConfigCache(name)
-- end end
-- count = count + 1 handleMonsterGrow("monster_chapter")
-- end
-- self:clearConfigCache(name)
-- end
-- handleMonsterGrow("monster_stage")
-- self.configs["monster"] = { self.configs["monster"] = {
-- data = monsterFullData, data = monsterFullData,
-- count = count count = count
-- } }
-- if EDITOR_MODE then if EDITOR_MODE then
-- local realCount = 0 local realCount = 0
-- for k, v in pairs(monsterFullData) do for k, v in pairs(monsterFullData) do
-- realCount = realCount + 1 realCount = realCount + 1
-- end end
-- if count ~= realCount then if count ~= realCount then
-- Logger.logFatal("same id in monster config") Logger.logFatal("same id in monster config")
-- end end
-- end end
end end
function ConfigManager:getChapterConfig(id) function ConfigManager:getChapterConfig(id)

View File

@ -8,8 +8,7 @@ local buff = {
["icon"]="stun", ["icon"]="stun",
["fx_continued"]={ ["fx_continued"]={
4001 4001
}, }
["hit_show"]=1
}, },
[2]={ [2]={
["name"]="hit_stun", ["name"]="hit_stun",
@ -17,8 +16,7 @@ local buff = {
["decr"]=2, ["decr"]=2,
["is_percent"]=2, ["is_percent"]=2,
["v_buf"]="stun", ["v_buf"]="stun",
["change_name"]="stun", ["change_name"]="stun"
["hit_show"]=1
}, },
[3]={ [3]={
["name"]="hurt", ["name"]="hurt",
@ -33,10 +31,9 @@ local buff = {
["decr"]=1, ["decr"]=1,
["is_percent"]=2, ["is_percent"]=2,
["v_buf"]="shield", ["v_buf"]="shield",
["fx_get"]={ ["fx_continued"]={
2010 4001
}, }
["hit_show"]=1
}, },
[5]={ [5]={
["name"]="atkp_add", ["name"]="atkp_add",
@ -69,7 +66,10 @@ local buff = {
["name"]="spd_dec", ["name"]="spd_dec",
["buff_type"]=8, ["buff_type"]=8,
["is_percent"]=2, ["is_percent"]=2,
["v_buf"]="spd_dec" ["v_buf"]="spd_dec",
["fx_continued"]={
4001
}
}, },
[10]={ [10]={
["name"]="block", ["name"]="block",
@ -91,9 +91,8 @@ local buff = {
["decr"]=3, ["decr"]=3,
["is_percent"]=2, ["is_percent"]=2,
["v_buf"]="heal", ["v_buf"]="heal",
["formula"]=8, ["fx_take"]={
["fx_get"]={ 4001
2001
} }
}, },
[13]={ [13]={
@ -101,11 +100,49 @@ local buff = {
["buff_type"]=5, ["buff_type"]=5,
["decr"]=3, ["decr"]=3,
["is_percent"]=2, ["is_percent"]=2,
["v_buf"]="heal" ["v_buf"]="heal",
["fx_take"]={
4001
}
}, },
[14]={ [14]={
["name"]="block_hurt_dec", ["name"]="block_hurt_dec",
["buff_type"]=1 ["buff_type"]=1
},
[15]={
["name"]="hurt_red",
["buff_type"]=3,
["decr"]=3,
["is_percent"]=1,
["v_buf"]="hurt"
},
[16]={
["name"]="hurt_yellow",
["buff_type"]=3,
["decr"]=3,
["is_percent"]=1,
["v_buf"]="hurt"
},
[17]={
["name"]="hurt_green",
["buff_type"]=3,
["decr"]=3,
["is_percent"]=1,
["v_buf"]="hurt"
},
[18]={
["name"]="hurt_blue",
["buff_type"]=3,
["decr"]=3,
["is_percent"]=1,
["v_buf"]="hurt"
},
[19]={
["name"]="hurt_purple",
["buff_type"]=3,
["decr"]=3,
["is_percent"]=1,
["v_buf"]="hurt"
} }
} }
local keys = { local keys = {
@ -123,12 +160,17 @@ local keys = {
["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] ["block_hurt_dec"]=buff[14],
["hurt_red"]=buff[15],
["hurt_yellow"]=buff[16],
["hurt_green"]=buff[17],
["hurt_blue"]=buff[18],
["hurt_purple"]=buff[19]
} }
} }
local config = { local config = {
data=buff, data=buff,
keys=keys, keys=keys,
count=14 count=19
} }
return config return config

View File

@ -22,6 +22,13 @@ local chapter = {
43, 43,
44 44
}, },
["monster"]={
101,
201,
301,
401,
501
},
["wave_reward"]={ ["wave_reward"]={
{ {
["type"]=1, ["type"]=1,
@ -111,6 +118,18 @@ local chapter = {
43, 43,
44 44
}, },
["monster"]={
601,
701,
801,
901,
1001,
1101,
1201,
1301,
1401,
1501
},
["wave_reward"]={ ["wave_reward"]={
{ {
["type"]=1, ["type"]=1,
@ -202,6 +221,23 @@ local chapter = {
43, 43,
44 44
}, },
["monster"]={
1601,
1701,
1801,
1901,
2001,
2101,
2201,
2301,
2401,
2501,
2601,
2701,
2801,
2901,
3001
},
["wave_reward"]={ ["wave_reward"]={
{ {
["type"]=1, ["type"]=1,
@ -283,6 +319,28 @@ local chapter = {
9, 9,
10 10
}, },
["monster"]={
3101,
3201,
3301,
3401,
3501,
3601,
3701,
3801,
3901,
4001,
4101,
4201,
4301,
4401,
4501,
4601,
4701,
4801,
4901,
5001
},
["wave_reward"]={ ["wave_reward"]={
{ {
["type"]=1, ["type"]=1,
@ -365,6 +423,28 @@ local chapter = {
13, 13,
14 14
}, },
["monster"]={
5101,
5201,
5301,
5401,
5501,
5601,
5701,
5801,
5901,
6001,
6101,
6201,
6301,
6401,
6501,
6601,
6701,
6801,
6901,
7001
},
["wave_reward"]={ ["wave_reward"]={
{ {
["type"]=1, ["type"]=1,
@ -447,6 +527,28 @@ local chapter = {
17, 17,
18 18
}, },
["monster"]={
7101,
7201,
7301,
7401,
7501,
7601,
7701,
7801,
7901,
8001,
8101,
8201,
8301,
8401,
8501,
8601,
8701,
8801,
8901,
9001
},
["wave_reward"]={ ["wave_reward"]={
{ {
["type"]=1, ["type"]=1,
@ -529,6 +631,28 @@ local chapter = {
21, 21,
22 22
}, },
["monster"]={
9101,
9201,
9301,
9401,
9501,
9601,
9701,
9801,
9901,
10001,
10101,
10201,
10301,
10401,
10501,
10601,
10701,
10801,
10901,
11001
},
["wave_reward"]={ ["wave_reward"]={
{ {
["type"]=1, ["type"]=1,
@ -611,6 +735,28 @@ local chapter = {
25, 25,
26 26
}, },
["monster"]={
11101,
11201,
11301,
11401,
11501,
11601,
11701,
11801,
11901,
12001,
12101,
12201,
12301,
12401,
12501,
12601,
12701,
12801,
12901,
13001
},
["wave_reward"]={ ["wave_reward"]={
{ {
["type"]=1, ["type"]=1,
@ -693,6 +839,28 @@ local chapter = {
29, 29,
30 30
}, },
["monster"]={
13101,
13201,
13301,
13401,
13501,
13601,
13701,
13801,
13901,
14001,
14101,
14201,
14301,
14401,
14501,
14601,
14701,
14801,
14901,
15001
},
["wave_reward"]={ ["wave_reward"]={
{ {
["type"]=1, ["type"]=1,
@ -774,6 +942,28 @@ local chapter = {
33, 33,
34 34
}, },
["monster"]={
15101,
15201,
15301,
15401,
15501,
15601,
15701,
15801,
15901,
16001,
16101,
16201,
16301,
16401,
16501,
16601,
16701,
16801,
16901,
17001
},
["wave_reward"]={ ["wave_reward"]={
{ {
["type"]=1, ["type"]=1,

View File

@ -823,9 +823,6 @@ local chapter_board = {
1, 1,
0 0
} }
},
["control_element"]={
0
} }
}, },
[5]={ [5]={
@ -1652,9 +1649,6 @@ local chapter_board = {
1, 1,
0 0
} }
},
["control_element"]={
0
} }
}, },
[9]={ [9]={

View File

@ -2,6 +2,8 @@ local hero = {
[12001]={ [12001]={
["position"]=1, ["position"]=1,
["qlt"]=2, ["qlt"]=2,
["hurt_skill"]=1,
["hurt_num"]=3,
["base_skill"]=50, ["base_skill"]=50,
["rouge_skill_1"]=200501, ["rouge_skill_1"]=200501,
["rouge_skill_2"]=200502, ["rouge_skill_2"]=200502,
@ -42,6 +44,8 @@ local hero = {
[22001]={ [22001]={
["position"]=2, ["position"]=2,
["qlt"]=2, ["qlt"]=2,
["hurt_skill"]=2,
["hurt_num"]=3,
["base_skill"]=20, ["base_skill"]=20,
["rouge_skill_1"]=200201, ["rouge_skill_1"]=200201,
["rouge_skill_2"]=200202, ["rouge_skill_2"]=200202,
@ -82,6 +86,8 @@ local hero = {
[23001]={ [23001]={
["position"]=2, ["position"]=2,
["qlt"]=3, ["qlt"]=3,
["hurt_skill"]=2,
["hurt_num"]=3,
["base_skill"]=70, ["base_skill"]=70,
["rouge_skill_1"]=200701, ["rouge_skill_1"]=200701,
["rouge_skill_2"]=200702, ["rouge_skill_2"]=200702,
@ -122,6 +128,8 @@ local hero = {
[32001]={ [32001]={
["position"]=3, ["position"]=3,
["qlt"]=2, ["qlt"]=2,
["hurt_skill"]=3,
["hurt_num"]=3,
["base_skill"]=10, ["base_skill"]=10,
["rouge_skill_1"]=200101, ["rouge_skill_1"]=200101,
["rouge_skill_2"]=200102, ["rouge_skill_2"]=200102,
@ -162,6 +170,8 @@ local hero = {
[33001]={ [33001]={
["position"]=3, ["position"]=3,
["qlt"]=3, ["qlt"]=3,
["hurt_skill"]=3,
["hurt_num"]=3,
["base_skill"]=60, ["base_skill"]=60,
["rouge_skill_1"]=200601, ["rouge_skill_1"]=200601,
["rouge_skill_2"]=200602, ["rouge_skill_2"]=200602,
@ -202,6 +212,8 @@ local hero = {
[42001]={ [42001]={
["position"]=4, ["position"]=4,
["qlt"]=2, ["qlt"]=2,
["hurt_skill"]=4,
["hurt_num"]=3,
["base_skill"]=30, ["base_skill"]=30,
["rouge_skill_1"]=200301, ["rouge_skill_1"]=200301,
["rouge_skill_2"]=200302, ["rouge_skill_2"]=200302,
@ -242,6 +254,8 @@ local hero = {
[43001]={ [43001]={
["position"]=4, ["position"]=4,
["qlt"]=3, ["qlt"]=3,
["hurt_skill"]=4,
["hurt_num"]=3,
["base_skill"]=80, ["base_skill"]=80,
["rouge_skill_1"]=200801, ["rouge_skill_1"]=200801,
["rouge_skill_2"]=200802, ["rouge_skill_2"]=200802,
@ -282,6 +296,8 @@ local hero = {
[52001]={ [52001]={
["position"]=5, ["position"]=5,
["qlt"]=2, ["qlt"]=2,
["hurt_skill"]=5,
["hurt_num"]=3,
["base_skill"]=40, ["base_skill"]=40,
["rouge_skill_1"]=200401, ["rouge_skill_1"]=200401,
["rouge_skill_2"]=200402, ["rouge_skill_2"]=200402,

View File

@ -1,120 +1,96 @@
local monster_base = { local monster_base = {
[10001]={ [10001]={
["model_id"]="m10001" ["model_id"]="m0001"
}, },
[10002]={ [10002]={
["model_id"]="m10002" ["model_id"]="m0001"
}, },
[10003]={ [10003]={
["model_id"]="m10003" ["model_id"]="m0001"
}, },
[10004]={ [10004]={
["model_id"]="m10004" ["model_id"]="m0001"
}, },
[10005]={ [10005]={
["model_id"]="m10005" ["model_id"]="m0001"
}, },
[10006]={ [10006]={
["model_id"]="m10006" ["model_id"]="m0001"
}, },
[10007]={ [10007]={
["model_id"]="m10007" ["model_id"]="m0001"
}, },
[10008]={ [10008]={
["model_id"]="m10008" ["model_id"]="m0001"
}, },
[10009]={ [10009]={
["model_id"]="m10009" ["model_id"]="m0001"
}, },
[10010]={ [10010]={
["model_id"]="m10010" ["model_id"]="m0001"
}, },
[10011]={ [10011]={
["model_id"]="m10011" ["model_id"]="m0001"
}, },
[10012]={ [10012]={
["model_id"]="m10012" ["model_id"]="m0001"
}, },
[10013]={ [10013]={
["model_id"]="m10013" ["model_id"]="m0001"
}, },
[10014]={ [10014]={
["model_id"]="m10014" ["model_id"]="m0001"
}, },
[10015]={ [10015]={
["model_id"]="m10015" ["model_id"]="m0001"
}, },
[10016]={ [10016]={
["model_id"]="m10016" ["model_id"]="m0001"
}, },
[10017]={ [10017]={
["model_id"]="m10017" ["model_id"]="m0001"
}, },
[10018]={ [10018]={
["model_id"]="m10018" ["model_id"]="m0001"
},
[10019]={
["model_id"]="m10019"
},
[10020]={
["model_id"]="m10020"
},
[10021]={
["model_id"]="m10021"
},
[10022]={
["model_id"]="m10022"
}, },
[20001]={ [20001]={
["model_id"]="m20001" ["model_id"]="m0001"
}, },
[20002]={ [20002]={
["model_id"]="m20002" ["model_id"]="m0001"
}, },
[20003]={ [20003]={
["model_id"]="m20003" ["model_id"]="m0001"
}, },
[20004]={ [20004]={
["model_id"]="m20004" ["model_id"]="m0001"
}, },
[20005]={ [20005]={
["model_id"]="m20005" ["model_id"]="m0001"
}, },
[20006]={ [20006]={
["model_id"]="m20006" ["model_id"]="m0001"
}, },
[20007]={ [20007]={
["model_id"]="m20007" ["model_id"]="m0001"
}, },
[20008]={ [20008]={
["model_id"]="m20008" ["model_id"]="m0001"
}, },
[20009]={ [20009]={
["model_id"]="m20009" ["model_id"]="m0001"
}, },
[20010]={ [20010]={
["model_id"]="m20010" ["model_id"]="m0001"
}, },
[20011]={ [20011]={
["model_id"]="m20011" ["model_id"]="m0001"
}, },
[20012]={ [20012]={
["model_id"]="m20012" ["model_id"]="m0001"
},
[20013]={
["model_id"]="m20013"
},
[20014]={
["model_id"]="m20014"
},
[20015]={
["model_id"]="m20015"
},
[20016]={
["model_id"]="m20016"
} }
} }
local config = { local config = {
data=monster_base,count=38 data=monster_base,count=30
} }
return config return config

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,56 @@
local skill_hero = { local skill_hero = {
[1]={
["method"]=2,
["skill_type"]=0,
["effect"]={
{
["type"]="hurt_red",
["num"]=10000,
["ratio"]=10000,
["round"]=0
}
}
},
[2]={
["effect"]={
{
["type"]="hurt_yellow",
["num"]=10000,
["ratio"]=10000,
["round"]=0
}
}
},
[3]={
["effect"]={
{
["type"]="hurt_green",
["num"]=10000,
["ratio"]=10000,
["round"]=0
}
}
},
[4]={
["effect"]={
{
["type"]="hurt_blue",
["num"]=10000,
["ratio"]=10000,
["round"]=0
}
}
},
[5]={
["effect"]={
{
["type"]="hurt_purple",
["num"]=10000,
["ratio"]=10000,
["round"]=0
}
}
},
[10]={ [10]={
["energy"]=10, ["energy"]=10,
["position"]=3, ["position"]=3,
@ -22,6 +74,8 @@ local skill_hero = {
["position"]=2, ["position"]=2,
["method"]=2, ["method"]=2,
["skill_type"]=0, ["skill_type"]=0,
["icon"]=20,
["battle_icon"]=2,
["effect"]={ ["effect"]={
{ {
["type"]="hurt", ["type"]="hurt",
@ -30,9 +84,7 @@ local skill_hero = {
["round"]=0 ["round"]=0
} }
}, },
["obj"]=2, ["obj"]=2
["icon"]=20,
["battle_icon"]=2
}, },
[21]={ [21]={
["energy"]=10, ["energy"]=10,
@ -58,6 +110,8 @@ local skill_hero = {
["range"]=1 ["range"]=1
} }
}, },
["icon"]=20,
["battle_icon"]=2,
["effect"]={ ["effect"]={
{ {
["type"]="hurt", ["type"]="hurt",
@ -65,9 +119,7 @@ local skill_hero = {
["ratio"]=10000, ["ratio"]=10000,
["round"]=0 ["round"]=0
} }
}, }
["icon"]=20,
["battle_icon"]=2
}, },
[30]={ [30]={
["energy"]=10, ["energy"]=10,
@ -88,6 +140,8 @@ local skill_hero = {
["position"]=5, ["position"]=5,
["method"]=2, ["method"]=2,
["skill_type"]=0, ["skill_type"]=0,
["icon"]=40,
["battle_icon"]=4,
["effect"]={ ["effect"]={
{ {
["type"]="shield", ["type"]="shield",
@ -96,9 +150,7 @@ local skill_hero = {
["round"]=1 ["round"]=1
} }
}, },
["obj"]=1, ["obj"]=1
["icon"]=40,
["battle_icon"]=4
}, },
[50]={ [50]={
["energy"]=10, ["energy"]=10,
@ -123,6 +175,8 @@ local skill_hero = {
["position"]=3, ["position"]=3,
["method"]=2, ["method"]=2,
["skill_type"]=0, ["skill_type"]=0,
["icon"]=60,
["battle_icon"]=6,
["effect"]={ ["effect"]={
{ {
["type"]="heal", ["type"]="heal",
@ -131,15 +185,15 @@ local skill_hero = {
["round"]=1 ["round"]=1
} }
}, },
["obj"]=1, ["obj"]=1
["icon"]=60,
["battle_icon"]=6
}, },
[70]={ [70]={
["energy"]=10, ["energy"]=10,
["position"]=2, ["position"]=2,
["method"]=2, ["method"]=2,
["skill_type"]=0, ["skill_type"]=0,
["icon"]=70,
["battle_icon"]=7,
["effect"]={ ["effect"]={
{ {
["type"]="atkp_add_connect", ["type"]="atkp_add_connect",
@ -148,9 +202,7 @@ local skill_hero = {
["round"]=1 ["round"]=1
} }
}, },
["obj"]=1, ["obj"]=1
["icon"]=70,
["battle_icon"]=7
}, },
[71]={ [71]={
["energy"]=10, ["energy"]=10,
@ -176,6 +228,8 @@ local skill_hero = {
["range"]=1 ["range"]=1
} }
}, },
["icon"]=70,
["battle_icon"]=7,
["effect"]={ ["effect"]={
{ {
["type"]="atkp_add_connect", ["type"]="atkp_add_connect",
@ -184,9 +238,7 @@ local skill_hero = {
["round"]=1 ["round"]=1
} }
}, },
["obj"]=1, ["obj"]=1
["icon"]=70,
["battle_icon"]=7
}, },
[72]={ [72]={
["energy"]=10, ["energy"]=10,
@ -236,6 +288,8 @@ local skill_hero = {
["position"]=4, ["position"]=4,
["method"]=2, ["method"]=2,
["skill_type"]=0, ["skill_type"]=0,
["icon"]=80,
["battle_icon"]=8,
["effect"]={ ["effect"]={
{ {
["type"]="hurt", ["type"]="hurt",
@ -249,9 +303,7 @@ local skill_hero = {
["ratio"]=10000, ["ratio"]=10000,
["round"]=1 ["round"]=1
} }
}, }
["icon"]=80,
["battle_icon"]=8
}, },
[81]={ [81]={
["energy"]=10, ["energy"]=10,
@ -276,6 +328,8 @@ local skill_hero = {
["range"]=1 ["range"]=1
} }
}, },
["icon"]=80,
["battle_icon"]=8,
["effect"]={ ["effect"]={
{ {
["type"]="hurt", ["type"]="hurt",
@ -289,12 +343,20 @@ local skill_hero = {
["ratio"]=10000, ["ratio"]=10000,
["round"]=1 ["round"]=1
} }
}
}, },
["icon"]=80, [100001]={
["battle_icon"]=8 ["effect"]={
{
["type"]="hurt",
["num"]=10000,
["ratio"]=10000,
["round"]=0
}
}
} }
} }
local config = { local config = {
data=skill_hero,count=12 data=skill_hero,count=18
} }
return config return config

View File

@ -11,8 +11,6 @@ local localization_global =
["BTN_TEXT_CANCEL"] = "取消", ["BTN_TEXT_CANCEL"] = "取消",
["BTN_TEXT_OK"] = "确定", ["BTN_TEXT_OK"] = "确定",
["BATTLE_DESC_1"] = "是否退出战斗", ["BATTLE_DESC_1"] = "是否退出战斗",
["START_DESC"] = "开始",
} }
return localization_global return localization_global

View File

@ -0,0 +1,16 @@
local BattleConst = require "app/module/battle/battle_const"
local BattleUnitComp = require "app/module/battle/component/battle_unit_comp"
local BattleMonsterComp = class("BattleMonsterComp", BattleUnitComp)
local UNIT_STATE = BattleConst.UNIT_STATE
function BattleMonsterComp:init()
end
function BattleMonsterComp:initBase()
self.isDead = false
self.currState = UNIT_STATE.INIT
end
return BattleMonsterComp

View File

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

View File

@ -12,8 +12,12 @@ end
function BattleUnitComp:initPosition() function BattleUnitComp:initPosition()
if self.unitEntity:getSide() == SIDE_ATK then if self.unitEntity:getSide() == SIDE_ATK then
self.baseObject:setLocalPosition(-BattleConst.INIT_POS_X, 0, 0) self.baseObject:setLocalPosition(-BattleConst.INIT_POS_X, 0, 0)
self.body:setLocalScaleX(1)
self.direction = 1
else else
self.baseObject:setLocalPosition(BattleConst.INIT_POS_X, 0, 0) self.baseObject:setLocalPosition(BattleConst.INIT_POS_X, 0, 0)
self.body:setLocalScaleX(-1)
self.direction = -1
end end
end end
@ -31,6 +35,7 @@ function BattleUnitComp:initWithEntity(modelId, entity, battleController, target
self.unitEntity = entity self.unitEntity = entity
self.battleController = battleController self.battleController = battleController
self.target = target self.target = target
self.body = self.baseObject:getChildByName("body")
self:_initBase() self:_initBase()
self:initPosition() self:initPosition()
self:playBorn() self:playBorn()

View File

@ -43,6 +43,15 @@ function BattleController:loadOtherRes(callback)
return callback() return callback()
end end
-- 一共有多少波
function BattleController:getMaxWave()
return 1
end
function BattleController:initDefUnits(callback)
callback()
end
function BattleController:onLinkChange() function BattleController:onLinkChange()
for posId, entity in pairs(self.battleData:getGridEnties()) do for posId, entity in pairs(self.battleData:getGridEnties()) do
if entity:getCell() then if entity:getCell() then
@ -101,14 +110,19 @@ end
function BattleController:init(params) function BattleController:init(params)
params = params or {} params = params or {}
self.chapterId = self:getChapterId() self.chapterId = self:getChapterId()
self.waveIndex = 1
self.atkUnits = {}
self.defUnits = {}
self.instructions = {}
self.battleData:init() self.battleData:init()
BattleHelper:init() BattleHelper:init()
self:prepareFight() self:prepareFight()
self:battleStart()
end end
function BattleController:prepareFight() function BattleController:prepareFight()
local count = 0 local count = 0
local totalCount = 2 local totalCount = 3
local function onPreloadFinished() local function onPreloadFinished()
count = count + 1 count = count + 1
if count == totalCount then if count == totalCount then
@ -119,15 +133,14 @@ function BattleController:prepareFight()
self.battleUI = UIManager:showUI(self:getBattleUIPath()) self.battleUI = UIManager:showUI(self:getBattleUIPath())
self.battleUI:setController(self) self.battleUI:setController(self)
self.battleUI:addLoadUICompleteListener(function() self.battleUI:addLoadUICompleteListener(function()
self:initAllUnits(onPreloadFinished) self:initAtkUnits(onPreloadFinished)
self:initDefUnits(onPreloadFinished)
self:generateBoard() self:generateBoard()
end) end)
self:loadOtherRes(onPreloadFinished) self:loadOtherRes(onPreloadFinished)
end end
function BattleController:initAllUnits(callback) function BattleController:initAtkUnits(callback)
self.atkUnits = {}
self.defUnits = {}
local atkTeam = self.battleData:getAtkTeam() local atkTeam = self.battleData:getAtkTeam()
local count = 0 local count = 0
local totalCount = atkTeam:getMembersCount() local totalCount = atkTeam:getMembersCount()
@ -156,6 +169,10 @@ function BattleController:initAllUnits(callback)
end end
function BattleController:onLoadComplete() function BattleController:onLoadComplete()
self:battleStart()
end
function BattleController:battleStart()
end end
function BattleController:onTouchEvent(eventType, posId) function BattleController:onTouchEvent(eventType, posId)
@ -372,8 +389,8 @@ function BattleController:onLinkOver()
self.battleUI:disableUITouch() self.battleUI:disableUITouch()
self.battleUI:eliminationAni(sequence, function() self.battleUI:eliminationAni(sequence, function()
local instructions = self:generateInstructions(skillEntity, linkElementType, influenceElementType, elementTypeMap) self:generateInstructions(skillEntity, linkElementType, influenceElementType, elementTypeMap)
self:exeInstructions(instructions, function() self:exeInstructions(function()
self:fillBoard() self:fillBoard()
end) end)
end) end)
@ -442,14 +459,12 @@ function BattleController:onFillBoardOver()
end end
function BattleController:generateInstructions(skillEntity, elementType, influenceElementType, elementTypeMap) function BattleController:generateInstructions(skillEntity, elementType, influenceElementType, elementTypeMap)
local instructions = {}
---- 加buff ---- 加buff
if skillEntity then if skillEntity then
if skillEntity:getLinkAtkp() > 0 and elementType then if skillEntity:getLinkAtkp() > 0 and elementType then
local attrType = BattleConst.ELEMENT_TYPE_ATKP_NAME[elementType] local attrType = BattleConst.ELEMENT_TYPE_ATKP_NAME[elementType]
if attrType then if attrType then
table.insert(instructions, { table.insert(self.instructions, {
name = BattleConst.INSTRUCTION_NAME.ADD_CUR_ROUND_ATTR, name = BattleConst.INSTRUCTION_NAME.ADD_CUR_ROUND_ATTR,
attr = { attr = {
type = attrType, type = attrType,
@ -463,7 +478,7 @@ function BattleController:generateInstructions(skillEntity, elementType, influen
for elementType, _ in pairs(influenceElementType) do for elementType, _ in pairs(influenceElementType) do
local attrType = BattleConst.ELEMENT_TYPE_ATKP_NAME[elementType] local attrType = BattleConst.ELEMENT_TYPE_ATKP_NAME[elementType]
if attrType then if attrType then
table.insert(instructions, { table.insert(self.instructions, {
name = BattleConst.INSTRUCTION_NAME.ADD_CUR_ROUND_ATTR, name = BattleConst.INSTRUCTION_NAME.ADD_CUR_ROUND_ATTR,
attr = { attr = {
type = attrType, type = attrType,
@ -481,7 +496,7 @@ function BattleController:generateInstructions(skillEntity, elementType, influen
if element == elementType then if element == elementType then
elementTypeCount = count elementTypeCount = count
else else
table.insert(instructions, { table.insert(self.instructions, {
name = BattleConst.INSTRUCTION_NAME.ASSISTING, name = BattleConst.INSTRUCTION_NAME.ASSISTING,
count = count, count = count,
skillMatch = element, skillMatch = element,
@ -491,7 +506,7 @@ function BattleController:generateInstructions(skillEntity, elementType, influen
---- 普攻 ---- 普攻
if elementTypeCount > 0 then if elementTypeCount > 0 then
table.insert(instructions, { table.insert(self.instructions, {
name = BattleConst.INSTRUCTION_NAME.GENERAL_ATTACK, name = BattleConst.INSTRUCTION_NAME.GENERAL_ATTACK,
count = elementTypeCount count = elementTypeCount
}) })
@ -499,20 +514,25 @@ function BattleController:generateInstructions(skillEntity, elementType, influen
---- 技能 ---- 技能
if skillEntity then if skillEntity then
table.insert(instructions, { table.insert(self.instructions, {
name = BattleConst.INSTRUCTION_NAME.PLAY_SKILL, name = BattleConst.INSTRUCTION_NAME.PLAY_SKILL,
skillMatch = elementType skillMatch = elementType
}) })
end end
return instructions
end end
function BattleController:exeInstructions(instructions, callback) function BattleController:exeInstructions(callback)
Logger.logHighlight("--------exeInstructions----------") Logger.logHighlight("--------exeInstructions----------")
Logger.printTable(instructions) Logger.printTable(self.instructions)
-- todo if #self.instructions <= 0 then
if callback then callback()
return
end
local instruction = table.remove(self.instructions)
local func = BattleController._doInstruction[instruction.name]
if func then
func(self, instruction, callback)
else
callback() callback()
end end
end end
@ -896,4 +916,29 @@ function BattleController:endBattleAndExit()
ModuleManager.BattleManager:exitBattle() ModuleManager.BattleManager:exitBattle()
end end
local function _addCurRoundAttr(self, instruction, callback)
callback()
end
local function _assisting(self, instruction, callback)
callback()
end
local function _generalAttack(self, instruction, callback)
self.
callback()
end
local function _playSkill(self, instruction, callback)
callback()
end
BattleController._doInstruction = {
[BattleConst.INSTRUCTION_NAME.ADD_CUR_ROUND_ATTR] = _addCurRoundAttr,
[BattleConst.INSTRUCTION_NAME.ASSISTING] = _assisting,
[BattleConst.INSTRUCTION_NAME.GENERAL_ATTACK] = _generalAttack,
[BattleConst.INSTRUCTION_NAME.PLAY_SKILL] = _playSkill,
}
return BattleController return BattleController

View File

@ -1,10 +1,30 @@
local BattleHelper = require "app/module/battle/helper/battle_helper"
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 BattleController:getChapterId() function BattleControllerStage:getChapterId()
return DataManager.ChapterData:getChapterId() return DataManager.ChapterData:getChapterId()
end end
function BattleControllerStage:getMaxWave()
local chapterId = DataManager.ChapterData:getChapterId()
local chapterInfo = ConfigManager:getConfig("chapter")[chapterId]
return #chapterInfo.monster
end
function BattleControllerStage:initDefUnits(callback)
local config = ConfigManager:getConfig("chapter")[self.chapterId]
local unitEntity = DataManager.BattleData:addMonster(config.monster[1])
local modelId = unitEntity:getModelId()
BattleHelper:loadBattleHeroModel(modelId, self.battleUI:getBattleNode(), function(spineObject)
local monsterComp = spineObject:addLuaComponent(GConst.BattleConst.TYPEOF_LUA_COMP.BATTLE_MONSTER_COMPONENT)
monsterComp:initWithEntity(modelId, unitEntity, self)
self.defUnits[unitEntity:getMatchType()] = monsterComp
callback()
end)
end
function BattleControllerStage:getInitBoard() function BattleControllerStage:getInitBoard()
if not self.boradList then if not self.boradList then
self.boradList = {} self.boradList = {}

View File

@ -285,10 +285,9 @@ function BattleData:initHeroData()
local unitData = { local unitData = {
id = heroId, id = heroId,
modelId = heroEntity:getModelId(), modelId = heroEntity:getModelId(),
level = heroEntity:getLv(),
qlt = heroEntity:getQlt(),
matchType = matchType, matchType = matchType,
activeSkill = activeSkill, normalSkill = heroEntity:getHurtSkill(),
activeSkill = {activeSkill},
attr = { attr = {
hp = hp, hp = hp,
max_hp = hp, max_hp = hp,
@ -305,4 +304,22 @@ function BattleData:initHeroData()
return data return data
end end
function BattleData:addMonster(monsterId)
local monsterInfo = ConfigManager:getConfig("monster")[monsterId]
local hp = monsterInfo.hp // DEFAULT_FACTOR
local unitData = {
id = monsterId,
modelId = monsterInfo.model_id,
matchType = 1,
normalSkill = monsterInfo.hurt_skill,
activeSkills = monsterInfo.skill,
attr = {
hp = hp,
max_hp = hp,
atk = monsterInfo.atk // DEFAULT_FACTOR,
}
}
return self.defTeam:addUnit(unitData)
end
return BattleData return BattleData

View File

@ -35,6 +35,18 @@ function BattleTeamEntity:init(side, data)
end end
end end
function BattleTeamEntity:addUnit(unitData)
local unit = BattleUnitEntity:create()
unit:init(unitData, self.side, self)
self.members[unitData.matchType] = unit
self.membersCount = self.membersCount + 1
if self.mainHero == nil then
unit:setIsMainUnit(true)
self.mainHero = unit
end
return unit
end
function BattleTeamEntity:getAllMembers() function BattleTeamEntity:getAllMembers()
return self.members return self.members
end end

View File

@ -28,10 +28,15 @@ function BattleUnitEntity:initAttr()
end end
function BattleUnitEntity:initSkill() function BattleUnitEntity:initSkill()
self.skills = {} self.activeSkills = {}
if self.unitData.activeSkill then if self.unitData.normalSkill then
local skill = BattleSkillEntity:create(self.unitData.activeSkill, GConst.BattleConst.SKILL_TYPE_ACTIVE, self) self.normalSkill = BattleSkillEntity:create(self.unitData.normalSkill, GConst.BattleConst.SKILL_TYPE_ACTIVE, self)
table.insert(self.skills, skill) end
if self.unitData.activeSkills then
for k, v in ipairs(self.unitData.activeSkills) do
local skill = BattleSkillEntity:create(v, GConst.BattleConst.SKILL_TYPE_ACTIVE, self)
table.insert(self.activeSkills, skill)
end
end end
end end

View File

@ -135,4 +135,8 @@ function HeroEntity:getActiveSkill()
return self.config.base_skill return self.config.base_skill
end end
function HeroEntity:getHurtSkill()
return self.config.hurt_skill
end
return HeroEntity return HeroEntity