From dc476e73a1ee7811cf8a279f711c6f41fb54f8f0 Mon Sep 17 00:00:00 2001 From: Hide_D Date: Wed, 22 Jan 2025 16:54:27 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=B3=91=EC=A2=85=20=EA=B2=80=EC=82=AC?= =?UTF-8?q?=EC=97=90=EC=84=9C=20$nation['aux']=EB=A5=BC=20=EC=A0=95?= =?UTF-8?q?=EC=8B=9D=20=EC=9E=85=EB=A0=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/sammo/Command/General/che_징병.php | 4 ++-- hwe/sammo/Constraint/AvailableRecruitCrewType.php | 10 ++++++++-- hwe/sammo/GameUnitDetail.php | 2 +- hwe/sammo/GeneralAI.php | 4 ++-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/hwe/sammo/Command/General/che_징병.php b/hwe/sammo/Command/General/che_징병.php index 602491ee..1afac212 100644 --- a/hwe/sammo/Command/General/che_징병.php +++ b/hwe/sammo/Command/General/che_징병.php @@ -79,7 +79,7 @@ class che_징병 extends Command\GeneralCommand protected function init() { $this->setCity(); - $this->setNation(['tech']); + $this->setNation(['tech', 'aux']); $this->minConditionConstraints = [ ConstraintHelper::NotBeNeutral(), @@ -288,7 +288,7 @@ class che_징병 extends Command\GeneralCommand $reqMinRelYearObj = $unit->reqConstraints['reqMinRelYear'] ?? null; $crewObj->reqYear = $reqMinRelYearObj ? $reqMinRelYearObj->reqMinRelYear : 0; - $crewObj->notAvailable = !$unit->isValid($general, $ownCities, $ownRegions, $relativeYear, $tech); + $crewObj->notAvailable = !$unit->isValid($general, $ownCities, $ownRegions, $relativeYear, $tech, $this->nation['aux']); $crewObj->baseRice = $general->onCalcDomestic($this->getName(), 'rice', $unit->riceWithTech($tech), ['armType' => $unit->armType]); $crewObj->baseCost = $general->onCalcDomestic($this->getName(), 'cost', $unit->costWithTech($tech), ['armType' => $unit->armType]); diff --git a/hwe/sammo/Constraint/AvailableRecruitCrewType.php b/hwe/sammo/Constraint/AvailableRecruitCrewType.php index d4dcf4e4..c78c3155 100644 --- a/hwe/sammo/Constraint/AvailableRecruitCrewType.php +++ b/hwe/sammo/Constraint/AvailableRecruitCrewType.php @@ -6,9 +6,10 @@ use \sammo\GameUnitConst; use \sammo\DB; use \sammo\KVStorage; use \sammo\CityConst; +use sammo\Json; class AvailableRecruitCrewType extends Constraint{ - const REQ_VALUES = Constraint::REQ_NATION|Constraint::REQ_INT_ARG; + const REQ_VALUES = Constraint::REQ_GENERAL|Constraint::REQ_NATION|Constraint::REQ_INT_ARG; public function checkInputValues(bool $throwExeception=true):bool{ if(!parent::checkInputValues($throwExeception) && !$throwExeception){ @@ -52,8 +53,13 @@ class AvailableRecruitCrewType extends Constraint{ $ownRegions[CityConst::byId($ownCity)->region] = 1; } + $nationAux = $this->nation['aux'] ?? null; + if($nationAux === null){ + $nationAux = Json::decode($db->queryFirstField('SELECT aux FROM nation WHERE id = %i', $nationID) ?? "{}"); + } + $crewType = GameUnitConst::byID($this->arg); - if($crewType->isValid($ownCities, $ownRegions, $year - $startyear, $tech)){ + if($crewType->isValid($this->generalObj, $ownCities, $ownRegions, $year - $startyear, $tech, $nationAux)){ return true; } diff --git a/hwe/sammo/GameUnitDetail.php b/hwe/sammo/GameUnitDetail.php index 85cda4fb..9976b892 100644 --- a/hwe/sammo/GameUnitDetail.php +++ b/hwe/sammo/GameUnitDetail.php @@ -189,7 +189,7 @@ class GameUnitDetail implements iAction return $defaultWar; } - public function isValid(General $general, $ownCities, $ownRegions, $relativeYear, $tech, $nationAux = []) + public function isValid(General $general, $ownCities, $ownRegions, $relativeYear, $tech, $nationAux) { //음수 없음 $relativeYear = max(0, $relativeYear); diff --git a/hwe/sammo/GeneralAI.php b/hwe/sammo/GeneralAI.php index f5d79c08..0cb3f9be 100644 --- a/hwe/sammo/GeneralAI.php +++ b/hwe/sammo/GeneralAI.php @@ -2570,7 +2570,7 @@ class GeneralAI $types = []; foreach (GameUnitConst::byType($armType) as $crewtype) { - if ($crewtype->isValid($general, $cities, $regions, $relYear, $tech)) { + if ($crewtype->isValid($general, $cities, $regions, $relYear, $tech, $this->nation['aux'])) { $score = $crewtype->pickScore($tech); $types[$crewtype->id] = $score; } @@ -2584,7 +2584,7 @@ class GeneralAI if ($this->generalPolicy->can고급병종) { $currCrewType = $general->getCrewTypeObj(); - if ($currCrewType->isValid($general, $cities, $regions, $relYear, $tech)) { + if ($currCrewType->isValid($general, $cities, $regions, $relYear, $tech, $this->nation['aux'])) { $reqTechObj = $currCrewType->reqConstraints['reqTech'] ?? null; if($reqTechObj){ $reqTech = $reqTechObj->getValue($tech);