Line 6: |
Line 6: |
| local Combat = require('Module:Combat') | | local Combat = require('Module:Combat') |
| | | |
− | local equipment = { | + | local setups = { |
| DD = { | | DD = { |
| + | spotting = 1, |
| + | note = "normal attack", |
| main = { | | main = { |
− | { firepower = 3, rank = 10, k = 1 }, | + | { firepower = 3 }, |
− | { firepower = 3, rank = 10, k = 1 }, | + | { firepower = 3 }, |
| }, | | }, |
| torpedo = { | | torpedo = { |
− | -- Quint/53
| + | { torpedo = 15 }, |
− | { torpedo = 12, rank = 10, k = 1 }, | + | { torpedo = 12 }, |
− | { torpedo = 12, rank = 10, k = 1 }, | + | { torpedo = 12 }, |
− | { torpedo = 12, rank = 10, k = 1 }, | |
| }, | | }, |
| }, | | }, |
| CL = { | | CL = { |
− | -- 20.3 #3 | + | spotting = Combat.modifier.spotting.double, |
| + | note = "double attack", |
| main = { | | main = { |
− | { firepower = 10, rank = 10, k = 1 }, | + | { firepower = 10 }, |
− | { firepower = 10, rank = 10, k = 1 }, | + | { firepower = 10 }, |
| }, | | }, |
| torpedo = { | | torpedo = { |
− | { torpedo = 12, rank = 10, k = 1 }, | + | { torpedo = 15 }, |
− | { torpedo = 12, rank = 10, k = 1 }, | + | { torpedo = 12 }, |
− | { torpedo = 12, rank = 10, k = 1 }, | + | { torpedo = 12 }, |
| }, | | }, |
| }, | | }, |
| CLT = { | | CLT = { |
| + | spotting = 1, |
| + | note = "normal attack", |
| main = { | | main = { |
− | -- OTO
| + | { firepower = 10 }, |
− | { firepower = 8, rank = 10, k = 1 }, | + | { firepower = 10 }, |
− | { firepower = 8, rank = 10, k = 1 }, | |
− | -- Hyouteki
| |
| { torpedo = 12 }, | | { torpedo = 12 }, |
| }, | | }, |
| torpedo = { | | torpedo = { |
− | { torpedo = 12, rank = 10, k = 1 }, | + | { torpedo = 15 }, |
− | { torpedo = 12, rank = 10, k = 1 }, | + | { torpedo = 12 }, |
| { torpedo = 12 }, | | { torpedo = 12 }, |
| }, | | }, |
| }, | | }, |
| CA = { | | CA = { |
| + | spotting = Combat.modifier.spotting.double, |
| + | note = "double attack", |
| main = { | | main = { |
− | -- 20.3 #3
| + | { firepower = 10 }, |
− | { firepower = 10, rank = 10, k = 1 }, | + | { firepower = 10 }, |
− | { firepower = 10, rank = 10, k = 1 }, | |
− | -- FuMO
| |
| { firepower = 3 }, | | { firepower = 3 }, |
| }, | | }, |
| torpedo = { | | torpedo = { |
− | { torpedo = 12, rank = 10, k = 1 }, | + | { torpedo = 15 }, |
− | { torpedo = 12, rank = 10, k = 1 }, | + | { torpedo = 12 }, |
− | { torpedo = 12, rank = 10, k = 1 }, | + | { torpedo = 12 }, |
− | { torpedo = 12, rank = 10, k = 1 }, | + | { torpedo = 12 }, |
| }, | | }, |
| }, | | }, |
| Bismarck = { | | Bismarck = { |
| + | spotting = Combat.modifier.spotting.double * Combat.modifier.ap.main_ap, |
| + | note = "double attack", |
| + | nb_ci = Combat.modifier.night_attack.cut_in.torpedo, |
| + | nb_ci_equip = "torpedo", |
| main = { | | main = { |
− | { firepower = 17, rank = 10, k = 1.5 }, | + | { firepower = 17 }, |
− | { firepower = 17, rank = 10, k = 1.5 }, | + | { firepower = 17 }, |
− | { firepower = 8, rank = 10, k = 1 }, | + | { firepower = 9 }, |
| }, | | }, |
| torpedo = { | | torpedo = { |
− | { torpedo = 12, rank = 10, k = 1 }, | + | { firepower = 26 }, |
− | { torpedo = 12, rank = 10, k = 1 }, | + | { firepower = 26 }, |
− | { torpedo = 12, rank = 10, k = 1 }, | + | { torpedo = 15 }, |
− | { torpedo = 12, rank = 10, k = 1 }, | + | { torpedo = 12 }, |
| }, | | }, |
| }, | | }, |
| FBB = { | | FBB = { |
| + | spotting = Combat.modifier.spotting.double * Combat.modifier.ap.main_ap, |
| + | note = "double attack", |
| main = { | | main = { |
− | { firepower = 17, rank = 10, k = 1.5 }, | + | { firepower = 17 }, |
− | { firepower = 17, rank = 10, k = 1.5 }, | + | { firepower = 17 }, |
− | { firepower = 8, rank = 10, k = 1 }, | + | { firepower = 9 }, |
| }, | | }, |
− | main_ci = {
| + | }, |
− | { firepower = 17, rank = 10, k = 1.5 },
| + | Yamato = { |
− | { firepower = 17, rank = 10, k = 1.5 }, | + | spotting = Combat.modifier.spotting.double * Combat.modifier.ap.main_ap, |
− | { firepower = 17, rank = 10, k = 1.5 },
| + | note = "double attack", |
− | { firepower = 8, rank = 10, k = 1 }, | + | main = { |
| + | { firepower = 30 }, |
| + | { firepower = 30 }, |
| + | { firepower = 9 }, |
| }, | | }, |
| }, | | }, |
− | BB = { | + | Italia = { |
| + | spotting = Combat.modifier.spotting.double * Combat.modifier.ap.main_ap, |
| + | note = "double attack", |
| main = { | | main = { |
− | { firepower = 22, rank = 10, k = 1.5 }, | + | { firepower = 21 }, |
− | { firepower = 22, rank = 10, k = 1.5 }, | + | { firepower = 21 }, |
− | { firepower = 8, rank = 10, k = 1 }, | + | { firepower = 9 }, |
| }, | | }, |
− | main_ci = {
| + | } |
− | { firepower = 22, rank = 10, k = 1.5 },
| |
− | { firepower = 22, rank = 10, k = 1.5 },
| |
− | { firepower = 22, rank = 10, k = 1.5 },
| |
− | { firepower = 8, rank = 10, k = 1 },
| |
− | },
| |
− | }, | |
| } | | } |
| + | setups.Musashi = setups.Yamato |
| + | setups.Nagato = setups.Yamato |
| + | setups.Mutsu = setups.Yamato |
| + | setups.Roma = setups.Italia |
| + | setups.Fusou = setups.Italia |
| + | setups.Yamashiro = setups.Italia |
| | | |
| local normalized_type_code = { | | local normalized_type_code = { |
Line 128: |
Line 141: |
| CVB = "carrier", | | CVB = "carrier", |
| -- SS = "submarine", | | -- SS = "submarine", |
− | -- SSV = "submarine_aviation", | + | -- SSV = "submarine", |
| -- AV = "...", | | -- AV = "...", |
| -- AO = "...", | | -- AO = "...", |
| } | | } |
| | | |
− | function format_damage(ship_, type_code, damage_type_fn, equip_setup, night_attack, spotting) | + | function format_damage(ship_, damage_type_fn, night_attack, setup, equip_setup, hide_normal_damage) |
| local combat = Combat:new(night_attack) | | local combat = Combat:new(night_attack) |
| local normal_damage = combat:damage(damage_type_fn(combat, Combat.ship(ship_, {}, night_attack))) | | local normal_damage = combat:damage(damage_type_fn(combat, Combat.ship(ship_, {}, night_attack))) |
Line 140: |
Line 153: |
| and string.format('<span style="color:red;">%s</span>', normal_damage) | | and string.format('<span style="color:red;">%s</span>', normal_damage) |
| or normal_damage | | or normal_damage |
− | local equip = equipment[type_code][equip_setup] | + | local equip = setup[equip_setup] |
− | spotting = spotting or 1 | + | if not equip then return "" end |
| + | setup.spotting = setup.spotting or 1 |
| local equip_damage_pre = combat:damage(damage_type_fn(combat, Combat.ship(ship_, equip, night_attack))) | | local equip_damage_pre = combat:damage(damage_type_fn(combat, Combat.ship(ship_, equip, night_attack))) |
− | local equip_damage = combat:damage(damage_type_fn(combat, Combat.ship(ship_, equip, night_attack, spotting))) | + | local equip_damage = combat:damage(damage_type_fn(combat, Combat.ship(ship_, equip, night_attack, setup.spotting))) |
| local equip_damage_string = | | local equip_damage_string = |
| equip_damage_pre >= combat.cap | | equip_damage_pre >= combat.cap |
Line 150: |
Line 164: |
| return | | return |
| night_attack | | night_attack |
| + | and string.format("%s * 2", equip_damage_string) |
| + | or hide_normal_damage |
| and string.format("%s", equip_damage_string) | | and string.format("%s", equip_damage_string) |
| or string.format("%s, %s", normal_damage_string, equip_damage_string) | | or string.format("%s, %s", normal_damage_string, equip_damage_string) |
Line 178: |
Line 194: |
| ${rows}|}]], | | ${rows}|}]], |
| | | |
− | carrier = [[{| class="wikitable sortable typography-xl-optout" style="width:100%;"
| + | carrier = [[{| class="wikitable sortable typography-xl-optout" style="width:100%;" |
| !style="width:60px;"|Rank | | !style="width:60px;"|Rank |
| !style="width:80px;"|Name | | !style="width:80px;"|Name |
Line 204: |
Line 220: |
| ]], | | ]], |
| | | |
− | carrier_row = [[|-
| + | carrier_row = [[|- |
| |${rank} | | |${rank} |
| |${name} | | |${name} |
Line 213: |
Line 229: |
| ]], | | ]], |
| | | |
− | }
| |
− |
| |
− | local attacks = {
| |
− | DD = {
| |
− | spotting = 1,
| |
− | note = "normal attack",
| |
− | },
| |
− | CL = {
| |
− | spotting = Combat.modifier.spotting.double,
| |
− | note = "double attack",
| |
− | },
| |
− | CLT = {
| |
− | spotting = 1,
| |
− | note = "normal attack",
| |
− | },
| |
− | CA = {
| |
− | spotting = Combat.modifier.spotting.double,
| |
− | note = "double attack",
| |
− | },
| |
− | Bismarck = {
| |
− | spotting = Combat.modifier.spotting.double,
| |
− | note = "double attack",
| |
− | nb_ci = Combat.modifier.night_attack.cut_in.torpedo,
| |
− | nb_ci_equip = "torpedo",
| |
− | },
| |
− | FBB = {
| |
− | spotting = Combat.modifier.spotting.double,
| |
− | note = "double attack",
| |
− | nb_ci = Combat.modifier.night_attack.cut_in.main,
| |
− | nb_ci_equip = "main_ci",
| |
− | },
| |
− | BB = {
| |
− | spotting = Combat.modifier.spotting.double,
| |
− | note = "double attack",
| |
− | nb_ci = Combat.modifier.night_attack.cut_in.main,
| |
− | nb_ci_equip = "main_ci",
| |
− | },
| |
| } | | } |
| | | |
Line 269: |
Line 248: |
| Formatting:format_image{StatIcons.torpedo, caption = Formatting:format_stat_name("torpedo")}, | | Formatting:format_image{StatIcons.torpedo, caption = Formatting:format_stat_name("torpedo")}, |
| luck_minus_cap = | | luck_minus_cap = |
− | '<span title="Luck cap">60</span>−' ..
| + | '<span title="Luck cap">60</span>−' .. |
| Formatting:format_image{StatIcons.luck, caption = Formatting:format_stat_name("luck")}, | | Formatting:format_image{StatIcons.luck, caption = Formatting:format_stat_name("luck")}, |
− | hp = Formatting:format_image{StatIcons.hp, caption = Formatting:format_stat_name("HP")},
| + | hp = Formatting:format_image{StatIcons.hp, caption = Formatting:format_stat_name("HP")}, |
− | armor = Formatting:format_image{StatIcons.armor, caption = Formatting:format_stat_name("Armor")},
| + | armor = Formatting:format_image{StatIcons.armor, caption = Formatting:format_stat_name("Armor")}, |
− | evasion = Formatting:format_image{StatIcons.evasion, caption = Formatting:format_stat_name("Evasion rate")},
| + | evasion = Formatting:format_image{StatIcons.evasion, caption = Formatting:format_stat_name("Evasion rate")}, |
| } | | } |
| end | | end |
Line 283: |
Line 262: |
| local note = frame.args["note"] | | local note = frame.args["note"] |
| | | |
− | local name, suffix = Ship:process_ship_key(ship_key) | + | local name, suffix = frame.args["ship"] or Ship:process_ship_key(ship_key) |
− | local ship = Ship:get_table(name, suffix) | + | local ship = frame.args["ship_table"] or Ship(ship_key) -- { _level = 80 } |
| | | |
| if rank and name and ship and ship._type then | | if rank and name and ship and ship._type then |
| | | |
| local type_code_ = Formatting:format_ship_code(ship._type) | | local type_code_ = Formatting:format_ship_code(ship._type) |
− | local type_code = name == "Bismarck" and "Bismarck" or normalized_type_code[type_code_] | + | local type_code = normalized_type_code[type_code_] |
| local template = templates[type_code_to_template[type_code_] .. "_row"] | | local template = templates[type_code_to_template[type_code_] .. "_row"] |
| local luck_diff = 60 - ship._luck | | local luck_diff = 60 - ship._luck |
− | local attack = attacks[type_code]
| + | local setup = setups[name] or setups[type_code] |
− |
| + | |
| return format{ | | return format{ |
| template, | | template, |
Line 300: |
Line 279: |
| string.format("[[%s]]", name), | | string.format("[[%s]]", name), |
| fp = ship._firepower_max, | | fp = ship._firepower_max, |
− | torp = ship._torpedo_max, | + | torp = ship._torpedo_max or "", |
| fp_plus_torp = ship._firepower_max + (ship._torpedo_max or 0), | | fp_plus_torp = ship._firepower_max + (ship._torpedo_max or 0), |
− | db_attack = | + | db_attack = format_damage(ship, Combat.shelling, nil, setup, "main", true), |
− | attack
| + | db_torp = format_damage(ship, Combat.torpedo, nil, setup, "torpedo"), |
− | and format_damage(ship, type_code, Combat.shelling, "main", nil, attack.spotting)
| + | nb_da = format_damage(ship, Combat.night_battle, Combat.modifier.night_attack.double, setup, "main"), |
− | or "",
| + | nb_ci = format_damage(ship, Combat.night_battle, Combat.modifier.night_attack.cut_in.torpedo, setup, "torpedo"), |
− | db_torp = | |
− | (type_code == "BB" or type_code == "FBB" or type_code == "CV")
| |
− | and ""
| |
− | or format_damage(ship, type_code, Combat.torpedo, "torpedo"),
| |
− | nb_da = | |
− | attack
| |
− | and format_damage(ship, type_code, Combat.night_battle, "main", Combat.modifier.night_attack.double)
| |
− | or "",
| |
− | nb_ci = | |
− | attack
| |
− | and format_damage(ship, type_code, Combat.night_battle, attack.nb_ci_equip or "torpedo", attack.nb_ci or Combat.modifier.night_attack.cut_in.torpedo)
| |
− | or "",
| |
| luck_minus_cap = luck_diff < 0 and "−" .. -luck_diff or luck_diff, | | luck_minus_cap = luck_diff < 0 and "−" .. -luck_diff or luck_diff, |
− | nb_ci_rate = format{ | + | nb_ci_rate = Combat.nb_cut_in_rate(ship, Combat.nb_cut_in_types.torpedo) .. '%', |
− | [[${torpedo}%, ${main}%]],
| |
− | torpedo = Combat.nb_cut_in_rate(ship, Combat.nb_cut_in_types.torpedo),
| |
− | main = Combat.nb_cut_in_rate(ship, Combat.nb_cut_in_types.main)},
| |
| hp = ship._hp, | | hp = ship._hp, |
− | armor = ship._armor_max,
| + | armor = ship._armor_max, |
− | evasion_rate = Combat.evasion_rate(ship) .. "%",
| + | evasion_rate = Combat.evasion_rate(ship) .. "%", |
| } | | } |
| else | | else |