"; require_once 'bdd.php'; require_once 'ressource.php'; require_once 'batiment_ajout.php'; require_once 'noms.php'; function sec($time) { $output = ''; $tab = array ('jour' => '86400', 'heure' => '3600', 'minute' => '60', 'seconde' => '1'); foreach ($tab as $key => $value) { $compteur = 0; while ($time > ($value-1)) { $time = $time - $value; $compteur++; } if ($compteur != 0) { $output .= $compteur.' '.$key; if ($compteur > 1) $output .= 's'; if ($value != 1) $output .= ' '; } } echo $output; } function verification_des_ress($num, $fer, $cristal, $ro, $need_fer, $need_cristal, $need_ro) { if ($fer >= $need_fer && $cristal >= $need_cristal && $ro >= $need_ro) { echo "


Construire"; } else { echo "


Construire"; } } function ressources($fer, $cristal, $ro, $need_fer, $need_cristal, $need_ro, $mine_m, $mine_c, $mine_h) { if ($need_fer > 0) { if ($fer <= $need_fer) { $z=floor($fer)-$need_fer; echo 'Fer : '.$need_fer.' '; } else echo "Fer : ".$need_fer." "; } if ($need_cristal > 0) { if ($cristal <= $need_cristal) { $z=floor($cristal)-$need_cristal; echo 'Cristal : '.$need_cristal.' '; } else echo "Cristal : ".$need_cristal." "; } if ($need_ro > 0) { if ($ro <= $need_ro) { $z=floor($ro)-$need_ro; echo 'Hydrogène : '.$need_ro.''; } else echo "Hydrogène : ".$need_ro.""; } } $case = $cases - ($mine_m + $mine_c + $mine_h + $centrale_s + $centrale_f + $radar + $labo + $chantier_terrestre + $chantier_spatial + $caserne + $silo); echo '
Arbre des technologies

'.$batiment[0].' '; if ($mine_m > 0) echo '(Niveau '.$mine_m.')'; echo '
Toute construction demande des quantités énormes de fer, pour cela des centaines de milliers d\'ouvriers travaillent dans ces mines afin d\'assurer le bon fonctionnement de votre empire.
Besoin de : '; $a=ceil(pow(1.5,$mine_m)*70); $b=ceil(pow(1.55,$mine_m)*35); ressources($metal, $cristal, $hydrogene, $a, $b, 0, $mine_m, $mine_c, $mine_h); echo '
Temps de construction : '; sec(ceil(pow(1.7,$mine_m)*120)); echo '
'; if ($temps_b > 0) { if ($bat==1) { $tr=$temps_b-time(); echo ''; echo ''; echo "
Annuler
"; } } else { if ($case <= 0) echo 'Planète pleine'; else verification_des_ress(1, $metal, $cristal, $hydrogene, $a, $b, 0); } echo '

'.$batiment[1].' '; if ($mine_c > 0) echo '(Niveau '.$mine_c.')'; echo '
Description.
Besoin de : '; $a=ceil(pow(1.55,$mine_c)*105); $b=ceil(pow(1.55,$mine_c)*60); ressources($metal, $cristal, $hydrogene, $a, $b, 0, $mine_m, $mine_c, $mine_h); echo'
Temps de construction : '; sec(ceil(pow(1.72,$mine_c)*160)); echo '
'; if ($temps_b > 0) { if ($bat==2) { $tr=$temps_b-time(); echo ''; echo ''; echo "
Annuler
"; } } else { if ($case <= 0) echo 'Planète pleine'; else verification_des_ress(2, $metal, $cristal, $hydrogene, $a, $b, 0); } echo '

'.$batiment[2].' '; if ($mine_h > 0) echo '(Niveau '.$mine_h.')'; echo '
Description.
Besoin de : '; $a=floor(pow(1.53,$mine_h)*82); $b=floor(pow(1.5,$mine_h)*80); ressources($metal, $cristal, $hydrogene, $a, $b, 0, $mine_m, $mine_c, $mine_h); echo '
Temps de construction : '; sec(ceil(pow(1.75,$mine_h)*180)); echo '
'; if ($temps_b > 0) { if ($bat==3) { $tr=$temps_b-time(); echo ''; echo ''; echo "
Annuler
"; } } else { if ($case <= 0) echo 'Planète pleine'; else verification_des_ress(3, $metal, $cristal, $hydrogene, $a, $b, 0); } echo '

'.$batiment[3].' '; if ($centrale_s > 0) echo '(Niveau '.$centrale_s.')'; echo '
Description.
Besoin de : '; $a=ceil(pow(2,$centrale_s)*300); $b=ceil(pow(2,$centrale_s)*230); ressources($metal, $cristal, $hydrogene, $a, $b, 0, $mine_m, $mine_c, $mine_h); echo '
Temps de construction : '; sec(pow(1.68,$centrale_s)*190); echo '
'; if ($temps_b > 0) { if ($bat==4) { $tr=$temps_b-time(); echo ''; echo ''; echo "
Annuler
"; } } else { if ($case <= 0) echo 'Planète pleine'; else verification_des_ress(4, $metal, $cristal, $hydrogene, $a, $b, 0); } echo '

'; if ($centrale_s >= 12 && $energie_t >= 5) { echo '
'.$batiment[4].' '; if ($centrale_f > 0) echo '(Niveau '.$centrale_f.')'; echo '
Description.
Besoin de : '; $a=ceil(pow(2,$centrale_f)*165); $b=ceil(pow(2,$centrale_f)*99); ressources($metal, $cristal, $hydrogene, $a, $b, 0, $mine_m, $mine_c, $mine_h); echo '
Temps de construction : '; sec(pow(1.8,$centrale_f)*300); echo '
'; if ($temps_b > 0) { if ($bat==5) { $tr=$temps_b-time(); echo ''; echo ''; echo "
Annuler
"; } } else { if ($case <= 0) echo 'Planète pleine'; else verification_des_ress(5, $metal, $cristal, $hydrogene, $a, $b, 0); } echo '

'; } if ($detection >= 1) { echo '
'.$batiment[5].' '; if ($radar > 0) echo '(Niveau '.$radar.')'; echo '
Description.
Besoin de : '; $a=ceil(pow(2,$radar)*750); $b=ceil(pow(2,$radar)*500); $c=ceil(pow(2,$radar)*50); ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h); echo '
Temps de construction : '; sec(ceil(pow(2,$radar)*720)); echo '
'; if ($temps_b > 0) { if ($bat==6) { $tr=$temps_b-time(); echo ''; echo ''; echo "
Annuler
"; } } else { if ($case <= 0) echo 'Planète pleine'; else verification_des_ress(6, $metal, $cristal, $hydrogene, $a, $b, $c); } echo '

'; } echo '
'.$batiment[6].' '; if ($labo > 0) echo '(Niveau '.$labo.')'; echo '
Description.
Besoin de : '; $a=ceil(pow(2,$labo)*200); $b=ceil(pow(2,$labo)*150); ressources($metal, $cristal, $hydrogene, $a, $b, 0, $mine_m, $mine_c, $mine_h); echo '
Temps de construction : '; sec(ceil(pow(2,$labo)*720)); echo '
'; if ($temps_b > 0) { if ($bat==7) { $tr=$temps_b-time(); echo ''; echo ''; echo "
Annuler
"; } } else { if ($case <= 0) echo "Planète pleine"; else { if($temps_t > 0) echo '

Recherche en cours dans le
laboratoire'; else verification_des_ress(7, $metal, $cristal, $hydrogene, $a, $b, 0); } } echo '

'.$batiment[7].' '; if ($chantier_terrestre > 0) echo '(Niveau '.$chantier_terrestre.')'; echo '
Description.
Besoin de : '; $a=ceil(pow(2,$chantier_terrestre)*520); $b=ceil(pow(2,$chantier_terrestre)*380); ressources($metal, $cristal, $hydrogene, $a, $b, 0, $mine_m, $mine_c, $mine_h); echo '
Temps de construction : '; sec(ceil(pow(2,$chantier_terrestre)*420)); echo '
'; if ($temps_b > 0) { if ($bat==8) { $tr=$temps_b-time(); echo ''; echo ''; echo "
Annuler
"; } } else { if ($case <= 0) echo 'Planète pleine'; else { if($unit_s > 0) echo '

Construction en cours dans le
chantier spatial'; else verification_des_ress(8, $metal, $cristal, $hydrogene, $a, $b, 0); } } echo '

'; if ($chantier_terrestre >= 2) { echo '
'.$batiment[8].' '; if ($chantier_spatial > 0) echo '(Niveau '.$chantier_spatial.')'; echo '
Description.
Besoin de : '; $a=ceil(pow(2,$chantier_spatial)*600); $b=ceil(pow(2,$chantier_spatial)*450); ressources($metal, $cristal, $hydrogene, $a, $b, 0, $mine_m, $mine_c, $mine_h); echo '
Temps de construction : '; sec(ceil(pow(2,$chantier_spatial)*600)); echo '
'; if ($temps_b > 0) { if ($bat==9) { $tr=$temps_b-time(); echo ''; echo ''; echo "
Annuler
"; } } else { if ($case <= 0) echo "Planète pleine"; else { if($unit_t > 0) echo "

Construction en cours dans le
chantier terrestre"; else verification_des_ress(9, $metal, $cristal, $hydrogene, $a, $b, 0); } } echo '

'; } echo '
'.$batiment[9].' '; if ($caserne > 0) echo '(Niveau '.$caserne.')'; echo '
Description.
Besoin de : '; $a=ceil(pow(2,$caserne)*200); $b=ceil(pow(2,$caserne)*100); ressources($metal, $cristal, $hydrogene, $a, $b, 0, $mine_m, $mine_c, $mine_h); echo '
Temps de construction : '; sec(ceil(pow(2,$caserne)*300)); echo '
'; if ($temps_b > 0) { if ($bat==10) { $tr=$temps_b-time(); echo ''; echo ''; echo "
Annuler
"; } } else { if ($case <= 0) echo 'Planète pleine'; else { if($unit > 0) echo '

Entrainement en cours dans la
caserne'; else verification_des_ress(10, $metal, $cristal, $hydrogene, $a, $b, 0); } } echo '

'.$batiment[10].' '; if ($silo > 0) echo '(Niveau '.$silo.')'; echo '
Description.
Besoin de : '; $a=ceil(pow(2,$silo)*400); $b=ceil(pow(2,$silo)*260); ressources($metal, $cristal, $hydrogene, $a, $b, 0, $mine_m, $mine_c, $mine_h); echo '
Temps de construction : '; sec(ceil(pow(2,$silo)*1200)); echo '
'; if ($temps_b > 0) { if ($bat==11) { $tr=$temps_b-time(); echo ''; echo ''; echo "
Annuler
"; } } else { if ($case <= 0) echo 'Planète pleine'; else verification_des_ress(11, $metal, $cristal, $hydrogene, $a, $b, 0); } echo '
'; ?>