battlemain 异妖
parent
c4dceec25a
commit
ec9b9a67e4
|
@ -129,7 +129,7 @@ local function addBattleData()
|
||||||
_BattleErrorCache[_BattleErrorIndex] = str
|
_BattleErrorCache[_BattleErrorIndex] = str
|
||||||
end
|
end
|
||||||
|
|
||||||
local function AddRecord()
|
local function AddRecord(fightData)
|
||||||
BattleRecord = {}
|
BattleRecord = {}
|
||||||
BattleLogic.Event:AddEvent(BattleEventName.AddRole, function (role)
|
BattleLogic.Event:AddEvent(BattleEventName.AddRole, function (role)
|
||||||
local record = {}
|
local record = {}
|
||||||
|
@ -141,15 +141,72 @@ local function AddRecord()
|
||||||
end)
|
end)
|
||||||
BattleRecord[role.uid] = record
|
BattleRecord[role.uid] = record
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
for i=1, #fightData.playerData.teamSkill do
|
||||||
|
local teamCaster = BattleLogic.GetTeamSkillCaster(0)
|
||||||
|
local teamSkill = fightData.playerData.teamSkill[i]
|
||||||
|
local teamType = math.floor(teamSkill[1] / 100)
|
||||||
|
|
||||||
|
local str = "order:1".."camp:"..teamCaster.camp.." team"..teamSkill[1]
|
||||||
|
|
||||||
|
local record = {}
|
||||||
|
record.uid = str
|
||||||
|
record.camp = teamCaster.camp
|
||||||
|
record.damage = 0
|
||||||
|
record.order = 1
|
||||||
|
|
||||||
|
local curSkill
|
||||||
|
teamCaster.Event:AddEvent(BattleEventName.SkillCast, function (skill)
|
||||||
|
if skill.owner.camp == record.camp then
|
||||||
|
curSkill = skill
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
teamCaster.Event:AddEvent(BattleEventName.RoleDamage, function (defRole, damage, bCrit, finalDmg)
|
||||||
|
if curSkill and curSkill.teamSkillType == teamType then
|
||||||
|
record.damage = record.damage + finalDmg
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
BattleRecord[str] = record
|
||||||
|
end
|
||||||
|
|
||||||
|
for i=1, #fightData.enemyData do
|
||||||
|
for j=1, #fightData.enemyData[i].teamSkill do
|
||||||
|
local teamCaster = BattleLogic.GetTeamSkillCaster(1)
|
||||||
|
local teamSkill = fightData.enemyData[i].teamSkill[j]
|
||||||
|
local teamType = math.floor(teamSkill[1] / 100)
|
||||||
|
|
||||||
|
local str = "order:"..i.."camp:"..teamCaster.camp.." team"..teamSkill[1]
|
||||||
|
|
||||||
|
local record = {}
|
||||||
|
record.uid = str
|
||||||
|
record.camp = teamCaster.camp
|
||||||
|
record.damage = 0
|
||||||
|
record.order = i
|
||||||
|
|
||||||
|
local curSkill
|
||||||
|
teamCaster.Event:AddEvent(BattleEventName.SkillCast, function (skill)
|
||||||
|
if skill.owner.camp == record.camp then
|
||||||
|
curSkill = skill
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
teamCaster.Event:AddEvent(BattleEventName.RoleDamage, function (defRole, damage, bCrit, finalDmg)
|
||||||
|
if curSkill and curSkill.teamSkillType == teamType and record.order == BattleLogic.CurOrder then
|
||||||
|
record.damage = record.damage + finalDmg
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
BattleRecord[str] = record
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
function BattleMain.Execute(args, fightData, optionData)
|
function BattleMain.Execute(args, fightData, optionData)
|
||||||
|
print("trfghjdfgucvhbjnfdcgvj")
|
||||||
_seed = args.seed
|
_seed = args.seed
|
||||||
_type = args.type
|
_type = args.type
|
||||||
_fightData = fightData
|
_fightData = fightData
|
||||||
_optionData = optionData or {}
|
_optionData = optionData or {}
|
||||||
|
|
||||||
--该开关用于输出战斗过程中的日志,用于验证前后端是否出现战斗不同步
|
--该开关用于输出战斗过程中的日志,用于验证前后端是否出现战斗不同步
|
||||||
BattleLogic.IsOpenBattleRecord = true
|
BattleLogic.IsOpenBattleRecord = false
|
||||||
|
|
||||||
local isError = false
|
local isError = false
|
||||||
local errorCache
|
local errorCache
|
||||||
|
@ -158,7 +215,7 @@ function BattleMain.Execute(args, fightData, optionData)
|
||||||
BattleLogic.Init(args.maxTime, fightData, optionData)
|
BattleLogic.Init(args.maxTime, fightData, optionData)
|
||||||
BattleLogic.Type = _type
|
BattleLogic.Type = _type
|
||||||
if _type == 9 then
|
if _type == 9 then
|
||||||
AddRecord()
|
AddRecord(fightData)
|
||||||
end
|
end
|
||||||
BattleLogic.StartOrder()
|
BattleLogic.StartOrder()
|
||||||
|
|
||||||
|
@ -234,5 +291,4 @@ function BattleMain.Execute(args, fightData, optionData)
|
||||||
end
|
end
|
||||||
return { result = -1 }
|
return { result = -1 }
|
||||||
end
|
end
|
||||||
|
|
||||||
return BattleMain
|
return BattleMain
|
|
@ -130,7 +130,7 @@ local function addBattleData()
|
||||||
_BattleErrorCache[_BattleErrorIndex] = str
|
_BattleErrorCache[_BattleErrorIndex] = str
|
||||||
end
|
end
|
||||||
|
|
||||||
local function AddRecord()
|
local function AddRecord(fightData)
|
||||||
BattleRecord = {}
|
BattleRecord = {}
|
||||||
BattleLogic.Event:AddEvent(BattleEventName.AddRole, function (role)
|
BattleLogic.Event:AddEvent(BattleEventName.AddRole, function (role)
|
||||||
local record = {}
|
local record = {}
|
||||||
|
@ -142,15 +142,72 @@ local function AddRecord()
|
||||||
end)
|
end)
|
||||||
BattleRecord[role.uid] = record
|
BattleRecord[role.uid] = record
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
for i=1, #fightData.playerData.teamSkill do
|
||||||
|
local teamCaster = BattleLogic.GetTeamSkillCaster(0)
|
||||||
|
local teamSkill = fightData.playerData.teamSkill[i]
|
||||||
|
local teamType = math.floor(teamSkill[1] / 100)
|
||||||
|
|
||||||
|
local str = "order:1".."camp:"..teamCaster.camp.." team"..teamSkill[1]
|
||||||
|
|
||||||
|
local record = {}
|
||||||
|
record.uid = str
|
||||||
|
record.camp = teamCaster.camp
|
||||||
|
record.damage = 0
|
||||||
|
record.order = 1
|
||||||
|
|
||||||
|
local curSkill
|
||||||
|
teamCaster.Event:AddEvent(BattleEventName.SkillCast, function (skill)
|
||||||
|
if skill.owner.camp == record.camp then
|
||||||
|
curSkill = skill
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
teamCaster.Event:AddEvent(BattleEventName.RoleDamage, function (defRole, damage, bCrit, finalDmg)
|
||||||
|
if curSkill and curSkill.teamSkillType == teamType then
|
||||||
|
record.damage = record.damage + finalDmg
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
BattleRecord[str] = record
|
||||||
|
end
|
||||||
|
|
||||||
|
for i=1, #fightData.enemyData do
|
||||||
|
for j=1, #fightData.enemyData[i].teamSkill do
|
||||||
|
local teamCaster = BattleLogic.GetTeamSkillCaster(1)
|
||||||
|
local teamSkill = fightData.enemyData[i].teamSkill[j]
|
||||||
|
local teamType = math.floor(teamSkill[1] / 100)
|
||||||
|
|
||||||
|
local str = "order:"..i.."camp:"..teamCaster.camp.." team"..teamSkill[1]
|
||||||
|
|
||||||
|
local record = {}
|
||||||
|
record.uid = str
|
||||||
|
record.camp = teamCaster.camp
|
||||||
|
record.damage = 0
|
||||||
|
record.order = i
|
||||||
|
|
||||||
|
local curSkill
|
||||||
|
teamCaster.Event:AddEvent(BattleEventName.SkillCast, function (skill)
|
||||||
|
if skill.owner.camp == record.camp then
|
||||||
|
curSkill = skill
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
teamCaster.Event:AddEvent(BattleEventName.RoleDamage, function (defRole, damage, bCrit, finalDmg)
|
||||||
|
if curSkill and curSkill.teamSkillType == teamType and record.order == BattleLogic.CurOrder then
|
||||||
|
record.damage = record.damage + finalDmg
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
BattleRecord[str] = record
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
function BattleMain.Execute(args, fightData, optionData)
|
function BattleMain.Execute(args, fightData, optionData)
|
||||||
|
print("trfghjdfgucvhbjnfdcgvj")
|
||||||
_seed = args.seed
|
_seed = args.seed
|
||||||
_type = args.type
|
_type = args.type
|
||||||
_fightData = fightData
|
_fightData = fightData
|
||||||
_optionData = optionData or {}
|
_optionData = optionData or {}
|
||||||
|
|
||||||
--该开关用于输出战斗过程中的日志,用于验证前后端是否出现战斗不同步
|
--该开关用于输出战斗过程中的日志,用于验证前后端是否出现战斗不同步
|
||||||
BattleLogic.IsOpenBattleRecord = true
|
BattleLogic.IsOpenBattleRecord = false
|
||||||
|
|
||||||
local isError = false
|
local isError = false
|
||||||
local errorCache
|
local errorCache
|
||||||
|
@ -159,7 +216,7 @@ function BattleMain.Execute(args, fightData, optionData)
|
||||||
BattleLogic.Init(args.maxTime, fightData, optionData)
|
BattleLogic.Init(args.maxTime, fightData, optionData)
|
||||||
BattleLogic.Type = _type
|
BattleLogic.Type = _type
|
||||||
if _type == 9 then
|
if _type == 9 then
|
||||||
AddRecord()
|
AddRecord(fightData)
|
||||||
end
|
end
|
||||||
BattleLogic.StartOrder()
|
BattleLogic.StartOrder()
|
||||||
|
|
||||||
|
@ -235,5 +292,4 @@ function BattleMain.Execute(args, fightData, optionData)
|
||||||
end
|
end
|
||||||
return { result = -1 }
|
return { result = -1 }
|
||||||
end
|
end
|
||||||
|
|
||||||
return BattleMain
|
return BattleMain
|
Loading…
Reference in New Issue