argTest를 로직 순서에 맞게 변경

This commit is contained in:
2018-10-21 14:28:29 +09:00
parent c08459e370
commit 6c5c2d40bc
27 changed files with 289 additions and 304 deletions
+30 -30
View File
@@ -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];