feat: 병종 검사에서 $nation['aux']를 정식 입력
This commit is contained in:
@@ -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]);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user