From 2d0c19271b4a83d3bda94b530a2c55f8865b90a8 Mon Sep 17 00:00:00 2001 From: hide_d Date: Sat, 13 Nov 2021 02:25:52 +0900 Subject: [PATCH] =?UTF-8?q?game:=20=EA=B8=B0=EA=B0=84=EB=B3=84=20=EC=B5=9C?= =?UTF-8?q?=EB=8C=80=20=EC=9C=A0=EB=8B=88=ED=81=AC=20=ED=9A=8D=EB=93=9D=20?= =?UTF-8?q?=EC=88=98=20=EB=B3=80=EA=B2=BD=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/func.php | 36 ++++++++++++++++++++++++------------ hwe/sammo/GameConstBase.php | 7 +++++++ 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/hwe/func.php b/hwe/func.php index 20c6c1f1..48927578 100644 --- a/hwe/func.php +++ b/hwe/func.php @@ -1840,21 +1840,26 @@ function tryUniqueItemLottery(General $general, string $acquireType = '아이템 return false; } - $inheritUnique = $general->getAuxVar('inheritUniqueTrial'); - if ($acquireType != '설문조사' && $inheritUnique && count($inheritUnique)) { - LogText("유니크 준비?? {$general->getID()}", $inheritUnique); - $trialResult = tryInheritUniqueItem($general, $acquireType); - if ($trialResult) { - return true; + $itemTypeCnt = count(GameConst::$allItems); + + [$startYear, $year] = $gameStor->getValuesAsArray(['startyear', 'year']); + $relYear = $year - $startYear; + $maxTrialCountByYear = 1; + foreach(GameConst::$maxUniqueItemLimit as $tmpVals){ + [$targetYear, $targetTrialCnt] = $tmpVals; + if($relYear < $targetYear){ + break; } + $maxTrialCountByYear = $targetTrialCnt; } - $itemTypeCnt = count(GameConst::$allItems); - $trialCnt = $itemTypeCnt; + $trialCnt = Util::valueFit($itemTypeCnt, null, $maxTrialCountByYear); + $maxCnt = $itemTypeCnt; foreach ($general->getItems() as $item) { if (!$item->isBuyable()) { $trialCnt -= 1; + $maxCnt -= 1; } } @@ -1866,10 +1871,17 @@ function tryUniqueItemLottery(General $general, string $acquireType = '아이템 $userLogger = new UserLogger($general->getVar('owner')); $userLogger->push(sprintf("유니크를 얻을 공간이 없어 %d 포인트 반환", GameConst::$inheritItemRandomPoint), "inheritPoint"); } + tryRollbackInheritUniqueItem($general); return false; } - + $inheritUnique = $general->getAuxVar('inheritUniqueTrial'); + if ($acquireType != '설문조사' && $inheritUnique && count($inheritUnique)) { + $trialResult = tryInheritUniqueItem($general, $acquireType); + if ($trialResult) { + return true; + } + } $scenario = $gameStor->scenario; $genCount = $db->queryFirstField('SELECT count(*) FROM general WHERE npc<2'); @@ -1899,7 +1911,7 @@ function tryUniqueItemLottery(General $general, string $acquireType = '아이템 $prob = 1; } - foreach (Util::range($trialCnt) as $_idx) { + foreach (Util::range($maxCnt) as $_idx) { if (Util::randBool($prob)) { $result = true; break; @@ -1907,10 +1919,10 @@ function tryUniqueItemLottery(General $general, string $acquireType = '아이템 $prob *= $moreProb; } if (!$result) { - LogText("{$general->getName()}, {$general->getID()} 유니크 실패 {$trialCnt}", $prob); + LogText("{$general->getName()}, {$general->getID()} 유니크 실패 {$maxCnt}", $prob); return false; } - LogText("{$general->getName()}, {$general->getID()} 유니크 성공 {$trialCnt}", $prob); + LogText("{$general->getName()}, {$general->getID()} 유니크 성공 {$maxCnt}", $prob); return giveRandomUniqueItem($general, $acquireType); } diff --git a/hwe/sammo/GameConstBase.php b/hwe/sammo/GameConstBase.php index ba8c86de..b478f5c4 100644 --- a/hwe/sammo/GameConstBase.php +++ b/hwe/sammo/GameConstBase.php @@ -195,6 +195,13 @@ class GameConstBase 'che_은둔', 'None' ]; + public static $maxUniqueItemLimit = [ + [-1, 1], + [3, 2], + [10, 3], + [20, 4] + ]; + public static $inheritBornSpecialPoint = 12000; public static $inheritBornTurntimePoint = 3000; public static $inheritBornCityPoint = 1000;