战斗验证
parent
2b06b9ace0
commit
7a779b3ee3
|
@ -125,7 +125,7 @@ function BattleMain.Execute(seed, fightData, optionData)
|
|||
|
||||
print(PrintTable(fightData))
|
||||
--该开关用于输出战斗过程中的日志,用于验证前后端是否出现战斗不同步
|
||||
BattleLogic.IsOpenBattleRecord = false
|
||||
BattleLogic.IsOpenBattleRecord = true
|
||||
|
||||
if xpcall(function ()
|
||||
Random.SetSeed(seed)
|
||||
|
@ -155,17 +155,17 @@ function BattleMain.Execute(seed, fightData, optionData)
|
|||
end
|
||||
|
||||
-- print -----------------------------------------
|
||||
for i=1, #resultList do
|
||||
print("hp:"..resultList[i])
|
||||
end
|
||||
print("最终运行帧数:"..BattleLogic.CurFrame())
|
||||
print("result:"..BattleLogic.Result)
|
||||
--for i=1, #resultList do
|
||||
-- print("hp:"..resultList[i])
|
||||
--end
|
||||
--print("最终运行帧数:"..BattleLogic.CurFrame())
|
||||
--print("result:"..BattleLogic.Result)
|
||||
|
||||
return resultList
|
||||
end
|
||||
return { result = -1 }
|
||||
end
|
||||
--BattleMain.Execute(1553167956, {enemyData={{{passivity={},skill={0,{20011,0.7,{1,1,1,},{3,0.3,1,3,},},},roleId=5,property={0,772,772,260,61,61,80,0,0,0.3,0.3,0.2,1.5,1,0,0,0,0,0,0,0,0,0,0,2,2,},type=2,professionId=0,quality=1,camp=1,},{passivity={},skill={0,{20011,0.7,{1,0.8,1,},{13,1,0.1,2,5,},},},roleId=3,property={0,772,772,260,61,61,240,0,0,0.3,0.3,0.2,1.5,1,0,0,0,0,0,0,0,0,0,0,0,0,},type=2,professionId=0,quality=1,camp=1,},{passivity={},skill={0,{20011,0.7,{1,0.8,1,},{13,1,0.1,2,5,},},},roleId=3,property={0,772,772,260,61,61,7,0,0,0.3,0.3,0.2,1.5,1,0,0,0,0,0,0,0,0,0,0,0,0,},type=2,professionId=0,quality=1,camp=1,},teamSkill={},},},playerData={{passivity={},superSkill={1.6,{20211,0.7,{1,3.3,2,},{15,1.98,2,1.98,},},},skill={0,{40001,0.7,{1,2.3,2,},},{30011,0.7,{4,9,0.2,4,1,},{4,10,0.2,4,1,},},},camp=0,roleId=10022,type=1,professionId=3,quality=0,property={1,1676,1678,248,167,200,173,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},},{passivity={},superSkill={3,{20000,0.7,{2,1.06,2,},{3,0.6,1,4,},},},skill={0,{40001,0.7,{11,0.93,2,2,0.2,},},},camp=0,roleId=10008,type=1,professionId=5,quality=0,property={1,2206,2208,221,193,232,130,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},},{passivity={},superSkill={2.5,{20000,0.7,{14,1.55,2,1,10023,0.2,},},},skill={0,{40001,0.7,{1,1.35,2,},},{30011,0.7,{3,0,0,5,},},},camp=0,roleId=10023,type=1,professionId=4,quality=0,property={1,1439,1441,284,131,157,168,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},},{passivity={},superSkill={2.3,{20312,0.7,{19,1.35,1,0.5,5,},},},skill={0,{40001,0.7,{1,1,1,},},{30011,0.7,{4,9,0.1,5,1,},{4,10,0.1,5,1,},},},camp=0,roleId=10013,type=1,professionId=1,quality=0,property={1,1678,1680,246,194,162,163,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},},{passivity={},superSkill={1.6,{20211,0.7,{1,3.3,2,},{15,1.98,2,1.98,},},},skill={0,{40001,0.7,{1,2.3,2,},},{30011,0.7,{4,9,0.2,4,1,},{4,10,0.2,4,1,},},},camp=0,roleId=10022,type=1,professionId=3,quality=0,property={1,1676,1678,248,167,200,173,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},},teamSkill={{3,{20012,0.7,{26,600,},{27,100,4,},},{10014,0.7,{25,2,0.1,4,},},},},},})
|
||||
BattleMain.Execute(1553167956, {playerData={{professionId=4,passivity={},type=1,skill={0,{40001,0.7,{1,1.35,2,},},{30011,0.7,{3,0,0,5,},},},superSkill={2.5,{20000,0.7,{14,1.55,2,1,10023,0.2,},},},roleId=10023,camp=0,property={1,1439,1441,284,131,157,168,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=3,passivity={},type=1,skill={0,{40001,0.7,{1,2.3,2,},},{30011,0.7,{4,9,0.2,4,1,},{4,9,0.2,4,1,},},},superSkill={1.6,{20211,0.7,{1,3.3,2,},{15,1.98,2,1.98,},},},roleId=10022,camp=0,property={1,1676,1678,248,167,200,173,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=2,passivity={},type=1,skill={0,{40001,0.7,{1,1.05,2,},{4,4,5,5,3,},},},superSkill={2.3,{20000,0.7,{2,1.89,2,},},{20012,0.7,{3,1,5,5,},},},roleId=10021,camp=0,property={1,1920,1922,209,170,204,178,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=5,passivity={},type=1,skill={0,{40001,0.7,{11,0.93,2,2,0.2,},},},superSkill={3,{20000,0.7,{2,1.06,2,},{3,0.6,1,4,},},},roleId=10008,camp=0,property={1,2206,2208,221,193,232,130,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=1,passivity={},type=1,skill={0,{40001,0.7,{1,1,1,},},{30011,0.7,{4,9,0.1,5,1,},{4,9,0.1,5,1,},},},superSkill={2.3,{20312,0.7,{19,1.35,1,0.5,5,},},},roleId=10013,camp=0,property={1,1678,1680,246,194,162,163,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},teamSkill={{3,{20012,0.7,{26,600,},{27,100,4,},},{10014,0.7,{25,2,0.1,4,},},},},},enemyData={{{professionId=0,passivity={},type=2,skill={0,{20011,0.7,{1,1,1,},{3,0.3,1,3,},},},superSkill={},roleId=14,camp=1,property={0,772,772,260,61,61,80,0,0,0.3,0.3,0.2,1.5,1,0,0,0,0,0,0,0,0,0,0,2,2,},quality=1,},{professionId=0,passivity={},type=2,skill={0,{20013,0.7,{1,0.45,1,},},},superSkill={},roleId=1,camp=1,property={0,483,483,260,61,61,240,0,0,0.3,0.3,0.2,1.5,1,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=0,passivity={},type=2,skill={0,{20013,0.7,{1,0.45,1,},},},superSkill={},roleId=3,camp=1,property={0,483,483,260,61,61,7,0,0,0.3,0.3,0.2,1.5,1,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},teamSkill={},},},})
|
||||
--BattleMain.Execute(1553167956, {playerData={{professionId=3,passivity={},type=1,skill={0,{40001,0.7,{1,2.3,2,},},{30011,0.7,{4,9,0.2,4,1,},{4,10,0.2,4,1,},},},superSkill={1.6,{20211,0.7,{1,3.3,2,},{15,1.98,2,1.98,},},},roleId=10022,camp=0,property={1,1676,1678,248,167,200,173,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=5,passivity={},type=1,skill={0,{40001,0.7,{11,0.93,2,2,0.2,},},},superSkill={3,{20000,0.7,{2,1.06,2,},{3,0.6,1,4,},},},roleId=10008,camp=0,property={1,2206,2208,221,193,232,130,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=4,passivity={},type=1,skill={0,{40001,0.7,{1,1.35,2,},},{30011,0.7,{3,0,0,5,},},},superSkill={2.5,{20000,0.7,{14,1.55,2,1,10023,0.2,},},},roleId=10023,camp=0,property={1,1439,1441,284,131,157,168,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=1,passivity={},type=1,skill={0,{40001,0.7,{1,1,1,},},{30011,0.7,{4,9,0.1,5,1,},{4,10,0.1,5,1,},},},superSkill={2.3,{20312,0.7,{19,1.35,1,0.5,5,},},},roleId=10013,camp=0,property={1,1678,1680,246,194,162,163,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=3,passivity={},type=1,skill={0,{40001,0.7,{1,2.3,2,},},{30011,0.7,{4,9,0.2,4,1,},{4,10,0.2,4,1,},},},superSkill={1.6,{20211,0.7,{1,3.3,2,},{15,1.98,2,1.98,},},},roleId=10022,camp=0,property={17,2732,2734,401,272,326,308,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},teamSkill={},},enemyData={{{professionId=0,passivity={},type=2,skill={0,{20013,0.7,{1,0.45,1,},},},superSkill={},roleId=1,camp=1,property={0,483,483,260,61,61,240,0,0,0.3,0.3,0.2,1.5,1,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=0,passivity={},type=2,skill={0,{20013,0.7,{1,0.45,1,},},},superSkill={},roleId=2,camp=1,property={0,483,483,260,61,61,80,0,0,0.3,0.3,0.2,1.5,1,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=0,passivity={},type=2,skill={0,{20013,0.7,{1,0.45,1,},},},superSkill={},roleId=3,camp=1,property={0,483,483,260,61,61,7,0,0,0.3,0.3,0.2,1.5,1,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},teamSkill={},},},})
|
||||
--BattleMain.Execute(1553167956, {playerData={{professionId=4,passivity={},type=1,skill={0,{40001,0.7,{1,1.35,2,},},{30011,0.7,{3,0,0,5,},},},superSkill={2.5,{20000,0.7,{14,1.55,2,1,10023,0.2,},},},roleId=10023,camp=0,property={1,1439,1441,284,131,157,168,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=3,passivity={},type=1,skill={0,{40001,0.7,{1,2.3,2,},},{30011,0.7,{4,9,0.2,4,1,},{4,9,0.2,4,1,},},},superSkill={1.6,{20211,0.7,{1,3.3,2,},{15,1.98,2,1.98,},},},roleId=10022,camp=0,property={1,1676,1678,248,167,200,173,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=2,passivity={},type=1,skill={0,{40001,0.7,{1,1.05,2,},{4,4,5,5,3,},},},superSkill={2.3,{20000,0.7,{2,1.89,2,},},{20012,0.7,{3,1,5,5,},},},roleId=10021,camp=0,property={1,1920,1922,209,170,204,178,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=5,passivity={},type=1,skill={0,{40001,0.7,{11,0.93,2,2,0.2,},},},superSkill={3,{20000,0.7,{2,1.06,2,},{3,0.6,1,4,},},},roleId=10008,camp=0,property={1,2206,2208,221,193,232,130,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=1,passivity={},type=1,skill={0,{40001,0.7,{1,1,1,},},{30011,0.7,{4,9,0.1,5,1,},{4,9,0.1,5,1,},},},superSkill={2.3,{20312,0.7,{19,1.35,1,0.5,5,},},},roleId=10013,camp=0,property={1,1678,1680,246,194,162,163,0,0,106,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},teamSkill={{3,{20012,0.7,{26,600,},{27,100,4,},},{10014,0.7,{25,2,0.1,4,},},},},},enemyData={{{professionId=0,passivity={},type=2,skill={0,{20011,0.7,{1,1,1,},{3,0.3,1,3,},},},superSkill={},roleId=14,camp=1,property={0,772,772,260,61,61,80,0,0,0.3,0.3,0.2,1.5,1,0,0,0,0,0,0,0,0,0,0,2,2,},quality=1,},{professionId=0,passivity={},type=2,skill={0,{20013,0.7,{1,0.45,1,},},},superSkill={},roleId=1,camp=1,property={0,483,483,260,61,61,240,0,0,0.3,0.3,0.2,1.5,1,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},{professionId=0,passivity={},type=2,skill={0,{20013,0.7,{1,0.45,1,},},},superSkill={},roleId=3,camp=1,property={0,483,483,260,61,61,7,0,0,0.3,0.3,0.2,1.5,1,0,0,0,0,0,0,0,0,0,0,0,0,},quality=1,},teamSkill={},},},})
|
||||
|
||||
return BattleMain
|
|
@ -245,12 +245,13 @@ local effectList = {
|
|||
local f1 = args[1]
|
||||
local dt = args[2]
|
||||
local f2 = args[3]
|
||||
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval)
|
||||
if caster.camp == 0 and target.camp == 1 then
|
||||
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval)
|
||||
end
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
local dmg = BattleUtil.CalDamage(caster, target, dt, f1)
|
||||
local dmg, crit = BattleUtil.CalDamage(caster, target, dt, f1)
|
||||
if target.isDead then
|
||||
local arr = BattleLogic.Query(function (r) return r.camp ~= caster.camp and r.uid ~= target.uid end)
|
||||
for i=1, #arr do
|
||||
|
@ -314,25 +315,6 @@ local effectList = {
|
|||
end
|
||||
end)
|
||||
end,
|
||||
--造成[a]%的[b]伤害,若暴击,则减少下次发动技能CD[c]秒。
|
||||
--a[float],b[伤害类型],c[float]
|
||||
[18] = function(caster, target, args, interval)
|
||||
local f1 = args[1]
|
||||
local dt = args[2]
|
||||
local f2 = args[3]
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval)
|
||||
if caster.camp == 0 and target.camp == 1 then
|
||||
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval)
|
||||
end
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
local d, crit = BattleUtil.CalDamage(caster, target, dt, f1)
|
||||
if crit then
|
||||
if target.skill then
|
||||
target.skill.sp = target.skill.sp + floor(f2 * BattleLogic.GameFrameRate)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end,
|
||||
--造成[a]%的[b]伤害,有[c]%的概率追加伤害,最多可追加[d]次。(0无限追加)
|
||||
--a[float],b[伤害类型],c[float],d[int]
|
||||
[19] = function(caster, target, args, interval)
|
||||
|
|
|
@ -6,15 +6,14 @@ local min = math.min
|
|||
--local RoleDataName = RoleDataName
|
||||
--local BattleEventName = BattleEventName
|
||||
|
||||
local chooseList = {}
|
||||
local function chooseTarget(role, chooseId, exceptList)
|
||||
local chooseType = floor(chooseId / 10000) % 10
|
||||
local chooseWeight = floor(chooseId / 100) % 10
|
||||
local sort = floor(chooseId / 10) % 10
|
||||
local exceptNum = #exceptList
|
||||
local exceptNum = exceptList.size
|
||||
local num = chooseId % 10
|
||||
|
||||
local arr = BattleLogic.Query()
|
||||
local arr
|
||||
if chooseType == 1 then
|
||||
arr = BattleLogic.Query(function (r)
|
||||
for i=1, exceptList.size do
|
||||
|
@ -26,8 +25,7 @@ local function chooseTarget(role, chooseId, exceptList)
|
|||
end)
|
||||
elseif chooseType == 2 then
|
||||
if role.lockTarget and num == 1 then
|
||||
arr[1] = role.lockTarget
|
||||
return arr
|
||||
return {role.lockTarget}
|
||||
end
|
||||
arr = BattleLogic.Query(function (r)
|
||||
for i=1, exceptList.size do
|
||||
|
@ -38,70 +36,72 @@ local function chooseTarget(role, chooseId, exceptList)
|
|||
return r.camp ~= role.camp
|
||||
end)
|
||||
elseif chooseType == 3 then
|
||||
arr[1] = role
|
||||
return arr
|
||||
return {role}
|
||||
elseif chooseType == 4 then
|
||||
return {BattleLogic.GetAggro(role.camp)}
|
||||
else
|
||||
arr = BattleLogic.Query()
|
||||
end
|
||||
|
||||
BattleUtil.RandomList(arr)
|
||||
if chooseWeight == 0 then
|
||||
BattleUtil.RandomList(arr)
|
||||
elseif chooseWeight == 1 then
|
||||
table.sort(arr, function(a, b)
|
||||
BattleUtil.Sort(arr, function(a, b)
|
||||
local r1 = a:GetRoleData(RoleDataName.Hp)
|
||||
local r2 = b:GetRoleData(RoleDataName.Hp)
|
||||
return sort == 1 and r1 < r2 or r1 > r2
|
||||
end)
|
||||
elseif chooseWeight == 2 then
|
||||
table.sort(arr, function(a, b)
|
||||
BattleUtil.Sort(arr, function(a, b)
|
||||
local r1 = a:GetRoleData(RoleDataName.Hp) / a:GetRoleData(RoleDataName.MaxHp)
|
||||
local r2 = b:GetRoleData(RoleDataName.Hp) / b:GetRoleData(RoleDataName.MaxHp)
|
||||
return sort == 1 and r1 < r2 or r1 > r2
|
||||
end)
|
||||
elseif chooseWeight == 3 then
|
||||
table.sort(arr, function(a, b)
|
||||
BattleUtil.Sort(arr, function(a, b)
|
||||
local r1 = a:GetRoleData(RoleDataName.Attack)
|
||||
local r2 = b:GetRoleData(RoleDataName.Attack)
|
||||
return sort == 1 and r1 < r2 or r1 > r2
|
||||
end)
|
||||
elseif chooseWeight == 4 then
|
||||
table.sort(arr, function(a, b)
|
||||
BattleUtil.Sort(arr, function(a, b)
|
||||
local r1 = a:GetRoleData(RoleDataName.PhysicalDefence)
|
||||
local r2 = b:GetRoleData(RoleDataName.PhysicalDefence)
|
||||
return sort == 1 and r1 < r2 or r1 > r2
|
||||
end)
|
||||
elseif chooseWeight == 5 then
|
||||
table.sort(arr, function(a, b)
|
||||
BattleUtil.Sort(arr, function(a, b)
|
||||
local r1 = a:GetRoleData(RoleDataName.PhysicalDefence)
|
||||
local r2 = b:GetRoleData(RoleDataName.PhysicalDefence)
|
||||
return sort == 1 and r1 < r2 or r1 > r2
|
||||
end)
|
||||
elseif chooseWeight == 6 then
|
||||
table.sort(arr, function(a, b)
|
||||
BattleUtil.Sort(arr, function(a, b)
|
||||
local r1 = a:GetRoleData(RoleDataName.MagicDefence)
|
||||
local r2 = b:GetRoleData(RoleDataName.MagicDefence)
|
||||
return sort == 1 and r1 < r2 or r1 > r2
|
||||
end)
|
||||
elseif chooseWeight == 7 then
|
||||
table.sort(arr, function(a, b)
|
||||
BattleUtil.Sort(arr, function(a, b)
|
||||
local r1 = a:GetRoleData(RoleDataName.MagicDefence)
|
||||
local r2 = b:GetRoleData(RoleDataName.MagicDefence)
|
||||
return sort == 1 and r1 < r2 or r1 > r2
|
||||
end)
|
||||
end
|
||||
|
||||
for i=1, #chooseList do
|
||||
chooseList[i] = nil
|
||||
if exceptNum > 0 then
|
||||
local chooseList = {}
|
||||
for i=1, exceptNum do
|
||||
chooseList[i] = exceptList.buffer[i]
|
||||
end
|
||||
for i=1+exceptNum, num == 0 and #arr or min(#arr, num) do
|
||||
chooseList[i] = arr[i-exceptNum]
|
||||
end
|
||||
return chooseList
|
||||
else
|
||||
return arr
|
||||
end
|
||||
--local chooseList = {}
|
||||
for i=1, exceptNum do
|
||||
chooseList[i] = exceptList[i]
|
||||
end
|
||||
for i=1+exceptNum, num == 0 and #arr or min(#arr, num) do
|
||||
chooseList[i] = arr[i]
|
||||
end
|
||||
arr = chooseList
|
||||
return arr
|
||||
end
|
||||
local effectPool = BattleObjectPool.New(function ()
|
||||
return {0, {}} -- type, {args, ...}
|
||||
|
@ -196,6 +196,12 @@ function Skill:ResetCD()
|
|||
BattleLogic.SetAggro(self.owner, 0)
|
||||
end
|
||||
|
||||
local function takeEffect(type, caster, target, args, interval)
|
||||
effect[type](caster, target, args, interval)
|
||||
if BattleLogic.IsOpenBattleRecord then
|
||||
BattleLogic.RecordEffect(caster, target, type, args, interval)
|
||||
end
|
||||
end
|
||||
function Skill:Cast()
|
||||
for i=1, self.effectList.size do
|
||||
local effectGroup = self.effectList.buffer[i]
|
||||
|
@ -217,7 +223,7 @@ function Skill:Cast()
|
|||
for j=1, #arr do
|
||||
for k=1, #effectGroup[3] do
|
||||
local v = effectGroup[3][k]
|
||||
effect[v[1]](self.owner, arr[j], v[2], duration)
|
||||
takeEffect(v[1], self.owner, arr[j], v[2], duration)
|
||||
end
|
||||
end
|
||||
elseif chooseId == 20000 then --敌方aoe
|
||||
|
@ -225,14 +231,14 @@ function Skill:Cast()
|
|||
for j=1, #arr do
|
||||
for k=1, #effectGroup[3] do
|
||||
local v = effectGroup[3][k]
|
||||
effect[v[1]](self.owner, arr[j], v[2], duration)
|
||||
takeEffect(v[1], self.owner, arr[j], v[2], duration)
|
||||
end
|
||||
end
|
||||
elseif nn == 1 or nn == 3 then
|
||||
for j=1, #arr do
|
||||
for k=1, #effectGroup[3] do
|
||||
local v = effectGroup[3][k]
|
||||
effect[v[1]](self.owner, arr[j], v[2], duration)
|
||||
takeEffect(v[1], self.owner, arr[j], v[2], duration)
|
||||
end
|
||||
end
|
||||
else
|
||||
|
@ -252,7 +258,7 @@ function Skill:Cast()
|
|||
r = arr[i]
|
||||
for k=1, #effectGroup[3] do
|
||||
local v = effectGroup[3][k]
|
||||
effect[v[1]](self.owner, r, v[2], cd)
|
||||
takeEffect(v[1], self.owner, r, v[2], cd)
|
||||
end
|
||||
return
|
||||
end
|
||||
|
@ -265,7 +271,7 @@ function Skill:Cast()
|
|||
self.choosedList:Add(r)
|
||||
for k=1, #effectGroup[3] do
|
||||
local v = effectGroup[3][k]
|
||||
effect[v[1]](self.owner, r, v[2], cd)
|
||||
takeEffect(v[1], self.owner, r, v[2], cd)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
|
|
@ -281,12 +281,12 @@ function BattleLogic.CurFrame()
|
|||
return curFrame
|
||||
end
|
||||
|
||||
local list = {}
|
||||
--local list = {}
|
||||
function BattleLogic.Query(func, inCludeDeadRole)
|
||||
for i=1, #list do
|
||||
list[i] = nil
|
||||
end
|
||||
--local list = {}
|
||||
--for i=1, #list do
|
||||
-- list[i] = nil
|
||||
--end
|
||||
local list = {}
|
||||
local index = 1
|
||||
if func then
|
||||
for i=1, objList.size do
|
||||
|
@ -458,6 +458,17 @@ function BattleLogic.RecordRoleProperty(uid, camp, name, value, delta)
|
|||
table.insert(record, string.format("frame:%d, uid:%d, camp:%d, name:%s, value:%d, delta:%d", curFrame, uid, camp, name, value, delta))
|
||||
end
|
||||
|
||||
--Record专用
|
||||
function BattleLogic.RecordEffect(caster, target, type, args, interval)
|
||||
local cUid = tostring(caster.uid) or "cTeam"
|
||||
local tUid = tostring(target.uid) or "tTeam"
|
||||
local str = ""
|
||||
for i=1, #args do
|
||||
str = str..tostring(args[i]) .. (i == #args and "" or "#")
|
||||
end
|
||||
table.insert(record, string.format("frame:%d, caster:%s, target:%s, effectType:%d, args:%s, interval:%d", curFrame, cUid, tUid, type, str, interval))
|
||||
end
|
||||
|
||||
--Record专用
|
||||
function BattleLogic.GenerateRecordFile()
|
||||
local time = string.format("%d-%d-%d-%d-%d-%d",
|
||||
|
|
|
@ -175,6 +175,18 @@ function BattleUtil.RandomList(arr)
|
|||
end
|
||||
end
|
||||
|
||||
function BattleUtil.Sort(arr, comp)
|
||||
if #arr <= 1 then return arr end
|
||||
for i=1, #arr do
|
||||
for j = #arr, i+1, -1 do
|
||||
if comp(arr[j-1], arr[j]) then
|
||||
arr[j-1], arr[j] = arr[j], arr[j-1]
|
||||
end
|
||||
end
|
||||
end
|
||||
return arr
|
||||
end
|
||||
|
||||
function BattleUtil.GetPropertyName(type)
|
||||
if type == 1 then
|
||||
return RoleDataName.Strength
|
||||
|
|
|
@ -723,10 +723,25 @@ public class MapLogic {
|
|||
LuaValue getOptionData = FightDataUtil.getOptionData(frames);
|
||||
|
||||
int[] checkResult = CheckFight.getInstance().checkFight(seed, getFightData, getOptionData);
|
||||
|
||||
List<Integer> remainHp = new ArrayList<>(5);
|
||||
for (int i = 1; i < checkResult.length; i++) {
|
||||
remainHp.add(checkResult[i]);
|
||||
}
|
||||
|
||||
//校验结果码 1:胜利
|
||||
int resultCode = checkResult[0];
|
||||
if (resultCode !=1){
|
||||
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "战斗失败");
|
||||
if (resultCode == -1){
|
||||
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "战斗异常!");
|
||||
return;
|
||||
}else if(resultCode == 0){
|
||||
CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder();
|
||||
FightInfoProto.FightEndResponse fightEndResponse = FightInfoProto.FightEndResponse
|
||||
.newBuilder()
|
||||
.setDrop(dropBuilder)
|
||||
.addAllRemainHpList(remainHp)
|
||||
.build();
|
||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightEndResponse, true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -737,11 +752,6 @@ public class MapLogic {
|
|||
hero.setCurHp(checkResult[teamPosHeroInfo.getPosition()]);
|
||||
}
|
||||
|
||||
List<Integer> remainHp = new ArrayList<>(5);
|
||||
for (int i = 1; i < checkResult.length; i++) {
|
||||
remainHp.add(checkResult[i]);
|
||||
}
|
||||
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sMonsterGroup.getRewardgroup(), 1, 1);
|
||||
FightInfoProto.FightEndResponse fightEndResponse = FightInfoProto.FightEndResponse
|
||||
.newBuilder()
|
||||
|
|
Loading…
Reference in New Issue