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

Module:Sandbox/Combat

From Kancolle Wiki
Revision as of 11:16, 20 October 2015 by がか (talk | contribs) (Created page with " local format = require('Module:StringInterpolation').format local Ship = require('Module:Ship') local Formatting = require('Module:Formatting') local Combat = {} -- * Damag...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Documentation for this module may be created at Module:Sandbox/Combat/doc

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 = [[{| class="wikitable sortable typography-xl-optout" style="width:100%;"
!Rank
!Name
!FP
!Torp
!FP + Torp
!DB Attack
!DB Torp
!NB DA
!NB CI
!Luck - Cap
!NB CI%
!Notes
${rows}|}]],

	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