Line 175: |
Line 175: |
| local table_templates = { | | local table_templates = { |
| | | |
− | table_dd = [[{| class="wikitable sortable typography-xl-optout" style="width:100%;" | + | dd = [[{| class="wikitable sortable typography-xl-optout" style="width:100%;" |
| ! colspan="2" | | | ! colspan="2" | |
| ! colspan="4" |Day Battle | | ! colspan="4" |Day Battle |
Line 184: |
Line 184: |
| !${fp} | | !${fp} |
| !${torp} | | !${torp} |
− | !<span title="Normal attack damage: without equipment, with 2x maxed guns; all modifiers = 1, see notes">Attack</span> | + | !<span title="Normal attack damage: without equipment, with maxed equipment; all modifiers = 1, see notes">Attack</span> |
| !<span title="Normal torpedo salvo damage, all modifiers = 1, see notes">Torpedo</span> | | !<span title="Normal torpedo salvo damage, all modifiers = 1, see notes">Torpedo</span> |
| !${fp_plus_torp} | | !${fp_plus_torp} |
Line 195: |
Line 195: |
| table_dd_row = [===[|- | | table_dd_row = [===[|- |
| |${rank} | | |${rank} |
− | |[[${name}]] | + | |${name} |
| |${fp} | | |${fp} |
| |${torp} | | |${torp} |
Line 209: |
Line 209: |
| } | | } |
| | | |
− | function Combat.table_dd(frame) | + | function Combat.table(frame) |
| + | local types = { dd = dd, cl = dd, clt = dd, ca = dd, bb = dd } |
| + | local typ = types[frame.args["type"]] |
| + | if not typ then |
| + | return "" |
| + | end |
| return format{ | | return format{ |
− | table_templates.table_dd, | + | table_templates[typ], |
| rows = frame.args[1] or "", | | rows = frame.args[1] or "", |
| fp = Formatting:format_image{StatIcons.firepower, caption = Formatting:format_stat_name("firepower")}, | | fp = Formatting:format_image{StatIcons.firepower, caption = Formatting:format_stat_name("firepower")}, |
Line 229: |
Line 234: |
| function get_db_attack_string(fp, t) | | function get_db_attack_string(fp, t) |
| local equip_fp = { | | local equip_fp = { |
− | dd = 2 * 3 + math.floor(2 * math.sqrt(10)) | + | dd = 2 * 3 + math.floor(2 * math.sqrt(10)), |
| + | cl = 2 * 10 + math.floor(2 * math.sqrt(10)), |
| + | clt = 2 * 8 + math.floor(2 * math.sqrt(10)), |
| } | | } |
| return | | return |
| damage(shelling_attack_power(fp, 0, modifiers), modifiers) | | damage(shelling_attack_power(fp, 0, modifiers), modifiers) |
| .. ", " .. | | .. ", " .. |
− | damage(shelling_attack_power(fp, equip_fp[t], modifiers), modifiers) | + | damage(shelling_attack_power(fp, equip_fp[t] or 0, modifiers), modifiers) |
| end | | end |
| | | |
Line 241: |
Line 248: |
| local rank = frame.args[1] | | local rank = frame.args[1] |
| local ship_key = frame.args[2] | | local ship_key = frame.args[2] |
| + | local typ = frame.args["type"] |
| + | local note = frame.args["note"] |
| + | |
| local name, suffix = Ship:process_ship_key(ship_key) | | local name, suffix = Ship:process_ship_key(ship_key) |
| local ship_table = Ship:get_table(name, suffix) | | local ship_table = Ship:get_table(name, suffix) |
Line 248: |
Line 258: |
| return format{ | | return format{ |
| table_templates.table_dd_row, | | table_templates.table_dd_row, |
− | rank = rank, name = name, | + | rank = rank, |
| + | name = |
| + | note and format{'[[${name}|<span title="${note}">${name}</span>]]<sup>?</sup>', name = name, note = note} or |
| + | string.format("[[%s]]", name), |
| fp = ship_table._firepower_max, | | fp = ship_table._firepower_max, |
| torp = ship_table._torpedo_max, | | torp = ship_table._torpedo_max, |
| fp_plus_torp = ship_table._firepower_max + ship_table._torpedo_max, | | fp_plus_torp = ship_table._firepower_max + ship_table._torpedo_max, |
− | db_attack = get_db_attack_string(ship_table._firepower_max, "dd"), | + | db_attack = get_db_attack_string(ship_table._firepower_max, typ), |
| db_torp = "", | | db_torp = "", |
| nb_da = "", | | nb_da = "", |
Line 267: |
Line 280: |
| end | | end |
| | | |
− | function Combat.table_cl(frame) | + | function Combat.table_cl(frame) return Combat.table_dd(frame) end |
− | return Combat.table_dd(frame)
| + | function Combat.table_cl_row(frame) return Combat.table_dd_row(frame) end |
− | end | + | function Combat.table_ca(frame) return Combat.table_dd(frame) end |
| + | function Combat.table_ca_row(frame) return Combat.table_dd_row(frame) end |
| + | function Combat.table_cav(frame) return Combat.table_dd(frame) end |
| + | function Combat.table_cav_row(frame) return Combat.table_dd_row(frame) end |
| + | function Combat.table_bb(frame) return Combat.table_dd(frame) end |
| + | function Combat.table_bb_row(frame) return Combat.table_dd_row(frame) end |
| + | function Combat.table_bbv(frame) return Combat.table_dd(frame) end |
| + | function Combat.table_bbv_row(frame) return Combat.table_dd_row(frame) end |
| | | |
− | function Combat.table_cl_row(frame)
| |
− | return Combat.table_dd_row(frame)
| |
− | end
| |
| | | |
| return Combat | | return Combat |