buildGeneralCommandClass류 구현

This commit is contained in:
2018-10-06 04:08:43 +09:00
parent b94081c45b
commit 1660e563ab
4 changed files with 15 additions and 11 deletions
+10
View File
@@ -313,6 +313,11 @@ function getGeneralCommandClass(?string $type){
throw new \InvalidArgumentException("{$type}은 올바른 장수 커맨드가 아님");
}
function buildGeneralCommandClass(?string $type, General $generalObj, array $env, $arg = null):Command\GeneralCommand{
$class = getGeneralCommandClass($type);
return new $class($generalObj, $env, $arg);
}
function getNationCommandClass(?string $type){
if($type === null){
$type = '휴식';
@@ -328,6 +333,11 @@ function getNationCommandClass(?string $type){
throw new \InvalidArgumentException("{$type}은 올바른 국가 커맨드가 아님");
}
function buildNationCommandClass(?string $type, General $generalObj, array $env, LastTurn $lastTurn, $arg = null):Command\NationCommand{
$class = getNationCommandClass($type);
return new $class($generalObj, $env, $lastTurn, $arg);
}
function getLevel($level, $nlevel=8) {
if($level >= 0 && $level <= 4) { $nlevel = 0; }
$code = $nlevel * 100 + $level;