Changes

Add override feature.
Line 21: Line 21:  
_kekkon_max_template = "Maximum after marriage: ${value}",
 
_kekkon_max_template = "Maximum after marriage: ${value}",
 
_nick_template = " (''${nick} ${japanese_nick}'')",
 
_nick_template = " (''${nick} ${japanese_nick}'')",
 +
_overridden_category_template = "[[Category:Pages that override data modules]]",
 
_slot_template = [[|- align=center style="background-color: whitesmoke; line-height: 1.1;"
 
_slot_template = [[|- align=center style="background-color: whitesmoke; line-height: 1.1;"
 
| style="width: 36px; height: 36px; background-color: ${color};${extra_style}" | ${icon}
 
| style="width: 36px; height: 36px; background-color: ${color};${extra_style}" | ${icon}
Line 172: Line 173:  
end
 
end
   −
function ShipInfoKai:evasion(ship)
+
function ShipInfoKai:evasion(ship, override, override_max)
return Formatting:format_stat_with_max(ship:evasion(), ship:evasion_max())
+
local evasion, evasion_max
 +
local overridden = false
 +
if override and override ~= "auto" then
 +
evasion = override
 +
overridden = true
 +
else
 +
evasion = ship:evasion()
 +
end
 +
if override_max and override_max ~= "auto" then
 +
evasion_max = override_max
 +
overridden = true
 +
else
 +
evasion_max = ship:evasion_max()
 +
end
 +
local result = Formatting:format_stat_with_max(evasion, evasion_max)
 +
if overridden then
 +
result = result .. self._overridden_category_template
 +
end
 +
return result
 
end
 
end
   Line 184: Line 203:  
end
 
end
   −
function ShipInfoKai:asw(ship)
+
function ShipInfoKai:asw(ship, override, override_max)
return Formatting:format_stat_with_max(ship:asw(), ship:asw_max())
+
local asw, asw_max
 +
local overridden = false
 +
if override and override ~= "auto" then
 +
asw = override
 +
overridden = true
 +
else
 +
asw = ship:asw()
 +
end
 +
if override_max and override_max ~= "auto" then
 +
asw_max = override_max
 +
overridden = true
 +
else
 +
asw_max = ship:asw_max()
 +
end
 +
local result = Formatting:format_stat_with_max(asw, asw_max)
 +
if overridden then
 +
result = result .. self._overridden_category_template
 +
end
 +
return result
 
end
 
end
   Line 192: Line 229:  
end
 
end
   −
function ShipInfoKai:los(ship)
+
function ShipInfoKai:los(ship, override, override_max)
return Formatting:format_stat_with_max(ship:los(), ship:los_max())
+
local los, los_max
 +
local overridden = false
 +
if override and override ~= "auto" then
 +
los = override
 +
overridden = true
 +
else
 +
los = ship:los()
 +
end
 +
if override_max and override_max ~= "auto" then
 +
los_max = override_max
 +
overridden = true
 +
else
 +
los_max = ship:los_max()
 +
end
 +
local result = Formatting:format_stat_with_max(los, los_max)
 +
if overridden then
 +
result = result .. self._overridden_category_template
 +
end
 +
return result
 
end
 
end
   Line 330: Line 385:  
vars.armor = self:armor(ship)
 
vars.armor = self:armor(ship)
 
vars.torpedo = self:torpedo(ship)
 
vars.torpedo = self:torpedo(ship)
vars.evasion = self:evasion(ship)
+
vars.evasion = self:evasion(ship, args.evasion, args.evasion_max)
 
vars.aa = self:aa(ship)
 
vars.aa = self:aa(ship)
 
vars.aircraft = self:aircraft(ship)
 
vars.aircraft = self:aircraft(ship)
vars.asw = self:asw(ship)
+
vars.asw = self:asw(ship, args.asw, args.asw_max)
 
vars.speed = self:speed(ship)
 
vars.speed = self:speed(ship)
vars.los = self:los(ship)
+
vars.los = self:los(ship, args.los, args.los_max)
 
vars.range = self:range(ship)
 
vars.range = self:range(ship)
 
vars.luck = self:luck(ship)
 
vars.luck = self:luck(ship)
Anonymous user