Corrige le calcul des rapports d'espionnages

This commit is contained in:
Nigel Sheldon 2021-01-27 17:05:39 +01:00
parent 3191822644
commit eea4226991
2 changed files with 25 additions and 13 deletions

View File

@ -573,17 +573,17 @@ class Flotte
if (($this->start_planete->technologies[1]& 67108864) == 67108864) {
$espionnage_A = 3;
} elseif (($this->start_planete->technologies[1]& 33554432) == 33554432) {
$espionnage_A = 3;
$espionnage_A = 2;
} elseif (($this->start_planete->technologies[1]& 16777216) == 16777216) {
$espionnage_A = 3;
$espionnage_A = 1;
} else {
$espionnage_A = 0;
}
if (($this->start_planete->technologies[1]& 536870912) == 536870912) {
if (($this->end_planete->technologies[1]& 536870912) == 536870912) {
$contreespionnage_B = 3;
} elseif (($this->start_planete->technologies[1]& 268435456) == 268435456) {
} elseif (($this->end_planete->technologies[1]& 268435456) == 268435456) {
$contreespionnage_B = 2;
} elseif (($this->start_planete->technologies[1]& 134217728) == 134217728) {
} elseif (($this->end_planete->technologies[1]& 134217728) == 134217728) {
$contreespionnage_B = 1;
} else {
$contreespionnage_B = 0;
@ -592,8 +592,20 @@ class Flotte
//Création du rapport
$rapport = new Rapport(5, $this->start_planete, $this->end_planete, $this->start_time + $this->end_time);
$rapport->addInfo($this->end_planete, 0);
$rapport->addInfo($contreespionnage_B/$espionnage_A/10, 1);
$rapport->addInfo($espionnage_A+2-$contreespionnage_B+1, 2);
//Rend aléatoire le niveau affiché des bâtiments
$diff_esp = $espionnage_A - $contreespionnage_B;
//Il y a au moins 2 niveaux d'erreur (soit 1 positif et 1 négatif)
if ($diff_esp == 0) {
$diff_esp = 1;
}
$rapport->addInfo($diff_esp, 1);
//Où x est le résultat de cette formule, si x >= y, ça donne accès a plus d'informations
// si y >= 1 : ressources
// si y >= 2 : batiment
// si y >= 3 : défenses
// si y >= 4 : flottes
$rapport->addInfo($espionnage_A + 2 - $contreespionnage_B + 1, 2);
//Si le joueur a au moins le niveau 1 du contre-espionnage, on le prévient qu'il a été espionné, sinon il n'en sait rien
$rapport->addInfo($contreespionnage_B, 3);
$rapport->send();

View File

@ -91,7 +91,7 @@ class Rapport
if ($this->var[2] > 2) {
$this->rapportA .= "<table style=\"margin: auto;\"><tr><th>Niveau</th><th>B&acirc;timent</th></tr>";
foreach ($this->var[0]->batiments as $key => $batiment) {
$this->rapportA .= "<tr><td>".rand($batiment * (1 - $this->var[1]), $batiment * (1 + $this->var[1]))."</td><td>".$LANG[$this->var[0]->race]["batiments"]["noms_sing"][$key]."</td></tr>";
$this->rapportA .= "<tr><td>".rand(($batiment - $this->var[1]), ($batiment + $this->var[1]))."</td><td>".$LANG[$this->var[0]->race]["batiments"]["noms_sing"][$key]."</td></tr>";
}
$this->rapportA .= "</table><br />";
}
@ -101,20 +101,20 @@ class Rapport
}
//Flottes au sol
if ($this->var[2] > 5) {
if ($this->var[2] > 4) {
$this->rapportA .= "<table style=\"margin: auto;\"><tr><th>Nombre</th><th>Vaisseaux</th></tr>";
foreach ($this->var[0]->vaisseaux as $key => $vaisseau) {
$this->rapportA .= "<tr><td>".rand($vaisseau * (1 - $this->var[1]), $vaisseau * (1 + $this->var[1]))."</td><td>".$LANG[$this->var[0]->race]["vaisseaux"]["noms_sing"][$key]."</td></tr>";
$this->rapportA .= "<tr><td>".rand(($vaisseau - $this->var[1]), ($vaisseau + $this->var[1]))."</td><td>".$LANG[$this->var[0]->race]["vaisseaux"]["noms_sing"][$key]."</td></tr>";
}
$this->rapportA .= "</table><br />";
}
//Défenses
if ($this->var[2] > 4) {
if ($this->var[2] > 3) {
$this->rapportA .= "<table style=\"margin: auto;\"><tr><th>Nombre</th><th>Défenses</th></tr>";
foreach ($this->var[0]->terrestres as $key => $unite) {
if (!dTerrestre::type($key)) {
$this->rapportA .= "<tr><td>".rand($unite * (1 - $this->var[1]), $unite * (1 + $this->var[1]))."</td><td>".$LANG[$this->var[0]->race]["terrestre"]["noms_sing"][$key]."</td></tr>";
if (!dTerrestre::type($key, $this->var[0])) {
$this->rapportA .= "<tr><td>".rand($unite * floor(1 - $this->var[1]), $unite * ceil(1 + $this->var[1]))."</td><td>".$LANG[$this->var[0]->race]["terrestre"]["noms_sing"][$key]."</td></tr>";
}
}
$this->rapportA .= "</table><br />";