Merge branch 'dev' of git.juzugame.com:b6-client/b6-lua into dev
This commit is contained in:
commit
9ab1297bce
@ -189,17 +189,36 @@ BattleConst.EFFECT_TYPE = {
|
|||||||
COUNTERATTACK = 301, -- 反击
|
COUNTERATTACK = 301, -- 反击
|
||||||
}
|
}
|
||||||
|
|
||||||
|
---- 特殊的伤害类型,其余都是buffname
|
||||||
|
BattleConst.SPECIAL_DAMAGE_OR_CURE_TYPE = {
|
||||||
|
ROUND_BEGIN_HEAL = "round_begin_heal",
|
||||||
|
KILL_MAX_ELEMENT_AND_HEAL = "kill_max_element_and_heal",
|
||||||
|
}
|
||||||
|
|
||||||
BattleConst.SKILL_RECORD_DATA_NAME = {
|
BattleConst.SKILL_RECORD_DATA_NAME = {
|
||||||
HP_LOWER_THAN = 1
|
HP_LOWER_THAN = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BattleConst.SKILL_CONDITION_TYPE = {
|
||||||
|
STATE = "state", -- 状态
|
||||||
|
ATTR = "attr", -- 属性
|
||||||
|
}
|
||||||
|
|
||||||
|
BattleConst.SKILL_CONDITION_REL_TYPE = {
|
||||||
|
AND = 1,
|
||||||
|
OR = 2,
|
||||||
|
}
|
||||||
|
|
||||||
BattleConst.PASSIVE_EVENT = {
|
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, -- 使用普攻
|
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 = {
|
||||||
|
|||||||
@ -2,6 +2,7 @@ local BattleConst = require "app/module/battle/battle_const"
|
|||||||
local BattleHelper = require "app/module/battle/helper/battle_helper"
|
local BattleHelper = require "app/module/battle/helper/battle_helper"
|
||||||
local BattleBuffHandle = require "app/module/battle/helper/battle_buff_handle"
|
local BattleBuffHandle = require "app/module/battle/helper/battle_buff_handle"
|
||||||
local BATTLE_BOARD_SKILL_HANDLE = require "app/module/battle/skill/battle_board_skill_handle"
|
local BATTLE_BOARD_SKILL_HANDLE = require "app/module/battle/skill/battle_board_skill_handle"
|
||||||
|
local BATTLE_SKILL_CONDITION_HANDLE = require "app/module/battle/helper/battle_skill_condition_handle"
|
||||||
local BattlePassive = require "app/module/battle/helper/battle_passive"
|
local BattlePassive = require "app/module/battle/helper/battle_passive"
|
||||||
|
|
||||||
local BattleUnitComp = class("BattleUnitComp", LuaComponent)
|
local BattleUnitComp = class("BattleUnitComp", LuaComponent)
|
||||||
@ -335,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
|
||||||
@ -693,7 +695,7 @@ function BattleUnitComp:updateRecoverHpWaveState(dt)
|
|||||||
if healNum < 0 then -- 治疗效果不能为负数
|
if healNum < 0 then -- 治疗效果不能为负数
|
||||||
healNum = 0
|
healNum = 0
|
||||||
end
|
end
|
||||||
self:takeDamageOrCure(self, healNum, EFFECT_TYPE.HEAL, 0)
|
self:takeDamageOrCure(self, healNum, EFFECT_TYPE.HEAL, 0, BattleConst.SPECIAL_DAMAGE_OR_CURE_TYPE.ROUND_BEGIN_HEAL)
|
||||||
if self.recoverHpCount <= 0 then
|
if self.recoverHpCount <= 0 then
|
||||||
if self.finishRecoverHpCallback then
|
if self.finishRecoverHpCallback then
|
||||||
local callback = self.finishRecoverHpCallback
|
local callback = self.finishRecoverHpCallback
|
||||||
@ -854,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
|
||||||
@ -880,6 +883,11 @@ function BattleUnitComp:updateSkillAttack(dt)
|
|||||||
else
|
else
|
||||||
self:onAttackOver()
|
self:onAttackOver()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local target = self.battleController:getOtherSideMainUnit(self.side)
|
||||||
|
if target and target.unitEntity:getIsDead() then
|
||||||
|
self:checkPassiveEvent(PASSIVE_EVENT.ON_DEAD_BY_SKILL, self)
|
||||||
|
end
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
self.currActiveSkill = currActiveSkill
|
self.currActiveSkill = currActiveSkill
|
||||||
@ -889,9 +897,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()
|
||||||
@ -899,8 +904,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
|
||||||
@ -1103,6 +1113,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()
|
||||||
@ -1140,6 +1151,10 @@ function BattleUnitComp:addBuff(buffEffect)
|
|||||||
return self.team:addBuff(buffEffect)
|
return self.team:addBuff(buffEffect)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleUnitComp:getBuffCountByName(buffName)
|
||||||
|
return self.team:getBuffCountByName(buffName)
|
||||||
|
end
|
||||||
|
|
||||||
function BattleUnitComp:updateBuffState(buff, num)
|
function BattleUnitComp:updateBuffState(buff, num)
|
||||||
self.team:updateBuffState(buff, num)
|
self.team:updateBuffState(buff, num)
|
||||||
end
|
end
|
||||||
@ -1204,8 +1219,10 @@ 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:takeEffect(effect, target) then
|
if self:judgeSkillEffectCondition(skill, k) then
|
||||||
succ = true
|
if self:takeEffect(effect, target) then
|
||||||
|
succ = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1235,6 +1252,17 @@ function BattleUnitComp:onSkillTakeEffect(skill, isFinalBlock, validEffectIdx)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
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, self.battleController)
|
||||||
|
end
|
||||||
|
|
||||||
function BattleUnitComp:takeEffect(buff, target)
|
function BattleUnitComp:takeEffect(buff, target)
|
||||||
local ratio = buff:getRatio()
|
local ratio = buff:getRatio()
|
||||||
if ratio < DEFAULT_FACTOR then
|
if ratio < DEFAULT_FACTOR then
|
||||||
@ -1330,7 +1358,7 @@ function BattleUnitComp:removeEffect(buff, target)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleUnitComp:takeDamageOrCure(atker, num, effectType, effectStatus)
|
function BattleUnitComp:takeDamageOrCure(atker, num, effectType, effectStatus, damageOrCureType)
|
||||||
if self:getIsClear() then
|
if self:getIsClear() then
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
@ -1388,16 +1416,16 @@ function BattleUnitComp:takeDamageOrCure(atker, num, effectType, effectStatus)
|
|||||||
end
|
end
|
||||||
if effectType == EFFECT_TYPE.DIRECT then
|
if effectType == EFFECT_TYPE.DIRECT then
|
||||||
if hp > 0 and self.unitEntity:getShieldRebound() then -- 伤害反弹
|
if hp > 0 and self.unitEntity:getShieldRebound() then -- 伤害反弹
|
||||||
atker:takeDamageOrCure(self, num*self.unitEntity:getShieldRebound() // DEFAULT_FACTOR, EFFECT_TYPE.REBOUND, 0)
|
atker:takeDamageOrCure(self, num*self.unitEntity:getShieldRebound() // DEFAULT_FACTOR, EFFECT_TYPE.REBOUND, 0, BattleConst.BUFF_NAME.SHIELD_REBOUND_200)
|
||||||
end
|
end
|
||||||
if self.unitEntity:getBeSucked() > 0 then -- 吸血
|
if self.unitEntity:getBeSucked() > 0 then -- 吸血
|
||||||
atker:takeDamageOrCure(self, -num*self.unitEntity:getBeSucked() // DEFAULT_FACTOR, EFFECT_TYPE.HEAL, 0)
|
atker:takeDamageOrCure(self, -num*self.unitEntity:getBeSucked() // DEFAULT_FACTOR, EFFECT_TYPE.HEAL, 0, BattleConst.ATTR_NAME.BE_SUCKED)
|
||||||
end
|
end
|
||||||
if self.unitEntity:getIsLethargy() then -- 移除昏睡
|
if self.unitEntity:getIsLethargy() then -- 移除昏睡
|
||||||
self:removeBuffByName(BattleConst.BUFF_NAME.LETHARGY)
|
self:removeBuffByName(BattleConst.BUFF_NAME.LETHARGY)
|
||||||
end
|
end
|
||||||
if self.unitEntity:getThorns() > 0 then -- 反伤
|
if self.unitEntity:getThorns() > 0 then -- 反伤
|
||||||
atker:takeDamageOrCure(self, num*self.unitEntity:getThorns() // DEFAULT_FACTOR, EFFECT_TYPE.REBOUND, 0)
|
atker:takeDamageOrCure(self, num*self.unitEntity:getThorns() // DEFAULT_FACTOR, EFFECT_TYPE.REBOUND, 0, BattleConst.BUFF_NAME.THORNS)
|
||||||
end
|
end
|
||||||
if self.unitEntity:getCounterAttack() > 0 then -- 触发反击
|
if self.unitEntity:getCounterAttack() > 0 then -- 触发反击
|
||||||
local counterattack = self.unitEntity:getCounterAttack()
|
local counterattack = self.unitEntity:getCounterAttack()
|
||||||
@ -1418,10 +1446,15 @@ function BattleUnitComp:takeDamageOrCure(atker, num, effectType, effectStatus)
|
|||||||
else
|
else
|
||||||
if self.unitEntity:getIsDead() then
|
if self.unitEntity:getIsDead() then
|
||||||
self:changeState(UNIT_STATE.DEAD)
|
self:changeState(UNIT_STATE.DEAD)
|
||||||
|
if damageOrCureType == BattleConst.BUFF_NAME.BURN then
|
||||||
|
local target = self.battleController:getOtherSideMainUnit(self.side)
|
||||||
|
target:checkPassiveEvent(BattleConst.PASSIVE_EVENT.ON_DEAD_BY_BURN, target)
|
||||||
|
end
|
||||||
elseif damage < 0 and self.currState == UNIT_STATE.IDLE then
|
elseif damage < 0 and self.currState == UNIT_STATE.IDLE then
|
||||||
self:playHurt()
|
self:playHurt()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if hp > 0 then
|
if hp > 0 then
|
||||||
self.team:checkPassiveEvent(PASSIVE_EVENT.HP_LOWER_THAN, atker, hpPercent)
|
self.team:checkPassiveEvent(PASSIVE_EVENT.HP_LOWER_THAN, atker, hpPercent)
|
||||||
else
|
else
|
||||||
|
|||||||
@ -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 = {
|
||||||
|
|||||||
@ -18,7 +18,7 @@ local function _doDotWork(unitComp, buffEffect, buff)
|
|||||||
else
|
else
|
||||||
damage = -damage
|
damage = -damage
|
||||||
end
|
end
|
||||||
unitComp:takeDamageOrCure(buffEffect.sender, damage, EFFECT_TYPE.DOT, hurtStatus)
|
unitComp:takeDamageOrCure(buffEffect.sender, damage, EFFECT_TYPE.DOT, hurtStatus, buff:getName())
|
||||||
end
|
end
|
||||||
|
|
||||||
local function _doHotWork(unitComp, buffEffect, buff)
|
local function _doHotWork(unitComp, buffEffect, buff)
|
||||||
@ -26,7 +26,7 @@ local function _doHotWork(unitComp, buffEffect, buff)
|
|||||||
if cure < 0 then -- 加血不能是负数
|
if cure < 0 then -- 加血不能是负数
|
||||||
cure = 0
|
cure = 0
|
||||||
end
|
end
|
||||||
unitComp:takeDamageOrCure(buffEffect.sender, cure, EFFECT_TYPE.HOT, hurtStatus)
|
unitComp:takeDamageOrCure(buffEffect.sender, cure, EFFECT_TYPE.HOT, hurtStatus, buff:getName())
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleBuffHandle.doBuffWork(unitComp, buffEffect)
|
function BattleBuffHandle.doBuffWork(unitComp, buffEffect)
|
||||||
@ -92,7 +92,7 @@ local function _takeEffectDirectHurt(unitComp, buff, target, buffEffect)
|
|||||||
else
|
else
|
||||||
damage = -damage
|
damage = -damage
|
||||||
end
|
end
|
||||||
target:takeDamageOrCure(unitComp, damage, EFFECT_TYPE.DIRECT, hurtStatus)
|
target:takeDamageOrCure(unitComp, damage, EFFECT_TYPE.DIRECT, hurtStatus, buff:getName())
|
||||||
return damage
|
return damage
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ local function _takeEffectDirectCure(unitComp, buff, target, buffEffect)
|
|||||||
if cure < 0 then -- 加血不能是负数
|
if cure < 0 then -- 加血不能是负数
|
||||||
cure = 0
|
cure = 0
|
||||||
end
|
end
|
||||||
target:takeDamageOrCure(unitComp, cure, EFFECT_TYPE.HEAL, hurtStatus)
|
target:takeDamageOrCure(unitComp, cure, EFFECT_TYPE.HEAL, hurtStatus, buff:getName())
|
||||||
return cure
|
return cure
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -43,7 +43,7 @@ local function _bleedWork(unitComp, buffEffect, buff)
|
|||||||
else
|
else
|
||||||
damage = -damage
|
damage = -damage
|
||||||
end
|
end
|
||||||
unitComp:takeDamageOrCure(buffEffect.sender, damage, EFFECT_TYPE.DOT, hurtStatus)
|
unitComp:takeDamageOrCure(buffEffect.sender, damage, EFFECT_TYPE.DOT, hurtStatus, buff:getName())
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -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,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,84 @@
|
|||||||
|
local BattleConst = require "app/module/battle/battle_const"
|
||||||
|
|
||||||
|
local BattleSkillConditionHandle = {}
|
||||||
|
|
||||||
|
local SKILL_CONDITION_REL_TYPE = BattleConst.SKILL_CONDITION_REL_TYPE
|
||||||
|
local SKILL_CONDITION_TYPE = BattleConst.SKILL_CONDITION_TYPE
|
||||||
|
local DEFAULT_FACTOR = BattleConst.DEFAULT_FACTOR
|
||||||
|
|
||||||
|
local function _judgeTargetState(buffCondition, conditionRel, target, battleController)
|
||||||
|
local num = target:getBuffCountByName(buffCondition.attr)
|
||||||
|
if num > 0 then -- 拥有这个buff
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local function _judgeTargetAttr(buffCondition, conditionRel, target, battleController)
|
||||||
|
local attrNum = 0
|
||||||
|
if buffCondition.attr == "hpp" then
|
||||||
|
attrNum = target.unitEntity:getHpPercent() * DEFAULT_FACTOR
|
||||||
|
else
|
||||||
|
attrNum = target.unitEntity:getAttrValue(buffCondition.attr)
|
||||||
|
end
|
||||||
|
return BattleSkillConditionHandle._strOperatorOverloading(buffCondition.op, attrNum, buffCondition.v)
|
||||||
|
end
|
||||||
|
|
||||||
|
BattleSkillConditionHandle._judgeSkillEffectCondition = {
|
||||||
|
[SKILL_CONDITION_TYPE.STATE] = _judgeTargetState,
|
||||||
|
[SKILL_CONDITION_TYPE.ATTR] = _judgeTargetAttr,
|
||||||
|
}
|
||||||
|
|
||||||
|
BattleSkillConditionHandle._strOperatorOverloading = function(opStr, value1, value2)
|
||||||
|
if opStr == "<" then
|
||||||
|
return value1 < value2
|
||||||
|
elseif opStr == "<=" then
|
||||||
|
return value1 <= value2
|
||||||
|
elseif opStr == "=" then
|
||||||
|
return value1 == value2
|
||||||
|
elseif opStr == ">" then
|
||||||
|
return value1 > value2
|
||||||
|
elseif opStr == ">=" then
|
||||||
|
return value1 >= value2
|
||||||
|
elseif opStr == "!=" then
|
||||||
|
return value1 ~= value2
|
||||||
|
end
|
||||||
|
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
function BattleSkillConditionHandle.judgeSkillEffectCondition(buffConditions, conditionRel, battleController)
|
||||||
|
if not buffConditions or not conditionRel then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
local passConditionCount = 0
|
||||||
|
for _, condition in ipairs(buffConditions) do
|
||||||
|
local func = BattleSkillConditionHandle._judgeSkillEffectCondition[condition.type]
|
||||||
|
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
|
||||||
|
|
||||||
|
if conditionRel == SKILL_CONDITION_REL_TYPE.AND then
|
||||||
|
if passConditionCount >= #buffConditions then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
elseif conditionRel == SKILL_CONDITION_REL_TYPE.OR then
|
||||||
|
if passConditionCount > 0 then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
return BattleSkillConditionHandle
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9858e4faf8623ec4983583f58ea463ba
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||||
@ -252,7 +252,7 @@ local function _takeKillMaxElementAndHeal(atkUnitComp, skillEntity, battleContro
|
|||||||
|
|
||||||
local list = elementMap[maxElement]
|
local list = elementMap[maxElement]
|
||||||
local heal = count * effectNum * atkUnitComp.unitEntity:getAtk() // GConst.BattleConst.DEFAULT_FACTOR
|
local heal = count * effectNum * atkUnitComp.unitEntity:getAtk() // GConst.BattleConst.DEFAULT_FACTOR
|
||||||
atkUnitComp:takeDamageOrCure(atkUnitComp, heal, BattleConst.EFFECT_TYPE.HEAL, 0)
|
atkUnitComp:takeDamageOrCure(atkUnitComp, heal, BattleConst.EFFECT_TYPE.HEAL, 0, BattleConst.SPECIAL_DAMAGE_OR_CURE_TYPE.KILL_MAX_ELEMENT_AND_HEAL)
|
||||||
|
|
||||||
battleController:killGrids(list)
|
battleController:killGrids(list)
|
||||||
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
|
||||||
@ -480,6 +480,10 @@ function BattleTeam:updateBuffState(buff, num)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleTeam:getBuffCountByName(buffName)
|
||||||
|
return self.sameBuffCount[buffName] or 0
|
||||||
|
end
|
||||||
|
|
||||||
function BattleTeam:getLoopFxResCount(res)
|
function BattleTeam:getLoopFxResCount(res)
|
||||||
return self.loopFxMap[res] or 0
|
return self.loopFxMap[res] or 0
|
||||||
end
|
end
|
||||||
|
|||||||
@ -199,6 +199,25 @@ function BattleSkillEntity:getEffectBlockTime()
|
|||||||
return self.blockTime
|
return self.blockTime
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleSkillEntity:getBuffCondition(index)
|
||||||
|
if not self.skillInfo.buff_condition then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
return self.skillInfo.buff_condition[index]
|
||||||
|
end
|
||||||
|
|
||||||
|
function BattleSkillEntity:getBuffConditionRel(index)
|
||||||
|
if not self.skillInfo.condition_rel then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
for _, info in ipairs(self.skillInfo.condition_rel) do
|
||||||
|
if info[1] == index then
|
||||||
|
return info[2]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return self.skillInfo.condition_rel[index]
|
||||||
|
end
|
||||||
|
|
||||||
function BattleSkillEntity:getTargetType()
|
function BattleSkillEntity:getTargetType()
|
||||||
return self.skillInfo.obj
|
return self.skillInfo.obj
|
||||||
end
|
end
|
||||||
|
|||||||
@ -305,6 +305,10 @@ function BattleTeamEntity:getSkillHurt()
|
|||||||
return self.attr.skill_hurt or 0
|
return self.attr.skill_hurt or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleTeamEntity:getAttrValue(attrName)
|
||||||
|
return self.attr[attrName] or 0
|
||||||
|
end
|
||||||
|
|
||||||
function BattleTeamEntity:takeDamageOrCure(num)
|
function BattleTeamEntity:takeDamageOrCure(num)
|
||||||
if self.isDead then
|
if self.isDead then
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@ -394,6 +394,10 @@ function BattleUnitEntity:getIsDead()
|
|||||||
return self.team:getIsDead()
|
return self.team:getIsDead()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleUnitEntity:getAttrValue(attr)
|
||||||
|
return self.team:getAttrValue(attr)
|
||||||
|
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