38 lines
938 B
PHP
38 lines
938 B
PHP
<?php
|
|
|
|
namespace sammo\GameUnitConstraint;
|
|
|
|
use sammo\CityConst;
|
|
use sammo\General;
|
|
|
|
class ReqRegions extends BaseGameUnitConstraint {
|
|
|
|
public readonly array $reqRegions;
|
|
public function __construct(...$reqRegions)
|
|
{
|
|
$this->reqRegions = $reqRegions;
|
|
}
|
|
|
|
public function test(General $general, array $ownCities, array $ownRegions, int $relativeYear, int $tech, array $nationAux): bool
|
|
{
|
|
foreach ($this->reqRegions as $region) {
|
|
if (key_exists($region, $ownRegions)) {
|
|
return true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
public function getInfo(): string
|
|
{
|
|
$regionNames = [];
|
|
foreach ($this->reqRegions as $region) {
|
|
$regionNames[] = CityConst::$regionMap[$region];
|
|
}
|
|
|
|
$regionNameText = implode(', ', $regionNames);
|
|
return "{$regionNameText} 지역 소유시 가능";
|
|
}
|
|
} |