Changes

m
33 revisions imported
Line 1: Line 1:    −
local format = require('Module:StringInterpolation').format
+
local format = require('Module:Core').format
 
local Formatting = require('Module:Formatting')
 
local Formatting = require('Module:Formatting')
local StatIcons = require('Module:StatIcons')
+
local StatIcons = require('Module:Data/Asset')
 
local Ship = require('Module:Ship')
 
local Ship = require('Module:Ship')
local Combat = require('Module:Combat')
+
local Combat = require('Module:Sandbox/Combat')
    
local setups = {
 
local setups = {
Line 15: Line 15:  
},
 
},
 
torpedo = {
 
torpedo = {
{ torpedo = 15 },
+
{ torpedo = 12 },
 
{ torpedo = 12 },
 
{ torpedo = 12 },
 
{ torpedo = 12 },
 
{ torpedo = 12 },
Line 28: Line 28:  
},
 
},
 
torpedo = {
 
torpedo = {
{ torpedo = 15 },
+
{ torpedo = 12 },
 
{ torpedo = 12 },
 
{ torpedo = 12 },
 
{ torpedo = 12 },
 
{ torpedo = 12 },
Line 42: Line 42:  
},
 
},
 
torpedo = {
 
torpedo = {
{ torpedo = 15 },
+
{ torpedo = 12 },
 
{ torpedo = 12 },
 
{ torpedo = 12 },
 
{ torpedo = 12 },
 
{ torpedo = 12 },
Line 56: Line 56:  
},
 
},
 
torpedo = {
 
torpedo = {
{ torpedo = 15 },
   
{ torpedo = 12 },
 
{ torpedo = 12 },
 
{ torpedo = 12 },
 
{ torpedo = 12 },
Line 105: Line 104:  
{ firepower = 9 },
 
{ firepower = 9 },
 
},
 
},
}
+
},
 +
Ise = {
 +
spotting = Combat.modifier.spotting.double * Combat.modifier.ap.main_ap,
 +
note = "double attack",
 +
main = {
 +
{ firepower = 20 },
 +
{ firepower = 20 },
 +
{ firepower = 9 },
 +
},
 +
},
 
}
 
}
 
setups.Musashi = setups.Yamato
 
setups.Musashi = setups.Yamato
Line 113: Line 121:  
setups.Fusou = setups.Italia
 
setups.Fusou = setups.Italia
 
setups.Yamashiro = setups.Italia
 
setups.Yamashiro = setups.Italia
 +
setups.Hyuuga = setups.Ise
    
local normalized_type_code = {
 
local normalized_type_code = {
Line 146: Line 155:  
}
 
}
   −
function format_damage(ship_, damage_type_fn, night_attack, setup, equip_setup, hide_normal_damage)
+
function format_damage(ship_, damage_type_fn, night_attack, setup, equip_setup, spotting, hide_normal_damage)
 +
    if not setup then return "" end
 
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 157: Line 167:  
setup.spotting = setup.spotting or 1
 
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, setup.spotting)))
+
local equip_damage = combat:damage(damage_type_fn(combat, Combat.ship(ship_, equip, night_attack, spotting)))
 
local equip_damage_string =
 
local equip_damage_string =
 
equip_damage_pre >= combat.cap
 
equip_damage_pre >= combat.cap
Line 166: Line 176:  
and string.format("%s * 2", equip_damage_string)
 
and string.format("%s * 2", equip_damage_string)
 
or hide_normal_damage
 
or hide_normal_damage
and string.format("%s", equip_damage_string)
+
and (spotting
 +
    and string.format("%s * 2", equip_damage_string)
 +
    or 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)
 
end
 
end
Line 182: Line 194:  
!${fp}
 
!${fp}
 
!${torp}
 
!${torp}
!<span title="Hit damage: without equipment, ${db_attack_note} with maxed equipment (all other modifiers = 1, see notes)">Hit</span>
+
!<span title="Double attack damage (* 1.5 for critical hit)">DA</span>
!<span title="Torpedo salvo damage: without torpedo equipment, with maxed torpedo equipment (all other modifiers = 1, see notes)">Salvo</span>
+
!<span title="Torpedo salvo damage: without and with torpedo equipment (* 1.5 for critical hit)">Salvo</span>
 
!${fp_plus_torp}
 
!${fp_plus_torp}
!<span title="Maximal damage from double attack (each, multiple by 1.5 for critical hit)">DA</span>
+
!<span title="Maximal damage from double attack (* 1.5 for critical hit)">DA</span>
!<span title="Maximal damage from cut-in (multiple by 2, multiple by 1.5 for critical hit)">CI</span>
+
!<span title="Maximal damage from torpedo cut-in (* 1.5 for critical hit)">CI</span>
 
!${luck_minus_cap}
 
!${luck_minus_cap}
!<span title="Torpedo/mixed cut-in rate, gun cut-in rate (only luck dependent part, no bonuses)">CI%</span>
+
!<span title="Torpedo and mixed cut-in rate (only luck dependent part, no bonuses)">CI%</span>
 
!${hp}
 
!${hp}
 
!${armor}
 
!${armor}
Line 195: Line 207:     
carrier = [[{| class="wikitable sortable typography-xl-optout" style="width:100%;"
 
carrier = [[{| class="wikitable sortable typography-xl-optout" style="width:100%;"
 +
! colspan="3" |
 +
! colspan="5" |<span title="Air Power with maxed Reppuu">Air Power</span>
 +
! colspan="2" |Offence
 +
! colspan="3" |Defence
 +
|-
 
!style="width:60px;"|Rank
 
!style="width:60px;"|Rank
 
!style="width:85px;"|Name
 
!style="width:85px;"|Name
 
!${fp}
 
!${fp}
!<span title="Air Power with maxed Reppuu">Air Power</span>
+
!Mule
 +
!1st slot
 +
!2nd
 +
!3rd
 +
!4th
 
!<span title="">Aerial Hit</span>
 
!<span title="">Aerial Hit</span>
 
!<span title="">Shelling</span>
 
!<span title="">Shelling</span>
 +
!${hp}
 +
!${armor}
 +
!${evasion}
 
${rows}|}]],
 
${rows}|}]],
   Line 224: Line 248:  
|${name}
 
|${name}
 
|${fp}
 
|${fp}
|
+
|${slot_all}
|
+
|${slot1}
|
+
|${slot2}
 +
|${slot3}
 +
|${slot4}
 +
|${aerial}
 +
|${shelling}
 +
|${hp}
 +
|${armor}
 +
|${evasion_rate}
 
]],
 
]],
   Line 252: Line 283:  
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 at lvl 80, with normal and high morale (only level dependent part)")},
 
}
 
}
 
end
 
end
Line 262: Line 293:  
local note = frame.args["note"]
 
local note = frame.args["note"]
   −
local name, suffix = frame.args["ship"] or Ship:process_ship_key(ship_key)
+
local name, suffix = Ship:process_ship_key(ship_key)
local ship = frame.args["ship_table"] or Ship:get_table(name, suffix) -- Ship(ship_key){ _level = 80 }
+
local ship = 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
Line 273: Line 304:  
local setup = setups[name] or setups[type_code]
 
local setup = setups[name] or setups[type_code]
   −
return format{
+
        if type_code == "CV" then
template,
+
            local air_power = Combat.air_power(ship)
rank = rank,
+
        return format{
name = note and format{'[[${name}|<span title="${note}">${name}</span>]]<sup>?</sup>', name = name, note = note} or
+
    template,
  string.format("[[%s]]", name),
+
    rank = rank,
fp = ship._firepower_max,
+
    name = note and format{'[[${name}|<span title="${note}">${name}</span>]]<sup>?</sup>', name = name, note = note} or
torp = ship._torpedo_max or "",
+
      string.format("[[%s]]", name),
fp_plus_torp = ship._firepower_max + (ship._torpedo_max or 0),
+
    fp = ship._firepower_max,
db_attack = format_damage(ship, Combat.shelling, nil, setup, "main", true),
+
    torp = ship._torpedo_max or "",
db_torp = format_damage(ship, Combat.torpedo, nil, setup, "torpedo"),
+
    hp = ship._hp,
nb_da = format_damage(ship, Combat.night_battle, Combat.modifier.night_attack.double, setup, "main"),
+
    armor = ship._armor_max,
nb_ci = format_damage(ship, Combat.night_battle, Combat.modifier.night_attack.cut_in.torpedo, setup, "torpedo"),
+
    evasion_rate = string.format("%s%%, %s%%", Combat.evasion_rate(ship), Combat.evasion_rate(ship, true)),
luck_minus_cap = luck_diff < 0 and "−" .. -luck_diff or luck_diff,
+
                slot_all = air_power.slot_all,
nb_ci_rate = Combat.nb_cut_in_rate(ship, Combat.nb_cut_in_types.torpedo) .. '%',
+
                slot1 = air_power.slot1,
hp = ship._hp,
+
                slot2 = air_power.slot2,
armor = ship._armor_max,
+
                slot3 = air_power.slot3,
evasion_rate = Combat.evasion_rate(ship) .. "%",
+
                slot4 = air_power.slot4,
}
+
                aerial = "",
 +
                shelling = "",
 +
    }
 +
        else
 +
    return format{
 +
    template,
 +
    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._firepower_max,
 +
    torp = ship._torpedo_max or "",
 +
    fp_plus_torp = ship._firepower_max + (ship._torpedo_max or 0),
 +
    db_attack = format_damage(ship, Combat.shelling, nil, setup, "main", setup and setup.spotting, true),
 +
    db_torp = format_damage(ship, Combat.torpedo, nil, setup, "torpedo"),
 +
    nb_da = format_damage(ship, Combat.night_battle, Combat.modifier.night_attack.double, setup, "main"),
 +
    nb_ci = format_damage(ship, Combat.night_battle, Combat.modifier.night_attack.cut_in.torpedo, setup, "torpedo"),
 +
    luck_minus_cap = luck_diff < 0 and "−" .. -luck_diff or luck_diff,
 +
    nb_ci_rate = Combat.nb_cut_in_rate(ship, Combat.nb_cut_in_types.torpedo) .. '%',
 +
    hp = ship._hp,
 +
    armor = ship._armor_max,
 +
    evasion_rate = string.format("%s%%, %s%%", Combat.evasion_rate(ship), Combat.evasion_rate(ship, true)),
 +
    }
 +
        end
 +
   
 
else
 
else
 
return ""
 
return ""
Bots, gkautomate
12,557

edits