diff --git a/hwe/a_genList.php b/hwe/a_genList.php index 27df5105..a6d1dded 100644 --- a/hwe/a_genList.php +++ b/hwe/a_genList.php @@ -178,7 +178,7 @@ for ($j=0; $j < $gencount; $j++) { $name {$general['age']}세 ".displayCharInfo($general['personal'])." - ".displaySpecialInfo($general['special'])." / ".displaySpecialInfo($general['special2'])." + ".displaySpecialDomesticInfo($general['special'])." / ".displaySpecialWarInfo($general['special2'])." Lv ".getExpLevel($general['experience'])." {$nation} ".getHonor($general['experience'])." diff --git a/hwe/a_npcList.php b/hwe/a_npcList.php index bed4edb6..1a94e287 100644 --- a/hwe/a_npcList.php +++ b/hwe/a_npcList.php @@ -111,7 +111,7 @@ for ($j=0; $j < $gencount; $j++) { Lv {$general['explevel']} {$nation} ".displayCharInfo($general['personal'])." - ".displaySpecialInfo($general['special'])." / ".displaySpecialInfo($general['special2'])." + ".displaySpecialDomesticInfo($general['special'])." / ".displaySpecialWarInfo($general['special2'])." {$general['sum']} {$general['leader']} {$general['power']} diff --git a/hwe/b_auction.php b/hwe/b_auction.php index 5845577b..77d3a30c 100644 --- a/hwe/b_auction.php +++ b/hwe/b_auction.php @@ -39,7 +39,7 @@ $bidCount = MYDB_num_rows($result); $btCount = $tradeCount + $bidCount; -if ($session->userGrade >= 5 || ($me['special'] != 30 && $btCount < 1) || ($me['special'] == 30 && $btCount < 3)) { +if ($session->userGrade >= 5) { $btn = "submit"; } else { $btn = "hidden"; diff --git a/hwe/b_myGenInfo.php b/hwe/b_myGenInfo.php index fed66425..3f39fe69 100644 --- a/hwe/b_myGenInfo.php +++ b/hwe/b_myGenInfo.php @@ -186,7 +186,7 @@ for($j=0; $j < $gencount; $j++) { {$general['gold']} {$general['rice']} ".displayCharInfo($general['personal'])." - ".displaySpecialInfo($general['special'])." / ".displaySpecialInfo($general['special2'])." + ".displaySpecialDomesticInfo($general['special'])." / ".displaySpecialWarInfo($general['special2'])." {$general['belong']} {$general['connect']}"; echo "
(".getConnect($general['connect']).") "; diff --git a/hwe/battle_simulator.php b/hwe/battle_simulator.php index 4b4ffc8b..01fd19c0 100644 --- a/hwe/battle_simulator.php +++ b/hwe/battle_simulator.php @@ -28,6 +28,9 @@ $startYear = $gameStor->getValue('startyear'); + diff --git a/hwe/c_auction.php b/hwe/c_auction.php index 3aa120b8..6a20bda6 100644 --- a/hwe/c_auction.php +++ b/hwe/c_auction.php @@ -66,7 +66,7 @@ if ($term > 24) { } $valid = 1; -if ($session->userGrade >= 5 || ($me['special'] != 30 && $btCount < 1) || ($me['special'] == 30 && $btCount < 3)) { +if ($session->userGrade >= 5) { } else { $msg = "ㆍ더이상 등록할 수 없습니다."; $msg2 = "ㆍ더이상 등록할 수 없습니다."; diff --git a/hwe/func.php b/hwe/func.php index d8e18a86..61aad81e 100644 --- a/hwe/func.php +++ b/hwe/func.php @@ -595,7 +595,7 @@ function commandTable() { addCommand("단련(자금$develcost, 군량$develcost)", 41, 0); } addCommand("견문(자금?, 군량?, 경험치?)", 42); - if($city['trade'] > 0 || $me['special'] == 30) { + if($city['trade'] > 0) { addCommand("장비매매", 48); addCommand("군량매매", 49); } else { @@ -847,8 +847,8 @@ function generalInfo($no) { else { $general['age'] = "{$general['age']} 세"; } $general['connect'] = Util::round($general['connect'] / 10) * 10; - $special = $general['special'] == 0 ? "{$general['specage']}세" : "".displaySpecialInfo($general['special']).""; - $special2 = $general['special2'] == 0 ? "{$general['specage2']}세" : "".displaySpecialInfo($general['special2']).""; + $special = $general['special'] == GameConst::$defaultSpecial ? "{$general['specage']}세" : "".displaySpecialDomesticInfo($general['special']).""; + $special2 = $general['special2'] == 0 ? "{$general['specage2']}세" : "".displaySpecialWarInfo($general['special2']).""; switch($general['personal']) { case 2: case 4: @@ -1732,19 +1732,17 @@ function addAge() { $admin = $gameStor->getValues(['startyear', 'year', 'month']); if($admin['year'] >= $admin['startyear']+3) { - $query = "select no,name,nation,leader,power,intel from general where specage<=age and special='0'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $gencount = MYDB_num_rows($result); - - for($i=0; $i < $gencount; $i++) { - $general = MYDB_fetch_array($result); + foreach($db->query('SELECT no,name,nation,leader,power,intel from general where specage<=age and special=%s', GameConst::$defaultSpecial) as $general){ $special = getSpecial($general['leader'], $general['power'], $general['intel']); - $query = "update general set special='$special' where no='{$general['no']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + $specialClass = getGeneralSpecialDomesticClass($special); + $specialText = $specialClass::$name; + $db->update('general', [ + 'special'=>$special + ], 'no=%i',$general['no']); - $josaUl = JosaUtil::pick($special, '을'); - pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:특기 【".getGenSpecial($special)."】{$josaUl} 습득"); - pushGenLog($general, "●특기 【".getGenSpecial($special)."】{$josaUl} 익혔습니다!"); + $josaUl = JosaUtil::pick($specialText, '을'); + pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:특기 【{$specialText}】{$josaUl} 습득"); + pushGenLog($general, "●특기 【{$specialText}】{$josaUl} 익혔습니다!"); } $query = "select no,name,nation,leader,power,intel,npc,dex0,dex10,dex20,dex30,dex40 from general where specage2<=age and special2='0'"; diff --git a/hwe/func_converter.php b/hwe/func_converter.php index 1cd2112e..18448195 100644 --- a/hwe/func_converter.php +++ b/hwe/func_converter.php @@ -123,20 +123,6 @@ function getCharInfo(?int $type):?string { function getGenSpecial($type) { switch($type) { - case 0: $call = '-'; break; - case 1: $call = '경작'; break; - case 2: $call = '상재'; break; - case 3: $call = '발명'; break; - - case 10: $call = '축성'; break; - case 11: $call = '수비'; break; - case 12: $call = '통찰'; break; - - case 20: $call = '인덕'; break; - - case 30: $call = '거상'; break; - case 31: $call = '귀모'; break; - case 40: $call = '귀병'; break; case 41: $call = '신산'; break; case 42: $call = '환술'; break; @@ -172,19 +158,6 @@ function getSpecialInfo(?int $type):?string{ //앞칸은 '설명을 위해' '그냥' 적어둠 $infoText = [ - 0 => ['-', null], - 1 => ['경작', '[내정] 농지 개간 : 기본 보정 +10%, 성공률 +10%p, 비용 -20%'], - 2 => ['상재', '[내정] 상업 투자 : 기본 보정 +10%, 성공률 +10%p, 비용 -20%'], - 3 => ['발명', '[내정] 기술 연구 : 기본 보정 +10%, 성공률 +10%p, 비용 -20%'], - - 10 => ['축성', '[내정] 성벽 보수 : 기본 보정 +10%, 성공률 +10%p, 비용 -20%'], - 11 => ['수비', '[내정] 수비 강화 : 기본 보정 +10%, 성공률 +10%p, 비용 -20%'], - 12 => ['통찰', '[내정] 치안 강화 : 기본 보정 +10%, 성공률 +10%p, 비용 -20%'], - - 20 => ['인덕', '[내정] 주민 선정·정착 장려 : 기본 보정 +10%, 성공률 +10%p, 비용 -20%'], - - 31 => ['귀모', '[계략] 화계·탈취·파괴·선동 : 성공률 +20%p'], - 40 => ['귀병', '[군사] 귀병 계통 징·모병비 -10%
[전투] 계략 성공 확률 +20%p'], 41 => ['신산', '[계략] 화계·탈취·파괴·선동 : 성공률 +10%p
[전투] 계략 시도 확률 +20%p, 계략 성공 확률 +20%p '], 42 => ['환술', '[전투] 계략 성공 확률 +10%p, 계략 성공 시 대미지 +30%'], @@ -250,21 +223,41 @@ function getNationTypeClass(?string $type){ $type = GameConst::$neutralNationType; } - static $path = __NAMESPACE__.'\\TriggerNationType\\'; - $nationClass = ($path.$type); + static $basePath = __NAMESPACE__.'\\TriggerNationType\\'; + $classPath = ($basePath.$type); - if(class_exists($nationClass)){ - return $nationClass; + if(class_exists($classPath)){ + return $classPath; } - $nationClass = ($path.'che_'.$type); - if(class_exists($nationClass)){ - return $nationClass; + $classPath = ($basePath.'che_'.$type); + if(class_exists($classPath)){ + return $classPath; } new \InvalidArgumentException("{$type}은 올바른 국가 타입 클래스가 아님"); } +function getGeneralSpecialDomesticClass(?string $type){ + if($type === null){ + $type = GameConst::$defaultSpecial; + } + + static $basePath = __NAMESPACE__.'\\TriggerSpecialDomestic\\'; + $classPath = ($basePath.$type); + + if(class_exists($classPath)){ + return $classPath; + } + + $classPath = ($basePath.'che_'.$type); + if(class_exists($classPath)){ + return $classPath; + } + + new \InvalidArgumentException("{$type}은 올바른 내정 특기가 아님"); +} + function getLevel($level, $nlevel=8) { if($level >= 0 && $level <= 4) { $nlevel = 0; } $code = $nlevel * 100 + $level; diff --git a/hwe/func_gamerule.php b/hwe/func_gamerule.php index 3d4fe8ef..f60cdc82 100644 --- a/hwe/func_gamerule.php +++ b/hwe/func_gamerule.php @@ -64,36 +64,37 @@ function getCityLevelList():array{ // 20 인덕 = 1 통솔내정 // 30 거상, 귀모 = 2 공통내정 +//TODO: 클래스로 이동 function getSpecial($leader, $power, $intel) { //통장 if($leader*0.9 > $power && $leader*0.9 > $intel) { - $type = array(20, 31); + $type = array('che_인덕', 'che_귀모'); $special = $type[array_rand($type)]; // 귀모는 50% * 5% = 2.5% if($special == 31 && Util::randBool(0.95)) { - $special = 20; + $special = 'che_인덕'; } //무장 } elseif($power >= $intel) { - $type = array(10, 11, 12, 31); + $type = array('che_축성', 'che_수비', 'che_통찰', 'che_귀모'); $special = $type[array_rand($type)]; // 귀모는 그중에 25% * 10% = 2.5% - if($special == 31 && Util::randBool(0.9)) { - $type = array(10, 11, 12); + if($special == 'che_귀모' && Util::randBool(0.9)) { + $type = array('che_축성', 'che_수비', 'che_통찰'); $special = $type[array_rand($type)]; } //지장 } elseif($intel > $power) { - $type = array(1, 2, 3, 31); + $type = array('che_상재', 'che_경작', 'che_발명', 'che_귀모'); $special = $type[array_rand($type)]; // 거상, 귀모는 그중에 25% * 10% = 2.5% - if($special == 31 && Util::randBool(0.9)) { - $type = array(1, 2, 3); + if($special == 'che_귀모' && Util::randBool(0.9)) { + $type = array('che_상재', 'che_경작', 'che_발명'); $special = $type[array_rand($type)]; } } else { //귀모. 다만 이쪽으로 빠지지 않음. - $type = 31; + $special = 'che_귀모'; } return $special; } diff --git a/hwe/func_process.php b/hwe/func_process.php index 328e1bec..2ab39467 100644 --- a/hwe/func_process.php +++ b/hwe/func_process.php @@ -2300,10 +2300,7 @@ function process_48(&$general) { if($isweap == 3) { $cost = getItemCost2($type); } else { $cost = getItemCost($type); } - //특기 보정 : 거상 - if($general['special'] == 30 && $type != 0) { $cost *= 0.5; } - - if($city['trade'] == 0 && $general['special'] != 30) { + if($city['trade'] == 0) { $log[] = "●{$admin['month']}월:도시에 상인이 없습니다. 장비매매 실패. <1>$date"; } elseif($city['secu']/1000 < $type) { $log[] = "●{$admin['month']}월:이 도시에서는 구할 수 없었습니다. 구입 실패. <1>$date"; @@ -2415,7 +2412,7 @@ function process_49(&$general) { if($amount < 100) { $amount = 100; } elseif($amount > 10000) { $amount = 10000; } - if($city['trade'] == 0 && ($general['special'] == 30 || $general['npc'] >= 2)) { + if($city['trade'] == 0 && $general['npc'] >= 2) { $city['trade'] = 100; } @@ -2427,26 +2424,17 @@ function process_49(&$general) { $dtype = "군량 판매"; if($general['rice'] < $amount) { $amount = $general['rice']; } $cost = $amount * $city['trade'] / 100; - //특기 보정 : 거상 - if($general['special'] == 30 && $city['trade'] > 100) { $cost = $amount * (6 * $city['trade']/100 - 5); } // 이익인 경우 5배 이득 - if($general['special'] == 30 && $city['trade'] < 100) { $cost = $amount * (0.2 * $city['trade']/100 + 0.8); } // 손해인 경우 1/5배 손해 $tax = $cost * GameConst::$exchangeFee; $cost = $cost - $tax; } elseif($type == 2) { $dtype = "군량 구입"; $cost = $amount * $city['trade'] / 100; - //특기 보정 : 거상 - if($general['special'] == 30 && $city['trade'] < 100) { $cost = $amount * (6 * $city['trade']/100 - 5); } // 이익인 경우 5배 이득 - if($general['special'] == 30 && $city['trade'] > 100) { $cost = $amount * (0.2 * $city['trade']/100 + 0.8); } // 손해인 경우 1/5배 손해 $tax = $cost * GameConst::$exchangeFee; $cost = $cost + $tax; if($general['gold'] < $cost) { $cost = $general['gold']; $tax = $cost * GameConst::$exchangeFee; $amount = ($cost-$tax) * 100 / $city['trade']; - //특기 보정 : 거상 - if($general['special'] == 30 && $city['trade'] < 100) { $amount = ($cost-$tax) / (6 * $city['trade']/100 - 5); } // 이익인 경우 5배 이득 - if($general['special'] == 30 && $city['trade'] > 100) { $amount = ($cost-$tax) / (0.2 * $city['trade']/100 + 0.8); } // 손해인 경우 1/5배 손해 } } @@ -2454,7 +2442,7 @@ function process_49(&$general) { $amount = Util::round($amount); $tax = Util::round($tax); - if($city['trade'] == 0 && $general['special'] != 30 && $general['npc'] < 2) { + if($city['trade'] == 0 && $general['npc'] < 2) { $log[] = "●{$admin['month']}월:도시에 상인이 없습니다. $dtype 실패. <1>$date"; } elseif($general['nation'] != $city['nation'] && $nation['level'] != 0) { $log[] = "●{$admin['month']}월:아국이 아닙니다. $dtype 실패. <1>$date"; diff --git a/hwe/func_template.php b/hwe/func_template.php index aa19fda6..30aa11d8 100644 --- a/hwe/func_template.php +++ b/hwe/func_template.php @@ -76,7 +76,7 @@ function displayCharInfo(?int $type):string{ ]); } -function displaySpecialInfo(?int $type):string{ +function displaySpecialWarInfo(?int $type):string{ $info = getSpecialInfo($type); $text = getGenSpecial($type); @@ -88,6 +88,19 @@ function displaySpecialInfo(?int $type):string{ ]); } +function displaySpecialDomesticInfo(?string $type):string{ + $class = getGeneralSpecialDomesticClass($type); + $info = $class::$info; + $name = $class::$name; + + $templates = new \League\Plates\Engine(__dir__.'/templates'); + + return $templates->render('tooltip', [ + 'text'=>$name, + 'info'=>$info, + ]); +} + function displayItemInfo(?int $type):string{ $info = getItemInfo($type); $text = getItemName($type); diff --git a/hwe/func_time_event.php b/hwe/func_time_event.php index 92545222..0b1c2f66 100644 --- a/hwe/func_time_event.php +++ b/hwe/func_time_event.php @@ -17,15 +17,11 @@ function processSpring() { $query = "update city set dead=0,agri=agri*0.99,comm=comm*0.99,secu=secu*0.99,def=def*0.99,wall=wall*0.99"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - // 유지비 1% 거상 0.5% - $query = "update general set gold=gold*0.99 where gold>1000 and gold<=10000 and special!=30"; + // 유지비 1% + $query = "update general set gold=gold*0.99 where gold>1000 and gold<=10000"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $query = "update general set gold=gold*0.995 where gold>1000 and gold<=10000 and special=30"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - // 유지비 3% 거상 1.5% - $query = "update general set gold=gold*0.97 where gold>10000 and special!=30"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $query = "update general set gold=gold*0.985 where gold>10000 and special=30"; + // 유지비 3% + $query = "update general set gold=gold*0.97 where gold>10000"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); // 유지비 1% @@ -343,15 +339,11 @@ function processFall() { $query = "update city set dead=0,agri=agri*0.99,comm=comm*0.99,secu=secu*0.99,def=def*0.99,wall=wall*0.99"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - // 유지비 3% 거상 1.5% - $query = "update general set rice=rice*0.97 where rice>10000 and special!=30"; + // 유지비 3% + $query = "update general set rice=rice*0.97 where rice>10000"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $query = "update general set rice=rice*0.985 where rice>10000 and special=30"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - // 유지비 1% 거상 0.5% - $query = "update general set rice=rice*0.99 where rice>1000 and rice<=10000 and special!=30"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $query = "update general set rice=rice*0.995 where rice>1000 and rice<=10000 and special=30"; + // 유지비 1% + $query = "update general set rice=rice*0.99 where rice>1000 and rice<=10000"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); // 유지비 5% $query = "update nation set rice=rice*0.95 where rice>100000"; diff --git a/hwe/j_get_select_npc_token.php b/hwe/j_get_select_npc_token.php index 7944cf70..b5ae3f8d 100644 --- a/hwe/j_get_select_npc_token.php +++ b/hwe/j_get_select_npc_token.php @@ -91,7 +91,7 @@ $candidates = []; $weight = []; foreach($db->query('SELECT `no`, `name`, leader, power, intel, imgsvr, picture, special, special2 FROM general WHERE npc=2') as $general){ - $general['special'] = \sammo\SpecialityConst::DOMESTIC[$general['special']][0]??'-'; + $general['special'] = (getGeneralSpecialDomesticClass($general['special']))::$name; $general['special2'] = \sammo\SpecialityConst::WAR[$general['special2']][0]??'-'; $candidates[$general['no']] = $general + ['keepCnt'=>KEEP_CNT]; $allStat = $general['leader'] + $general['power'] + $general['intel']; diff --git a/hwe/join_post.php b/hwe/join_post.php index a830e0c8..8b9a0369 100644 --- a/hwe/join_post.php +++ b/hwe/join_post.php @@ -166,7 +166,7 @@ if ($genius) { } //내특 $specage = Util::round((80 - $age)/12) + $age; -$special = 0; +$special = GameConst::$defaultSpecial; $admin = $gameStor->getValues(['scenario', 'turnterm', 'show_img_level']); diff --git a/hwe/js/battle_simulator.js b/hwe/js/battle_simulator.js index 0169d561..51694041 100644 --- a/hwe/js/battle_simulator.js +++ b/hwe/js/battle_simulator.js @@ -364,7 +364,7 @@ jQuery(function($){ nation: (generalData.no)<=1 ? 1 : 2, city: (generalData.no)<=1 ? 1 : 3, turntime:'2018-08-26 12:00', - special:0, + special:defaultSpecial, leader2:0, power2:0, intel2:0, diff --git a/hwe/sammo/GameConstBase.php b/hwe/sammo/GameConstBase.php index 87a343c5..912992c3 100644 --- a/hwe/sammo/GameConstBase.php +++ b/hwe/sammo/GameConstBase.php @@ -99,6 +99,12 @@ class GameConstBase 'che_도적', 'che_명가', 'che_음양가', 'che_종횡가', 'che_불가', 'che_오두미도', 'che_태평도', 'che_도가', 'che_묵가', 'che_덕가', 'che_병가', 'che_유가', 'che_법가' ]; - + /** @var array 기본 국가 성향 */ public static $neutralNationType = 'che_중립'; + /** @var array 선택 가능한 장수 내정 특기 */ + public static $availableSpecialDomestic = [ + 'che_경작', 'che_상재', 'che_발명', 'che_축성', 'che_수비', 'che_통찰', 'che_인덕', 'che_귀모', + ]; + /** @var array 기본 특기(공용) */ + public static $defaultSpecial = 'None'; } diff --git a/hwe/sammo/General.php b/hwe/sammo/General.php index debf71b3..ba6cc145 100644 --- a/hwe/sammo/General.php +++ b/hwe/sammo/General.php @@ -16,6 +16,7 @@ class General{ protected $nationType; protected $levelObj; + protected $specialDomesticObj; public function __construct(array $raw, ?array $city, int $year, int $month){ //TODO: 밖에서 가져오도록 하면 버그 확률이 높아짐. 필요한 raw 값을 직접 구해야함. diff --git a/hwe/sammo/Scenario/NPC.php b/hwe/sammo/Scenario/NPC.php index 9e571662..e8b67778 100644 --- a/hwe/sammo/Scenario/NPC.php +++ b/hwe/sammo/Scenario/NPC.php @@ -20,7 +20,7 @@ class NPC{ public $birth; public $death; public $ego; - public $charDomestic = 0; + public $charDomestic; public $charWar = 0; public $npc = 2; public $text; @@ -62,6 +62,8 @@ class NPC{ 'intel'=>$intel ]; + $this->charDomestic = \sammo\GameConst::$defaultSpecial; + if($char === '랜덤전특'){ $this->charWar = \sammo\SpecialityConst::pickSpecialWar($general); } @@ -76,13 +78,17 @@ class NPC{ $this->charDomestic = \sammo\SpecialityConst::pickSpecialDomestic($general); } } + else if($char !== null){ + } else{ - $char = \sammo\SpecCall($char); - if($char < 40){ - $this->charDomestic = $char; + //TODO: 내특, 전특 구분 필요 + + try{ + $domesticClass = \sammo\getGeneralSpecialDomesticClass($char); + $this->charDomestic = Util::getClassName($domesticClass); } - else{ - $this->charWar = $char; + catch (Exception $e) { + $this->charWar = \sammo\SpecCall($char); } } } @@ -153,7 +159,7 @@ class NPC{ if($isFictionMode){ $charWar = 0; - $charDomestic = 0; + $charDomestic = GameConst::$defaultSpecial; } $name = 'ⓝ'.$this->name; diff --git a/hwe/sammo/SpecialityConst.php b/hwe/sammo/SpecialityConst.php index 9c406b18..dd66f49a 100644 --- a/hwe/sammo/SpecialityConst.php +++ b/hwe/sammo/SpecialityConst.php @@ -29,18 +29,17 @@ class SpecialityConst{ //음수 : 절대값 %, 양수 : 상대적 비중 const DOMESTIC = [ - 1 => ['경작', 1, [self::STAT_INTEL]], - 2 => ['상재', 1, [self::STAT_INTEL]], - 3 => ['발명', 1, [self::STAT_INTEL]], + 'che_경작' => ['경작', 1, [self::STAT_INTEL]], + 'che_상재' => ['상재', 1, [self::STAT_INTEL]], + 'che_발명' => ['발명', 1, [self::STAT_INTEL]], - 10 => ['축성', 1, [self::STAT_POWER]], - 11 => ['수비', 1, [self::STAT_POWER]], - 12 => ['통찰', 1, [self::STAT_POWER]], + 'che_축성' => ['축성', 1, [self::STAT_POWER]], + 'che_수비' => ['수비', 1, [self::STAT_POWER]], + 'che_통찰' => ['통찰', 1, [self::STAT_POWER]], - 20 => ['인덕', 1, [self::STAT_LEADERSHIP]], + 'che_인덕' => ['인덕', 1, [self::STAT_LEADERSHIP]], - 30 => ['거상', -2.5, [self::DISABLED]], - 31 => ['귀모', -2.5, [self::STAT_LEADERSHIP, self::STAT_POWER, self::STAT_INTEL]], + 'che_귀모' => ['귀모', -2.5, [self::STAT_LEADERSHIP, self::STAT_POWER, self::STAT_INTEL]], ]; const WAR = [ @@ -162,7 +161,7 @@ class SpecialityConst{ return array_keys($dex, max($dex))[0]; } - public static function pickSpecialDomestic(array $general) : int{ + public static function pickSpecialDomestic(array $general) : string{ $pAbs = []; $pRel = []; @@ -204,7 +203,7 @@ class SpecialityConst{ return $id; } - return static::pickStatickWar($general); + throw new MustNotBeReachedException(); } public static function pickSpecialWar(array $general) : int{ @@ -258,6 +257,6 @@ class SpecialityConst{ return $id; } - return static::pickStatickWar($general); + throw new MustNotBeReachedException(); } } \ No newline at end of file diff --git a/hwe/sammo/WarUnit.php b/hwe/sammo/WarUnit.php index 63420789..6b99655f 100644 --- a/hwe/sammo/WarUnit.php +++ b/hwe/sammo/WarUnit.php @@ -110,8 +110,8 @@ class WarUnit{ return $this->deadCurr; } - function getSpecialDomestic():int{ - return 0; + function getSpecialDomestic():string{ + return GameConst::$defaultSpecial; } function getSpecialWar():int{ diff --git a/hwe/sammo/WarUnitGeneral.php b/hwe/sammo/WarUnitGeneral.php index 9cef3ae6..c06523df 100644 --- a/hwe/sammo/WarUnitGeneral.php +++ b/hwe/sammo/WarUnitGeneral.php @@ -53,7 +53,7 @@ class WarUnitGeneral extends WarUnit{ return $this->rawCity[$key]; } - function getSpecialDomestic():int{ + function getSpecialDomestic():string{ return $this->getVar('special'); } diff --git a/hwe/select_npc.php b/hwe/select_npc.php index 979bbf62..40e7dc04 100644 --- a/hwe/select_npc.php +++ b/hwe/select_npc.php @@ -37,10 +37,11 @@ $nationList = $db->query('SELECT nation,`name`,color,scout,scoutmsg FROM nation var specialInfo = $values) { - $name = $values[0]; - $text = getSpecialInfo($id); - $specialAll[$name] = $text; +foreach (GameConst::$availableSpecialDomestic as $id) { + $domesticClass = getGeneralSpecialDomesticClass($id); + $name = $domesticClass::$name; + $info = $domesticClass::$info; + $specialAll[$name] = $info; } foreach (SpecialityConst::WAR as $id=>$values) { $name = $values[0]; diff --git a/hwe/sql/schema.sql b/hwe/sql/schema.sql index a11bf151..767a3f91 100644 --- a/hwe/sql/schema.sql +++ b/hwe/sql/schema.sql @@ -74,7 +74,7 @@ CREATE TABLE `general` ( `belong` INT(2) NULL DEFAULT '1', `betray` INT(2) NULL DEFAULT '0', `personal` INT(2) NULL DEFAULT '0', - `special` INT(2) NULL DEFAULT '0', + `special` VARCHAR(20) NOT NULL DEFAULT 'None', `specage` INT(2) NULL DEFAULT '0', `special2` INT(2) NULL DEFAULT '0', `specage2` INT(2) NULL DEFAULT '0', @@ -202,7 +202,7 @@ CREATE TABLE `nation` ( `power` INT(8) NULL DEFAULT '0', `spy` CHAR(255) NOT NULL DEFAULT '{}', `level` INT(1) NULL DEFAULT '0', - `type` VARCHAR(16) NULL DEFAULT 'che_중립', + `type` VARCHAR(20) NOT NULL DEFAULT 'che_중립', `rule` TEXT NULL DEFAULT '', `history` MEDIUMTEXT NULL DEFAULT '', `board0` TEXT NULL DEFAULT '', diff --git a/src/sammo/Util.php b/src/sammo/Util.php index 41e84a7d..6b0091df 100644 --- a/src/sammo/Util.php +++ b/src/sammo/Util.php @@ -451,4 +451,10 @@ class Util extends \utilphp\util { return $items[array_rand($items)]; } + + function getClassName(string $classpath) + { + if ($pos = strrpos($classpath, '\\')) return substr($classpath, $pos + 1); + return $pos; + } };