game: 기간별 최대 유니크 획득 수 변경경
This commit is contained in:
+24
-12
@@ -1840,21 +1840,26 @@ function tryUniqueItemLottery(General $general, string $acquireType = '아이템
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$inheritUnique = $general->getAuxVar('inheritUniqueTrial');
|
$itemTypeCnt = count(GameConst::$allItems);
|
||||||
if ($acquireType != '설문조사' && $inheritUnique && count($inheritUnique)) {
|
|
||||||
LogText("유니크 준비?? {$general->getID()}", $inheritUnique);
|
[$startYear, $year] = $gameStor->getValuesAsArray(['startyear', 'year']);
|
||||||
$trialResult = tryInheritUniqueItem($general, $acquireType);
|
$relYear = $year - $startYear;
|
||||||
if ($trialResult) {
|
$maxTrialCountByYear = 1;
|
||||||
return true;
|
foreach(GameConst::$maxUniqueItemLimit as $tmpVals){
|
||||||
|
[$targetYear, $targetTrialCnt] = $tmpVals;
|
||||||
|
if($relYear < $targetYear){
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
$maxTrialCountByYear = $targetTrialCnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
$itemTypeCnt = count(GameConst::$allItems);
|
$trialCnt = Util::valueFit($itemTypeCnt, null, $maxTrialCountByYear);
|
||||||
$trialCnt = $itemTypeCnt;
|
$maxCnt = $itemTypeCnt;
|
||||||
|
|
||||||
foreach ($general->getItems() as $item) {
|
foreach ($general->getItems() as $item) {
|
||||||
if (!$item->isBuyable()) {
|
if (!$item->isBuyable()) {
|
||||||
$trialCnt -= 1;
|
$trialCnt -= 1;
|
||||||
|
$maxCnt -= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1866,10 +1871,17 @@ function tryUniqueItemLottery(General $general, string $acquireType = '아이템
|
|||||||
$userLogger = new UserLogger($general->getVar('owner'));
|
$userLogger = new UserLogger($general->getVar('owner'));
|
||||||
$userLogger->push(sprintf("유니크를 얻을 공간이 없어 %d 포인트 반환", GameConst::$inheritItemRandomPoint), "inheritPoint");
|
$userLogger->push(sprintf("유니크를 얻을 공간이 없어 %d 포인트 반환", GameConst::$inheritItemRandomPoint), "inheritPoint");
|
||||||
}
|
}
|
||||||
|
tryRollbackInheritUniqueItem($general);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$inheritUnique = $general->getAuxVar('inheritUniqueTrial');
|
||||||
|
if ($acquireType != '설문조사' && $inheritUnique && count($inheritUnique)) {
|
||||||
|
$trialResult = tryInheritUniqueItem($general, $acquireType);
|
||||||
|
if ($trialResult) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$scenario = $gameStor->scenario;
|
$scenario = $gameStor->scenario;
|
||||||
$genCount = $db->queryFirstField('SELECT count(*) FROM general WHERE npc<2');
|
$genCount = $db->queryFirstField('SELECT count(*) FROM general WHERE npc<2');
|
||||||
@@ -1899,7 +1911,7 @@ function tryUniqueItemLottery(General $general, string $acquireType = '아이템
|
|||||||
$prob = 1;
|
$prob = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (Util::range($trialCnt) as $_idx) {
|
foreach (Util::range($maxCnt) as $_idx) {
|
||||||
if (Util::randBool($prob)) {
|
if (Util::randBool($prob)) {
|
||||||
$result = true;
|
$result = true;
|
||||||
break;
|
break;
|
||||||
@@ -1907,10 +1919,10 @@ function tryUniqueItemLottery(General $general, string $acquireType = '아이템
|
|||||||
$prob *= $moreProb;
|
$prob *= $moreProb;
|
||||||
}
|
}
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
LogText("{$general->getName()}, {$general->getID()} 유니크 실패 {$trialCnt}", $prob);
|
LogText("{$general->getName()}, {$general->getID()} 유니크 실패 {$maxCnt}", $prob);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
LogText("{$general->getName()}, {$general->getID()} 유니크 성공 {$trialCnt}", $prob);
|
LogText("{$general->getName()}, {$general->getID()} 유니크 성공 {$maxCnt}", $prob);
|
||||||
|
|
||||||
return giveRandomUniqueItem($general, $acquireType);
|
return giveRandomUniqueItem($general, $acquireType);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -195,6 +195,13 @@ class GameConstBase
|
|||||||
'che_은둔', 'None'
|
'che_은둔', 'None'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public static $maxUniqueItemLimit = [
|
||||||
|
[-1, 1],
|
||||||
|
[3, 2],
|
||||||
|
[10, 3],
|
||||||
|
[20, 4]
|
||||||
|
];
|
||||||
|
|
||||||
public static $inheritBornSpecialPoint = 12000;
|
public static $inheritBornSpecialPoint = 12000;
|
||||||
public static $inheritBornTurntimePoint = 3000;
|
public static $inheritBornTurntimePoint = 3000;
|
||||||
public static $inheritBornCityPoint = 1000;
|
public static $inheritBornCityPoint = 1000;
|
||||||
|
|||||||
Reference in New Issue
Block a user