Module:Combat

local format = require('Module:StringInterpolation').format local Ship = require('Module:Ship') local Formatting = require('Module:Formatting')

local Combat = {}

-- * Damage calculator. -- -- TBD -- --  http://kancollecalc.web.fc2.com/damage_formula.html --  http://kancollecalc.web.fc2.com/damage.js -- --  http://wikiwiki.jp/kancolle/?%C0%EF%C6%AE%A4%CB%A4%C4%A4%A4%A4%C6 --  http://wikiwiki.jp/kancolle/?%BB%D9%B1%E7%B4%CF%C2%E2 --

-- * CI rate formula.

-- * Tables.

local table_templates = {

table_dd = },

table_dd_row = |-
 * ${rank}
 * ${name}
 * ${fp}
 * ${torp}
 * ${fp_plus_torp}
 * ${db_attack}
 * ${db_torp}
 * ${nb_da}
 * ${nb_ci}
 * ${luck_minus_cap}
 * ${nb_ci_rate}

}

function Combat.table_dd(frame) return format{table_templates.table_dd, rows = frame.args[1] or ""} end

function Combat.table_dd_row(frame)

local rank = frame.args[1] local ship = frame.args[2] local name = ship and string.match(ship, "([^/]+)") local ship_table = ship and Ship:get_table(ship, "")

if rank and ship and name and ship_table and ship_table._type then return format{ table_templates.table_dd_row, rank = rank, name = name, fp = ship_table._firepower_max, torp = ship_table._torpedo_max, fp_plus_torp = ship_table._firepower_max + ship_table._torpedo_max, db_attack = "", db_torp = "", nb_da = "", nb_ci = "", luck_minus_cap = "", nb_ci_rate = "", }	else return "" end

end