feat(wip): GameUnitConstrint
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace sammo\GameUnitConstraint;
|
||||
|
||||
use sammo\CityConst;
|
||||
use sammo\General;
|
||||
|
||||
class ReqRegions extends BaseGameUnitConstraint {
|
||||
|
||||
public function __construct(protected array $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} 지역 소유시 가능";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user