forked from devsam/core
내특을 int에서 string으로 변경
This commit is contained in:
+1
-1
@@ -178,7 +178,7 @@ for ($j=0; $j < $gencount; $j++) {
|
||||
<td align=center>$name</td>
|
||||
<td align=center>{$general['age']}세</td>
|
||||
<td align=center>".displayCharInfo($general['personal'])."</td>
|
||||
<td align=center>".displaySpecialInfo($general['special'])." / ".displaySpecialInfo($general['special2'])."</td>
|
||||
<td align=center>".displaySpecialDomesticInfo($general['special'])." / ".displaySpecialWarInfo($general['special2'])."</td>
|
||||
<td align=center>Lv ".getExpLevel($general['experience'])."</td>
|
||||
<td align=center>{$nation}</td>
|
||||
<td align=center>".getHonor($general['experience'])."</td>
|
||||
|
||||
+1
-1
@@ -111,7 +111,7 @@ for ($j=0; $j < $gencount; $j++) {
|
||||
<td align=center>Lv {$general['explevel']}</td>
|
||||
<td align=center>{$nation}</td>
|
||||
<td align=center>".displayCharInfo($general['personal'])."</td>
|
||||
<td align=center>".displaySpecialInfo($general['special'])." / ".displaySpecialInfo($general['special2'])."</td>
|
||||
<td align=center>".displaySpecialDomesticInfo($general['special'])." / ".displaySpecialWarInfo($general['special2'])."</td>
|
||||
<td align=center>{$general['sum']}</td>
|
||||
<td align=center>{$general['leader']}</td>
|
||||
<td align=center>{$general['power']}</td>
|
||||
|
||||
+1
-1
@@ -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";
|
||||
|
||||
+1
-1
@@ -186,7 +186,7 @@ for($j=0; $j < $gencount; $j++) {
|
||||
<td align=center>{$general['gold']}</td>
|
||||
<td align=center>{$general['rice']}</td>
|
||||
<td align=center>".displayCharInfo($general['personal'])."</td>
|
||||
<td align=center>".displaySpecialInfo($general['special'])." / ".displaySpecialInfo($general['special2'])."</td>
|
||||
<td align=center>".displaySpecialDomesticInfo($general['special'])." / ".displaySpecialWarInfo($general['special2'])."</td>
|
||||
<td align=center>{$general['belong']}</td>
|
||||
<td align=center>{$general['connect']}"; echo "<br>(".getConnect($general['connect']).")</td>
|
||||
</tr>";
|
||||
|
||||
@@ -28,6 +28,9 @@ $startYear = $gameStor->getValue('startyear');
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/download2.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<script>
|
||||
var defaultSpecial = <?=GameConst::$defaultSpecial?>;
|
||||
</script>
|
||||
<?=WebUtil::printJS('js/battle_simulator.js')?>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
+1
-1
@@ -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 = "ㆍ<span class='ev_warning'>더이상 등록할 수 없습니다.</span>";
|
||||
$msg2 = "ㆍ<span class='ev_warning'>더이상 등록할 수 없습니다.</span>";
|
||||
|
||||
+12
-14
@@ -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'] = "<font color=red>{$general['age']} 세</font>"; }
|
||||
|
||||
$general['connect'] = Util::round($general['connect'] / 10) * 10;
|
||||
$special = $general['special'] == 0 ? "{$general['specage']}세" : "<font color=limegreen>".displaySpecialInfo($general['special'])."</font>";
|
||||
$special2 = $general['special2'] == 0 ? "{$general['specage2']}세" : "<font color=limegreen>".displaySpecialInfo($general['special2'])."</font>";
|
||||
$special = $general['special'] == GameConst::$defaultSpecial ? "{$general['specage']}세" : "<font color=limegreen>".displaySpecialDomesticInfo($general['special'])."</font>";
|
||||
$special2 = $general['special2'] == 0 ? "{$general['specage2']}세" : "<font color=limegreen>".displaySpecialWarInfo($general['special2'])."</font>";
|
||||
|
||||
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, "<C>●</>{$admin['year']}년 {$admin['month']}월:특기 【<b><C>".getGenSpecial($special)."</></b>】{$josaUl} 습득");
|
||||
pushGenLog($general, "<C>●</>특기 【<b><L>".getGenSpecial($special)."</></b>】{$josaUl} 익혔습니다!");
|
||||
$josaUl = JosaUtil::pick($specialText, '을');
|
||||
pushGeneralHistory($general, "<C>●</>{$admin['year']}년 {$admin['month']}월:특기 【<b><C>{$specialText}</></b>】{$josaUl} 습득");
|
||||
pushGenLog($general, "<C>●</>특기 【<b><L>{$specialText}</></b>】{$josaUl} 익혔습니다!");
|
||||
}
|
||||
|
||||
$query = "select no,name,nation,leader,power,intel,npc,dex0,dex10,dex20,dex30,dex40 from general where specage2<=age and special2='0'";
|
||||
|
||||
+27
-34
@@ -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%<br>[전투] 계략 성공 확률 +20%p'],
|
||||
41 => ['신산', '[계략] 화계·탈취·파괴·선동 : 성공률 +10%p<br>[전투] 계략 시도 확률 +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;
|
||||
|
||||
+10
-9
@@ -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;
|
||||
}
|
||||
|
||||
+3
-15
@@ -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[] = "<C>●</>{$admin['month']}월:도시에 상인이 없습니다. 장비매매 실패. <1>$date</>";
|
||||
} elseif($city['secu']/1000 < $type) {
|
||||
$log[] = "<C>●</>{$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[] = "<C>●</>{$admin['month']}월:도시에 상인이 없습니다. $dtype 실패. <1>$date</>";
|
||||
} elseif($general['nation'] != $city['nation'] && $nation['level'] != 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:아국이 아닙니다. $dtype 실패. <1>$date</>";
|
||||
|
||||
+14
-1
@@ -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);
|
||||
|
||||
+8
-16
@@ -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";
|
||||
|
||||
@@ -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'];
|
||||
|
||||
+1
-1
@@ -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']);
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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';
|
||||
}
|
||||
|
||||
@@ -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 값을 직접 구해야함.
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -110,8 +110,8 @@ class WarUnit{
|
||||
return $this->deadCurr;
|
||||
}
|
||||
|
||||
function getSpecialDomestic():int{
|
||||
return 0;
|
||||
function getSpecialDomestic():string{
|
||||
return GameConst::$defaultSpecial;
|
||||
}
|
||||
|
||||
function getSpecialWar():int{
|
||||
|
||||
@@ -53,7 +53,7 @@ class WarUnitGeneral extends WarUnit{
|
||||
return $this->rawCity[$key];
|
||||
}
|
||||
|
||||
function getSpecialDomestic():int{
|
||||
function getSpecialDomestic():string{
|
||||
return $this->getVar('special');
|
||||
}
|
||||
|
||||
|
||||
+5
-4
@@ -37,10 +37,11 @@ $nationList = $db->query('SELECT nation,`name`,color,scout,scoutmsg FROM nation
|
||||
var specialInfo =
|
||||
<?php
|
||||
$specialAll = [];
|
||||
foreach (SpecialityConst::DOMESTIC as $id=>$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];
|
||||
|
||||
+2
-2
@@ -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 '',
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user