From b89d37c8c532c9be4bd68010f37a6673d3fee2f6 Mon Sep 17 00:00:00 2001 From: hide_d Date: Thu, 13 Sep 2018 02:21:42 +0900 Subject: [PATCH] =?UTF-8?q?getPersonalityClass=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/func_converter.php | 20 +++++++++++++++++++ hwe/sammo/GameConstBase.php | 8 ++++++++ hwe/sammo/General.php | 4 +++- .../None.php | 2 +- .../che_대의.php | 2 +- .../che_안전.php | 2 +- .../che_왕좌.php | 2 +- .../che_유지.php | 2 +- .../che_은둔.php | 2 +- .../che_의협.php | 2 +- .../che_재간.php | 2 +- .../che_정복.php | 2 +- .../che_출세.php | 2 +- .../che_패권.php | 2 +- .../che_할거.php | 2 +- 15 files changed, 43 insertions(+), 13 deletions(-) rename hwe/sammo/{TriggerCharacter => TriggerPersonality}/None.php (83%) rename hwe/sammo/{TriggerCharacter => TriggerPersonality}/che_대의.php (93%) rename hwe/sammo/{TriggerCharacter => TriggerPersonality}/che_안전.php (95%) rename hwe/sammo/{TriggerCharacter => TriggerPersonality}/che_왕좌.php (93%) rename hwe/sammo/{TriggerCharacter => TriggerPersonality}/che_유지.php (95%) rename hwe/sammo/{TriggerCharacter => TriggerPersonality}/che_은둔.php (96%) rename hwe/sammo/{TriggerCharacter => TriggerPersonality}/che_의협.php (95%) rename hwe/sammo/{TriggerCharacter => TriggerPersonality}/che_재간.php (95%) rename hwe/sammo/{TriggerCharacter => TriggerPersonality}/che_정복.php (93%) rename hwe/sammo/{TriggerCharacter => TriggerPersonality}/che_출세.php (95%) rename hwe/sammo/{TriggerCharacter => TriggerPersonality}/che_패권.php (95%) rename hwe/sammo/{TriggerCharacter => TriggerPersonality}/che_할거.php (93%) diff --git a/hwe/func_converter.php b/hwe/func_converter.php index 18448195..6f16639b 100644 --- a/hwe/func_converter.php +++ b/hwe/func_converter.php @@ -238,6 +238,26 @@ function getNationTypeClass(?string $type){ new \InvalidArgumentException("{$type}은 올바른 국가 타입 클래스가 아님"); } +function getPersonalityClass(?string $type){ + if($type === null){ + $type = GameConst::$neutralPersonality; + } + + static $basePath = __NAMESPACE__.'\\TriggerPersonality\\'; + $classPath = ($basePath.$type); + + if(class_exists($classPath)){ + return $classPath; + } + + $classPath = ($basePath.'che_'.$type); + if(class_exists($classPath)){ + return $classPath; + } + + new \InvalidArgumentException("{$type}은 올바른 성격 클래스가 아님"); +} + function getGeneralSpecialDomesticClass(?string $type){ if($type === null){ $type = GameConst::$defaultSpecial; diff --git a/hwe/sammo/GameConstBase.php b/hwe/sammo/GameConstBase.php index 912992c3..5c5778ee 100644 --- a/hwe/sammo/GameConstBase.php +++ b/hwe/sammo/GameConstBase.php @@ -107,4 +107,12 @@ class GameConstBase ]; /** @var array 기본 특기(공용) */ public static $defaultSpecial = 'None'; + + /** @var array 기본 성향(공용) */ + public static $neutralPersonality = 'None'; + /** @var array 선택 가능한 성향 */ + public static $availablePersonality = [ + 'che_안전', 'che_유지', 'che_재간', 'che_출세', 'che_할거', 'che_정복', + 'che_패권', 'che_의협', 'che_대의', 'che_왕좌' + ]; } diff --git a/hwe/sammo/General.php b/hwe/sammo/General.php index 88def24f..a0eb37ce 100644 --- a/hwe/sammo/General.php +++ b/hwe/sammo/General.php @@ -20,10 +20,11 @@ class General{ protected $logActivatedSkill = []; protected $isFinished = false; - + protected $nationType; protected $levelObj; protected $specialDomesticObj; + protected $characteristicObj; public function __construct(array $raw, ?array $city, int $year, int $month){ //TODO: 밖에서 가져오도록 하면 버그 확률이 높아짐. 필요한 raw 값을 직접 구해야함. @@ -45,6 +46,7 @@ class General{ $nationTypeClass = getNationTypeClass($staticNation['type']); $this->nationType = new $nationTypeClass; $this->levelObj = new TriggerGeneralLevel($this->raw, $city); + $this->levelObj = new TriggerGeneralLevel($this->raw, $city); } protected function clearActivatedSkill(){ diff --git a/hwe/sammo/TriggerCharacter/None.php b/hwe/sammo/TriggerPersonality/None.php similarity index 83% rename from hwe/sammo/TriggerCharacter/None.php rename to hwe/sammo/TriggerPersonality/None.php index f362e591..c44f6385 100644 --- a/hwe/sammo/TriggerCharacter/None.php +++ b/hwe/sammo/TriggerPersonality/None.php @@ -1,5 +1,5 @@