Line 1: |
Line 1: |
− | local format = require("Module:Utils").format | + | local format = require("Module:Core").format |
| local BaseData = require("Module:BaseData") | | local BaseData = require("Module:BaseData") |
| local Formatting = require("Module:Formatting") | | local Formatting = require("Module:Formatting") |
Line 29: |
Line 29: |
| [7] = "Cut-in: Torpedo", | | [7] = "Cut-in: Torpedo", |
| [8] = "Bombing", | | [8] = "Bombing", |
| + | [9] = "Cut-in: Carrier", |
| }, | | }, |
| _night_battle_attack_counts = { | | _night_battle_attack_counts = { |
Line 195: |
Line 196: |
| or equipment_type == 8 | | or equipment_type == 8 |
| or equipment_type == 11 | | or equipment_type == 11 |
| + | or equipment_type == 47 |
| end | | end |
| | | |
Line 227: |
Line 229: |
| end | | end |
| | | |
− | -- small main guns', recon sea planes' and radars' asw is invalid | + | -- only following equipments' asw value are counted for attack |
− | function ShipCapabilities:_is_unable_asw_equip(equipment) | + | function ShipCapabilities:_is_damaging_asw_equip(equipment) |
| local equipment_type = equipment:type() | | local equipment_type = equipment:type() |
− | return equipment_type == 1 | + | return equipment_type == 7 |
− | or equipment_type == 10 | + | or equipment_type == 8 |
− | or equipment_type == 12 | + | or equipment_type == 11 |
− | or equipment_type == 13 | + | or equipment_type == 14 |
− | or equipment_type == 93 | + | or equipment_type == 15 |
| + | or equipment_type == 25 |
| + | or equipment_type == 26 |
| + | or equipment_type == 40 |
| end | | end |
| | | |
Line 256: |
Line 261: |
| function Self._is_active_midget_submarine(equipment) | | function Self._is_active_midget_submarine(equipment) |
| return equipment:id() == 41 or equipment:id() == 541 | | return equipment:id() == 41 or equipment:id() == 541 |
| + | end |
| + | |
| + | function ShipCapabilities:_is_night_aviation_personnel(equipment) |
| + | return equipment:id() == 258 |
| + | or equipment:id() == 259 |
| + | or equipment:id() == 608 |
| end | | end |
| | | |
Line 289: |
Line 300: |
| if ship_name:match("Lycoris Princess") or ship_name:match("Abyssal Jellyfish Princess") then | | if ship_name:match("Lycoris Princess") or ship_name:match("Abyssal Jellyfish Princess") then |
| return 1 | | return 1 |
| + | elseif ship:id() == 1964 then |
| + | return 9 |
| else | | else |
| return 8 | | return 8 |
Line 313: |
Line 326: |
| return nil | | return nil |
| end | | end |
| + | --[[ |
| + | local has_bomber_planes = false |
| + | for i = 1, self._ship:slots_length() do |
| + | local equipment, size = self._ship:slot(i) |
| + | if equipment and self:_is_bomber(equipment) and size and size > 0 then |
| + | has_bomber_planes = true |
| + | break |
| + | end |
| + | end |
| + | ]]-- |
| local is_installation_bbv = self._ship:speed() == 0 and self._ship:type() == 10 | | local is_installation_bbv = self._ship:speed() == 0 and self._ship:type() == 10 |
| if not self:_is_carrier() and not is_installation_bbv then | | if not self:_is_carrier() and not is_installation_bbv then |
Line 497: |
Line 520: |
| -- Or basic attack power for night battle attack, including night special attack, anti-installation and contact modifiers. | | -- Or basic attack power for night battle attack, including night special attack, anti-installation and contact modifiers. |
| function ShipCapabilities:night_battle(vs_installation, contact) | | function ShipCapabilities:night_battle(vs_installation, contact) |
− | local main_guns, secondary_guns, torpedoes, has_planes, firepower, torpedo = 0, 0, 0, false, self._ship:firepower_leveled(), self._ship:torpedo_leveled() | + | local main_guns, secondary_guns, torpedoes, has_planes, has_night_aviation_personnel, firepower, torpedo = 0, 0, 0, false, self._ship:night_aviation_personnel(), self._ship:firepower_leveled(), self._ship:torpedo_leveled() |
| if not firepower or not torpedo then | | if not firepower or not torpedo then |
| return nil | | return nil |
Line 521: |
Line 544: |
| equipment_torpedo = 0 | | equipment_torpedo = 0 |
| end | | end |
| + | elseif self:_is_night_aviation_personnel(equipment) then |
| + | has_night_aviation_personnel = true |
| end | | end |
| if equipment_firepower then | | if equipment_firepower then |
Line 563: |
Line 588: |
| elseif main_guns + secondary_guns >= 2 and firepower > 0 then | | elseif main_guns + secondary_guns >= 2 and firepower > 0 then |
| return 3, ((firepower + torpedo) * anti_installation_modifier + anti_installation_bonus) * 1.2 | | return 3, ((firepower + torpedo) * anti_installation_modifier + anti_installation_bonus) * 1.2 |
| + | -- WIP: just a hack for enemy CVs, no plane checked, only NF + NTB (120%) supported |
| + | elseif self:_is_carrier(self._ship) and has_night_aviation_personnel then |
| + | return 9, ((firepower + torpedo) * anti_installation_modifier + anti_installation_bonus) * 1.2 |
| -- Single Attack, Single Torpedo and Bombing are actually same | | -- Single Attack, Single Torpedo and Bombing are actually same |
| else | | else |
Line 595: |
Line 623: |
| local is_player_submarine = not is_enemy and self:_is_submarine() | | local is_player_submarine = not is_enemy and self:_is_submarine() |
| if | | if |
| + | self._ship:opening_torpedo() == true or |
| not is_enemy_submarine and self:_find_equipment(Self._is_active_midget_submarine) or | | not is_enemy_submarine and self:_find_equipment(Self._is_active_midget_submarine) or |
| is_player_submarine and self._ship:level() and self._ship:level() >= 10 or | | is_player_submarine and self._ship:level() and self._ship:level() >= 10 or |
Line 642: |
Line 671: |
| end | | end |
| -- some equipments' asw value is invalid | | -- some equipments' asw value is invalid |
− | if not self:_is_unable_asw_equip(equipment) then | + | if self:_is_damaging_asw_equip(equipment) then |
| equipment_asw = equipment_asw + (equipment:asw_leveled() or 0) | | equipment_asw = equipment_asw + (equipment:asw_leveled() or 0) |
| end | | end |
Line 684: |
Line 713: |
| -- Basic attack power for opening airstrike (returns an array with attack values per each bomber). | | -- Basic attack power for opening airstrike (returns an array with attack values per each bomber). |
| function ShipCapabilities:opening_airstrike() | | function ShipCapabilities:opening_airstrike() |
− | if not self:_is_aviation_ship() then
| |
− | return false
| |
− | end
| |
| local airstrikes = {} | | local airstrikes = {} |
| for i = 1, self._ship:slots_length() or 0 do | | for i = 1, self._ship:slots_length() or 0 do |