@@ -82,15 +82,15 @@ discard block |
||
| 82 | 82 | $today = Bataille::getToday(); |
| 83 | 83 | |
| 84 | 84 | //on test si déja arrivé à destination |
| 85 | - if (($this->aller == 1) && (($this->date_arrivee-$today) <= 0)) { |
|
| 85 | + if (($this->aller == 1) && (($this->date_arrivee - $today) <= 0)) { |
|
| 86 | 86 | $this->setLivrerRessource(); |
| 87 | 87 | |
| 88 | 88 | //on calcul la date d'arrivée du retour |
| 89 | 89 | if ($this->id_base_dest == Bataille::getIdBase()) { |
| 90 | - $date_retour = Bataille::getDureeTrajet($this->id_base, Bataille::getParam("vitesse_marchand"))+$this->date_arrivee; |
|
| 90 | + $date_retour = Bataille::getDureeTrajet($this->id_base, Bataille::getParam("vitesse_marchand")) + $this->date_arrivee; |
|
| 91 | 91 | } |
| 92 | 92 | else { |
| 93 | - $date_retour = Bataille::getDureeTrajet($this->id_base_dest, Bataille::getParam("vitesse_marchand"))+$this->date_arrivee; |
|
| 93 | + $date_retour = Bataille::getDureeTrajet($this->id_base_dest, Bataille::getParam("vitesse_marchand")) + $this->date_arrivee; |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | //si le retour du trajet est également arrivé on finit le transport sinon on le place sur le retour |
@@ -99,15 +99,15 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | else { |
| 101 | 101 | $this->setTrajetRetour($date_retour); |
| 102 | - $this->duree_restante_trajet = $date_retour-$today; |
|
| 102 | + $this->duree_restante_trajet = $date_retour - $today; |
|
| 103 | 103 | $set_array = true; |
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | - else if (($this->aller == 0) && (($this->date_arrivee-$today) <= 0)) { |
|
| 106 | + else if (($this->aller == 0) && (($this->date_arrivee - $today) <= 0)) { |
|
| 107 | 107 | $this->setTerminerTransport(); |
| 108 | 108 | } |
| 109 | 109 | else { |
| 110 | - $this->duree_restante_trajet = $this->date_arrivee-$today; |
|
| 110 | + $this->duree_restante_trajet = $this->date_arrivee - $today; |
|
| 111 | 111 | $set_array = true; |
| 112 | 112 | } |
| 113 | 113 | |
@@ -159,11 +159,11 @@ discard block |
||
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | //on a le nombre de marchand dispo dans la base |
| 162 | - $nombre_marchand_dispo = $nombre_max_marchand-$marchand_transport; |
|
| 162 | + $nombre_marchand_dispo = $nombre_max_marchand - $marchand_transport; |
|
| 163 | 163 | |
| 164 | 164 | //on calcul savoir si on en a assez pour transport toutes les ressoures |
| 165 | 165 | //il faut 1 marchand pour 1000 ressource |
| 166 | - $nombre_marchand_trajet = ceil($all_ressource/1000); |
|
| 166 | + $nombre_marchand_trajet = ceil($all_ressource / 1000); |
|
| 167 | 167 | |
| 168 | 168 | //si on a assez de marchand on revoi true sinon false |
| 169 | 169 | if ($nombre_marchand_dispo >= $nombre_marchand_trajet) { |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | //on check si assez marchand dans la base, si pas assez on return false |
| 247 | - $nb_marchand = $this->getAssezMarchand($eau+$electricite+$fer+$fuel+$nourriture); |
|
| 247 | + $nb_marchand = $this->getAssezMarchand($eau + $electricite + $fer + $fuel + $nourriture); |
|
| 248 | 248 | |
| 249 | 249 | if ($nb_marchand === false) { |
| 250 | 250 | FlashMessage::setFlash("Vous n'avez pas assez de marchans disponibles pour effectuer ce trajet"); |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | |
| 254 | 254 | //sinon initialise le transport |
| 255 | 255 | //on recup la date d'arrivee dans la base de destintation |
| 256 | - $date_arrivee = Bataille::getDureeTrajet($id_base_dest, Bataille::getParam("vitesse_marchand"))+Bataille::getToday(); |
|
| 256 | + $date_arrivee = Bataille::getDureeTrajet($id_base_dest, Bataille::getParam("vitesse_marchand")) + Bataille::getToday(); |
|
| 257 | 257 | |
| 258 | 258 | $ressource = [ |
| 259 | 259 | "eau" => $eau, |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | public static function getTestAssezRessourceBase($nom_ressource, $ressource) { |
| 198 | 198 | $f = "get".ucfirst($nom_ressource); |
| 199 | 199 | |
| 200 | - if ($ressource > Bataille::getRessource()->$f()) { |
|
| 200 | + if ($ressource > Bataille::getRessource()->$f()) { |
|
| 201 | 201 | /*echo("$nom_ressource $ressource ".Bataille::getRessource()->getEau()." ---");*/ |
| 202 | 202 | return [ |
| 203 | 203 | "ressource" => $ressource, |
@@ -224,10 +224,10 @@ discard block |
||
| 224 | 224 | |
| 225 | 225 | //calcul des distances séparant les deux bases en x et y |
| 226 | 226 | //cette dstance sera multipliée par 15 sur x et y puis ajoutée pour avoir le temps du trajte en seconde |
| 227 | - $calc_x = abs($base_joueur['posx']-$base_autre['posx']); |
|
| 228 | - $calc_y = abs($base_joueur['posy']-$base_autre['posy']); |
|
| 227 | + $calc_x = abs($base_joueur['posx'] - $base_autre['posx']); |
|
| 228 | + $calc_y = abs($base_joueur['posy'] - $base_autre['posy']); |
|
| 229 | 229 | |
| 230 | - $temps_voyage = (($calc_x*70)+($calc_y*70))/$vitesse; |
|
| 230 | + $temps_voyage = (($calc_x * 70) + ($calc_y * 70)) / $vitesse; |
|
| 231 | 231 | |
| 232 | 232 | return $temps_voyage; |
| 233 | 233 | } |