fix: ReqCities, ReqRegion 버그
This commit is contained in:
@@ -26,7 +26,7 @@ class GameUnitDetail implements iAction
|
||||
public $iActionList;
|
||||
public array $reqConstraints;
|
||||
|
||||
protected ?string $info;
|
||||
protected ?array $info = null;
|
||||
|
||||
public function __construct(
|
||||
int $id,
|
||||
@@ -42,6 +42,7 @@ class GameUnitDetail implements iAction
|
||||
array $reqConstraints,
|
||||
array $attackCoef,
|
||||
array $defenceCoef,
|
||||
public readonly array $baseInfo,
|
||||
?array $initSkillTrigger,
|
||||
?array $phaseSkillTrigger,
|
||||
?array $iActionList,
|
||||
@@ -75,20 +76,24 @@ class GameUnitDetail implements iAction
|
||||
}
|
||||
}
|
||||
|
||||
public function getInfo(): string
|
||||
{
|
||||
public function getInfoArr(): array {
|
||||
if($this->info !== null){
|
||||
return $this->info;
|
||||
}
|
||||
|
||||
$info = [];
|
||||
$info = $this->baseInfo;
|
||||
foreach ($this->reqConstraints as $constraint) {
|
||||
$info[] = $constraint->getInfo();
|
||||
}
|
||||
$this->info = join("\n<br>", $info);
|
||||
$this->info = $info;
|
||||
return $this->info;
|
||||
}
|
||||
|
||||
public function getInfo(): string
|
||||
{
|
||||
return join("\n<br>", $this->getInfoArr());
|
||||
}
|
||||
|
||||
public function getShortName(): string
|
||||
{
|
||||
return StringUtil::subStringForWidth($this->name, 0, 4);
|
||||
@@ -198,13 +203,13 @@ class GameUnitDetail implements iAction
|
||||
return $defaultWar;
|
||||
}
|
||||
|
||||
public function isValid($ownCities, $ownRegions, $relativeYear, $tech)
|
||||
public function isValid(General $general, $ownCities, $ownRegions, $relativeYear, $tech, $nationAux = [])
|
||||
{
|
||||
//음수 없음
|
||||
$relativeYear = max(0, $relativeYear);
|
||||
|
||||
foreach($this->reqConstraints as $constraint){
|
||||
if(!$constraint->test($ownCities, $ownRegions, $relativeYear, $tech)){
|
||||
if(!$constraint->test($general, $ownCities, $ownRegions, $relativeYear, $tech, $nationAux)){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user