Merge branch 'dev' of http://git.juzugame.com/b6-client/b6-lua into dev
This commit is contained in:
commit
8641c42a20
@ -38,6 +38,13 @@ BattleConst.BATTLE_ROUND_STEP = {
|
|||||||
ON_END = 10, -- 回合结束
|
ON_END = 10, -- 回合结束
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BattleConst.TIME_SCALE = {
|
||||||
|
LEVEL_0 = 0,
|
||||||
|
LEVEL_1 = 1,
|
||||||
|
LEVEL_2 = 1.5,
|
||||||
|
LEVEL_3 = 2,
|
||||||
|
}
|
||||||
|
|
||||||
-- 为方便存储,这里使用字符串
|
-- 为方便存储,这里使用字符串
|
||||||
BattleConst.BATTLE_TYPE = {
|
BattleConst.BATTLE_TYPE = {
|
||||||
STAGE = "1",
|
STAGE = "1",
|
||||||
@ -129,6 +136,7 @@ BattleConst.PASSIVE_EVENT = {
|
|||||||
ON_UNIT_PREPARE_OVER = 2, -- 新单位出场时
|
ON_UNIT_PREPARE_OVER = 2, -- 新单位出场时
|
||||||
ON_UNI_ATTACK_START = 3, -- 攻击开始前
|
ON_UNI_ATTACK_START = 3, -- 攻击开始前
|
||||||
HP_LOWER_THAN = 4, -- 血量低于X%
|
HP_LOWER_THAN = 4, -- 血量低于X%
|
||||||
|
USE_NORMAL_SKILL = 5, -- 使用普攻
|
||||||
}
|
}
|
||||||
|
|
||||||
local BUFF_NAME = {
|
local BUFF_NAME = {
|
||||||
|
|||||||
@ -67,6 +67,7 @@ function BattleUnitComp:_initBase()
|
|||||||
self.currActiveSkill = nil
|
self.currActiveSkill = nil
|
||||||
self.targetX = nil
|
self.targetX = nil
|
||||||
self.assistingDmgAddition = 0
|
self.assistingDmgAddition = 0
|
||||||
|
self.attackCount = 0
|
||||||
self.currState = UNIT_STATE.INIT
|
self.currState = UNIT_STATE.INIT
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -88,6 +89,10 @@ function BattleUnitComp:prepare()
|
|||||||
self:checkPassiveEvent(PASSIVE_EVENT.HP_LOWER_THAN, nil, self.unitEntity:getHpPercent())
|
self:checkPassiveEvent(PASSIVE_EVENT.HP_LOWER_THAN, nil, self.unitEntity:getHpPercent())
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleUnitComp:resetBeforeAttack()
|
||||||
|
self.attackCount = 0
|
||||||
|
end
|
||||||
|
|
||||||
function BattleUnitComp:initPassiveSkills()
|
function BattleUnitComp:initPassiveSkills()
|
||||||
local pasSkills = self.unitEntity:getPassiveSkills()
|
local pasSkills = self.unitEntity:getPassiveSkills()
|
||||||
if pasSkills and #pasSkills > 0 then
|
if pasSkills and #pasSkills > 0 then
|
||||||
@ -503,6 +508,7 @@ function BattleUnitComp:enterAssistingAttackState()
|
|||||||
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)
|
||||||
|
self:attackAndSpeedUp()
|
||||||
self:initPosition()
|
self:initPosition()
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -564,6 +570,7 @@ function BattleUnitComp:enterSkillAttackState()
|
|||||||
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)
|
||||||
|
self:attackAndSpeedUp()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -695,12 +702,22 @@ function BattleUnitComp:onAttackOver()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleUnitComp:attackAndSpeedUp()
|
||||||
|
self.attackCount = self.attackCount + 1
|
||||||
|
if self.attackCount == 3 then
|
||||||
|
DataManager.BattleData:addTimeSpeed()
|
||||||
|
elseif self.attackCount == 5 then
|
||||||
|
DataManager.BattleData:addTimeSpeed()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function BattleUnitComp:doNextSkillAttack()
|
function BattleUnitComp:doNextSkillAttack()
|
||||||
self.attackTime = 0
|
self.attackTime = 0
|
||||||
local attackName = self.currActiveSkill:getSkillAttackName()
|
local attackName = self.currActiveSkill: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)
|
||||||
|
self:attackAndSpeedUp()
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleUnitComp:doNextNormalAttack()
|
function BattleUnitComp:doNextNormalAttack()
|
||||||
@ -710,6 +727,7 @@ function BattleUnitComp:doNextNormalAttack()
|
|||||||
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)
|
||||||
|
self:attackAndSpeedUp()
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleUnitComp:doNextAttack()
|
function BattleUnitComp:doNextAttack()
|
||||||
@ -725,6 +743,7 @@ function BattleUnitComp:doNextAttack()
|
|||||||
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)
|
||||||
|
self:attackAndSpeedUp()
|
||||||
else -- 归位
|
else -- 归位
|
||||||
self:moveBackToInitPosition()
|
self:moveBackToInitPosition()
|
||||||
end
|
end
|
||||||
@ -753,6 +772,7 @@ function BattleUnitComp:enterNormalAttackState()
|
|||||||
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)
|
||||||
|
self:attackAndSpeedUp()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -812,9 +832,6 @@ end
|
|||||||
|
|
||||||
function BattleUnitComp:onSkillTakeEffect(skill)
|
function BattleUnitComp:onSkillTakeEffect(skill)
|
||||||
skill:endUse()
|
skill:endUse()
|
||||||
if self.side == GConst.BattleConst.SIDE_ATK and skill == self.unitEntity:getNormalSkill() then
|
|
||||||
self.battleController:addBattleExp(self.side)
|
|
||||||
end
|
|
||||||
local effectList = skill:getEffectList()
|
local effectList = skill:getEffectList()
|
||||||
if effectList == nil then
|
if effectList == nil then
|
||||||
return
|
return
|
||||||
@ -825,6 +842,14 @@ function BattleUnitComp:onSkillTakeEffect(skill)
|
|||||||
target = self
|
target = self
|
||||||
else
|
else
|
||||||
target = self.battleController:getOtherSideMainUnit(self.side)
|
target = self.battleController:getOtherSideMainUnit(self.side)
|
||||||
|
if skill:getIsNormalType() then -- 普攻要计算一下格挡
|
||||||
|
local block = target.unitEntity:getBlock()
|
||||||
|
if block > 0 then
|
||||||
|
if BattleHelper:random(1, DEFAULT_FACTOR) <= block then -- 格挡成功
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local succ = false
|
local succ = false
|
||||||
@ -833,6 +858,9 @@ function BattleUnitComp:onSkillTakeEffect(skill)
|
|||||||
succ = true
|
succ = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if succ and skill:getIsNormalType() then -- 普攻攻击成功的话
|
||||||
|
self:checkPassiveEvent(PASSIVE_EVENT.USE_NORMAL_SKILL, target)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleUnitComp:takeEffect(buff, target)
|
function BattleUnitComp:takeEffect(buff, target)
|
||||||
@ -887,7 +915,13 @@ function BattleUnitComp:takeDamageOrCure(atker, buff, num, effectType, effectSta
|
|||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
local shieldHpBefore = self.unitEntity:getShieldHp()
|
local shieldHpBefore = self.unitEntity:getShieldHp()
|
||||||
self.unitEntity:takeDamageOrCure(num)
|
local hpRealReduce = self.unitEntity:takeDamageOrCure(num)
|
||||||
|
if hpRealReduce < 0 and self.side == BattleConst.SIDE_DEF then -- 实际掉血了
|
||||||
|
local exp = self.unitEntity:getExp()
|
||||||
|
if exp > 0 then
|
||||||
|
self.battleController:addBattleExp(math.floor(exp/self.unitEntity:getMaxHp()*-hpRealReduce))
|
||||||
|
end
|
||||||
|
end
|
||||||
local shieldHpDiff = self.unitEntity:getShieldHp() - shieldHpBefore
|
local shieldHpDiff = self.unitEntity:getShieldHp() - shieldHpBefore
|
||||||
if shieldHpDiff < 0 then -- 说明护盾减少了
|
if shieldHpDiff < 0 then -- 说明护盾减少了
|
||||||
self:handleShield(shieldHpDiff, self)
|
self:handleShield(shieldHpDiff, self)
|
||||||
|
|||||||
@ -148,11 +148,23 @@ function BattleController:init(params)
|
|||||||
BattleScheduler:init()
|
BattleScheduler:init()
|
||||||
BattleHelper:init()
|
BattleHelper:init()
|
||||||
BattlePassive:init()
|
BattlePassive:init()
|
||||||
|
self:setTimeScale(DataManager.BattleData:getTimeScale())
|
||||||
|
self:bindData()
|
||||||
self:initBattleTeam()
|
self:initBattleTeam()
|
||||||
self:initOther()
|
self:initOther()
|
||||||
self:prepareFight()
|
self:prepareFight()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleController:bindData()
|
||||||
|
DataManager.BattleData:bind("timeSpeed", ModuleManager.BattleManager, function()
|
||||||
|
self:setTimeScale(DataManager.BattleData:getTimeScale())
|
||||||
|
end, false)
|
||||||
|
end
|
||||||
|
|
||||||
|
function BattleController:unBindAll()
|
||||||
|
DataManager.BattleData:unBind("timeSpeed", ModuleManager.BattleManager)
|
||||||
|
end
|
||||||
|
|
||||||
function BattleController:initBattleTeam()
|
function BattleController:initBattleTeam()
|
||||||
self.atkTeam = BattleTeam:create()
|
self.atkTeam = BattleTeam:create()
|
||||||
self.atkTeam:init(BattleConst.SIDE_ATK, self)
|
self.atkTeam:init(BattleConst.SIDE_ATK, self)
|
||||||
@ -245,6 +257,12 @@ function BattleController:battleStart()
|
|||||||
self:enterNextWave()
|
self:enterNextWave()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleController:setTimeScale(timeScale)
|
||||||
|
GFunc.setDOTweenTimeScale(GConst.DOTWEEN_IDS.BATTLE, timeScale)
|
||||||
|
BattleScheduler:setTimeScale(timeScale)
|
||||||
|
BattleHelper:setTimeScale(timeScale)
|
||||||
|
end
|
||||||
|
|
||||||
---- start 回合步骤
|
---- start 回合步骤
|
||||||
|
|
||||||
function BattleController:enterNextWave()
|
function BattleController:enterNextWave()
|
||||||
@ -366,6 +384,7 @@ function BattleController:enterRefreshBoard()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function BattleController:enterRoundEnd()
|
function BattleController:enterRoundEnd()
|
||||||
|
DataManager.BattleData:resetTimeSpeed()
|
||||||
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_END
|
self.roundStep = BattleConst.BATTLE_ROUND_STEP.ON_END
|
||||||
local defTeam = self.battleData:getDefTeam()
|
local defTeam = self.battleData:getDefTeam()
|
||||||
if not defTeam or defTeam:getIsDead() then -- 怪物死了, 直接进入刷新逻辑
|
if not defTeam or defTeam:getIsDead() then -- 怪物死了, 直接进入刷新逻辑
|
||||||
@ -1402,6 +1421,8 @@ function BattleController:clear()
|
|||||||
BattleScheduler:clear()
|
BattleScheduler:clear()
|
||||||
BattleHelper:clear()
|
BattleHelper:clear()
|
||||||
BattlePassive:clear()
|
BattlePassive:clear()
|
||||||
|
self:unBindAll()
|
||||||
|
DataManager.BattleData:resetTimeSpeed()
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleController:endBattleAndExit()
|
function BattleController:endBattleAndExit()
|
||||||
|
|||||||
@ -12,6 +12,19 @@ function BattleHelper:init()
|
|||||||
self.seed = tonumber(tostring(os.time()):reverse():sub(1,6))
|
self.seed = tonumber(tostring(os.time()):reverse():sub(1,6))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleHelper:setTimeScale(timeScale)
|
||||||
|
if self.effectMap then
|
||||||
|
for k, effect in pairs(self.effectMap) do
|
||||||
|
effect:setTimeScale(timeScale)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if self.characterMap then
|
||||||
|
for k, character in pairs(self.characterMap) do
|
||||||
|
character:setTimeScale(timeScale)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function BattleHelper:random(min, max)
|
function BattleHelper:random(min, max)
|
||||||
self.seed = (self.seed*9301 + 49297)%233280
|
self.seed = (self.seed*9301 + 49297)%233280
|
||||||
return min + self.seed*(max - min + 1)//233280
|
return min + self.seed*(max - min + 1)//233280
|
||||||
@ -25,12 +38,16 @@ function BattleHelper:loadBattleHeroModel(id, parent, callback)
|
|||||||
if self.characterMap then
|
if self.characterMap then
|
||||||
self.characterMap[spineObject:getInstanceID()] = spineObject
|
self.characterMap[spineObject:getInstanceID()] = spineObject
|
||||||
end
|
end
|
||||||
|
local timeScale = DataManager.BattleData:getTimeScale()
|
||||||
|
spineObject:setTimeScale(timeScale)
|
||||||
callback(spineObject)
|
callback(spineObject)
|
||||||
else
|
else
|
||||||
SpineManager:loadHeroAsync(id, parent, function(spineObject)
|
SpineManager:loadHeroAsync(id, parent, function(spineObject)
|
||||||
spineObject:setDefaultMix(0)
|
spineObject:setDefaultMix(0)
|
||||||
if self.characterMap then
|
if self.characterMap then
|
||||||
self.characterMap[spineObject:getInstanceID()] = spineObject
|
self.characterMap[spineObject:getInstanceID()] = spineObject
|
||||||
|
local timeScale = DataManager.BattleData:getTimeScale()
|
||||||
|
spineObject:setTimeScale(timeScale)
|
||||||
callback(spineObject)
|
callback(spineObject)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|||||||
@ -41,10 +41,15 @@ local function _checkhpLowerThan(unitComp, skill, targetComp, hpPercent)
|
|||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function _checkUseNormalSkill(unitComp, skill, targetComp)
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
BattlePassive.checkTrigger = {
|
BattlePassive.checkTrigger = {
|
||||||
[PASSIVE_EVENT.ON_UNIT_PREPARE_OVER] = _checkOnUnitPrepareOver,
|
[PASSIVE_EVENT.ON_UNIT_PREPARE_OVER] = _checkOnUnitPrepareOver,
|
||||||
[PASSIVE_EVENT.ON_UNI_ATTACK_START] = _checkOnUniAttackStart,
|
[PASSIVE_EVENT.ON_UNI_ATTACK_START] = _checkOnUniAttackStart,
|
||||||
[PASSIVE_EVENT.HP_LOWER_THAN] = _checkhpLowerThan,
|
[PASSIVE_EVENT.HP_LOWER_THAN] = _checkhpLowerThan,
|
||||||
|
[PASSIVE_EVENT.USE_NORMAL_SKILL] = _checkUseNormalSkill,
|
||||||
}
|
}
|
||||||
|
|
||||||
return BattlePassive
|
return BattlePassive
|
||||||
@ -56,6 +56,7 @@ function BattleTeam:useNormalSkill(matchType, count, callback)
|
|||||||
self.mainUnit = unit
|
self.mainUnit = unit
|
||||||
self.battleController:setIsPauseHpProgress(true)
|
self.battleController:setIsPauseHpProgress(true)
|
||||||
unit:beforeAttack()
|
unit:beforeAttack()
|
||||||
|
unit:resetBeforeAttack()
|
||||||
unit:useNormalSkill(count, callback)
|
unit:useNormalSkill(count, callback)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -72,6 +73,7 @@ function BattleTeam:useSkill(matchType, count, callback)
|
|||||||
self.mainUnit = unit
|
self.mainUnit = unit
|
||||||
self.battleController:setIsPauseHpProgress(true)
|
self.battleController:setIsPauseHpProgress(true)
|
||||||
unit:beforeAttack()
|
unit:beforeAttack()
|
||||||
|
unit:resetBeforeAttack()
|
||||||
unit:useSkill(1, count, callback)
|
unit:useSkill(1, count, callback)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -89,6 +91,7 @@ function BattleTeam:useAssistingSkill(assistingList, callback)
|
|||||||
for _, v in ipairs(assistingList) do
|
for _, v in ipairs(assistingList) do
|
||||||
local unit = self.unitMap[v.skillMatch]
|
local unit = self.unitMap[v.skillMatch]
|
||||||
if unit then
|
if unit then
|
||||||
|
unit:resetBeforeAttack()
|
||||||
unit:useAssistingSkill(v.count, finish)
|
unit:useAssistingSkill(v.count, finish)
|
||||||
else
|
else
|
||||||
finish()
|
finish()
|
||||||
@ -99,6 +102,7 @@ end
|
|||||||
function BattleTeam:mainUnitUseAllSkills(callback)
|
function BattleTeam:mainUnitUseAllSkills(callback)
|
||||||
self.battleController:setIsPauseHpProgress(true)
|
self.battleController:setIsPauseHpProgress(true)
|
||||||
self.mainUnit:beforeAttack()
|
self.mainUnit:beforeAttack()
|
||||||
|
self.mainUnit:resetBeforeAttack()
|
||||||
self.mainUnit:useAllSkills(callback)
|
self.mainUnit:useAllSkills(callback)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -17,6 +17,8 @@ function BattleData:init()
|
|||||||
self.curBattleExp = 0
|
self.curBattleExp = 0
|
||||||
self.needBattleExp = self:getLvNeedExp()
|
self.needBattleExp = self:getLvNeedExp()
|
||||||
self.addLvCount = 0
|
self.addLvCount = 0
|
||||||
|
self.timeScale = BattleConst.TIME_SCALE.LEVEL_1
|
||||||
|
self.data.timeSpeed = 1
|
||||||
self.data.lvDirty = false
|
self.data.lvDirty = false
|
||||||
BattleSkillEntity.sid = 0
|
BattleSkillEntity.sid = 0
|
||||||
self.atkTeam = self:initTeam(BattleConst.SIDE_ATK)
|
self.atkTeam = self:initTeam(BattleConst.SIDE_ATK)
|
||||||
@ -24,6 +26,68 @@ function BattleData:init()
|
|||||||
self:initRogueSkills()
|
self:initRogueSkills()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleData:getTimeScale()
|
||||||
|
return self.timeScale
|
||||||
|
end
|
||||||
|
|
||||||
|
function BattleData:pauseBattle()
|
||||||
|
self.cacheSpeed = self.data.timeSpeed
|
||||||
|
self:setTimeSpeed(0)
|
||||||
|
end
|
||||||
|
|
||||||
|
function BattleData:resumeBattle()
|
||||||
|
if self.cacheSpeed == nil then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if self.data.timeSpeed ~= 0 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self:setTimeSpeed(self.cacheSpeed or 1)
|
||||||
|
end
|
||||||
|
|
||||||
|
function BattleData:resetTimeSpeed()
|
||||||
|
if self.cacheSpeed then -- 目前处于暂停状态
|
||||||
|
self.cacheSpeed = 1
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if self.data.timeSpeed <= 1 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self:setTimeSpeed(1)
|
||||||
|
end
|
||||||
|
|
||||||
|
function BattleData:addTimeSpeed()
|
||||||
|
if self.data.timeSpeed >= 3 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if self.cacheSpeed then -- 目前处于暂停状态
|
||||||
|
if self.cacheSpeed < 3 then
|
||||||
|
self.cacheSpeed = self.cacheSpeed + 1
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local timeSpeed = self.data.timeSpeed + 1
|
||||||
|
self:setTimeSpeed(timeSpeed)
|
||||||
|
end
|
||||||
|
|
||||||
|
function BattleData:setTimeSpeed(timeSpeed)
|
||||||
|
if timeSpeed == self.data.timeSpeed then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if timeSpeed == 0 then
|
||||||
|
self.timeScale = 0
|
||||||
|
elseif timeSpeed == 1 then
|
||||||
|
self.timeScale = BattleConst.TIME_SCALE.LEVEL_1
|
||||||
|
elseif timeSpeed == 2 then
|
||||||
|
self.timeScale = BattleConst.TIME_SCALE.LEVEL_2
|
||||||
|
elseif timeSpeed == 3 then
|
||||||
|
self.timeScale = BattleConst.TIME_SCALE.LEVEL_3
|
||||||
|
else
|
||||||
|
self.timeScale = BattleConst.TIME_SCALE.LEVEL_1
|
||||||
|
end
|
||||||
|
self.data.timeSpeed = timeSpeed
|
||||||
|
end
|
||||||
|
|
||||||
function BattleData:initRogueSkills()
|
function BattleData:initRogueSkills()
|
||||||
self.skillPool = {}
|
self.skillPool = {}
|
||||||
self.skillMap = {}
|
self.skillMap = {}
|
||||||
@ -416,6 +480,7 @@ function BattleData:addMonster(monsterId, newTeam)
|
|||||||
normalSkillCount = monsterInfo.hurt_num,
|
normalSkillCount = monsterInfo.hurt_num,
|
||||||
assistingSkill = nil,
|
assistingSkill = nil,
|
||||||
isBoss = monsterInfo.is_boss,
|
isBoss = monsterInfo.is_boss,
|
||||||
|
exp = monsterInfo.monster_exp or 0,
|
||||||
attr = {
|
attr = {
|
||||||
hp = hp,
|
hp = hp,
|
||||||
max_hp = hp,
|
max_hp = hp,
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
local BattleBuffEntity = require "app/userdata/battle/skill/battle_buff_entity"
|
local BattleBuffEntity = require "app/userdata/battle/skill/battle_buff_entity"
|
||||||
|
local BattleConst = require "app/module/battle/battle_const"
|
||||||
|
|
||||||
local BattleSkillEntity = class("BattleSkillEntity", BaseData)
|
local BattleSkillEntity = class("BattleSkillEntity", BaseData)
|
||||||
|
|
||||||
@ -104,7 +105,11 @@ function BattleSkillEntity:getSkillid()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function BattleSkillEntity:getIsPassiveType()
|
function BattleSkillEntity:getIsPassiveType()
|
||||||
return self.skillType == GConst.BattleConst.SKILL_TYPE_PASSIVE
|
return self.skillType == BattleConst.SKILL_TYPE_PASSIVE
|
||||||
|
end
|
||||||
|
|
||||||
|
function BattleSkillEntity:getIsNormalType()
|
||||||
|
return self.skillType == BattleConst.SKILL_TYPE_NORMAL
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleSkillEntity:changeSkillId(skillId)
|
function BattleSkillEntity:changeSkillId(skillId)
|
||||||
|
|||||||
@ -129,6 +129,10 @@ function BattleTeamEntity:getHp()
|
|||||||
return self.attr.hp
|
return self.attr.hp
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleTeamEntity:getMaxHp()
|
||||||
|
return self.attr.max_hp
|
||||||
|
end
|
||||||
|
|
||||||
function BattleTeamEntity:getHpPercent()
|
function BattleTeamEntity:getHpPercent()
|
||||||
return self.attr.hp / self.attr.max_hp
|
return self.attr.hp / self.attr.max_hp
|
||||||
end
|
end
|
||||||
@ -191,6 +195,10 @@ function BattleTeamEntity:getShieldHp()
|
|||||||
return self.shieldHp
|
return self.shieldHp
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleTeamEntity:getBlock()
|
||||||
|
return self.attr.block or 0
|
||||||
|
end
|
||||||
|
|
||||||
function BattleTeamEntity:takeDamageOrCure(num)
|
function BattleTeamEntity:takeDamageOrCure(num)
|
||||||
if self.isDead then
|
if self.isDead then
|
||||||
return 0
|
return 0
|
||||||
@ -212,7 +220,7 @@ function BattleTeamEntity:takeDamageOrCure(num)
|
|||||||
hurtEventNum = num
|
hurtEventNum = num
|
||||||
else -- 满血了
|
else -- 满血了
|
||||||
-- 这是加血
|
-- 这是加血
|
||||||
hurtEventNum = 0
|
hurtEventNum = self.attr.max_hp - hpBefore
|
||||||
self.attr.hp = self.attr.max_hp
|
self.attr.hp = self.attr.max_hp
|
||||||
end
|
end
|
||||||
return hurtEventNum
|
return hurtEventNum
|
||||||
|
|||||||
@ -177,6 +177,10 @@ function BattleUnitEntity:getHp()
|
|||||||
return self.team:getHp()
|
return self.team:getHp()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleUnitEntity:getMaxHp()
|
||||||
|
return self.team:getMaxHp()
|
||||||
|
end
|
||||||
|
|
||||||
function BattleUnitEntity:getHpPercent()
|
function BattleUnitEntity:getHpPercent()
|
||||||
return self.team:getHpPercent()
|
return self.team:getHpPercent()
|
||||||
end
|
end
|
||||||
@ -233,6 +237,14 @@ function BattleUnitEntity:addMaxHp(num)
|
|||||||
self.team:addMaxHp(num)
|
self.team:addMaxHp(num)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleUnitEntity:getBlock()
|
||||||
|
return self.team:getBlock()
|
||||||
|
end
|
||||||
|
|
||||||
|
function BattleUnitEntity:getExp()
|
||||||
|
return self.unitData.exp
|
||||||
|
end
|
||||||
|
|
||||||
function BattleUnitEntity:addSkillExtraUseTimes(skillId, count)
|
function BattleUnitEntity:addSkillExtraUseTimes(skillId, count)
|
||||||
if self.skillExtraUseTimes == nil then
|
if self.skillExtraUseTimes == nil then
|
||||||
self.skillExtraUseTimes = {}
|
self.skillExtraUseTimes = {}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user