XG-Proyect-v3.x.x
XG-Proyect-v3.x.x copied to clipboard
[FIX] Battle Engine Report combat
Based now on the new XGP or PSR-12 file location you decide to implement this
Search BattleReport.php y BattleEngine
use App\Libraries\BattleEngine\Utils\Math;
add Below
use App\Libraries\Functions;
public function getAttackerDebris()
Replace all code for this
public function getAttackerDebris()
{
$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 = Functions::readConfig('fleet_cdr') / 100;
$sendMetal += $metal * $factor;
$sendCrystal += $crystal * $factor;
}
}
}
return [$sendMetal, $sendCrystal];
}
public function getDefenderDebris()
remplace all code for this
public function getDefenderDebris()
{
$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 = Functions::readConfig('defs_cdr') / 100;
$sendMetal += $metal * $factor;
$sendCrystal += $crystal * $factor;
}
}
}
return [$sendMetal, $sendCrystal];
}
search in BattleEngine Folder PhysicShot.php
private $shipType;
add below
private $fighters;