@@ -15,7 +15,7 @@ |
||
| 15 | 15 | |
| 16 | 16 | //-------------------------- GETTER ----------------------------------------------------------------------------// |
| 17 | 17 | public function getBatiments(){ |
| 18 | - return $this->batiments; |
|
| 18 | + return $this->batiments; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | /** |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | |
| 15 | 15 | |
| 16 | 16 | //-------------------------- GETTER ----------------------------------------------------------------------------// |
| 17 | - public function getBatiments(){ |
|
| 17 | + public function getBatiments() { |
|
| 18 | 18 | return $this->batiments; |
| 19 | 19 | } |
| 20 | 20 | |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | |
| 15 | 15 | |
| 16 | 16 | //-------------------------- GETTER ----------------------------------------------------------------------------// |
| 17 | - public function getBatiments(){ |
|
| 17 | + public function getBatiments() { |
|
| 18 | 18 | return $this->batiments; |
| 19 | 19 | } |
| 20 | 20 | |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | return $this->ressource_construire; |
| 47 | 47 | } |
| 48 | 48 | public function getInfoBatiment(){ |
| 49 | - return $this->info_batiment; |
|
| 49 | + return $this->info_batiment; |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | public function getNomBatimentConstruction() { |
@@ -3,7 +3,6 @@ |
||
| 3 | 3 | use core\App; |
| 4 | 4 | use core\functions\ChaineCaractere; |
| 5 | 5 | use core\HTML\flashmessage\FlashMessage; |
| 6 | - use Nette\Utils\DateTime; |
|
| 7 | 6 | |
| 8 | 7 | class Batiment { |
| 9 | 8 | //pour quand on recup un batiment |
@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | * @param $case_depart |
| 401 | 401 | * @param $nom_batiment |
| 402 | 402 | * @param $nom_batiment_sql |
| 403 | - * @return bool |
|
| 403 | + * @return false|null |
|
| 404 | 404 | * fonction qui test si un il y a la place de construire un batiment en fonction de sa case ou il a été laché en x et y |
| 405 | 405 | * et en fonction de sa taille et du positionnement des autres batiments |
| 406 | 406 | */ |
@@ -482,7 +482,7 @@ discard block |
||
| 482 | 482 | |
| 483 | 483 | /** |
| 484 | 484 | * @param $nom_batiment_sql |
| 485 | - * @param $niveau |
|
| 485 | + * @param integer $niveau |
|
| 486 | 486 | * @return array |
| 487 | 487 | * recuperation des ressources nécéssaire pour construire le batiment |
| 488 | 488 | */ |
@@ -47,10 +47,10 @@ discard block |
||
| 47 | 47 | public function getRessourceConstruire() { |
| 48 | 48 | return $this->ressource_construire; |
| 49 | 49 | } |
| 50 | - public function getInfoBatiment(){ |
|
| 50 | + public function getInfoBatiment() { |
|
| 51 | 51 | return $this->info_batiment; |
| 52 | 52 | } |
| 53 | - public function getInfoBatimentNext(){ |
|
| 53 | + public function getInfoBatimentNext() { |
|
| 54 | 54 | return $this->info_batiment_next; |
| 55 | 55 | } |
| 56 | 56 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | if ($niveau > 0) { |
| 149 | 149 | $query = $dbc1->select("stockage")->from("entrepot")->where("ID_entrepot", "=", $niveau)->get(); |
| 150 | 150 | |
| 151 | - if ((is_array($query)) && (count($query) > 0)){ |
|
| 151 | + if ((is_array($query)) && (count($query) > 0)) { |
|
| 152 | 152 | foreach ($query as $obj) { |
| 153 | 153 | return $obj->stockage; |
| 154 | 154 | } |
@@ -184,10 +184,10 @@ discard block |
||
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | if (($construction[1] == true) && ($this->niveau_batiment > 1)) { |
| 187 | - $this->niveau_batiment = $this->niveau_batiment + 1; |
|
| 187 | + $this->niveau_batiment = $this->niveau_batiment+1; |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | - $max_level = $this->getInfoUpgradeBatiment(); |
|
| 190 | + $max_level = $this->getInfoUpgradeBatiment(); |
|
| 191 | 191 | } |
| 192 | 192 | else { |
| 193 | 193 | $query = $dbc1->select("nom_table") |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | //et compare la liste des batiments qu'il faut pour construire le batiment |
| 307 | 307 | //a ceux qui sont deja construit dans la base |
| 308 | 308 | //si tous les batments qu'il faut son batis on autorise la construction du batiment |
| 309 | - for ($i=0 ; $i<$c_all_batiment ; $i++) { |
|
| 309 | + for ($i = 0; $i < $c_all_batiment; $i++) { |
|
| 310 | 310 | if (!in_array($all_batiment[$i], $batiment_construit)) { |
| 311 | 311 | $query = $dbc1->select("pour_construire") |
| 312 | 312 | ->select("temps_construction") |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | else if (count($pour_construire) > 1) { |
| 349 | 349 | $ok_construction = false; |
| 350 | 350 | //test si tous les batiments sont construits et on le niveau nécéssaire |
| 351 | - for ($j=0 ; $j<count($pour_construire) ; $j++) { |
|
| 351 | + for ($j = 0; $j < count($pour_construire); $j++) { |
|
| 352 | 352 | if (in_array($pour_construire[$j][1], $batiment_construit)) { |
| 353 | 353 | if ($pour_construire[$j][2] <= $this->getNiveauBatiment($pour_construire[$j][1])) { |
| 354 | 354 | $ok_construction = true; |
@@ -435,8 +435,8 @@ discard block |
||
| 435 | 435 | $finx_batiment = $taille_batiment[0]+$posx_batiment; |
| 436 | 436 | $finy_batiment = $taille_batiment[1]+$posy_batiment; |
| 437 | 437 | |
| 438 | - for ($i=$posy ; $i<$finy ; $i++) { |
|
| 439 | - for ($j=$posx ; $j<$finx ; $j++) { |
|
| 438 | + for ($i = $posy; $i < $finy; $i++) { |
|
| 439 | + for ($j = $posx; $j < $finx; $j++) { |
|
| 440 | 440 | if ((($posx++ >= $posx_batiment) && ($posx++ <= $finx_batiment)) && (($posy++ >= $posy_batiment) && ($posy++ <= $finy_batiment))) { |
| 441 | 441 | FlashMessage::setFlash("Un batiment est déjà présent à cet emplacement, merci d'en choisir un autre"); |
| 442 | 442 | return false; |
@@ -554,7 +554,7 @@ discard block |
||
| 554 | 554 | ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment) |
| 555 | 555 | ->get(); |
| 556 | 556 | |
| 557 | - if ((is_array($query)) && (count($query) > 0)){ |
|
| 557 | + if ((is_array($query)) && (count($query) > 0)) { |
|
| 558 | 558 | foreach ($query as $obj) { |
| 559 | 559 | $this->info_batiment = $xml->$nom_batiment_sql->phrase.$obj->$champ.$xml->$nom_batiment_sql->complement; |
| 560 | 560 | } |
@@ -566,7 +566,7 @@ discard block |
||
| 566 | 566 | ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1) |
| 567 | 567 | ->get(); |
| 568 | 568 | |
| 569 | - if ((is_array($query)) && (count($query) > 0)){ |
|
| 569 | + if ((is_array($query)) && (count($query) > 0)) { |
|
| 570 | 570 | foreach ($query as $obj) { |
| 571 | 571 | $this->info_batiment_next = $xml->$nom_batiment_sql->phrase_suivant.$obj->$champ.$xml->$nom_batiment_sql->complement; |
| 572 | 572 | } |
@@ -618,7 +618,7 @@ discard block |
||
| 618 | 618 | } |
| 619 | 619 | |
| 620 | 620 | //si pas assez de ressource |
| 621 | - if (($ressource["eau"]["class"] || $ressource["electricite"]["class"] ||$ressource["fer"]["class"] ||$ressource["fuel"]["class"]) == "rouge") { |
|
| 621 | + if (($ressource["eau"]["class"] || $ressource["electricite"]["class"] || $ressource["fer"]["class"] || $ressource["fuel"]["class"]) == "rouge") { |
|
| 622 | 622 | FlashMessage::setFlash("Pas assez de ressources pour construire ce batiment"); |
| 623 | 623 | return false; |
| 624 | 624 | } |
@@ -47,10 +47,10 @@ discard block |
||
| 47 | 47 | public function getRessourceConstruire() { |
| 48 | 48 | return $this->ressource_construire; |
| 49 | 49 | } |
| 50 | - public function getInfoBatiment(){ |
|
| 50 | + public function getInfoBatiment() { |
|
| 51 | 51 | return $this->info_batiment; |
| 52 | 52 | } |
| 53 | - public function getInfoBatimentNext(){ |
|
| 53 | + public function getInfoBatimentNext() { |
|
| 54 | 54 | return $this->info_batiment_next; |
| 55 | 55 | } |
| 56 | 56 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | if ($niveau > 0) { |
| 149 | 149 | $query = $dbc1->select("stockage")->from("entrepot")->where("ID_entrepot", "=", $niveau)->get(); |
| 150 | 150 | |
| 151 | - if ((is_array($query)) && (count($query) > 0)){ |
|
| 151 | + if ((is_array($query)) && (count($query) > 0)) { |
|
| 152 | 152 | foreach ($query as $obj) { |
| 153 | 153 | return $obj->stockage; |
| 154 | 154 | } |
@@ -554,7 +554,7 @@ discard block |
||
| 554 | 554 | ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment) |
| 555 | 555 | ->get(); |
| 556 | 556 | |
| 557 | - if ((is_array($query)) && (count($query) > 0)){ |
|
| 557 | + if ((is_array($query)) && (count($query) > 0)) { |
|
| 558 | 558 | foreach ($query as $obj) { |
| 559 | 559 | $this->info_batiment = $xml->$nom_batiment_sql->phrase.$obj->$champ.$xml->$nom_batiment_sql->complement; |
| 560 | 560 | } |
@@ -566,7 +566,7 @@ discard block |
||
| 566 | 566 | ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1) |
| 567 | 567 | ->get(); |
| 568 | 568 | |
| 569 | - if ((is_array($query)) && (count($query) > 0)){ |
|
| 569 | + if ((is_array($query)) && (count($query) > 0)) { |
|
| 570 | 570 | foreach ($query as $obj) { |
| 571 | 571 | $this->info_batiment_next = $xml->$nom_batiment_sql->phrase_suivant.$obj->$champ.$xml->$nom_batiment_sql->complement; |
| 572 | 572 | } |
@@ -76,10 +76,10 @@ discard block |
||
| 76 | 76 | return $this->message; |
| 77 | 77 | } |
| 78 | 78 | public function getDateMessage(){ |
| 79 | - return $this->date_message; |
|
| 79 | + return $this->date_message; |
|
| 80 | 80 | } |
| 81 | 81 | public function getUrl(){ |
| 82 | - return $this->url; |
|
| 82 | + return $this->url; |
|
| 83 | 83 | } |
| 84 | 84 | public function getIdExpediteur() { |
| 85 | 85 | return $this->id_expediteur; |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | return $this->pseudo_receveur; |
| 95 | 95 | } |
| 96 | 96 | public function getValues(){ |
| 97 | - return ["messagerie" => $this->values]; |
|
| 97 | + return ["messagerie" => $this->values]; |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
@@ -76,10 +76,10 @@ discard block |
||
| 76 | 76 | public function getMessage() { |
| 77 | 77 | return $this->message; |
| 78 | 78 | } |
| 79 | - public function getDateMessage(){ |
|
| 79 | + public function getDateMessage() { |
|
| 80 | 80 | return $this->date_message; |
| 81 | 81 | } |
| 82 | - public function getUrl(){ |
|
| 82 | + public function getUrl() { |
|
| 83 | 83 | return $this->url; |
| 84 | 84 | } |
| 85 | 85 | public function getIdExpediteur() { |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | public function getPseudoReceveur() { |
| 95 | 95 | return $this->pseudo_receveur; |
| 96 | 96 | } |
| 97 | - public function getValues(){ |
|
| 97 | + public function getValues() { |
|
| 98 | 98 | return ["messagerie" => $this->values]; |
| 99 | 99 | } |
| 100 | 100 | |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | $destinataires = explode(",", $destinataire); |
| 292 | 292 | $c = count($destinataires); |
| 293 | 293 | |
| 294 | - for ($i=0 ; $i<$c ; $i++) { |
|
| 294 | + for ($i = 0; $i < $c; $i++) { |
|
| 295 | 295 | if ($this->getIdIdentiteExist($destinataires[$i]) !== false) { |
| 296 | 296 | $destinataires[] = $this->getIdIdentiteExist($destinataires[$i]); |
| 297 | 297 | } |
@@ -76,10 +76,10 @@ discard block |
||
| 76 | 76 | public function getMessage() { |
| 77 | 77 | return $this->message; |
| 78 | 78 | } |
| 79 | - public function getDateMessage(){ |
|
| 79 | + public function getDateMessage() { |
|
| 80 | 80 | return $this->date_message; |
| 81 | 81 | } |
| 82 | - public function getUrl(){ |
|
| 82 | + public function getUrl() { |
|
| 83 | 83 | return $this->url; |
| 84 | 84 | } |
| 85 | 85 | public function getIdExpediteur() { |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | public function getPseudoReceveur() { |
| 95 | 95 | return $this->pseudo_receveur; |
| 96 | 96 | } |
| 97 | - public function getValues(){ |
|
| 97 | + public function getValues() { |
|
| 98 | 98 | return ["messagerie" => $this->values]; |
| 99 | 99 | } |
| 100 | 100 | |
@@ -87,19 +87,19 @@ |
||
| 87 | 87 | * renvoi le ou les batiments nécéssaires pour la construction du batiment spécifié |
| 88 | 88 | */ |
| 89 | 89 | private function getPourConstruire($pour_construire) { |
| 90 | - for ($i=0 ; $i<count($pour_construire) ; $i++) { |
|
| 90 | + for ($i = 0; $i < count($pour_construire); $i++) { |
|
| 91 | 91 | //si plusieur batiment pour construire le batiment en question |
| 92 | 92 | $count = count($pour_construire[$i]); |
| 93 | 93 | if ($count > 1) { |
| 94 | - for ($j=0 ; $j<$count ; $j++) { |
|
| 95 | - $batiment[] = [ |
|
| 94 | + for ($j = 0; $j < $count; $j++) { |
|
| 95 | + $batiment[] = [ |
|
| 96 | 96 | "nom_batiment" => $pour_construire[$i][$j][0], |
| 97 | 97 | "niveau_batiment" => $pour_construire[$i][$j][2] |
| 98 | 98 | ]; |
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | else { |
| 102 | - $batiment[] = [ |
|
| 102 | + $batiment[] = [ |
|
| 103 | 103 | "nom_batiment" => $pour_construire[$i][0][0], |
| 104 | 104 | "niveau_batiment" => $pour_construire[$i][0][2] |
| 105 | 105 | ]; |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | //-------------------------- SETTER ----------------------------------------------------------------------------// |
| 50 | 50 | /** |
| 51 | 51 | * @param $id_base |
| 52 | - * @param $type |
|
| 52 | + * @param string $type |
|
| 53 | 53 | * fonction qui ajoute des points à la base en fonction du type |
| 54 | 54 | * le type peut etre : batiment, attaque, defense, troupe |
| 55 | 55 | */ |
@@ -119,6 +119,7 @@ |
||
| 119 | 119 | |
| 120 | 120 | /** |
| 121 | 121 | * fonction qui place le trajet en retour |
| 122 | + * @param double $date_retour |
|
| 122 | 123 | */ |
| 123 | 124 | private function setTrajetRetour($date_retour) { |
| 124 | 125 | $dbc = App::getDb(); |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | - $marche = new \modules\bataille\app\controller\Marche(); |
|
| 2 | + $marche = new \modules\bataille\app\controller\Marche(); |
|
| 3 | 3 | |
| 4 | 4 | $marche->setCommencerTransport($_POST['eau'], $_POST['electricite'], $_POST['fer'], $_POST['fuel'], $_POST['nourriture'], $_POST['posx'], $_POST['posy']); |
| 5 | 5 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | /** |
| 92 | 92 | * @param $cout |
| 93 | - * @param $niveau_recherche |
|
| 93 | + * @param integer $niveau_recherche |
|
| 94 | 94 | * @return array |
| 95 | 95 | * fonction qui renvoi le cout d'une recherche |
| 96 | 96 | */ |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | /** |
| 107 | 107 | * @param $temps |
| 108 | 108 | * @param int $niveau |
| 109 | - * @return floatfonction qui renvoi le temps qu'il faut pour effectuer une recherche |
|
| 109 | + * @return double qui renvoi le temps qu'il faut pour effectuer une recherche |
|
| 110 | 110 | */ |
| 111 | 111 | private function getTempsRecherche($temps, $niveau = 0) { |
| 112 | 112 | $pourcent = ($temps*Bataille::getBatiment()->getNiveauBatiment("centre_recherche")/100); |
@@ -61,10 +61,10 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | private function getCoutRecherche($cout, $niveau_recherche) { |
| 63 | 63 | return [ |
| 64 | - "eau" => $cout["eau"] * ($this->coef_centre * $niveau_recherche), |
|
| 65 | - "electricite" => $cout["electricite"] * ($this->coef_centre * $niveau_recherche), |
|
| 66 | - "fer" => $cout["fer"] * ($this->coef_centre * $niveau_recherche), |
|
| 67 | - "fuel" => $cout["fuel"] * ($this->coef_centre * $niveau_recherche) |
|
| 64 | + "eau" => $cout["eau"]*($this->coef_centre*$niveau_recherche), |
|
| 65 | + "electricite" => $cout["electricite"]*($this->coef_centre*$niveau_recherche), |
|
| 66 | + "fer" => $cout["fer"]*($this->coef_centre*$niveau_recherche), |
|
| 67 | + "fuel" => $cout["fuel"]*($this->coef_centre*$niveau_recherche) |
|
| 68 | 68 | ]; |
| 69 | 69 | } |
| 70 | 70 | |
@@ -77,10 +77,10 @@ discard block |
||
| 77 | 77 | $pourcent = ($temps*Bataille::getBatiment()->getNiveauBatiment("centre_recherche")/100); |
| 78 | 78 | |
| 79 | 79 | if ($niveau == 0) { |
| 80 | - return round($temps-$pourcent);; |
|
| 80 | + return round($temps-$pourcent); ; |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - return round(($temps * ($this->coef_centre * $niveau))-$pourcent); |
|
| 83 | + return round(($temps*($this->coef_centre*$niveau))-$pourcent); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | $fuel = Bataille::getTestAssezRessourceBase("fuel", $cout["fuel"]); |
| 246 | 246 | |
| 247 | 247 | |
| 248 | - if (($eau["class"] || $electricite["class"] || $fer["class"] || $fuel["class"]) == "rouge" ) { |
|
| 248 | + if (($eau["class"] || $electricite["class"] || $fer["class"] || $fuel["class"]) == "rouge") { |
|
| 249 | 249 | FlashMessage::setFlash("Pas assez de ressources pour effectuer cette recherche"); |
| 250 | 250 | return false; |
| 251 | 251 | } |
@@ -317,7 +317,7 @@ |
||
| 317 | 317 | |
| 318 | 318 | /** |
| 319 | 319 | * @param string $param |
| 320 | - * @return mixed |
|
| 320 | + * @return integer |
|
| 321 | 321 | * fonction qui sert à récupérer un parametre spécifique pour un batiment |
| 322 | 322 | * par exemple la vitesse d'un marchand ou le nombred'emplacment de la base |
| 323 | 323 | */ |