Skip to content

Commit

Permalink
Improvements thanks to Scrutinizer
Browse files Browse the repository at this point in the history
  • Loading branch information
thekabal committed Sep 20, 2021
1 parent c0ccd9d commit b1f6fa8
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions classes/CheckDefenses.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public static function sectorFighters(\PDO $pdo_db, string $lang, int $sector, s
'sector_fighters', 'universal'));
echo $langvars['l_sf_attacking'] . "<br>";
$targetfighters = $total_sec_fighters;

$playerbeams = \Tki\CalcLevels::abstractLevels($playerinfo['beams'], $tkireg);
$playerenergy = $playerinfo['ship_energy'];

Expand All @@ -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'])
Expand Down Expand Up @@ -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']);
Expand Down

0 comments on commit b1f6fa8

Please sign in to comment.