山河社稷图战斗脚本

back_recharge
xuexinpeng 2021-05-19 14:17:06 +08:00
parent bc94b6290d
commit af20b1f45f
4 changed files with 109 additions and 14 deletions

View File

@ -1917,17 +1917,23 @@ local passivityList = {
role.Event:AddEvent(BattleEventName.RoleBeHit, onBeHit,nil,nil,role)
end,
-- 释放技能后自身回[a]点怒气
-- a[int]
-- 释放技能后自身回[a]点怒气,回怒概率[b]%(不填为100%)
-- a[int],b[float]
[107] = function(role, args,id,judge)
local i1 = args[1]
local p1 = args[2]
if not p1 then
p1=1
end
-- 释放技能后
local onSkillEnd = function(skill)
if skill and not skill.isTriggerJudge and judge==1 then
return
end
if skill.type == BattleSkillType.Special then
BattleUtil.RandomAction(p1, function ()
BattleUtil.CalRage(role, role, i1, CountTypeName.Add)
end)
end
end
role.Event:AddEvent(BattleEventName.SkillCastEnd, onSkillEnd,nil,nil,role)
@ -7008,24 +7014,25 @@ local passivityList = {
end
role.Event:AddEvent(BattleEventName.RoleRageGrow, OnRageGrow,nil,nil,role)
end,
--[a]%概率受到的直接伤害变成[b],每回合最多触发[c]次
--a[float],b[int],c[int]
--[a]%概率受到的直接伤害变成[b],每回合最多触发[c]次,同一回合内每失败一次概率增加[d]%
--a[float],b[int],c[int],d[float]
[321] = function(role, args,id,judge)
local p1 = args[1]
local damage1=args[2]
local v1 =args[3]
local p2 = args[4]
local curRound=1
local time=0
local curDamage = 0
local function onRoundChange(round)
if round==curRound+1 then
p1=args[1]
time=0
end
curRound=round
end
BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, onRoundChange,nil,nil,role)
local function onFinalBeDamage(damagingFunc, atkRole, damage, skill, dotType, bCrit, damageType,isDirect)
-- 非直接伤害不免除
if not skill and not isDirect then
@ -7037,13 +7044,15 @@ local passivityList = {
if time>=v1 then
return
end
BattleUtil.RandomAction(p1, function ()
local isTrigger=BattleUtil.RandomAction(p1, function ()
curDamage=floor(damage-damage1)
if damagingFunc then damagingFunc(curDamage) end
time=time+1
p1=args[1]
end)
if not isTrigger then
p1=p1+p2
end
end
role.Event:AddEvent(BattleEventName.FinalBeDamageEnd, onFinalBeDamage,nil,nil,role)
end,

View File

@ -21,7 +21,7 @@ local _ConditionConfig = {
--上阵[a]个神将通过关卡
[3]=function(condition)
local v1 = condition[1]
local list = RoleManager.Query(function(v) return v.camp == 0 end)
local list = RoleManager.Query(function(v) return v.camp == 0 end,true)
if BattleUtil.LengthOfTable(list)<=v1 then
return 1
end
@ -45,7 +45,7 @@ local _ConditionConfig = {
[5]=function(condition)
local v1 = condition[1]
local v2 = condition[2]
local list = RoleManager.Query(function(v) return v.camp == 0 and v.element==v1 end)
local list = RoleManager.Query(function(v) return v.camp == 0 and v.element==v1 end,true)
if BattleUtil.LengthOfTable(list)>=v2 then
return 1
end
@ -63,7 +63,7 @@ local _ConditionConfig = {
--不上阵[a]职能神将通过关卡
[7]=function(condition)
local v1 = condition[1]
local list = RoleManager.Query(function(v) return v.camp == 0 and v.professionId==v1 end)
local list = RoleManager.Query(function(v) return v.camp == 0 and v.professionId==v1 end,true)
if BattleUtil.LengthOfTable(list)==0 then
return 1
end
@ -72,7 +72,7 @@ local _ConditionConfig = {
--不上阵[a]阵营神将通过关卡
[8]=function(condition)
local v1 = condition[1]
local list = RoleManager.Query(function(v) return v.camp == 0 and v.element==v1 end)
local list = RoleManager.Query(function(v) return v.camp == 0 and v.element==v1 end,true)
if BattleUtil.LengthOfTable(list)==0 then
return 1
end
@ -81,7 +81,7 @@ local _ConditionConfig = {
--佩戴xxxid被动通过关卡
[9]=function(condition)
local v1 = condition[1]
local list = RoleManager.Query(function(v) return v.camp == 0 end)
local list = RoleManager.Query(function(v) return v.camp == 0 end,true)
if not list or #list==0 then
return 0
end
@ -105,12 +105,34 @@ local _ConditionConfig = {
--全部上阵[a]职业神将通过关卡
[11]=function(condition)
local v1 = condition[1]
local list = RoleManager.Query(function(v) return v.camp == 0 and v.professionId~=v1 end)
local list = RoleManager.Query(function(v) return v.camp == 0 and v.professionId~=v1 end,true)
if BattleUtil.LengthOfTable(list)==0 then
return 1
end
return 0
end,
--达成[a]次斩杀
[12]=function(condition)
local v1 = condition[1]
local num=HardStageEventManager.GetSeckKillNum()
if v1 and num>=v1 then
return 1
end
return 0
end,
--控制[a]类型 [b]次
[13]=function(condition)
local v1 = condition[1]
local v2 = condition[2]
local list=HardStageEventManager.GetCtrlNumList()
if list and list[v1] then
if list[v1]>=v2 then
return 1
end
end
return 0
end,
}

View File

@ -6,16 +6,76 @@ local recordRound=1
local roundDamage=0
--记录的回合伤害
local recordRoundDamage
--记录追击击杀单位
local recordAddKill
--斩杀次数
local seckKillNum=0
--控制次数集合
local ctrlNumList
function this.Init()
recordRound=1
roundDamage=0
seckKillNum=0
CurRound=0
recordRoundDamage={}
recordAddKill={}
ctrlNumList={}
BattleLogic.Event:AddEvent(BattleEventName.RecordDamage,this.OnRecordDamage)
BattleLogic.Event:AddEvent(BattleEventName.Seckill,this.OnSeckill)
BattleLogic.Event:AddEvent(BattleEventName.BuffRoundChange,this.OnRoundChange)
BattleLogic.Event:AddEvent(BattleEventName.RecordBuff,this.OnBuffAdd)
end
function this.ClearEvent()
BattleLogic.Event:RemoveEvent(BattleEventName.RecordDamage,this.OnRecordDamage)
BattleLogic.Event:RemoveEvent(BattleEventName.Seckill,this.OnSeckill)
BattleLogic.Event:RemoveEvent(BattleEventName.BuffRoundChange,this.OnRoundChange)
BattleLogic.Event:RemoveEvent(BattleEventName.RecordBuff,this.OnBuffAdd)
end
--buff添加成功
function this.OnBuffAdd(caster,target,buff)
if caster and target and buff then
if caster.camp==0 and buff.type==BuffName.Control then
local type=buff.ctrlType
LogError("ctrltype=="..type)
if ctrlNumList[type] then
ctrlNumList[type]=ctrlNumList[type]+1
else
table.insert(ctrlNumList,type)
ctrlNumList[type]=1
end
end
end
end
--获取控制集合
function this.GetCtrlNumList()
return ctrlNumList
end
--回合数据改变
function this.OnRoundChange(round)
CurRound=round
end
function this.OnSeckill(atkRole,defRole)
if not atkRole and not defRole then
if atkRole.camp==0 and defRole.camp==1 and not BattleUtil.CheckIsNoDead(defRole) then
seckKillNum=seckKillNum+1
end
end
end
--获取斩杀次数
function this.GetSeckKillNum()
return seckKillNum
end
--记录伤害
function this.OnRecordDamage(atkRole,defRole,damage)
if not atkRole or atkRole.camp==1 then

View File

@ -1,3 +1,7 @@
v1.0.33
1. 同步被动逻辑
v1.0.32
1. 精英副本星级判断逻辑修改
v1.0.31
1. 添加精英副本相关战斗逻辑
v1.0.30