내정 커맨드 버그 수정, 정착장려, 주민선정 추가, RemainCityTrust 추가, succ -> success

This commit is contained in:
2018-09-15 03:42:09 +09:00
parent f5bcaba352
commit b5380f183c
17 changed files with 393 additions and 57 deletions
+43
View File
@@ -0,0 +1,43 @@
<?php
namespace sammo\Constraint;
use \sammo\JosaUtil;
class RemainCityTrust extends Constraint{
const REQ_VALUES = Constraint::REQ_CITY|Constraint::REQ_STRING_ARG;
protected $key;
protected $maxKey;
protected $keyNick;
public function checkInputValues(bool $throwExeception=true){
if(!parent::checkInputValues($throwExeception) && !$throwException){
return false;
}
$this->keyNick = $this->arg;
$this->key = 'trust';
$this->maxVal = 100;
if(!key_exists($this->key, $this->city)){
if(!$throwExeception){return false; }
throw new \InvalidArgumentException("require {$this->key} in city");
}
return true;
}
public function test():bool{
$this->checkInputValues();
$this->tested = true;
if($this->city[$this->key] < $this->maxVal){
return true;
}
$josaUn = JosaUtil::pick($keyNick, '은');
$this->reason = "{$keyNick}{$josaUn} 충분합니다.";
return false;
}
}