diff --git a/hwe/sammo/Command/General/che_임관.php b/hwe/sammo/Command/General/che_임관.php index aab1c42c..8ebea4b7 100644 --- a/hwe/sammo/Command/General/che_임관.php +++ b/hwe/sammo/Command/General/che_임관.php @@ -190,7 +190,6 @@ class che_임관 extends Command\GeneralCommand{ public function getForm(): string { $db = DB::db(); - $form = []; $generalObj = $this->generalObj; diff --git a/hwe/sammo/Command/Nation/che_선전포고.php b/hwe/sammo/Command/Nation/che_선전포고.php index 305f0e59..f9eea96a 100644 --- a/hwe/sammo/Command/Nation/che_선전포고.php +++ b/hwe/sammo/Command/Nation/che_선전포고.php @@ -16,6 +16,8 @@ use function \sammo\{ getDomesticExpLevelBonus, CriticalRatioDomestic, CriticalScoreEx, + getAllNationStaticInfo, + getNationStaticInfo, GetImageURL }; @@ -73,6 +75,7 @@ class che_선전포고 extends Command\NationCommand{ ConstraintHelper::OccupiedCity(), ConstraintHelper::SuppliedCity(), ConstraintHelper::ExistsDestNation(), + ConstraintHelper::NearNation(), ConstraintHelper::DisallowDiplomacyBetweenStatus([ 0 => '아국과 이미 교전중입니다.', 1 => '아국과 이미 선포중입니다.', @@ -98,6 +101,12 @@ class che_선전포고 extends Command\NationCommand{ return 0; } + public function getBrief():string{ + $commandName = $this->getName(); + $destNationName = getNationStaticInfo($this->arg['destNationID'])['name']; + return "【{$destNationName}】에 {$commandName}"; + } + public function run():bool{ if(!$this->isRunnable()){ @@ -126,7 +135,7 @@ class che_선전포고 extends Command\NationCommand{ $logger = $general->getLogger(); $destLogger = new ActionLogger(0, $destNationID, $env['year'], $env['month']); - $logger->pushGeneralActionLog("{$destNationName}으로 선전 포고 했습니다.<1>$date"); + $logger->pushGeneralActionLog("{$destNationName}에 선전 포고 했습니다.<1>$date"); $logger->pushNationalHistoryLog("{$generalName}{$josaYi} {$destNationName}에 선전 포고"); $destLogger->pushNationalHistoryLog("{$nationName}{$generalName}{$josaYi} 아국에 선전 포고"); @@ -183,10 +192,43 @@ class che_선전포고 extends Command\NationCommand{ public function getForm(): string { - $form = []; - $form[] = \sammo\getMapHtml(); + $generalObj = $this->generalObj; + $nationID = $generalObj->getNationID(); + $startYear = $this->env['startyear']; + $availableYear = $startYear + 1; + $nationList = []; + foreach(getAllNationStaticInfo() as $destNation){ + if($destNation['nation'] == $nationID){ + continue; + } + $testCommand = new static($generalObj, $this->env, $this->getLastTurn(), ['destNationID'=>$destNation['nation']]); + if($testCommand->isRunnable()){ + $destNation['availableWar'] = true; + } + else{ + $destNation['availableWar'] = false; + } - return join("\n",$form); + $nationList[] = $destNation; + } + + ob_start(); +?> +타국에게 선전 포고합니다.
+선전 포고할 국가를 목록에서 선택하세요.
+고립되지 않은 아국 도시에서 인접한 국가에 선포 가능합니다.
+초반제한 해제 2년전부터 선포가 가능합니다. (년 1월부터 가능)
+현재 선포가 불가능한 국가는 배경색이 붉은색으로 표시됩니다.
+ +nation)){ + if(!$throwExeception){return false; } + throw new \InvalidArgumentException("require capital in nation"); + } + + if(!key_exists('capital', $this->destNation)){ + if(!$throwExeception){return false; } + throw new \InvalidArgumentException("require capital in destNation"); + } + + return true; + } + + public function test():bool{ + $this->checkInputValues(); + $this->tested = true; + + $srcCityID = $this->nation['capital']; + $srcNationID = $this->nation['nation']; + + $destCityID = $this->destNation['capital']; + $destNationID = $this->destNation['nation']; + + $dist = \sammo\searchDistanceListToDest($srcCityID, $destCityID, [$srcNationID, $destNationID]); + + if(!$dist){ + $this->reason = "인접 국가가 아닙니다."; + return false; + } + + return false; + } +} \ No newline at end of file