From 5ebfaf24ee260e7ac6a6cbcecd933af6d50c3d3e Mon Sep 17 00:00:00 2001 From: hide_d Date: Tue, 16 Nov 2021 22:18:29 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=ED=86=A0=EB=84=88=EB=A8=BC=ED=8A=B8=20?= =?UTF-8?q?=EB=B9=84=EC=A4=91=EC=9D=84=20=EA=B0=95=EC=A0=9C=EB=A1=9C=20?= =?UTF-8?q?=EC=A1=B0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/func.php | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/hwe/func.php b/hwe/func.php index 48927578..e1ab09ce 100644 --- a/hwe/func.php +++ b/hwe/func.php @@ -1348,17 +1348,29 @@ function triggerTournament() $db = DB::db(); $gameStor = KVStorage::getStorage($db, 'game_env'); - $admin = $gameStor->getValues(['tournament', 'tnmt_trig']); + [$tournament, $tnmt_trig, $tnmt_pattern] = $gameStor->getValuesAsArray(['tournament', 'tnmt_trig', 'tnmt_pattern']); //현재 토너먼트 없고, 자동개시 걸려있을때, 40%확률 - if ($admin['tournament'] == 0 && $admin['tnmt_trig'] > 0 && rand() % 100 < 40) { - $type = rand() % 5; // 0 : 전력전, 1 : 통솔전, 2 : 일기토, 3 : 설전 - //전력전 40%, 통, 일, 설 각 20% - if ($type > 3) { - $type = 0; - } - startTournament($admin['tnmt_trig'], $type); + if($tournament != 0){ + return; } + if($tnmt_trig == 0){ + return; + } + if(!Util::randBool(0.4)){ + return; + } + + if(!$tnmt_pattern){ + // 0 : 전력전, 1 : 통솔전, 2 : 일기토, 3 : 설전 + //전력전 40%, 통, 일, 설 각 20% + $tnmt_pattern = [0, 0, 1, 2, 3]; + shuffle($tnmt_pattern); + } + + $tnmt_type = array_pop($tnmt_pattern); + $gameStor->setValue('tnmt_pattern', $tnmt_pattern); + startTournament($tnmt_trig, $tnmt_type); } function CheckHall($no)