id = $plan["id"]; $this->metal = $plan["metal"]; $this->cristal = $plan["cristal"]; $this->hydrogene = $plan["hydrogene"]; foreach($batimentVAR as $bat){ $this->batiments[] = $plan[$bat]; } foreach($casernenVAR as $cas){ $this->casernes[] = $plan[$cas]; } foreach($nomterrnVAR as $ter){ $this->terrestres[] = $plan[$ter]; } foreach($nomvaisnVAR as $vais){ $this->vaisseaux[] = $plan[$vais]; } } function calculerBatiments(){ global $batimentCALC; $pointsbat = 0; $planete = $this; foreach($this->batiments as $k => $n){ eval($batimentCALC[$k][0]); eval($batimentCALC[$k][1]); eval($batimentCALC[$k][2]); $pointsbat += $a + $b + $c; } return $pointsbat; } function calculerCasernes(){ global $casernenCALC; $pointscas = 0; foreach($this->casernes as $k => $n){ $pointscas += ($casernenCALC[$k][0] + $casernenCALC[$k][1] + $casernenCALC[$k][2]) * $n; } return $pointscas; } function calculerTerrestres(){ global $nomterrnCALC; $pointster = 0; foreach($this->terrestres as $k => $n){ $pointster += ($nomterrnCALC[$k][0] + $nomterrnCALC[$k][1] + $nomterrnCALC[$k][2]) * $n; } return $pointster; } function calculerVaisseaux(){ global $nomvaisnCALC; $pointsvai = 0; foreach($this->vaisseaux as $k => $n){ $pointsvai += ($nomvaisnCALC[$k][0] + $nomvaisnCALC[$k][1] + $nomvaisnCALC[$k][2]) * $n; } return $pointsvai; } } ?>