133 lines
12 KiB
Lua
133 lines
12 KiB
Lua
|
|
local function pairsByKeys(t)
|
|
local test.a = {}
|
|
for n in pairs(t) do
|
|
if n then
|
|
test.a[#test.a+1] = n
|
|
end
|
|
end
|
|
table.sort(test.a, function( op1, op2 )
|
|
local type1, type2 = type(op1), type(op2)
|
|
local num1, num2 = tonumber(op1), tonumber(op2)
|
|
|
|
if ( num1 ~= nil) and (num2 ~= nil) then
|
|
return num1 < num2
|
|
elseif type1 ~= type2 then
|
|
return type1 < type2
|
|
elseif type1 == "string" then
|
|
return op1 < op2
|
|
elseif type1 == "boolean" then
|
|
return op1
|
|
-- 以上处理: number, string, boolean
|
|
else -- 处理剩下的: function, table, thread, userdata
|
|
return tostring(op1) < tostring(op2) -- tostring后比较字符串
|
|
end
|
|
end)
|
|
local i = 0
|
|
return function()
|
|
i = i + 1
|
|
return test.a[i], t[test.a[i]]
|
|
end
|
|
end
|
|
local function PrintTable(tb)
|
|
local indent_str = "{"
|
|
local count = 0
|
|
for k,v in pairs(tb) do
|
|
count = count + 1
|
|
end
|
|
for k=1, #tb do
|
|
local v = tb[k]
|
|
if type(v) == "table" then
|
|
indent_str = indent_str .. PrintTable(v)
|
|
else
|
|
indent_str = indent_str .. tostring(v)
|
|
end
|
|
if k < count then
|
|
indent_str = indent_str..","
|
|
end
|
|
end
|
|
|
|
local index = 0
|
|
for k,v in pairsByKeys(tb) do
|
|
index = index + 1
|
|
if type(k) ~= "number" then
|
|
if type(v) == "table" then
|
|
indent_str = string.format("%s%s=%s", indent_str, tostring(k), PrintTable(v))
|
|
else
|
|
indent_str = string.format("%s%s=%s", indent_str, tostring(k), tostring(v))
|
|
end
|
|
if index < count then
|
|
indent_str = indent_str .. ","
|
|
end
|
|
end
|
|
end
|
|
indent_str = indent_str .. "}"
|
|
return indent_str
|
|
end
|
|
|
|
|
|
|
|
local testFightData ={enemyData={{{ai={0},camp=1,element=3,godSoulLv=0,job=0,monsterId=30040701,passivity={{107205,0,107,1},{107106,0,90,16,2,1},{107107,1,107,1}},position=1,professionId=0,property={165,92782,92782,14395,4279,4279,0,0,0,1.5,0.058,0.067,0.067,0.067,1,1,0,0,0,0,0,0,0,0,0},quality=0,roleId=10005,skill={1071,0.2,0,1,{400000,{1,0.95,0.4}}},skinId=0,star=7,superSkill={1072,0.3,0,1,{210003,{2,1.63,2},{3,0.4,2,1}}},type=0},{ai={0},camp=1,element=2,godSoulLv=0,job=0,monsterId=30040702,passivity={{115205,0,110,1},{115106,0,90,16,2,1},{115107,1,107,2}},position=2,professionId=0,property={165,92782,92782,14395,4279,4279,0,0,0,1.5,0.058,0.067,0.067,0.067,1,1,0,0,0,0,0,0,0,0,0},quality=0,roleId=10022,skill={1151,0.2,0,1,{220000,{1,0.44,2}}},skinId=0,star=7,superSkill={1152,0.05,0,1,{220000,{2,1.55,2},{3,0.45,1,1}}},type=0},{ai={0},camp=1,element=2,godSoulLv=0,job=0,monsterId=30040703,passivity={{119106,0,90,16,2,1},{119205,0,105,1}},position=3,professionId=0,property={165,92782,92782,14395,4279,4279,0,0,0,1.5,0.058,0.067,0.067,0.067,1,1,0,0,0,0,0,0,0,0,0},quality=0,roleId=10033,skill={1191,0.2,0,1,{220801,{1,0.9,2}}},skinId=0,star=7,superSkill={1192,1,0,1,{220801,{103,3.15,2,0.3,1}}},type=0},{ai={0},camp=1,element=3,godSoulLv=0,job=0,monsterId=30040704,passivity={{104106,0,90,16,2,1},{104107,1,104,1,2}},position=4,professionId=0,property={165,92782,92782,14395,4279,4279,0,0,0,1.5,0.058,0.067,0.067,0.067,1,1,0,0,0,0,0,0,0,0,0},quality=0,roleId=10006,skill={1041,0.2,0,1,{220801,{1,0.95,2}}},skinId=0,star=7,superSkill={1042,0,0,1,{220801,{1,3.33,2}},{300000,{100,1,1}}},type=0},{ai={0},camp=1,element=1,godSoulLv=0,job=1,monsterId=30040705,passivity={{129106,0,90,16,2,1},{129107,1,137,1,0.2,2},{129205,0,300,1,0.32}},position=5,professionId=0,property={165,92782,92782,14395,4279,4279,0,0,0,1.5,0.058,0.067,0.067,0.067,1,1,0,0,0,0,0,0,0,0,0},quality=0,roleId=10004,skill={1291,0.05,0,1,{100211,{24,1,1.03}}},skinId=0,star=7,superSkill={1292,1.4,0,1,{100000,{24,1,0.9}}},type=0},{ai={0},camp=1,element=3,godSoulLv=0,job=0,monsterId=30040706,passivity={{103205,0,95,1},{103106,0,90,16,2,1},{103107,1,91,0.25,2}},position=6,professionId=0,property={165,92782,92782,14395,4279,4279,0,0,0,1.5,0.058,0.067,0.067,0.067,1,1,0,0,0,0,0,0,0,0,0},quality=0,roleId=10002,skill={1031,0.2,0,1,{230002,{1,0.65,1}}},skinId=0,star=7,superSkill={1032,0.3,0,1,{220003,{1,1.63,1}},{300000,{100,1,1}}},type=0},firstCamp=0,monsterList={},outData="",teamPassive={},teamSkill={}}},nodeId=0,playerData={{camp=0,element=3,godSoulLv=0,job=0,passivity={{1061060,0,90,16,2,1},{1061110,1,108,1}},position=1,professionId=1,property={330,3523964,3523964,447044,27751,27751,0,0.42,0.05,1.19,0,0.2,0,0.12,1,1.12,0,0,0,0,0,0,0,0,0.05},quality=0,roleId=10003,skill={1061,0.2,0,1,{400000,{1,0.95,1}}},skinId=0,star=11,superSkill={1062,1.7,0,1,{230002,{10,2.23,1,0.3}}},type=1},{camp=0,element=4,godSoulLv=0,job=0,passivity={{1471110,1,110,1},{1471060,0,90,16,2,1},{1471111,1,91,0.18,2},{1471100,1,160,0.8,2,1.6,2},{1471071,1,107,1},{1471070,1,159,2,1,0.6}},position=2,professionId=2,property={330,2280212,2280212,505865,27751,27751,0,0.3,0.05,1.17,0,0.3,0,0.12,1,1,0,0,0,0,0,0,0,0,0.05},quality=0,roleId=10041,skill={1471,0.5,0,1,{400000,{1,1,2}}},skinId=0,star=11,superSkill={1472,0.05,0.8,3,{210003,{2,1.72,2},{111,0.6,2,1,1,2}}},type=1},{camp=0,element=1,godSoulLv=0,job=0,passivity={{1311111,1,327,1},{1311100,1,105,1},{1311101,1,283,1,0,1,1,10},{1311060,0,90,16,2,1}},position=3,professionId=4,property={330,2280212,2280212,447044,27751,27751,0,0.3,0.17,1.09,0.1,0.2,0,0.2,1,1,0,0,0,0,0,0,0,0,0.05},quality=0,roleId=10009,skill={1311,0.48,0,1,{400000,{1,0.9,2}}},skinId=0,star=11,superSkill={1312,2.5,0,1,{210003,{113,1.55,2,1,0.4,7,1}}},type=1},{camp=0,element=3,godSoulLv=0,job=0,passivity={{1131070,1,112,1,1},{1131071,1,115,1,0.3,1,2},{1131060,0,90,16,2,1},{1131110,1,118,0.5,2},{1131111,1,56,0.1},{1131100,1,245,2},{1131101,1,337,1}},position=4,professionId=2,property={330,2280212,2280212,505865,27751,27751,0,0.42,0.05,1.17,0,0.3,0,0.12,1,1,0,0,0,0,0,0,0,0,0.05},quality=0,roleId=10085,skill={1131,0.7,0,1,{230002,{1,0.6,2}}},skinId=0,star=11,superSkill={1132,0.8,0,1,{200212,{2,2.12,2}},{400000,{116,1}}},type=1},{camp=0,element=2,godSoulLv=0,job=0,passivity={{1141100,1,107,2},{1141110,1,102,1},{1141070,1,119,1,0.1,5,7},{1141111,1,258,12,0.15},{1141071,1,119,1,0.06,6,7},{1141060,0,90,16,2,1},{1141101,1,296,2,1}},position=5,professionId=2,property={330,2280212,2280212,482337,27751,27751,0,0.3,0.17,1.23,0,0.32,0,0.12,1,1,0,0,0,0,0,0,0,0,0.05},quality=0,roleId=10023,skill={1141,0.4,0,1,{230002,{1,0.6,1}}},skinId=0,star=11,superSkill={1142,2,0,1,{230002,{1,2.12,1}},{300000,{112,5,0.1,7,1}}},type=1},{camp=0,element=2,godSoulLv=0,job=0,passivity={{1181101,1,99,0.3},{1181100,1,124,1},{1181071,1,98,0.3},{1181060,0,90,16,2,1}},position=6,professionId=4,property={330,2280212,2280212,447044,27751,27751,0,0.3,0.29,1.09,0.1,0.2,0,0.2,1,1,0,0,0,0,0,0,0,0,0.05},quality=0,roleId=10089,skill={1181,0.2,0,1,{400000,{1,0.9,2}}},skinId=0,star=11,superSkill={1182,0.8,0,1,{230002,{2,2.12,2}},{300000,{100,1,1}}},type=1},firstCamp=0,monsterList={{camp=0,id=0,passivity={{2510060,0,430,1,14,3,0.073,1},{2500060,0,429,0.525,1,0.5,1},{2520060,0,431,1,0.0575,12}},position=100,property={0},sex=0,skill={{{effect={40006,1.2,1.5,5,{200000,{128,0.0006,12000}}},maxCount=99,maxRoundCount=1,triggerCondition={8,3,20},triggerId=6}}},star=100,teamDamage=88809}},outData="",teamPassive={{}},teamSkill={}}}
|
|
|
|
|
|
|
|
|
|
require "Modules/Battle/Data/ConfigData"
|
|
local BattleMain = require("BattleMain")
|
|
local seed = 1646989655
|
|
local resultList = BattleMain.Execute({seed = seed, type = BATTLE_SERVER_TYPE.MonterFight, maxRound = 20}, testFightData)
|
|
print(PrintTable(resultList))
|
|
--print(PrintTable(resultList.starRecord))
|
|
-- local resultList = BattleMain.Execute({seed = seed, type = BATTLE_SERVER_TYPE.MonterFight, maxRound = 20}, testFightData)
|
|
-- print(PrintTable(resultList))
|
|
-- local resultList = BattleMain.Execute({seed = seed, type = BATTLE_SERVER_TYPE.MonterFight, maxRound = 20}, testFightData)
|
|
-- print(PrintTable(resultList))
|
|
-- local resultList = BattleMain.Execute({seed = seed, type = BATTLE_SERVER_TYPE.MonterFight, maxRound = 20}, testFightData)
|
|
-- print(PrintTable(resultList))
|
|
-- local resultList = BattleMain.Execute({seed = seed, type = BATTLE_SERVER_TYPE.MonterFight, maxRound = 20}, testFightData)
|
|
-- print(PrintTable(resultList))
|
|
-- local resultList = BattleMain.Execute({seed = seed, type = BATTLE_SERVER_TYPE.MonterFight, maxRound = 20}, testFightData)
|
|
-- print(PrintTable(resultList))
|
|
-- local resultList = BattleMain.Execute({seed = seed, type = BATTLE_SERVER_TYPE.MonterFight, maxRound = 20}, testFightData)
|
|
-- print(PrintTable(resultList))
|
|
-- local resultList = BattleMain.Execute({seed = seed, type = BATTLE_SERVER_TYPE.MonterFight, maxRound = 20}, testFightData)
|
|
-- print(PrintTable(resultList))
|
|
-- -- local resultList = BattleMain.Execute({seed = os.time(), type = 2, maxRound = 20}, testFightData)
|
|
-- print(PrintTable(resultList))
|
|
-- local resultList = BattleMain.Execute({seed = os.time(), type = 2, maxRound = 20}, testFightData)
|
|
-- print(PrintTable(resultList))
|
|
-- local resultList = BattleMain.Execute({seed = os.time(), type = 2, maxRound = 20}, testFightData)
|
|
-- print(PrintTable(resultList))
|
|
-- local resultList = BattleMain.Execute({seed = os.time(), type = 2, maxRound = 20}, testFightData)
|
|
-- print(PrintTable(resultList))
|
|
-- local resultList = BattleMain.Execute({seed = os.time(), type = 2, maxRound = 20}, testFightData)
|
|
-- print(PrintTable(resultList))
|
|
-- local resultList = BattleMain.Execute({seed = os.time(), type = 2, maxRound = 20}, testFightData)
|
|
-- print(PrintTable(resultList))
|
|
-- local resultList = BattleMain.Execute({seed = os.time(), type = 2, maxRound = 20}, testFightData)
|
|
-- print(PrintTable(resultList))
|
|
-- local resultList = BattleMain.Execute({seed = os.time(), type = 2, maxRound = 20}, testFightData)
|
|
-- print(PrintTable(resultList))
|
|
-- local resultList = BattleMain.Execute({seed = os.time(), type = 2, maxRound = 20}, testFightData)
|
|
-- print(PrintTable(resultList))
|
|
-- local resultList = BattleMain.Execute({seed = os.time(), type = 2, maxRound = 20}, testFightData)
|
|
-- print(PrintTable(resultList))
|
|
-- local testFightData =
|
|
-- {enemyData={{{ai={0},camp=1,element=3,monsterId=10101162,passivity={},position=2,professionId=0,property={1,1100,1100,350,100,100,400,0,0,1,0,0.2,0,0,1,1,0,0,0,0,0,0,0,0,0},quality=1,roleId=10048,skill={100481,0.05,0,1,{210003,{1,0.47,1}}},skinId=0,star=0,superSkill={100482,0.05,0,1,{210003,{1,1.72,1}}},type=2},firstCamp=0,monsterList={},outData="",teamPassive={},teamSkill={}}},playerData={{camp=0,element=1,passivity={},position=1,professionId=4,property={1,3000,3000,450,150,150,0,0,0,1,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0},quality=0,roleId=10068,skill={100681,0.05,0,1,{400000,{1,0.9,2}}},skinId=0,star=4,superSkill={100682,0.05,0,1,{200003,{113,1.55,2,1,0.2,7,1}}},type=1},firstCamp=0,monsterList={},outData="",teamPassive={{}},teamSkill={}}}
|
|
|
|
|
|
-- local BattleMain = require("BattleMain")
|
|
-- local resultList = BattleMain.Execute({seed = os.time(), type = 2, maxRound = 20}, testFightData)
|
|
-- print(PrintTable(resultList))
|
|
-- local resultList = BattleMain.Execute({seed = os.time(), type = 2, maxRound = 20}, testFightData)
|
|
-- print(PrintTable(resultList))
|
|
-- local resultList = BattleMain.Execute({seed = os.time(), type = 2, maxRound = 20}, testFightData)
|
|
-- print(PrintTable(resultList))
|
|
-- local resultList = BattleMain.Execute({seed = os.time(), type = 2, maxRound = 20}, testFightData)
|
|
-- print(PrintTable(resultList))
|
|
-- local resultList = BattleMain.Execute({seed = os.time(), type = 2, maxRound = 20}, testFightData)
|
|
-- print(PrintTable(resultList))
|
|
-- local resultList = BattleMain.Execute({seed = os.time(), type = 2, maxRound = 20}, testFightData)
|
|
-- print(PrintTable(resultList))
|
|
|