被动、buff触发时机
This commit is contained in:
parent
6596d89003
commit
82d95ee5fd
@ -209,7 +209,10 @@ BattleConst.PASSIVE_EVENT = {
|
|||||||
HP_LOWER_THAN = 4, -- 血量低于X%
|
HP_LOWER_THAN = 4, -- 血量低于X%
|
||||||
USE_NORMAL_SKILL = 5, -- 使用普攻
|
USE_NORMAL_SKILL = 5, -- 使用普攻
|
||||||
ACTIVE_SKILL_HIT = 6, -- 主动技能命中
|
ACTIVE_SKILL_HIT = 6, -- 主动技能命中
|
||||||
ON_DEAD = 7, -- 死亡时
|
ON_NORAML_SKILL_OVER = 7, -- 普攻结束后
|
||||||
|
ON_DEAD_BY_BURN = 8, -- 有敌人死于灼烧伤害时触发
|
||||||
|
ON_DEAD_BY_SKILL = 9, -- 有敌人死于技能时触发
|
||||||
|
ON_DEAD = 10, -- 死亡时
|
||||||
}
|
}
|
||||||
|
|
||||||
local BUFF_NAME = {
|
local BUFF_NAME = {
|
||||||
|
|||||||
@ -336,6 +336,7 @@ function BattleUnitComp:useSkill(index, count, callback)
|
|||||||
end
|
end
|
||||||
if count <= 0 then
|
if count <= 0 then
|
||||||
self.normalSkillCount = 0
|
self.normalSkillCount = 0
|
||||||
|
self:checkPassiveEvent(PASSIVE_EVENT.ON_NORAML_SKILL_OVER, self)
|
||||||
else
|
else
|
||||||
self.normalSkillCount = count + self.unitEntity:getNormalAttackAddCount()
|
self.normalSkillCount = count + self.unitEntity:getNormalAttackAddCount()
|
||||||
end
|
end
|
||||||
@ -855,6 +856,7 @@ function BattleUnitComp:updateSkillAttack(dt)
|
|||||||
self.currActiveSkill:startUse()
|
self.currActiveSkill:startUse()
|
||||||
self:doNextSkillAttack()
|
self:doNextSkillAttack()
|
||||||
end
|
end
|
||||||
|
self:checkPassiveEvent(PASSIVE_EVENT.ON_NORAML_SKILL_OVER, self)
|
||||||
else -- 继续普攻
|
else -- 继续普攻
|
||||||
self:doNextNormalAttack()
|
self:doNextNormalAttack()
|
||||||
end
|
end
|
||||||
@ -890,9 +892,6 @@ function BattleUnitComp:updateSkillAttack(dt)
|
|||||||
else
|
else
|
||||||
if self.currAttackKeyTime > 0 and self.attackTime >= self.currAttackKeyTime then -- 到达关键后使用
|
if self.currAttackKeyTime > 0 and self.attackTime >= self.currAttackKeyTime then -- 到达关键后使用
|
||||||
if self.normalSkillCount > 0 then
|
if self.normalSkillCount > 0 then
|
||||||
if self.normalSkillCount == 1 and self.currActiveSkill == nil then -- 最后一次攻击
|
|
||||||
self.team:setCentralizedAttack(false)
|
|
||||||
end
|
|
||||||
local skill = self.unitEntity:getNormalSkill()
|
local skill = self.unitEntity:getNormalSkill()
|
||||||
if skill then
|
if skill then
|
||||||
local attackName = skill:getSkillAttackName()
|
local attackName = skill:getSkillAttackName()
|
||||||
@ -900,8 +899,13 @@ function BattleUnitComp:updateSkillAttack(dt)
|
|||||||
else
|
else
|
||||||
self.currAttackKeyTime = 0
|
self.currAttackKeyTime = 0
|
||||||
end
|
end
|
||||||
|
local isFinalBlock = self.currAttackKeyTime <= 0
|
||||||
|
|
||||||
|
if self.normalSkillCount == 1 and self.currActiveSkill == nil and isFinalBlock then -- 最后一次攻击
|
||||||
|
self.team:setCentralizedAttack(false)
|
||||||
|
end
|
||||||
self:onSkillTakeEffect(skill, self.currAttackKeyTime <= 0, self.validEffectIdx)
|
self:onSkillTakeEffect(skill, self.currAttackKeyTime <= 0, self.validEffectIdx)
|
||||||
if self.normalSkillCount == 1 and self.currActiveSkill == nil then -- 最后一次攻击
|
if self.normalSkillCount == 1 and self.currActiveSkill == nil and isFinalBlock then -- 最后一次攻击
|
||||||
self.battleController:setIsPauseHpProgress(false)
|
self.battleController:setIsPauseHpProgress(false)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -1104,6 +1108,7 @@ function BattleUnitComp:updateNormalAttack(dt)
|
|||||||
else
|
else
|
||||||
self:onAttackOver()
|
self:onAttackOver()
|
||||||
end
|
end
|
||||||
|
self:checkPassiveEvent(PASSIVE_EVENT.ON_NORAML_SKILL_OVER, self)
|
||||||
return
|
return
|
||||||
else -- 继续攻击
|
else -- 继续攻击
|
||||||
self:doNextNormalAttack()
|
self:doNextNormalAttack()
|
||||||
@ -1209,7 +1214,7 @@ function BattleUnitComp:onSkillTakeEffect(skill, isFinalBlock, validEffectIdx)
|
|||||||
local succ = false
|
local succ = false
|
||||||
for k, effect in ipairs(effectList) do
|
for k, effect in ipairs(effectList) do
|
||||||
if k >= validEffectIdx[1] and k <= validEffectIdx[2] then
|
if k >= validEffectIdx[1] and k <= validEffectIdx[2] then
|
||||||
if self:judgeSkillEffectCondition(skill, k, target) then
|
if self:judgeSkillEffectCondition(skill, k) then
|
||||||
if self:takeEffect(effect, target) then
|
if self:takeEffect(effect, target) then
|
||||||
succ = true
|
succ = true
|
||||||
end
|
end
|
||||||
@ -1242,14 +1247,15 @@ function BattleUnitComp:onSkillTakeEffect(skill, isFinalBlock, validEffectIdx)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleUnitComp:judgeSkillEffectCondition(skill, index, target)
|
function BattleUnitComp:judgeSkillEffectCondition(skill, index)
|
||||||
if not skill then
|
if not skill then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
local buffConditions = skill:getBuffCondition(index)
|
local buffConditions = skill:getBuffCondition(index)
|
||||||
local conditionRel = skill:getBuffConditionRel(index)
|
local conditionRel = skill:getBuffConditionRel(index)
|
||||||
return BATTLE_SKILL_CONDITION_HANDLE.judgeSkillEffectCondition(buffConditions, conditionRel, target)
|
|
||||||
|
return BATTLE_SKILL_CONDITION_HANDLE.judgeSkillEffectCondition(buffConditions, conditionRel, self.battleController)
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleUnitComp:takeEffect(buff, target)
|
function BattleUnitComp:takeEffect(buff, target)
|
||||||
|
|||||||
@ -2620,7 +2620,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, instruction.count, #self.instructions == 0, callback)
|
self.atkTeam:useSkill(instruction.skillMatch, instruction.count, #self.instructions == 0, BattleConst.EFFECT_TYPE.DIRECT, callback)
|
||||||
end
|
end
|
||||||
|
|
||||||
BattleController._doInstruction = {
|
BattleController._doInstruction = {
|
||||||
|
|||||||
@ -49,6 +49,18 @@ local function _checkActiveSkillHit(unitComp, skill, targetComp)
|
|||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function _checkOnNormalSkillOver(unitComp, skill, targetComp)
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
local function _checkOnDeadByBurn(unitComp, skill, targetComp)
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
local function _checkOnDeadBySkill(unitComp, skill, targetComp)
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
local function _checkOnDead(unitComp, skill, targetComp)
|
local function _checkOnDead(unitComp, skill, targetComp)
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
@ -59,6 +71,9 @@ BattlePassive.checkTrigger = {
|
|||||||
[PASSIVE_EVENT.HP_LOWER_THAN] = _checkhpLowerThan,
|
[PASSIVE_EVENT.HP_LOWER_THAN] = _checkhpLowerThan,
|
||||||
[PASSIVE_EVENT.USE_NORMAL_SKILL] = _checkUseNormalSkill,
|
[PASSIVE_EVENT.USE_NORMAL_SKILL] = _checkUseNormalSkill,
|
||||||
[PASSIVE_EVENT.ACTIVE_SKILL_HIT] = _checkActiveSkillHit,
|
[PASSIVE_EVENT.ACTIVE_SKILL_HIT] = _checkActiveSkillHit,
|
||||||
|
[PASSIVE_EVENT.ON_NORAML_SKILL_OVER] = _checkOnNormalSkillOver,
|
||||||
|
[PASSIVE_EVENT.ON_DEAD_BY_BURN] = _checkOnDeadByBurn,
|
||||||
|
[PASSIVE_EVENT.ON_DEAD_BY_SKILL] = _checkOnDeadBySkill,
|
||||||
[PASSIVE_EVENT.ON_DEAD] = _checkOnDead,
|
[PASSIVE_EVENT.ON_DEAD] = _checkOnDead,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@ local BattleSkillConditionHandle = {}
|
|||||||
local SKILL_CONDITION_REL_TYPE = BattleConst.SKILL_CONDITION_REL_TYPE
|
local SKILL_CONDITION_REL_TYPE = BattleConst.SKILL_CONDITION_REL_TYPE
|
||||||
local SKILL_CONDITION_TYPE = BattleConst.SKILL_CONDITION_TYPE
|
local SKILL_CONDITION_TYPE = BattleConst.SKILL_CONDITION_TYPE
|
||||||
|
|
||||||
local function _judgeTargetState(buffCondition, conditionRel, target)
|
local function _judgeTargetState(buffCondition, conditionRel, target, battleController)
|
||||||
local num = target:getBuffCountByName(buffCondition.attr)
|
local num = target:getBuffCountByName(buffCondition.attr)
|
||||||
if num > 0 then -- 拥有这个buff
|
if num > 0 then -- 拥有这个buff
|
||||||
return true
|
return true
|
||||||
@ -13,7 +13,7 @@ local function _judgeTargetState(buffCondition, conditionRel, target)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
local function _judgeTargetAttr(buffCondition, conditionRel, target)
|
local function _judgeTargetAttr(buffCondition, conditionRel, target, battleController)
|
||||||
local attrNum = target.unitEntity:getAttrValue(buffCondition.attr)
|
local attrNum = target.unitEntity:getAttrValue(buffCondition.attr)
|
||||||
return BattleSkillConditionHandle._strOperatorOverloading(buffCondition.op, attrNum, buffCondition.v)
|
return BattleSkillConditionHandle._strOperatorOverloading(buffCondition.op, attrNum, buffCondition.v)
|
||||||
end
|
end
|
||||||
@ -41,7 +41,7 @@ BattleSkillConditionHandle._strOperatorOverloading = function(opStr, value1, val
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleSkillConditionHandle.judgeSkillEffectCondition(buffConditions, conditionRel, target)
|
function BattleSkillConditionHandle.judgeSkillEffectCondition(buffConditions, conditionRel, battleController)
|
||||||
if not buffConditions or not conditionRel then
|
if not buffConditions or not conditionRel then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@ -49,8 +49,16 @@ function BattleSkillConditionHandle.judgeSkillEffectCondition(buffConditions, co
|
|||||||
local passConditionCount = 0
|
local passConditionCount = 0
|
||||||
for _, condition in ipairs(buffConditions) do
|
for _, condition in ipairs(buffConditions) do
|
||||||
local func = BattleSkillConditionHandle._judgeSkillEffectCondition[condition.type]
|
local func = BattleSkillConditionHandle._judgeSkillEffectCondition[condition.type]
|
||||||
if func(condition, conditionRel, target) then
|
if func then
|
||||||
passConditionCount = passConditionCount + 1
|
local target
|
||||||
|
if condition.side == BattleConst.SIDE_ATK then
|
||||||
|
target = battleController.atkTeam:getMainUnit()
|
||||||
|
else
|
||||||
|
target = battleController.defTeam:getMainUnit()
|
||||||
|
end
|
||||||
|
if func(condition, conditionRel, target, battleController) then
|
||||||
|
passConditionCount = passConditionCount + 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -78,7 +78,7 @@ function BattleTeam:useNormalSkill(matchType, count, isFinalAction, effectType,
|
|||||||
unit:useNormalSkill(count, effectType, callback)
|
unit:useNormalSkill(count, effectType, callback)
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleTeam:useSkill(matchType, count, isFinalAction, callback)
|
function BattleTeam:useSkill(matchType, count, isFinalAction, effectType, callback)
|
||||||
self.isFinalAction = isFinalAction
|
self.isFinalAction = isFinalAction
|
||||||
local unit = nil
|
local unit = nil
|
||||||
if matchType == nil then
|
if matchType == nil then
|
||||||
@ -94,7 +94,7 @@ function BattleTeam:useSkill(matchType, count, isFinalAction, callback)
|
|||||||
end
|
end
|
||||||
local lastMainUnit = self.mainUnit
|
local lastMainUnit = self.mainUnit
|
||||||
self.mainUnit = unit
|
self.mainUnit = unit
|
||||||
unit:beforeAttack()
|
unit:beforeAttack(effectType)
|
||||||
unit:resetBeforeAttack()
|
unit:resetBeforeAttack()
|
||||||
if unit:useSkill(1, count, callback) then
|
if unit:useSkill(1, count, callback) then
|
||||||
if lastMainUnit and lastMainUnit ~= unit then
|
if lastMainUnit and lastMainUnit ~= unit then
|
||||||
|
|||||||
@ -215,6 +215,7 @@ function BattleSkillEntity:getBuffConditionRel(index)
|
|||||||
return info[2]
|
return info[2]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
return self.skillInfo.condition_rel[index]
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleSkillEntity:getTargetType()
|
function BattleSkillEntity:getTargetType()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user