fix: GameUnitDetail의 info를 기존방식으로 변경
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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<br>", $this->getInfoArr());
|
||||
return join("\n<br>", $this->info);
|
||||
}
|
||||
|
||||
public function getShortName(): string
|
||||
|
||||
@@ -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<string, unknown>[];
|
||||
attackCoef: Record<CrewTypeID | ArmTypeID, number> | null | [];
|
||||
defenceCoef: Record<CrewTypeID | ArmTypeID, number> | null | [];
|
||||
info: string | string[];
|
||||
|
||||
Reference in New Issue
Block a user