1
This commit is contained in:
parent
43a916c235
commit
c19b4a1fb6
@ -39,6 +39,8 @@ use services\FormulaService;
|
||||
|
||||
class BattleDataService extends BaseService {
|
||||
|
||||
const MAX_DROP_NUM = 2;
|
||||
|
||||
private $seasonDb = array();
|
||||
private $heroDto = null;
|
||||
private $heroMeta = null;
|
||||
@ -488,54 +490,33 @@ class BattleDataService extends BaseService {
|
||||
|
||||
private function rewardFragmentPvp()
|
||||
{
|
||||
$todayPvpBattleTimes = $this->_getDailyV(TN_DAILY_PVP_BATTLE_TIMES, 0);
|
||||
$todayPveGetFragmentNum = $this->_getDailyV(TN_DAILY_PVE_GET_FRAGMENT_NUM, 0);
|
||||
$todayPvpGetFragmentNum = $this->_getDailyV(TN_DAILY_PVP_GET_FRAGMENT_NUM, 0);
|
||||
|
||||
if ($todayPveGetFragmentNum + $todayPvpGetFragmentNum > 2) {
|
||||
return;
|
||||
}
|
||||
if ($todayPveGetFragmentNum + $todayPvpGetFragmentNum < self::MAX_DROP_NUM) {
|
||||
$todayPvpBattleTimes = $this->_getDailyV(TN_DAILY_PVP_BATTLE_TIMES, 0);
|
||||
|
||||
$onlineNum = RealtimeData::getOnline();
|
||||
$heroFragmentNum = FragmentPool::getHeroNum();
|
||||
$gunFragmentNum = FragmentPool::getGunNum();
|
||||
$onlineNum = RealtimeData::getOnline();
|
||||
$heroFragmentNum = FragmentPool::getHeroNum();
|
||||
$gunFragmentNum = FragmentPool::getGunNum();
|
||||
|
||||
$heroProbability = FormulaService::calcHeroFragmentProbabilityPvp
|
||||
($_REQUEST,
|
||||
$onlineNum,
|
||||
$heroFragmentNum,
|
||||
$todayPvpBattleTimes);
|
||||
$gunProbability = FormulaService::calcGunFragmentProbabilityPvp
|
||||
($_REQUEST,
|
||||
$onlineNum,
|
||||
$gunFragmentNum,
|
||||
$todayPvpBattleTimes);
|
||||
$heroProbability = FormulaService::calcHeroFragmentProbabilityPvp
|
||||
($_REQUEST,
|
||||
$onlineNum,
|
||||
$heroFragmentNum,
|
||||
$todayPvpBattleTimes);
|
||||
$gunProbability = FormulaService::calcGunFragmentProbabilityPvp
|
||||
($_REQUEST,
|
||||
$onlineNum,
|
||||
$gunFragmentNum,
|
||||
$todayPvpBattleTimes);
|
||||
|
||||
$heroProbability = max($heroProbability, 0);
|
||||
$gunProbability = max($gunProbability, 0);
|
||||
$emptyProbability = max(1 - $heroProbability - $gunProbability, 0);
|
||||
$heroProbability = max($heroProbability, 0);
|
||||
$gunProbability = max($gunProbability, 0);
|
||||
$emptyProbability = max(1 - $heroProbability - $gunProbability, 0);
|
||||
|
||||
$dropIdx = $this->randWeight(array($heroProbability, $gunProbability, $emptyProbability));
|
||||
if ($dropIdx == 0) {
|
||||
$itemId = FragmentPool::dropHero();
|
||||
if ($itemId) {
|
||||
array_push($this->reward['items'],
|
||||
array(
|
||||
'item_id' => $itemId,
|
||||
'item_num' => 1
|
||||
));
|
||||
$this->_incDailyV(TN_DAILY_PVP_GET_FRAGMENT_NUM, 1);
|
||||
}
|
||||
} else if ($dropIdx == 1) {
|
||||
$itemId = FragmentPool::dropGun();
|
||||
if ($itemId) {
|
||||
array_push($this->reward['items'],
|
||||
array(
|
||||
'item_id' => $itemId,
|
||||
'item_num' => 1
|
||||
));
|
||||
$this->_incDailyV(TN_DAILY_PVP_GET_FRAGMENT_NUM, 1);
|
||||
}
|
||||
$dropIdx = $this->randWeight(array($heroProbability, $gunProbability, $emptyProbability));
|
||||
$this->procDrop($dropIdx);
|
||||
}
|
||||
}
|
||||
|
||||
@ -743,4 +724,29 @@ class BattleDataService extends BaseService {
|
||||
}
|
||||
}
|
||||
|
||||
private function procDrop($dropIdx)
|
||||
{
|
||||
if ($dropIdx == 0) {
|
||||
$itemId = FragmentPool::dropHero();
|
||||
if ($itemId) {
|
||||
array_push($this->reward['items'],
|
||||
array(
|
||||
'item_id' => $itemId,
|
||||
'item_num' => 1
|
||||
));
|
||||
$this->_incDailyV(TN_DAILY_PVP_GET_FRAGMENT_NUM, 1);
|
||||
}
|
||||
} else if ($dropIdx == 1) {
|
||||
$itemId = FragmentPool::dropGun();
|
||||
if ($itemId) {
|
||||
array_push($this->reward['items'],
|
||||
array(
|
||||
'item_id' => $itemId,
|
||||
'item_num' => 1
|
||||
));
|
||||
$this->_incDailyV(TN_DAILY_PVP_GET_FRAGMENT_NUM, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user