Changes

Line 7: Line 7:  
local StatIcons = require('Module:Data/Asset')
 
local StatIcons = require('Module:Data/Asset')
 
local Iterator = require('Module:Iterator')
 
local Iterator = require('Module:Iterator')
 +
local EquipInfo = require('Module:EquipmentInfoKai')
    
local format = require('Module:Core').format
 
local format = require('Module:Core').format
Line 25: Line 26:  
! style="text-align:left;" | OASW
 
! style="text-align:left;" | OASW
 
! style="text-align:left;" | Opening Torpedo
 
! style="text-align:left;" | Opening Torpedo
! style="text-align:left;" | Night Bombing]],
+
! style="text-align:left;" | Night Bombing
 +
! style="text-align:left;" | AACI]],
 
_columns = {
 
_columns = {
 
"card",
 
"card",
Line 42: Line 44:  
"otorp",
 
"otorp",
 
"nightbombing",
 
"nightbombing",
 +
"aaci",
 
},
 
},
 
_cell = [[|style="text-align:${text_align};background-color:${bg_color}"|${value}]],
 
_cell = [[|style="text-align:${text_align};background-color:${bg_color}"|${value}]],
Line 197: Line 200:  
local value = {}
 
local value = {}
 
local attack_power, opening, day, night, uncertain = capabilities:asw_attack()
 
local attack_power, opening, day, night, uncertain = capabilities:asw_attack()
table.insert(value, opening and "Yes" or "No")
+
local label = opening and "Yes" or "No"
 
 
return {value = table.concat(value, "<br/>"), bg_color = opening and "green" or self._transparent, text_align = self._start_align}
+
return {value = label, bg_color = opening and "green" or self._transparent, text_align = self._start_align}
 
end
 
end
   Line 208: Line 211:  
for i = 1, ship:slots_length() do
 
for i = 1, ship:slots_length() do
 
local equipment, size, estimation = ship:slot(i)
 
local equipment, size, estimation = ship:slot(i)
local icon, equipment_type, equipment_link
   
if equipment then
 
if equipment then
equipment_type = equipment:type()
   
if ShipCapabilities._is_active_midget_submarine(equipment) then
 
if ShipCapabilities._is_active_midget_submarine(equipment) then
 
active_midget_submarine = true
 
active_midget_submarine = true
Line 226: Line 227:  
can_otorp = true
 
can_otorp = true
 
end
 
end
table.insert(roles, can_otorp and "Yes" or "No")
+
local label = can_otorp and "Yes" or "No"
   −
return {value = table.concat(roles, ", "), bg_color = can_otorp and "green" or "self._transparent", text_align = self._start_align}
+
return {value = label, bg_color = can_otorp and "green" or "self._transparent", text_align = self._start_align}
 
end
 
end
   Line 238: Line 239:  
can_night = true
 
can_night = true
 
end
 
end
table.insert(roles, can_night and "Yes" or "No")
+
local label = can_night and "Yes" or "No"
 +
 
 +
return {value = label, bg_color = can_night and "green" or "self._transparent", text_align = self._start_align}
 +
end
 +
 
 +
function EnemyShipListKai:aaci(ship)
 +
local ha_aafd, cd_mg, other_mg, air_radar = 0, 0, 0, 0
 +
 
 +
for i = 1, ship:slots_length() do
 +
local equipment, size, estimation = ship:slot(i)
 +
local equipment_type
 +
if equipment then
 +
equipment_type = equipment:type()
 +
 +
if ShipCapabilities:_is_main_gun(equipment) or ShipCapabilities:_is_secondary_gun(equipment) then
 +
if equipment:is_aafd() then
 +
ha_aafd = ha_aafd + 1
 +
end
 +
elseif ShipCapabilities:_is_radar(equipment) then
 +
if equipment:aa() and equipment:aa() > 2 then
 +
air_radar = air_radar + 1
 +
end
 +
elseif equipment_type == 21 then --AA guns
 +
if equipment:aa() >= 9 then
 +
cd_mg = cd_mg + 1
 +
elseif equipment:aa() >= 3 then
 +
other_mg = other_mg + 1
 +
end
 +
end
 +
end
 +
end
 +
 +
local can_aaci = true
 +
local api = nil
 +
 +
if ha_aafd >= 2 and air_radar >= 1 then
 +
api = 5
 +
elseif ha_aafd >= 1 and air_radar >= 1 then
 +
api = 8
 +
elseif cd_mg >= 1 and other_mg >= 1 and air_radar >= 1 then
 +
api = 12
 +
else
 +
can_aaci = false
 +
end
 +
local label = can_aaci and "API: " .. api or "No"
   −
return {value = table.concat(roles, ", "), bg_color = can_night and "green" or "self._transparent", text_align = self._start_align}
+
return {value = label, bg_color = can_aaci and "green" or self._transparent, text_align = self._start_align}
 
end
 
end
   Line 281: Line 326:  
     end
 
     end
 
      
 
      
     local result = testList('enemiesByTypeAndInstallationAndBoss', { type = '2', boss = 'no' , listBase = 'true'})
+
     local result = testList('enemiesByTypeAndInstallationAndBoss', { type = '9', boss = 'no', installation='yes'})
 +
    mw.log(EnemyShipListKai:Table(result))
 +
   
 +
    result = testList('enemiesByTypeAndInstallationAndBoss', { type = '2', boss = 'no' , listBase = 'true'})
 
mw.log(EnemyShipListKai:Table(result))
 
mw.log(EnemyShipListKai:Table(result))
 
 
953

edits