Skip to content

Commit

Permalink
GH-131 Use calculateShieldsTakeDownStats for rapid fire pre-calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
mdziekon committed Nov 23, 2020
1 parent a5d00b4 commit 11eb961
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions includes/CombatEngineAres.php
Original file line number Diff line number Diff line change
Expand Up @@ -468,14 +468,14 @@ function Combat($Attacker, $Defender, $AttackerTech, $DefenderTech, $UseRapidFir
$ThisKey = "{$TShip}|{$Owner}";
$CalcCount = ($DefShipsTypesCount[$TShip][$Owner] - (isset($AlreadyDestroyedDef[$ThisKey]) ? $AlreadyDestroyedDef[$ThisKey] : 0));

if(isset($DefShields[$ThisKey]['left']) && $DefShields[$ThisKey]['left'] === true)
{
$Force2TDShield = $DefShields[$ThisKey]['shield'];
}
else
{
$Force2TDShield = $DefShipsShield[$ThisKey] * $CalcCount;
}
$Force2TDShield = Ares\Calculations\calculateShieldsTakeDownStats([
'shotForce' => 0,
'targetFullKey' => $ThisKey,
'targetShipShield' => $DefShipsShield[$ThisKey],
'targetShipCount' => $CalcCount,
'roundShieldStateCacheByTargetKey' => $DefShields,
])['forceNeeded'];

$RapidForce4Shield[$Owner] = $Force2TDShield;
$RapidForce4Hull[$Owner] = $CalcCount * $DefShipsHull[$ThisKey];
if(isset($DefHullDmg[$ThisKey]))
Expand Down Expand Up @@ -942,14 +942,14 @@ function Combat($Attacker, $Defender, $AttackerTech, $DefenderTech, $UseRapidFir
$ThisKey = "{$TShip}|{$Owner}";
$CalcCount = ($AtkShipsTypesCount[$TShip][$Owner] - (isset($AlreadyDestroyedAtk[$ThisKey]) ? $AlreadyDestroyedAtk[$ThisKey] : 0));

if(isset($AtkShields[$ThisKey]['left']) && $AtkShields[$ThisKey]['left'] === true)
{
$Force2TDShield = $AtkShields[$ThisKey]['shield'];
}
else
{
$Force2TDShield = $AtkShipsShield[$ThisKey] * $CalcCount;
}
$Force2TDShield = Ares\Calculations\calculateShieldsTakeDownStats([
'shotForce' => 0,
'targetFullKey' => $ThisKey,
'targetShipShield' => $AtkShipsShield[$ThisKey],
'targetShipCount' => $CalcCount,
'roundShieldStateCacheByTargetKey' => $AtkShields,
])['forceNeeded'];

$RapidForce4Shield[$Owner] = $Force2TDShield;
$RapidForce4Hull[$Owner] = $CalcCount * $AtkShipsHull[$ThisKey];
if(isset($AtkHullDmg[$ThisKey]))
Expand Down

0 comments on commit 11eb961

Please sign in to comment.