From 27582821340b3df5f8b5f5dfc61c661f8e7ca7db Mon Sep 17 00:00:00 2001 From: Michal Dziekonski Date: Mon, 23 Nov 2020 03:16:17 +0100 Subject: [PATCH] GH-131 Simplify code's indentation a bit --- includes/CombatEngineAres.php | 54 ++++++++++++++--------------------- 1 file changed, 22 insertions(+), 32 deletions(-) diff --git a/includes/CombatEngineAres.php b/includes/CombatEngineAres.php index 9db91ae2c..8e61eccbb 100644 --- a/includes/CombatEngineAres.php +++ b/includes/CombatEngineAres.php @@ -415,16 +415,14 @@ function Combat($Attacker, $Defender, $AttackerTech, $DefenderTech, $UseRapidFir } unset($DefShipsTypesOwners[$TShip][$TUser]); $DefShipsTypes[$TShip] -= 1; - } else { - if($Destroyed > 0) - { - if(!isset($AlreadyDestroyedDef[$TKey])) - { - $AlreadyDestroyedDef[$TKey] = 0; - } - $AlreadyDestroyedDef[$TKey] += $Destroyed; + } else if ($Destroyed > 0) { + if (!isset($AlreadyDestroyedDef[$TKey])) { + $AlreadyDestroyedDef[$TKey] = 0; } + + $AlreadyDestroyedDef[$TKey] += $Destroyed; } + $ACount_Copy -= $Shoots; } @@ -685,15 +683,12 @@ function Combat($Attacker, $Defender, $AttackerTech, $DefenderTech, $UseRapidFir } unset($DefShipsTypesOwners[$TShip][$TUser]); $DefShipsTypes[$TShip] -= 1; - } else { - if($Destroyed > 0) - { - if(!isset($AlreadyDestroyedDef[$TKey])) - { - $AlreadyDestroyedDef[$TKey] = 0; - } - $AlreadyDestroyedDef[$TKey] += $Destroyed; + } else if ($Destroyed > 0) { + if (!isset($AlreadyDestroyedDef[$TKey])) { + $AlreadyDestroyedDef[$TKey] = 0; } + + $AlreadyDestroyedDef[$TKey] += $Destroyed; } } } @@ -888,16 +883,14 @@ function Combat($Attacker, $Defender, $AttackerTech, $DefenderTech, $UseRapidFir } unset($AtkShipsTypesOwners[$TShip][$TUser]); $AtkShipsTypes[$TShip] -= 1; - } else { - if($Destroyed > 0) - { - if(!isset($AlreadyDestroyedAtk[$TKey])) - { - $AlreadyDestroyedAtk[$TKey] = 0; - } - $AlreadyDestroyedAtk[$TKey] += $Destroyed; + } else if ($Destroyed > 0) { + if (!isset($AlreadyDestroyedAtk[$TKey])) { + $AlreadyDestroyedAtk[$TKey] = 0; } + + $AlreadyDestroyedAtk[$TKey] += $Destroyed; } + $ACount_Copy -= $Shoots; } @@ -1158,15 +1151,12 @@ function Combat($Attacker, $Defender, $AttackerTech, $DefenderTech, $UseRapidFir } unset($AtkShipsTypesOwners[$TShip][$TUser]); $AtkShipsTypes[$TShip] -= 1; - } else { - if($Destroyed > 0) - { - if(!isset($AlreadyDestroyedAtk[$TKey])) - { - $AlreadyDestroyedAtk[$TKey] = 0; - } - $AlreadyDestroyedAtk[$TKey] += $Destroyed; + } else if ($Destroyed > 0) { + if (!isset($AlreadyDestroyedAtk[$TKey])) { + $AlreadyDestroyedAtk[$TKey] = 0; } + + $AlreadyDestroyedAtk[$TKey] += $Destroyed; } } }