Files
core/hwe/sammo/Constraint/AllowJoinAction.php
T
2019-04-21 11:43:23 +09:00

35 lines
911 B
PHP

<?php
namespace sammo\Constraint;
use \sammo\GameConst;
class AllowJoinAction extends Constraint{
const REQ_VALUES = Constraint::REQ_GENERAL;
public function checkInputValues(bool $throwExeception=true){
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
if(!key_exists('makelimit', $this->general)){
if(!$throwExeception){return false; }
throw new \InvalidArgumentException("require makelimit in general");
}
return true;
}
public function test():bool{
$this->checkInputValues();
$this->tested = true;
if($this->general['makelimit'] == 0){
return true;
}
$joinActionLimit = GameConst::$joinActionLimit;
$this->reason = "재야가 된지 {$joinActionLimit}턴이 지나야 합니다.";
return false;
}
}