diff --git a/hwe/battle_simulator.php b/hwe/battle_simulator.php
index 4b4f130a..4b4ffc8b 100644
--- a/hwe/battle_simulator.php
+++ b/hwe/battle_simulator.php
@@ -90,9 +90,9 @@ $startYear = $gameStor->getValue('startyear');
국가 성향
@@ -162,8 +162,9 @@ $startYear = $gameStor->getValue('startyear');
국가 성향
diff --git a/hwe/func_converter.php b/hwe/func_converter.php
index 80696065..06ebdc27 100644
--- a/hwe/func_converter.php
+++ b/hwe/func_converter.php
@@ -6,18 +6,9 @@ namespace sammo;
* Value Converter
*
* Side effect 없이 값의 변환만을 수행하는 함수들의 모음.
+ * (단, autoload, 정적 변수 초기화는 허용)
*/
-function NationCharCall($call) {
- static $invTable = [];
- if(!$invTable){
- foreach(getNationTypeList() as $typeID => [$name, $pros, $cons]){
- $invTable[$name] = $typeID;
- }
- }
- return $invTable[$call]??0;
-}
-
function getCharacterList(){
$infoText = [
9=>['안전', '사기 -5, 징·모병 비용 -20%'],
@@ -223,16 +214,9 @@ function getSpecialInfo(?int $type):?string{
return $infoText[$type][1]??null;
}
-function getNationType(?int $type) {
- if($type === null){
- return '-';
- }
- static $cache = [];
- if(\key_exists($type, $cache)){
- return $cache[$type];
- }
-
- $text = getNationTypeList()[$type][0]??'-';
+function getNationType(?string $type) {
+ $nationClass = getNationTypeClass($type);
+ $text = $nationClass::$name;
$text = join(' ', StringUtil::splitString($text));
$cache[$type] = $text;
@@ -255,14 +239,33 @@ function getConnect($con) {
return $conname;
}
-function getNationType2(?int $type) {
- if($type === null){
- return '-';
- }
- [$name, $pros, $cons] = getNationTypeList()[$type]??['-', '', ''];
+function getNationType2(?string $type) {
+ $nationClass = getNationTypeClass($type);
+
+ [$name, $pros, $cons] = [$nationClass::$name, $nationClass::$pros, $nationClass::$cons];
return "{$pros} {$cons}";
}
+function getNationTypeClass(?string $type){
+ if($type === null){
+ $type = GameConst::$neutralNationType;
+ }
+
+ static $path = __NAMESPACE__.'\\TriggerNationType\\';
+ $nationClass = ($path.$type);
+
+ if(class_exists($nationClass)){
+ return $nationClass;
+ }
+
+ $nationClass = ($path.'che_'.$type);
+ if(class_exists($nationClass)){
+ return $nationClass;
+ }
+
+ new \InvalidArgumentException("{$type}은 올바른 국가 타입 클래스가 아님");
+}
+
function getLevel($level, $nlevel=8) {
if($level >= 0 && $level <= 4) { $nlevel = 0; }
$code = $nlevel * 100 + $level;
diff --git a/hwe/processing.php b/hwe/processing.php
index 3deddf26..a2ecfa2f 100644
--- a/hwe/processing.php
+++ b/hwe/processing.php
@@ -1315,19 +1315,10 @@ function command_46($turn, $command) {
?>
성향 :
>
diff --git a/hwe/sammo/GameConstBase.php b/hwe/sammo/GameConstBase.php
index 270cbe46..87a343c5 100644
--- a/hwe/sammo/GameConstBase.php
+++ b/hwe/sammo/GameConstBase.php
@@ -96,7 +96,9 @@ class GameConstBase
/** @var array 선택 가능한 국가 성향 */
public static $availableNationType = [
- 'che_명가', 'che_음양가', 'che_종횡가', 'che_불가', 'che_도적', 'che_오두미도', 'che_태평도', 'che_도가',
+ 'che_도적', 'che_명가', 'che_음양가', 'che_종횡가', 'che_불가', 'che_오두미도', 'che_태평도', 'che_도가',
'che_묵가', 'che_덕가', 'che_병가', 'che_유가', 'che_법가'
];
+
+ public static $neutralNationType = 'che_중립';
}
diff --git a/hwe/sammo/Scenario/Nation.php b/hwe/sammo/Scenario/Nation.php
index cbcc0f5a..6b683e60 100644
--- a/hwe/sammo/Scenario/Nation.php
+++ b/hwe/sammo/Scenario/Nation.php
@@ -71,8 +71,12 @@ class Nation{
$capital = 0;
}
-
- $type = \sammo\NationCharCall($this->type);
+ if(strpos($this->type, '_') === FALSE){
+ $type = 'che_'.$this->type;
+ }
+ else{
+ $type = $this->type;
+ }
$db = DB::db();
$otherNations = $db->queryFirstColumn('SELECT nation FROM nation');