Changes

m
A large comment was deleted along with the edit. Partial undo of revision 141774 by Jigaraphale (talk)
Line 1: Line 1:  
{{:Combat/Battle Opening}}
 
{{:Combat/Battle Opening}}
 +
<!--
 +
function group(array) {
 +
    const groups = [];
 +
    let i = 0;
 +
    for (const element of array) {
 +
        if (!groups[i]) {
 +
            groups.push({count: 1, element: element});
 +
        } else if (element === groups[i].element) {
 +
            ++groups[i].count;
 +
        } else {
 +
            ++i;
 +
            groups.push({count: 1, element: element});
 +
        }
 +
    }
 +
    return groups;
 +
}
    +
function calc_level_for_asw(remodel_level, base, max, target) {
 +
    const level = Math.ceil(99 * (target - base) / (max - base));
 +
    return level < remodel_level ? remodel_level : level;
 +
}
 +
 +
const oasw_breakpoints = [64, 66, 68, 70, 72, 76, 78, 80, 82, 88, 90];
 +
 +
function calc_levels_for_asw(ship, remodel_level, base, max) {
 +
    return oasw_breakpoints.map((target) => calc_level_for_asw(remodel_level, base, max, target));
 +
}
 +
 +
function gen_row(ship, remodel_level, base, max) {
 +
    const format_cell = (group) => `|${group.count > 1 ? `colspan="${group.count}" ` : ""}style="background:#${group.element < 90 ? "c8e6c9" : group.element < 100 ? "ffe0b2" : group.element <= 155 ? "ffcdd2" : "cfd8dc"}"|${group.element <= 155 ? group.element : "N/A"}`
 +
    return `|-\n|{{Ship/Link|${ship}}}\n${group(calc_levels_for_asw(ship, remodel_level, base, max)).map(format_cell).join("\n")}`;
 +
}
 +
 +
// e.g.
 +
// gen_row("Asashio Kai Ni D", 85, 45, 89);
 +
-->
 
===OASW Level Table===
 
===OASW Level Table===
 
The following tables show how much base ASW is needed (in form of required ship level) to enable OASW with a given equipment setup (T4: [[Type 4 Passive Sonar]], T3: [[Type 3 Active Sonar]], DC: [[Type 3 Depth Charge Projector]] ASWR: [[Prototype 15cm 9-tube ASW Rocket Launcher]]).
 
The following tables show how much base ASW is needed (in form of required ship level) to enable OASW with a given equipment setup (T4: [[Type 4 Passive Sonar]], T3: [[Type 3 Active Sonar]], DC: [[Type 3 Depth Charge Projector]] ASWR: [[Prototype 15cm 9-tube ASW Rocket Launcher]]).
advmod, cssedit, Interface administrators, janitor, Moderators, prechecked, Widget editors
7,373

edits