From dd6e7511749d0641e1437baf4ea4832d2024525e Mon Sep 17 00:00:00 2001 From: chenxi Date: Tue, 11 Apr 2023 20:33:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=BA=9B=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/config/buff.lua | 49 ++++++++++--------- lua/app/config/hero.lua | 16 +++--- lua/app/config/skill_hero.lua | 26 +++++----- lua/app/config/skill_rogue.lua | 4 +- lua/app/module/battle/battle_const.lua | 1 + .../battle/component/battle_hero_comp.lua | 21 ++++++++ .../component/battle_hero_comp.lua.meta | 10 ++++ .../battle/component/battle_unit_comp.lua | 41 ++++++++++------ .../battle/controller/battle_controller.lua | 2 +- lua/app/userdata/battle/battle_data.lua | 2 +- .../battle/team/battle_unit_entity.lua | 6 ++- 11 files changed, 112 insertions(+), 66 deletions(-) create mode 100644 lua/app/module/battle/component/battle_hero_comp.lua create mode 100644 lua/app/module/battle/component/battle_hero_comp.lua.meta diff --git a/lua/app/config/buff.lua b/lua/app/config/buff.lua index f5395efb..87e910ea 100644 --- a/lua/app/config/buff.lua +++ b/lua/app/config/buff.lua @@ -53,54 +53,55 @@ local buff = { ["v_buf"]="atkp_add" }, [7]={ - ["name"]="healp", - ["buff_type"]=5, - ["decr"]=3, - ["is_percent"]=2, - ["v_buf"]="healp", - ["fx_get"]={ - 2001 - } - }, - [8]={ ["name"]="wavehealp", ["buff_type"]=5, ["decr"]=3, ["is_percent"]=2, ["v_buf"]="healp" }, - [9]={ + [8]={ ["name"]="atkp_add_connect", ["buff_type"]=1, ["is_percent"]=2, ["v_buf"]="atkp_add" }, - [10]={ + [9]={ ["name"]="spd_dec", ["buff_type"]=8, ["is_percent"]=2, ["v_buf"]="spd_dec" }, - [11]={ + [10]={ ["name"]="block", ["buff_type"]=1, ["decr"]=1, ["is_percent"]=2, ["v_buf"]="block" }, - [12]={ + [11]={ ["name"]="hit_block", ["buff_type"]=1, ["decr"]=1, ["is_percent"]=2, ["v_buf"]="block" }, - [13]={ - ["name"]="hit_healp", + [12]={ + ["name"]="heal", ["buff_type"]=5, ["decr"]=3, ["is_percent"]=2, - ["v_buf"]="healp" + ["v_buf"]="heal", + ["formula"]=8, + ["fx_get"]={ + 2001 + } + }, + [13]={ + ["name"]="hit_heal", + ["buff_type"]=5, + ["decr"]=3, + ["is_percent"]=2, + ["v_buf"]="heal" } } local keys = { @@ -111,13 +112,13 @@ local keys = { ["shield"]=buff[4], ["atkp_add"]=buff[5], ["atkp_add_defenderhp"]=buff[6], - ["healp"]=buff[7], - ["wavehealp"]=buff[8], - ["atkp_add_connect"]=buff[9], - ["spd_dec"]=buff[10], - ["block"]=buff[11], - ["hit_block"]=buff[12], - ["hit_healp"]=buff[13] + ["wavehealp"]=buff[7], + ["atkp_add_connect"]=buff[8], + ["spd_dec"]=buff[9], + ["block"]=buff[10], + ["hit_block"]=buff[11], + ["heal"]=buff[12], + ["hit_heal"]=buff[13] } } local config = { diff --git a/lua/app/config/hero.lua b/lua/app/config/hero.lua index 7362997f..5a7bfaf1 100644 --- a/lua/app/config/hero.lua +++ b/lua/app/config/hero.lua @@ -36,7 +36,7 @@ local hero = { ["atk_13"]=220, ["atk_14"]=230, ["atk_15"]=240, - ["model_id"]="p00001", + ["model_id"]="p0001", ["icon"]="1" }, [22001]={ @@ -76,7 +76,7 @@ local hero = { ["atk_13"]=220, ["atk_14"]=230, ["atk_15"]=240, - ["model_id"]="p00002", + ["model_id"]="p0002", ["icon"]="2" }, [23001]={ @@ -116,7 +116,7 @@ local hero = { ["atk_13"]=330, ["atk_14"]=345, ["atk_15"]=360, - ["model_id"]="p00006", + ["model_id"]="p0006", ["icon"]="6" }, [32001]={ @@ -156,7 +156,7 @@ local hero = { ["atk_13"]=220, ["atk_14"]=230, ["atk_15"]=240, - ["model_id"]="p00003", + ["model_id"]="p0003", ["icon"]="3" }, [33001]={ @@ -196,7 +196,7 @@ local hero = { ["atk_13"]=330, ["atk_14"]=345, ["atk_15"]=360, - ["model_id"]="p00007", + ["model_id"]="p0007", ["icon"]="7" }, [42001]={ @@ -236,7 +236,7 @@ local hero = { ["atk_13"]=220, ["atk_14"]=230, ["atk_15"]=240, - ["model_id"]="p00004", + ["model_id"]="p0004", ["icon"]="4" }, [43001]={ @@ -276,7 +276,7 @@ local hero = { ["atk_13"]=330, ["atk_14"]=345, ["atk_15"]=360, - ["model_id"]="p00008", + ["model_id"]="p0008", ["icon"]="8" }, [52001]={ @@ -316,7 +316,7 @@ local hero = { ["atk_13"]=220, ["atk_14"]=230, ["atk_15"]=240, - ["model_id"]="p00005", + ["model_id"]="p0005", ["icon"]="5" } } diff --git a/lua/app/config/skill_hero.lua b/lua/app/config/skill_hero.lua index 1adfcb3c..b0d9340c 100644 --- a/lua/app/config/skill_hero.lua +++ b/lua/app/config/skill_hero.lua @@ -1,6 +1,6 @@ local skill_hero = { [10]={ - ["energy"]=3, + ["energy"]=10, ["position"]=3, ["method"]=2, ["skill_type"]=1, @@ -18,7 +18,7 @@ local skill_hero = { ["battle_icon"]=1 }, [20]={ - ["energy"]=3, + ["energy"]=10, ["position"]=2, ["method"]=2, ["skill_type"]=0, @@ -35,7 +35,7 @@ local skill_hero = { ["battle_icon"]=2 }, [21]={ - ["energy"]=3, + ["energy"]=10, ["position"]=2, ["method"]=1, ["skill_type"]=2, @@ -70,7 +70,7 @@ local skill_hero = { ["battle_icon"]=2 }, [30]={ - ["energy"]=3, + ["energy"]=10, ["position"]=4, ["method"]=2, ["skill_type"]=1, @@ -84,7 +84,7 @@ local skill_hero = { ["battle_icon"]=3 }, [40]={ - ["energy"]=3, + ["energy"]=10, ["position"]=5, ["method"]=2, ["skill_type"]=0, @@ -101,7 +101,7 @@ local skill_hero = { ["battle_icon"]=4 }, [50]={ - ["energy"]=3, + ["energy"]=10, ["position"]=1, ["method"]=2, ["skill_type"]=1, @@ -119,13 +119,13 @@ local skill_hero = { ["battle_icon"]=5 }, [60]={ - ["energy"]=3, + ["energy"]=10, ["position"]=3, ["method"]=2, ["skill_type"]=0, ["effect"]={ { - ["type"]="healp", + ["type"]="heal", ["num"]=2000, ["ratio"]=10000, ["round"]=1 @@ -136,7 +136,7 @@ local skill_hero = { ["battle_icon"]=6 }, [70]={ - ["energy"]=3, + ["energy"]=10, ["position"]=2, ["method"]=2, ["skill_type"]=0, @@ -153,7 +153,7 @@ local skill_hero = { ["battle_icon"]=7 }, [71]={ - ["energy"]=3, + ["energy"]=10, ["position"]=2, ["method"]=1, ["skill_type"]=2, @@ -189,7 +189,7 @@ local skill_hero = { ["battle_icon"]=7 }, [72]={ - ["energy"]=3, + ["energy"]=10, ["position"]=2, ["method"]=1, ["skill_type"]=2, @@ -232,7 +232,7 @@ local skill_hero = { ["battle_icon"]=7 }, [80]={ - ["energy"]=3, + ["energy"]=10, ["position"]=4, ["method"]=2, ["skill_type"]=0, @@ -254,7 +254,7 @@ local skill_hero = { ["battle_icon"]=8 }, [81]={ - ["energy"]=3, + ["energy"]=10, ["position"]=4, ["method"]=2, ["skill_type"]=1, diff --git a/lua/app/config/skill_rogue.lua b/lua/app/config/skill_rogue.lua index 467929a4..7ce09870 100644 --- a/lua/app/config/skill_rogue.lua +++ b/lua/app/config/skill_rogue.lua @@ -933,8 +933,8 @@ local skill_rogue = { }, ["effect"]={ { - ["type"]="hit_healp", - ["num"]=200, + ["type"]="hit_heal", + ["num"]=500, ["ratio"]=10000, ["round"]=1 } diff --git a/lua/app/module/battle/battle_const.lua b/lua/app/module/battle/battle_const.lua index d77ff7d3..d74769c2 100644 --- a/lua/app/module/battle/battle_const.lua +++ b/lua/app/module/battle/battle_const.lua @@ -15,6 +15,7 @@ BattleConst.SIDE_ATK = 1 BattleConst.SIDE_DEF = 2 BattleConst.SKILL_TYPE_ACTIVE = 1 BattleConst.SKILL_SELECT_COUNT = 3 +BattleConst.DEFAULT_FACTOR = 10000 -- 为方便存储,这里使用字符串 BattleConst.BATTLE_TYPE = { diff --git a/lua/app/module/battle/component/battle_hero_comp.lua b/lua/app/module/battle/component/battle_hero_comp.lua new file mode 100644 index 00000000..7fc88cdf --- /dev/null +++ b/lua/app/module/battle/component/battle_hero_comp.lua @@ -0,0 +1,21 @@ +local BattleConst = require "app/module/battle/battle_const" +local BattleUnitComp = require "app/module/battle/component/battle_unit_comp" + +local BattleHeroComp = class("BattleHeroComp", BattleUnitComp) + +local UNIT_STATE = BattleConst.UNIT_STATE + +function BattleHeroComp:init() + self.battleMgr = CS.BF.BFMain.Instance.BattleMgr +end + +function BattleHeroComp:initBase() + self.isDead = false + self.currState = UNIT_STATE.INIT +end + +function BattleHeroComp:initPosition() + self.baseObject:setLocalPosition(0, 0, 0) +end + +return BattleHeroComp \ No newline at end of file diff --git a/lua/app/module/battle/component/battle_hero_comp.lua.meta b/lua/app/module/battle/component/battle_hero_comp.lua.meta new file mode 100644 index 00000000..cc33f0f3 --- /dev/null +++ b/lua/app/module/battle/component/battle_hero_comp.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 2de8b968215b6754d98014fe8d8feedf +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3} diff --git a/lua/app/module/battle/component/battle_unit_comp.lua b/lua/app/module/battle/component/battle_unit_comp.lua index 66d9b36f..94b1651d 100644 --- a/lua/app/module/battle/component/battle_unit_comp.lua +++ b/lua/app/module/battle/component/battle_unit_comp.lua @@ -7,8 +7,8 @@ local UNIT_STATE = BattleConst.UNIT_STATE function BattleUnitComp:ctor() end -function BattleUnitComp:init() - self:_initBase() +function BattleUnitComp:initPosition() + self.baseObject:setLocalPosition(0, 0, 0) end function BattleUnitComp:_initBase() @@ -16,21 +16,30 @@ function BattleUnitComp:_initBase() self.isDead = false end +function BattleUnitComp:initWithEntity(modelId, entity, battleController, target) + self.modelId = modelId + self.unitEntity = entity + self.battleController = battleController + self.target = target + self:_initBase() + self:initPosition() +end + function BattleUnitComp:tick(dt) - if self.isClear then - return - end - if self.isDead then - self:updateDead(dt) - return - end - if self.currState == UNIT_STATE.IDLE then - self:updateIdle(dt) - return - end - if self.currState == UNIT_STATE.ATTACK then - self:updateAttack(dt) - end + -- if self.isClear then + -- return + -- end + -- if self.isDead then + -- self:updateDead(dt) + -- return + -- end + -- if self.currState == UNIT_STATE.IDLE then + -- self:updateIdle(dt) + -- return + -- end + -- if self.currState == UNIT_STATE.ATTACK then + -- self:updateAttack(dt) + -- end end return BattleUnitComp \ No newline at end of file diff --git a/lua/app/module/battle/controller/battle_controller.lua b/lua/app/module/battle/controller/battle_controller.lua index 3740e89d..f9312921 100644 --- a/lua/app/module/battle/controller/battle_controller.lua +++ b/lua/app/module/battle/controller/battle_controller.lua @@ -129,7 +129,7 @@ function BattleController:initAllUnits(callback) local members = atkTeam:getAllMembers() for k, v in pairs(members) do local modelId = v:getModelId() - BattleHelper:loadBattleHero(modelId, self.battleUI:getBattleNode(), function(spineObject) + BattleHelper:loadBattleHeroModel(modelId, self.battleUI:getBattleNode(), function(spineObject) local heroComp = spineObject:addLuaComponent(BattleConst.TYPEOF_LUA_COMP.BATTLE_HERO_COMPONENT) heroComp:initWithEntity(modelId, v, self) self.atkUnits[v:getMatchType()] = heroComp diff --git a/lua/app/userdata/battle/battle_data.lua b/lua/app/userdata/battle/battle_data.lua index ed62ec7c..9a95e869 100644 --- a/lua/app/userdata/battle/battle_data.lua +++ b/lua/app/userdata/battle/battle_data.lua @@ -8,7 +8,7 @@ local BATTLE_GRID_ENTITY = require "app/userdata/battle/battle_grid_entity" local BATTLE_BOARD_SKILL_ENTITY = require "app/userdata/battle/skill/battle_borad_skill_entity" local ATTR_TYPE = GConst.ATTR_TYPE -local DEFAULT_FACTOR = GConst.DEFAULT_FACTOR +local DEFAULT_FACTOR = BattleConst.DEFAULT_FACTOR function BattleData:init(board, skillIds, skillPool) self:clear() diff --git a/lua/app/userdata/battle/team/battle_unit_entity.lua b/lua/app/userdata/battle/team/battle_unit_entity.lua index 13d21840..08914b0e 100644 --- a/lua/app/userdata/battle/team/battle_unit_entity.lua +++ b/lua/app/userdata/battle/team/battle_unit_entity.lua @@ -6,7 +6,7 @@ function BattleUnitEntity:ctor() end function BattleUnitEntity:init(unitData, side, team) - self.data = unitData + self.unitData = unitData self.side = side self.team = team self:initAttr() @@ -39,4 +39,8 @@ function BattleUnitEntity:getModelId() return self.unitData.modelId end +function BattleUnitEntity:getMatchType() + return self.unitData.matchType +end + return BattleUnitEntity \ No newline at end of file