장수 성격, 아이템 설명 툴팁 추가

This commit is contained in:
2018-07-11 21:50:01 +09:00
parent 0d925af065
commit a7270b2cd2
9 changed files with 120 additions and 12 deletions
+1 -1
View File
@@ -218,7 +218,7 @@ $itemTypes = [
["명 마", 'horse', function($v){return getHorseName($v);}, 7, 26, []],
["명 검", 'weap', function($v){return getWeapName($v);}, 7, 26, []],
["명 서", 'book', function($v){return getBookName($v);}, 7, 26, []],
["도 구", 'item', function($v){return getItemName($v);}, 7, 26, []],
["도 구", 'item', function($v){return displayItemInfo($v);}, 7, 26, []],
];
$simpleItemTypes = array_map(function($itemType){return $itemType[1];}, $itemTypes);
+1 -1
View File
@@ -170,7 +170,7 @@ for ($j=0; $j < $gencount; $j++) {
<td align=center><img width='64' height='64' src={$imageTemp}/{$general['picture']}></img></td>
<td align=center>$name</td>
<td align=center>{$general['age']}세</td>
<td align=center>".getGenChar($general['personal'])."</td>
<td align=center>".displayCharInfo($general['personal'])."</td>
<td align=center>".displaySpecialInfo($general['special'])." / ".displaySpecialInfo($general['special2'])."</td>
<td align=center>Lv ".getExpLevel($general['experience'])."</td>
<td align=center>{$nation}</td>
+1 -1
View File
@@ -111,7 +111,7 @@ for ($j=0; $j < $gencount; $j++) {
<td align=center>{$general['name2']}</td>
<td align=center>Lv {$general['explevel']}</td>
<td align=center>{$nation}</td>
<td align=center>".getGenChar($general['personal'])."</td>
<td align=center>".displayCharInfo($general['personal'])."</td>
<td align=center>".displaySpecialInfo($general['special'])." / ".displaySpecialInfo($general['special2'])."</td>
<td align=center>{$general['sum']}</td>
<td align=center>{$general['leader']}</td>
+1 -1
View File
@@ -185,7 +185,7 @@ for($j=0; $j < $gencount; $j++) {
<td align=center>$intel</td>
<td align=center>{$general['gold']}</td>
<td align=center>{$general['rice']}</td>
<td align=center>".getGenChar($general['personal'])."</td>
<td align=center>".displayCharInfo($general['personal'])."</td>
<td align=center>".displaySpecialInfo($general['special'])." / ".displaySpecialInfo($general['special2'])."</td>
<td align=center>{$general['belong']}</td>
<td align=center>{$general['connect']}"; echo "<br>(".getConnect($general['connect']).")</td>
+2 -2
View File
@@ -821,7 +821,7 @@ function generalInfo($no) {
$weapname = getWeapName($general['weap']);
$bookname = getBookName($general['book']);
$horsename = getHorseName($general['horse']);
$itemname = getItemName($general['item']);
$itemname = displayItemInfo($general['item']);
if($general['injury'] > 0) {
$leader = intdiv($general['leader'] * (100 - $general['injury']), 100);
$power = intdiv($general['power'] * (100 - $general['injury']), 100);
@@ -913,7 +913,7 @@ function generalInfo($no) {
<td style='text-align:center;' class='bg1'><b>병사</b></td>
<td style='text-align:center;' colspan=2>{$general['crew']}</td>
<td style='text-align:center;' class='bg1'><b>성격</b></td>
<td style='text-align:center;' colspan=2>".getGenChar($general['personal'])."</td>
<td style='text-align:center;' colspan=2>".displayCharInfo($general['personal'])."</td>
</tr>
<tr>
<td style='text-align:center;' class='bg1'><b>훈련</b></td>
+60 -3
View File
@@ -135,6 +135,28 @@ function getGenChar($type) {
return $call;
}
function getCharInfo(?int $type):?string {
if($type === null){
return null;
}
$infoText = [
10=>['은둔', '명성 -10%, 계급 -10%, 사기 -5, 훈련 -5, 단련 성공률 +10%'],
9=>['안전', '사기 -5, 징·모병 비용 -20%'],
8=>['유지', '훈련 -5, 징·모병 비용 -20%'],
7=>['재간', '명성 -10%, 징·모병 비용 -20%'],
6=>['출세', '명성 +10%, 징·모병 비용 +20%'],
5=>['할거', '명성 -10%, 훈련 +5'],
4=>['정복', '명성 -10%, 사기 +5'],
3=>['패권', '훈련 +5, 징·모병 비용 +20%'],
2=>['의협', '사기 +5, 징·모병 비용 +20%'],
1=>['대의', '명성 +10%, 훈련 -5'],
0=>['왕좌', '명성 +10%, 사기 -5'],
];
return $infoText[$type][1]??null;
}
function getGenSpecial($type) {
switch($type) {
case 0: $call = '-'; break;
@@ -198,10 +220,10 @@ function getSpecialInfo(?int $type):?string{
20 => ['인덕', '[내정] 주민 선정·정착 장려 : 기본 보정 +10%, 성공률 +10%p, 비용 -20%'],
30 => ['거상', '이것 저것'],
31 => ['귀모', '[내정] 화계·탈취·파괴·선동 : 성공률 +20%p'],
31 => ['귀모', '[계략] 화계·탈취·파괴·선동 : 성공률 +20%p'],
40 => ['귀병', '[군사] 귀병 계통 징·모병비 -10%<br>[전투] 계략 시도 확률 +20%p'],
41 => ['신산', '[내정] 화계·탈취·파괴·선동 : 성공률 +10%p<br>[전투] 계략 시도 확률 +20%p, 계략 성공 확률 +20%p '],
41 => ['신산', '[계략] 화계·탈취·파괴·선동 : 성공률 +10%p<br>[전투] 계략 시도 확률 +20%p, 계략 성공 확률 +20%p '],
42 => ['환술', '[전투] 계략 시도 확률 +10%p, 계략 성공 시 대미지 +30%'],
43 => ['집중', '[전투] 계략 성공 시 대미지 +50%'],
44 => ['신중', '[전투] 계략 성공 확률 100%'],
@@ -776,7 +798,7 @@ function getHorseEff($horse) : int {
return $horse;
}
function getItemName($item) : string {
function getItemName($item) : ?string {
switch($item) {
case 0: $itemname = '-'; break;
case 1: $itemname = '환약(치료)'; break;
@@ -806,10 +828,45 @@ function getItemName($item) : string {
case 24: $itemname = '태평청령(의술)'; break;
case 25: $itemname = '태평요술(회피)'; break;
case 26: $itemname = '둔갑천서(회피)'; break;
default: $itemname = null;
}
return $itemname;
}
function getItemInfo(?int $item):?string{
$itemInfo = [
1=>['환약(치료)', '[군사] 턴 실행 전 부상 회복. 1회용'],
2=>['수극(저격)', '[전투] 전투 개시 전 20% 확률로 저격 시도. 1회용'],
3=>['탁주(사기)', '[전투] 사기 보정 +3. 1회용'],
4=>['청주(훈련)', '[전투] 훈련 보정 +3. 1회용'],
5=>['이추(계략)', '[계략] 화계·탈취·파괴·선동 : 성공률 +10%p. 1회용'],
6=>['향낭(계략)', '[계략] 화계·탈취·파괴·선동 : 성공률 +20%p. 1회용'],
7=>['오석산(치료)', '[군사] 턴 실행 전 부상 회복.'],
8=>['무후행군(치료)', '[군사] 턴 실행 전 부상 회복.'],
9=>['도소연명(치료)', '[군사] 턴 실행 전 부상 회복.'],
10=>['칠엽청점(치료)', '[군사] 턴 실행 전 부상 회복.'],
11=>['정력견혈(치료)', '[군사] 턴 실행 전 부상 회복.'],
12=>['과실주(훈련)', '[전투] 훈련 보정 +5'],
13=>['이강주(훈련)', '[전투] 훈련 보정 +5'],
14=>['의적주(사기)', '[전투] 사기 보정 +5'],
15=>['두강주(사기)', '[전투] 사기 보정 +5'],
16=>['보령압주(사기)', '[전투] 사기 보정 +5'],
17=>['철벽서(훈련)', '[전투] 훈련 보정 +7'],
18=>['단결도(훈련)', '[전투] 훈련 보정 +7'],
19=>['춘화첩(사기)', '[전투] 사기 보정 +7'],
20=>['초선화(사기)', '[전투] 사기 보정 +7'],
21=>['육도(계략)', '[계략] 화계·탈취·파괴·선동 : 성공률 +20%p'],
22=>['삼략(계략)', '[계략] 화계·탈취·파괴·선동 : 성공률 +20%p'],
23=>['청낭서(의술)', '[군사] 매 턴마다 자신(100%)과 소속 도시 장수(적 포함 50%) 부상 회복<br>[전투] 페이즈마다 20% 확률로 치료 발동(아군 피해 1/3 감소)'],
24=>['태평청령(의술)', '[군사] 매 턴마다 자신(100%)과 소속 도시 장수(적 포함 50%) 부상 회복<br>[전투] 페이즈마다 20% 확률로 치료 발동(아군 피해 1/3 감소)'],
25=>['태평요술(회피)', '[전투] 회피 확률 +20%p'],
26=>['둔갑천서(회피)', '[전투] 회피 확률 +20%p'],
];
return $itemInfo[$item][1]??null;
}
function getItemCost2($weap) : int {
switch($weap) {
case 0: $weapcost = 0; break;
+25
View File
@@ -64,6 +64,18 @@ function CoreTurnTable() {
";
}
function displayCharInfo(?int $type):string{
$info = getCharInfo($type);
$text = getGenChar($type);
$templates = new \League\Plates\Engine(__dir__.'/templates');
return $templates->render('tooltip', [
'text'=>$text,
'info'=>$info,
]);
}
function displaySpecialInfo(?int $type):string{
$info = getSpecialInfo($type);
$text = getGenSpecial($type);
@@ -76,6 +88,19 @@ function displaySpecialInfo(?int $type):string{
]);
}
function displayItemInfo(?int $type):string{
$info = getItemInfo($type);
$text = getItemName($type);
$templates = new \League\Plates\Engine(__dir__.'/templates');
return $templates->render('tooltip', [
'text'=>$text,
'info'=>$info,
]);
}
function allButton() {
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
+15 -2
View File
@@ -38,11 +38,24 @@ $connect=$db->get();
var defaultStatTotal = <?=GameConst::$defaultStatTotal?>;
var defaultStatMin = <?=GameConst::$defaultStatMin?>;
var defaultStatMax = <?=GameConst::$defaultStatMax?>;
var charInfoText = <?php
$charInfoText = [];
for($i=0;$i<=9;$i++){
//XXX:하드코딩 금지!
$charInfoText[$i] = getCharInfo($i);
}
echo Json::encode((object)$charInfoText);
?>;
</script>
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
<?=WebUtil::printCSS('../d_shared/common.css')?>
<?=WebUtil::printCSS('css/common.css')?>
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
<?=WebUtil::printJS('../d_shared/common_path.js')?>
<?=WebUtil::printJS('js/common.js')?>
<?=WebUtil::printJS('js/join.js')?>
</head>
@@ -106,7 +119,7 @@ if ($admin['show_img_level'] >= 1 && $member['grade'] >= 1 && $member['picture']
<tr>
<td width=498 align=right id=bg1>성격</td>
<td colspan=2>
<select name=character size=1 maxlength=15 style=color:white;background-color:black;>
<select id="selChar" name=character size=1 maxlength=15 style=color:white;background-color:black;>
<option selected value=11>????</option>
<!--
<option value=10>은둔</option>
@@ -121,7 +134,7 @@ if ($admin['show_img_level'] >= 1 && $member['grade'] >= 1 && $member['picture']
<option value=2>의협</option>
<option value=1>대의</option>
<option value=0>왕좌</option>
</select> ※보정은 도움말 참고
</select> <span id="charInfoText"></span>
</td>
</tr>
<tr>
+14 -1
View File
@@ -150,4 +150,17 @@ jQuery(function($){
window.abilityLeadpow = abilityLeadpow;
window.abilityLeadint = abilityLeadint;
window.abilityPowint = abilityPowint;
});
var $charInfoText = $('#charInfoText');
var $selChar = $('#selChar');
$selChar.change(function(){
var $this = $(this);
var char = $this.val();
if(char in charInfoText){
$charInfoText.html(charInfoText[char]);
}
else{
$charInfoText.html('');
}
});
});