diff --git a/hwe/css/board.css b/hwe/css/board.css new file mode 100644 index 00000000..e69de29b diff --git a/hwe/css/diplomacy.css b/hwe/css/diplomacy.css new file mode 100644 index 00000000..e69de29b diff --git a/hwe/func_converter.php b/hwe/func_converter.php index fb6f2779..c6d88e94 100644 --- a/hwe/func_converter.php +++ b/hwe/func_converter.php @@ -158,7 +158,7 @@ function getSpecialInfo(?int $type):?string{ 42 => ['환술', '[전투] 계략 성공 확률 +10%p, 계략 성공 시 대미지 +30%'], 43 => ['집중', '[전투] 계략 성공 시 대미지 +50%'], 44 => ['신중', '[전투] 계략 성공 확률 100%'], - 45 => ['반계', '[전투] 상대의 계략을 30% 확률로 되돌림, 반목 성공시 대미지 추가(+60% → +100%)'], + 45 => ['반계', '[전투] 상대의 계략 성공 확률 -10%p, 상대의 계략을 40% 확률로 되돌림, 반목 성공시 대미지 추가(+60% → +100%)'], 50 => ['보병', '[군사] 보병 계통 징·모병비 -10%[전투] 공격 시 아군 피해 -10%, 수비 시 아군 피해 -20%'], 51 => ['궁병', '[군사] 궁병 계통 징·모병비 -10%[전투] 회피 확률 +20%p'], diff --git a/hwe/func_process.php b/hwe/func_process.php index 0767545c..c1eb0de8 100644 --- a/hwe/func_process.php +++ b/hwe/func_process.php @@ -189,10 +189,5 @@ function setLeadershipBonus(&$general, $nationLevel){ function CriticalScoreEx(string $type):float { if($type == 'success'){ return Util::randRange(2.2, 3.0); - } - if($type == 'fail'){ - return Util::randRange(0.2, 0.4); - } - return 1; } diff --git a/hwe/func_process_personnel.old.php b/hwe/func_process_personnel.old.php index 9d6cebc6..9647f57d 100644 --- a/hwe/func_process_personnel.old.php +++ b/hwe/func_process_personnel.old.php @@ -11,7 +11,7 @@ function process_22(&$general) { $history = []; $date = substr($general['turntime'],11,5); - $admin = $gameStor->getValues(['startyear','year','month','develcost']); + $admin = $gameStor->getValues(['startyear','year','month','develcost','join_mode']); $query = "select nation,supply from city where city='{$general['city']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); @@ -26,7 +26,10 @@ function process_22(&$general) { $cost = Util::round($admin['develcost'] + ($you['experience'] + $you['dedication'])/1000) * 10; - if(!$you) { + if($admin['join_mode'] == 'onlyRandom'){ + $log[] = "●>{$admin['month']}월:랜덤 임관만 가능합니다. 등용 실패. <1>$date>"; + } + else if(!$you) { $log[] = "●>{$admin['month']}월:없는 장수입니다. 등용 실패. <1>$date>"; } elseif($admin['year'] < $admin['startyear']+3) { $log[] = "●>{$admin['month']}월:초반 제한중입니다. 등용 실패. <1>$date>"; @@ -70,7 +73,7 @@ function process_25(&$general) { $history = []; $date = substr($general['turntime'],11,5); - $admin = $gameStor->getValues(['startyear', 'year', 'month', 'scenario', 'fiction']); + $admin = $gameStor->getValues(['startyear', 'year', 'month', 'scenario', 'fiction', 'join_mode', 'init_year', 'init_month']); $query = "select nation from city where city='{$general['city']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); @@ -79,6 +82,10 @@ function process_25(&$general) { $command = DecodeCommand($general['turn0']); $where = $command[1]; + if($admin['join_mode'] == 'onlyRandom' && $where < 98){ + $where = 99; + } + $nation = null; $joinedNations = Json::decode($general['nations']); @@ -126,10 +133,18 @@ function process_25(&$general) { $allGen = array_sum($generals); + $genLimit = GameConst::$defaultMaxGeneral; + if($admin['join_mode'] == 'onlyRandom' && TimeUtil::IsRangeMonth($admin['init_year'], $admin['init_month'], 1, $admin['year'], $admin['month'])){ + $genLimit = GameConst::$initialNationGenLimitForRandInit; + } + else if($admin['year'] < $admin['startyear'] + 3){ + $genLimit = GameConst::$initialNationGenLimit; + } + $nations = $db->query( 'SELECT nation.`name` as `name`,nation.nation as nation,scout,nation.`level` as `level`,gennum,`injury` FROM nation join general on general.nation = nation.nation and general.level = 12 WHERE nation.nation not in %li and gennum < %i and scout = 0', $joinedNations, - ($admin['year'] < $admin['startyear']+3)?GameConst::$initialNationGenLimit:GameConst::$defaultMaxGeneral + $genLimit ); shuffle($nations); @@ -141,17 +156,20 @@ function process_25(&$general) { } $score = 1; - if($admin['startyear']+3 > $admin['year'] && $general['npc'] > 2){ + if($admin['startyear']+3 > $admin['year'] && $general['npc'] == 2){ $score *= sqrt((100-max(30, $testNation['injury']))/100); } - $score *= sqrt($allGen/$generals[$testNation['nation']]); + $score *= $allGen/$generals[$testNation['nation']]; $randVals[$idx] = $score; } if($randVals){ $nation = $nations[Util::choiceRandomUsingWeight($randVals)]; } + else{ + $nation = null; + } } else { $nation = $db->queryFirstRow('SELECT `name`,nation,scout,`level` FROM nation WHERE nation=%i', $where); @@ -164,6 +182,15 @@ function process_25(&$general) { if(!$nation) { $log[] = "●>{$admin['month']}월:임관할 국가가 없습니다. 임관 실패. <1>$date>"; + if($where >= 98 && $genLimit == GameConst::$initialNationGenLimitForRandInit){ + //랜덤 모드, 초기화시에는 랜덤 임관을 대신 한턴 더 넣어준다. + $db->update('general', [ + 'turn1'=>EncodeCommand(0, 0, $where, 25), + ], '`no` = %i', $general['no']); + pushGenLog($general, $log); + process_42($general); + return; + } } elseif($general['nation'] != 0) { $log[] = "●>{$admin['month']}월:재야가 아닙니다. 임관 실패. <1>$date>"; } elseif($nation['nation'] == 0) { @@ -644,6 +671,8 @@ function process_46(&$general) { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $nationcount = MYDB_num_rows($result); + $currNationLevel = $db->queryFirstField('SELECT level FROM nation WHERE nation=%i', $general['nation']); + $command = DecodeCommand($general['turn0']); $color = $command[1]; $type = $command[2]; // 1 ~ 13 @@ -661,6 +690,8 @@ function process_46(&$general) { $log[] = "●>{$admin['month']}월:건국 기간이 지났습니다. 건국 실패. <1>$date>"; } elseif($city['nation'] != 0) { $log[] = "●>{$admin['month']}월:공백지가 아닙니다. 건국 실패. <1>$date>"; + } elseif($currNationLevel != 0) { + $log[] = "●>{$admin['month']}월:방랑군이 아닙니다. 건국 실패. <1>$date>"; } elseif($nationcount > 0) { $log[] = "●>{$admin['month']}월:존재하는 국가명입니다. 건국 실패. <1>$date>"; } elseif($general['makelimit'] > 0) { diff --git a/hwe/j_board_article_add.php b/hwe/j_board_article_add.php index e212a239..7c90dba2 100644 --- a/hwe/j_board_article_add.php +++ b/hwe/j_board_article_add.php @@ -15,7 +15,7 @@ $text = Util::getReq('text'); increaseRefresh("회의실", 1); -$me = $db->queryFirstRow('SELECT no, nation, level, permission, con, turntime, belong, penalty FROM general WHERE owner=%i', $userID); +$me = $db->queryFirstRow('SELECT no, nation, name, level, permission, con, turntime, belong, penalty FROM general WHERE owner=%i', $userID); $con = checkLimit($me['con']); if ($con >= 2) { diff --git a/hwe/js/board.js b/hwe/js/board.js index dc08ad87..459f2008 100644 --- a/hwe/js/board.js +++ b/hwe/js/board.js @@ -2,8 +2,8 @@ function submitArticle(){ var $article = $('#newArticle'); - var $title = $article.find('input.titleInput'); - var $text = $article.find('input.contentInput'); + var $title = $article.find('.titleInput'); + var $text = $article.find('.contentInput'); var title = $.trim($title.val()); var text = $.trim($text.val()); @@ -87,7 +87,7 @@ function submitComment(){ return false; } -function drawArticle(articleObj){ +function drawArticle(idx, articleObj){ var $articleFrame = $('#articleTemplate > .articleFrame'); var $commentFrame = $('#commentTemplate > .comment'); @@ -96,8 +96,10 @@ function drawArticle(articleObj){ .data('no', articleObj.no) .data('author', articleObj.general_no); - $article.find('.author').text(articleObj.author); - $article.find('.title').text(articleObj.title); + console.log(articleObj); + + $article.find('.authorName').text(articleObj.author); + $article.find('.articleTitle').text(articleObj.title); $article.find('.date').text(articleObj.date); //$article.find('.text').text(articleObj.text); $article.find('.text').html(nl2br(escapeHtml(articleObj.text))); @@ -114,7 +116,9 @@ function drawArticle(articleObj){ $articleComment.append($comment); }); - $('#board').append($article); + var $board = $('#board'); + + $board.append($article); } function drawArticles(articlesObj){ diff --git a/hwe/process_war.php b/hwe/process_war.php index 3d148b1b..cc4c347f 100644 --- a/hwe/process_war.php +++ b/hwe/process_war.php @@ -110,6 +110,30 @@ function processWar(array $rawAttacker, array $rawDefenderCity){ $attackerIncTech = $attacker->getDead() * 0.01 * getNationTechMultiplier($rawAttackerNation['type']); $defenderIncTech = $attacker->getKilled() * 0.01 * getNationTechMultiplier($rawDefenderNation['type']); + $attackerGenCnt = $rawAttackerNation['gennum']; + $defenderGenCnt = $rawDefenderNation['gennum']; + $attackerGenCnt_eff = $db->queryFirstField('SELECT count(no) FROM general WHERE nation=%i AND npc != 5', $rawAttackerNation['nation']); + $defenderGenCnt_eff = $db->queryFirstField('SELECT count(no) FROM general WHERE nation=%i AND npc != 5', $rawDefenderNation['nation']); + + if($attackerGenCnt_eff < GameConst::$initialNationGenLimit){ + $attackerGenCnt = GameConst::$initialNationGenLimit; + $attackerGenCnt_eff = GameConst::$initialNationGenLimit; + } + + if($defenderGenCnt_eff < GameConst::$initialNationGenLimit){ + $defenderGenCnt = GameConst::$initialNationGenLimit; + $defenderGenCnt_eff = GameConst::$initialNationGenLimit; + } + + if($attackerGenCnt != $attackerGenCnt_eff){ + $attackerIncTech *= $attackerGenCnt / $attackerGenCnt_eff; + } + + if($defenderGenCnt != $defenderGenCnt_eff){ + $defenderIncTech *= $defenderGenCnt / $defenderGenCnt_eff; + } + + if(TechLimit($startYear, $year, $rawAttackerNation['tech'])){ $attackerIncTech /= 4; } @@ -560,7 +584,7 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) { $loseGeneralRice += $loseRice; //모두 등용장 발부 - if(Util::randBool(0.5)) { + if($admin['join_mode'] != 'onlyRandom' && Util::randBool(0.5)) { $msg = ScoutMessage::buildScoutMessage($general['no'], $gen['no']); if($msg){ $msg->send(true); diff --git a/hwe/sql/reset.sql b/hwe/sql/reset.sql index bf721196..ff27bd88 100644 --- a/hwe/sql/reset.sql +++ b/hwe/sql/reset.sql @@ -9,6 +9,10 @@ DROP TABLE IF EXISTS `nation_turn`; DROP TABLE IF EXISTS board; DROP TABLE IF EXISTS comment; +# 회의실 테이블 삭제 +DROP TABLE IF EXISTS board; +DROP TABLE IF EXISTS comment; + # 도시 테이블 삭제 DROP TABLE IF EXISTS city; diff --git a/hwe/t_board.php b/hwe/t_board.php index a0dd6d06..bfaf6a91 100644 --- a/hwe/t_board.php +++ b/hwe/t_board.php @@ -74,11 +74,12 @@ var isSecretBoard = =($isSecretBoard?'true':'false')?>; // - + + - - + + @@ -92,15 +93,15 @@ var isSecretBoard = =($isSecretBoard?'true':'false')?>; // - + - + - + =backButton()?> diff --git a/src/sammo/TimeUtil.php b/src/sammo/TimeUtil.php index 24c3e17d..cc0c00a4 100644 --- a/src/sammo/TimeUtil.php +++ b/src/sammo/TimeUtil.php @@ -134,5 +134,4 @@ class TimeUtil } return true; } - }