使用技能

This commit is contained in:
chenxi 2023-04-17 18:40:39 +08:00
parent 5977527c8d
commit 602983faee
12 changed files with 263 additions and 106 deletions

View File

@ -81,6 +81,7 @@ function ConfigManager:preLoadConfig()
local data = baseData[v.monster_base] local data = baseData[v.monster_base]
if data then if data then
monsterFullData[k].model_id = data.model_id monsterFullData[k].model_id = data.model_id
monsterFullData[k].hurt_num = data.hurt_num
-- else -- else
-- Logger.logHighlight("not data monster_baseid = " .. v.monster_baseid) -- Logger.logHighlight("not data monster_baseid = " .. v.monster_baseid)
end end

View File

@ -1,92 +1,122 @@
local monster_base = { local monster_base = {
[10001]={ [10001]={
["hurt_num"]=3,
["model_id"]="m10001" ["model_id"]="m10001"
}, },
[10002]={ [10002]={
["hurt_num"]=3,
["model_id"]="m10002" ["model_id"]="m10002"
}, },
[10003]={ [10003]={
["hurt_num"]=3,
["model_id"]="m10003" ["model_id"]="m10003"
}, },
[10004]={ [10004]={
["hurt_num"]=3,
["model_id"]="m10004" ["model_id"]="m10004"
}, },
[10005]={ [10005]={
["hurt_num"]=3,
["model_id"]="m10005" ["model_id"]="m10005"
}, },
[10006]={ [10006]={
["hurt_num"]=3,
["model_id"]="m10006" ["model_id"]="m10006"
}, },
[10007]={ [10007]={
["hurt_num"]=3,
["model_id"]="m10007" ["model_id"]="m10007"
}, },
[10008]={ [10008]={
["hurt_num"]=3,
["model_id"]="m10008" ["model_id"]="m10008"
}, },
[10009]={ [10009]={
["hurt_num"]=3,
["model_id"]="m10009" ["model_id"]="m10009"
}, },
[10010]={ [10010]={
["hurt_num"]=3,
["model_id"]="m10010" ["model_id"]="m10010"
}, },
[10011]={ [10011]={
["hurt_num"]=3,
["model_id"]="m10011" ["model_id"]="m10011"
}, },
[10012]={ [10012]={
["hurt_num"]=3,
["model_id"]="m10012" ["model_id"]="m10012"
}, },
[10013]={ [10013]={
["hurt_num"]=3,
["model_id"]="m10013" ["model_id"]="m10013"
}, },
[10014]={ [10014]={
["hurt_num"]=3,
["model_id"]="m10014" ["model_id"]="m10014"
}, },
[10015]={ [10015]={
["hurt_num"]=3,
["model_id"]="m10015" ["model_id"]="m10015"
}, },
[10016]={ [10016]={
["hurt_num"]=3,
["model_id"]="m10016" ["model_id"]="m10016"
}, },
[10017]={ [10017]={
["hurt_num"]=3,
["model_id"]="m10017" ["model_id"]="m10017"
}, },
[10018]={ [10018]={
["hurt_num"]=3,
["model_id"]="m10018" ["model_id"]="m10018"
}, },
[20001]={ [20001]={
["hurt_num"]=1,
["model_id"]="m0001" ["model_id"]="m0001"
}, },
[20002]={ [20002]={
["hurt_num"]=1,
["model_id"]="m0001" ["model_id"]="m0001"
}, },
[20003]={ [20003]={
["hurt_num"]=3,
["model_id"]="m0001" ["model_id"]="m0001"
}, },
[20004]={ [20004]={
["hurt_num"]=3,
["model_id"]="m0001" ["model_id"]="m0001"
}, },
[20005]={ [20005]={
["hurt_num"]=3,
["model_id"]="m0001" ["model_id"]="m0001"
}, },
[20006]={ [20006]={
["hurt_num"]=3,
["model_id"]="m0001" ["model_id"]="m0001"
}, },
[20007]={ [20007]={
["hurt_num"]=3,
["model_id"]="m0001" ["model_id"]="m0001"
}, },
[20008]={ [20008]={
["hurt_num"]=3,
["model_id"]="m0001" ["model_id"]="m0001"
}, },
[20009]={ [20009]={
["hurt_num"]=3,
["model_id"]="m0001" ["model_id"]="m0001"
}, },
[20010]={ [20010]={
["hurt_num"]=3,
["model_id"]="m0001" ["model_id"]="m0001"
}, },
[20011]={ [20011]={
["hurt_num"]=3,
["model_id"]="m0001" ["model_id"]="m0001"
}, },
[20012]={ [20012]={
["hurt_num"]=3,
["model_id"]="m0001" ["model_id"]="m0001"
} }
} }

View File

@ -181,7 +181,8 @@ local skill = {
}, },
["icon"]=10, ["icon"]=10,
["battle_icon"]=1, ["battle_icon"]=1,
["skill_position"]=1 ["skill_position"]=1,
["name_act"]="skill_01"
}, },
[220011]={ [220011]={
["energy"]=10, ["energy"]=10,
@ -201,7 +202,8 @@ local skill = {
} }
}, },
["obj"]=2, ["obj"]=2,
["skill_position"]=1 ["skill_position"]=1,
["name_act"]="skill_01"
}, },
[220012]={ [220012]={
["energy"]=10, ["energy"]=10,
@ -241,7 +243,8 @@ local skill = {
["round"]=0 ["round"]=0
} }
}, },
["skill_position"]=1 ["skill_position"]=1,
["name_act"]="skill_01"
}, },
[420011]={ [420011]={
["energy"]=10, ["energy"]=10,
@ -256,7 +259,8 @@ local skill = {
}, },
["icon"]=30, ["icon"]=30,
["battle_icon"]=3, ["battle_icon"]=3,
["skill_position"]=2 ["skill_position"]=2,
["name_act"]="skill_01"
}, },
[520011]={ [520011]={
["energy"]=10, ["energy"]=10,
@ -276,7 +280,8 @@ local skill = {
} }
}, },
["obj"]=1, ["obj"]=1,
["skill_position"]=2 ["skill_position"]=2,
["name_act"]="skill_01"
}, },
[120011]={ [120011]={
["energy"]=10, ["energy"]=10,
@ -295,7 +300,8 @@ local skill = {
}, },
["icon"]=50, ["icon"]=50,
["battle_icon"]=5, ["battle_icon"]=5,
["skill_position"]=2 ["skill_position"]=2,
["name_act"]="skill_01"
}, },
[330011]={ [330011]={
["energy"]=10, ["energy"]=10,
@ -315,7 +321,8 @@ local skill = {
} }
}, },
["obj"]=1, ["obj"]=1,
["skill_position"]=2 ["skill_position"]=2,
["name_act"]="skill_01"
}, },
[230011]={ [230011]={
["energy"]=10, ["energy"]=10,
@ -458,7 +465,8 @@ local skill = {
["round"]=1 ["round"]=1
} }
}, },
["skill_position"]=1 ["skill_position"]=1,
["name_act"]="skill_01"
}, },
[430012]={ [430012]={
["energy"]=10, ["energy"]=10,
@ -501,7 +509,8 @@ local skill = {
["round"]=1 ["round"]=1
} }
}, },
["skill_position"]=1 ["skill_position"]=1,
["name_act"]="skill_01"
}, },
[1000000]={ [1000000]={
["effect_type"]=1, ["effect_type"]=1,
@ -545,7 +554,8 @@ local skill = {
["obj"]=1, ["obj"]=1,
["skill_position"]=2, ["skill_position"]=2,
["cd"]=3, ["cd"]=3,
["cd_start"]=3 ["cd_start"]=3,
["name_act"]="skill_01"
}, },
[1000003]={ [1000003]={
["effect_type"]=1, ["effect_type"]=1,
@ -561,7 +571,8 @@ local skill = {
["obj"]=2, ["obj"]=2,
["skill_position"]=1, ["skill_position"]=1,
["cd"]=4, ["cd"]=4,
["cd_start"]=4 ["cd_start"]=4,
["name_act"]="skill_01"
}, },
[1000004]={ [1000004]={
["effect_type"]=1, ["effect_type"]=1,
@ -577,7 +588,8 @@ local skill = {
["obj"]=1, ["obj"]=1,
["skill_position"]=2, ["skill_position"]=2,
["cd"]=2, ["cd"]=2,
["cd_start"]=2 ["cd_start"]=2,
["name_act"]="skill_01"
}, },
[1000005]={ [1000005]={
["effect_type"]=2, ["effect_type"]=2,
@ -612,7 +624,8 @@ local skill = {
["obj"]=2, ["obj"]=2,
["skill_position"]=1, ["skill_position"]=1,
["cd"]=3, ["cd"]=3,
["cd_start"]=3 ["cd_start"]=3,
["name_act"]="skill_01"
}, },
[1000007]={ [1000007]={
["effect_type"]=2, ["effect_type"]=2,
@ -637,7 +650,8 @@ local skill = {
["obj"]=2, ["obj"]=2,
["skill_position"]=2, ["skill_position"]=2,
["cd"]=2, ["cd"]=2,
["cd_start"]=2 ["cd_start"]=2,
["name_act"]="skill_01"
}, },
[1000009]={ [1000009]={
["effect_type"]=2, ["effect_type"]=2,
@ -668,7 +682,8 @@ local skill = {
["obj"]=2, ["obj"]=2,
["skill_position"]=2, ["skill_position"]=2,
["cd"]=2, ["cd"]=2,
["cd_start"]=2 ["cd_start"]=2,
["name_act"]="skill_01"
}, },
[1000011]={ [1000011]={
["effect_type"]=1, ["effect_type"]=1,
@ -684,7 +699,8 @@ local skill = {
["obj"]=2, ["obj"]=2,
["skill_position"]=2, ["skill_position"]=2,
["cd"]=2, ["cd"]=2,
["cd_start"]=2 ["cd_start"]=2,
["name_act"]="skill_01"
}, },
[1000012]={ [1000012]={
["effect_type"]=2, ["effect_type"]=2,
@ -714,7 +730,8 @@ local skill = {
["obj"]=1, ["obj"]=1,
["skill_position"]=2, ["skill_position"]=2,
["cd"]=3, ["cd"]=3,
["cd_start"]=3 ["cd_start"]=3,
["name_act"]="skill_01"
}, },
[1000014]={ [1000014]={
["effect_type"]=2, ["effect_type"]=2,
@ -739,7 +756,8 @@ local skill = {
["obj"]=2, ["obj"]=2,
["skill_position"]=2, ["skill_position"]=2,
["cd"]=2, ["cd"]=2,
["cd_start"]=2 ["cd_start"]=2,
["name_act"]="skill_01"
}, },
[1000016]={ [1000016]={
["skill_type"]=3, ["skill_type"]=3,
@ -750,7 +768,8 @@ local skill = {
["obj"]=2, ["obj"]=2,
["skill_position"]=2, ["skill_position"]=2,
["cd"]=2, ["cd"]=2,
["cd_start"]=2 ["cd_start"]=2,
["name_act"]="skill_01"
}, },
[1000017]={ [1000017]={
["effect_type"]=2, ["effect_type"]=2,
@ -767,7 +786,7 @@ local skill = {
["skill_position"]=2 ["skill_position"]=2
}, },
[1000018]={ [1000018]={
["effect_type"]=1, ["effect_type"]=2,
["trigger"]=3, ["trigger"]=3,
["effect"]={ ["effect"]={
{ {
@ -796,7 +815,8 @@ local skill = {
["obj"]=1, ["obj"]=1,
["skill_position"]=2, ["skill_position"]=2,
["cd"]=3, ["cd"]=3,
["cd_start"]=3 ["cd_start"]=3,
["name_act"]="skill_01"
}, },
[1000020]={ [1000020]={
["effect_type"]=2, ["effect_type"]=2,
@ -821,10 +841,11 @@ local skill = {
["obj"]=2, ["obj"]=2,
["skill_position"]=2, ["skill_position"]=2,
["cd"]=2, ["cd"]=2,
["cd_start"]=2 ["cd_start"]=2,
["name_act"]="skill_01"
}, },
[1000022]={ [1000022]={
["effect_type"]=1, ["effect_type"]=2,
["trigger"]=3, ["trigger"]=3,
["effect"]={ ["effect"]={
{ {
@ -848,7 +869,8 @@ local skill = {
["obj"]=2, ["obj"]=2,
["skill_position"]=2, ["skill_position"]=2,
["cd"]=3, ["cd"]=3,
["cd_start"]=3 ["cd_start"]=3,
["name_act"]="skill_01"
}, },
[1000024]={ [1000024]={
["skill_type"]=3, ["skill_type"]=3,
@ -859,7 +881,8 @@ local skill = {
["obj"]=2, ["obj"]=2,
["skill_position"]=2, ["skill_position"]=2,
["cd"]=3, ["cd"]=3,
["cd_start"]=3 ["cd_start"]=3,
["name_act"]="skill_01"
}, },
[1000025]={ [1000025]={
["effect_type"]=2, ["effect_type"]=2,
@ -889,7 +912,8 @@ local skill = {
["obj"]=2, ["obj"]=2,
["skill_position"]=2, ["skill_position"]=2,
["cd"]=2, ["cd"]=2,
["cd_start"]=2 ["cd_start"]=2,
["name_act"]="skill_01"
}, },
[1000027]={ [1000027]={
["effect_type"]=2, ["effect_type"]=2,
@ -906,7 +930,7 @@ local skill = {
["skill_position"]=2 ["skill_position"]=2
}, },
[1000028]={ [1000028]={
["effect_type"]=1, ["effect_type"]=2,
["trigger"]=3, ["trigger"]=3,
["effect"]={ ["effect"]={
{ {

View File

@ -727,10 +727,16 @@ local skill_rogue = {
["weight"]=3000, ["weight"]=3000,
["qlt"]=2, ["qlt"]=2,
["type"]=3, ["type"]=3,
["parameter"]={
1000
},
["skill_position"]=3, ["skill_position"]=3,
["effect"]={
{
["type"]="atkp",
["num"]=1000,
["ratio"]=10000,
["round"]=1
}
},
["obj"]=1,
["icon"]=200102 ["icon"]=200102
}, },
[200103]={ [200103]={
@ -766,10 +772,16 @@ local skill_rogue = {
["weight"]=3000, ["weight"]=3000,
["qlt"]=2, ["qlt"]=2,
["type"]=3, ["type"]=3,
["parameter"]={
1000
},
["skill_position"]=2, ["skill_position"]=2,
["effect"]={
{
["type"]="atkp",
["num"]=1000,
["ratio"]=10000,
["round"]=1
}
},
["obj"]=1,
["icon"]=200202 ["icon"]=200202
}, },
[200203]={ [200203]={
@ -796,10 +808,16 @@ local skill_rogue = {
["weight"]=3000, ["weight"]=3000,
["qlt"]=2, ["qlt"]=2,
["type"]=11, ["type"]=11,
["parameter"]={
1000
},
["skill_position"]=4, ["skill_position"]=4,
["effect"]={
{
["type"]="atkp",
["num"]=1000,
["ratio"]=10000,
["round"]=1
}
},
["obj"]=1,
["icon"]=200302 ["icon"]=200302
}, },
[200303]={ [200303]={
@ -871,10 +889,16 @@ local skill_rogue = {
["weight"]=3000, ["weight"]=3000,
["qlt"]=2, ["qlt"]=2,
["type"]=3, ["type"]=3,
["parameter"]={
1000
},
["skill_position"]=1, ["skill_position"]=1,
["effect"]={
{
["type"]="atkp",
["num"]=1000,
["ratio"]=10000,
["round"]=1
}
},
["obj"]=1,
["icon"]=200502 ["icon"]=200502
}, },
[200503]={ [200503]={
@ -907,10 +931,16 @@ local skill_rogue = {
["weight"]=3000, ["weight"]=3000,
["qlt"]=2, ["qlt"]=2,
["type"]=3, ["type"]=3,
["parameter"]={
1000
},
["skill_position"]=3, ["skill_position"]=3,
["effect"]={
{
["type"]="atkp",
["num"]=1000,
["ratio"]=10000,
["round"]=1
}
},
["obj"]=1,
["icon"]=200602 ["icon"]=200602
}, },
[200603]={ [200603]={
@ -923,7 +953,7 @@ local skill_rogue = {
{ {
["type"]="heal", ["type"]="heal",
["num"]=500, ["num"]=500,
["ratio"]=1000, ["ratio"]=10000,
["round"]=1 ["round"]=1
} }
}, },
@ -946,10 +976,16 @@ local skill_rogue = {
["weight"]=3000, ["weight"]=3000,
["qlt"]=2, ["qlt"]=2,
["type"]=3, ["type"]=3,
["parameter"]={
1000
},
["skill_position"]=2, ["skill_position"]=2,
["effect"]={
{
["type"]="atkp",
["num"]=1000,
["ratio"]=10000,
["round"]=1
}
},
["obj"]=1,
["icon"]=200702 ["icon"]=200702
}, },
[200703]={ [200703]={
@ -979,10 +1015,16 @@ local skill_rogue = {
["weight"]=3000, ["weight"]=3000,
["qlt"]=2, ["qlt"]=2,
["type"]=3, ["type"]=3,
["parameter"]={
1000
},
["skill_position"]=4, ["skill_position"]=4,
["effect"]={
{
["type"]="atkp",
["num"]=1000,
["ratio"]=10000,
["round"]=1
}
},
["obj"]=1,
["icon"]=200802 ["icon"]=200802
}, },
[200803]={ [200803]={

View File

@ -103,11 +103,12 @@ function BattleUnitComp:getAnimationDuration(aniName)
return duration or 0 return duration or 0
end end
function BattleUnitComp:useSkill(index, callback) function BattleUnitComp:useSkill(index, count, callback)
self.actionOverCallback = callback self.actionOverCallback = callback
self.normalSkillCount = count + self.unitEntity:getNormalAttackAddCount()
self.activeSkillIndex = nil self.activeSkillIndex = nil
self.currActiveSkill = self.unitEntity:getActiveSkill(index) self.currActiveSkill = self.unitEntity:getActiveSkill(index)
if self.currActiveSkill == nil then if self.currActiveSkill == nil and self.normalSkillCount <= 0 then
self.actionOverCallback = nil self.actionOverCallback = nil
callback() callback()
return return
@ -120,23 +121,25 @@ end
function BattleUnitComp:useAllSkills(callback) function BattleUnitComp:useAllSkills(callback)
self.actionOverCallback = callback self.actionOverCallback = callback
self.normalSkillCount = self.unitEntity:getNormalSkillCount() + self.unitEntity:getNormalAttackAddCount()
self.activeSkillIndex = 1 self.activeSkillIndex = 1
self.currActiveSkill = self.unitEntity:getActiveSkill(self.activeSkillIndex) self.currActiveSkill = self.unitEntity:getActiveSkill(self.activeSkillIndex)
if self.currActiveSkill == nil then if self.currActiveSkill == nil then -- 没有技能就用普攻
if not self:changeState(UNIT_STATE.NORMAL_ATTACK) then
self.actionOverCallback = nil self.actionOverCallback = nil
callback() callback()
return
end end
else
if not self:changeState(UNIT_STATE.SKILL_ATTACK) then if not self:changeState(UNIT_STATE.SKILL_ATTACK) then
self.actionOverCallback = nil self.actionOverCallback = nil
callback() callback()
end end
end
end end
function BattleUnitComp:useNormalSkill(count, callback) function BattleUnitComp:useNormalSkill(count, callback)
self.baseObject:getTransform():SetAsLastSibling()
self.actionOverCallback = callback self.actionOverCallback = callback
self.normalSkillCount = count + self.unitEntity:getNormalAttackCount() self.normalSkillCount = count + self.unitEntity:getNormalAttackAddCount()
if not self:changeState(UNIT_STATE.NORMAL_ATTACK) then if not self:changeState(UNIT_STATE.NORMAL_ATTACK) then
self.actionOverCallback = nil self.actionOverCallback = nil
callback() callback()
@ -285,7 +288,7 @@ end
function BattleUnitComp:enterEnterBattlefieldState() function BattleUnitComp:enterEnterBattlefieldState()
self:hideOutsideScreen() self:hideOutsideScreen()
self.isMove = true self.isMove = true
self:playAnimation(SPINE_ANIMATION_NAME.MOVE, true, false) self:playAnimation(SPINE_ANIMATION_NAME.BORN, true, false)
self.positionX = self.baseObject:fastGetLocalPosition() self.positionX = self.baseObject:fastGetLocalPosition()
if self.side == BattleConst.SIDE_ATK then if self.side == BattleConst.SIDE_ATK then
self.targetX = -BattleConst.INIT_POS_X self.targetX = -BattleConst.INIT_POS_X
@ -389,7 +392,14 @@ function BattleUnitComp:updateSkillAttack(dt)
end end
else -- 到位置该攻击了 else -- 到位置该攻击了
self.attackTime = 0 self.attackTime = 0
local attackName = self.currActiveSkill:getSkillAttackName() self.currAttackKeyTime = 0.3
local attackName = nil
if self.normalSkillCount > 0 then
local skill = self.unitEntity:getNormalSkill()
attackName = skill:getRandomNormalAttackName()
else
attackName = self.currActiveSkill:getSkillAttackName()
end
self.currAttackDuration = self:getAnimationDuration(attackName) self.currAttackDuration = self:getAnimationDuration(attackName)
self:playAnimation(attackName, false, false) self:playAnimation(attackName, false, false)
end end
@ -400,6 +410,10 @@ function BattleUnitComp:updateSkillAttack(dt)
self.attackTime = self.attackTime + dt self.attackTime = self.attackTime + dt
if self.attackTime >= self.currAttackDuration then if self.attackTime >= self.currAttackDuration then
self.attackOver = true self.attackOver = true
if self.normalSkillCount > 0 then
self.normalSkillCount = self.normalSkillCount - 1
end
if self.normalSkillCount <= 0 then
local currActiveSkill = nil local currActiveSkill = nil
if self.activeSkillIndex then if self.activeSkillIndex then
self.activeSkillIndex = self.activeSkillIndex + 1 self.activeSkillIndex = self.activeSkillIndex + 1
@ -426,7 +440,7 @@ function BattleUnitComp:updateSkillAttack(dt)
end end
end end
return return
else -- 继续攻击 else
self.currActiveSkill = currActiveSkill self.currActiveSkill = currActiveSkill
self.attackTime = 0 self.attackTime = 0
self.currAttackKeyTime = 0.3 self.currAttackKeyTime = 0.3
@ -434,12 +448,25 @@ function BattleUnitComp:updateSkillAttack(dt)
self.currAttackDuration = self:getAnimationDuration(attackName) self.currAttackDuration = self:getAnimationDuration(attackName)
self:playAnimation(attackName, false, false) self:playAnimation(attackName, false, false)
end end
else -- 继续攻击
self.attackTime = 0
self.currAttackKeyTime = 0.3
local skill = self.unitEntity:getNormalSkill()
local attackName = skill:getRandomNormalAttackName()
self.currAttackDuration = self:getAnimationDuration(attackName)
self:playAnimation(attackName, false, false)
end
else else
if self.currAttackKeyTime > 0 and self.attackTime >= self.currAttackKeyTime then -- 到达关键后使用 if self.currAttackKeyTime > 0 and self.attackTime >= self.currAttackKeyTime then -- 到达关键后使用
self.currAttackKeyTime = 0 self.currAttackKeyTime = 0
if self.normalSkillCount > 0 then
local skill = self.unitEntity:getNormalSkill()
self:onSkillTakeEffect(skill)
else
self:onSkillTakeEffect(self.currActiveSkill) self:onSkillTakeEffect(self.currActiveSkill)
end end
end end
end
end end
function BattleUnitComp:enterNormalAttackState() function BattleUnitComp:enterNormalAttackState()
@ -487,6 +514,7 @@ function BattleUnitComp:updateNormalAttack(dt)
end end
else -- 到位置该攻击了 else -- 到位置该攻击了
self.attackTime = 0 self.attackTime = 0
self.currAttackKeyTime = 0.3
local skill = self.unitEntity:getNormalSkill() local skill = self.unitEntity:getNormalSkill()
local attackName = skill:getRandomNormalAttackName() local attackName = skill:getRandomNormalAttackName()
self.currAttackDuration = self:getAnimationDuration(attackName) self.currAttackDuration = self:getAnimationDuration(attackName)
@ -624,13 +652,9 @@ function BattleUnitComp:takeDamageOrCure(atker, buff, num, effectType, effectSta
self:showEffectNumber(num, x, y) self:showEffectNumber(num, x, y)
self.battleController:refreshHp(self.side, self.unitEntity:getHp(), self.unitEntity:getHpPercent()) self.battleController:refreshHp(self.side, self.unitEntity:getHp(), self.unitEntity:getHpPercent())
-- local shieldHp = self.unitEntity:getShieldHp() if self.currState == UNIT_STATE.IDLE then
-- if shieldHp and shieldHp.value > 0 then self:playHurt()
-- local percent = self.unitEntity:getShieldHpPercent() end
-- self.controlUnitComp:RefreshShieldBar(percent, true)
-- else
-- self.controlUnitComp:RefreshShieldBar(0, false)
-- end
end end
function BattleUnitComp:showEffectNumber(num, x, y) function BattleUnitComp:showEffectNumber(num, x, y)

View File

@ -1233,7 +1233,7 @@ local function _generalAttack(self, instruction, callback)
end end
local function _playSkill(self, instruction, callback) local function _playSkill(self, instruction, callback)
self.atkTeam:useSkill(instruction.skillMatch, callback) self.atkTeam:useSkill(instruction.skillMatch, instruction.count, callback)
end end
BattleController._doInstruction = { BattleController._doInstruction = {

View File

@ -44,7 +44,7 @@ function BattleTeam:useNormalSkill(matchType, count, callback)
unit:useNormalSkill(count, callback) unit:useNormalSkill(count, callback)
end end
function BattleTeam:useSkill(matchType, callback) function BattleTeam:useSkill(matchType, count, callback)
local unit = nil local unit = nil
if matchType == nil then if matchType == nil then
unit = self.unitList[1] unit = self.unitList[1]
@ -55,7 +55,7 @@ function BattleTeam:useSkill(matchType, callback)
return callback() return callback()
end end
self.mainUnit = unit self.mainUnit = unit
unit:useSkill(1, callback) unit:useSkill(1, count, callback)
end end
function BattleTeam:mainUnitUseAllSkills(callback) function BattleTeam:mainUnitUseAllSkills(callback)

View File

@ -377,6 +377,7 @@ function BattleData:initHeroData()
matchType = matchType, matchType = matchType,
normalSkill = heroEntity:getHurtSkill(), normalSkill = heroEntity:getHurtSkill(),
activeSkills = {activeSkill}, activeSkills = {activeSkill},
normalSkillCount = heroEntity:getHurtNum(),
attr = { attr = {
hp = hp, hp = hp,
max_hp = hp, max_hp = hp,
@ -409,6 +410,7 @@ function BattleData:addMonster(monsterId, newTeam)
matchType = 0, matchType = 0,
normalSkill = monsterInfo.hurt_skill, normalSkill = monsterInfo.hurt_skill,
activeSkills = monsterInfo.skill, activeSkills = monsterInfo.skill,
normalSkillCount = monsterInfo.hurt_num,
attr = { attr = {
hp = hp, hp = hp,
max_hp = hp, max_hp = hp,
@ -426,4 +428,16 @@ function BattleData:addMonster(monsterId, newTeam)
return self.defTeam:addUnit(unitData) return self.defTeam:addUnit(unitData)
end end
function BattleData:getNormalAttackName(index)
if self.normalAttackName == nil then
self.normalAttackName = {}
end
local name = self.normalAttackName[index]
if name == nil then
name = string.format("attack%02d", index)
self.normalAttackName[index] = name
end
return name
end
return BattleData return BattleData

View File

@ -31,7 +31,11 @@ end
function BattleSkillEntity:getRandomNormalAttackName() function BattleSkillEntity:getRandomNormalAttackName()
if self.normalSkillNameList == nil then if self.normalSkillNameList == nil then
self.normalSkillNameList = {"attack01", "attack02", "attack03"} local normalSkillNameList, count = self.owner:getNormalSkillNameList()
self.normalSkillNameList = {}
for i = 1, count do
self.normalSkillNameList[i] = normalSkillNameList[i]
end
end end
if self.normalSkillNameIndex == nil then if self.normalSkillNameIndex == nil then
self.normalSkillNameIndex = math.random(1, #self.normalSkillNameList) self.normalSkillNameIndex = math.random(1, #self.normalSkillNameList)
@ -45,8 +49,7 @@ function BattleSkillEntity:getRandomNormalAttackName()
end end
function BattleSkillEntity:getSkillAttackName() function BattleSkillEntity:getSkillAttackName()
-- return self.skillInfo.name_act return self.skillInfo.name_act
return "attack01"
end end
function BattleSkillEntity:getEffectList() function BattleSkillEntity:getEffectList()

View File

@ -161,7 +161,7 @@ function BattleTeamEntity:getCureAddition()
return self.attr.cure_addition or 0 return self.attr.cure_addition or 0
end end
function BattleTeamEntity:getNormalAttackCount() function BattleTeamEntity:getNormalAttackAddCount()
return self.attr[ATTR_NAME.NORMAL_ATTACK_COUNT] or 0 return self.attr[ATTR_NAME.NORMAL_ATTACK_COUNT] or 0
end end

View File

@ -57,6 +57,21 @@ function BattleUnitEntity:getActiveSkill(index)
return self.activeSkills[index] return self.activeSkills[index]
end end
function BattleUnitEntity:getNormalSkillCount()
return self.unitData.normalSkillCount or 0
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
function BattleUnitEntity:takeDamageOrCure(num) function BattleUnitEntity:takeDamageOrCure(num)
return self.team:takeDamageOrCure(num) return self.team:takeDamageOrCure(num)
end end
@ -97,8 +112,8 @@ function BattleUnitEntity:getCureAddition()
return self.team:getCureAddition() return self.team:getCureAddition()
end end
function BattleUnitEntity:getNormalAttackCount() function BattleUnitEntity:getNormalAttackAddCount()
return self.team:getNormalAttackCount() return self.team:getNormalAttackAddCount()
end end
function BattleUnitEntity:addLimit(name) function BattleUnitEntity:addLimit(name)

View File

@ -197,6 +197,10 @@ function HeroEntity:getIcon()
return self.config.icon return self.config.icon
end end
function HeroEntity:getHurtNum()
return self.config.hurt_num
end
function HeroEntity:getName() function HeroEntity:getName()
return I18N:getConfig("hero")[self:getCfgId()].name return I18N:getConfig("hero")[self:getCfgId()].name
end end