- GameUnitDetail의 요구 기술, 지역, 도시, 연도를 GameUnitConstraint로 통합 - GameUnitConstraint는 조건 검사, 설명 제공 - 병종 정의를 GameUnitConstraint 이용 재정의 - test 함수에 General 객체 요구, - test 함수의 ownCities에 단순 도시 외 도시 정보 추가 - 변경된 값에 맞게 호출 함수 변경
26 lines
560 B
PHP
26 lines
560 B
PHP
<?php
|
|
|
|
namespace sammo\GameUnitConstraint;
|
|
|
|
use sammo\General;
|
|
use sammo\KVStorage;
|
|
|
|
class ReqTech extends BaseGameUnitConstraint {
|
|
|
|
public function __construct(public readonly int $reqTech)
|
|
{
|
|
}
|
|
|
|
public function test(General $general, array $ownCities, array $ownRegions, int $relativeYear, int $tech, array $nationAux): bool
|
|
{
|
|
if ($tech < $this->reqTech) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public function getInfo(): string
|
|
{
|
|
return "기술력 {$this->reqTech} 이상 필요";
|
|
}
|
|
} |