2007-10-27 10:00:00 +00:00
|
|
|
<?php
|
2007-11-04 11:00:00 +00:00
|
|
|
function vais_tempsDeplacement($start_galaxie,$start_ss,$start_position,$end_galaxie,$end_ss,$end_position,$vitesse,$coefvitesse = 1,$preparation = 0,$chauffe = 0) {
|
2007-10-27 10:00:00 +00:00
|
|
|
if ($end_galaxie-$start_galaxie == 0 && $end_ss-$start_ss == 0 && $end_position-$start_position == 0) $temps = 0;
|
2007-11-04 11:00:00 +00:00
|
|
|
elseif ($end_galaxie-$start_galaxie == 0 && $end_ss-$start_ss == 0 && $chauffe == 0) $temps = $preparation+abs($end_position-$start_position)*$vitesse/12;
|
|
|
|
elseif ($end_galaxie-$start_galaxie == 0 && $chauffe == 0) $temps = $preparation+abs($end_ss-$start_ss)*$vitesse;
|
|
|
|
elseif ($chauffe == 0) $temps = $preparation+abs($end_ss-$start_ss)*$vitesse*300;
|
|
|
|
elseif ($end_galaxie-$start_galaxie == 0 && $end_ss-$start_ss == 0) $temps = $preparation+abs($end_position-$start_position)*($vitesse*2)/12+$preparation;
|
|
|
|
/*elseif ($end_galaxie-$start_galaxie == 0 && $end_ss-$start_ss <= $chauffe) $temps = abs($end_ss-$start_ss)*(($vitesse/$chauffe)*($chauffe-abs($end_ss-$start_ss))+$vitesse)+$preparation;
|
|
|
|
elseif ($end_galaxie-$start_galaxie == 0) $temps = $vitesse*abs($end_ss-$start_ss)+$vitesse*10+$preparation;*/
|
|
|
|
elseif ($end_galaxie-$start_galaxie == 0) $temps = (abs($end_ss-$start_ss)*(($vitesse/$chauffe)*((abs($chauffe-abs($end_ss-$start_ss))+($chauffe-abs($end_ss-$start_ss)))/2)+$vitesse))+(20-(abs($chauffe-abs($end_ss-$start_ss))+($chauffe-abs($end_ss-$start_ss)))/2)*54+$preparation;
|
|
|
|
else $temps = (($vitesse/$chauffe)*($chauffe-abs($end_galaxie-$start_galaxie))+$vitesse)*300+108+$preparation;
|
2007-10-27 10:00:00 +00:00
|
|
|
|
2007-11-04 11:00:00 +00:00
|
|
|
return $temps/$coefvitesse;
|
2007-10-27 10:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function vais_conso($tempsDeplacement){
|
2007-11-04 11:00:00 +00:00
|
|
|
return $tempsDeplacement/9*100;
|
2007-10-27 10:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function vais_tempsArrivee($start_time,$start_galaxie,$start_ss,$start_position,$end_galaxie,$end_ss,$end_position,$vitesse,$chauffe = 0){
|
|
|
|
return ($start_time+vais_tempsDeplacement($start_galaxie,$start_ss,$start_position,$end_galaxie,$end_ss,$end_position,$vitesse,$chauffe));
|
|
|
|
}
|
|
|
|
|
|
|
|
function combat_maxressources($capacite, $metal, $cristal, $hydrogene){
|
|
|
|
$metal /= 2;
|
|
|
|
$cristal /= 2;
|
|
|
|
$hydrogene /= 2;
|
|
|
|
|
|
|
|
if ($metal + $cristal + $hydrogene > $capacite) {
|
|
|
|
if ($capacite/3 > $metal && $capacite/3 > $cristal && $capacite/3 > $hydrogene) {
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$ressources['metal'] = $metal;
|
|
|
|
$ressources['cristal'] = $cristal;
|
|
|
|
$ressources['hydrogene'] = $hydrogene;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function txtmission($mission){
|
|
|
|
if ($mission == 0) return 'Stationner';
|
|
|
|
elseif ($mission == 1) return 'Attaquer';
|
|
|
|
elseif ($mission == 2) return 'Transporter';
|
2007-11-04 11:00:00 +00:00
|
|
|
elseif ($mission == 3) return 'Coloniser';
|
2007-10-27 10:00:00 +00:00
|
|
|
else return 'Erreur';
|
|
|
|
}
|
2007-11-04 11:00:00 +00:00
|
|
|
|
|
|
|
function trouvNom($id_user){
|
|
|
|
$req = mysql_query("SELECT pseudo FROM user WHERE `id` = '$id_user'");
|
|
|
|
$resultat = mysql_fetch_array($req);
|
|
|
|
return $resultat['pseudo'];
|
|
|
|
}
|
2007-10-27 10:00:00 +00:00
|
|
|
?>
|