name = $name; $this->armType = $armType; $this->attack = $attack; $this->defence = $defence; $this->speed = $speed; $this->avoid = $avoid; $this->cost = $cost; $this->rice = $rice; $this->reqTech = $reqTech; $this->reqCities = $reqCities; $this->reqRegions = $reqRegions; $this->reqYear = $reqYear; $this->info = $info; } public function isValid($ownCities, $ownRegions, $relativeYear, $tech){ if($relativeYear < $this->reqYear){ return false; } if($tech < $this->reqTech){ return false; } if($this->reqCities !== null){ $valid = false; foreach($this->reqCities as $reqCity){ if(\key_exists($reqCity, $ownCities)){ $valid = true; break; } } if(!$valid){ return false; } } if($this->reqRegions !== null){ $valid = false; foreach($this->reqRegions as $reqRegion){ if(\key_exists($reqRegion, $ownRegions)){ $valid = true; break; } } if(!$valid){ return false; } } return true; } }