Command 구조 일부 수정

This commit is contained in:
2018-09-30 03:04:20 +09:00
parent 98cfc8a748
commit 082c376dde
15 changed files with 156 additions and 22 deletions
+4 -4
View File
@@ -63,10 +63,10 @@ abstract class BaseCommand{
$this->reasonNotReservable = null;
}
protected function setCity(array $args=null){
protected function setCity(?array $args=null){
$this->resetTestCache();
$db = DB::db();
if($args == null){
if($args === null){
$this->city = $this->generalObj->getRawCity();
if($this->city){
return;
@@ -83,7 +83,7 @@ abstract class BaseCommand{
protected function setNation(?array $args = null){
$this->resetTestCache();
if($args == null){
if($args === null){
$this->nation = $this->generalObj->getStaticNation();
return;
}
@@ -158,7 +158,7 @@ abstract class BaseCommand{
$constraintInput = [
'general'=>$this->generalObj->getRaw(),
'city'=>$this->city,
'nation'=>$this->city,
'nation'=>$this->nation,
'arg'=>$this->arg,
'destGeneral'=>$this->destGeneral,
@@ -1,5 +1,5 @@
<?php
namespace sammo\Command;
namespace sammo\GeneralCommand;
use \sammo\{
DB, Util, JosaUtil,
@@ -11,6 +11,7 @@ use \sammo\{
uniqueItemEx
};
use \sammo\Command;
use \sammo\Constraint\Constraint;
use function sammo\CriticalScore;
use function sammo\uniqueItemEx;
@@ -1,5 +1,5 @@
<?php
namespace sammo\Command;
namespace sammo\GeneralCommand;
use \sammo\Util;
use \sammo\JosaUtil;
@@ -1,5 +1,5 @@
<?php
namespace sammo\Command;
namespace sammo\GeneralCommand;
use \sammo\{
DB, Util, JosaUtil,
@@ -11,13 +11,14 @@ use \sammo\{
uniqueItemEx
};
use \sammo\Command;
use \sammo\Constraint\Constraint;
use function sammo\CriticalScore;
use function sammo\uniqueItemEx;
use function sammo\getGeneralLeadership;
class che_상업투자 extends BaseCommand{
class che_상업투자 extends GeneralCommand{
static $cityKey = 'comm';
static $statKey = 'intel';
static $actionKey = '상업';
@@ -1,5 +1,5 @@
<?php
namespace sammo\Command;
namespace sammo\GeneralCommand;
use \sammo\Util;
use \sammo\JosaUtil;
@@ -1,5 +1,5 @@
<?php
namespace sammo\Command;
namespace sammo\GeneralCommand;
use \sammo\Util;
use \sammo\JosaUtil;
@@ -1,5 +1,5 @@
<?php
namespace sammo\Command;
namespace sammo\GeneralCommand;
use \sammo\{
DB, Util, JosaUtil,
@@ -11,13 +11,14 @@ use \sammo\{
uniqueItemEx
};
use \sammo\Command;
use \sammo\Constraint\Constraint;
use function sammo\CriticalScore;
use function sammo\uniqueItemEx;
use function sammo\getGeneralLeadership;
class che_상업투자 extends BaseCommand{
class che_상업투자 extends GeneralCommand{
static $cityKey = 'pop';
static $statKey = 'leader';
static $actionKey = '인구';
@@ -1,5 +1,5 @@
<?php
namespace sammo\Command;
namespace sammo\GeneralCommand;
use \sammo\{
DB, Util, JosaUtil,
@@ -11,13 +11,14 @@ use \sammo\{
uniqueItemEx
};
use \sammo\Command;
use \sammo\Constraint\Constraint;
use function sammo\CriticalScore;
use function sammo\uniqueItemEx;
use function sammo\getGeneralLeadership;
class che_주민선정 extends BaseCommand{
class che_주민선정 extends GeneralCommand{
static $cityKey = 'trust';
static $statKey = 'leader';
static $actionKey = '민심';
@@ -1,5 +1,5 @@
<?php
namespace sammo\Command;
namespace sammo\GeneralCommand;
use \sammo\Util;
use \sammo\JosaUtil;
@@ -1,10 +1,11 @@
<?php
namespace sammo\Command;
namespace sammo\Command\General;
use \sammo\Command;
use \sammo\Util;
use \sammo\JosaUtil;
class 휴식 extends BaseCommand{
class 휴식 extends GeneralCommand{
protected function init(){
//아무것도 하지 않음
}
+6
View File
@@ -0,0 +1,6 @@
<?php
namespace sammo\Command;
abstract class GeneralCommand extends BaseCommand{
};
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace sammo\Command\Nation;
use \sammo\Command;
use \sammo\Util;
use \sammo\JosaUtil;
class 휴식 extends NationCommand{
protected function init(){
//아무것도 하지 않음
}
protected function argTest():bool{
return true;
}
public function getCost():array{
return [0, 0];
}
public function run():bool{
return true;
}
}
+6
View File
@@ -0,0 +1,6 @@
<?php
namespace sammo\Command;
abstract class NationCommand extends BaseCommand{
};
+6 -5
View File
@@ -3,13 +3,13 @@ namespace sammo;
class GameConstBase
{
/** @var string 버전 */
/** @var string 게임명 */
public static $title = "삼국지 모의전투 PHP HiDCHe";
/** @var string 코드 아래에 붙는 설명 코드 */
public static $banner = "KOEI의 이미지를 사용, 응용하였습니다 / 제작 : HideD(hided62@gmail.com) / <a href='https://sam.hided.net/wiki/hidche/credit' target='_blank' style='color:white;text-decoration: underline;'>Credit</a>";
/** @var string mapName 사용중인 지도명 */
/** @var string 사용중인 지도명 */
public static $mapName = 'che';
/** @var string unitSet 사용중인 유닛셋 */
/** @var string 사용중인 유닛셋 */
public static $unitSet = 'che';
/** @var int 내정시 최하 민심 설정*/
public static $develrate = 50;
@@ -86,8 +86,9 @@ class GameConstBase
/** @var int 초기 시작 년도. 실제 값은 시나리오에서 정해지므로 딱히 의미는 없음. */
public static $defaultStartYear = 180;
/** @var int 최대 턴(현재는 DB상 24턴으로 고정) */
public static $maxTurn = 24;
/** @var int 최대 턴 */
public static $maxTurn = 30;
public static $maxNationTurn = 12;
public static $statGradeLevel = 5;