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

Difference between revisions of "Module:Sandbox/Combat"

From Kancolle Wiki
Jump to navigation Jump to search
m
m
Line 40: Line 40:
 
table_dd_row = [[|-
 
table_dd_row = [[|-
 
|${rank}
 
|${rank}
|${name}
+
|\[\[${name}\]\]
 
|${fp}
 
|${fp}
 
|${torp}
 
|${torp}
Line 62: Line 62:
  
 
local rank = frame.args[1]
 
local rank = frame.args[1]
local ship = frame.args[2]
+
local ship_key = frame.args[2]
local name = ship and string.match(ship, "([^/]+)")
+
local name, suffix = Ship:process_ship_key(ship_key)
local ship_table = ship and Ship:get_table(ship, "")
+
local ship_table = Ship:get_table(name, suffix)
  
if rank and ship and name and ship_table and ship_table._type then
+
if rank and name and ship_table and ship_table._type then
 
return format{
 
return format{
 
table_templates.table_dd_row,
 
table_templates.table_dd_row,
Line 88: Line 88:
  
 
function Combat.table_cl(frame)
 
function Combat.table_cl(frame)
    return Combat.table_dd(frame)
+
return Combat.table_dd(frame)
 
end
 
end
  
 
function Combat.table_cl_row(frame)
 
function Combat.table_cl_row(frame)
    return Combat.table_dd_row(frame)
+
return Combat.table_dd_row(frame)
 
end
 
end
  
 
return Combat
 
return Combat

Revision as of 11:25, 20 October 2015

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}
|${notes}
]]

}

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_key = frame.args[2]
	local name, suffix = Ship:process_ship_key(ship_key)
	local ship_table = Ship:get_table(name, suffix)

	if rank 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 = "",
			notes = ""
		}
	else
		return ""
	end

end

function Combat.table_cl(frame)
	return Combat.table_dd(frame)
end

function Combat.table_cl_row(frame)
	return Combat.table_dd_row(frame)
end

return Combat