<?php
include ('logue.php'); 
include ('entete2.php');
include ('evolutionbats.php');
include ('siege.php');
echo $siege_temps_evolution;
$sql = "SELECT pts,hangarfer_lvl,robo_lvl,fer_ressource,or_ressource,ada_ressource FROM matgraph_users WHERE id='$planete' ";
$res = db_mysql_Query($sql)or die('erreur sql<br>'.$sql.'<br>'.mysql_error());
$row = mysql_fetch_array($res); 
if ($row[hangarfer_lvl] =="0") {
$Depense_fer_ressource = "2000";
}
else {
$Depense_fer_ressource = round((1000 * ( bcpow( 2, ($row[hangarfer_lvl] + 1),3))),0);
}
$New_fer_ressource = ($row[fer_ressource] - $Depense_fer_ressource) ;
$temps1hangarfer = (1440 * (bcpow(1.35, ($row[hangarfer_lvl] + 1),3)));
if ($row[robo_lvl] == "0") {
$hangarfer_evolution =  strftime("%Y-%m-%d %H:%M:%S", time()+ (round($temps1hangarfer)));
}
else {
$hangarfer_evolution =  strftime("%Y-%m-%d %H:%M:%S", time()+ (round($temps1hangarfer* $siege_temps_evolution * (bcpow(0.9, $row[robo_lvl],3)))));
} 
if ($row[fer_ressource] >= $Depense_fer_ressource && $evolution < 0) {
$sql = "UPDATE matgraph_users SET hangarfer_evolution='$hangarfer_evolution', fer_ressource=$New_fer_ressource WHERE id='$planete'";
$res = db_mysql_Query($sql)or die('erreur sql<br>'.$sql.'<br>'.mysql_error()); }
echo '<script language="javascript" type="text/javascript">
<!--
window.location.replace("batiments.php");
-->
</script>';
?>