forked from halo-battle/game
Version 1.7i
This commit is contained in:
parent
8a8280758b
commit
ba5e741c99
136 changed files with 2561 additions and 2105 deletions
|
|
@ -24,11 +24,25 @@ $titre = 'Défenses';
|
|||
if (isset($_GET['v']) && !empty($nomterrn[$_GET['v']]) && !empty($_POST['nombre'])) {
|
||||
$i = $_GET['v'];
|
||||
$nbv = floor($_POST['nombre']);
|
||||
|
||||
$a = $nomterrnCALC[$i][0];
|
||||
$b = $nomterrnCALC[$i][1];
|
||||
$c = $nomterrnCALC[$i][2];
|
||||
if ($a * $nbv > $metal || $b * $nbv > $cristal || $c * $nbv > $hydrogene) {
|
||||
if ($a != 0) $nbvm = $metal/$a;
|
||||
if ($b == 0) $nbvc = $nbvm;
|
||||
else $nbvc = $cristal/$b;
|
||||
if ($c == 0) $nbvh = $nbvc;
|
||||
else $nbvh = $hydrogene/$c;
|
||||
if ($a == 0) $nbvm = $nbvh;
|
||||
$nbv = floor(min($nbvm, $nbvc, $nbvh));
|
||||
}
|
||||
|
||||
if(requestDeblok($nomterrnTECH[$i], $queryPlanete, $queryUser) && $nbv > 0) {
|
||||
$n=($queryPlanete[$nomterrnVAR[$i]]+1);
|
||||
$a = $nomterrnCALC[$i][0]; $metal -= $a * $nbv;
|
||||
$b = $nomterrnCALC[$i][1]; $cristal -= $b * $nbv;
|
||||
$c = $nomterrnCALC[$i][2]; $hydrogene -= $c * $nbv;
|
||||
$metal -= $a * $nbv;
|
||||
$cristal -= $b * $nbv;
|
||||
$hydrogene -= $c * $nbv;
|
||||
if ($metal < 0 || $cristal < 0 || $hydrogene < 0) {
|
||||
$template->assign('message','Vous n\'avez pas assez de ressources pour démarrer cette construction.');
|
||||
$template->assign('script','<script type="text/javascript">setTimeout(\'document.location.href="?p=defenses";\', 3500);</script>');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue