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

View File

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

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -11,8 +11,6 @@ local localization_global =
["BTN_TEXT_CANCEL"] = "取消",
["BTN_TEXT_OK"] = "确定",
["BATTLE_DESC_1"] = "是否退出战斗",
["START_DESC"] = "开始",
}
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()
if self.unitEntity:getSide() == SIDE_ATK then
self.baseObject:setLocalPosition(-BattleConst.INIT_POS_X, 0, 0)
self.body:setLocalScaleX(1)
self.direction = 1
else
self.baseObject:setLocalPosition(BattleConst.INIT_POS_X, 0, 0)
self.body:setLocalScaleX(-1)
self.direction = -1
end
end
@ -31,6 +35,7 @@ function BattleUnitComp:initWithEntity(modelId, entity, battleController, target
self.unitEntity = entity
self.battleController = battleController
self.target = target
self.body = self.baseObject:getChildByName("body")
self:_initBase()
self:initPosition()
self:playBorn()

View File

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

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 BattleControllerStage = class("BattleControllerStage", BattleController)
function BattleController:getChapterId()
function BattleControllerStage:getChapterId()
return DataManager.ChapterData:getChapterId()
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()
if not self.boradList then
self.boradList = {}

View File

@ -285,10 +285,9 @@ function BattleData:initHeroData()
local unitData = {
id = heroId,
modelId = heroEntity:getModelId(),
level = heroEntity:getLv(),
qlt = heroEntity:getQlt(),
matchType = matchType,
activeSkill = activeSkill,
normalSkill = heroEntity:getHurtSkill(),
activeSkill = {activeSkill},
attr = {
hp = hp,
max_hp = hp,
@ -305,4 +304,22 @@ function BattleData:initHeroData()
return data
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

View File

@ -35,6 +35,18 @@ function BattleTeamEntity:init(side, data)
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()
return self.members
end

View File

@ -28,10 +28,15 @@ function BattleUnitEntity:initAttr()
end
function BattleUnitEntity:initSkill()
self.skills = {}
if self.unitData.activeSkill then
local skill = BattleSkillEntity:create(self.unitData.activeSkill, GConst.BattleConst.SKILL_TYPE_ACTIVE, self)
table.insert(self.skills, skill)
self.activeSkills = {}
if self.unitData.normalSkill then
self.normalSkill = BattleSkillEntity:create(self.unitData.normalSkill, GConst.BattleConst.SKILL_TYPE_ACTIVE, self)
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

View File

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