[战斗]====精英副本相关修改提交

dev_chengFeng
wangzhenxing 2021-05-11 17:05:11 +08:00
parent 410f679e68
commit 32d592b7bc
8 changed files with 256 additions and 14 deletions

View File

@ -453,8 +453,10 @@ function this.GetBattleServerData(msg, isFightPlayer)
fightType = msg.fightData.fightType,
maxRound = msg.fightData.fightMaxTime,
fightId = msg.fightData.fightId,
--精英副本关卡id
nodeId = msg.fightData.nodeId,
}
LogYellow("收到的战斗ID = "..msg.fightData.fightId)
LogYellow("收到的战斗ID = "..msg.fightData.fightId.." 精英副本关卡id="..msg.fightData.nodeId)
this.SetLastBattleResult(nil,nil)
lastFightData = data
return data

View File

@ -6761,6 +6761,7 @@ local passivityList = {
role:AddBuff(Buff.Create(role, BuffName.PropertyChange,round, BattlePropList[p1],v1, ct))
end
end,nil,nil,role)
end,
-- 敌方单位被击杀自身释放[a]技能,释放的技能类型为[b]。
-- a[int] b[int]
@ -6781,7 +6782,7 @@ local passivityList = {
end,
--英雄[a],附加的[b]种类[c]类型buff,持续时间改变[d][e]回合
--a[int],b[int buff类型],c[int type类型],d[int 改变类型],e[int]
[306] = function(role, args)
[306] = function(role, args,id,judge)
local id = args[1]
local tp1 = args[2]
local tp2 = args[3]
@ -6835,7 +6836,7 @@ local passivityList = {
end,
-- 根据生命百分比添加被动 血量百分比[a],被动id[b],...(后面没有的不配)
-- a[float],b[int],c[float],d[int],e[float],f[int],g[float],h[int]
[313] = function(role, args)
[313] = function(role, args,id,judge)
local passTable={}
for i = 1, #args do
if i%2==0 then
@ -6860,5 +6861,15 @@ local passivityList = {
end
role.Event:AddEvent(BattleEventName.RoleBeDamaged, onRoleBeDamaged,nil,nil,role)
end,
-- 普通攻击不会回复怒气
-- a[float]
[314] = function(role, args,id,judge)
role.isNormalAttackAddRage=false
end,
-- 禁止治疗
-- a[float]
[315] = function(role, args,id,judge)
role.ctrl_noheal=true
end,
}
return passivityList

View File

@ -1,4 +1,6 @@
BattleLogic = {}
require("Modules.Battle.Logic.HardStageCondition")
require("Modules.Battle.Logic.HardStageEventManager")
BattleLogic = {}
local floor = math.floor
local min = math.min
-- local objList = BattleDictionary.New()
@ -22,6 +24,9 @@ local userData
local allHeroDamage=0
--所有怪的伤害和治疗
local allEnemyDamage=0
--关卡星级记录
local levelStarRecord
local hardStageId =0
--是否开启战斗日志
BattleLogic.IsOpenBattleRecord = false
--逻辑帧频
@ -44,23 +49,19 @@ function BattleLogic.Init(data, _userData, maxRound)
if BattleLogic.IsOpenBattleRecord then
record = {}
end
levelStarRecord={}
fightData = data
userData = _userData
hardStageId=data.nodeId
BattleLogic.CurOrder = 0
BattleLogic.TotalOrder = #data.enemyData
BattleLogic.Clear()
curFrame = 0
CurRound = 0
MaxRound = maxRound or 20
allHeroDamage= 0
allEnemyDamage= 0
_IsDebug = false
BattleLogic.Event:ClearEvent()
BattleLogic.BuffMgr:Init()
BattleLogic.IsEnd = false
@ -73,7 +74,7 @@ function BattleLogic.Init(data, _userData, maxRound)
SkillManager.Init()
OutDataManager.Init(fightData)
PassiveManager.Init()
HardStageEventManager.Init()
-- 监听英雄受到治疗
BattleLogic.Event:AddEvent(BattleEventName.RoleBeTreated,function (castRole, realTreat, treat)
--巅峰争霸赛和切磋超时改为只判断总伤害,不再判断总治疗
@ -93,6 +94,7 @@ function BattleLogic.Init(data, _userData, maxRound)
allEnemyDamage=allEnemyDamage+damage
end
end)
end
@ -101,6 +103,15 @@ function BattleLogic.GetAllDamage()
return allHeroDamage, allEnemyDamage
end
--获取我方灵兽数据
function BattleLogic.GetPlayerMonsterData()
return fightData.playerData.monsterList
end
--获取精英副本星级记录
function BattleLogic.GetHardLevelStarRecord()
return levelStarRecord
end
-- 检测先手阵营
function BattleLogic.CheckFirstCamp()
@ -439,13 +450,32 @@ function BattleLogic.BattleEnd(result)
BattleLogic.IsEnd = true
BattleLogic.Result = result
BattleLogic.Event:DispatchEvent(BattleEventName.BattleEnd, result)
LogError("/////////////")
if hardStageId and hardStageId~=0 then
--获取精英副本 星级信息
local hardStageConfig=ConfigManager.GetConfigData(ConfigName.HardStage,hardStageId)
if hardStageConfig then
if hardStageConfig.ConditionValue then
for i = 1, #hardStageConfig.ConditionValue do
local harConfig = ConfigManager.GetConfigData(ConfigName.HardStageCondition,hardStageConfig.ConditionValue[i])
local v1=HardStageCondition.CheckCondition(harConfig.ConditionType,harConfig.ConditionValue)
table.insert(levelStarRecord,hardStageConfig.ConditionValue[i])
table.insert(levelStarRecord,v1)
end
end
for i = 1, #levelStarRecord do
LogError("星级记录"..levelStarRecord[i])
end
end
end
-- 打印结果
BattleLogic.LogResult(result)
-- 战斗日志写入
if not BattleLogic.GetIsDebug() then
BattleLogManager.WriteLogToFile()
end
HardStageEventManager.ClearEvent()
end
-- 打印战斗结果

View File

@ -0,0 +1,140 @@
HardStageCondition = {}
local this = HardStageCondition
local _ConditionConfig = {
--通过关卡
[1]=function(condition)
LogError("aaaaaaaaaaaaaaaaaaa")
if BattleLogic.Result==1 then
return 1
end
return 0
end,
--[a]回合内通过关卡
[2]=function(condition)
local v1 = condition[1]
local round,maxRound=BattleLogic.GetCurRound()
LogError(" "..v1.." "..round)
if round<=v1 then
return 1
end
return 0
end,
--上阵[a]个神将通过关卡
[3]=function(condition)
local v1 = condition[1]
local list = RoleManager.Query(function(v) return v.camp == 0 end)
if BattleUtil.LengthOfTable(list)<=v1 then
return 1
end
return 0
end,
--[a]回合内造成[b]伤害
[4]=function(condition)
local v1 = condition[1]
local v2 = condition[2]
local record=HardStageEventManager.GetRoundDamageRecord()
if record then
for key, value in pairs(record) do
LogError(" round=="..value[1].." value=="..value[2])
if key<=v1 and value[2]>=v2 then
LogError("伤害达标!!!!")
return 1
end
end
end
return 0
end,
--使用指定[a]系神将[b]名
[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)
if BattleUtil.LengthOfTable(list)>=v2 then
return 1
end
return 0
end,
--存活[a]名
[6]=function(condition)
local v1 = condition[1]
local list = RoleManager.Query(function(v) return v.camp == 0 and not v:IsDead() end)
if BattleUtil.LengthOfTable(list)>=v1 then
return 1
end
return 0
end,
--不上阵[a]职能神将通过关卡
[7]=function(condition)
local v1 = condition[1]
local list = RoleManager.Query(function(v) return v.camp == 0 and v.professionId==v1 end)
if BattleUtil.LengthOfTable(list)==0 then
return 1
end
return 0
end,
--不上阵[a]阵营神将通过关卡
[8]=function(condition)
local v1 = condition[1]
local list = RoleManager.Query(function(v) return v.camp == 0 and v.element==v1 end)
LogError(" 8 len== "..BattleUtil.LengthOfTable(list))
if BattleUtil.LengthOfTable(list)==0 then
return 1
end
return 0
end,
--佩戴xxxid被动通过关卡
[9]=function(condition)
local v1 = condition[1]
local list = RoleManager.Query(function(v) return v.camp == 0 end)
if not list or #list==0 then
return 0
end
for i = 1, #list do
local isHave=list[i]:CheckHavePassive(v1)
if isHave then
LogError("有改魂印")
return 1
end
end
return 0
end,
--不使用灵兽通过关卡
[10]=function(condition)
local v1 = condition[1]
local data=BattleLogic.GetPlayerMonsterData()
if data and BattleUtil.LengthOfTable(data)>v1 then
LogError("灵兽数量不符合")
return 0
end
return 1
end,
--全部上阵[a]职业神将通过关卡
[11]=function(condition)
local v1 = condition[1]
local list = RoleManager.Query(function(v) return v.camp == 0 and v.professionId~=v1 end)
LogError(" 11 len== "..BattleUtil.LengthOfTable(list))
if BattleUtil.LengthOfTable(list)==0 then
LogError("阵容符合")
return 1
end
return 0
end,
}
-- 条件检测
function HardStageCondition.CheckCondition(type,condition)
--LogError("*************".. type.." "..condition)
if not condition then
return true
end
-- local v1 = condition[1]
-- local v2 = condition[2]
-- local v3 = condition[3]
return _ConditionConfig[type](condition)
end
return HardStageCondition

View File

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

View File

@ -0,0 +1,44 @@
HardStageEventManager = {}
local this = HardStageEventManager
local CurRound
--记录的回合数
local recordRound=1
local roundDamage=0
--记录的回合伤害
local recordRoundDamage
function this.Init()
recordRound=1
roundDamage=0
recordRoundDamage={}
BattleLogic.Event:AddEvent(BattleEventName.RecordDamage,this.OnRecordDamage)
end
function this.ClearEvent()
BattleLogic.Event:RemoveEvent(BattleEventName.RecordDamage,this.OnRecordDamage)
end
--记录伤害
function this.OnRecordDamage(atkRole,defRole,damage)
if not atkRole or atkRole.camp==1 then
return
end
local curRound,maxRound=BattleLogic.GetCurRound()
CurRound=curRound
LogError("damage=="..damage)
--如果进入下一回合,记录上一回合的伤害
if CurRound==recordRound+1 then
table.insert(recordRoundDamage,{recordRound,roundDamage})
recordRound=CurRound
end
roundDamage=roundDamage+damage
end
--获取回合伤害记录
function this.GetRoundDamageRecord()
--如果一回合就结束战斗了,就直接把记录的回合数伤害加进去
if CurRound==1 then
table.insert(recordRoundDamage,{recordRound,roundDamage})
end
return recordRoundDamage
end
return HardStageEventManager

View File

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

View File

@ -82,6 +82,7 @@ function RoleLogic:Init(uid, data, position)
self.isImmuneAllReduceShield = false --免疫敌方无敌盾(敌方无敌盾对自己无效)
self.ignoreShara = false --忽略敌方分摊
self.type = BattleUnitType.Role
self.isNormalAttackAddRage=true --普攻是否回复怒气
self.passiveList = {}
if data.passivity and #data.passivity > 0 then
table.sort(data.passivity,function(a,b)return a[1] < b[1] end)
@ -328,8 +329,8 @@ function RoleLogic:SkillCast(skill, func)
if (skill.type == BattleSkillType.Normal or skill.type ==BattleSkillType.ChaosNormal) and not self.ctrl_palsy then
local function _CheckRage()
-- 后成长怒气
if skill.isRage then
-- 后成长怒气 判断普攻是否会回复怒气
if skill.isRage and self.isNormalAttackAddRage then
-- 检测被动技能对怒气成长的影响
local grow = self.RageGrow
local _RageGrowPassivity = function(finalGrow)