普攻改成数组

This commit is contained in:
chenxi 2023-04-21 17:11:59 +08:00
parent c6ea40de7e
commit 2a9f4350b0
12 changed files with 3060 additions and 962 deletions

View File

@ -63,6 +63,18 @@ local fx = {
["res"]="sfx_m10016_b03", ["res"]="sfx_m10016_b03",
["bind"]="root" ["bind"]="root"
}, },
[100016]={
["res"]="sfx_m10008_b01",
["bind"]="root"
},
[100017]={
["res"]="sfx_m10008_b02",
["bind"]="root"
},
[100018]={
["res"]="sfx_m10008_b03",
["bind"]="root"
},
[200000]={ [200000]={
["res"]="sfx_m20001_b01", ["res"]="sfx_m20001_b01",
["bind"]="root" ["bind"]="root"
@ -357,6 +369,6 @@ local fx = {
} }
} }
local config = { local config = {
data=fx,count=89 data=fx,count=92
} }
return config return config

View File

@ -2,10 +2,15 @@ local hero = {
[12001]={ [12001]={
["position"]=1, ["position"]=1,
["qlt"]=2, ["qlt"]=2,
["hurt_skill"]=1, ["hurt_skill"]={
1200111,
1200112,
1200113,
1200114
},
["hurt_num"]=3, ["hurt_num"]=3,
["base_skill"]=120011, ["base_skill"]=1200120,
["support_skill"]=120010, ["support_skill"]=1200110,
["rouge_skill"]=200500, ["rouge_skill"]=200500,
["rouge_skill_1"]=200501, ["rouge_skill_1"]=200501,
["rouge_skill_2"]=200502, ["rouge_skill_2"]=200502,
@ -53,10 +58,15 @@ local hero = {
[22001]={ [22001]={
["position"]=2, ["position"]=2,
["qlt"]=2, ["qlt"]=2,
["hurt_skill"]=2, ["hurt_skill"]={
2200111,
2200112,
2200113,
2200114
},
["hurt_num"]=3, ["hurt_num"]=3,
["base_skill"]=220011, ["base_skill"]=2200120,
["support_skill"]=220010, ["support_skill"]=2200110,
["rouge_skill"]=200200, ["rouge_skill"]=200200,
["rouge_skill_1"]=200201, ["rouge_skill_1"]=200201,
["rouge_skill_2"]=200202, ["rouge_skill_2"]=200202,
@ -104,10 +114,15 @@ local hero = {
[23001]={ [23001]={
["position"]=2, ["position"]=2,
["qlt"]=3, ["qlt"]=3,
["hurt_skill"]=2, ["hurt_skill"]={
2300111,
2300112,
2300113,
2300114
},
["hurt_num"]=3, ["hurt_num"]=3,
["base_skill"]=230011, ["base_skill"]=2300120,
["support_skill"]=230010, ["support_skill"]=2300110,
["rouge_skill"]=200700, ["rouge_skill"]=200700,
["rouge_skill_1"]=200701, ["rouge_skill_1"]=200701,
["rouge_skill_2"]=200702, ["rouge_skill_2"]=200702,
@ -155,10 +170,15 @@ local hero = {
[32001]={ [32001]={
["position"]=3, ["position"]=3,
["qlt"]=2, ["qlt"]=2,
["hurt_skill"]=3, ["hurt_skill"]={
3200111,
3200112,
3200113,
3200114
},
["hurt_num"]=3, ["hurt_num"]=3,
["base_skill"]=320011, ["base_skill"]=3200120,
["support_skill"]=320010, ["support_skill"]=3200110,
["rouge_skill"]=200100, ["rouge_skill"]=200100,
["rouge_skill_1"]=200101, ["rouge_skill_1"]=200101,
["rouge_skill_2"]=200102, ["rouge_skill_2"]=200102,
@ -206,10 +226,15 @@ local hero = {
[33001]={ [33001]={
["position"]=3, ["position"]=3,
["qlt"]=3, ["qlt"]=3,
["hurt_skill"]=3, ["hurt_skill"]={
3300111,
3300112,
3300113,
3300114
},
["hurt_num"]=3, ["hurt_num"]=3,
["base_skill"]=330011, ["base_skill"]=3300120,
["support_skill"]=330010, ["support_skill"]=3300110,
["rouge_skill"]=200600, ["rouge_skill"]=200600,
["rouge_skill_1"]=200601, ["rouge_skill_1"]=200601,
["rouge_skill_2"]=200602, ["rouge_skill_2"]=200602,
@ -257,10 +282,15 @@ local hero = {
[42001]={ [42001]={
["position"]=4, ["position"]=4,
["qlt"]=2, ["qlt"]=2,
["hurt_skill"]=9, ["hurt_skill"]={
4200111,
4200112,
4200113,
4200114
},
["hurt_num"]=3, ["hurt_num"]=3,
["base_skill"]=420011, ["base_skill"]=4200120,
["support_skill"]=420010, ["support_skill"]=4200110,
["rouge_skill"]=200300, ["rouge_skill"]=200300,
["rouge_skill_1"]=200301, ["rouge_skill_1"]=200301,
["rouge_skill_2"]=200302, ["rouge_skill_2"]=200302,
@ -308,10 +338,15 @@ local hero = {
[43001]={ [43001]={
["position"]=4, ["position"]=4,
["qlt"]=3, ["qlt"]=3,
["hurt_skill"]=4, ["hurt_skill"]={
4300111,
4300112,
4300113,
4300114
},
["hurt_num"]=3, ["hurt_num"]=3,
["base_skill"]=430011, ["base_skill"]=4300120,
["support_skill"]=430010, ["support_skill"]=4300110,
["rouge_skill"]=200800, ["rouge_skill"]=200800,
["rouge_skill_1"]=200801, ["rouge_skill_1"]=200801,
["rouge_skill_2"]=200802, ["rouge_skill_2"]=200802,
@ -359,10 +394,15 @@ local hero = {
[52001]={ [52001]={
["position"]=5, ["position"]=5,
["qlt"]=2, ["qlt"]=2,
["hurt_skill"]=5, ["hurt_skill"]={
5200111,
5200112,
5200113,
5200114
},
["hurt_num"]=3, ["hurt_num"]=3,
["base_skill"]=520011, ["base_skill"]=5200120,
["support_skill"]=520010, ["support_skill"]=5200110,
["rouge_skill"]=200400, ["rouge_skill"]=200400,
["rouge_skill_1"]=200401, ["rouge_skill_1"]=200401,
["rouge_skill_2"]=200402, ["rouge_skill_2"]=200402,

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -724,7 +724,7 @@ local skill_rogue = {
["qlt"]=3, ["qlt"]=3,
["type"]=1, ["type"]=1,
["parameter"]={ ["parameter"]={
220012 2200121
}, },
["skill_position"]=2, ["skill_position"]=2,
["icon"]="34" ["icon"]="34"
@ -755,13 +755,13 @@ local skill_rogue = {
["effect"]={ ["effect"]={
{ {
["type"]="skill_fire_times", ["type"]="skill_fire_times",
["num"]=220011, ["num"]=2200120,
["ratio"]=10000, ["ratio"]=10000,
["round"]=1 ["round"]=1
}, },
{ {
["type"]="skill_fire_times", ["type"]="skill_fire_times",
["num"]=220012, ["num"]=2200121,
["ratio"]=10000, ["ratio"]=10000,
["round"]=1 ["round"]=1
} }
@ -980,7 +980,7 @@ local skill_rogue = {
["qlt"]=3, ["qlt"]=3,
["type"]=1, ["type"]=1,
["parameter"]={ ["parameter"]={
230012 2300121
}, },
["skill_position"]=2, ["skill_position"]=2,
["icon"]="49" ["icon"]="49"
@ -1008,7 +1008,7 @@ local skill_rogue = {
["qlt"]=4, ["qlt"]=4,
["type"]=1, ["type"]=1,
["parameter"]={ ["parameter"]={
230013 2300122
}, },
["skill_position"]=2, ["skill_position"]=2,
["icon"]="51" ["icon"]="51"
@ -1027,7 +1027,7 @@ local skill_rogue = {
["qlt"]=3, ["qlt"]=3,
["type"]=1, ["type"]=1,
["parameter"]={ ["parameter"]={
430012 4300121
}, },
["skill_position"]=4, ["skill_position"]=4,
["icon"]="52" ["icon"]="52"

View File

@ -2,7 +2,6 @@ local tutorial = {
[10000]={ [10000]={
["next_id"]=10010, ["next_id"]=10010,
["type"]=6, ["type"]=6,
["finish"]=4,
["target_element"]={ ["target_element"]={
53, 53,
44, 44,
@ -33,7 +32,6 @@ local tutorial = {
[10040]={ [10040]={
["next_id"]=10050, ["next_id"]=10050,
["type"]=6, ["type"]=6,
["finish"]=4,
["target_element"]={ ["target_element"]={
33, 33,
23, 23,
@ -55,7 +53,6 @@ local tutorial = {
}, },
[10060]={ [10060]={
["type"]=6, ["type"]=6,
["finish"]=4,
["target_element"]={ ["target_element"]={
23, 23,
13, 13,

View File

@ -653,7 +653,7 @@ function BattleUnitComp:enterSkillAttackState()
self.targetX = nil self.targetX = nil
local skill local skill
if self.normalSkillCount > 0 then if self.normalSkillCount > 0 then
skill = self.unitEntity:getNormalSkill() skill = self.unitEntity:getNormalSkill(true)
else else
skill = self.currActiveSkill skill = self.currActiveSkill
end end
@ -672,12 +672,9 @@ function BattleUnitComp:enterSkillAttackState()
else else
self.isMove = false self.isMove = false
self.attackTime = 0 self.attackTime = 0
local attackName local attackName = skill:getSkillAttackName()
if self.normalSkillCount > 0 then if self.normalSkillCount > 0 then
attackName = skill:getRandomNormalAttackName()
self:attackAndSpeedUp() self:attackAndSpeedUp()
else
attackName = skill:getSkillAttackName()
end end
self.currAttackDuration = self:getAnimationDuration(attackName) self.currAttackDuration = self:getAnimationDuration(attackName)
self.currAttackKeyTime = self:getAnimationKeyFrameTime(attackName) self.currAttackKeyTime = self:getAnimationKeyFrameTime(attackName)
@ -842,8 +839,9 @@ end
function BattleUnitComp:doNextNormalAttack() function BattleUnitComp:doNextNormalAttack()
self.attackTime = 0 self.attackTime = 0
local skill = self.unitEntity:getNormalSkill() local skill = self.unitEntity:getNormalSkill(true)
local attackName = skill:getRandomNormalAttackName() skill:startUse()
local attackName = skill:getSkillAttackName()
self.currAttackDuration = self:getAnimationDuration(attackName) self.currAttackDuration = self:getAnimationDuration(attackName)
self.currAttackKeyTime = self:getAnimationKeyFrameTime(attackName) self.currAttackKeyTime = self:getAnimationKeyFrameTime(attackName)
self:playAnimation(attackName, false, false) self:playAnimation(attackName, false, false)
@ -855,8 +853,9 @@ function BattleUnitComp:doNextAttack()
self.attackTime = 0 self.attackTime = 0
local attackName = nil local attackName = nil
if self.normalSkillCount > 0 then if self.normalSkillCount > 0 then
local skill = self.unitEntity:getNormalSkill() local skill = self.unitEntity:getNormalSkill(true)
attackName = skill:getRandomNormalAttackName() skill:startUse()
attackName = skill:getSkillAttackName()
if attackName then if attackName then
self.currAttackDuration = self:getAnimationDuration(attackName) self.currAttackDuration = self:getAnimationDuration(attackName)
self.currAttackKeyTime = self:getAnimationKeyFrameTime(attackName) self.currAttackKeyTime = self:getAnimationKeyFrameTime(attackName)
@ -867,6 +866,7 @@ function BattleUnitComp:doNextAttack()
self:moveBackToInitPosition() self:moveBackToInitPosition()
end end
elseif self.currActiveSkill then elseif self.currActiveSkill then
self.currActiveSkill:startUse()
attackName = self.currActiveSkill:getSkillAttackName() attackName = self.currActiveSkill:getSkillAttackName()
if attackName then if attackName then
self.currAttackDuration = self:getAnimationDuration(attackName) self.currAttackDuration = self:getAnimationDuration(attackName)
@ -885,7 +885,7 @@ end
function BattleUnitComp:enterNormalAttackState() function BattleUnitComp:enterNormalAttackState()
self.attackOver = false self.attackOver = false
self.attackTime = 0 self.attackTime = 0
local skill = self.unitEntity:getNormalSkill() local skill = self.unitEntity:getNormalSkill(true)
skill:startUse() skill:startUse()
if skill:getMoveType() == BattleConst.SKILL_MOVE_TYPE.MOVE then if skill:getMoveType() == BattleConst.SKILL_MOVE_TYPE.MOVE then
self.isMove = true self.isMove = true
@ -901,7 +901,7 @@ function BattleUnitComp:enterNormalAttackState()
else else
self.isMove = false self.isMove = false
self.attackTime = 0 self.attackTime = 0
local attackName = skill:getRandomNormalAttackName() local attackName = skill:getSkillAttackName()
self.currAttackDuration = self:getAnimationDuration(attackName) self.currAttackDuration = self:getAnimationDuration(attackName)
self.currAttackKeyTime = self:getAnimationKeyFrameTime(attackName) self.currAttackKeyTime = self:getAnimationKeyFrameTime(attackName)
self:playAnimation(attackName, false, false) self:playAnimation(attackName, false, false)
@ -1278,9 +1278,8 @@ function BattleUnitComp:getEffectAndPlay(skill, fxInfo)
-- effectObj:changeSortingOrderToFudge(BattleConst.BATTLE_BASE_ORDER, BattleConst.FX_SORTING_FUDGE_COEFFICIENT) -- effectObj:changeSortingOrderToFudge(BattleConst.BATTLE_BASE_ORDER, BattleConst.FX_SORTING_FUDGE_COEFFICIENT)
-- end -- end
effectObj:play() effectObj:play()
duration = duration or effectObj:getDuration()
local sid local sid
sid = BattleHelper:performDurationDelay(duration, function() sid = BattleHelper:performDurationDelay(effectObj:getDuration(), function()
BattleHelper:recycleEffect(effectObj) BattleHelper:recycleEffect(effectObj)
end) end)
end) end)

View File

@ -177,9 +177,9 @@ function BattleController:init(params)
self.time = 0 self.time = 0
self.battleData:init() self.battleData:init()
BattleScheduler:init() BattleScheduler:init()
BattlePool:init()
BattleHelper:init() BattleHelper:init()
BattlePassive:init() BattlePassive:init()
BattlePool:init()
self:setTimeScale(DataManager.BattleData:getTimeScale()) self:setTimeScale(DataManager.BattleData:getTimeScale())
self:bindData() self:bindData()
self:initBattleTeam() self:initBattleTeam()

View File

@ -1,5 +1,6 @@
local UIPrefabObject = require "app/bf/unity/uiprefab_object" local UIPrefabObject = require "app/bf/unity/uiprefab_object"
local BattlePool = require "app/module/battle/helper/battle_pool" local BattlePool = require "app/module/battle/helper/battle_pool"
local BattleScheduler = require "app/module/battle/helper/battle_scheduler"
local BattleHelper = {} local BattleHelper = {}
@ -100,14 +101,15 @@ function BattleHelper:getEffectAsync(name, parent, callback)
end end
local effect = self.effectPools:pop(path) local effect = self.effectPools:pop(path)
if effect then if effect then
if parent then -- if parent then
effect:setParent(parent, false) -- effect:setParent(parent, false)
end -- end
if self.effectMap then if self.effectMap then
self.effectMap[effect:getInstanceID()] = effect self.effectMap[effect:getInstanceID()] = effect
end end
local timeScale = DataManager.BattleData:getTimeScale() local timeScale = DataManager.BattleData:getTimeScale()
effect:setTimeScale(timeScale) effect:setTimeScale(timeScale)
effect:setActive(true)
callback(effect) callback(effect)
else else
EffectManager:loadBattleEffectAsync(path, parent, function(effect) EffectManager:loadBattleEffectAsync(path, parent, function(effect)
@ -134,8 +136,9 @@ function BattleHelper:recycleEffect(effect)
end end
end end
effect:stop() effect:stop()
effect:setActive(false)
if self.effectPools then if self.effectPools then
self.effectPools:push(effect) self.effectPools:push(effect, true)
end end
if self.effectMap then if self.effectMap then
self.effectMap[effect:getInstanceID()] = nil self.effectMap[effect:getInstanceID()] = nil
@ -218,6 +221,18 @@ function BattleHelper:recycleBuffEffect(buffEffect)
table.insert(self.buffEffectPool, buffEffect) table.insert(self.buffEffectPool, buffEffect)
end end
function BattleHelper:performDurationDelay(delay, func)
return BattleScheduler:performWithDelayGlobal(func, delay)
end
function BattleHelper:scheduleGlobal(inter, func)
return BattleScheduler:scheduleGlobal(func, inter)
end
function BattleHelper:unscheduleGlobal(scheduleId)
BattleScheduler:unscheduleGlobal(scheduleId)
end
function BattleHelper:clear() function BattleHelper:clear()
self.isClear = true self.isClear = true
self.characterPools = nil self.characterPools = nil

View File

@ -479,9 +479,8 @@ function BattleData:initHeroData()
id = heroId, id = heroId,
modelId = heroEntity:getModelId(), modelId = heroEntity:getModelId(),
matchType = matchType, matchType = matchType,
normalSkill = heroEntity:getHurtSkill(), normalSkills = heroEntity:getHurtSkill(),
activeSkills = {activeSkill}, activeSkills = {activeSkill},
normalSkillCount = heroEntity:getHurtNum(),
assistingSkill = heroEntity:getAssistingSkill(), assistingSkill = heroEntity:getAssistingSkill(),
attr = { attr = {
hp = hp, hp = hp,
@ -512,9 +511,8 @@ function BattleData:addMonster(monsterId, newTeam)
id = monsterId, id = monsterId,
modelId = monsterInfo.model_id, modelId = monsterInfo.model_id,
matchType = 0, matchType = 0,
normalSkill = monsterInfo.hurt_skill, normalSkills = monsterInfo.hurt_skill,
activeSkills = monsterInfo.skill, activeSkills = monsterInfo.skill,
normalSkillCount = monsterInfo.hurt_num,
assistingSkill = nil, assistingSkill = nil,
isBoss = monsterInfo.is_boss, isBoss = monsterInfo.is_boss,
exp = monsterInfo.monster_exp or 0, exp = monsterInfo.monster_exp or 0,

View File

@ -125,25 +125,6 @@ function BattleSkillEntity:getMoveType()
return self.skillInfo.skill_position return self.skillInfo.skill_position
end end
function BattleSkillEntity:getRandomNormalAttackName()
if self.normalSkillNameList == nil then
local normalSkillNameList, count = self.owner:getNormalSkillNameList()
self.normalSkillNameList = {}
for i = 1, count do
self.normalSkillNameList[i] = normalSkillNameList[i]
end
end
if self.normalSkillNameIndex == nil then
self.normalSkillNameIndex = math.random(1, #self.normalSkillNameList)
else
local temp = self.normalSkillNameList[#self.normalSkillNameList]
self.normalSkillNameList[#self.normalSkillNameList] = self.normalSkillNameList[self.normalSkillNameIndex]
self.normalSkillNameList[self.normalSkillNameIndex] = temp
self.normalSkillNameIndex = math.random(1, #self.normalSkillNameList - 1)
end
return self.normalSkillNameList[self.normalSkillNameIndex]
end
function BattleSkillEntity:getSkillAttackName() function BattleSkillEntity:getSkillAttackName()
return self.skillInfo.name_act return self.skillInfo.name_act
end end

View File

@ -14,9 +14,17 @@ end
function BattleUnitEntity:initSkill() function BattleUnitEntity:initSkill()
self.activeSkills = {} self.activeSkills = {}
if self.unitData.normalSkill then if self.unitData.normalSkills then
self.normalSkill = BattleSkillEntity:create(self.unitData.normalSkill, GConst.BattleConst.SKILL_TYPE_NORMAL, self) self.normalSkills = {}
for k, v in ipairs(self.unitData.normalSkills) do
local skill = BattleSkillEntity:create(v, GConst.BattleConst.SKILL_TYPE_NORMAL, self)
table.insert(self.normalSkills, skill)
end
self.normalSkillCount = #self.normalSkills
else
self.normalSkillCount = 0
end end
self.normalSkill = nil
if self.unitData.assistingSkill then if self.unitData.assistingSkill then
self.assistingSkill = BattleSkillEntity:create(self.unitData.assistingSkill, GConst.BattleConst.SKILL_TYPE_ASSISTING, self) self.assistingSkill = BattleSkillEntity:create(self.unitData.assistingSkill, GConst.BattleConst.SKILL_TYPE_ASSISTING, self)
end end
@ -99,7 +107,22 @@ function BattleUnitEntity:getIsMainUnit()
return self.isMainUnit return self.isMainUnit
end end
function BattleUnitEntity:getNormalSkill() function BattleUnitEntity:getNormalSkill(reRandom)
if self.normalSkills == nil then
return nil
end
if not reRandom then
return self.normalSkill
end
if self.normalSkillIndex == nil then
self.normalSkillIndex = math.random(1, #self.normalSkills)
else
local temp = self.normalSkills[#self.normalSkills]
self.normalSkills[#self.normalSkills] = self.normalSkills[self.normalSkillIndex]
self.normalSkills[self.normalSkillIndex] = temp
self.normalSkillIndex = math.random(1, #self.normalSkills - 1)
end
self.normalSkill = self.normalSkills[self.normalSkillIndex]
return self.normalSkill return self.normalSkill
end end
@ -124,18 +147,7 @@ function BattleUnitEntity:getActiveSkill(index)
end end
function BattleUnitEntity:getNormalSkillCount() function BattleUnitEntity:getNormalSkillCount()
return self.unitData.normalSkillCount or 0 return self.normalSkillCount
end
function BattleUnitEntity:getNormalSkillNameList()
local count = self.unitData.normalSkillCount or 0
if self.normalSkillNameList == nil then
self.normalSkillNameList = {}
for i = 1, count do
table.insert(self.normalSkillNameList, DataManager.BattleData:getNormalAttackName(i))
end
end
return self.normalSkillNameList, count
end end
function BattleUnitEntity:getPassiveSkills() function BattleUnitEntity:getPassiveSkills()