Merge branch 'china/dev-c-battle' into china/dev

dev_chengFeng
wangzhenxing 2021-07-10 15:27:50 +08:00
commit 5dd8dded1d
6 changed files with 188 additions and 88 deletions

View File

@ -125,6 +125,9 @@ function EffectCaster:Cast()
if count == 0 then
count = #arr
end
table.sort(arr, function(a, b)
return a.position < b.position
end)
-- 全部同时生效
for j=1, count do
if arr[j] and not arr[j]:IsRealDead() then

View File

@ -1841,11 +1841,12 @@ local passivityList = {
-- 释放技能后给除自己外己方生命最少的[a]名武将附加无敌盾持续[b]回合(只剩自己则不加)
-- a[int] b[int]
-- 释放技能后给除自己外己方生命最少的[a]名武将附加无敌盾持续[b]回合(只剩自己则不加)无敌盾目标额外添加 [c]点怒气(c不填/填0 不会触发)
-- a[int] b[int] c[int]
[104] = function(role, args,id,judge)
local i1 = args[1]
local num = args[2]
local rageNum = args[3]
-- 释放技能后
local onSkillEnd = function(skill)
if skill and not skill.isTriggerJudge and judge==1 then
@ -1867,6 +1868,9 @@ local passivityList = {
for i = 1, i1 do
if heros[i] then
heros[i]:AddBuff(Buff.Create(role, BuffName.Shield, num, ShieldTypeName.AllReduce, 0, 0))
if rageNum and rageNum~=0 then
BattleUtil.CalRage(role,heros[i],rageNum,CountTypeName.Add)
end
end
end
end
@ -1877,7 +1881,7 @@ local passivityList = {
-- 释放技能后增加友方全体[a]点怒气,是否
-- 释放技能后增加友方全体[a]点怒气
-- a[int]
[105] = function(role, args,id,judge)
local i1 = args[1]
@ -1956,6 +1960,10 @@ local passivityList = {
[108] = function(role, args)
local f1 = args[1]
local onBeHit = function(caster, damage, bCrit, finalDmg, damageType, skill)
--damagetype为3 是 舍身济世分摊伤害
if damageType==3 then
return
end
--如果角色死亡就不会反弹伤害
if role:IsDead() then
return
@ -2425,7 +2433,7 @@ local passivityList = {
-- TODO
-- TODO 后端用被动 会在战前显示
-- 全体蜀国武将增加[a]%[b]
-- a[float]b[属性]
-- [129] = {},
@ -3894,6 +3902,7 @@ local passivityList = {
if not skill then
return
end
--BattleLogic.WaitForTrigger(BattleLogic.GameDeltaTime,function()
-- 伤害降低
local finalDamage = BattleUtil.CountValue(damage, f1, ct)
local curHp = role:GetRoleData(RoleDataName.Hp)
@ -3946,6 +3955,7 @@ local passivityList = {
end
end
end
--end)
end
role.Event:AddEvent(BattleEventName.FinalBeDamage, onFinalBeDamage,nil,nil,role)
@ -4257,7 +4267,7 @@ local passivityList = {
damagingFunc(shareDamage)
end
-- 分担伤害
BattleUtil.ApplyDamage(skill, atkRole, role, shareDamage,false,damageType,dotType,true)
BattleUtil.ApplyDamage(skill, atkRole, role, shareDamage,false,3,dotType,true)
end
end
BattleLogic.Event:AddEvent(BattleEventName.FinalDamage, onFinalDamage,nil,nil,role)
@ -5139,7 +5149,6 @@ local passivityList = {
-- 紫+橙
local num = OutDataManager.GetOutData(role.camp, id)
--LogError("笔使用次数:"..num)
num = min(maxNum, num)
BattleUtil.AddProp(role, pro1, f1 * num, ct1)
end,
@ -5839,7 +5848,7 @@ local passivityList = {
end
local num=0
for key, value in pairs(list) do
local isHave=BattleLogic.BuffMgr:HasBuff(value, BuffName.Control, function(buff) return buff.ctrlType == dot and buff.caster==role and buff.startRound == BattleLogic.GetCurRound() end)
local isHave=BattleLogic.BuffMgr:HasBuff(value, BuffName.Control, function(buff) return buff.ctrlType == dot end)
if isHave then
BattleUtil.CalRage(role, value, i1, CountTypeName.Sub)
end
@ -6159,6 +6168,7 @@ local passivityList = {
local shieldType = args[3]
local ele =args[4]
local OnBuffEnd=function(buff)
if buff.caster~=role then
return
end
@ -6168,6 +6178,7 @@ local passivityList = {
if shieldType and buff and buff.type==BuffName.Shield and buff.shieldType~=shieldType then
return
end
if buff and not buff.target:IsDead() and buff.type==BuffName.Shield then
local val = floor(BattleUtil.FP_Mul(v1, buff.target:GetRoleData(BattlePropList[pro])))
BattleUtil.CalTreat(role,buff.target, val)
@ -6283,7 +6294,9 @@ local passivityList = {
if not num then
num=1
end
local onSkillCastEnd=function(skill)
local fireNum=0
if skill and not skill.isTriggerJudge and judge==1 then
return
end
@ -6299,19 +6312,20 @@ local passivityList = {
end
--查找敌方燃烧数量
if num==10 then
num=0
fireNum=0
local arr=skill:GetDirectTargets()
-- local arr=RoleManager.Query(function (v) return v.camp~=role.camp end)
for i = 1, #arr do
local aaa=BattleLogic.BuffMgr:HasBuff(arr[i], BuffName.DOT, function (buff) return buff.damageType==1 end,role,1)
if aaa then
num=num+1
fireNum=fireNum+1
end
end
end
list=BattleUtil.SortByRage(list,0)
for i = 1, #list do
if i<=num then
if i<=fireNum then
BattleUtil.CalRage(role, list[i], v1, ct)
end
end
@ -7237,9 +7251,12 @@ local passivityList = {
local v2 = args[2]
local OnDead = function(atkRole,skill)
local arr=RoleManager.Query(function(v) return v.camp==role.camp and v~=role end)
--延时一帧,等所有英雄死亡结束后再执行逻辑
local roleRage=role.Rage
BattleLogic.WaitForTrigger(BattleLogic.GameDeltaTime,function()
local arr=RoleManager.Query(function(v) return v.camp==role.camp and v~=role and not BattleUtil.CheckIsNoDead(v) end)
local len=#arr
local rage1=role.Rage*v1
local rage1=roleRage*v1
if rage1<len*v2 then
rage1=len*v2
end
@ -7252,6 +7269,8 @@ local passivityList = {
BattleUtil.CalRage(role,arr[i],num1, CountTypeName.Add)
end
end
end)
end
role.Event:AddEvent(BattleEventName.RoleDead, OnDead,nil,nil,role)
end,
@ -7322,6 +7341,9 @@ local passivityList = {
return
end
if skill and skill.owner==role and (skill.type == BattleSkillType.Special or skill.type==BattleSkillType.Extra) and target:IsDead() and not BattleUtil.CheckIsNoDead(target) then
if damage~=target.killDamage then
return
end
local dmg= floor(BattleUtil.ErrorCorrection((damage-finalDmg)*f1))
if target:IsDead() then
allDamage=allDamage+dmg
@ -7728,6 +7750,75 @@ local passivityList = {
end
role.Event:AddEvent(BattleEventName.PassiveDamaging, onPassiveDamaging,nil,nil,role)
end,
-- 直接伤害击杀目标后下回合必定暴击
-- a[int]
[337] = function(role, args,id,judge)
local currRound = 1
local isKill=false
local isRoundCrit=false
-- 释放技能后
local onRoleHit = function(target,damage, bCrit, finalDmg, damageType, skill)
if skill and not skill.isTriggerJudge and judge==1 then
return
end
--如果是技能并且这个被动已经被触发过 return
if skill and BattleUtil.ChecklistIsContainValue(skill.triggerPassivityId,id) then
return
end
if target:IsDead() and not BattleUtil.CheckIsNoDead(target) then
currRound = BattleLogic.GetCurRound()
isKill=true
if skill then
table.insert(skill.triggerPassivityId,id)
end
end
end
role.Event:AddEvent(BattleEventName.RoleHit, onRoleHit,nil,nil,role)
local function onRoleDamageAfter(skill)
if isRoundCrit then
role.mustCrit = false
role.Event:RemoveEvent(BattleEventName.SkillCastEnd, onRoleDamageAfter)
end
end
local function onRoleDamageBefore(skill)
if skill and not skill.isTriggerJudge and judge==1 then
return
end
--最加的普攻不触发这个被动
if skill.type==BattleSkillType.Normal and skill.isAdd then
return
end
if isRoundCrit then
role.mustCrit = true
role.Event:AddEvent(BattleEventName.SkillCastEnd, onRoleDamageAfter,nil,nil,role)
end
end
role.Event:AddEvent(BattleEventName.SkillCast, onRoleDamageBefore,nil,nil,role)
local onRoundChange=function(round2)
if round2==currRound+1 and isKill then
isRoundCrit=true
else
isRoundCrit=false
isKill=false
end
currRound=round2
end
BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onRoundChange,nil,nil,role)
local onRoundStart=function(round2)
isKill=false
end
BattleLogic.Event:AddEvent(BattleEventName.BattleRoundStart, onRoundStart,nil,nil,role)
end,
}
return passivityList

View File

@ -515,7 +515,7 @@ function BattleUtil.Seckill(skill, atkRole, defRole)
local finalDmg = defRole.data:SubValue(RoleDataName.Hp, damage)
if finalDmg >= 0 then
if defRole:GetRoleData(RoleDataName.Hp) <= 0 and not defRole:IsDead() then
defRole:SetDead()
defRole:SetDead(damage)
defRole.Event:DispatchEvent(BattleEventName.RoleDead, atkRole,skill)
atkRole.Event:DispatchEvent(BattleEventName.RoleKill, defRole,skill)
BattleLogic.Event:DispatchEvent(BattleEventName.BattleRoleDead, defRole, atkRole)
@ -547,7 +547,7 @@ function BattleUtil.SeckillHP(skill, atkRole, defRole, pro)
local finalDmg = defRole.data:SubValue(RoleDataName.Hp, damage)
if finalDmg >= 0 then
if defRole:GetRoleData(RoleDataName.Hp) <= 0 and not defRole:IsDead() then
defRole:SetDead()
defRole:SetDead(damage)
defRole.Event:DispatchEvent(BattleEventName.RoleDead, atkRole)
atkRole.Event:DispatchEvent(BattleEventName.RoleKill, defRole,skill)
BattleLogic.Event:DispatchEvent(BattleEventName.BattleRoleDead, defRole, atkRole)
@ -679,7 +679,7 @@ function BattleUtil.FinalDamage(skill, atkRole, defRole, damage, bCrit, damageTy
local finalDmg = defRole.data:SubValue(RoleDataName.Hp, damage)
if finalDmg >= 0 then
if defRole:GetRoleData(RoleDataName.Hp) <= 0 and not defRole:IsDead() then
defRole:SetDead()
defRole:SetDead(damage)
defRole.Event:DispatchEvent(BattleEventName.RoleDead, atkRole)
atkRole.Event:DispatchEvent(BattleEventName.RoleKill, defRole,skill)
BattleLogic.Event:DispatchEvent(BattleEventName.BattleRoleDead, defRole, atkRole,skill,dotType)
@ -707,6 +707,7 @@ function BattleUtil.FinalDamage(skill, atkRole, defRole, damage, bCrit, damageTy
atkRole.Event:DispatchEvent(BattleEventName.RoleHit, defRole, damage, bCrit, finalDmg, damageType, skill,isDirect)
defRole.Event:DispatchEvent(BattleEventName.RoleBeHit, atkRole, damage, bCrit, finalDmg, damageType, skill,isDirect)
end
end
-- 战斗记录用
@ -799,7 +800,6 @@ function BattleUtil.CalDamage(skill, atkRole, defRole, damageType, baseFactor, i
-- 计算额外暴击伤害
critDamageFactor = 1.3 + atkRole:GetRoleData(RoleDataName.CritDamageFactor) - critDamageReduceFactor
--加入被动效果 触发暴击被动
local critFunc = function(critEx) critDamageFactor = critEx end
atkRole.Event:DispatchEvent(BattleEventName.PassiveCriting, critFunc,skill)

View File

@ -28,7 +28,7 @@ function RoleLogic:Init(uid, data, position)
self.data:Init(self, data.property)
self.isDead = self:GetRoleData(RoleDataName.Hp) <= 0
self.isRealDead = self.isDead
self.killDamage = 0 --致死伤害
self.camp = data.camp --阵营 0我方 1敌方
self.name = data.name
self.element = data.element
@ -560,8 +560,9 @@ function RoleLogic:SetDeadFilter(filter)
self.deadFilter = filter
end
-- 要死了
function RoleLogic:SetDead()
function RoleLogic:SetDead(damage)
self.isDead = true
self.killDamage=damage
RoleManager.AddDeadRole(self)
end
-- 判断是否死亡

View File

@ -366,12 +366,17 @@ function BuffCtrl:OnBuffStart(buff)
else
self:AddBuffEffect(eConfig.Hit)
self:AddBuffEffect(eConfig.Continue, false, eConfig.ContinueOffset)
--一个伤害打死目标同时被上buff 不显示buff提示(除非目标有不灭,死亡技能) change by:wangzhenxing,shihongyi 2021/7/7
if not self.owner.role:IsDead() or not self.owner.role:IsCanDead() or self.owner.role.isHaveNoDead then
if eConfig.DescribeIcon and eConfig.DescribeIcon ~= "" then
self.owner.Floater:ImageBuffFloating(eConfig.DescribeIcon)
else
self.owner.Floater:TextBuffFloating(eConfig.DescColorType, GetLanguageStrById(eConfig.Describe))
end
self:AddBuffIcon(buff, eConfig.Icon)
--else
-- LogError("//////////")
end
end
end

View File

@ -6,7 +6,7 @@ this.sendPlayerHead={}--发送者头像
--红包资源名
local RedPacketName={"g_ghhb_ming_01_zh","g_ghhb_ming_02_zh","g_ghhb_ming_03_zh","g_ghhb_ming_04_zh"}
--红包按钮状态图片
local BtnStateImage={"g_ghhb_qiang","g_ghhb_lingqu","g_ghhb_lingwan"}--抢 已领取 已领完
local BtnStateImage={"g_ghhb_qiang","g_ghhb_lingqu","g_ghhb_lingwan_zh"}--抢 已领取 已领完
function RedPacketPopup:InitComponent()
this.spLoader = SpriteLoader.New()