XGProyect / XG-Proyect-v3.x.x

XG Proyect is an OGame clone open-source web application framework designed for creating game clones, particularly those inspired by the popular game OGame, set in a vast and captivating space-themed universe.
https://xgproyect.org
GNU General Public License v3.0
149 stars 101 forks source link

[FIX] Battle Engine Report combat #595

Closed jonamix-ar closed 1 month ago

jonamix-ar commented 7 months ago

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;

image image