1
This commit is contained in:
parent
cb315c1b0c
commit
31e9699eea
35
webapp/mt/PveGeminiMode.php
Normal file
35
webapp/mt/PveGeminiMode.php
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace mt;
|
||||||
|
|
||||||
|
use phpcommon;
|
||||||
|
|
||||||
|
class PveGeminiMode {
|
||||||
|
|
||||||
|
public static function get($id)
|
||||||
|
{
|
||||||
|
return array_key_exists($id, self::getMetaList()) ? self::getMetaList()[$id] : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function calcStar($meta, $score)
|
||||||
|
{
|
||||||
|
$strs = explode('|', $meta['score_reward']);
|
||||||
|
for ($i = 0; i < count($strs) && $i < 3; ++$i) {
|
||||||
|
if ($score > $strs[i]) {
|
||||||
|
return i + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static function getMetaList()
|
||||||
|
{
|
||||||
|
if (!self::$metaList) {
|
||||||
|
self::$metaList = getMetaTable('pveGeminiMode@pveGeminiMode.php');
|
||||||
|
}
|
||||||
|
return self::$metaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static $metaList;
|
||||||
|
|
||||||
|
}
|
@ -11,6 +11,8 @@ require_once('mt/KillReward.php');
|
|||||||
require_once('mt/Parameter.php');
|
require_once('mt/Parameter.php');
|
||||||
require_once('mt/HeroQuality.php');
|
require_once('mt/HeroQuality.php');
|
||||||
require_once('mt/AttrHelper.php');
|
require_once('mt/AttrHelper.php');
|
||||||
|
require_once('mt/PveGemini.php');
|
||||||
|
require_once('mt/PveGeminiMode.php');
|
||||||
|
|
||||||
require_once('models/Season.php');
|
require_once('models/Season.php');
|
||||||
require_once('models/Battle.php');
|
require_once('models/Battle.php');
|
||||||
@ -81,6 +83,8 @@ class BattleDataService extends BaseService {
|
|||||||
);
|
);
|
||||||
private $heroDto = null;
|
private $heroDto = null;
|
||||||
private $rankActivityService = null;
|
private $rankActivityService = null;
|
||||||
|
private $pveGeminiMeta = null;
|
||||||
|
private $pveGeminiModeMeta = null;
|
||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
@ -464,6 +468,7 @@ class BattleDataService extends BaseService {
|
|||||||
$onlineNum = $this->getOnlineNumber();
|
$onlineNum = $this->getOnlineNumber();
|
||||||
$instanceLevel = 0;
|
$instanceLevel = 0;
|
||||||
$instanceRank = 0;
|
$instanceRank = 0;
|
||||||
|
$instanceRankRate = $this->getInstanceRankRate();
|
||||||
$bossReward = getReqVal('pve_kill_boss', 0) ? 1 : 0;
|
$bossReward = getReqVal('pve_kill_boss', 0) ? 1 : 0;
|
||||||
$todayPveBattleTimes = $this->_getDailyV(TN_DAILY_PVE_BATTLE_TIMES, 0);
|
$todayPveBattleTimes = $this->_getDailyV(TN_DAILY_PVE_BATTLE_TIMES, 0);
|
||||||
$todayPveGetFragmentNum = $this->_getDailyV(TN_DAILY_PVE_GET_FRAGMENT_NUM, 0);
|
$todayPveGetFragmentNum = $this->_getDailyV(TN_DAILY_PVE_GET_FRAGMENT_NUM, 0);
|
||||||
@ -479,7 +484,7 @@ class BattleDataService extends BaseService {
|
|||||||
$gunProbability = max($gunProbability, 0);
|
$gunProbability = max($gunProbability, 0);
|
||||||
$emptyProbability = max(1 - $heroProbability - $gunProbability, 0);
|
$emptyProbability = max(1 - $heroProbability - $gunProbability, 0);
|
||||||
|
|
||||||
$dropIdx = $this.randWeight(array($heroProbability, $gunProbability, $emptyProbability));
|
$dropIdx = $this->randWeight(array($heroProbability, $gunProbability, $emptyProbability));
|
||||||
if ($dropIdx < 0 || $dropIdx == 2) {
|
if ($dropIdx < 0 || $dropIdx == 2) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -507,4 +512,35 @@ class BattleDataService extends BaseService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getInstanceRankRate()
|
||||||
|
{
|
||||||
|
if ($this->pveGeminiModeMeta) {
|
||||||
|
$pveRankScore = getReqVal('pve_rank_score', 0);
|
||||||
|
$star = mt\PveGeminiMode::calcStar($this->pveGeminiModeMeta, $pveRankScore);
|
||||||
|
switch ($star) {
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
return 0.8;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
return 0.55;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
{
|
||||||
|
return 0.3;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user