= $ress_ness_metal && $calcium >= $ress_ness_calcium && $nourriture >= $ress_ness_nourriture) return '

'; else return 'Vous n\'avez pas suffisament de ressources'; } function ressources($fer, $cristal, $ro, $need_fer, $need_cristal, $need_ro) { require 'noms.php'; $return = ''; if ($need_fer > 0) { if ($fer <= $need_fer) { $z=floor($fer)-$need_fer; $return .= ''.$ressourc[0].' : '.$need_fer.' '; } else $return .= $ressourc[0].' : '.$need_fer.' '; } if ($need_cristal > 0) { if ($cristal <= $need_cristal) { $z=floor($cristal)-$need_cristal; $return .= ''.$ressourc[1].' : '.$need_cristal.' '; } else $return .= $ressourc[1].' : '.$need_cristal.' '; } if ($need_ro > 0) { if ($ro <= $need_ro) { $z=floor($ro)-$need_ro; $return .= ''.$ressourc[2].' : '.$need_ro.''; } else $return .= $ressourc[2].' : '.$need_ro.''; } return $return; } 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 .= ' '; } } return $output; } $f = ceil(480/pow(1.25,($chantier_terrestre-1))); $g = ceil(1560/pow(1.25,($chantier_terrestre-3))); $h = ceil(1800/pow(1.25,($chantier_terrestre-4))); $i = ceil(6720/pow(1.25,($chantier_terrestre-4))); $j = ceil(12960/pow(1.25,($chantier_terrestre-8))); if ($temps_t > 0) $unit = $nomterra[--$unit_v]; if ($chantier_terrestre > 0) { if (!isset($_GET['err'])) $_GET['err'] = ''; $ERREUR = ''; if ($_GET['err'] == 1) $ERREUR = '
Cette technologie est déjà en cours de recherche, vous ne pouvez pas la rajouter dans la file d\'attente

'; elseif ($_GET['err'] == 2) $ERREUR = '
La production à la chaîne a été arrêtée

'; elseif ($_GET['err'] == 3) $ERREUR = '
Vous n\'avez pas assez de ressources pour construire autant de défenses

'; $template->set_filenames(array('ressourcestpl' => 'ressources.tpl')); $template->assign_vars( array('RES_IMAGE' => $RES_IMAGE, 'NOM_METAL' => $NOM_METAL, 'NOM_CRISTAL' => $NOM_CRISTAL, 'NOM_HYDROGENE' => $NOM_HYDROGENE, 'NOM_ENERGIE' => $NOM_ENERGIE, 'RES_METAL' => $RES_METAL, 'RES_CRISTAL' => $RES_CRISTAL, 'RES_HYDROGENE' => $RES_HYDROGENE, 'RES_ENERGIE' => $RES_ENERGIE, 'ERREUR' => $ERREUR, 'HEADER' => $HEADER, 'PUB' => $PUB)); for ($i=0 ; $iassign_block_vars('planetes',array('RES_VALUE' => $Aplan_value[$i], 'RES_MORE' => $Aplan_more[$i], 'RES_REF' => $Aplan_ref[$i])); } $template->set_filenames(array('defenses' => 'defenses.tpl')); $template->assign_var_from_handle('RESSOURCES', 'ressourcestpl'); $CHAINE = ''; if (!empty($fileVeh[0])) { $comp = 1; for ($i=0 ; $iassign_block_vars('file',array('NOM' => $comp.' '.$nomterrn[$fileVeh[$i]-1], 'NUM' => $fileVeh[$i], 'I' => $i)); $comp = 1; } } } $FILETXT = ''; } else $FILETXT = 'Aucune défense en attente'; $tr = $fileTemps_v[0] + $fileTemps_v[1] - time(); if (!empty($fileVeh[0])) $RESTE = $action = ''; else $RESTE = ''; $template->assign_vars(array('RACE' => $race, 'FILETXT' => $FILETXT, 'CHAINE' => $CHAINE, 'RESTE' => $RESTE)); $a=0; $b=0; $c=0; // Défense n°1 : Shade/Tour à plasma/Mitrailleuse automatique M247 GP ; planete.def_1 if ($chantier_spatial >= 1) { $i = 8; $nom_bdd = 'def'.($i-7); if (${$nom_bdd} > 0) $niveau = '('.${$nom_bdd}.' construit)'; else $niveau = ''; $n=(${$nom_bdd}-1); $a=500; $b=200; if($bat == 8) $action = 'Le chantier terrestre est en cours d\'évolution'; else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); if (!empty($nomterrn[$i])) $template->assign_block_vars('defense', array('IMAGE' => $nomterri[$i], 'NOM' => $nomterrn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomterde[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($f), 'ACTION' => $action)); } // Défense n°2 : Strong shade/Tour Ion/DCA légère ; planete.def_2 if ($chantier_terrestre >= 3 && $energie_t >=2) { $i = 9; $nom_bdd = 'def'.($i-7); if (${$nom_bdd} > 0) $niveau = '('.${$nom_bdd}.' construit)'; else $niveau = ''; $n=(${$nom_bdd}-1); $a=4000; $b=2000; if($bat == 8) $action = 'Le chantier terrestre est en cours d\'évolution'; else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); if (!empty($nomterrn[$i])) $template->assign_block_vars('defense', array('IMAGE' => $nomterri[$i], 'NOM' => $nomterrn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomterde[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($g), 'ACTION' => $action)); } // Défense n°3 : Tourelle à barreau de combustible/Canon Orbital/DCA lourde ; planete.def_3 if ($chantier_terrestre >= 4 && $armement >= 3 && $energie_t >= 3) { $i = 10; $nom_bdd = 'def'.($i-7); if (${$nom_bdd} > 0) $niveau = '('.${$nom_bdd}.' construit)'; else $niveau = ''; $n=(${$nom_bdd}-1); $a=4500; $b=800; $c=600; if($bat == 8) $action = 'Le chantier terrestre est en cours d\'évolution'; else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); if (!empty($nomterrn[$i])) $template->assign_block_vars('defense', array('IMAGE' => $nomterri[$i], 'NOM' => $nomterrn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomterde[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($h), 'ACTION' => $action)); } // Défense n°4 : Canon à plasma/Drone/Canon Gauss ; planete.def_4 if ($chantier_terrestre >= 4 && $armement >= 1) { $i = 11; $nom_bdd = 'def'.($i-7); if (${$nom_bdd} > 0) $niveau = '('.${$nom_bdd}.' construit)'; else $niveau = ''; $n=(${$nom_bdd}-1); $a=12000; $b=10000; $c=1000; if($bat == 8) $action = 'Le chantier terrestre est en cours d\'évolution'; else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); if (!empty($nomterrn[$i])) $template->assign_block_vars('defense', array('IMAGE' => $nomterri[$i], 'NOM' => $nomterrn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomterde[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($h), 'ACTION' => $action)); } // Défense n°5 : Lanceur de torpilles plasma/Station de defense/Lanceur de missiles ; planete.def_5 if ($chantier_terrestre >= 4 && $armement >= 1) { $i = 12; $nom_bdd = 'def'.($i-7); if (${$nom_bdd} > 0) $niveau = '('.${$nom_bdd}.' construit)'; else $niveau = ''; $n=(${$nom_bdd}-1); $a=15000; $b=9500; $c=1500; if($bat == 8) $action = 'Le chantier terrestre est en cours d\'évolution'; else $action = verification_des_ress($i+1, $metal, $cristal, $hydrogene, $a, $b, $c); if (!empty($nomterrn[$i])) $template->assign_block_vars('defense', array('IMAGE' => $nomterri[$i], 'NOM' => $nomterrn[$i], 'NUM' => $i, 'NIVEAU' => $niveau, 'DESCRIPTION' => $nomterde[$i], 'BESOIN' => ressources($metal, $cristal, $hydrogene, $a, $b, $c, $mine_m, $mine_c, $mine_h), 'TEMPS' => sec($h), 'ACTION' => $action)); } $template->pparse('defenses'); } else { $template->set_filenames(array('ressourcestpl' => 'ressources.tpl')); $template->assign_vars( array('RES_IMAGE' => $RES_IMAGE, 'NOM_METAL' => $NOM_METAL, 'NOM_CRISTAL' => $NOM_CRISTAL, 'NOM_HYDROGENE' => $NOM_HYDROGENE, 'NOM_ENERGIE' => $NOM_ENERGIE, 'RES_METAL' => $RES_METAL, 'RES_CRISTAL' => $RES_CRISTAL, 'RES_HYDROGENE' => $RES_HYDROGENE, 'RES_ENERGIE' => $RES_ENERGIE, 'ERREUR' => $ERREUR, 'HEADER' => $HEADER, 'PUB' => $PUB)); for ($i=0 ; $iassign_block_vars('planetes',array('RES_VALUE' => $Aplan_value[$i], 'RES_MORE' => $Aplan_more[$i], 'RES_REF' => $Aplan_ref[$i])); } $template->set_filenames(array('manque' => 'manque.tpl')); $template->assign_var_from_handle('RESSOURCES', 'ressourcestpl'); $template->assign_vars( array('TEXTE' => 'Vous devez d\'abord construire un chantier spatial !', 'PUB' => $PUB)); $template->pparse('manque'); } ?>