Skip to content

Commit

Permalink
Fix an error when the unit does not have a rate of fire
Browse files Browse the repository at this point in the history
  • Loading branch information
Basilisk3 authored May 12, 2024
1 parent bbef3ca commit 0517cdc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion www/res/scripts/calculations.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ function calculateDps($stdClassWeapon, $unitID, $Projectile){
// but thats pretty much a bug so not taken into account here

/// BTW - SpookyDB uses round(), not floor(), based on the values seen there. Values will not match between DBs. floor() is the correct method.
$trueReload = max(0.1*floor(10 / $weapon["RateOfFire"]), 0.1);
if(isset($weapon["RateOfFire"])) {
$trueReload = max(0.1*floor(10 / $weapon["RateOfFire"]), 0.1);
}
$trueReload = max(
($weapon["RackSalvoChargeTime"] ?? 0) + ($weapon["RackSalvoReloadTime"] ?? 0) +
($weapon["MuzzleSalvoDelay"] ?? 0)*(($weapon["MuzzleSalvoSize"] ?? 1)-1),
Expand Down

0 comments on commit 0517cdc

Please sign in to comment.