加一个被动
This commit is contained in:
parent
92edaa2a73
commit
431c57c353
@ -129,6 +129,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 = {
|
||||||
|
|||||||
@ -812,9 +812,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 +822,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 +838,9 @@ function BattleUnitComp:onSkillTakeEffect(skill)
|
|||||||
succ = true
|
succ = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if succ and skill:getIsNormalType() then -- 普攻攻击成功的话
|
||||||
|
self:checkPassiveEvent(BattleConst.PASSIVE_EVENT_TYPE.USE_NORMAL_SKILL, target)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleUnitComp:takeEffect(buff, target)
|
function BattleUnitComp:takeEffect(buff, target)
|
||||||
|
|||||||
@ -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
|
||||||
@ -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)
|
||||||
|
|||||||
@ -191,6 +191,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
|
||||||
|
|||||||
@ -233,6 +233,10 @@ function BattleUnitEntity:addMaxHp(num)
|
|||||||
self.team:addMaxHp(num)
|
self.team:addMaxHp(num)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleUnitEntity:getBlock()
|
||||||
|
return self.team:getBlock()
|
||||||
|
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