battle
parent
622d22d4a2
commit
2df1e6b44c
|
@ -24,6 +24,9 @@ local BattleMain = {}
|
|||
local BattleLogic = BattleLogic
|
||||
local Random = Random
|
||||
|
||||
local _BattleErrorCache = {}
|
||||
local _BattleErrorIndex = 0
|
||||
local _seed
|
||||
local _fightData
|
||||
local _optionData
|
||||
|
||||
|
@ -110,7 +113,22 @@ local function generateRecordFile()
|
|||
io.close(file)
|
||||
end
|
||||
|
||||
|
||||
local function addBattleData()
|
||||
local str = ""
|
||||
str = str.."seed:\n"..tostring(_seed).."\n"
|
||||
str = str.."fightData:\n"..PrintTable(_fightData).."\n"
|
||||
str = str.."optionData:\n"..PrintTable(_optionData).."\n"
|
||||
|
||||
_BattleErrorIndex = _BattleErrorIndex + 1
|
||||
if _BattleErrorIndex > 5 then
|
||||
_BattleErrorIndex = 1
|
||||
end
|
||||
_BattleErrorCache[_BattleErrorIndex] = str
|
||||
end
|
||||
|
||||
function BattleMain.Execute(args, fightData, optionData)
|
||||
_seed = args.seed
|
||||
_fightData = fightData
|
||||
_optionData = optionData or {}
|
||||
|
||||
|
@ -144,7 +162,6 @@ function BattleMain.Execute(args, fightData, optionData)
|
|||
end
|
||||
end
|
||||
resultList.result = BattleLogic.Result
|
||||
resultList.duration = BattleLogic.CurFrame() / BattleLogic.GameFrameRate
|
||||
|
||||
if BattleLogic.IsOpenBattleRecord then
|
||||
generateRecordFile()
|
||||
|
@ -157,19 +174,7 @@ function BattleMain.Execute(args, fightData, optionData)
|
|||
--print("最终运行帧数:"..BattleLogic.CurFrame())
|
||||
--print("result:"..BattleLogic.Result)
|
||||
|
||||
local time = string.format("%d-%d-%d-%d-%d-%d",
|
||||
os.date("%Y"),
|
||||
os.date("%m"),
|
||||
os.date("%d"),
|
||||
os.date("%H"),
|
||||
os.date("%M"),
|
||||
os.date("%S"))
|
||||
local file = io.open("luafight/BattleRecord/record_"..time..".txt", "a")
|
||||
file:write("fightData:\n"..PrintTable(_fightData).."\n")
|
||||
file:write("optionData:\n"..PrintTable(_optionData).."\n")
|
||||
file:write("seed:\n"..args.seed.."\n")
|
||||
io.close(file)
|
||||
|
||||
addBattleData()
|
||||
return resultList
|
||||
end
|
||||
if isError then --捕获异常,并输出错误日志
|
||||
|
@ -182,14 +187,22 @@ function BattleMain.Execute(args, fightData, optionData)
|
|||
os.date("%S"))
|
||||
local file = io.open("luafight/LogError/"..time..".txt", "a")
|
||||
file:write(errorCache)
|
||||
file:write("seed:\n"..tostring(args.seed).."\n")
|
||||
file:write("fightData:\n"..PrintTable(_fightData).."\n")
|
||||
file:write("optionData:\n"..PrintTable(_optionData).."\n")
|
||||
file:write("seed:\n"..args.seed.."\n")
|
||||
file:write("\n\nlast battle data:\n")
|
||||
for i=1, #_BattleErrorCache do
|
||||
file:write(string.format("\nindex:%d\n", i))
|
||||
file:write(_BattleErrorCache[i])
|
||||
end
|
||||
io.close(file)
|
||||
end
|
||||
return { result = -1 }
|
||||
end
|
||||
--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={},},},})
|
||||
--[[
|
||||
BattleMain.Execute({seed=1565094199,maxTime=300}
|
||||
,{enemyData={{{ai={0},camp=1,element=1,passivity={{45,1},{45,2}},professionId=0,property={139,117440,117440,18564,2911,2911,5960,0.0,0.0,0.05,0.15,0.2,1.5,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=3,roleId=23,skill={0,{20001,0.7,{1,0.848,1},{13,2,0.1,2,4},{4,4,0.2,12,4}}},superSkill={1.5,{20002,0.7,{10,1.072,1,0.4},{13,3,0.2,1,4}},{30000,0.7,{4,4,0.2,9,2}}},type=4},teamSkill={}}},playerData={{camp=0,element=4,passivity={{5,0.3,1,0.1,5},{39,5,2800},{12,0.15,0.15,2},{44,0.1,4,0.05,6,2}},professionId=5,property={139,76728,76728,4144,3372,2321,3740,0,0,0,0,0.0847,1.5,0,1,1,0,0,0,0,0,0,0,0,0},quality=1,roleId=10005,skill={0,{20001,0.7,{1,0.65,2}},{30101,0.7,{24,1,0.68}},{30001,0.7,{4,1,0.2,9,2}}},superSkill={2,{20004,0.7,{2,0.86,2}},{10100,0.7,{24,1,0.74}}},type=1},{camp=0,element=3,passivity={{5,0.3,1,0.1,5},{39,5,2800},{12,0.15,0.15,2},{44,0.1,4,0.05,6,2}},professionId=5,property={139,76559,76559,4086,2372,3370,3734,0,0,0,0,0.0808,1.5,0,1,1,0,0,0,0,0,0,0,0,0},quality=1,roleId=10007,skill={0,{20001,0.7,{6,3,3,0.88,1},{4,2,0.15,8,4},{4,3,0.15,8,4}}},superSkill={2,{20001,0.7,{1,1.1,1}},{10721,0.7,{8,0,1,1}}},type=1},{camp=0,element=5,passivity={{6,0.25,1,0.25,1,10},{39,5,2800},{12,0.15,0.15,2},{44,0.1,4,0.05,6,2}},professionId=2,property={139,60127,60127,7669,1672,3242,4060,0,0,0,0,0.1287,1.5,0,1,1,0,0,0,0,0,0,0,0,0},quality=1,roleId=10015,skill={0,{20001,0.7,{10,0.95,2,0.3}}},superSkill={3,{20002,0.7,{33,1.4,2,1,10015,0.15,10},{16,0.04,1,10,2}}},type=1},{camp=0,element=1,passivity={{6,0.25,1,0.25,1,10},{39,5,2800},{12,0.15,0.15,2},{44,0.1,4,0.05,6,2}},professionId=1,property={140,72220,72220,3858,4378,2630,4246,0,0,0,0,0.1274,1.5,0,1,1,0,0,0,0,0,0,0,0,0},quality=1,roleId=10020,skill={0,{20001,0.7,{6,3,3,0.35,1}},{10002,0.7,{24,1,0.9}}},superSkill={5,{20000,0.7,{2,0.65,1}},{10000,0.7,{4,6,0.15,6,1}}},type=1},{camp=0,element=2,passivity={{14,0.4,2,0.3,1,10,1},{39,5,2800},{12,0.15,0.15,2},{44,0.1,4,0.05,6,2}},professionId=3,property={139,58750,58750,5175,2145,3634,3581,0,0,0,0,0.0915,1.5,0,1,1,0,0,0,0,0,0,0,0,0},quality=1,roleId=10008,skill={0,{20001,0.7,{29,4,4,0.45,2,2,0.1}}},superSkill={4,{20000,0.7,{2,0.7,2}},{20000,0.7,{3,0.15,1,8}}},type=1},teamSkill={}}}
|
||||
,{{1,1,0},{1,6,11},{1,6,21},{1,6,31},{1,6,41},{1,6,51},{1,5,0}})
|
||||
]]--
|
||||
|
||||
return BattleMain
|
|
@ -1537,7 +1537,6 @@ public class HeroLogic {
|
|||
for(Pokemon pokemon : pokemonMap.values()){
|
||||
combinePokemonAttribute(pokemonAttributeMap, pokemon,false);
|
||||
}
|
||||
int i = calForce(pokemonAttributeMap) * 5;
|
||||
|
||||
return calForce(pokemonAttributeMap)*5;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue