pvp的超回合按伤害算胜负

back_recharge
xuexinpeng 2021-11-23 14:17:57 +08:00
parent 13101fbdee
commit c8da24671b
19 changed files with 2016 additions and 405 deletions

View File

@ -1,6 +1,7 @@
package com.ljsd.fight;
public enum FightType {
CrossLuofuFight(0),//跨服罗浮争锋
StoryFight(1), //故事副本
MapExploreFight(2), // 地图探索
ArenaFight(3), //竞技场

View File

@ -144,6 +144,8 @@ end
function BattleMain.Execute(args, fightData, optionData)
_seed = args.seed
_type = args.type
print("战斗服type=="..args.type)
_maxRound = args.maxRound
_fightData = fightData
_optionData = optionData or {}
@ -224,14 +226,17 @@ function BattleMain.Execute(args, fightData, optionData)
-- 结果为2
resultList.result = 2
else
print("使用战斗结果===================")
resultList.result = BattleLogic.Result
end
resultList.curRound=curRound
resultList.curRound=curRound
local allHeroDamage, allEnemyDamage = BattleLogic.GetAllDamage()
-- print(allHeroDamage, allEnemyDamage)
if _type == BATTLE_SERVER_TYPE.GuildBossFight -- 公会boss
or _type == BATTLE_SERVER_TYPE.CarBossFight -- 车迟boss
or _type == BATTLE_SERVER_TYPE.GuildChallenge then -- 公会副本 -- 返回伤害值
or _type == BATTLE_SERVER_TYPE.GuildChallenge
or _type == BATTLE_SERVER_TYPE.CarPersonFight
then -- 公会副本 -- 返回伤害值
resultList.duration = allHeroDamage --TODO:公会boss的持续时间传递的是我方总伤害值
else
resultList.duration = BattleLogic.CurFrame() / BattleLogic.GameFrameRate

File diff suppressed because one or more lines are too long

View File

@ -16,6 +16,7 @@ local BuffRegister = {
[BuffName.Aura] = "Aura",
[BuffName.Brand] = "Brand",
[BuffName.Blood] = "Blood",
[BuffName.BanBlood] = "BanBlood",
}
@ -254,8 +255,10 @@ function BuffManager:ClearBuff(target, func)
if not buff.target:IsRealDead() then
if buff.type== BuffName.Shield then
buff.target.Event:DispatchEvent(BattleEventName.ShowHintText, BattleArtFontType.Shield)
elseif buff.type== BuffName.DOT or buff.type==BuffName.Control then
buff.target.Event:DispatchEvent(BattleEventName.ShowHintText, BattleArtFontType.clear)
elseif buff.type== BuffName.DOT or buff.type==BuffName.Control or buff.type==BuffName.BanBlood or buff.type==BuffName.Curse then
buff.target.Event:DispatchEvent(BattleEventName.ShowHintText, BattleArtFontType.clear)
elseif buff.type==BuffName.PropertyChange and buff.changeType and (buff.changeType==3 or buff.changeType==4 )then
buff.target.Event:DispatchEvent(BattleEventName.ShowHintText, BattleArtFontType.clear)
end
end
buff:OnEnd()

View File

@ -5,26 +5,6 @@ local max = math.max
--local BattleLogic = BattleLogic
--local BattleUtil = BattleUtil
--属性编号
-- local BattlePropList = {
-- RoleDataName.Attack,
-- RoleDataName.PhysicalDefence,
-- RoleDataName.MagicDefence,
-- RoleDataName.Speed,
-- RoleDataName.DamageBocusFactor,
-- RoleDataName.DamageReduceFactor,
-- RoleDataName.Hit,
-- RoleDataName.Dodge,
-- RoleDataName.Crit,
-- RoleDataName.CritDamageFactor,
-- RoleDataName.TreatFacter,
-- RoleDataName.MaxHp,
-- RoleDataName.Hp,
-- RoleDataName.CureFacter,
-- RoleDataName.Tenacity,
-- RoleDataName.InitRage,
-- }
local function buffRandomAction(random, target, buff)
-- 检测被动技能对技能的加成
@ -101,7 +81,7 @@ local effectList = {
local cb1 = args[2]
local f2 = args[3]
BattleLogic.WaitForTrigger(interval, function ()
BattleUtil.RandomControl(f1, cb1, caster, target, f2)
BattleUtil.RandomControl(f1, cb1, caster, target, f2,skill)
end)
end,
--[d]改变[a]属性[b]%,持续[c]秒
@ -225,7 +205,9 @@ local effectList = {
local dt = args[2]
local f2 = args[3]
BattleLogic.WaitForTrigger(interval, function ()
target:AddBuff(Buff.Create(caster, BuffName.DOT, f2, 1, 0, dt, f1))
local buff=Buff.Create(caster, BuffName.DOT, f2, 1, 0, dt, f1)
buff.skill=skill
target:AddBuff(buff)
end)
end,
--造成[a],每秒造成[b]的[c]的伤害,持续[d]秒
@ -392,7 +374,7 @@ local effectList = {
BattleLogic.WaitForTrigger(interval, function ()
BattleUtil.CalDamage(skill, caster, target, dt, f1)
if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end,caster,dot) then
BattleUtil.RandomControl(f1, ct, caster, target, f3)
BattleUtil.RandomControl(f1, ct, caster, target, f3,skill)
end
end)
end,
@ -474,7 +456,9 @@ local effectList = {
local d1 = args[1]
local d2 = args[2]
BattleLogic.WaitForTrigger(interval, function ()
target:AddBuff(Buff.Create(caster, BuffName.DOT, d2, 1, 0, d1, 1))
local buff=Buff.Create(caster, BuffName.DOT, d2, 1, 0, d1, 1)
buff.skill=skill
target:AddBuff(buff)
end)
end,
--造成[a]%的[b]伤害,对[c]造成额外[d]%伤害
@ -677,6 +661,7 @@ local effectList = {
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, skill, target)
BattleLogic.WaitForTrigger(interval, function ()
local dot = Buff.Create(caster, BuffName.DOT, d2, 1, 0, d1, 1)
dot.skill=skill
dot.isRealDamage = true
target:AddBuff(dot)
end)
@ -953,7 +938,7 @@ local effectList = {
local f3 = args[4]
BattleLogic.WaitForTrigger(interval, function ()
if BattleUtil.GetHPPencent(target) < f1 then
BattleUtil.RandomControl(f2, ct, caster, target, f3)
BattleUtil.RandomControl(f2, ct, caster, target, f3,skill)
end
end)
end,
@ -1164,7 +1149,7 @@ local effectList = {
-- 伤害
BattleUtil.CalDamage(skill, caster, target, dt, f1)
-- 控制未命中则施加增伤印记
if not BattleUtil.RandomControl(f2, 1, caster, target, f3) then
if not BattleUtil.RandomControl(f2, 1, caster, target, f3,skill) then
local brand = Buff.Create(caster, BuffName.Brand, 0, "zengshang")
brand.maxLayer = i1
brand.clear = false
@ -1253,6 +1238,7 @@ local effectList = {
BattleUtil.CalDamage(skill, caster, target, dt, f1)
local val = floor(BattleUtil.FP_Mul(caster:GetRoleData(RoleDataName.MaxHp), f2))
local dot = Buff.Create(caster, BuffName.DOT, f3, 1, 0, val, 1)
dot.skill=skill
dot.isRealDamage = true
target:AddBuff(dot)
end)
@ -1308,7 +1294,7 @@ local effectList = {
else
BattleUtil.CalDamage(skill, caster, target, dt, f1)
end
BattleUtil.RandomControl(f2, c1, caster, target, f4)
BattleUtil.RandomControl(f2, c1, caster, target, f4,skill)
end)
end)
end
@ -1322,7 +1308,9 @@ local effectList = {
local dt = args[4]
local f2 = args[5]
BattleLogic.WaitForTrigger(interval, function ()
buffRandomAction(f3, target, Buff.Create(caster, BuffName.DOT, f2, 1, d1, dt, f1))
local buff=Buff.Create(caster, BuffName.DOT, f2, 1, d1, dt, f1)
buff.skill=skill
buffRandomAction(f3, target,buff)
end)
end,
--造成[a]%的[b]伤害立即结算目标身上所有dot的剩余伤害。【aoe】
@ -1408,9 +1396,9 @@ local effectList = {
local arr = BattleUtil.ChooseTarget(caster, 20000)
for i=1, #arr do
if arr[i] == target then
BattleUtil.RandomControl(f1+f3, cb1, caster, arr[i], f2)
BattleUtil.RandomControl(f1+f3, cb1, caster, arr[i], f2,skill)
else
BattleUtil.RandomControl(f1, cb1, caster, arr[i], f2)
BattleUtil.RandomControl(f1, cb1, caster, arr[i], f2,skill)
end
end
end)
@ -1464,7 +1452,7 @@ local effectList = {
end
return b
end)
BattleUtil.RandomControl(f1+f3*layer, ct, caster, target, f2)
BattleUtil.RandomControl(f1+f3*layer, ct, caster, target, f2,skill)
end)
end,
--添加[a]的[b]%护盾,持续[c]秒。为自身挂护盾印记,每层额外增加护盾值[d]%,印记最多[e]层。印记不显示。(增益印记,不可驱散)
@ -1675,7 +1663,7 @@ local effectList = {
end
end)
if hasBuff then
BattleUtil.RandomControl(f2, ct, caster, target, f3)
BattleUtil.RandomControl(f2, ct, caster, target, f3,skill)
end
end)
end,
@ -1697,7 +1685,7 @@ local effectList = {
end
end)
if hasBuff then
BattleUtil.RandomControl(f2, ct, caster, target, f3)
BattleUtil.RandomControl(f2, ct, caster, target, f3,skill)
end
end)
end,
@ -1745,7 +1733,9 @@ local effectList = {
local f2 = args[5]
local f3 = args[6]
BattleLogic.WaitForTrigger(interval, function ()
buffRandomAction(f4, target, Buff.Create(caster, BuffName.DOT, f2, f2/f3, d1, dt, f1))
local buff=Buff.Create(caster, BuffName.DOT, f2, f2/f3, d1, dt, f1)
buff.skill=skill
buffRandomAction(f4, target,buff)
end)
end,
--造成[a]%的[b]伤害,若暴击,[g][c]%概率改变我方随机1人[d]属性[e]%,持续[f]秒。
@ -1850,6 +1840,7 @@ local effectList = {
local DOT = Buff.Create(caster, BuffName.DOT, f2, f2/f3, d1, f1, 1)
DOT.clear = false
DOT.isDeBuff = true
DOT.skill=skill
buffRandomAction(f4, target, DOT)
end)
end,
@ -1891,7 +1882,7 @@ local effectList = {
else
BattleUtil.CalDamage(skill, caster, target, dt, f1)
end
BattleUtil.RandomControl(f2, c1, caster, target, f4)
BattleUtil.RandomControl(f2, c1, caster, target, f4,skill)
end)
end)
end
@ -2174,7 +2165,7 @@ local effectList = {
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, skill, target)
BattleLogic.WaitForTrigger(interval, function ()
local damage = BattleUtil.ErrorCorrection(f2 * caster:GetRoleData(BattlePropList[pro]))
BattleUtil.RandomDot(f1, dot, caster, target, i1, 1, floor(damage))
BattleUtil.RandomDot(f1, dot, caster, target, i1, 1, floor(damage),skill)
end)
end,
@ -2205,7 +2196,7 @@ local effectList = {
BattleLogic.WaitForTrigger(interval, function ()
BattleUtil.CalDamage(skill, caster, target, dt, f1)
if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end,caster,dot) then
BattleUtil.RandomControl(f2, ct, caster, target, f3)
BattleUtil.RandomControl(f2, ct, caster, target, f3,skill)
end
end)
end,
@ -2315,7 +2306,7 @@ local effectList = {
BattleUtil.CalDamage(skill, caster, target, dt, f1)
--伤害命中才会给目标上buff
if skill and skill:CheckTargetIsHit(target) then
BattleUtil.RandomControl(pro1,ctrl, caster, target,r1)
BattleUtil.RandomControl(pro1,ctrl, caster, target,r1,skill)
end
end)
end,
@ -2460,11 +2451,13 @@ local effectList = {
value=0
end
if damage-value>0 then
if target.bloodShield then
target.bloodShield:AddValue(damage-value)
else
target:AddBuff(Buff.Create(caster,BuffName.Blood,0,damage-value))
end
if not target.isBanBlood then
if target.bloodShield then
target.bloodShield:AddValue(damage-value)
else
target:AddBuff(Buff.Create(caster,BuffName.Blood,0,damage-value))
end
end
end
end)
@ -2492,6 +2485,7 @@ local effectList = {
end
end
local buff=Buff.Create(caster, BuffName.DOT,round, 1,3,damage)
buff.skill=skill
buff.isRealDamage=true
target:AddBuff(buff)
end)

File diff suppressed because it is too large Load Diff

View File

@ -107,7 +107,8 @@ function BattleLogic.GetIsPvP()
BattleLogic.Type== BATTLE_SERVER_TYPE.ArenaFight or
BattleLogic.Type== BATTLE_SERVER_TYPE.CarPersonFight or
BattleLogic.Type== BATTLE_SERVER_TYPE.CrossYuxuLunDaoFight or
BattleLogic.Type== BATTLE_SERVER_TYPE.NewArenaFight then
BattleLogic.Type== BATTLE_SERVER_TYPE.NewArenaFight or
BattleLogic.Type== BATTLE_SERVER_TYPE.LINGMAIMIJING then
return true
end
return false
@ -485,10 +486,16 @@ function BattleLogic.Update()
BattleLogic.BattleEnd(0)
return
end
print("===================type==============="..BattleLogic.Type)
if CurRound > MaxRound then
if BattleLogic.Type == BATTLE_SERVER_TYPE.TOPFight -- 巅峰赛
or BattleLogic.Type == BATTLE_SERVER_TYPE.Firend then -- 好友切磋
or BattleLogic.Type == BATTLE_SERVER_TYPE.Firend
or BattleLogic.Type == BATTLE_SERVER_TYPE.CrossYuxuLunDaoFight
or BattleLogic.Type == BATTLE_SERVER_TYPE.LINGMAIMIJING
or BattleLogic.Type == BATTLE_SERVER_TYPE.CarPersonFight
or BattleLogic.Type == BATTLE_SERVER_TYPE.NewArenaFight then -- 好友切磋
if allHeroDamage>allEnemyDamage then
print("============="..allHeroDamage.." "..allEnemyDamage)
BattleLogic.BattleEnd(1)
else
BattleLogic.BattleEnd(0)

View File

@ -6,7 +6,7 @@ end
BATTLE_SERVER_TYPE = {
NewArenaFight = 0, --本地测试竞技场值
NewArenaFight = 0, --本地测试竞技场值/罗浮争锋
StoryFight = 1, --故事副本
MapExploreFight = 2, -- 地图探索
ArenaFight = 3, --竞技场
@ -25,7 +25,11 @@ BATTLE_SERVER_TYPE = {
TenDespairArray = 16,--十绝阵
Firend = 17,--好友
SenLuoHuanJing = 18,-- 森罗环境
TaSuiLingXiao = 19,-- 踏碎凌霄
FightLevel = 20,--
QiJieShiLian = 23,--七界试炼
CrossYuxuLunDaoFight = 24,--玉虚论道
LINGMAIMIJING = 25, --灵脉秘境
}
BattleEventName = {
@ -76,6 +80,7 @@ BattleEventName = {
RoleBeControl = indexAdd(), -- 角色被控制
RoleRealDead = indexAdd(), -- 角色真死了
RoleRelive = indexAdd(), -- 角色复活了
ReliveRole = indexAdd(), -- 复活角色
FinalDamage = indexAdd(),
FinalBeDamage = indexAdd(),
FinalBeDamageEnd = indexAdd(), --最后被攻击结束
@ -175,8 +180,15 @@ BattleEventName = {
ActionOperateAngerAfter =indexAdd(),--角色行动操作怒气后
HitRoleInBurn = indexAdd(), --击中在燃烧状态得敌人
ActionOperateAngerBefore =indexAdd(),--角色行动操作怒气前
BloodValueChange = indexAdd(), --御甲发发生改变
BloodValueChange = indexAdd(), --御甲发发生改变
CheckLiZhanZhiQu = indexAdd(),--检测历战之躯
SkillCastCostRageEnd = indexAdd(), --技能释放最后扣除怒气
BloodValuePassiveChange = indexAdd(),--被动修改御甲值
TemporaryChangeCrit = indexAdd(),--临时改变暴击率
RoleAddCtrlBuff = indexAdd(),--角色添加控制类buff
CastRageBrfore = indexAdd(),--扣除怒气之前
PassiveAddCritDamageFactor = indexAdd(), --被动增加爆伤系数
PassiveChangeIgnoreImmuneValue = indexAdd(),--被动修改无视
}
BattleMaxFrame = 1000000
@ -184,35 +196,64 @@ BattleMaxFrame = 1000000
index = 0
RoleDataName = {
Level = indexAdd(), --等级
Hp = indexAdd(), --生命
MaxHp = indexAdd(), --最大生命
Attack = indexAdd(), --攻击力
PhysicalDefence = indexAdd(),--护甲
MagicDefence = indexAdd(),--魔抗
Speed = indexAdd(),--速度
Level = indexAdd(), --等级
Hp = indexAdd(), --生命
MaxHp = indexAdd(), --最大生命
Attack = indexAdd(), --攻击力
PhysicalDefence = indexAdd(), --护甲
MagicDefence = indexAdd(), --魔抗
Speed = indexAdd(), --速度
DamageBocusFactor = indexAdd(), --伤害加成系数(%
DamageReduceFactor = indexAdd(), --伤害减免系数(%
Hit = indexAdd(), --施法率(%
Hit = indexAdd(), --施法率(%
Dodge = indexAdd(), --后期基础施法率(%
Crit = indexAdd(), --暴击率(%
CritDamageFactor = indexAdd(), --暴击伤害系数(%
Crit = indexAdd(), --暴击率(%
CritDamageBonus = indexAdd(), --暴击伤害系数(%
Tenacity = indexAdd(), --抗暴率(%
TreatFacter = indexAdd(),--治疗加成系数(%
TreatFacter = indexAdd(), --治疗加成系数(%
CureFacter = indexAdd(),--受到治疗加成系数(%
TeamDamageBocusFactor = indexAdd(),--队伍伤害加成系数(%
TeamDamageReduceFactor = indexAdd(),--队伍伤害减免系数(%
FireDamageReduceFactor = indexAdd(), --火系伤害减免系数(%
WindDamageReduceFactor = indexAdd(), --风系伤害减免系数(%
IceDamageReduceFactor = indexAdd(), --冰系伤害减免系数(%
LandDamageReduceFactor = indexAdd(), --地系伤害减免系数(%
LightDamageReduceFactor = indexAdd(), --光系伤害减免系数(%
DarkDamageReduceFactor = indexAdd(), --暗系伤害减免系数(%
ElementDamageBocusFactor = indexAdd(), --属性伤害加成系数(%
RenBonus = indexAdd(), --人系伤害加成
FoBonus = indexAdd(), --佛系伤害加成
YaoBonus = indexAdd(), --妖系伤害加成
DaoBonus = indexAdd(), --道系伤害加成
RenReduce = indexAdd(), --人系伤害减免
FoReduce = indexAdd(), --佛系伤害减免
YaoReduce = indexAdd(), --妖系伤害减免
DaoReduce = indexAdd(), --道系伤害减免
CritDamageReduce = indexAdd(), --暴击伤害减免
InitRage = indexAdd(), --初始怒气值
}
-- 战斗表属性id对应战斗中属性数据
BattlePropList = {
RoleDataName.Attack,
RoleDataName.PhysicalDefence,
RoleDataName.MagicDefence,
RoleDataName.Speed,
RoleDataName.DamageBocusFactor,
RoleDataName.DamageReduceFactor,
RoleDataName.Hit,
RoleDataName.Dodge,
RoleDataName.Crit,
RoleDataName.CritDamageBonus,
RoleDataName.TreatFacter,
RoleDataName.MaxHp,
RoleDataName.Hp,
RoleDataName.CureFacter,
RoleDataName.Tenacity,
RoleDataName.InitRage,
RoleDataName.RenBonus,
RoleDataName.FoBonus,
RoleDataName.YaoBonus,
RoleDataName.DaoBonus,
RoleDataName.RenReduce,
RoleDataName.FoReduce,
RoleDataName.YaoReduce,
RoleDataName.DaoReduce,
RoleDataName.CritDamageReduce,
}
BuffName = {
PropertyChange = 1,
Control = 2,
@ -227,6 +268,7 @@ BuffName = {
Aura = 11,
Brand = 12,
Blood = 13,
BanBlood = 14,
}
DotType = {
@ -294,27 +336,6 @@ skill6={100923,0.15,1.5,1,{260004,{126,0.48,2,4,1,0,4,12,0}}},
}
-- 战斗表属性id对应战斗中属性数据
BattlePropList = {
RoleDataName.Attack,
RoleDataName.PhysicalDefence,
RoleDataName.MagicDefence,
RoleDataName.Speed,
RoleDataName.DamageBocusFactor,
RoleDataName.DamageReduceFactor,
RoleDataName.Hit,
RoleDataName.Dodge,
RoleDataName.Crit,
RoleDataName.CritDamageFactor,
RoleDataName.TreatFacter,
RoleDataName.MaxHp,
RoleDataName.Hp,
RoleDataName.CureFacter,
RoleDataName.Tenacity,
RoleDataName.InitRage,
}
CurseTypeName = {
ShareDamage = 1,
}
@ -346,4 +367,19 @@ BattleArtFontType = {
Immune = 1, -- 免疫文字
Shield = 2, --破盾文字
clear = 3, --清除文字
Blood = 4, --禁甲文字
}
BattleMieProp = {
[BattleRoleElementType.REN] = RoleDataName.RenBonus,
[BattleRoleElementType.FO] = RoleDataName.FoBonus,
[BattleRoleElementType.YAO] = RoleDataName.YaoBonus,
[BattleRoleElementType.DAO] = RoleDataName.DaoBonus
}
BattleKangProp = {
[BattleRoleElementType.REN] = RoleDataName.RenReduce,
[BattleRoleElementType.FO] = RoleDataName.FoReduce,
[BattleRoleElementType.YAO] = RoleDataName.YaoReduce,
[BattleRoleElementType.DAO] = RoleDataName.DaoReduce
}

View File

@ -607,16 +607,9 @@ function BattleUtil.ApplyDamage(skill, atkRole, defRole, damage, bCrit, damageTy
bCrit = bCrit or false
damageType = damageType or 0
-- if atkRole.isTeam then
-- --max技能基础伤害*1+已方异妖伤害加成-目标异妖伤害减免30%×技能基础伤害)
-- local arr = RoleManager.Query(function (r) return r.camp == atkRole.camp end)
-- local n = 0
-- for i=1, #arr do
-- n = n + arr[i]:GetRoleData(RoleDataName.TeamDamageBocusFactor)
-- end
-- damage = floor(max(damage * (1 + n / #arr - defRole:GetRoleData(RoleDataName.TeamDamageReduceFactor)), 0.3 * damage))
-- end
-- 计算护盾减伤
damage = BattleUtil.CalShield(atkRole, defRole, damage,skill)
--加入被动效果
local damagingFunc = function(dmgDeduction)
damage = damage - dmgDeduction
@ -625,10 +618,6 @@ function BattleUtil.ApplyDamage(skill, atkRole, defRole, damage, bCrit, damageTy
defRole.Event:DispatchEvent(BattleEventName.PassiveBeDamaging, damagingFunc, atkRole, damage, skill, dotType, bCrit)
BattleLogic.Event:DispatchEvent(BattleEventName.PassiveDamaging, damagingFunc, atkRole, defRole, damage, skill, dotType, bCrit,damageType, dotType,isDirect)
-- 计算护盾减伤
damage = BattleUtil.CalShield(atkRole, defRole, damage,skill)
-- 造成的最终伤害
local damagingFunc = function(dmgDeduction)
damage = damage - dmgDeduction
@ -651,13 +640,23 @@ function BattleUtil.ApplyDamageNoPassive(skill, atkRole, defRole, damage, bCrit,
-- 计算护盾减伤
damage = BattleUtil.CalShield(atkRole, defRole, damage,skill)
-- 造成的最终伤害
local damagingFunc = function(dmgDeduction)
local damagingFunc = function(dmgDeduction)
--不计算增伤只计算减伤
if dmgDeduction<0 then
return
end
damage = damage - dmgDeduction
end
atkRole.Event:DispatchEvent(BattleEventName.PassiveDamaging, damagingFunc, defRole, damage, skill, dotType, bCrit,damageType, dotType,isDirect)
defRole.Event:DispatchEvent(BattleEventName.PassiveBeDamaging, damagingFunc, atkRole, damage, skill, dotType, bCrit)
BattleLogic.Event:DispatchEvent(BattleEventName.PassiveDamaging, damagingFunc, atkRole, defRole, damage, skill, dotType, bCrit,damageType, dotType,isDirect)
atkRole.Event:DispatchEvent(BattleEventName.FinalDamage, damagingFunc, defRole, damage, skill, dotType, bCrit, damageType)
defRole.Event:DispatchEvent(BattleEventName.FinalBeDamage, damagingFunc, atkRole, damage, skill, dotType, bCrit, damageType)
defRole.Event:DispatchEvent(BattleEventName.FinalBeDamageEnd, damagingFunc, atkRole, damage, skill, dotType, bCrit, damageType,isDirect)
BattleLogic.Event:DispatchEvent(BattleEventName.FinalDamage, damagingFunc, atkRole, defRole, damage, skill, dotType, bCrit, damageType)
--
return BattleUtil.FinalDamage(skill, atkRole, defRole, damage, bCrit, damageType, dotType,isDirect)
end
@ -747,7 +746,7 @@ function BattleUtil.FinalDamage(skill, atkRole, defRole, damage, bCrit, damageTy
local realDamage=damage
--血量防护只会防直接伤害
if defRole.bloodShield and skill then
realDamage=math.abs(defRole.bloodShield:CountBloodValue(damage))
realDamage=math.abs(defRole.bloodShield:CountBloodValue(damage,atkRole))
-- damage=realDamage
end
--检测历战之躯
@ -814,8 +813,8 @@ function BattleUtil.FinalDamageCountShield(skill, atkRole, defRole, damage, bCri
if defRole.type == BattleUnitType.Monster or defRole.type == BattleUnitType.Player then
return
end
-- 计算盾减伤
damage = BattleUtil.CalShield(atkRole, defRole, damage,skill)
-- 计算无敌盾减伤
damage = BattleUtil.CalAllReduceShield(atkRole, defRole, damage,skill)
if damage < 0 then damage = 0 end
if skill and skill.type==BattleSkillType.Special then
@ -825,7 +824,7 @@ function BattleUtil.FinalDamageCountShield(skill, atkRole, defRole, damage, bCri
local realDamage=damage
--血量防护只会防直接伤害
if defRole.bloodShield and skill then
realDamage=math.abs(defRole.bloodShield:CountBloodValue(damage))
realDamage=math.abs(defRole.bloodShield:CountBloodValue(damage,atkRole))
-- damage=realDamage
end
--检测历战之躯
@ -898,13 +897,42 @@ function BattleUtil.CalDamage(skill, atkRole, defRole, damageType, baseFactor, i
if defRole.type == BattleUnitType.Monster or defRole.type == BattleUnitType.Player then
return
end
-- 判断是否命中
if skill and not skill:CheckTargetIsHit(defRole) and atkRole.type==BattleUnitType.Role then
BattleLogic.Event:DispatchEvent(BattleEventName.HitMiss, atkRole, defRole, skill)
atkRole.Event:DispatchEvent(BattleEventName.HitMiss, defRole, skill)
defRole.Event:DispatchEvent(BattleEventName.BeHitMiss, atkRole, skill)
return 0
-- 是否暴击: 暴击率 = 自身暴击率 - 对方抗暴率
local bCrit = false
local critRandom = Random.Range01()
--特殊处理 白骨精附加的普攻不会必定暴击
local mustCrit=atkRole.mustCrit
if atkRole.roleId==10091 and skill and skill.type==BattleSkillType.Normal and skill.isAdd then
mustCrit=false
end
local addCrit=0
local isMustHit=false
-- 计算被动对暴击概率的影响
local critFunc = function(df, dt,hit)
addCrit = BattleUtil.CountValue(addCrit, df, dt)
isMustHit = hit
end
BattleLogic.Event:DispatchEvent(BattleEventName.TemporaryChangeCrit,critFunc,atkRole,defRole,skill)
local critCondition = clamp(atkRole:GetRoleData(RoleDataName.Crit)+addCrit - defRole:GetRoleData(RoleDataName.Tenacity), 0, 1)
bCrit = critRandom <= critCondition
--处理达摩神魂被动必定命中
if not bCrit or addCrit==0 then
isMustHit=false
end
bCrit =mustCrit or bCrit or defRole.isFlagCrit == true -- 必定暴击
-- 判断是否命中
if not isMustHit then
if (skill and not skill:CheckTargetIsHit(defRole) and atkRole.type==BattleUnitType.Role) then
BattleLogic.Event:DispatchEvent(BattleEventName.HitMiss, atkRole, defRole, skill)
atkRole.Event:DispatchEvent(BattleEventName.HitMiss, defRole, skill)
defRole.Event:DispatchEvent(BattleEventName.BeHitMiss, atkRole, skill)
return 0
end
end
-- 如果是队伍技能计算真实伤害则damageType为伤害值
if atkRole.isTeam and not defRole:IsDead() then
return BattleUtil.ApplyDamage(skill, atkRole, defRole, damageType), false
@ -934,18 +962,7 @@ function BattleUtil.CalDamage(skill, atkRole, defRole, damageType, baseFactor, i
-- 基础伤害增加系数
local addDamageFactor = 1 + atkRole:GetRoleData(RoleDataName.DamageBocusFactor) - defRole:GetRoleData(RoleDataName.DamageReduceFactor)
-- 是否暴击: 暴击率 = 自身暴击率 - 对方抗暴率
local bCrit = false
local critRandom = Random.Range01()
--特殊处理 白骨精附加的普攻不会必定暴击
local mustCrit=atkRole.mustCrit
if atkRole.roleId==10091 and skill and skill.type==BattleSkillType.Normal and skill.isAdd then
mustCrit=false
end
local critCondition = clamp(atkRole:GetRoleData(RoleDataName.Crit) - defRole:GetRoleData(RoleDataName.Tenacity), 0, 1)
bCrit = critRandom <= critCondition
bCrit =mustCrit or bCrit or defRole.isFlagCrit == true -- 必定暴击
-- 计算暴伤害系数
local critDamageFactor = 1
local critDamageReduceFactor = 0 -- 暴击伤害减免
@ -962,16 +979,33 @@ function BattleUtil.CalDamage(skill, atkRole, defRole, damageType, baseFactor, i
defRole.Event:DispatchEvent(BattleEventName.CritDamageReduceFactor, onCritDamageReduceFactor, atkRole, defRole)
BattleLogic.Event:DispatchEvent(BattleEventName.CritDamageReduceFactor, onCritDamageReduceFactor, atkRole, defRole)
critDamageReduceFactor = max(BattleUtil.CountChangeList(critDamageReduceFactor, cl), 0)
-- 计算额外暴击伤害
critDamageFactor = 1.3 + atkRole:GetRoleData(RoleDataName.CritDamageFactor) - critDamageReduceFactor
local critDamageAddFactor=0
--加入被动效果 触发暴击被动
local critFunc = function(critEx) critDamageFactor = critEx end
atkRole.Event:DispatchEvent(BattleEventName.PassiveCriting, critFunc,skill)
local cl2 = {}
local onCritDamageAddFactor = function(v, ct)
if v then
table.insert(cl2, {v, ct})
end
end
atkRole.Event:DispatchEvent(BattleEventName.PassiveAddCritDamageFactor, onCritDamageAddFactor, atkRole, defRole)
critDamageAddFactor = max(BattleUtil.CountChangeList(critDamageAddFactor, cl2), 0)
-- 计算额外暴击伤害
critDamageFactor = 1.3 + atkRole:GetRoleData(RoleDataName.CritDamageBonus) - defRole:GetRoleData(RoleDataName.CritDamageReduce)+critDamageAddFactor - critDamageReduceFactor
--加入被动效果 触发暴击被动 废弃不用
-- local critFunc = function(critEx) critDamageFactor = critEx end
-- atkRole.Event:DispatchEvent(BattleEventName.PassiveCriting, critFunc,skill)
end
-- 公式伤害 = 基础伤害 * 基础伤害系数 * 增伤系数 * 爆伤系数
local fixDamage = floor(BattleUtil.FP_Mul(baseDamage, baseFactor, addDamageFactor, critDamageFactor))
-- 计算克制伤害系数
local MieKangFactor = 1
if atkRole.type == BattleUnitType.Role and defRole.type == BattleUnitType.Role then
MieKangFactor=MieKangFactor + atkRole:GetRoleData(BattleMieProp[defRole.element]) - defRole:GetRoleData(BattleKangProp[atkRole.element])
end
-- 公式伤害 = 基础伤害 * 基础伤害系数 * 增伤系数 * 爆伤系数 * 克制伤害系数
local fixDamage = floor(BattleUtil.FP_Mul(baseDamage, baseFactor, addDamageFactor, critDamageFactor, MieKangFactor))
-- 公式计算完成
local damageFunc = function(damage) fixDamage = damage end
@ -1011,7 +1045,7 @@ function BattleUtil.CalTreat(castRole, targetRole, value, baseFactor,skill)
--计算暴击
if bCrit then
--伤害有个+1.3 不知道干什么用的就给去了 by:wangxhenxing 2020/10/10 18:46
critDamageFactor = 1.3 + castRole:GetRoleData(RoleDataName.CritDamageFactor)
critDamageFactor = 1.3 + castRole:GetRoleData(RoleDataName.CritDamageBonus)
end
-- 基础伤害增加系数
local addDamageFactor = 1 + castRole:GetRoleData(RoleDataName.DamageBocusFactor)
@ -1046,8 +1080,8 @@ function BattleUtil.FinalTreat(castRole, targetRole, value, baseFactor,skill)
targetRole.data:AddValue(RoleDataName.Hp, treat)
end
castRole.Event:DispatchEvent(BattleEventName.RoleTreat, targetRole, treat, baseTreat)
targetRole.Event:DispatchEvent(BattleEventName.RoleBeTreated, castRole, treat, baseTreat)
castRole.Event:DispatchEvent(BattleEventName.RoleTreat, targetRole, treat, baseTreat,skill)
targetRole.Event:DispatchEvent(BattleEventName.RoleBeTreated, castRole, treat, baseTreat,skill)
--添加发送到battleLogic的治疗消息用于计算总的战斗伤害值
BattleLogic.Event:DispatchEvent(BattleEventName.RoleBeTreated, castRole, treat, baseTreat)
-- 战斗记录用
@ -1111,8 +1145,8 @@ function BattleUtil.ApplyTreat(castRole, targetRole, value, baseFactor,critDamag
if treat > 0 then
targetRole.data:AddValue(RoleDataName.Hp, treat)
end
castRole.Event:DispatchEvent(BattleEventName.RoleTreat, targetRole, treat, baseTreat)
targetRole.Event:DispatchEvent(BattleEventName.RoleBeTreated, castRole, treat, baseTreat)
castRole.Event:DispatchEvent(BattleEventName.RoleTreat, targetRole, treat, baseTreat,skill)
targetRole.Event:DispatchEvent(BattleEventName.RoleBeTreated, castRole, treat, baseTreat,skill)
--添加发送到battleLogic的治疗消息用于计算总的战斗伤害值
BattleLogic.Event:DispatchEvent(BattleEventName.RoleBeTreated, castRole, treat, baseTreat)
-- 战斗记录用
@ -1145,6 +1179,19 @@ function BattleUtil.CheckIsHit(atkRole, defRole,skill)
end
function BattleUtil.AddBlood(target,value)
if not target.isBanBlood then
if target.bloodShield then
target.bloodShield:AddValue(value)
else
target:AddBuff(Buff.Create(target, BuffName.Blood,0,value))
end
else
target.Event:DispatchEvent(BattleEventName.ShowHintText, BattleArtFontType.Blood)
end
end
--获取table的长度
function BattleUtil.LengthOfTable(table)
if not table then
@ -1166,7 +1213,7 @@ function BattleUtil.RandomAction(rand, action)
end
--
function BattleUtil.RandomControl(rand, ctrl, caster, target, round)
function BattleUtil.RandomControl(rand, ctrl, caster, target, round,skill)
local cl = {}
local function _CallBack(v, ct)
@ -1185,11 +1232,12 @@ function BattleUtil.RandomControl(rand, ctrl, caster, target, round)
buff.target=target
BattleLogic.Event:DispatchEvent(BattleEventName.RoleAddBuffFail,buff)
end
BattleLogic.Event:DispatchEvent(BattleEventName.RoleAddCtrlBuff,buff,isAdd,caster,target,skill)
return isAdd
end
--
function BattleUtil.RandomDot(rand, dot, caster, target, round, interval, damage)
function BattleUtil.RandomDot(rand, dot, caster, target, round, interval, damage,skill)
local cl = {}
local dcl = {}
@ -1208,6 +1256,7 @@ function BattleUtil.RandomDot(rand, dot, caster, target, round, interval, damage
return BattleUtil.RandomAction(rand, function()
local buff = Buff.Create(caster, BuffName.DOT, round, interval, dot, damage)
buff.skill=skill
buff.isRealDamage = true
target:AddBuff(buff)
end)
@ -1352,7 +1401,7 @@ function BattleUtil.CheckSeckill(bf, kf, caster, target)
table.insert(kcl, {kv, kct})
end
end
caster.Event:DispatchEvent(BattleEventName.PassiveSeckill, _CallBack)
caster.Event:DispatchEvent(BattleEventName.PassiveSeckill, _CallBack,target)
target.Event:DispatchEvent(BattleEventName.PassiveBeSeckill, _CallBack)
bf = BattleUtil.CountChangeList(bf, bcl)
kf = BattleUtil.CountChangeList(kf, kcl)

View File

@ -24,6 +24,7 @@ function Monster:Init(data)
self.uid= data.id
self.teamDamage=data.teamDamage
self.roleData = data
self.sex=data.sex
self.data:Init(self, data.property)
self.buffFilter:Clear() --buff屏蔽列表
self.Event:ClearEvent()

View File

@ -25,7 +25,7 @@ function MSkill:Init(owner, group, index, skillData)
--MTrigger.AddSkill(self.skillData, self.skillData.triggerCondition, self)
local effectData = self.skillData.effect
self.id = effectData[1] -- 技能ID
self.id = tonumber(effectData[1]) -- 技能ID
-- 将技能加入触发检测
MTrigger.AddSkill(self.skillData.triggerId, self.skillData.triggerCondition, self)
self.hitTime = effectData[2] -- 效果命中需要的时间

View File

@ -2,92 +2,161 @@ require("Modules.Battle.Logic.Monster.MonsterSkill.MCondition")
MTrigger = {}
local this = MTrigger
-- local _TriggerConfig = {
-- [1] = { --1敌方单位行动前
-- event = BattleEventName.RoleTurnStart,
-- triggerFunc = function(skill, ...)
-- local args = {...}
-- local role = args[1]
-- return role.camp ~= skill.owner.camp
-- end
-- },
-- [2] = {--2敌方单位行动后
-- event = BattleEventName.RoleTurnEnd,
-- triggerFunc = function(skill, ...)
-- local args = {...}
-- local role = args[1]
-- return role.camp ~= skill.owner.camp
-- end
-- },
-- [3] = {--3我方单位行动前
-- event = BattleEventName.RoleTurnStart,
-- triggerFunc = function(skill, ...)
-- local args = {...}
-- local role = args[1]
-- return role.camp == skill.owner.camp
-- end
-- },
-- [4] = {--4我方单位行动后
-- event = BattleEventName.RoleTurnEnd,
-- triggerFunc = function(skill, ...)
-- local args = {...}
-- local role = args[1]
-- return role.camp == skill.owner.camp
-- end
-- },
-- [5] = {--5战前
-- event = BattleEventName.BattleStart,
-- triggerFunc = function(skill, ...)
-- return true
-- end
-- },
-- [6] = {--6奇数回合开始前
-- event = BattleEventName.BattleRoundStart,
-- triggerFunc = function(skill, ...)
-- local args = {...}
-- local curRound = args[1]
-- return curRound%2 == 1
-- end
-- },
-- [7] = {--7偶数回合开始前
-- event = BattleEventName.BattleRoundStart,
-- triggerFunc = function(skill, ...)
-- local args = {...}
-- local curRound = args[1]
-- return curRound%2 == 0
-- end
-- },
-- [8] = {--8奇数回合结束后
-- event = BattleEventName.BattleRoundEnd,
-- triggerFunc = function(skill, ...)
-- local args = {...}
-- local curRound = args[1]
-- return curRound%2 == 1
-- end
-- },
-- [9] = {--9偶数回合结束后
-- event = BattleEventName.BattleRoundEnd,
-- triggerFunc = function(skill, ...)
-- local args = {...}
-- local curRound = args[1]
-- return curRound%2 == 0
-- end
-- },
-- [10] = {--10回合开始前
-- event = BattleEventName.BattleRoundStart,
-- triggerFunc = function(skill, ...)
-- return true
-- end
-- },
-- [11] = {--11回合结束后
-- event = BattleEventName.BattleRoundEnd,
-- triggerFunc = function(skill, ...)
-- return true
-- end
-- },
-- [12] = {--12我方单位释放技能后
-- event = BattleEventName.SkillCastEnd,
-- triggerFunc = function(skill, ...)
-- local args = {...}
-- local castSkill = args[1]
-- return castSkill.owner.camp == skill.owner.camp and castSkill.owner.job==2 and (castSkill.type==BattleSkillType.DeadSkill or castSkill.type==BattleSkillType.Extra or castSkill.type==BattleSkillType.Special)
-- end
-- },
-- }
local _TriggerConfig = {
[1] = { --1敌方单位行动前
event = BattleEventName.RoleTurnStart,
triggerFunc = function(skill, ...)
[BattleEventName.RoleTurnStart] = {
[1] = function(skill, ...) --1敌方单位行动前
local args = {...}
local role = args[1]
return role.camp ~= skill.owner.camp
end
},
[2] = {--2敌方单位行动后
event = BattleEventName.RoleTurnEnd,
triggerFunc = function(skill, ...)
local args = {...}
local role = args[1]
return role.camp ~= skill.owner.camp
end
},
[3] = {--3我方单位行动前
event = BattleEventName.RoleTurnStart,
triggerFunc = function(skill, ...)
end,
[3] = function(skill, ...) --3我方单位行动前
local args = {...}
local role = args[1]
return role.camp == skill.owner.camp
end
},
[4] = {--4我方单位行动后
event = BattleEventName.RoleTurnEnd,
triggerFunc = function(skill, ...)
[BattleEventName.RoleTurnEnd] = {
[2] = function(skill, ...)--2敌方单位行动后
local args = {...}
local role = args[1]
return role.camp ~= skill.owner.camp
end,
[4] = function(skill, ...)--4我方单位行动后
local args = {...}
local role = args[1]
return role.camp == skill.owner.camp
end
},
[5] = {--5战前
event = BattleEventName.BattleStart,
triggerFunc = function(skill, ...)
[BattleEventName.BattleStart] = {
[5] = function(skill, ...)--5战前
return true
end
},
[6] = {--6奇数回合开始前
event = BattleEventName.BattleRoundStart,
triggerFunc = function(skill, ...)
[BattleEventName.BattleRoundStart] = {
[6] = function(skill, ...)--6奇数回合开始前
local args = {...}
local curRound = args[1]
return curRound%2 == 1
end
},
[7] = {--7偶数回合开始前
event = BattleEventName.BattleRoundStart,
triggerFunc = function(skill, ...)
end,
[7] = function(skill, ...)--7偶数回合开始前
local args = {...}
local curRound = args[1]
return curRound%2 == 0
end,
[10] = function(skill, ...)--10回合开始前
return true
end
},
[8] = {--8奇数回合结束后
event = BattleEventName.BattleRoundEnd,
triggerFunc = function(skill, ...)
[BattleEventName.BattleRoundEnd] = {
[8] = function(skill, ...)--8奇数回合结束后
local args = {...}
local curRound = args[1]
return curRound%2 == 1
end
},
[9] = {--9偶数回合结束后
event = BattleEventName.BattleRoundEnd,
triggerFunc = function(skill, ...)
end,
[9] = function(skill, ...)--9偶数回合结束后
local args = {...}
local curRound = args[1]
return curRound%2 == 0
end
},
[10] = {--10回合开始前
event = BattleEventName.BattleRoundStart,
triggerFunc = function(skill, ...)
end,
[11] = function(skill, ...)--11回合结束后
return true
end
},
[11] = {--11回合结束后
event = BattleEventName.BattleRoundEnd,
triggerFunc = function(skill, ...)
return true
end
},
[12] = {--12我方单位释放技能后
event = BattleEventName.SkillCastEnd,
triggerFunc = function(skill, ...)
[BattleEventName.SkillCastEnd] = {
[12] = function(skill, ...)--12我方单位释放技能后
local args = {...}
local castSkill = args[1]
return castSkill.owner.camp == skill.owner.camp and castSkill.owner.job==2 and (castSkill.type==BattleSkillType.DeadSkill or castSkill.type==BattleSkillType.Extra or castSkill.type==BattleSkillType.Special)
@ -104,32 +173,48 @@ end
function this.InitListener()
--每次初始化时间监听前 清除下缓存数据
MCondition.ClearCache()
for triggerId, config in pairs(_TriggerConfig) do
BattleLogic.Event:AddEvent(config.event, function(...)
for event, list in pairs(_TriggerConfig) do
BattleLogic.Event:AddEvent(event, function(...)
-- 用于排序
local firstList = {}
-- 用于排序
local sortList = {}
-- 判断是否有需要触发的技能
local triggerSkill = this.TriggerList[triggerId]
if not triggerSkill then
return
end
for _, trigger in ipairs(triggerSkill) do
local skill = trigger.skill
local condition = trigger.condition
-- 判断技能是否可以释放
if skill:canCastSkill() then
-- 判断是否符合触发类型条件
if config.triggerFunc(skill, ... ) then
-- 检测是否符合子条件
if MCondition.CheckCondition(skill, condition) then
-- 加入技能排序对列
table.insert(sortList, skill)
for triggerId, triggerFunc in pairs(list) do
-- 判断是否有需要触发的技能
local triggerSkill = this.TriggerList[triggerId]
if triggerSkill then
for _, trigger in ipairs(triggerSkill) do
local skill = trigger.skill
local condition = trigger.condition
-- 判断技能是否可以释放
if skill:canCastSkill() then
-- 判断是否符合触发类型条件
if triggerFunc(skill, ... ) then
-- 检测是否符合子条件
if MCondition.CheckCondition(skill, condition) then
-- 加入技能排序对列
if skill.owner.position == 100 then
table.insert(firstList, skill)
else
table.insert(sortList, skill)
end
end
end
end
end
end
end
end
-- 对技能进行排序
table.sort(firstList, function(a, b)
-- 同阵营按位置排序
if a.owner.camp == b.owner.camp then
return a.owner.position < b.owner.position
else
-- 不同阵营的根据先手阵营排序
return a.owner.camp == BattleLogic.FirstCamp
end
end)
-- 对技能进行排序
table.sort(sortList, function(a, b)
-- 同阵营按位置排序
if a.owner.camp == b.owner.camp then
@ -140,6 +225,9 @@ function this.InitListener()
end
end)
-- 依次加入技能管理
for _, skill in ipairs(firstList) do
SkillManager.AddMonsterSkill(skill)
end
for _, skill in ipairs(sortList) do
SkillManager.AddMonsterSkill(skill)
end

View File

@ -47,7 +47,9 @@ function RoleLogic:Init(uid, data, position)
self.Event:ClearEvent()
self.skill = data.skill
self.skill[1] = tonumber(self.skill[1])
self.superSkill = data.superSkill
self.superSkill[1] = tonumber(self.superSkill[1])
--首次读条时间=速度/20*(等级+10
self.sp = 0
local time = self:GetRoleData(RoleDataName.Speed)/(20*(self:GetRoleData(RoleDataName.Level)+10))
@ -83,6 +85,7 @@ function RoleLogic:Init(uid, data, position)
self.IsCanAddSkill = true -- 是否可以追加技能
self.mustHit=false --必定命中
self.mustCrit=false --必定暴击
self.isBanBlood=false --是否禁止上御甲
self.isImmuneAllReduceShield = false --免疫敌方无敌盾(敌方无敌盾对自己无效)
self.ignoreShara = false --忽略敌方分摊
self.type = BattleUnitType.Role
@ -90,16 +93,54 @@ function RoleLogic:Init(uid, data, position)
self.curMainTarget=nil --当前主目标
self.passiveList = {}
if data.passivity and #data.passivity > 0 then
table.sort(data.passivity,function(a,b)return a[1] < b[1] end)
--排序363类型的排在前面
table.sort(data.passivity,function(a,b)
if a[3]==b[3] then
return a[1] < b[1]
else
if a[3]==363 then
return true
end
if b[3]==363 then
return false
end
end
return a[1] < b[1]
end)
local coverPass={}
for i = 1, #data.passivity do
local v = data.passivity[i]
local passivityId=v[1]
local passivityId = tonumber(v[1])
local judge=v[2]
local id = v[3]
local id = tonumber(v[3])
local args = {}
for j = 4, #v do
args[j-3] = v[j]
end
--如果时363类型得被动就存起来
if id==363 then
coverPass[args[1]]=args
else
--如果有363修改的被动就修改
if coverPass[passivityId] then
local coverArgs=coverPass[passivityId]
local len=floor((#coverArgs-1)/2)
for i = 1, len do
local id=0
if #coverArgs>i+i then
id=coverArgs[i+i]
end
local value=0
if #coverArgs>=i+i+1 then
value=coverArgs[i+i+1]
end
if id~=0 and value~=0 and #args>=id and args[id] then
args[id]=value
end
end
end
end
if BattleUtil.Passivity[id] then
BattleUtil.Passivity[id](self, args,passivityId,judge)
BattleLogManager.Log(
@ -307,17 +348,27 @@ function RoleLogic:AddBuff(buff)
"missF", missF)
-- 如果概率为0 或者没有miss
if missF == 0 or not BattleUtil.RandomAction(missF, function() BattleLogic.BuffMgr:PutBuff(buff) end) then
for i=1, self.buffFilter.size do
if self.buffFilter.buffer[i](buff,self) then
BattleLogManager.Log(
"Buff Filter",
"camp", buff.caster.camp,
"position", buff.caster.position,
"id", buff.id,
"type", buff.type)
BattleLogic.BuffMgr:PutBuff(buff)
BattleLogic.Event:DispatchEvent(BattleEventName.RoleAddBuffFail,buff,self)
return
--概率忽略免疫
local ignoreProb=0
local changeIgnore=function(v1,ct)
ignoreProb=BattleUtil.CountValue(ignoreProb,v1,ct)
end
buff.caster.Event:DispatchEvent(BattleEventName.PassiveChangeIgnoreImmuneValue,changeIgnore,buff)
local isIgnor=BattleUtil.RandomAction(ignoreProb,function()end)
if not isIgnor then
for i=1, self.buffFilter.size do
if self.buffFilter.buffer[i](buff,self) then
BattleLogManager.Log(
"Buff Filter",
"camp", buff.caster.camp,
"position", buff.caster.position,
"id", buff.id,
"type", buff.type)
BattleLogic.BuffMgr:PutBuff(buff)
BattleLogic.Event:DispatchEvent(BattleEventName.RoleAddBuffFail,buff,self)
return
end
end
end
BattleLogic.BuffMgr:AddBuff(self, buff)
@ -340,6 +391,9 @@ function RoleLogic:IsAvailable(skill)
return false
end
end
if self.isExile then
return false
end
--角色没有真正死亡 在 被眩晕/沉默的 情况下 任然能释放死亡技能
if (self.ctrl_dizzy or self.ctrl_slient) and self:IsDead() and skill and skill.type==BattleSkillType.DeadSkill then
return true
@ -419,11 +473,15 @@ function RoleLogic:SkillCast(skill, func)
local costRate = 1 - noRageRate
costRate = costRate > 1 and 1 or costRate
costRate = costRate < 0 and 0 or costRate
skill.costRage=0
BattleUtil.RandomAction(costRate, function()
self.Rage = self.Rage - costRage
self.Event:DispatchEvent(BattleEventName.SkillCastCostRageEnd,costRage)
skill.costRage=costRage
end)
end
self.Event:DispatchEvent(BattleEventName.ActionOperateAngerAfter,self)
-- 释放绝技
skill:Cast(_CastDone)
@ -462,7 +520,11 @@ end
--加入额外技能,用于额外释放技能 by:王振兴
function RoleLogic:InsertExtraSkill(id,type)
local effectData=BattleUtil.GetExtraSkillbyId(id)
effectData[1]=self.superSkill[1]
effectData[2]=self.superSkill[2]
effectData[3]=self.superSkill[3]
effectData[4]=self.superSkill[4]
-- local effectData2={role.,role.superSkill[2],role.superSkill[3],role.superSkill[4],{targets,{1,f1,f2}}}
if effectData then
local skillType=BattleSkillType.Extra
--如果type为1则按绝技处理,不为1的话按额外技能处理额外技能因为被动判断会判断是否是绝技类型所以不会触发
@ -607,6 +669,7 @@ function RoleLogic:Relive()
-- 发送复活事件
self.Event:DispatchEvent(BattleEventName.RoleRelive, self)
--BattleLogic.Event:DispatchEvent(BattleEventName.RoleRelive, self)
self.reliveCaster.Event:DispatchEvent(BattleEventName.ReliveRole,self)
-- 复活的血量算做加血
BattleLogic.Event:DispatchEvent(BattleEventName.RecordTreat, self.reliveCaster or self, self, reHp)
return true

View File

@ -70,6 +70,7 @@ function Skill:Cast(func)
local targets=BattleUtil.LengthOfTable(self:GetDirectTargetsNoExile())
if targets==0 and self.castDoneFunc then
self.isRage=false
self.owner.Event:DispatchEvent(BattleEventName.CastRageBrfore, self)
self.castDoneFunc()
return
end

View File

@ -16,6 +16,7 @@ function this.Init()
this.CurSkillCount = 0
-- 清除轮转方法,防止收到上一局战斗的影响
this.TurnRoundFunc = nil
this.MonsterCheckFunc = nil
this.Clear()
end
@ -39,6 +40,12 @@ function this.AddMonsterSkill(skill)
if skill.type == BattleSkillType.Monster then
table.insert(this.MonsterSkillList, skill)
end
BattleLogManager.Log(
"Add Monster Skill",
"camp", skill.owner.camp,
"pos", skill.owner.position,
"type", BattleSkillType.Monster
)
return skill
end

View File

@ -1,4 +1,107 @@
master_zh_test同步数据表2021_08_02_19_27_29
master_zh_test同步数据表2021_11_23_11_29_17
v1.0.79
1、被动391修改 我方流血显示修改
master_zh_test同步数据表2021_11_22_18_00_26
v1.0.78
1、被动112 258 360修改提交
2. 伤害公式修改
3.战斗超时 pvp添加战斗类型
v1.0.77
1、第三批神魂提交
v1.0.76
1、修复前后端战斗数据格式不一致导致的结果不一致
master_zh_test同步数据表2021_11_16_11_07_25
v1.0.75
1添加不处理增伤的伤害接口
master_zh_test同步数据表2021_11_15_17_10_47
v1.0.74
1第二期神魂技能
master_zh_test同步数据表2021_11_08_18_01_19
v1.0.73
1被动285修改
master_zh_test同步数据表2021_11_08_17_48_59
v1.0.72
1第一期神魂技能
v1.0.71
1灵兽技能检测添加初始化
2.追加技能特效修改
v1.0.70
1、添加神魂被动技能
master_zh_test同步数据表2021_11_01_14_07_31
master_zh_test同步数据表2021_10_26_10_10_26
master_zh_test同步数据表2021_10_25_18_57_36
v1.0.69
1、战斗公式修改
master_zh_test同步数据表2021_10_22_18_57_18
v1.0.68
1、添加主角技能
2. 被动199修改
master_zh_test同步数据表2021_10_18_11_00_42
master_zh_test同步数据表2021_10_16_19_07_28
master_zh_test同步数据表2021_10_16_19_06_48
v1.0.67
1、被动344添加空判断
2. 战斗力公式修改
master_zh_test同步数据表2021_10_12_15_58_23
master_zh_test同步数据表2021_10_12_10_25_47
master_zh_test同步数据表2021_10_11_18_25_43
v1.0.66
1、被动312修改
master_zh_test同步数据表2021_10_09_18_47_41
master_zh_test同步数据表2021_10_09_18_46_50
v1.0.65
1、被动116 258 281 312 344 250修改
2. 精卫借的怒气不会回复怒气
3. 添加不处理增伤被动的方法
master_zh_test同步数据表2021_09_28_17_45_03
v1.0.64
1、353 351 137 被动修改
2. 添加获取没有出发不灭的目标
master_zh_test同步数据表2021_09_27_18_41_38
v1.0.63
1、353被动修改
v1.0.62
1、添加御甲buff
2.添加最后一期紫府神印,添加白金装备被动 觉醒被动修改
master_zh_test同步数据表2021_09_26_20_35_14
master_zh_test同步数据表2021_09_18_21_14_36
master_zh_test同步数据表2021_09_18_18_42_35
v1.0.61
1、技能是否能释放 添加是否有技能目标判断
2.被动196 200 188 修改
master_zh_test同步数据表2021_09_17_16_21_53
master_zh_test同步数据表2021_09_15_20_05_28
master_zh_test同步数据表2021_09_15_14_23_26
master_zh_test同步数据表2021_09_14_15_46_46
master_zh_test同步数据表2021_09_14_11_51_05
v1.0.60
1、被动56修改
master_zh_test同步数据表2021_09_11_18_04_19
v1.0.59
1、被动261 修改
master_zh_test同步数据表2021_09_10_18_24_51
v1.0.58
1、修复方法缺失报错
v1.0.57
1、尝试修复孙悟空大招不会增加伤害的问题
2、添加用于debug的log
master_zh_test同步数据表2021_09_07_11_00_31
v1.0.56
1.选生命百分比最少目标逻辑修改 去掉有不灭单位
2. 死亡不把怒气显示清空
3.被动99 307 选目标逻辑修改
v1.0.55
1.被动263 269 274 332 112 145 修改
2. 添加战斗日志
v1.0.54
1. 被动91 被动115 160修改
2. Dot类buff清除逻辑修改
master_zh_test同步数据表2021_08_27_18_25_18
master_zh_test同步数据表2021_08_21_16_34_06
v1.0.54
1. 被动141 310 283 330 336修改
master_zh_test同步数据表2021_08_02_19_27_29
v1.0.53
1. 随机种子修改
master_zh_test同步数据表2021_07_31_17_55_16

View File

@ -112,6 +112,7 @@ public class CrossLingmaiSecretAreaBattleHandler extends BaseHandler<ArenaInfoPr
.setFightId(FightUtil.getFightId(user.getId(), FightType.CrossLingMaiSecretFight.getType()))
.build();
res.setFightData(fightData);
LOGGER.error("跨服灵脉秘境机器人战斗结果:"+fightResult.getResult());
if (fightResult.getResult() == -1) {
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION);
} else if (fightResult.getResult() == 1) {
@ -162,19 +163,21 @@ public class CrossLingmaiSecretAreaBattleHandler extends BaseHandler<ArenaInfoPr
//对手
CommonProto.FightTeamInfo defteamInfo = FightUtil.makeCrossPersonData(csPlayer, TeamEnum.CROSS_LING_MAI_SECRET_AREA.getTeamId(), null, crossArenaManager);
FightResult fightResult = GetWorldArenaChallengeRequestHandler.getFightForPVP(uid, defUid,
fightTeamInfo, defteamInfo, FightUtil.getFightSeed(), myforce < defforce);
fightTeamInfo, defteamInfo, FightUtil.getFightSeed(), myforce < defforce,FightType.CrossLingMaiSecretFight);
int seed = fightResult.getSeed();
CommonProto.FightData build = CommonProto.FightData.newBuilder()
.setFightMaxTime(SArenaSetting.getSArenaSetting().getMostTime())
.setFightSeed(seed)
.setHeroFightInfos(fightResult.getFightTeamInfo())
.addMonsterList(fightResult.getDefFightTeamInfo())
.setFightType(FightType.CrossYuxulundaoFight.getType())
.setFightType(FightType.CrossLingMaiSecretFight.getType())
.setFightId(FightUtil.getFightId(uid, FightType.CrossLingMaiSecretFight.getType()))
.build();
int result = (int) fightResult.getCheckResult()[0];
res.setFightData(build);
res.setResult(result);
LOGGER.error("跨服灵脉秘境真人战斗结果:"+result);
if (result == 1) {
//赢了 我有灵脉 我没灵脉
//别人积分收益结算

View File

@ -389,7 +389,7 @@ public class CrossYuxulundaoChallengeHandler extends BaseHandler<ArenaInfoProto.
defforce = arenaRecord.getYxldDefForce().get(i);
}
FightResult fightResult = GetWorldArenaChallengeRequestHandler.getFightForPVP(myUser.getId(), defUserUid,
fightTeamInfo, defteamInfo, FightUtil.getFightSeed(), myforce<defforce);
fightTeamInfo, defteamInfo, FightUtil.getFightSeed(), myforce<defforce,FightType.CrossYuxulundaoFight);
int seed = fightResult.getSeed();
CommonProto.FightData build = CommonProto.FightData.newBuilder()
.setFightMaxTime(SArenaSetting.getSArenaSetting().getMostTime())
@ -491,7 +491,7 @@ public class CrossYuxulundaoChallengeHandler extends BaseHandler<ArenaInfoProto.
}
FightResult fightResult = GetWorldArenaChallengeRequestHandler.getFightForPVP(myUser.getId(), defUserUid,
fightTeamInfo, defteamInfo, FightUtil.getFightSeed(), myforce<defforce);
fightTeamInfo, defteamInfo, FightUtil.getFightSeed(), myforce<defforce,FightType.CrossYuxulundaoFight);
int seed = fightResult.getSeed();
CommonProto.FightData build = CommonProto.FightData.newBuilder()
.setFightMaxTime(SArenaSetting.getSArenaSetting().getMostTime())

View File

@ -178,7 +178,7 @@ public class GetWorldArenaChallengeRequestHandler extends BaseHandler<WorldProto
int myForce = HeroLogic.getInstance().calTeamTotalForce(user, proto.getTeamId(), true);
int teamId = proto.getTeamId();
CommonProto.FightTeamInfo fightTeamInfo = FightUtil.makePersonFightData(UserManager.getUser(iSession.getUid()), teamId, null, null);
FightResult fightResult = getFightForPVP(iSession.getUid(), proto.getChallengeUid(), fightTeamInfo, teamInfo, FightUtil.getFightSeed(),myForce<defendForce);
FightResult fightResult = getFightForPVP(iSession.getUid(), proto.getChallengeUid(), fightTeamInfo, teamInfo, FightUtil.getFightSeed(),myForce<defendForce,FightType.CrossLuofuFight);
builder1.setFightResult(fightResult.getResult());
int seed = fightResult.getSeed();
CommonProto.FightData build = CommonProto.FightData.newBuilder()
@ -252,7 +252,8 @@ public class GetWorldArenaChallengeRequestHandler extends BaseHandler<WorldProto
PlayerLogic.getInstance().checkAndUpdate(user, VipPrivilegeType.WORLD_ARENA_CHALLENGE_TIMES, 1);
}
public static FightResult getFightForPVP(int attachId,int defUid,CommonProto.FightTeamInfo fightTeamInfo, CommonProto.FightTeamInfo deffightTeamInfo,int seed,boolean isRever) throws Exception {
public static FightResult getFightForPVP(int attachId,int defUid,CommonProto.FightTeamInfo fightTeamInfo, CommonProto.FightTeamInfo deffightTeamInfo,int seed,boolean isRever
,FightType fightType) throws Exception {
LuaValue getFightData ;
if(isRever){
deffightTeamInfo = CommonProto.FightTeamInfo.newBuilder().mergeFrom(deffightTeamInfo).setFirstCamp(1).build();
@ -261,14 +262,14 @@ public class GetWorldArenaChallengeRequestHandler extends BaseHandler<WorldProto
getFightData = FightDataUtil.getFinalPlayerFightData(fightTeamInfo, deffightTeamInfo);
}
LuaValue getOptionData = FightDataUtil.getOptionData(attachId+"");
long[] fightResult = CheckFight.getInstance().checkFight(seed, SArenaSetting.getSArenaSetting().getMostTime(), getFightData, getOptionData, FightType.ArenaFight);
long[] fightResult = CheckFight.getInstance().checkFight(seed, SArenaSetting.getSArenaSetting().getMostTime(), getFightData, getOptionData, fightType);
FightResult.Builder builder = FightResult.newBuilder();
builder.setCheckResult(fightResult);
builder.setSeed(seed);
builder.setFightTeamInfo(fightTeamInfo);
builder.setDefFightTeamInfo(deffightTeamInfo);
CommonProto.FightData fightData = CommonProto.FightData.newBuilder().setFightType(FightType.ArenaFight.getType()).setHeroFightInfos(fightTeamInfo).addMonsterList(deffightTeamInfo).setFightSeed(seed).setFightMaxTime(SArenaSetting.getSArenaSetting().getMostTime()).build();
CommonProto.FightData fightData = CommonProto.FightData.newBuilder().setFightType(fightType.getType()).setHeroFightInfos(fightTeamInfo).addMonsterList(deffightTeamInfo).setFightSeed(seed).setFightMaxTime(SArenaSetting.getSArenaSetting().getMostTime()).build();
builder.setFightData(fightData);
return builder.build();
}