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