"; 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) { 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 ress_tem($fer, $cristal, $ro, $need_fer, $need_cristal, $need_ro, $mine_m, $mine_c, $mine_h) { if ($mine_m < 0) $prod_met = 40; else $prod_metal = ceil((($mine_m*32)+(pow(1.41,$mine_m)*exp(0.066*$mine_m))*$coeff)*3.7) + 40; if ( $mine_c < 0 ) $prod_cri = 20; else $prod_cristal = (floor(($mine_c*13)+(pow(1.36,$mine_c)*exp(0.0675*$mine_c))*$coeff)*7) + 20; if ($centrale_f > 0) { $conso_hy = ceil(($centrale_f*5+(exp($mine_m*0.3)*10))*$coeff); } else {$conso_hy=0;} if ($mine_h < 0) $prod_hydrogene = 0.0000000001; else $prod_hydrogene = (ceil((($mine_h*12)+(pow(1.394,$mine_h)*exp(0.072*$mine_h))*$coeff)*5)); $w = $prod_hydrogene - $conso_hy; if ($mine_h == 0) $w=1; $ro=0; $need_ro=0; if (($prod_hydrogene-$conso_hy) < 0) $w= 1; $ro=0; $need_ro=0; $tem1 = abs(floor($fer)-$need_fer)/$prod_metal; $tem2 = abs(floor($cristal)-$need_cristal)/$prod_cristal; $tem3 = abs(floor($ro)-$need_ro)/$w; $tem = max($tem1,$tem2,$tem3); echo ceil($tem); } $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(exp(0.4*$mine_m)*190); $b=ceil(exp(0.4*$mine_m)*90); 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)/(pow(1.23,$centre_info)+0.0025*$ingeneieur))); //if (sec(ress_tem($fer, $cristal, $ro, $a, $nb,0, $mine_m, $mine_c, $mine_h)) <= 0) { echo '
Temps avant construction : maintenant'; } else { echo'
Temps avant construction : ';sec($tem); } 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(exp(0.43*$mine_c)*205); $b=ceil(exp(0.43*$mine_c)*110); 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)/(pow(1.23,$centre_info)+0.0025*$ingeneieur))); //if (sec(ress_tem($fer, $cristal, $ro, $a, $nb,0, $mine_m, $mine_c, $mine_h)) <= 0) { echo '
Temps avant construction : maintenant'; } else { echo'
Temps avant construction : ';sec($tem); } 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=ceil(exp(0.445*$mine_h)*235); $b=ceil(exp(0.445*$mine_h)*150); 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)/(pow(1.23,$centre_info)+0.0025*$ingeneieur))); //if (sec(ress_tem($fer, $cristal, $ro, $a, $nb,0, $mine_m, $mine_c, $mine_h)) <= 0) { echo '
Temps avant construction : maintenant'; } else { echo'
Temps avant construction : ';sec($tem); } 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(exp(0.442*$centrale_s)*165); $b=ceil(exp(0.442*$centrale_s)*99); ressources($metal, $cristal, $hydrogene, $a, $b, 0, $mine_m, $mine_c, $mine_h); echo '
Temps de construction : '; sec(ceil((pow(1.68,$centrale_s)*190)/(pow(1.23,$centre_info)+0.0025*$ingeneieur))); //if (sec(ress_tem($fer, $cristal, $ro, $a, $nb,0, $mine_m, $mine_c, $mine_h)) <= 0) { echo '
Temps avant construction : maintenant'; } else { echo'
Temps avant construction : ';sec($tem); } 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(1.8,$centrale_s)*300); $b=ceil(pow(1.82,$centrale_s)*230); ressources($metal, $cristal, $hydrogene, $a, $b, 0, $mine_m, $mine_c, $mine_h); echo '
Temps de construction : '; sec(ceil((pow(1.8,$centrale_f)*300)/(pow(1.23,$centre_info)+0.0025*$ingeneieur))); //if (sec(ress_tem($fer, $cristal, $ro, $a, $nb,0, $mine_m, $mine_c, $mine_h)) <= 0) { echo '
Temps avant construction : maintenant'; } else { echo'
Temps avant construction : ';sec($tem); } 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)/(pow(1.23,$centre_info)+0.0025*$ingeneieur))); //if (sec(ress_tem($fer, $cristal, $ro, $a, $nb,$c, $mine_m, $mine_c, $mine_h)) <= 0) { echo '
Temps avant construction : maintenant'; } else { echo'
Temps avant construction : ';sec($tem); } 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)/(pow(1.23,$centre_info)+0.0025*$ingeneieur))); //if (sec(ress_tem($fer, $cristal, $ro, $a, $nb,0, $mine_m, $mine_c, $mine_h)) <= 0) { echo '
Temps avant construction : maintenant'; } else { echo'
Temps avant construction : ';sec($tem); } 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($tec > 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)/(pow(1.23,$centre_info)+0.0025*$ingeneieur))); //if (sec(ress_tem($fer, $cristal, $ro, $a, $nb,0, $mine_m, $mine_c, $mine_h)) <= 0) { echo '
Temps avant construction : maintenant'; } else { echo'
Temps avant construction : ';sec($tem); } 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_t > 0 && unit_t <= 8) { echo '

Construction en cours dans le
chantier terrestre'; } elseif($unit_t > 8) { echo'

Construction en cours dans le
centre de défenses'; } 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)/(pow(1.23,$centre_info)+0.0025*$ingeneieur))); //if (sec(ress_tem($fer, $cristal, $ro, $a, $nb,0, $mine_m, $mine_c, $mine_h)) <= 0) { echo '
Temps avant construction : maintenant'; } else { echo'
Temps avant construction : ';sec($tem); } 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_s > 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)/(pow(1.23,$centre_info)+0.0025*$ingeneieur))); //if (sec(ress_tem($fer, $cristal, $ro, $a, $nb,0, $mine_m, $mine_c, $mine_h)) <= 0) { echo '
Temps avant construction : maintenant'; } else { echo'
Temps avant construction : ';sec($tem); } 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)/(pow(1.23,$centre_info)+0.0025*$ingeneieur))); //if (sec(ress_tem($fer, $cristal, $ro, $a, $nb,0, $mine_m, $mine_c, $mine_h)) <= 0) { echo '
Temps avant construction : maintenant'; } else { echo'
Temps avant construction : ';sec($tem); } 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 '
'; if ($informatique >= 2) { echo'
'.$batiment[11].' '; if ($centre_info > 0) echo '(Niveau '.$centre_info.')'; echo '
Description.
Besoin de : '; $a=ceil(pow(1.7,$centre_info)*600); $b=ceil(pow(1.7,$centre_info)*420); $c=ceil(pow(1.7,$centre_info)*100); ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h); echo '
Temps de construction : '; sec(ceil((pow(1.9,$centre_info)*800)/(pow(1.23,$centre_info)+0.0025*$ingeneieur))); //if (sec(ress_tem($fer, $cristal, $ro, $a, $nb,$c, $mine_m, $mine_c, $mine_h)) <= 0) { echo '
Temps avant construction : maintenant'; } else { echo'
Temps avant construction : ';sec($tem); } echo '
'; if ($temps_b > 0) { if ($bat==12) { $tr=$temps_b-time(); echo ''; echo ''; echo "
Annuler
"; } } else { if ($case <= 0) echo 'Planète pleine'; else verification_des_ress(12, $metal, $cristal, $hydrogene, $a, $b, $c); } echo '
'; } echo'
'; ?>