local function pairsByKeys(t) local a = {} for n in pairs(t) do if n then a[#a+1] = n end end table.sort(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 a[i], t[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=4,job=0,passivity={},position=2,professionId=0,property={"1","600","600","140","25","25","400","0.0","0.0","1.0","0.0","0.0","0.0","0.0","1.0","1.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"},quality=1,roleId=10053,skill={"100531",0.5,0,1,{400000,{1,1,1}}},skinId=0,star=3,superSkill={"100532",0.5,0,1,{400000,{1,3.5,1}}},type=2},monsterList={},teamPassive={},teamSkill={},weaponList={}}},playerData={{camp=0,element=4,job=0,passivity={},position=1,professionId=2,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=1,roleId=10071,skill={"100711",0.5,0,1,{210003,{1,0.49,1}}},skinId=0,star=4,superSkill={"100712",0.5,0,1,{200003,{109,1.4,1,1,0.24,5}}},type=1},firstCamp=0,monsterList={},outData="",teamPassive={},teamSkill={},weaponList={}}} require "Modules/Battle/Data/ConfigData" local BattleMain = require("BattleMain") local seed = 1698029492 -- local config=ConfigManager.GetConfigData(ConfigName.PassiveSkillLogicConfig,12000004) -- print(config.Value) local resultList = BattleMain.Execute({seed = seed, type = BATTLE_SERVER_TYPE.MonterFight, maxRound = 20}, testFightData) print(PrintTable(resultList)) print("curround=="..resultList.curRound) -- 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))