• Welcome to the Kancolle Wiki!
  • If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord

Changes

Jump to navigation Jump to search
no edit summary
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
    
local EnemyShipListKai = BaseTable{
 
local EnemyShipListKai = BaseTable{
_header_template = [[! style="min-width: 180px;" | Card
+
_table_start = [[{| class="wikitable" style="text-align:center" ]],
! style="min-width: 75px;" | Name
+
_header_template = [[! style="min-width:180px" | Card
 +
! style="min-width:75px" | Name
 
! Type
 
! Type
! style="width: 30px; text-align: center; vertical-align: middle; background-color: pink;" | ${hp}
+
! style="width:30px;background-color:pink" | ${hp}
! style="width: 30px; text-align: center; vertical-align: middle; background-color: lightcoral;" | ${firepower}
+
! style="width:30px;background-color:lightcoral" | ${firepower}
! style="width: 30px; text-align: center; vertical-align: middle; background-color: lightskyblue;" | ${torpedo}
+
! style="width:30px;background-color:lightskyblue" | ${torpedo}
! style="width: 30px; text-align: center; vertical-align: middle; background-color: sandybrown;" | ${aa}
+
! style="width:30px;background-color:sandybrown" | ${aa}
! style="width: 30px; text-align: center; vertical-align: middle; background-color: #9C8FEE;" | ${asw}
+
! style="width:30px;background-color:#9C8FEE" | ${asw}
! style="width: 30px; text-align: center; vertical-align: middle; background-color: #F2E279;" | ${armor}
+
! style="width:30px;background-color:#F2E279" | ${armor}
! style="width: 30px; text-align: center; vertical-align: middle; background-color: violet;" | ${evasion}
+
! style="width:30px;background-color:violet" | ${evasion}
! style="text-align: center; vertical-align: middle;" | Armament
+
! Armament
! style="text-align:left;" | Notes
+
! Notes
! style="text-align:left;" | OASW
+
! OASW
! style="text-align:left;" | Opening Torpedo]],
+
! Opening Torpedo
 +
! Night Bombing
 +
! AACI]],
 
_columns = {
 
_columns = {
 
"card",
 
"card",
Line 39: Line 43:  
"notes",
 
"notes",
 
"oasw",
 
"oasw",
"otorp"
+
"otorp",
 +
"nightbombing",
 +
"aaci",
 
},
 
},
_cell = [[|style="text-align:${text_align};background-color:${bg_color}"|${value}]],
+
_cell = [[|style="background-color:${bg_color}"|${value}]],
 
_column_cell_templates = {
 
_column_cell_templates = {
-- card = [[|style="text-align:${text_align};background-color:${bg_color};background-image:${background_image}" |${value}]],
+
card = [[|style="background-color:${bg_color};background-image:${background_image}" |${value}]],
card = [[|style="text-align:${text_align}"|${value}]],
+
--card = [[|style="text-align:${text_align}"|${value}]],
 
},
 
},
 
_item_class = function(item_key) return EnemyShip(item_key) end,
 
_item_class = function(item_key) return EnemyShip(item_key) end,
Line 84: Line 90:  
return {
 
return {
 
value = value,
 
value = value,
-- bg_color = bg_color,
+
bg_color = bg_color,
-- background_image = background_image or self._none,
+
background_image = background_image or self._none,
 
text_align = self._center_align,
 
text_align = self._center_align,
 
}
 
}
Line 163: Line 169:  
         end
 
         end
 
table.insert(roles, ap_text)
 
table.insert(roles, ap_text)
end
  −
if ShipCapabilities:_is_night_bombing(ship) then
  −
table.insert(roles, self._night_bombing_label)
   
end
 
end
 
if sonar or dc then
 
if sonar or dc then
Line 198: Line 201:  
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 209: Line 212:  
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 227: Line 228:  
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 = label, bg_color = can_otorp and "green" or self._transparent, text_align = self._start_align}
 +
end
 +
 
 +
function EnemyShipListKai:nightbombing(ship)
 +
local roles = {}
 +
local can_night = false
 +
 
 +
if ShipCapabilities:_is_night_bombing(ship) then
 +
can_night = true
 +
end
 +
local label = can_night 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_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 = label, bg_color = can_aaci and "green" or self._transparent, text_align = self._start_align}
 
end
 
end
   Line 270: Line 327:  
     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))
 
 
7,212

edits

Navigation menu