[战斗]==========后续紫府神印提交

dev_chengFeng
wangzhenxing 2021-08-12 15:11:38 +08:00
parent c3ca8f5286
commit 08d02a0b6d
9 changed files with 281 additions and 28 deletions

View File

@ -15,6 +15,7 @@ local BuffRegister = {
[BuffName.NoDead] = "NoDead",
[BuffName.Aura] = "Aura",
[BuffName.Brand] = "Brand",
[BuffName.Blood] = "Blood",
}
@ -168,6 +169,7 @@ function BuffManager:AddBuff(target, buff)
buff.roundDuration = buff.duration
buff.roundInterval = buff.interval
buff.caster.Event:DispatchEvent(BattleEventName.BuffCaster, buff)
buff.target.Event:DispatchEvent(BattleEventName.BuffBeAdd, buff)
-- 用于记录统计
BattleLogic.Event:DispatchEvent(BattleEventName.RecordBuff, buff.caster, buff.target, buff)
end

View File

@ -2760,13 +2760,16 @@ local passivityList = {
end,
-- 受到[a]状态敌人攻击时受到伤害[b]改变[c]%
-- a[持续伤害状态]b[改变类型]c[float]
-- a[持续伤害状态]b[改变类型]c[float],d[int 1:直接伤害 ](d 不填/0不区别是否为直接伤害)
[140] = function(role, args)
local dot = args[1]
local ct = args[2]
local f1 = args[3]
local onPassiveBeDamaging = function(func, caster, damage)
local type = args[4]
local onPassiveBeDamaging = function(func, caster, damage,skill)
if type==1 and not skill then
return
end
if BattleLogic.BuffMgr:HasBuff(caster, BuffName.DOT, function(buff) return buff.damageType == dot end,role,dot) then
local dmgDeduction = damage - floor(BattleUtil.ErrorCorrection(BattleUtil.CountValue(damage, f1, ct)))
if func then func(dmgDeduction) end
@ -3311,25 +3314,25 @@ local passivityList = {
role.Event:AddEvent(BattleEventName.BeSkillCastEnd, onBeSkillCastEnd,nil,nil,role)
end,
-- 攻击目标时目标身上每有1种异常状态包括麻痹、眩晕、沉默、灼烧、中毒都会使对其造成的直接伤害提高异常状态数量乘以[a]%。
-- a[float]
-- 攻击目标时目标身上每有1种异常状态包括麻痹、眩晕、沉默、灼烧、中毒都会使对其造成的直接伤害提高异常状态数量乘以[a]%。,[b]是否包含dot类buff(b 不填/0为包含 )
-- a[float],b[int 1:不包含]
[161] = function(role, args,id,judge)
local f1 = args[1]
local isDot = args[2]
if not isDot then
isDot=0
end
--之前为根据异常效果的数量改为根据异常效果的类型 by:王振兴
local function onPassiveDamaging(damagingFunc, target, damage,skill)
if skill and not skill.isTriggerJudge and judge==1 then
return
end
--local list = BattleLogic.BuffMgr:GetBuff(target, function(buff)
--return buff.type == BuffName.DOT or buff.type == BuffName.Control
--end)
local dotList={}
local controlList={}
local list=BattleLogic.BuffMgr:GetBuff(target)
for i = 1, #list do
local buff=list[i]
if buff.type== BuffName.DOT and buff.damageType and dotList and not BattleUtil.ChecklistIsContainValue(dotList,buff.damageType) then
if isDot==0 and buff.type== BuffName.DOT and buff.damageType and dotList and not BattleUtil.ChecklistIsContainValue(dotList,buff.damageType) then
table.insert(dotList,buff.damageType)
end
@ -7239,7 +7242,7 @@ local passivityList = {
end,
-- 技能施加控制状态失败,回复自身[a]点怒气()
-- a[int]
[318] = function(role, args)
[318] = function(role, args,id,judge)
local f1 = args[1]
local ctrlNum=0
@ -7428,7 +7431,7 @@ local passivityList = {
end,
--释放技能怒气不足时,损失自身([a]-我方活着的[b]系神将数)%生命*不足怒气数 后释放技能
--a[int],b[int]
[324]=function(role,args)
[324]=function(role,args,id,judge)
local max=args[1]
local ele=args[2]
local onRoleCastSkillBrfore=function(caster)
@ -7455,7 +7458,7 @@ local passivityList = {
end,
-- 被自身控制[a]的敌方目标,己方[b]阵营神将对其造成伤害增加[c]%
-- a[int 控制状态] b[int] c[float]
[325] = function(role, args)
[325] = function(role, args,id,judge)
local f1 = args[1]
local ele = args[2]
local f2 = args[3]
@ -7743,7 +7746,7 @@ local passivityList = {
end,
-- 武将怒气为[a]点时即可释放技能,释放技能消耗当前所有怒气 超过[c]点的怒气部分 每消耗1点怒气技能伤害为[b]%(c不填默认为4)
-- a[int]b[float],c[int]
[336] = function(role, args)
[336] = function(role, args,id,judge)
local i1 = args[1]
local f1 = args[2]
local num = args[3]
@ -7847,7 +7850,7 @@ local passivityList = {
end,
-- 受到直接伤害的[a]%转换为护甲
-- a[float]
[338] = function(role, args)
[338] = function(role, args,id,judge)
local f1 = args[1]
local onBeHit = function(caster, damage, bCrit, finalDmg, damageType, skill)
--如果角色死亡就不会反弹伤害
@ -7858,15 +7861,15 @@ local passivityList = {
if not skill and not isDirect then
return
end
local rDamage = f1 * damage
role:AddBuff(Buff.Create(role, BuffName.Shield,0, ShieldTypeName.NormalReduce, rDamage, 0))
local rDamage =floor(f1 * damage)
role:AddBuff(Buff.Create(role, BuffName.Blood,0, rDamage))
end
role.Event:AddEvent(BattleEventName.RoleBeHit, onBeHit,nil,nil,role)
end,
--每次行动未造成击杀,则该行动主目标造成其[a][b]%的间接伤害
[339] = function(role, args)
--a[int 属性],b[float]
[339] = function(role, args,id,judge)
local p1 = args[1]
local v1 = args[2]
local isNoDie=true
@ -7890,7 +7893,6 @@ local passivityList = {
isNoDie=false
end
local onTurnStar=function(role)
role.Event:AddEvent(BattleEventName.RoleKill,onRoleKill,nil,nil,role)
end
role.Event:AddEvent(BattleEventName.RoleTurnStart, onTurnStar,nil,nil,role)
@ -7898,11 +7900,187 @@ local passivityList = {
local onTurnEnd=function(role)
role.Event:RemoveEvent(BattleEventName.RoleKill,onRoleKill,nil,nil,role)
if isNoDie then
local damage=floor(BattleUtil.FP_Mul(role.curMainTarget:GetRoleData(p1),v1))
local damage=floor(BattleUtil.FP_Mul(role.curMainTarget:GetRoleData(BattlePropList[p1]),v1))
BattleUtil.FinalDamage(nil,role,role.curMainTarget,damage)
end
isNoDie=true
end
role.Event:AddEvent(BattleEventName.RoleTurnEnd, onTurnStar,nil,nil,role)
role.Event:AddEvent(BattleEventName.RoleTurnEnd, onTurnEnd,nil,nil,role)
end,
-- 为己方单位恢复怒气是,为主目标添加[a] 属性[b] [c]%的效果,持续[d]回合,每回合最多生效一次
-- a[int 改变类型] b[int] c[float] d[int]
[340] = function(role, args,id,judge)
local ct = args[1]
local p1 = args[2]
local v1=args[3]
local round=args[4]
local isTurn=false
local onRoleHit = function(caster, target, deltaRage, countType, value)
if not isTurn then
return
end
if caster~=role then
return
end
if target.camp~=role.camp or countType~=CountTypeName.Add then
return
end
target:AddBuff(Buff.Create(role, BuffName.PropertyChange,round, BattlePropList[p1],v1, ct))
isTurn=false
end
BattleLogic.Event:AddEvent(BattleEventName.RecordRageChange, onRoleHit,nil,nil,role)
local onRoleTurnStart=function()
isTurn=true
end
BattleLogic.Event:AddEvent(BattleEventName.BattleRoundStart,onRoleTurnStart,nil,nil,role)
end,
-- 造成直接伤害时,自身每有[a]点怒气,造成的伤害增加[b]%,最高为[c]%
-- a[int],b[float],c[float]
[341] = function(role, args,id,judge)
local num = args[1]
local f1 = args[2]
local f2 = args[3]
local count=0
local OnSkillCast=function(skill)
count=floor(role.Rage/num)
end
role.Event:AddEvent(BattleEventName.ActionOperateAngerBefore,OnSkillCast,nil,nil,role)
local OnPassiveDamaging = function(damagingFunc, target, damage,skill)
if not skill then
return
end
local add=count*f1
if add>f2 then
add=f2
end
damagingFunc(-floor(BattleUtil.FP_Mul(add,damage)))
end
role.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging,nil,nil,role)
end,
--回合行动形成追击时,每次追击造成的伤害增加[a]%
--a[float]
[342] = function(role, args,id,judge)
local p1 = args[1]
local isTurn=false
-- 如果是行动回合追加的技能的伤害
local onPassiveDamaging = function(func, target, damage, skill)
if not skill then
return
end
if not skill.isAdd then
return
end
if isTurn==false then
return
end
if not skill.isTriggerJudge and judge==1 then
return
end
if skill.type==BattleSkillType.Special or skill.type==BattleSkillType.Extra or skill.type==BattleSkillType.Normal then
func(-floor(BattleUtil.FP_Mul(p1,damage)))
end
end
role.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging,nil,nil,role)
local onTurnStar=function(role)
isTurn=true
end
role.Event:AddEvent(BattleEventName.RoleTurnStart, onTurnStar,nil,nil,role)
local onTurnEnd=function(role)
isTurn=false
end
role.Event:AddEvent(BattleEventName.RoleTurnEnd, onTurnEnd,nil,nil,role)
end,
--回合结束时,与自己怒气相同的己方单位同时回复[a]点怒气
--a[int]
[343]=function(role,args,id,judge)
local num=args[1]
local onRoundChange=function(round)
if round==0 then
return
end
local list = RoleManager.Query(function(v) return role.camp == v.camp end)
for _, r in pairs(list) do
if r.Rage==role.Rage and r~=role then
BattleUtil.CalRage(role,r,num,CountTypeName.Add)
end
end
BattleUtil.CalRage(role,role,num,CountTypeName.Add)
end
BattleLogic.Event:AddEvent(BattleEventName.BattleRoundEnd, onRoundChange,nil,nil,role)
end,
--释放技能时,对控制成功的目标,技能的直接伤害增加[a]%;失败使目标 属性[b] 改变[c] [d]% 持续[e]回合
--a[float],b[int 属性id],c[int 改变类型],d[float],e[int]
[344]=function(role,args,id,judge)
local p1=args[1]
local pro = args[2]
local ct = args[3]
local v1 = args[4]
local round = args[5]
local curSkill=nil
--添加buff成功
local OnBuffBeAdd=function(buff)
if not buff or buff.caster~=role or buff.type~=BuffName.Control then
return
end
--添加技能额外伤害
if curSkill then
local finalDamage=floor(role.superSkillDamage*p1)
BattleUtil.FinalDamage(nil,role,buff.target,finalDamage)
end
end
--添加buff失败
local OnBuffAddFail=function(buff)
if not buff or buff.caster~=role or buff.type~=BuffName.Control then
return
end
buff.target:AddBuff(Buff.Create(role, BuffName.PropertyChange, round, BattlePropList[pro],v1, ct))
end
local OnSkillCast=function(skill)
if skill.type~=BattleSkillType.Special then
return
end
curSkill=skill
BattleLogic.Event:AddEvent(BattleEventName.RoleAddBuffFail,OnBuffAddFail,nil,nil,role)
role.Event:AddEvent(BattleEventName.BuffCaster,OnBuffBeAdd,nil,nil,role)
end
role.Event:AddEvent(BattleEventName.SkillCast,OnSkillCast,nil,nil,role)
local OnSkillCastEnd=function(skill)
if skill.type~=BattleSkillType.Special then
return
end
curSkill=nil
BattleLogic.Event:RemoveEvent(BattleEventName.RoleAddBuffFail,OnBuffAddFail,nil,nil,role)
role.Event:RemoveEvent(BattleEventName.BuffCaster,OnBuffBeAdd,nil,nil,role)
end
role.Event:AddEvent(BattleEventName.SkillCastEnd,OnSkillCastEnd,nil,nil,role)
end,
--持续伤害效果[a]结算时,对目标造成其[b][c]%的伤害
-- a[int dot类型id] b[int 属性id],c[float]
[345]=function(role,args)
local type=args[1]
local pro=args[2]
local v1=args[3]
local OnBuffEnd=function(buff)
if buff and buff.caster==role and buff.damageType==type then
local val = floor(BattleUtil.FP_Mul(v1, buff.target:GetRoleData(BattlePropList[pro])))
BattleUtil.FinalDamage(nil,role,buff.target, val)
end
end
BattleLogic.Event:AddEvent(BattleEventName.DotBuffEnd, OnBuffEnd,nil,nil,role)
end,
}
return passivityList

View File

@ -0,0 +1,47 @@
Blood = Buff:New()
--初始化Buff通过传入一些自定义参数控制成长相关的数值
function Blood:SetData(...)
-- 刷新排序等级
self.bloodValue=...
self.sort = 4
end
--初始化后调用一次
function Blood:OnStart()
self.target.bloodShield = self
end
--间隔N帧触发返回true时表示继续触发返回false立刻触发OnEnd
function Blood:OnTrigger()
return true
end
--效果结束时调用一次
function Blood:OnEnd()
self.target.bloodShield = nil
self.bloodValue=0
end
--计算血甲
function Blood:CountBloodValue(damage)
local finalDamage=0
self.bloodValue=self.bloodValue-damage
if self.bloodValue<=0 then
self.disperse=true
end
finalDamage=self.bloodValue
LogError(" 伤害== "..damage.." 盾值=="..self.bloodValue.." 扣血:"..finalDamage)
return finalDamage
end
--只有当cover字段为true时触发返回true则被新效果覆盖
function Blood:OnCover(newBuff)
return true
end
return Blood

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 489a333956a8af142befcc171adc4334
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -43,7 +43,7 @@ end
--效果结束时调用一次
function DOT:OnEnd()
BattleLogic.Event:DispatchEvent(BattleEventName.DotBuffEnd, self)
end
--只有当cover字段为true时触发返回true则被新效果覆盖

View File

@ -131,6 +131,7 @@ BattleEventName = {
BuffStart = indexAdd(),
BuffDodge = indexAdd(),
BuffTrigger = indexAdd(),
BuffBeAdd=indexAdd(),
BuffEnd = indexAdd(),
BuffCountChange = indexAdd(),
BuffCover = indexAdd(),
@ -153,9 +154,10 @@ BattleEventName = {
RoleCastSkillBefore = indexAdd(),
--护盾buff消失以后
ShieldBuffEnd=indexAdd(),
--治疗效果导入
--治疗效果结束
HotBuffEnd=indexAdd(),
--dot buff结束
DotBuffEnd=indexAdd(),
-- 战斗记录用
RecordDamage = indexAdd(), -- 伤害
RecordTreat = indexAdd(), -- 治疗
@ -170,6 +172,7 @@ BattleEventName = {
RecordRageChange = indexAdd(), -- 怒气改变时
ActionOperateAngerAfter =indexAdd(),--角色行动操作怒气后
HitRoleInBurn = indexAdd(), --击中在燃烧状态得敌人
ActionOperateAngerBefore =indexAdd(),--角色行动操作怒气前
}
BattleMaxFrame = 1000000
@ -218,6 +221,7 @@ BuffName = {
NoDead = 10,
Aura = 11,
Brand = 12,
Blood = 13,
}
DotType = {

View File

@ -676,7 +676,17 @@ function BattleUtil.FinalDamage(skill, atkRole, defRole, damage, bCrit, damageTy
return
end
if damage < 0 then damage = 0 end
local finalDmg = defRole.data:SubValue(RoleDataName.Hp, damage)
if skill and skill.type==BattleSkillType.Special then
skill.owner.superSkillDamage=damage
end
--计算血量防护
local realDamage=0
--血量防护只会防直接伤害
if defRole.bloodShield and skill then
realDamage=math.abs(defRole.bloodShield:CountBloodValue(damage))
end
local finalDmg = defRole.data:SubValue(RoleDataName.Hp,realDamage)
if finalDmg >= 0 then
if defRole:GetRoleData(RoleDataName.Hp) <= 0 and not defRole:IsDead() then
defRole:SetDead(damage)
@ -973,6 +983,7 @@ function BattleUtil.RandomControl(rand, ctrl, caster, target, round)
target:AddBuff(buff)
end)
if not isAdd then
buff.target=target
BattleLogic.Event:DispatchEvent(BattleEventName.RoleAddBuffFail,buff)
end
return isAdd

View File

@ -29,6 +29,7 @@ function RoleLogic:Init(uid, data, position)
self.isDead = self:GetRoleData(RoleDataName.Hp) <= 0
self.isRealDead = self.isDead
self.killDamage = 0 --致死伤害
self.superSkillDamage = 0 --技能伤害
self.killRole=nil --击杀英雄
self.camp = data.camp --阵营 0我方 1敌方
self.name = data.name
@ -76,7 +77,7 @@ function RoleLogic:Init(uid, data, position)
self.reliveFilter = true -- 控制复活的标志位置为false角色将不再享受复活效果
self.reliveHPF = 1
self.reliveCaster = nil
self.bloodShield = nil
self.IsCanAddSkill = true -- 是否可以追加技能
self.mustHit=false --必定命中
self.mustCrit=false --必定暴击
@ -345,7 +346,7 @@ function RoleLogic:SkillCast(skill, func)
_CastDone()
return
end
self.Event:DispatchEvent(BattleEventName.ActionOperateAngerBefore,self)
-- 没有麻痹,释放普通攻击
if (skill.type == BattleSkillType.Normal or skill.type ==BattleSkillType.ChaosNormal) and not self.ctrl_palsy then

View File

@ -10,6 +10,7 @@ local BuffTypeToConfigType = {
[BuffName.Curse] = 7,
[BuffName.KylinMark] = 8,
[BuffName.Exile] = 9,
[BuffName.Blood] = 13,
}
local function _GetPropChangeBuffCType(pName)
for cType, pn in ipairs(BattlePropList) do
@ -45,6 +46,8 @@ local function _GetBuffEffectConfig(buff)
cType = 1
elseif bType== BuffName.Exile then
cType = 1
elseif bType== BuffName.Blood then
cType = 1
end
local type = BuffTypeToConfigType[bType]