• 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
Scaling stat tooltips for "At remodel level" and "Maximum after marriage" implemented(/ported from Module:ShipInfoKai). Updated to include ASW modding.
Line 1: Line 1:  
local U = require("Module:Core")
 
local U = require("Module:Core")
 +
local DataCaps = require("Module:Data/Caps")
    
-- Some formatting
 
-- Some formatting
Line 29: Line 30:  
local function getMarriedHp(hp, maxHp)
 
local function getMarriedHp(hp, maxHp)
 
   return math.min(maxHp, hp + ({4, 4, 4, 5, 6, 7, 7, 8, 8, 9})[math.floor(hp / 10) + 1])
 
   return math.min(maxHp, hp + ({4, 4, 4, 5, 6, 7, 7, 8, 8, 9})[math.floor(hp / 10) + 1])
 +
end
 +
local function getScaledStat(baseStat, maxStat, level)
 +
  return math.floor((maxStat-baseStat) /99 * level + baseStat)
 
end
 
end
   Line 44: Line 48:  
     '<td colspan="3" class="double-image" style="width:240px;height:60px">' .. BannerImg .. BannerDmgImg .. "</td>"
 
     '<td colspan="3" class="double-image" style="width:240px;height:60px">' .. BannerImg .. BannerDmgImg .. "</td>"
 
   local sortNoText = ship.no and (ship.no < 1000 and ship.no or formatTooltip(ship.id, ship.no)) or ship.id
 
   local sortNoText = ship.no and (ship.no < 1000 and ship.no or formatTooltip(ship.id, ship.no)) or ship.id
 +
  local MarriedMaxTemplate = "Maximum after marriage: ${value}"
 +
  local ASWModMaxTemplate = "${value} with ASW modernization"
 +
  local ASWMarriedMaxTemplate = "Maximum after marriage: ${value} (${valueM})"
 +
  local RemodelLevelStatValueText = "At remodel level: ${value}"
 
   local row1 = "<tr>" .. Cards .. '<th style="text-align: center;">' .. sortNoText .. "</th>" .. Banners .. "</tr>"
 
   local row1 = "<tr>" .. Cards .. '<th style="text-align: center;">' .. sortNoText .. "</th>" .. Banners .. "</tr>"
 
   -- Formatting Japanese
 
   -- Formatting Japanese
Line 152: Line 160:  
   local row6 = "<tr>" .. Armorinfo .. Torpedoinfo .. "</tr>"
 
   local row6 = "<tr>" .. Armorinfo .. Torpedoinfo .. "</tr>"
 
   -- Evasion & AA
 
   -- Evasion & AA
   local Evasioninfo =
+
   local Evasioninfo = statLabel .. "EVA [[File:IcoEvasion.png|Evasion]]</th>" .. statBox
    statLabel ..
+
  if ship["remodellv"] ~= nil and ship["remodellv"] ~= "" then
    "EVA [[File:IcoEvasion.png|Evasion]]</th>" .. statBox .. ship["evasion"][1] .. "→" .. ship["evasion"][2] .. "</td>"
+
    Evasioninfo = Evasioninfo .. formatTooltip(ship["evasion"][1], U.format{RemodelLevelStatValueText, value = getScaledStat(ship["evasion"][1], ship["evasion"][2], ship["remodellv"])}) .. "→"
 +
  else
 +
    Evasioninfo = Evasioninfo .. ship["evasion"][1] .. "→"
 +
  end
 +
  Evasioninfo = Evasioninfo .. formatTooltip(ship["evasion"][2], U.format{MarriedMaxTemplate, value = getScaledStat(ship["evasion"][1], ship["evasion"][2], DataCaps.ship_level)}) .. "</td>"
 
   local AAinfo = statLabel .. "AA [[File:IcoAA.png|Anti-Air]]</th>" .. statBox
 
   local AAinfo = statLabel .. "AA [[File:IcoAA.png|Anti-Air]]</th>" .. statBox
 
   if ship["aa"] == 0 then
 
   if ship["aa"] == 0 then
Line 169: Line 181:  
     ASWinfo = ASWinfo .. ship["asw"]
 
     ASWinfo = ASWinfo .. ship["asw"]
 
   else
 
   else
    ASWinfo = ASWinfo .. ship["asw"][1] .. "→" .. ship["asw"][2]
+
  if ship["remodellv"] ~= nil and ship["remodellv"] ~= "" then
 +
    ASWinfo = ASWinfo .. formatTooltip(ship["asw"][1], U.format{RemodelLevelStatValueText, value = getScaledStat(ship["asw"][1], ship["asw"][2], ship["remodellv"])}) .. "→"
 +
  else
 +
    ASWinfo = ASWinfo .. ship["asw"][1] .. "→"
 +
  end
 +
  local marriedASW = getScaledStat(ship["asw"][1], ship["asw"][2], DataCaps.ship_level)
 +
  ASWinfo = ASWinfo .. formatTooltip(ship["asw"][2], U.format{ASWModMaxTemplate, value = ship["asw"][2]+9} .. ". " .. U.format{ASWMarriedMaxTemplate, value = marriedASW, valueM = marriedASW+9} )
 
   end
 
   end
 
   local row8 = "<tr>" .. Planeinfo .. ASWinfo .. "</tr>"
 
   local row8 = "<tr>" .. Planeinfo .. ASWinfo .. "</tr>"
 
   -- Speed & LOS
 
   -- Speed & LOS
 
   local Speedinfo = statLabel .. "SPD [[File:IcoSpeed.png|Speed]]</th>" .. statBox .. ship["spd"] .. "</td>"
 
   local Speedinfo = statLabel .. "SPD [[File:IcoSpeed.png|Speed]]</th>" .. statBox .. ship["spd"] .. "</td>"
   local LOSinfo =
+
   local LOSinfo = statLabel .. "LOS [[File:IcoLOS.png|Line of Sight]]</th>" .. statBox
    statLabel ..
+
  if ship["remodellv"] ~= nil and ship["remodellv"] ~= "" then
    "LOS [[File:IcoLOS.png|Line of Sight]]</th>" .. statBox .. ship["los"][1] .. "→" .. ship["los"][2] .. "</td>"
+
    LOSinfo = LOSinfo .. formatTooltip(ship["los"][1], U.format{RemodelLevelStatValueText, value = getScaledStat(ship["los"][1], ship["los"][2], ship["remodellv"])}) .. "→"
 +
  else
 +
    LOSinfo = LOSinfo .. ship["los"][1] .. "→"
 +
  end
 +
  LOSinfo = LOSinfo .. formatTooltip(ship["los"][2], U.format{MarriedMaxTemplate, value = getScaledStat(ship["los"][1], ship["los"][2], DataCaps.ship_level)}) .. "</td>"
 
   local row9 = "<tr>" .. Speedinfo .. LOSinfo .. "</tr>"
 
   local row9 = "<tr>" .. Speedinfo .. LOSinfo .. "</tr>"
 
   -- Range & Luck
 
   -- Range & Luck
advmod, cssedit, Interface administrators, janitor, Moderators, prechecked, Widget editors
7,932

edits

Navigation menu