From 6c5c2d40bc933aa44295a7528f9b65fe74f97f5b Mon Sep 17 00:00:00 2001 From: hide_d Date: Sun, 21 Oct 2018 14:28:29 +0900 Subject: [PATCH] =?UTF-8?q?argTest=EB=A5=BC=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EC=88=9C=EC=84=9C=EC=97=90=20=EB=A7=9E=EA=B2=8C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/sammo/Command/General/che_NPC능동.php | 20 +++--- hwe/sammo/Command/General/che_강행.php | 28 ++++---- hwe/sammo/Command/General/che_견문.php | 10 +-- hwe/sammo/Command/General/che_군량매매.php | 36 +++++----- hwe/sammo/Command/General/che_귀환.php | 10 +-- hwe/sammo/Command/General/che_기술연구.php | 10 +-- hwe/sammo/Command/General/che_단련.php | 10 +-- hwe/sammo/Command/General/che_등용.php | 42 +++++------ hwe/sammo/Command/General/che_물자조달.php | 10 +-- hwe/sammo/Command/General/che_사기진작.php | 10 +-- hwe/sammo/Command/General/che_상업투자.php | 10 +-- hwe/sammo/Command/General/che_소집해제.php | 12 ++-- hwe/sammo/Command/General/che_요양.php | 10 +-- hwe/sammo/Command/General/che_이동.php | 26 +++---- hwe/sammo/Command/General/che_장비매매.php | 38 +++++----- hwe/sammo/Command/General/che_전투태세.php | 10 +-- hwe/sammo/Command/General/che_정착장려.php | 10 +-- hwe/sammo/Command/General/che_주민선정.php | 10 +-- hwe/sammo/Command/General/che_증여.php | 82 ++++++++++------------ hwe/sammo/Command/General/che_집합.php | 10 +-- hwe/sammo/Command/General/che_징병.php | 60 ++++++++-------- hwe/sammo/Command/General/che_첩보.php | 26 +++---- hwe/sammo/Command/General/che_출병.php | 26 +++---- hwe/sammo/Command/General/che_헌납.php | 52 ++++++-------- hwe/sammo/Command/General/che_훈련.php | 10 +-- hwe/sammo/Command/General/휴식.php | 8 +-- hwe/sammo/Command/Nation/휴식.php | 7 +- 27 files changed, 289 insertions(+), 304 deletions(-) diff --git a/hwe/sammo/Command/General/che_NPC능동.php b/hwe/sammo/Command/General/che_NPC능동.php index cd5b5f5d..1e02e260 100644 --- a/hwe/sammo/Command/General/che_NPC능동.php +++ b/hwe/sammo/Command/General/che_NPC능동.php @@ -16,16 +16,6 @@ use \sammo\Constraint\Constraint; class che_NPC능동 extends Command\GeneralCommand{ static protected $actionName = 'NPC능동'; - protected function init(){ - - $general = $this->generalObj; - - $this->runnableConstraints=[ - ['MustBeNPC'] - ]; - - } - protected function argTest():bool{ if(!key_exists('optionText', $this->arg)){ return false; @@ -48,6 +38,16 @@ class che_NPC능동 extends Command\GeneralCommand{ return false; } + protected function init(){ + + $general = $this->generalObj; + + $this->runnableConstraints=[ + ['MustBeNPC'] + ]; + + } + public function getCost():array{ return [0, 0]; } diff --git a/hwe/sammo/Command/General/che_강행.php b/hwe/sammo/Command/General/che_강행.php index 3e2d6cdb..47f281ef 100644 --- a/hwe/sammo/Command/General/che_강행.php +++ b/hwe/sammo/Command/General/che_강행.php @@ -23,6 +23,19 @@ use sammo\CityConst; class che_강행 extends Command\GeneralCommand{ static protected $actionName = '강행'; + protected function argTest():bool{ + if(!key_exists('destCityID', $this->arg)){ + return false; + } + if(!key_exists($this->arg['destCityID'], CityConst::all())){ + return false; + } + $this->arg = [ + 'destCityID'=>$this->arg['destCityID'] + ]; + return true; + } + protected function init(){ $general = $this->generalObj; @@ -40,20 +53,7 @@ class che_강행 extends Command\GeneralCommand{ ['ReqGeneralRice', $reqRice], ]; } - - protected function argTest():bool{ - if(!key_exists('destCityID', $this->arg)){ - return false; - } - if(!key_exists($this->arg['destCityID'], CityConst::all())){ - return false; - } - $this->arg = [ - 'destCityID'=>$this->arg['destCityID'] - ]; - return true; - } - + public function getCost():array{ $env = $this->env; return [$env['develcost'] * 5, 0]; diff --git a/hwe/sammo/Command/General/che_견문.php b/hwe/sammo/Command/General/che_견문.php index 5265e2c9..0ebe35b4 100644 --- a/hwe/sammo/Command/General/che_견문.php +++ b/hwe/sammo/Command/General/che_견문.php @@ -21,6 +21,11 @@ use \sammo\TextDecoration\SightseeingMessage; class che_견문 extends Command\GeneralCommand{ static protected $actionName = '견문'; + + protected function argTest():bool{ + $this->arg = null; + return true; + } protected function init(){ @@ -31,11 +36,6 @@ class che_견문 extends Command\GeneralCommand{ } - protected function argTest():bool{ - $this->arg = null; - return true; - } - public function getCost():array{ return [0, 0]; } diff --git a/hwe/sammo/Command/General/che_군량매매.php b/hwe/sammo/Command/General/che_군량매매.php index 11241c16..6f76ff7c 100644 --- a/hwe/sammo/Command/General/che_군량매매.php +++ b/hwe/sammo/Command/General/che_군량매매.php @@ -33,6 +33,24 @@ class che_군량매매 extends Command\GeneralCommand{ 'item'=>'도구', ]; + protected function argTest():bool{ + $buyRice = $this->arg['buyRice']??null; + if(!is_bool($buyRice)){ + return false; + } + $amount = $this->arg['amount']??null; + if(!is_int($amount)){ + return false; + } + $amount = Util::valueFit($amount, 100, 10000); + + $this->arg = [ + 'buyRice'=>$buyRice, + 'amount'=>$amount + ]; + return true; + } + protected function init(){ $general = $this->generalObj; @@ -54,24 +72,6 @@ class che_군량매매 extends Command\GeneralCommand{ } } - protected function argTest():bool{ - $buyRice = $this->arg['buyRice']??null; - if(!is_bool($buyRice)){ - return false; - } - $amount = $this->arg['amount']??null; - if(!is_int($amount)){ - return false; - } - $amount = Util::valueFit($amount, 100, 10000); - - $this->arg = [ - 'buyRice'=>$buyRice, - 'amount'=>$amount - ]; - return true; - } - public function getCost():array{ return [0, 0]; } diff --git a/hwe/sammo/Command/General/che_귀환.php b/hwe/sammo/Command/General/che_귀환.php index af23cb72..7a398173 100644 --- a/hwe/sammo/Command/General/che_귀환.php +++ b/hwe/sammo/Command/General/che_귀환.php @@ -23,6 +23,11 @@ use sammo\CityConst; class che_귀환 extends Command\GeneralCommand{ static protected $actionName = '귀환'; + protected function argTest():bool{ + $this->arg = null; + return true; + } + protected function init(){ $general = $this->generalObj; @@ -39,11 +44,6 @@ class che_귀환 extends Command\GeneralCommand{ ]; } - protected function argTest():bool{ - $this->arg = null; - return true; - } - public function getCost():array{ return [0, 0]; } diff --git a/hwe/sammo/Command/General/che_기술연구.php b/hwe/sammo/Command/General/che_기술연구.php index 02465356..2d623c20 100644 --- a/hwe/sammo/Command/General/che_기술연구.php +++ b/hwe/sammo/Command/General/che_기술연구.php @@ -25,6 +25,11 @@ class che_기술연구 extends che_상업투자{ static protected $actionKey = '기술'; static protected $actionName = '기술 연구'; + protected function argTest():bool{ + $this->arg = null; + return true; + } + protected function init(){ $general = $this->generalObj; @@ -46,11 +51,6 @@ class che_기술연구 extends che_상업투자{ $this->reqGold = $reqGold; } - protected function argTest():bool{ - $this->arg = null; - return true; - } - public function run():bool{ if(!$this->isRunnable()){ throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도'); diff --git a/hwe/sammo/Command/General/che_단련.php b/hwe/sammo/Command/General/che_단련.php index 69c55146..479b8ad5 100644 --- a/hwe/sammo/Command/General/che_단련.php +++ b/hwe/sammo/Command/General/che_단련.php @@ -22,6 +22,11 @@ use \sammo\Constraint\Constraint; class che_단련 extends Command\GeneralCommand{ static protected $actionName = '단련'; + protected function argTest():bool{ + $this->arg = null; + return true; + } + protected function init(){ $general = $this->generalObj; @@ -42,11 +47,6 @@ class che_단련 extends Command\GeneralCommand{ } - protected function argTest():bool{ - $this->arg = null; - return true; - } - public function getCost():array{ $env = $this->env; return [$env['develcost'], $env['develcost']]; diff --git a/hwe/sammo/Command/General/che_등용.php b/hwe/sammo/Command/General/che_등용.php index 09a1d3ed..0cbe0bd0 100644 --- a/hwe/sammo/Command/General/che_등용.php +++ b/hwe/sammo/Command/General/che_등용.php @@ -25,6 +25,27 @@ use \sammo\Constraint\Constraint; class che_등용 extends Command\GeneralCommand{ static protected $actionName = '등용'; + protected function argTest():bool{ + //NOTE: 사망 직전에 '등용' 턴을 넣을 수 있으므로, 존재하지 않는 장수여도 argTest에서 바로 탈락시키지 않음 + if(!key_exists('destGeneralID', $this->arg)){ + return false; + } + $destGeneralID = $this->arg['destGeneralID']; + if(!is_int($destGeneralID)){ + return false; + } + if($destGeneralID <= 0){ + return false; + } + if($destGeneralID == $this->generalObj->getID()){ + return false; + } + $this->arg = [ + 'destGeneralID'=>$destGeneralID + ]; + return true; + } + protected function init(){ $general = $this->generalObj; @@ -58,27 +79,6 @@ class che_등용 extends Command\GeneralCommand{ } } - protected function argTest():bool{ - //NOTE: 사망 직전에 '등용' 턴을 넣을 수 있으므로, 존재하지 않는 장수여도 argTest에서 바로 탈락시키지 않음 - if(!key_exists('destGeneralID', $this->arg)){ - return false; - } - $destGeneralID = $this->arg['destGeneralID']; - if(!is_int($destGeneralID)){ - return false; - } - if($destGeneralID <= 0){ - return false; - } - if($destGeneralID == $this->generalObj->getID()){ - return false; - } - $this->arg = [ - 'destGeneralID'=>$destGeneralID - ]; - return true; - } - public function getCost():array{ $env = $this->env; if(!$this->isArgValid){ diff --git a/hwe/sammo/Command/General/che_물자조달.php b/hwe/sammo/Command/General/che_물자조달.php index 62a71005..4ef473d8 100644 --- a/hwe/sammo/Command/General/che_물자조달.php +++ b/hwe/sammo/Command/General/che_물자조달.php @@ -24,6 +24,11 @@ use \sammo\Constraint\Constraint; class che_물자조달 extends Command\GeneralCommand{ static protected $actionName = '물자조달'; + protected function argTest():bool{ + $this->arg = null; + return true; + } + protected function init(){ $general = $this->generalObj; @@ -40,11 +45,6 @@ class che_물자조달 extends Command\GeneralCommand{ } - protected function argTest():bool{ - $this->arg = null; - return true; - } - public function getCost():array{ return [0, 0]; } diff --git a/hwe/sammo/Command/General/che_사기진작.php b/hwe/sammo/Command/General/che_사기진작.php index d83b701f..b00b091f 100644 --- a/hwe/sammo/Command/General/che_사기진작.php +++ b/hwe/sammo/Command/General/che_사기진작.php @@ -21,6 +21,11 @@ use \sammo\Constraint\Constraint; class che_사기진작 extends Command\GeneralCommand{ static protected $actionName = '사기진작'; + protected function argTest():bool{ + $this->arg = null; + return true; + } + protected function init(){ $general = $this->generalObj; @@ -42,11 +47,6 @@ class che_사기진작 extends Command\GeneralCommand{ } - protected function argTest():bool{ - $this->arg = null; - return true; - } - public function getCost():array{ return [Util::round($this->getVar('crew')/100), 0]; } diff --git a/hwe/sammo/Command/General/che_상업투자.php b/hwe/sammo/Command/General/che_상업투자.php index 116d499b..286b7e4f 100644 --- a/hwe/sammo/Command/General/che_상업투자.php +++ b/hwe/sammo/Command/General/che_상업투자.php @@ -28,6 +28,11 @@ class che_상업투자 extends Command\GeneralCommand{ static protected $actionName = '상업 투자'; static protected $debuffFront = 0.5; + protected function argTest():bool{ + $this->arg = null; + return true; + } + protected function init(){ $general = $this->generalObj; @@ -50,11 +55,6 @@ class che_상업투자 extends Command\GeneralCommand{ $this->reqGold = $reqGold; } - protected function argTest():bool{ - $this->arg = null; - return true; - } - public function getCost():array{ $develCost = $this->env['develcost']; $reqGold = $general->onCalcDomestic(static::$actionKey, 'cost', $develCost); diff --git a/hwe/sammo/Command/General/che_소집해제.php b/hwe/sammo/Command/General/che_소집해제.php index bed7be65..04c53a32 100644 --- a/hwe/sammo/Command/General/che_소집해제.php +++ b/hwe/sammo/Command/General/che_소집해제.php @@ -17,11 +17,14 @@ use function \sammo\{ use \sammo\Constraint\Constraint; - - class che_소집해제 extends Command\GeneralCommand{ static protected $actionName = '소집해제'; + protected function argTest():bool{ + $this->arg = null; + return true; + } + protected function init(){ $general = $this->generalObj; @@ -35,11 +38,6 @@ class che_소집해제 extends Command\GeneralCommand{ } - protected function argTest():bool{ - $this->arg = null; - return true; - } - public function getCost():array{ return [0, 0]; } diff --git a/hwe/sammo/Command/General/che_요양.php b/hwe/sammo/Command/General/che_요양.php index 48ec1531..401d6e2e 100644 --- a/hwe/sammo/Command/General/che_요양.php +++ b/hwe/sammo/Command/General/che_요양.php @@ -22,6 +22,11 @@ use \sammo\Constraint\Constraint; class che_요양 extends Command\GeneralCommand{ static protected $actionName = '요양'; + protected function argTest():bool{ + $this->arg = null; + return true; + } + protected function init(){ $general = $this->generalObj; @@ -33,11 +38,6 @@ class che_요양 extends Command\GeneralCommand{ } - protected function argTest():bool{ - $this->arg = null; - return true; - } - public function getCost():array{ return [0, 0]; } diff --git a/hwe/sammo/Command/General/che_이동.php b/hwe/sammo/Command/General/che_이동.php index dc72253c..8e6bf4ad 100644 --- a/hwe/sammo/Command/General/che_이동.php +++ b/hwe/sammo/Command/General/che_이동.php @@ -23,6 +23,19 @@ use sammo\CityConst; class che_이동 extends Command\GeneralCommand{ static protected $actionName = '이동'; + protected function argTest():bool{ + if(!key_exists('destCityID', $this->arg)){ + return false; + } + if(!key_exists($this->arg['destCityID'], CityConst::all())){ + return false; + } + $this->arg = [ + 'destCityID'=>$this->arg['destCityID'] + ]; + return true; + } + protected function init(){ $general = $this->generalObj; @@ -41,19 +54,6 @@ class che_이동 extends Command\GeneralCommand{ ]; } - protected function argTest():bool{ - if(!key_exists('destCityID', $this->arg)){ - return false; - } - if(!key_exists($this->arg['destCityID'], CityConst::all())){ - return false; - } - $this->arg = [ - 'destCityID'=>$this->arg['destCityID'] - ]; - return true; - } - public function getCost():array{ $env = $this->env; return [$env['develcost'], 0]; diff --git a/hwe/sammo/Command/General/che_장비매매.php b/hwe/sammo/Command/General/che_장비매매.php index 82450a7f..38bc56ac 100644 --- a/hwe/sammo/Command/General/che_장비매매.php +++ b/hwe/sammo/Command/General/che_장비매매.php @@ -32,6 +32,25 @@ class che_장비매매 extends Command\GeneralCommand{ 'item'=>'도구', ]; + protected function argTest():bool{ + $itemType = $this->arg['itemType']??null; + if(!in_array($itemType, array_keys(static::$itemMap))){ + return false; + } + $itemCode = $this->arg['itemCode']??null; + if(!is_int($itemCode)){ + return false; + } + if($itemCode < 0 || 6 < $itemCode){ + return false; + } + $this->arg = [ + 'itemType'=>$itemType, + 'itemCode'=>$itemCode + ]; + return true; + } + protected function init(){ $general = $this->generalObj; @@ -64,25 +83,6 @@ class che_장비매매 extends Command\GeneralCommand{ } - protected function argTest():bool{ - $itemType = $this->arg['itemType']??null; - if(!in_array($itemType, array_keys(static::$itemMap))){ - return false; - } - $itemCode = $this->arg['itemCode']??null; - if(!is_int($itemCode)){ - return false; - } - if($itemCode < 0 || 6 < $itemCode){ - return false; - } - $this->arg = [ - 'itemType'=>$itemType, - 'itemCode'=>$itemCode - ]; - return true; - } - public function getCost():array{ if(!$this->isArgValid){ return [0, 0]; diff --git a/hwe/sammo/Command/General/che_전투태세.php b/hwe/sammo/Command/General/che_전투태세.php index d64f60cf..de83fc0e 100644 --- a/hwe/sammo/Command/General/che_전투태세.php +++ b/hwe/sammo/Command/General/che_전투태세.php @@ -22,6 +22,11 @@ use \sammo\Constraint\Constraint; class che_전투태세 extends Command\GeneralCommand{ static protected $actionName = '전투태세'; + protected function argTest():bool{ + $this->arg = null; + return true; + } + protected function init(){ $general = $this->generalObj; @@ -44,11 +49,6 @@ class che_전투태세 extends Command\GeneralCommand{ } - protected function argTest():bool{ - $this->arg = null; - return true; - } - public function getCost():array{ $crew = $this->getVar('crew'); $techCost = getTechCost($this->nation['tech']); diff --git a/hwe/sammo/Command/General/che_정착장려.php b/hwe/sammo/Command/General/che_정착장려.php index 8a8f8c06..f2b6e11b 100644 --- a/hwe/sammo/Command/General/che_정착장려.php +++ b/hwe/sammo/Command/General/che_정착장려.php @@ -28,6 +28,11 @@ class che_정착장려 extends Command\GeneralCommand{ static protected $actionKey = '인구'; static protected $actionName = '정착 장려'; + protected function argTest():bool{ + $this->arg = null; + return true; + } + protected function init(){ $general = $this->generalObj; @@ -50,11 +55,6 @@ class che_정착장려 extends Command\GeneralCommand{ $this->reqRice = $reqRice; } - protected function argTest():bool{ - $this->arg = null; - return true; - } - public function getCost():array{ $develCost = $this->env['develcost'] * 2; $reqGold = 0; diff --git a/hwe/sammo/Command/General/che_주민선정.php b/hwe/sammo/Command/General/che_주민선정.php index 6499e20c..84d3a1a0 100644 --- a/hwe/sammo/Command/General/che_주민선정.php +++ b/hwe/sammo/Command/General/che_주민선정.php @@ -27,6 +27,11 @@ class che_주민선정 extends Command\GeneralCommand{ static protected $actionKey = '민심'; static protected $actionName = '주민 선정'; + protected function argTest():bool{ + $this->arg = null; + return true; + } + protected function init(){ $general = $this->generalObj; @@ -49,11 +54,6 @@ class che_주민선정 extends Command\GeneralCommand{ $this->reqRice = $reqRice; } - protected function argTest():bool{ - $this->arg = null; - return true; - } - public function getCost():array{ $develCost = $this->env['develcost'] * 2; $reqGold = 0; diff --git a/hwe/sammo/Command/General/che_증여.php b/hwe/sammo/Command/General/che_증여.php index ebd750cf..e88168ba 100644 --- a/hwe/sammo/Command/General/che_증여.php +++ b/hwe/sammo/Command/General/che_증여.php @@ -24,6 +24,44 @@ use \sammo\Constraint\Constraint; class che_증여 extends Command\GeneralCommand{ static protected $actionName = '증여'; + protected function argTest():bool{ + //NOTE: 사망 직전에 '증여' 턴을 넣을 수 있으므로, 존재하지 않는 장수여도 argTest에서 바로 탈락시키지 않음 + if(!key_exists('isGold', $this->arg)){ + return false; + } + if(!key_exists('amount', $this->arg)){ + return false; + } + if(!key_exists('destGeneralID', $this->arg)){ + return false; + } + $isGold = $this->arg['isGold']; + $amount = $this->arg['amount']; + $destGeneralID = $this->arg['destGeneralID']; + if(!is_int($amount)){ + return false; + } + $amount = Util::valueFit($amount, 100, 10000); + if(!is_bool($isGold)){ + return false; + } + if(!is_int($destGeneralID)){ + return false; + } + if($destGeneralID <= 0){ + return false; + } + if($destGeneralID == $this->generalObj->getID()){ + return false; + } + $this->arg = [ + 'isGold'=>$isGold, + 'amount'=>$amount, + 'destGeneralID'=>$destGeneralID + ]; + return true; + } + protected function init(){ $general = $this->generalObj; @@ -55,50 +93,6 @@ class che_증여 extends Command\GeneralCommand{ } - protected function argTest():bool{ - //NOTE: 사망 직전에 '증여' 턴을 넣을 수 있으므로, 존재하지 않는 장수여도 argTest에서 바로 탈락시키지 않음 - if(!key_exists('isGold', $this->arg)){ - return false; - } - if(!key_exists('amount', $this->arg)){ - return false; - } - if(!key_exists('destGeneralID', $this->arg)){ - return false; - } - $isGold = $this->arg['isGold']; - $amount = $this->arg['amount']; - $destGeneralID = $this->arg['destGeneralID']; - if(!is_int($amount)){ - return false; - } - if($amount < 100){ - return false; - } - if($amount > 10000){ - return false; - } - $amount = (int)$amount; - if(!is_bool($isGold)){ - return false; - } - if(!is_int($destGeneralID)){ - return false; - } - if($destGeneralID <= 0){ - return false; - } - if($destGeneralID == $this->generalObj->getID()){ - return false; - } - $this->arg = [ - 'isGold'=>$isGold, - 'amount'=>$amount, - 'destGeneralID'=>$destGeneralID - ]; - return true; - } - public function getCost():array{ return [0, 0]; } diff --git a/hwe/sammo/Command/General/che_집합.php b/hwe/sammo/Command/General/che_집합.php index 31cc4537..07a346ea 100644 --- a/hwe/sammo/Command/General/che_집합.php +++ b/hwe/sammo/Command/General/che_집합.php @@ -23,6 +23,11 @@ use sammo\CityConst; class che_집합 extends Command\GeneralCommand{ static protected $actionName = '집합'; + protected function argTest():bool{ + $this->arg = null; + return true; + } + protected function init(){ $general = $this->generalObj; @@ -42,11 +47,6 @@ class che_집합 extends Command\GeneralCommand{ ]; } - protected function argTest():bool{ - $this->arg = null; - return true; - } - public function getCost():array{ return [0, 0]; } diff --git a/hwe/sammo/Command/General/che_징병.php b/hwe/sammo/Command/General/che_징병.php index bc3e40c4..432e65d5 100644 --- a/hwe/sammo/Command/General/che_징병.php +++ b/hwe/sammo/Command/General/che_징병.php @@ -39,6 +39,36 @@ class che_징병 extends Command\GeneralCommand{ static::$defaultAtmos = GameConst::$defaultAtmosLow; } + protected function argTest():bool{ + if(!key_exists('crewType', $this->arg)){ + return false; + } + if(!key_exists('amount', $this->arg)){ + return false; + } + $crewType = $this->arg['crewType']; + $amount = $this->arg['amountCrew']; + + if(!is_int($crewType)){ + return false; + } + if(!is_int($amount)){ + return false; + } + + if(GameUnitConst::byID($crewType) === null){ + return false; + } + if($amount < 100){ + return false; + } + $this->arg = [ + 'crewType'=>$crewType, + 'amount'=>$amount + ]; + return true; + } + protected function init(){ $general = $this->generalObj; @@ -74,36 +104,6 @@ class che_징병 extends Command\GeneralCommand{ } - protected function argTest():bool{ - if(!key_exists('crewType', $this->arg)){ - return false; - } - if(!key_exists('amount', $this->arg)){ - return false; - } - $crewType = $this->arg['crewType']; - $amount = $this->arg['amountCrew']; - - if(!is_int($crewType)){ - return false; - } - if(!is_int($amount)){ - return false; - } - - if(GameUnitConst::byID($crewType) === null){ - return false; - } - if($amount < 100){ - return false; - } - $this->arg = [ - 'crewType'=>$crewType, - 'amount'=>$amount - ]; - return true; - } - public function getCost():array{ if(!$this->isArgValid){ return [0, 0]; diff --git a/hwe/sammo/Command/General/che_첩보.php b/hwe/sammo/Command/General/che_첩보.php index 691ce27a..1433ae2a 100644 --- a/hwe/sammo/Command/General/che_첩보.php +++ b/hwe/sammo/Command/General/che_첩보.php @@ -24,6 +24,19 @@ use sammo\CityConst; class che_첩보 extends Command\GeneralCommand{ static protected $actionName = '첩보'; + protected function argTest():bool{ + if(!key_exists('destCityID', $this->arg)){ + return false; + } + if(!key_exists($this->arg['destCityID'], CityConst::all())){ + return false; + } + $this->arg = [ + 'destCityID'=>$this->arg['destCityID'] + ]; + return true; + } + protected function init(){ $general = $this->generalObj; @@ -42,19 +55,6 @@ class che_첩보 extends Command\GeneralCommand{ ]; } - protected function argTest():bool{ - if(!key_exists('destCityID', $this->arg)){ - return false; - } - if(!key_exists($this->arg['destCityID'], CityConst::all())){ - return false; - } - $this->arg = [ - 'destCityID'=>$this->arg['destCityID'] - ]; - return true; - } - public function getCost():array{ $env = $this->env; return [$env['develcost'], 0]; diff --git a/hwe/sammo/Command/General/che_출병.php b/hwe/sammo/Command/General/che_출병.php index ea373342..7a5d53ec 100644 --- a/hwe/sammo/Command/General/che_출병.php +++ b/hwe/sammo/Command/General/che_출병.php @@ -24,6 +24,19 @@ use sammo\CityConst; class che_출병 extends Command\GeneralCommand{ static protected $actionName = '출병'; + protected function argTest():bool{ + if(!key_exists('destCityID', $this->arg)){ + return false; + } + if(!key_exists($this->arg['destCityID'], CityConst::all())){ + return false; + } + $this->arg = [ + 'destCityID'=>$this->arg['destCityID'] + ]; + return true; + } + protected function init(){ $general = $this->generalObj; @@ -47,19 +60,6 @@ class che_출병 extends Command\GeneralCommand{ ]; } - protected function argTest():bool{ - if(!key_exists('destCityID', $this->arg)){ - return false; - } - if(!key_exists($this->arg['destCityID'], CityConst::all())){ - return false; - } - $this->arg = [ - 'destCityID'=>$this->arg['destCityID'] - ]; - return true; - } - public function getCost():array{ return [0, Util::round($this->general->getVar('crew')/100)]; } diff --git a/hwe/sammo/Command/General/che_헌납.php b/hwe/sammo/Command/General/che_헌납.php index 886aaba5..6bd3ce88 100644 --- a/hwe/sammo/Command/General/che_헌납.php +++ b/hwe/sammo/Command/General/che_헌납.php @@ -24,6 +24,29 @@ use \sammo\Constraint\Constraint; class che_헌납 extends Command\GeneralCommand{ static protected $actionName = '헌납'; + protected function argTest():bool{ + if(!key_exists('isGold', $this->arg)){ + return false; + } + if(!key_exists('amount', $this->arg)){ + return false; + } + $isGold = $this->arg['isGold']; + $amount = $this->arg['amount']; + if(!is_int($amount)){ + return false; + } + $amount = Util::valueFit($amount, 100, 10000); + if(!is_bool($isGold)){ + return false; + } + $this->arg = [ + 'isGold'=>$isGold, + 'amount'=>$amount + ]; + return true; + } + protected function init(){ $general = $this->generalObj; @@ -45,35 +68,6 @@ class che_헌납 extends Command\GeneralCommand{ } - protected function argTest():bool{ - if(!key_exists('isGold', $this->arg)){ - return false; - } - if(!key_exists('amount', $this->arg)){ - return false; - } - $isGold = $this->arg['isGold']; - $amount = $this->arg['amount']; - if(!is_int($amount)){ - return false; - } - if($amount < 100){ - return false; - } - if($amount > 10000){ - return false; - } - $amount = (int)$amount; - if(!is_bool($isGold)){ - return false; - } - $this->arg = [ - 'isGold'=>$isGold, - 'amount'=>$amount - ]; - return true; - } - public function getCost():array{ return [0, 0]; } diff --git a/hwe/sammo/Command/General/che_훈련.php b/hwe/sammo/Command/General/che_훈련.php index 20bca756..5245ab6f 100644 --- a/hwe/sammo/Command/General/che_훈련.php +++ b/hwe/sammo/Command/General/che_훈련.php @@ -22,6 +22,11 @@ use \sammo\Constraint\Constraint; class che_훈련 extends Command\GeneralCommand{ static protected $actionName = '훈련'; + protected function argTest():bool{ + $this->arg = null; + return true; + } + protected function init(){ $general = $this->generalObj; @@ -39,11 +44,6 @@ class che_훈련 extends Command\GeneralCommand{ } - protected function argTest():bool{ - $this->arg = null; - return true; - } - public function getCost():array{ return [0, 0]; } diff --git a/hwe/sammo/Command/General/휴식.php b/hwe/sammo/Command/General/휴식.php index 97d6a11c..173f8543 100644 --- a/hwe/sammo/Command/General/휴식.php +++ b/hwe/sammo/Command/General/휴식.php @@ -8,14 +8,14 @@ use \sammo\JosaUtil; class 휴식 extends Command\GeneralCommand{ static protected $actionName = '휴식'; - protected function init(){ - //아무것도 하지 않음 - } - protected function argTest():bool{ return true; } + protected function init(){ + //아무것도 하지 않음 + } + public function getCost():array{ return [0, 0]; } diff --git a/hwe/sammo/Command/Nation/휴식.php b/hwe/sammo/Command/Nation/휴식.php index 472f467c..e489e468 100644 --- a/hwe/sammo/Command/Nation/휴식.php +++ b/hwe/sammo/Command/Nation/휴식.php @@ -9,14 +9,13 @@ use sammo\LastTurn; class 휴식 extends Command\NationCommand{ static protected $actionName = '휴식'; - protected function init(){ - //아무것도 하지 않음 - } - protected function argTest():bool{ return true; } + protected function init(){ + //아무것도 하지 않음 + } public function getCost():array{ return [0, 0]; }