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);