"; require_once 'bdd.php'; require_once 'ressource.php'; require_once 'laboratoire_ajout.php'; require_once 'noms.php'; function verification_des_ress($numtec, $metal, $calcium, $nourriture, $ress_ness_metal, $ress_ness_calcium, $ress_ness_nourriture) { if ($metal >= $ress_ness_metal && $calcium >= $ress_ness_calcium && $nourriture >= $ress_ness_nourriture) echo "


Construire"; else echo "


Construire"; } function ressources($fer, $cristal, $ro, $need_fer, $need_cristal, $need_ro) { require 'noms.php'; if ($need_fer > 0) { if ($fer <= $need_fer) { $z=floor($fer)-$need_fer; echo ''.$ressourc[0].' : '.$need_fer.' '; } else echo $ressourc[0].' : '.$need_fer.' '; } if ($need_cristal > 0) { if ($cristal <= $need_cristal) { $z=floor($cristal)-$need_cristal; echo ''.$ressourc[1].' : '.$need_cristal.' '; } else echo $ressourc[1].' : '.$need_cristal.' '; } if ($need_ro > 0) { if ($ro <= $need_ro) { $z=floor($ro)-$need_ro; echo ''.$ressourc[2].' : '.$need_ro.''; } else echo $ressourc[2].' : '.$need_ro.''; } } 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; } ?> 0) { if ($labo >= 1) { echo'
Arbre des technologies

'.$technolo[0].' '; if ($informatique > 0) echo '(Niveau '.$informatique.')'; echo '
'.$technode[0].'
Besoin de : '; $n=($informatique-1); $b=ceil(pow(2,$n)*500); $c=ceil(pow(2,$n)*150); ressources($metal, $cristal, $hydrogene, 0, $b, $c, $mine_m, $mine_c, $mine_h); echo '
Temps de construction : '; sec(ceil((420*2*($informatique+1))/pow(1.25,($labo-1)))); echo '
'; if ($temps_tec > 0) { if ($tec==1) { $tr=$temps_tec-time(); echo '



'; echo ''; echo "Annuler"; } } else { if($bat == 7) echo "


Le laboratoire est en cours d'évolution"; else verification_des_ress(1, $metal, $cristal, $hydrogene, 0, $b, $c); } echo '

'; } if ($labo >= 2 && $informatique >=2) { echo'
'.$technolo[1].' '; if ($detection > 0) echo '(Niveau '.$detection.')'; echo '
'.$technode[1].'
Besoin de : '; $n=($detection-1); $a=ceil(pow(2,$n)*500); $b=ceil(pow(2,$n)*750); $c=ceil(pow(2,$n)*100); ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h); echo '
Temps de construction : '; sec(ceil((600*2*($detection+1))/pow(1.25,($labo-2)))); echo '
'; if ($temps_tec > 0) { if ($tec==2) { $tr=$temps_tec-time(); echo '



'; echo ''; echo "Annuler"; } } else { if($bat == 7) echo "


Le laboratoire est en cours d'évolution"; else verification_des_ress(2, $metal, $cristal, $hydrogene, $a, $b, $c); } echo '

'; } if ($labo >= 5) { echo'
'.$technolo[2].' '; if ($armement > 0) echo '(Niveau '.$armement.')'; echo '
'.$technode[2].'
Besoin de : '; $n=($armement-1); $a=ceil(pow(2,$n)*2500); $b=ceil(pow(2,$n)*500); ressources($metal, $cristal, $hydrogene, $a, $b, 0, $mine_m, $mine_c, $mine_h); echo '
Temps de construction : '; sec(ceil((1500*2*($armement+1))/pow(1.25,($labo-5)))); echo '
'; if ($temps_tec > 0) { if ($tec==3) { $tr=$temps_tec-time(); echo '



'; echo ''; echo "Annuler"; } } else { if($bat == 7) echo "


Le laboratoire est en cours d'évolution"; else verification_des_ress(3, $metal, $cristal, $hydrogene, $a, $b, 0); } echo '

'; } if ($labo >= 4) { echo'
'.$technolo[3].' '; if ($blindage > 0) echo '(Niveau '.$blindage.')'; echo '
'.$technode[3].'
Besoin de : '; $n=($blindage-1); $a=ceil(pow(2,$n)*4000); $b=ceil(pow(2,$n)*1500); ressources($metal, $cristal, $hydrogene, $a, $b, 0, $mine_m, $mine_c, $mine_h); echo '
Temps de construction : '; sec(ceil((1710*2*($blindage+1))/pow(1.25,($labo-4)))); echo '
'; if ($temps_tec > 0) { if ($tec==4) { $tr=$temps_tec-time(); echo '



'; echo ''; echo "Annuler"; } } else { if($bat == 7) echo "


Le laboratoire est en cours d'évolution"; else verification_des_ress(4, $metal, $cristal, $hydrogene, $a, $b, 0); } echo '

'; } if ($labo >= 2) { echo'
'.$technolo[4].' '; if ($energie_t > 0) echo '(Niveau '.$energie_t.')'; echo '
'.$technode[4].'
Besoin de : '; $n=($energie_t-1); $a=ceil(pow(2,$n)*2000); $b=ceil(pow(2,$n)*1500); $c=ceil(pow(2,$n)*300); ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h); echo '
Temps de construction : '; sec(ceil((900*2*($energie_t+1))/pow(1.25,($labo-2)))); echo '
'; if ($temps_tec > 0) { if ($tec==5) { $tr=$temps_tec-time(); echo '



'; echo ''; echo "Annuler"; } } else { if($bat == 7) echo "


Le laboratoire est en cours d'évolution"; else verification_des_ress(5, $metal, $cristal, $hydrogene, $a, $b, $c); } echo '

'; } if ($labo >= 2) { echo'
'.$technolo[5].' '; if ($reacteur > 0) echo '(Niveau '.$reacteur.')'; echo '
'.$technode[5].'
Besoin de : '; $n=($reacteur-1); $a=ceil(pow(2,$n)*1400); $b=ceil(pow(2,$n)*400); ressources($metal, $cristal, $hydrogene, $a, $b, 0, $mine_m, $mine_c, $mine_h); echo '
Temps de construction : '; sec(ceil((510*2*($reacteur+1))/pow(1.25,($labo-2)))); echo '
'; if ($temps_tec > 0) { if ($tec==6) { $tr=$temps_tec-time(); echo '



'; echo ''; echo "Annuler"; } } else { if($bat == 7) echo "


Le laboratoire est en cours d'évolution"; else verification_des_ress(6, $metal, $cristal, $hydrogene, $a, $b, 0); } echo '

'; } if ($labo >= 4 && $energie_t >=2 && $reacteur >= 4) { echo'
'.$technolo[6].' '; if ($reacteur_f > 0) echo '(Niveau '.$reacteur_f.')'; echo '
'.$technode[6].'
Besoin de : '; $n=($reacteur_f-1); $a=ceil(pow(2,$n)*3000); $b=ceil(pow(2,$n)*2100); $c=ceil(pow(2,$n)*750); ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h); echo '
Temps de construction : '; sec(ceil((1650*2*($reacteur_f+1))/pow(1.25,($labo-4)))); echo '
'; if ($temps_tec > 0) { if ($tec==7) { $tr=$temps_tec-time(); echo '



'; echo ''; echo "Annuler"; } } else { if($bat == 7) echo "


Le laboratoire est en cours d'évolution"; else verification_des_ress(7, $metal, $cristal, $hydrogene, $a, $b, $c); } echo '

'; } if ($labo >= 6 && $energie_t >=5 && $reacteur_f >= 4) { echo'
'.$technolo[7].' '; if ($reacteur_ff > 0) echo '(Niveau '.$reacteur_ff.')'; echo '
'.$technode[7].'
Besoin de : '; $n=($reacteur_ff-1); $a=ceil(pow(2,$n)*5000); $b=ceil(pow(2,$n)*4000); $c=ceil(pow(2,$n)*1500); ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h); echo '
Temps de construction : '; sec(ceil((2400*2*($reacteur_ff+1))/pow(1.25,($labo-6)))); echo '
'; if ($temps_tec > 0) { if ($tec==8) { $tr=$temps_tec-time(); echo '



'; echo ''; echo "Annuler"; } } else { if($bat == 7) echo "


Le laboratoire est en cours d'évolution"; else verification_des_ress(8, $metal, $cristal, $hydrogene, $a, $b, $c); } echo '

'; } if ($labo >= 1) { echo'
'.$technolo[8].' '; if ($medecine > 0) echo '(Niveau '.$medecine.')'; echo '
'.$technode[8].'
Besoin de : '; $n=($medecine-1); $a=ceil(pow(2,$n)*800); $b=ceil(pow(2,$n)*1000); ressources($metal, $cristal, $hydrogene, $a, $b, 0, $mine_m, $mine_c, $mine_h); echo '
Temps de construction : '; sec(ceil((360*2*($medecine+1))/pow(1.25,($labo-1)))); echo '
'; if ($temps_tec > 0) { if ($tec==9) { $tr=$temps_tec-time(); echo '



'; echo ''; echo "Annuler"; } } else { if($bat == 7) echo "


Le laboratoire est en cours d'évolution"; else verification_des_ress(9, $metal, $cristal, $hydrogene, $a, $b, 0); } echo '

'; } if ($labo >= 3) { echo'
'.$technolo[9].' '; if ($tactique > 0) echo '(Niveau '.$tactique.')'; echo '
'.$technode[9].'
Besoin de : '; $n=($tactique-1); $a=ceil(pow(2,$n)*2600); $b=ceil(pow(2,$n)*2600); ressources($metal, $cristal, $hydrogene, $a, $b, 0, $mine_m, $mine_c, $mine_h); echo '
Temps de construction : '; sec(ceil((4410*2*($tactique+1))/pow(1.25,($labo-3)))); echo '
'; if ($temps_tec > 0) { if ($tec==10) { $tr=$temps_tec-time(); echo '



'; echo ''; echo "Annuler"; } } else { if($bat == 7) echo "


Le laboratoire est en cours d'évolution"; else verification_des_ress(10, $metal, $cristal, $hydrogene, $a, $b, 0); } echo '

'; } if ($labo >= 8 && $mine_m >= 18 && $mine_c >= 15 && $informatique >= 8) { echo'
'.$technolo[10].' '; if ($developpement > 0) echo '(Niveau '.$developpement.')'; echo '
'.$technode[10].'
Besoin de : '; $n=($developpement-1); $a=ceil(pow(2,$n)*10000); $b=ceil(pow(2,$n)*10000); $c=ceil(pow(2,$n)*5000); ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h); echo '
Temps de construction : '; sec(ceil((11400*2*($developpement+1))/pow(1.25,($labo-8)))); echo '
'; if ($temps_tec > 0) { if ($tec==11) { $tr=$temps_tec-time(); echo '



'; echo ''; echo "Annuler"; } } else { if($bat == 7) echo "


Le laboratoire est en cours d'évolution"; else verification_des_ress(11, $metal, $cristal, $hydrogene, $a, $b, $c); } echo '

'; } if ($labo >= 8 && $medecine >= 5 && $informatique >= 8) { echo'
'.$technolo[11].' '; if ($spartan > 0) echo '(Niveau '.$spartan.')'; echo '
'.$technode[11].'
Besoin de : '; $n=($spartan-1); $a=ceil(pow(3,$n)*5200); $b=ceil(pow(3,$n)*4250); $c=ceil(pow(3,$n)*850); ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h); echo '
Temps de construction : '; sec(ceil((5000*2*($spartan+1))/pow(1.25,($labo-8)))); echo '
'; if ($temps_tec > 0) { if ($tec==12) { $tr=$temps_tec-time(); echo '



'; echo ''; echo "Annuler"; } } else { if($bat == 7) echo "


Le laboratoire est en cours d'évolution"; else verification_des_ress(12, $metal, $cristal, $hydrogene, $a, $b, $c); } echo '
'; } } else { echo '
Vous devez d\'abord construire un centre de recherche !
'; } ?>