diff --git a/hwe/sammo/API/Global/GetConst.php b/hwe/sammo/API/Global/GetConst.php index f8f1571d..951f71c3 100644 --- a/hwe/sammo/API/Global/GetConst.php +++ b/hwe/sammo/API/Global/GetConst.php @@ -261,7 +261,7 @@ class GetConst extends \sammo\BaseAPI $crewtypeMap[$crewtypeObj->id] = [ 'value'=>(string)$crewtypeObj->id, 'name'=>$crewtypeObj->name, - 'info'=>$crewtypeObj->getInfoArr(), + 'info'=>$crewtypeObj->info, ]; } $iActionInfo['crewtype'] = $crewtypeMap; diff --git a/hwe/sammo/Command/General/che_징병.php b/hwe/sammo/Command/General/che_징병.php index 1e926d18..602491ee 100644 --- a/hwe/sammo/Command/General/che_징병.php +++ b/hwe/sammo/Command/General/che_징병.php @@ -276,7 +276,6 @@ class che_징병 extends Command\GeneralCommand 'values' => [], ]; - $crewTypes = []; foreach (GameUnitConst::byType($armType) as $unit) { $crewObj = new \stdClass; @@ -289,14 +288,6 @@ class che_징병 extends Command\GeneralCommand $reqMinRelYearObj = $unit->reqConstraints['reqMinRelYear'] ?? null; $crewObj->reqYear = $reqMinRelYearObj ? $reqMinRelYearObj->reqMinRelYear : 0; - /* - if ($unit->reqTech == 0) { - $crewObj->bgcolor = 'green'; - } else { - $crewObj->bgcolor = 'limegreen'; - } - */ - $crewObj->notAvailable = !$unit->isValid($general, $ownCities, $ownRegions, $relativeYear, $tech); $crewObj->baseRice = $general->onCalcDomestic($this->getName(), 'rice', $unit->riceWithTech($tech), ['armType' => $unit->armType]); @@ -313,7 +304,7 @@ class che_징병 extends Command\GeneralCommand $crewObj->img = ServConfig::$gameImagePath . "/crewtype" . $unit->id . ".png"; } - $crewObj->info = $unit->getInfoArr(); + $crewObj->info = $unit->info; $armCrewType['values'][] = $crewObj; } diff --git a/hwe/sammo/GameUnitConstBase.php b/hwe/sammo/GameUnitConstBase.php index 3c1c3478..c90d1fef 100644 --- a/hwe/sammo/GameUnitConstBase.php +++ b/hwe/sammo/GameUnitConstBase.php @@ -442,6 +442,11 @@ class GameUnitConstBase{ $iActionList, ] = $rawUnit; + foreach($reqConstraints as $constraint){ + /** @var \sammo\GameUnitConstraint\BaseGameUnitConstraint $constraint */ + $info[] = $constraint->getInfo(); + } + $unit = new GameUnitDetail( $id, $armType, diff --git a/hwe/sammo/GameUnitDetail.php b/hwe/sammo/GameUnitDetail.php index 4c522a6a..85cda4fb 100644 --- a/hwe/sammo/GameUnitDetail.php +++ b/hwe/sammo/GameUnitDetail.php @@ -26,7 +26,6 @@ class GameUnitDetail implements iAction public $iActionList; public array $reqConstraints; - protected ?array $info = null; public function __construct( int $id, @@ -42,7 +41,7 @@ class GameUnitDetail implements iAction array $reqConstraints, array $attackCoef, array $defenceCoef, - public readonly array $baseInfo, + public readonly array $info, ?array $initSkillTrigger, ?array $phaseSkillTrigger, ?array $iActionList, @@ -76,22 +75,9 @@ class GameUnitDetail implements iAction } } - public function getInfoArr(): array { - if($this->info !== null){ - return $this->info; - } - - $info = $this->baseInfo; - foreach ($this->reqConstraints as $constraint) { - $info[] = $constraint->getInfo(); - } - $this->info = $info; - return $this->info; - } - public function getInfo(): string { - return join("\n
", $this->getInfoArr()); + return join("\n
", $this->info); } public function getShortName(): string diff --git a/hwe/ts/defs/GameObj.ts b/hwe/ts/defs/GameObj.ts index ad21e2c2..95fac373 100644 --- a/hwe/ts/defs/GameObj.ts +++ b/hwe/ts/defs/GameObj.ts @@ -176,10 +176,7 @@ export type GameUnitType = { magicCoef: number; cost: number; rice: number; - reqTech: number; - reqCities: CityID[] | null; - reqRegions: MapRegionID[] | null; - reqYear: number; + reqConstraints: Record[]; attackCoef: Record | null | []; defenceCoef: Record | null | []; info: string | string[];