전략 사용 방식 변경

This commit is contained in:
2020-07-13 21:54:32 +09:00
parent a427ddff83
commit 6306dae92d
24 changed files with 4024 additions and 3910 deletions
@@ -1,32 +1,32 @@
<?php
namespace sammo\Constraint;
class AvailableStrategicCommand extends Constraint{
const REQ_VALUES = Constraint::REQ_NATION;
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
if(!key_exists('strategic_cmd_limit', $this->nation)){
if(!$throwExeception){return false; }
throw new \InvalidArgumentException("require strategic_cmd_limit in nation");
}
return true;
}
public function test():bool{
$this->checkInputValues();
$this->tested = true;
if($this->nation['strategic_cmd_limit'] == 0){
return true;
}
$this->reason = "전략기한이 남았습니다.";
return false;
}
<?php
namespace sammo\Constraint;
class AvailableStrategicCommand extends Constraint{
const REQ_VALUES = Constraint::REQ_NATION | Constraint::REQ_INT_ARG;
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
if(!key_exists('strategic_cmd_limit', $this->nation)){
if(!$throwExeception){return false; }
throw new \InvalidArgumentException("require strategic_cmd_limit in nation");
}
return true;
}
public function test():bool{
$this->checkInputValues();
$this->tested = true;
if($this->nation['strategic_cmd_limit'] <= $this->arg){
return true;
}
$this->reason = "전략기한이 남았습니다.";
return false;
}
}