-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathzhikongjisuan.lua
40 lines (37 loc) · 1.21 KB
/
zhikongjisuan.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
--判断是不是侦察机,是的话返回对空值
function isReconnaissance(arr1)
arr2 = {5,7,10,10,0}
for j = 1, 5 do
if(arr1[j] ~= arr2[j]) then
return false
end
end
return true
end
equipmentData = require("shinkai-items")
shipData = require("shinkai-ships")
shipDataTable = shipData.shipDataTable
equipDataTable = equipmentData.equipDataTable
data = {}
for key,ship in pairs(shipDataTable) do
equipment = ship["装备"]
zhikong = 0
for i = 1, equipment["格数"] do
if(equipment["搭载"][i] ~= 0 and equipment["装备"][i] ~= -1 and isReconnaissance(equipDataTable[tostring(equipment["装备"][i])]["类型"])) then
zhikong = zhikong + math.floor( math.sqrt(equipment["搭载"][i]) *equipDataTable[tostring(equipment["装备"][i])]["对空"])
end
end
if zhikong ~= 0 then
data[tonumber(key)] = zhikong
end
end
--排序输出
local key_table = {}
for key,_ in pairs(data) do
table.insert(key_table,key)
end
table.sort(key_table)
local file=io.output("zhikongzhi.txt")
for _,key in pairs(key_table) do
io.write(" [\""..key.."\"] = " .. data[key]..",\n")
end