Skip to content

Commit

Permalink
Debris calculator fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
byazrail committed May 24, 2020
1 parent a10803e commit c04e0a1
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions core/BattleReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,49 +239,53 @@ public function getMoonProb()
}
public function getAttackerDebris()
{
$metal = 0;
$crystal = 0;
$sendMetal = 0;
$sendCrystal = 0;
foreach ($this->getAttackersLostUnits(!REPAIRED_DO_DEBRIS) as $idPlayer => $player)
{
foreach ($player as $idFleet => $fleet)
{
foreach($fleet as $role => $values)
{
$metal = 0;
$crystal = 0;
foreach ($values as $idShipType => $lost)
{
$metal += $lost[0];
$crystal += $lost[1];
}
$factor = constant(strtoupper($role).'_DEBRIS_FACTOR');
$metal *= $factor;
$crystal *= $factor;
$sendMetal *= $metal * $factor;
$sendCrystal *= $crystal * $factor;
}
}
}
return array($metal, $crystal);
return array($sendMetal, $sendCrystal);
}
public function getDefenderDebris()
{
$metal = 0;
$crystal = 0;
$sendMetal = 0;
$sendCrystal = 0;
foreach ($this->getDefendersLostUnits(!REPAIRED_DO_DEBRIS) as $idPlayer => $player)
{
foreach ($player as $idFleet => $fleet)
{
foreach($fleet as $role => $values)
{
$metal = 0;
$crystal = 0;
foreach ($values as $idShipType => $lost)
{
$metal += $lost[0];
$crystal += $lost[1];
}
$factor = constant(strtoupper($role).'_DEBRIS_FACTOR');
$metal *= $factor;
$crystal *= $factor;
$sendMetal *= $metal * $factor;
$sendCrystal *= $crystal * $factor;
}
}
}
return array($metal, $crystal);
return array($sendMetal, $sendCrystal);
}
public function getDebris()
{
Expand Down

0 comments on commit c04e0a1

Please sign in to comment.