From b1f6fa8e87d8fff5ae63e9db7302b79c3599e1db Mon Sep 17 00:00:00 2001 From: The Kabal Date: Mon, 20 Sep 2021 07:58:59 -0400 Subject: [PATCH] Improvements thanks to Scrutinizer --- classes/CheckDefenses.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/classes/CheckDefenses.php b/classes/CheckDefenses.php index da1cd6d7..939446a3 100644 --- a/classes/CheckDefenses.php +++ b/classes/CheckDefenses.php @@ -35,6 +35,7 @@ public static function sectorFighters(\PDO $pdo_db, string $lang, int $sector, s 'sector_fighters', 'universal')); echo $langvars['l_sf_attacking'] . "
"; $targetfighters = $total_sec_fighters; + $playerbeams = \Tki\CalcLevels::abstractLevels($playerinfo['beams'], $tkireg); $playerenergy = $playerinfo['ship_energy']; @@ -49,13 +50,6 @@ public static function sectorFighters(\PDO $pdo_db, string $lang, int $sector, s } $playerenergy = $playerenergy - $playerbeams; - $playershields = \Tki\CalcLevels::abstractLevels($playerinfo['shields'], $tkireg); - - if ($playershields > $playerenergy) - { - $playershields = $playerenergy; - } - $playertorpnum = round(pow($tkireg->level_factor, $playerinfo['torp_launchers'])) * 2; if ($playertorpnum > $playerinfo['torps']) @@ -153,7 +147,7 @@ public static function sectorFighters(\PDO $pdo_db, string $lang, int $sector, s } } - $fighterslost = $total_sec_fighters - $targetfighters; + $fighterslost = (int) $total_sec_fighters - $targetfighters; \Tki\Fighters::destroy($pdo_db, $sector, $fighterslost); $langvars['l_sf_sendlog'] = str_replace("[player]", $playerinfo['character_name'], $langvars['l_sf_sendlog']); $langvars['l_sf_sendlog'] = str_replace("[lost]", (string) $fighterslost, $langvars['l_sf_sendlog']);