未命中效果添加

dev_chengFeng
gaoxin 2020-07-03 18:55:45 +08:00
parent 0bdb498338
commit 9c7377e3d6
5 changed files with 83 additions and 37 deletions

View File

@ -1915,7 +1915,7 @@ local passivityList = {
-- 释放技能后
local onSkillEnd = function(skill)
if skill.type == BattleSkillType.Special then
local list = skill:GetDirectTargets()
local list = skill:GetDirectTargetsNoMiss()
if list then
for i = 1, #list do
list[i]:AddRage(i1, CountTypeName.Sub)
@ -2265,7 +2265,7 @@ local passivityList = {
-- 普攻后
local onSkillEnd = function(skill)
if skill.type == BattleSkillType.Normal then
local list = skill:GetDirectTargets()
local list = skill:GetDirectTargetsNoMiss()
if list then
for _, r in ipairs(list) do
r:AddRage(i1, CountTypeName.Sub)
@ -2467,7 +2467,7 @@ local passivityList = {
-- 普攻后
local onSkillEnd = function(skill)
if skill.type == BattleSkillType.Normal then
local list = skill:GetDirectTargets()
local list = skill:GetDirectTargetsNoMiss()
if list then
local attack = role:GetRoleData(RoleDataName.Attack)
local damage = floor(BattleUtil.ErrorCorrection(attack * 0.2))
@ -2510,7 +2510,7 @@ local passivityList = {
-- 技能后后
local onSkillEnd = function(skill)
if skill.type == BattleSkillType.Special then
local list = skill:GetDirectTargets()
local list = skill:GetDirectTargetsNoMiss()
if list then
local tv = floor(BattleUtil.ErrorCorrection(role:GetRoleData(pro) * f1))
for _, r in ipairs(list) do
@ -2533,7 +2533,7 @@ local passivityList = {
-- 技能后后
local onSkillEnd = function(skill)
if skill.type == BattleSkillType.Normal then
local list = skill:GetDirectTargets()
local list = skill:GetDirectTargetsNoMiss()
if list then
local tv = floor(BattleUtil.ErrorCorrection(role:GetRoleData(pro) * f1))
for _, r in ipairs(list) do
@ -2871,7 +2871,7 @@ local passivityList = {
-- 技能后后
local onSkillCastEnd = function(skill)
if skill.type == BattleSkillType.Special then
local targets = skill:GetDirectTargets()
local targets = skill:GetDirectTargetsNoMiss()
if targets then
for _, r in ipairs(targets) do
BattleUtil.RandomControl(f1, ctrl, role, r, i1)
@ -3416,7 +3416,7 @@ local passivityList = {
local function onSkillCastEnd(skill)
-- 对每个目标附加减伤盾
local targets = skill:GetDirectTargets()
local targets = skill:GetDirectTargetsNoMiss()
if targets and #targets == 1 then
targets[1]:AddRage(i1, CountTypeName.Sub)
end
@ -3523,7 +3523,7 @@ local passivityList = {
local chooseId = effectGroup.chooseId
local chooseLimit = floor(chooseId / 10000) % 10
if chooseLimit == 3 then -- 打纵列
local targets = skill:GetDirectTargets()
local targets = skill:GetDirectTargetsNoMiss()
if targets then
for _, r in ipairs(targets) do
r:AddRage(i1, CountTypeName.Sub)

View File

@ -72,33 +72,45 @@ function Skill:Dispose()
end
end
local function takeEffect(caster, target, effects, duration, skill)
local function DoEffect(caster, target, eff, duration, skill)
local e = {type = 0, args = {}}
e.type = eff.type
for i=1, #eff.args do
e.args[i] = eff.args[i]
end
-- 检测被动技能对技能参数的影响
local function _PassiveCheck(pe)
if pe then
e = pe
end
end
caster.Event:DispatchEvent(BattleEventName.SkillEffectBefore, skill, e, _PassiveCheck)
target.Event:DispatchEvent(BattleEventName.BeSkillEffectBefore, skill, e, _PassiveCheck)
--
if effect[e.type] then
effect[e.type](caster, target, e.args, duration, skill)
BattleLogManager.Log(
"Take Effect",
"tcamp", target.camp,
"tpos", target.position,
"type", e.type
)
end
end
local function takeEffect(caster, target, effects, effectIndex, duration, skill)
for k=1, #effects do
local e = {type = 0, args = {}}
e.type = effects[k].type
for i=1, #effects[k].args do
e.args[i] = effects[k].args[i]
end
-- 检测被动技能对技能参数的影响
local function _PassiveCheck(pe)
if pe then
e = pe
-- 如果不是第一个效果对列的第一个效果则判断是否命中
if k ~= 1 and effectIndex == 1 then
if self:CheckTargetIsHit(target) then
DoEffect(caster, target, effects[k], duration, skill)
end
end
caster.Event:DispatchEvent(BattleEventName.SkillEffectBefore, skill, e, _PassiveCheck)
target.Event:DispatchEvent(BattleEventName.BeSkillEffectBefore, skill, e, _PassiveCheck)
--
if effect[e.type] then
effect[e.type](caster, target, e.args, duration, skill)
BattleLogManager.Log(
"Take Effect",
"tcamp", target.camp,
"tpos", target.position,
"type", e.type
)
else
DoEffect(caster, target, effects[k], duration, skill)
end
end
end
@ -167,7 +179,16 @@ function Skill:Cast(func)
if i == 1 then
self.targetIsHit[arr[j]] = BattleUtil.CheckIsHit(self.owner, arr[j])
end
takeEffect(self.owner, arr[j], effects, self.hitTime, self)
takeEffect(self.owner, arr[j], effects, i, self.hitTime, self)
-- if i == 1 then
-- self.targetIsHit[arr[j]] = BattleUtil.CheckIsHit(self.owner, arr[j])
-- takeEffect(self.owner, arr[j], effects, self.hitTime, self)
-- else
-- -- 未命中的目标不会产生后续技能效果
-- if self:CheckTargetIsHit(arr[j]) then
-- takeEffect(self.owner, arr[j], effects, self.hitTime, self)
-- end
-- end
end
end
end)
@ -203,10 +224,20 @@ function Skill:Cast(func)
end
-- 获取技能的直接目标,和策划规定第一个效果的目标为直接效果目标
-- 获取技能的直接目标,和策划规定第一个效果的目标为直接效果目标,(包含miss的目标)
function Skill:GetDirectTargets()
return self.effectTargets[1]
end
-- 获取直接目标不包含miss的目标可能为空
function Skill:GetDirectTargetsNoMiss()
local list = {}
for _, role in ipairs(self.effectTargets[1]) do
if self.CheckTargetIsHit(role) then
table.insert(list, role)
end
end
return list
end
-- 获取技能目标最大人数
function Skill:GetMaxTargetNum()
local mainEffect = self.effectList.buffer[1]

View File

@ -50,6 +50,9 @@ BattleEventName = {
FinalDamage = indexAdd(),
FinalBeDamage = indexAdd(),
HitMiss = indexAdd(),
BeHitMiss = indexAdd(),
CritDamageReduceFactor = indexAdd(), -- 暴击伤害减免系数
SkillCast = indexAdd(), -- 技能攻击前

View File

@ -383,10 +383,17 @@ end
--执行完整的命中,伤害,暴击计算,返回命中,暴击
--skill造成伤害的技能 atkRole攻击者 defRole受击者 damageType伤害类型 baseFactor伤害系数 ignoreDef无视防御参数 dotType是持续伤害类型
function BattleUtil.CalDamage(skill, atkRole, defRole, damageType, baseFactor, ignoreDef, dotType)
if atkRole.isTeam and not defRole:IsDead() then --如果是队伍技能计算真实伤害则damageType为伤害值
-- 判断是否命中
if skill and not skill:CheckTargetIsHit(defRole) then
BattleLogic.Event:DispatchEvent(BattleEventName.HitMiss, atkRole, defRole, skill)
atkRole.Event:DispatchEvent(BattleEventName.HitMiss, defRole, skill)
defRole.Event:DispatchEvent(BattleEventName.BeHitMiss, atkRole, skill)
return
end
-- 如果是队伍技能计算真实伤害则damageType为伤害值
if atkRole.isTeam and not defRole:IsDead() then
return BattleUtil.ApplyDamage(skill, atkRole, defRole, damageType), false
end
-- 计算技能额外伤害系数加成
baseFactor = baseFactor or 1
local factorFunc = function(exFactor) baseFactor = baseFactor + exFactor end

View File

@ -48,6 +48,7 @@ function RoleView.New(go, role, position, root)
BattleLogic.Event:AddEvent(BattleEventName.BattleEnd, instance.OnEnd, instance)
BattleLogic.Event:AddEvent(BattleEventName.BattleOrderChange, instance.OnEnd, instance)
role.Event:AddEvent(BattleEventName.BeHitMiss, instance.OnBeHitMiss, instance)
role.Event:AddEvent(BattleEventName.RoleBeDamaged, instance.OnDamaged, instance)
role.Event:AddEvent(BattleEventName.RoleBeTreated, instance.OnTreated, instance)
role.Event:AddEvent(BattleEventName.RoleBeHealed, instance.OnHealed, instance)
@ -1167,6 +1168,10 @@ function RoleView:OnShieldTrigger(shield)
end
end
-- 哈哈,没打着
function RoleView:OnBeHitMiss(atkRole, skill)
self:TextBuffFloating(TextFloatingColor.Blue, "未命中")
end
local DotTypeTip = {
[0] = Language[10276],