feat(wip): GameUnitConstrint
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace sammo\GameUnitConstraint;
|
||||
|
||||
use sammo\General;
|
||||
|
||||
class ReqMinRelYear extends BaseGameUnitConstraint {
|
||||
|
||||
public function __construct(protected int $reqMinRelYear)
|
||||
{
|
||||
}
|
||||
|
||||
public function test(General $general, array $ownCities, array $ownRegions, int $relativeYear, int $tech, array $nationAux): bool
|
||||
{
|
||||
return $relativeYear >= $this->reqMinRelYear;
|
||||
}
|
||||
|
||||
public function getInfo(): string
|
||||
{
|
||||
return "{$this->reqMinRelYear}년 경과 후 사용 가능";
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
if($reqTech > 0){
|
||||
$info[] = "기술력 {$reqTech} 이상 필요";
|
||||
}
|
||||
|
||||
if($reqCities !== null){
|
||||
$reqCities = array_map(function($reqCity) use (&$info){
|
||||
$info[] = "{$reqCity} 소유시 가능";
|
||||
return CityConst::byName($reqCity)->id;
|
||||
}, $reqCities);
|
||||
}
|
||||
|
||||
if($reqRegions !== null){
|
||||
$reqRegions = array_map(function($reqRegion) use (&$info){
|
||||
$info[] = "{$reqRegion} 지역 소유시 가능";
|
||||
return CityConst::$regionMap[$reqRegion];
|
||||
}, $reqRegions);
|
||||
}
|
||||
|
||||
*/
|
||||
Reference in New Issue
Block a user