argTest를 로직 순서에 맞게 변경
This commit is contained in:
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user