game: 반환은 4개월 이전에도 이루어지도록 수정

This commit is contained in:
2021-12-15 03:19:02 +09:00
parent 2d585611a5
commit b2585137a5
2 changed files with 31 additions and 19 deletions
+14 -3
View File
@@ -461,7 +461,8 @@ function commandGroup($typename, $type = 0)
} }
} }
function getCommandTable(General $general){ function getCommandTable(General $general)
{
$db = DB::db(); $db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env'); $gameStor = KVStorage::getStorage($db, 'game_env');
$gameStor->turnOnCache(); $gameStor->turnOnCache();
@@ -1648,9 +1649,19 @@ function giveRandomUniqueItem(General $general, string $acquireType): bool
return false; return false;
} }
if ($general->getAuxVar('inheritRandomUnique')) { if ($general->getAuxVar('inheritRandomUnique')) {
$gameStor = KVStorage::getStorage($db, 'game_env');
[$year, $month, $initYear, $initMonth] = $gameStor->getValuesAsArray(['year', 'month', 'init_year', 'init_month']);
$relMonthByInit = Util::joinYearMonth($year, $month) - Util::joinYearMonth($initYear, $initMonth);
$availableBuyUnique = $relMonthByInit >= GameConst::$minMonthToAllowInheritItem;
if($availableBuyUnique){
$general->setAuxVar('inheritRandomUnique', null); $general->setAuxVar('inheritRandomUnique', null);
} }
}
[$itemType, $itemCode] = Util::choiceRandomUsingWeightPair($availableUnique); [$itemType, $itemCode] = Util::choiceRandomUsingWeightPair($availableUnique);
@@ -1903,7 +1914,7 @@ function tryUniqueItemLottery(General $general, string $acquireType = '아이템
$maxCnt = $itemTypeCnt; $maxCnt = $itemTypeCnt;
$relMonthByInit = Util::joinYearMonth($year, $month) - Util::joinYearMonth($initYear, $initMonth); $relMonthByInit = Util::joinYearMonth($year, $month) - Util::joinYearMonth($initYear, $initMonth);
$availableBuyUnique = $relMonthByInit >= 4; $availableBuyUnique = $relMonthByInit >= GameConst::$minMonthToAllowInheritItem;
foreach ($general->getItems() as $item) { foreach ($general->getItems() as $item) {
if (!$item->isBuyable()) { if (!$item->isBuyable()) {
@@ -1914,7 +1925,7 @@ function tryUniqueItemLottery(General $general, string $acquireType = '아이템
if ($trialCnt <= 0) { if ($trialCnt <= 0) {
LogText("{$general->getName()}, {$general->getID()} 모든 아이템", $trialCnt); LogText("{$general->getName()}, {$general->getID()} 모든 아이템", $trialCnt);
if ($general->getAuxVar('inheritRandomUnique') && $availableBuyUnique) { if ($general->getAuxVar('inheritRandomUnique')) {
$general->setAuxVar('inheritRandomUnique', null); $general->setAuxVar('inheritRandomUnique', null);
$general->increaseInheritancePoint('previous', GameConst::$inheritItemRandomPoint); $general->increaseInheritancePoint('previous', GameConst::$inheritItemRandomPoint);
$userLogger = new UserLogger($general->getVar('owner')); $userLogger = new UserLogger($general->getVar('owner'));
+1
View File
@@ -205,6 +205,7 @@ class GameConstBase
public static $maxAvailableWarSettingCnt = 10; public static $maxAvailableWarSettingCnt = 10;
public static $incAvailableWarSettingCnt = 2; public static $incAvailableWarSettingCnt = 2;
public static $minMonthToAllowInheritItem = 4;
public static $inheritBornSpecialPoint = 6000; public static $inheritBornSpecialPoint = 6000;
public static $inheritBornTurntimePoint = 3000; public static $inheritBornTurntimePoint = 3000;
public static $inheritBornCityPoint = 1000; public static $inheritBornCityPoint = 1000;