game/onyx/hb_game/jeu/description.php

155 lines
5.6 KiB
PHP
Raw Normal View History

2008-11-22 11:00:00 +00:00
<?php
if(!defined('INDEX')) { header('Location: ../'); exit; }
$page = 'description';
$titre = 'D&eacute;tails';
2008-11-30 11:00:00 +00:00
function tableauProd($ibat,$nivo){
$temps_ecoule = 3600;
$return = array();
$c = $nivo-2 < 1 ? 1 : $nivo-2;
$a = $c + 6;
if ($ibat == 0) {
for ($c; $c < $a; $c++) {
$b = ((ceil(pow(1.1,$c)*35*$c)/3600)*$temps_ecoule)*1.5;
$h = (((ceil(pow(1.1,$c)*35*$c)/3600)*$temps_ecoule)*1.5) - (((ceil(pow(1.1,($c-1))*35*($c-1))/3600)*$temps_ecoule)*1.5);
$p = ceil(exp(0.28*$c)*10);
$g = ceil(exp(0.28*$c)*10) - ceil(exp(0.28*($c-1))*10);
if ($c == $nivo) $return[] = array($c, $b, $h, $p, $g, true);
else $return[] = array($c, $b, $h, $p, $g, false);
}
}
elseif ($ibat == 1) {
for ($c; $c < $a; $c++) {
$b = ((ceil(pow(1.1,$c)*23*$c)/3600)*$temps_ecoule)*1.5;
$h = (((ceil(pow(1.1,$c)*23*$c)/3600)*$temps_ecoule)*1.5) - (((ceil(pow(1.1,($c-1))*23*($c-1))/3600)*$temps_ecoule)*1.5);
$p = ceil(exp(0.28*$c)*10);
$g = (ceil(exp(0.28*$c)*10)) - (ceil(exp(0.28*($c-1))*10));
if ($c == $nivo) $return[] = array($c, $b, $h, $p, $g, true);
else $return[] = array($c, $b, $h, $p, $g, false);
}
}
elseif ($ibat == 2) {
for ($c; $c < $a; $c++) {
$b = (((ceil(pow(1.1,$c)*14*($c+0.7))/3600)*$temps_ecoule))*1.5;
$h = ((((ceil(pow(1.1,$c)*14*($c+0.7))/3600)*$temps_ecoule))*1.5) - ((((ceil(pow(1.1,($c-1))*14*(($c-1)+0.7))/3600)*$temps_ecoule))*1.5);
$p = ceil(exp(0.2849*$c)*13);
$g = (ceil(exp(0.2849*$c)*13)) - (ceil(exp(0.2849*($c-1))*13));
if ($c == $nivo) $return[] = array($c, $b, $h, $p, $g, true);
else $return[] = array($c, $b, $h, $p, $g, false);
}
}
elseif ($ibat == 3) {
for ($c; $c < $a; $c++) {
$b = ceil(exp(0.297*$c)*25);
$h = ceil(exp(0.297*$c)*25) - ceil(exp(0.297*($c-1))*25);
if ($c == $nivo) $return[] = array($c, $b, $h, 0, 0, true);
else $return[] = array($c, $b, $h, 0, 0, false);
}
}
elseif ($ibat == 4) {
for ($c; $c < $a; $c++) {
$b = ceil(exp(0.28*$c)*22);
$h = ceil(exp(0.28*$c)*22) - ceil(exp(0.28*($c-1))*22);
$p = ((ceil(pow(1.34,($c-1))*9)/3600)*$temps_ecoule);
$g = ((ceil(pow(1.34,($c-1))*9)/3600)*$temps_ecoule) - ((ceil(pow(1.34,($c-2))*9)/3600)*$temps_ecoule);
if ($c == $nivo) $return[] = array($c, $b, $h, $p, $g, true);
else $return[] = array($c, $b, $h, $p, $g, false);
}
}
else $return = '';
if ($return == '') return false;
else return $return;
}
2008-11-22 11:00:00 +00:00
if (isset($_GET['b']) && is_numeric($_GET['b']) && $_GET['b'] < count($batiment)) {
$template->assign('type', 'batiments');
$t = $_GET['b'];
$nom_bdd = $batimentVAR[$t];
2008-11-30 11:00:00 +00:00
$template->assign('t', $t);
2008-11-22 11:00:00 +00:00
$template->assign('image', $batimeni[$t]);
$template->assign('nom', $batiment[$t]);
$template->assign('niveau', $queryPlanete[$nom_bdd]);
$template->assign('description', $batimede[$t]);
2008-11-30 11:00:00 +00:00
$template->assign('tableau_prod', tableauProd($t, $queryPlanete[$nom_bdd]));
2008-11-22 11:00:00 +00:00
$n=($queryPlanete[$nom_bdd]+1);
$a = 0; $b = 0; $c = 0; $sec = 0;
eval($batimentCALC[$t][0]);
eval($batimentCALC[$t][1]);
eval($batimentCALC[$t][2]);
eval($batimentCALC[$t][3]);
$template->assign('ressourcesNext', array(separerNombres($a), separerNombres($b), separerNombres($c), sec($sec)));
$template->assign('etat', readDeblok($batimentTECH[$t], $queryPlanete, $queryUser));
}
elseif (isset($_GET['t']) && is_numeric($_GET['t']) && $_GET['t'] < count($technolo)) {
$template->assign('type', 'technologies');
$t = $_GET['t'];
$nom_bdd = $technoloVAR[$t];
$template->assign('image', $technoli[$t]);
$template->assign('nom', $technolo[$t]);
$template->assign('niveau', $queryUser[$nom_bdd]);
$template->assign('description', $technode[$t]);
$n=($queryUser[$nom_bdd]+1);
$a = 0; $b = 0; $c = 0; $sec = 0;
eval($technoloCALC[$t][0]);
eval($technoloCALC[$t][1]);
eval($technoloCALC[$t][2]);
eval($technoloCALC[$t][3]);
$template->assign('ressourcesNext', array(separerNombres($a), separerNombres($b), separerNombres($c), sec($sec)));
$template->assign('etat', readDeblok($technoloTECH[$t], $queryPlanete, $queryUser));
}
elseif (isset($_GET['v']) && is_numeric($_GET['v']) && $_GET['v'] < count($nomvaisn)) {
$template->assign('type', 'vaisseaux');
$t = $_GET['v'];
$nom_bdd = $nomvaisnVAR[$t];
$template->assign('image', $nomvaisi[$t]);
$template->assign('nom', $nomvaisn[$t]);
$template->assign('niveau', $queryPlanete[$nom_bdd]);
$template->assign('description', $nomvaisd[$t]);
$n=($queryPlanete[$nom_bdd]+1);
$a = $nomvaisnCALC[$t][0]; $b = $nomvaisnCALC[$t][1]; $c = $nomvaisnCALC[$t][2]; $sec = 0;
eval($nomvaisnCALC[$t][3]);
$template->assign('ressourcesNext', array(separerNombres($a), separerNombres($b), separerNombres($c), sec($sec)));
$template->assign('etat', readDeblok($nomvaisnTECH[$t], $queryPlanete, $queryUser));
2008-11-30 11:00:00 +00:00
$template->assign('caract', array($nomvais_at[$t], $nomvais_bc[$t], $nomvais_pv[$t], $nomvais_rs[$t]));
2008-11-22 11:00:00 +00:00
}
elseif (isset($_GET['d']) && is_numeric($_GET['d']) && $_GET['d'] < count($nomterrn)) {
$template->assign('type', 'terrestre');
$t = $_GET['d'];
$nom_bdd = $nomterrnVAR[$t];
$template->assign('image', $nomterri[$t]);
$template->assign('nom', $nomterrn[$t]);
$template->assign('niveau', $queryPlanete[$nom_bdd]);
$template->assign('description', $nomterde[$t]);
$n=($queryPlanete[$nom_bdd]+1);
$a = $nomterrnCALC[$t][0]; $b = $nomterrnCALC[$t][1]; $c = $nomterrnCALC[$t][2]; $sec = 0;
eval($nomterrnCALC[$t][3]);
$template->assign('ressourcesNext', array(separerNombres($a), separerNombres($b), separerNombres($c), sec($sec)));
$template->assign('etat', readDeblok($nomterrnTECH[$t], $queryPlanete, $queryUser));
2008-11-30 11:00:00 +00:00
if ($t-8 >= 0) {
$t -= 8;
$template->assign('caract', array($defense_at[$t], $defense_bc[$t], $defense_pv[$t]));
}
2008-11-22 11:00:00 +00:00
}
else {
header('Location: ?p=accueil');
}
?>