AJout des bouclier/attaque/armature des vaisseaux et fix de l'affichage de l'arbre techno

This commit is contained in:
Nigel Sheldon 2021-01-28 18:42:35 +01:00
parent 2269a56ce5
commit b0e5c7dea5
3 changed files with 390 additions and 39 deletions

View File

@ -3,9 +3,12 @@ require_once("Class/Donnees/interface.php");
class dSpatial implements Donnees class dSpatial implements Donnees
{ {
public static function metal($id, $nombre, surface $planete) public static function metal($id, $nombre, surface $planete, $race = null)
{ {
if ($planete->race == "humain") { if ($race == null) {
$race = $planete->race;
}
if ($race == "humain") {
switch ($id) { switch ($id) {
case 0: case 0:
$metal = 1000; $metal = 1000;
@ -118,9 +121,12 @@ class dSpatial implements Donnees
return $metal * $nombre; return $metal * $nombre;
} }
public static function cristal($id, $nombre, surface $planete) public static function cristal($id, $nombre, surface $planete, $race = null)
{ {
if ($planete->race == "humain") { if ($race == null) {
$race = $planete->race;
}
if ($race == "humain") {
switch ($id) { switch ($id) {
case 0: case 0:
$cristal = 800; $cristal = 800;
@ -233,9 +239,12 @@ class dSpatial implements Donnees
return $cristal * $nombre; return $cristal * $nombre;
} }
public static function hydrogene($id, $nombre, surface $planete) public static function hydrogene($id, $nombre, surface $planete, $race = null)
{ {
if ($planete->race == "humain") { if ($race == null) {
$race = $planete->race;
}
if ($race == "humain") {
switch ($id) { switch ($id) {
case 0: case 0:
$hydrogene = 180; $hydrogene = 180;
@ -348,14 +357,17 @@ class dSpatial implements Donnees
return $hydrogene * $nombre; return $hydrogene * $nombre;
} }
public static function credits($id, $nombre, surface $planete) public static function credits($id, $nombre, surface $planete, $race = null)
{ {
return 0; return 0;
} }
public static function temps($id, $nombre, surface $planete) public static function temps($id, $nombre, surface $planete, $race = null)
{ {
if ($planete->race == "humain") { if ($race == null) {
$race = $planete->race;
}
if ($race == "humain") {
switch ($id) { switch ($id) {
case 0: case 0:
$temps = 733; $temps = 733;
@ -502,10 +514,12 @@ class dSpatial implements Donnees
} }
} }
public static function image($id, surface $planete, $race = null)
public static function image($id, surface $planete)
{ {
if ($planete->race == "humain") { if ($race == null) {
$race = $planete->race;
}
if ($race == "humain") {
switch ($id) { switch ($id) {
case 0: case 0:
return "csnucargoparabola2mc9.jpg"; return "csnucargoparabola2mc9.jpg";
@ -542,7 +556,7 @@ class dSpatial implements Donnees
break; break;
} }
return Donnees::image_humain_default; return Donnees::image_humain_default;
} elseif ($planete->race == "covenant") { } else {
switch ($id) { switch ($id) {
case 0: case 0:
return "cargo2pb6.jpg"; return "cargo2pb6.jpg";
@ -553,39 +567,32 @@ class dSpatial implements Donnees
case 2: case 2:
return "colocopiers4.jpg"; return "colocopiers4.jpg";
break; break;
case 3: case 6:
return "sonde_despionnage1.jpg";
break;
case 4:
return "chasseurlourd7id.jpg"; return "chasseurlourd7id.jpg";
break; break;
case 5:
return "contactharvestbynameleszk3.jpg";
break;
case 6:
return "vaisseauuu0.jpg";
break;
case 7: case 7:
return "vaisseaudebataille9na.jpg"; return "sonde_despionnage1.jpg";
break; break;
case 8: case 8:
return "pv.jpg"; return "contactharvestbynameleszk3.jpg";
break; break;
case 9: case 9:
return "stationorbitalezt7.jpg"; return "vaisseauuu0.jpg";
break; break;
case 10: case 10:
return "vaisseaudebataille9na.jpg";
break;
case 14:
return "pv.jpg";
break;
case 16:
return "citecovenant.jpg"; return "citecovenant.jpg";
break; break;
} }
return Donnees::image_covenant_default; return Donnees::image_covenant_default;
} else {
trigger_error("Impossible de trouver la race pour ".$planete->race, E_USER_ERROR);
} }
} }
public static function needed($id, surface $planete, $print = false, $race = null) public static function needed($id, surface $planete, $print = false, $race = null)
{ {
if ($race == null) { if ($race == null) {
@ -733,10 +740,12 @@ class dSpatial implements Donnees
} }
} }
public static function tailleCales($id, surface $planete, $race = null)
public static function tailleCales($id, surface $planete)
{ {
if ($planete->race == "humain") { if ($race == null) {
$race = $planete->race;
}
if ($race == "humain") {
switch ($id) { switch ($id) {
case 0: case 0:
$vitesse = 10000; $vitesse = 10000;
@ -845,7 +854,6 @@ class dSpatial implements Donnees
return $vitesse; return $vitesse;
} }
public static function vitesseP($id, surface $planete) public static function vitesseP($id, surface $planete)
{ {
if ($planete->race == "humain") { if ($planete->race == "humain") {
@ -1178,4 +1186,347 @@ class dSpatial implements Donnees
//On tient compte des bonus //On tient compte des bonus
return $vitesse; return $vitesse;
} }
public static function attaque($id, surface $planete, $race = null)
{
if ($race == null) {
$race = $planete->race;
}
if ($race == "humain") {
switch ($id) {
case 0:
$attaque = 10;
break;
case 1:
$attaque = 20;
break;
case 2:
$attaque = 20;
break;
case 3:
$attaque = 20;
break;
case 4:
$attaque = 50;
break;
case 5:
$attaque = 250;
break;
case 6:
$attaque = 720;
break;
case 7:
$attaque = 1240;
break;
case 8:
$attaque = 1990;
break;
case 9:
$attaque = 3250;
break;
case 10:
$attaque = 4250;
break;
case 11:
$attaque = 8500;
break;
case 12:
$attaque = 16000;
break;
case 13:
$attaque = 20;
break;
default:
trigger_error("Vaisseau ".$id." introuvable dans les données", E_USER_ERROR);
}
} else {
switch ($id) {
case 0:
$attaque = 0;
break;
case 1:
$attaque = 25;
break;
case 2:
$attaque = 25;
break;
case 3:
$attaque = 25;
break;
case 4:
$attaque = 50;
break;
case 5:
$attaque = 100;
break;
case 6:
$attaque = 250;
break;
case 7:
$attaque = 740;
break;
case 8:
$attaque = 1300;
break;
case 9:
$attaque = 2000;
break;
case 10:
$attaque = 3400;
break;
case 11:
$attaque = 4400;
break;
case 12:
$attaque = 9300;
break;
case 13:
$attaque = 8400;
break;
case 14:
$attaque = 8300;
break;
case 15:
$attaque = 11500;
break;
case 16:
$attaque = 0;
break;
default:
trigger_error("Vaisseau ".$id." introuvable dans les données", E_USER_ERROR);
}
}
//On tient compte des bonus
return $attaque;
}
public static function bouclier($id, surface $planete, $race = null)
{
if ($race == null) {
$race = $planete->race;
}
if ($race == "humain") {
switch ($id) {
case 0:
$bouclier = 500;
break;
case 1:
$bouclier = 2000;
break;
case 2:
$bouclier = 2000;
break;
case 3:
$bouclier = 1500;
break;
case 4:
$bouclier = 250;
break;
case 5:
$bouclier = 1000;
break;
case 6:
$bouclier = 1750;
break;
case 7:
$bouclier = 3000;
break;
case 8:
$bouclier = 5000;
break;
case 9:
$bouclier = 9000;
break;
case 10:
$bouclier = 10000;
break;
case 11:
$bouclier = 10250;
break;
case 12:
$bouclier = 12750;
break;
case 13:
$bouclier = 750;
break;
default:
trigger_error("Vaisseau ".$id." introuvable dans les données", E_USER_ERROR);
}
} else {
switch ($id) {
case 0:
$bouclier = 400;
break;
case 1:
$bouclier = 1800;
break;
case 2:
$bouclier = 2000;
break;
case 3:
$bouclier = 400;
break;
case 4:
$bouclier = 200;
break;
case 5:
$bouclier = 300;
break;
case 6:
$bouclier = 900;
break;
case 7:
$bouclier = 1500;
break;
case 8:
$bouclier = 3000;
break;
case 9:
$bouclier = 4600;
break;
case 10:
$bouclier = 8000;
break;
case 11:
$bouclier = 9000;
break;
case 12:
$bouclier = 15000;
break;
case 13:
$bouclier = 10400;
break;
case 14:
$bouclier = 9700;
break;
case 15:
$bouclier = 11500;
break;
case 16:
$bouclier = 50000;
break;
default:
trigger_error("Vaisseau ".$id." introuvable dans les données", E_USER_ERROR);
}
}
//On tient compte des bonus
return $bouclier;
}
public static function armature($id, surface $planete, $race = null)
{
if ($race == null) {
$race = $planete->race;
}
if ($race == "humain") {
switch ($id) {
case 0:
$armature = 100;
break;
case 1:
$armature = 400;
break;
case 2:
$armature = 400;
break;
case 3:
$armature = 300;
break;
case 4:
$armature = 50;
break;
case 5:
$armature = 200;
break;
case 6:
$armature = 350;
break;
case 7:
$armature = 600;
break;
case 8:
$armature = 1000;
break;
case 9:
$armature = 1800;
break;
case 10:
$armature = 2000;
break;
case 11:
$armature = 2050;
break;
case 12:
$armature = 2550;
break;
case 13:
$armature = 150;
break;
default:
trigger_error("Vaisseau ".$id." introuvable dans les données", E_USER_ERROR);
}
} else {
switch ($id) {
case 0:
$armature = 200;
break;
case 1:
$armature = 600;
break;
case 2:
$armature = 800;
break;
case 3:
$armature = 120;
break;
case 4:
$armature = 100;
break;
case 5:
$armature = 150;
break;
case 6:
$armature = 300;
break;
case 7:
$armature = 600;
break;
case 8:
$armature = 600;
break;
case 9:
$armature = 1400;
break;
case 10:
$armature = 2800;
break;
case 11:
$armature = 3000;
break;
case 12:
$armature = 3000;
break;
case 13:
$armature = 3600;
break;
case 14:
$armature = 3600;
break;
case 15:
$armature = 3500;
break;
case 16:
$armature = 30000;
break;
default:
trigger_error("Vaisseau ".$id." introuvable dans les données", E_USER_ERROR);
}
}
//On tient compte des bonus
return $armature;
}
} }

View File

@ -89,7 +89,7 @@ foreach ($planete->casernes as $id => $unite) {
$template->assign('caserne', $TEMP_liste); $template->assign('caserne', $TEMP_liste);
$TEMP_liste = array(); $TEMP_liste = array();
$id = 1; $id = 0;
$max_unite = count($LANG[$race]["terrestre"]["noms_sing"]); $max_unite = count($LANG[$race]["terrestre"]["noms_sing"]);
while ($id <= $max_unite) { while ($id <= $max_unite) {
if (!empty($LANG[$race]["terrestre"]["noms_sing"][$id])) { if (!empty($LANG[$race]["terrestre"]["noms_sing"][$id])) {
@ -103,7 +103,7 @@ while ($id <= $max_unite) {
$template->assign('unites', $TEMP_liste); $template->assign('unites', $TEMP_liste);
$TEMP_liste = array(); $TEMP_liste = array();
$id = 1; $id = 0;
$max_unite = count($LANG[$race]["vaisseaux"]["noms_sing"]); $max_unite = count($LANG[$race]["vaisseaux"]["noms_sing"]);
while ($id <= $max_unite) { while ($id <= $max_unite) {
if (!empty($LANG[$race]["vaisseaux"]["noms_sing"][$id])) { if (!empty($LANG[$race]["vaisseaux"]["noms_sing"][$id])) {

View File

@ -110,12 +110,12 @@ if (isset($_GET['t']) && is_numeric($_GET['t']) && !empty($LANG[$race]["technolo
$template->assign('type', 'vaisseaux'); $template->assign('type', 'vaisseaux');
$t = intval(gpc('v')); $t = intval(gpc('v'));
$template->assign('id', $t); $template->assign('id', $t);
$template->assign('image', dSpatial::image($t, $planete)); $template->assign('image', dSpatial::image($t, $planete, $race));
$template->assign('ressourcesNext', array(dSpatial::metal($t, 1, $planete), dSpatial::cristal($t, 1, $planete), dSpatial::hydrogene($t, 1, $planete), dSpatial::temps($t, 1, $planete))); $template->assign('ressourcesNext', array(dSpatial::metal($t, 1, $planete, $race), dSpatial::cristal($t, 1, $planete, $race), dSpatial::hydrogene($t, 1, $planete, $race), dSpatial::temps($t, 1, $planete, $race)));
$template->assign('etat', dSpatial::needed($t, $planete, $race)); $template->assign('etat', dSpatial::needed($t, $planete, $race));
$template->assign('caract', array($nomvais_at[$t], $nomvais_bc[$t], $nomvais_pv[$t], $nomvais_rs[$t])); $template->assign('caract', array(dSpatial::attaque($t, $planete, $race), dSpatial::bouclier($t, $planete, $race), dSpatial::armature($t, $planete, $race), dSpatial::tailleCales($t, $planete, $race)));
} elseif (isset($_GET['d']) && is_numeric($_GET['d']) && !empty($LANG[$race]["terrestre"]["noms_sing"][$_GET['d']])) { } elseif (isset($_GET['d']) && is_numeric($_GET['d']) && !empty($LANG[$race]["terrestre"]["noms_sing"][$_GET['d']])) {
$template->assign('type', 'terrestre'); $template->assign('type', 'terrestre');
$t = gpc('d'); $t = gpc('d');