| Line 1: |
Line 1: |
| | local U = require("Module:Core") | | local U = require("Module:Core") |
| − | local format = U.format | + | local format = require("Module:Core").format |
| | local Formatting = require("Module:Formatting") | | local Formatting = require("Module:Formatting") |
| | local Equipment = require("Module:Equipment") | | local Equipment = require("Module:Equipment") |
| Line 8: |
Line 8: |
| | local ShipCardKai = require("Module:ShipCardKai") | | local ShipCardKai = require("Module:ShipCardKai") |
| | local ShipBattleCardKai = require("Module:ShipBattleCardKai") | | local ShipBattleCardKai = require("Module:ShipBattleCardKai") |
| − | local Combat2 = require("Module:Combat2") | + | local Combat = require("Module:CalcCombat") |
| | local EquipmentCardKai = require("Module:EquipmentCardKai") | | local EquipmentCardKai = require("Module:EquipmentCardKai") |
| | local EquipmentGraphicKai = require("Module:EquipmentGraphicKai") | | local EquipmentGraphicKai = require("Module:EquipmentGraphicKai") |
| Line 97: |
Line 97: |
| | air_power = function(ship) | | air_power = function(ship) |
| | return ship:air_power() or -1 | | return ship:air_power() or -1 |
| | + | end, |
| | + | |
| | + | equipment_range = function(ship) |
| | + | return U.imax(U.imap(ship._equipment or {}, function (e) return Equipment(e.equipment):range() or 0 end), 0) |
| | + | end, |
| | + | |
| | + | equipment_range_diff = function(ship) |
| | + | local equipment_range = U.imax(U.imap(ship._equipment or {}, function (e) return Equipment(e.equipment):range() or 0 end), 0) |
| | + | return (ship:range() or 0) - equipment_range |
| | end, | | end, |
| | | | |
| Line 207: |
Line 216: |
| | | | |
| | banner = function(obj) | | banner = function(obj) |
| | + | if not obj or not obj.lua_name then |
| | + | return ' ' |
| | + | end |
| | return ShipBattleCardKai:Asset({ obj:lua_name(), hd = true, size = "160px" }) | | return ShipBattleCardKai:Asset({ obj:lua_name(), hd = true, size = "160px" }) |
| | end, | | end, |
| | | | |
| | card = function(obj) | | card = function(obj) |
| | + | if not obj or not obj.lua_name then |
| | + | return ' ' |
| | + | end |
| | if obj.hp then | | if obj.hp then |
| | return ShipCardKai:Asset({ obj:lua_name(), hd = true, size = "160px" }) | | return ShipCardKai:Asset({ obj:lua_name(), hd = true, size = "160px" }) |
| Line 241: |
Line 256: |
| | | | |
| | hit_rate = function(ship, target) | | hit_rate = function(ship, target) |
| − | local r = Combat2.hit_rate(ship, target) | + | local r = Combat.hit_rate(ship, target) |
| | if r then | | if r then |
| | ship.hit_rate = r | | ship.hit_rate = r |
| Line 251: |
Line 266: |
| | | | |
| | critical_hit_rate = function(ship, target) | | critical_hit_rate = function(ship, target) |
| − | local r = Combat2.critical_hit_rate(ship, target) | + | local r = Combat.critical_hit_rate(ship, target) |
| | if r then | | if r then |
| | ship.critical_hit_rate = r | | ship.critical_hit_rate = r |
| Line 303: |
Line 318: |
| | end | | end |
| | | | |
| − | local Plugins = require("Module:Calc/Plugins")
| + | addFormattingFunctions("FitData", require("Module:CalcFit")) |
| − | | + | addFormattingFunctions("Assets", require("Module:CalcAsset")) |
| − | for _, name in ipairs(Plugins) do
| |
| − | local data = require("Module:Calc/Plugins/" .. name)
| |
| − | addFormattingFunctions(name, data)
| |
| − | end
| |
| | | | |
| | function format_value(key, ship, target) | | function format_value(key, ship, target) |