miduo_server/luafight/test.lua

135 lines
14 KiB
Lua

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={{152106,0,90,16,2,1},{152107,1,91,0.18,2},{152205,0,163,0.1,4,0.2},{1000011,0,205,0.12,2},{1000016,0,90,16,1,1},{1000038,0,188,0.12,4},{1000047,0,195,1,2,7},{1000050,0,205,0.18,2},{1000052,0,90,16,2,1}},position=1,professionId=1,property={"318","2799153","2799153","467018","5946","5946","1","0.407","0.407","1.771","0.099","0.547","0.386","0.547","1.0","1.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"},quality=2,roleId=10090,skill={"1521",0.5,0,1,{400000,{1,0.95,2}}},skinId=0,star=5,superSkill={"1522",1.2,0.5,3,{200213,{1,1.4,2},{110,0.4,2}}},type=1},{ai={0},camp=1,element=1,job=0,passivity={{127106,0,90,16,2,1},{127107,1,102,1},{127205,0,425,3,1,1,0.8},{1000011,0,205,0.12,2},{1000016,0,90,16,1,1},{1000038,0,188,0.12,4},{1000046,0,194,1},{1000047,0,195,1,2,7},{1000048,0,196,0.5,3}},position=2,professionId=1,property={"318","2799153","2799153","467018","5946","5946","1","0.407","0.407","1.771","0.099","0.547","0.386","0.547","1.0","1.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"},quality=2,roleId=10001,skill={"1271",0.48,0,1,{220000,{1,0.44,1}}},skinId=0,star=5,superSkill={"1272",1,0.5,4,{220000,{105,1.55,1,1,0.6}}},type=1},{ai={0},camp=1,element=1,job=2,passivity={{134106,0,90,16,2,1},{134107,1,107,1},{134205,0,134,1,1,0.36},{1000011,0,205,0.12,2},{1000016,0,90,16,1,1},{1000025,0,178,1,0.96,1},{1000038,0,188,0.12,4},{1000039,0,178,1,0.96,1},{1000040,0,189,1},{1000043,0,184,1,1},{1000047,0,195,1,2,7}},position=3,professionId=1,property={"318","2799153","2799153","467018","5946","5946","1","0.407","0.407","1.771","0.099","0.547","0.386","0.547","1.0","1.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"},quality=2,roleId=10087,skill={"1341",0.48,0,1,{220801,{1,0.9,2}}},skinId=0,star=5,superSkill={"1342",1.2,0,1,{220003,{1,1.55,2},{111,0.6,1,0.2,1,2}}},type=1},{ai={0},camp=1,element=1,job=0,passivity={{130106,0,90,16,2,1},{130107,1,140,1,4,0.4,1},{130205,0,140,1,4,0.25,1},{1000016,0,90,16,1,1},{1000047,0,195,1,2,7},{1000052,0,90,16,2,1},{1000053,0,199,0.5}},position=4,professionId=1,property={"318","2799153","2799153","467018","5946","5946","1","0.407","0.407","1.771","0.099","0.547","0.386","0.547","1.0","1.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"},quality=2,roleId=10016,skill={"1301",0.48,0,1,{400000,{1,0.9,1}}},skinId=0,star=5,superSkill={"1302",0.4,0,1,{400000,{1,3.15,1}},{300000,{24,12,0.3}}},type=1},{ai={0},camp=1,element=4,job=0,passivity={{145106,0,90,16,2,1},{145107,1,128,1},{145205,0,206,1,0.5,1,0},{1000011,0,205,0.12,2},{1000013,0,174,0.18,1},{1000016,0,90,16,1,1},{1000038,0,188,0.12,4},{1000042,0,191,0.18},{1000046,0,194,1},{1000047,0,195,1,2,7},{1000050,0,205,0.18,2}},position=5,professionId=1,property={"318","2799153","2799153","467018","5946","5946","1","0.407","0.407","1.771","0.099","0.547","0.386","0.547","1.0","1.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"},quality=2,roleId=10043,skill={"1451",0.5,0,1,{400000,{1,1,2}}},skinId=0,star=5,superSkill={"1452",1.35,0.5,4,{400000,{103,3.5,2,0.3,1}}},type=1},{ai={0},camp=1,element=4,job=1,passivity={{142106,0,90,16,2,1},{142107,1,93,0.25,2},{142205,0,155,0.1,1,0.05},{1000011,0,205,0.12,2},{1000016,0,90,16,1,1},{1000022,0,177,0.25,0.12,1},{1000038,0,188,0.12,4},{1000045,0,193,0.32,1},{1000047,0,195,1,2,7}},position=6,professionId=1,property={"318","2799153","2799153","467018","5946","5946","1","0.407","0.407","1.771","0.099","0.547","0.386","0.547","1.0","1.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0","0.0"},quality=2,roleId=10024,skill={"1421",0.05,0,1,{100211,{24,1,1.03}}},skinId=0,star=5,superSkill={"1422",2.2,0,1,{100000,{24,1,0.9}}},type=1},monsterList={},teamPassive={},teamSkill={}}},playerData={{camp=0,element=4,job=0,passivity={{1471060,0,90,16,2,1},{1471070,1,159,2,1,0.6},{1471071,1,107,1},{1471100,1,160,0.8,2,1.6,2},{1471110,1,110,1},{1471111,1,91,0.18,2},{3471020,0,356,1472,2,1,2.12},{3000000,0,354,12,0.2,1},{1000026,0,179,0.1},{1000029,0,178,2,0.6,1},{1000016,0,90,16,1,1},{1201431,0,304,1,1,5,0.1,1},{147205,0,134,2,1,0.36},{147215,0,90,16,1,1},{3000004,0,90,16,2,1},{2320005,0,428,1,0,1,1,1,0,3,1,1},{2320006,0,90,1,0.05,2}},position=1,professionId=2,property={231,3027430,3027430,470723,88557,85631,0,0.33,0.57,1.23,0,0.63,0.13,0,1,1,0,0,0,0,0,0,0,0,0.17},quality=1,roleId=10041,skill={"1471",0.5,0,1,{400000,{1,1,2}}},skinId=0,star=14,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,job=2,passivity={{128106,0,90,16,2,1},{128107,1,356,1282,111,3,0.3},{128110,1,135,0.4,1,2},{1000040,0,189,1},{1000043,0,184,1,1},{1000016,0,90,16,1,1},{128205,0,136,0.8,1,2},{128215,0,90,16,1,1},{2320005,0,428,1,0,1,1,1,0,3,1,1},{2320006,0,90,1,0.05,2}},position=3,professionId=4,property={205,1228505,1228505,235622,41355,34423,0,0.2,0.44,1.23,0,0.3,0,0,1,1,0,0,0,0,0,0,0,0,0.17},quality=1,roleId=10014,skill={"1281",0.05,0,1,{210003,{1,0.44,2}}},skinId=0,star=9,superSkill={"1282",0.35,1,6,{200000,{2,0.92,2},{111,0.65,1,0.2,1,2}}},type=1},{camp=0,element=2,job=0,passivity={{119106,0,90,16,2,1},{119110,1,206,1,0.2,1,0},{119205,0,105,1},{2320005,0,428,1,0,1,1,1,0,3,1,1},{2320006,0,90,1,0.05,2}},position=5,professionId=4,property={185,1017565,1017565,158447,31508,29119,0,0.15,0.39,1.15,0.06,0.2,0,0.1,1,1,0,0,0,0,0,0,0,0,0.17},quality=1,roleId=10033,skill={"1191",0.2,0.5,4,{220801,{1,0.9,2}}},skinId=0,star=9,superSkill={"1192",1,0.5,4,{220801,{103,3.15,2,0.3,1}}},type=1},{camp=0,element=1,job=0,passivity={{130106,0,90,16,2,1},{130107,1,140,1,4,0.4,1},{130110,1,141,1},{1000046,0,194,1},{1201431,0,304,1,1,5,0.1,1},{130205,0,140,1,4,0.25,1},{2320005,0,428,1,0,1,1,1,0,3,1,1},{2320006,0,90,1,0.05,2}},position=6,professionId=1,property={191,1470715,1470715,228680,35775,32981,0,0.15,0.39,1.15,0.06,0.2,0,0.1,1,1,0,0,0,0,0,0,0,0,0.17},quality=1,roleId=10016,skill={"1301",0.48,0,1,{400000,{1,0.9,1}}},skinId=0,star=9,superSkill={"1302",0.4,0,1,{400000,{1,3.15,1}},{300000,{24,12,0.3}}},type=1},{camp=0,element=1,job=0,passivity={{1311060,0,90,16,2,1},{1311100,1,105,1},{1311101,1,283,1,0,1,1,10},{1311111,1,327,1},{1000016,0,90,16,1,1},{131205,0,168,1},{2320005,0,428,1,0,1,1,1,0,3,1,1},{2320006,0,90,1,0.05,2}},position=2,professionId=4,property={205,1395497,1395497,258337,36437,36934,0,0.15,0.51,1.15,0.1,0.2,0,0.08,1,1,0,0,0,0,0,0,0,0,0.17},quality=1,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=1,job=0,passivity={{133106,0,90,16,2,1},{133107,1,150,1,0.5,2},{133110,1,245,1},{1000041,0,190,13},{1201421,0,444,0.2,12,0.05},{133205,0,146,1,0.8,2},{2320005,0,428,1,0,1,1,1,0,3,1,1},{2320006,0,90,1,0.05,2}},position=4,professionId=2,property={205,1306801,1306801,261107,44697,42071,0,0.36,0.52,1.25,0,0.41,0.13,0,1,1,0,0,0,0,0,0,0,0,0.17},quality=1,roleId=10017,skill={"1331",0.48,0,1,{220801,{1,0.9,1}}},skinId=0,star=9,superSkill={"1332",1.7,0.6,6,{220801,{1,3.15,1}},{400000,{116,1}}},type=1},firstCamp=0,monsterList={{camp=0,id=0,position=100,property={0},skill={{{effect={"50043",0.35,0.5,4,{210003,{132,1,1800}},{100001,{117,0.6,1,1}}},maxCount=10,maxRoundCount=1,triggerCondition={8,3,4},triggerId=6}},{{effect={"50044",0.35,1,6,{200000,{134,1,1200,0.4,3,1,1,120}}},maxCount=3,maxRoundCount=1,triggerCondition={8,3,3},triggerId=6}},{{effect={"50038",1.4,0,1,{100213,{144,12,0.15,2}}},maxCount=1,maxRoundCount=1,triggerCondition={8,3,1},triggerId=11}}},star=72,teamDamage=8909144}},outData="",teamPassive={},teamSkill={}}}
require "Modules/Battle/Data/ConfigData"
local BattleMain = require("BattleMain")
local seed = 1675210086548
-- 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))