game2006api/webapp/services/FormulaService.php
aozhiwei 28dec0c565 1
2022-09-19 21:18:08 +08:00

588 lines
29 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace services;
require_once('mt/AttrHelper.php');
require_once('mt/Item.php');
require_once('mt/FormulaPvp.php');
require_once('mt/HeroQuality.php');
require_once('mt/GunQuality.php');
use mt;
class FormulaService extends BaseService {
public static function calcHeroPvpCeg($heroDto, $params)
{
//PVP角色NFT每日获得极限*(50%*[每局排名TopX%对应比例]+25%*[每局PK人数排名TopX%对应比例]+15%*[每局英雄属性排名TopX%对应比例]+5%*[每局武器属性排名TopX%对应比例]+5%*[每局存活时间排名TopX%对应比例])
$upLimit = $heroDto['pvp_ceg_uplimit'];
$ranked = getXVal($params, 'ranked');
$kills = getXVal($params, 'kills');
$aliveTime = getXVal($params, 'alive_time');
$rankedTopX = getXVal($params, 'ranked_topx');
$killsTopX = getXVal($params, 'kills_topx');
$heroTopX = getXVal($params, 'hero_topx');
$weaponTopX = getXVal($params, 'weapon_topx');
$survivalTopX = getXVal($params, 'survival_topx');
$meta = mt\FormulaPvp::getByRanked($rankedTopX);
if (!$meta) {
return 0;
}
$ceg = $upLimit *
(
(0.5 * $rankedTopX * $meta['ranked_topx']) +
(0.25 * $killsTopX * $meta['kills_topx']) +
(0.15 * $heroTopX * $meta['hero_topx']) +
(0.5 * $weaponTopX * $meta['weapon_topx']) +
(0.5 * $survivalTopX * $meta['survival_topx'])
) *
(1 - ($ranked > 30 ? 1 : 0)) *
($kills > 1 ? 1 : 0) *
($aliveTime > 30 ? 1 : 0);
return round($ceg);
}
public static function calcHeroPveCeg($heroDto, $instanceLevel, $instanceRank, $bossReward)
{
$upLimit = $heroDto['pve_ceg_uplimit'];
$heroQuality = $heroDto['quality'];
$ceg = $upLimit *
max(1.15 - ($heroQuality - $instanceLevel) * 0.25, 0) *
(0.8 - ($instanceRank - 1) * 0.25 + $bossReward * 0.2) *
1/10;
return round(ceg);
}
public static function calcWeaponPvpCeg($weaponDto, $params)
{
//PVP武器NFT每日获得极限*(50%*[每局排名TopX%对应比例]+25%*[每局PK人数排名TopX%对应比例]+15%*[每局英雄属性排名TopX%对应比例]+5%*[每局武器属性排名TopX%对应比例]+5%*[每局存活时间排名TopX%对应比例])
$upLimit = $weaponDto['pvp_ceg_uplimit'];
$rankedTopX= getXVal($params, 'ranked_topx');
$killsTopX = getXVal($params, 'kills_topx');
$heroTopX = getXVal($params, 'hero_topx');
$weaponTopX = getXVal($params, 'weapon_topx');
$survivalTopX = getXVal($params, 'survival_topx');
$meta = mt\FormulaPvp::getByRanked($rankedTopX);
if (!$meta) {
return 0;
}
$ceg = $upLimit *
(
(0.5 * $rankedTopX * $meta['ranked_topx']) +
(0.25 * $killsTopX * $meta['kills_topx']) +
(0.15 * $heroTopX * $meta['hero_topx']) +
(0.5 * $weaponTopX * $meta['weapon_topx']) +
(0.5 * $survivalTopX * $meta['survival_topx'])
) *
(1 - ($ranked > 30 ? 1 : 0)) *
($kills > 1 ? 1 : 0) *
($aliveTime > 30 ? 1 : 0);
return round($ceg);
}
public static function calcWeaponPveCeg($weaponDb, $instanceLevel, $instanceRank, $bossReward)
{
$upLimit = $weaponDto['pve_ceg_uplimit'];
$weaponQuality = $weaponDto['quality'];
$ceg = $upLimit *
max(1.15 - ($weaponQuality - $instanceLevel) * 0.25, 0) *
(0.8 - ($instanceRank - 1) * 0.25 + $bossReward * 0.2) *
1/10;
return round(ceg);
}
public static function calcHeroFragmentProbabilityPvp($params,
$onlineNum,
$heroFragmentNum,
$todayPvpBattleTimes)
{
$rankedTopX = getXVal($params, 'ranked_topx');
$killsTopX = getXVal($params, 'kills_topx');
$heroTopX = getXVal($params, 'hero_topx');
$weaponTopX = getXVal($params, 'weapon_topx');
$survivalTopX = getXVal($params, 'survival_topx');
$meta = mt\FormulaPvp::getByRanked($rankedTopX);
if (!$meta) {
return 0;
}
$heroProbability = min($heroFragmentNum / $onlineNum *
5 *
(
0.5 * $rankedTopX * $meta['ranked_topx'] +
0.25 * $killsTopX * $meta['kills_topx'] +
0.15 * $heroTopX * $meta['hero_topx'] +
0.05 * $weaponTopX * $meta['weapon_topx'] +
0.05 * $survivalTopX * $meta['survival_topx']
) *
pow(2, ($todayPvpBattleTimes % 10) - 1), 1);
return max(0, $heroProbability);
}
public static function calcWeaponFragmentProbabilityPvp($params,
$onlineNum,
$weaponFragmentNum,
$todayPvpBattleTimes)
{
$rankedTopX = getXVal($params, 'ranked_topx');
$killsTopX = getXVal($params, 'kills_topx');
$heroTopX = getXVal($params, 'hero_topx');
$weaponTopX = getXVal($params, 'weapon_topx');
$survivalTopX = getXVal($params, 'survival_topx');
$meta = mt\FormulaPvp::getByRanked($rankedTopX);
if (!$meta) {
return 0;
}
$weaponProbability = min($weaponFragmentNum / $onlineNum *
5 *
(
0.5 * $rankedTopX * $meta['ranked_topx'] +
0.25 * $killsTopX * $meta['kills_topx'] +
0.15 * $heroTopX * $meta['hero_topx'] +
0.05 * $weaponTopX * $meta['weapon_topx'] +
0.05 * $survivalTopX * $meta['survival_topx']
) *
pow(2, ($todayPvpBattleTimes % 10) - 1), 1);
return max(0, $weaponProbability);
}
public static function calcHeroFragmentProbabilityPve($heroQuality,
$onlineNum,
$heroFragmentNum,
$todayPvpBattleTimes,
$instanceLevel,
$instanceRank,
$instanceRankRate,
$bossReward,
$todayPveGetFragmentNum)
{
$dropRate = max(1.15 - ($heroQuality - $instanceLevel) * 0.25, 0);
$dropMul = 0.8 - ($instanceRank - 1) * 0.25 + $bossReward * 0.2;
$heroProbability = min($heroFragmentNum / $onlineNum *
$dropRate * ($instanceRankRate + $bossReward*0.2) *
pow(2, $todayPveBattleTimes - $todayPveGetFragmentNum - 1), 1);
return max(0, $heroProbability);
}
public static function calcWeaponFragmentProbabilityPve($heroQuality,
$onlineNum,
$gunFragmentNum,
$todayPvpBattleTimes,
$instanceLevel,
$instanceRank,
$instanceRankRate,
$bossReward,
$todayPveGetFragmentNum)
{
$dropRate = max(1.15 - ($heroQuality - $instanceLevel) * 0.25, 0);
$dropMul = 0.8 - ($instanceRank - 1) * 0.25 + $bossReward * 0.2;
$gunProbability = min($gunFragmentNum / $onlineNum *
$dropRate * ($instanceRankRate + $bossReward*0.2) *
pow(2, $todayPveBattleTimes - $todayPveGetFragmentNum - 1), 1);
return max(0, $gunProbability);
}
public static function getHeroPvpTiliTotalValue($heroDb)
{
//ROUND((0.0241*角色NFT阶数^3-0.5675*角色NFT阶数^2+7.1798*角色NFT阶数+2.4114)+(0.0161*角色幸运值^3-1.2943*角色幸运值^2+36.5664*角色幸运值-336.144),0)+系统参数
$sysParam = 0;
$lucky = 0;
$upLimit = round(
(
0.0241*pow($heroDb['quality'],3) -
0.5675*pow($heroDb['quality'],2) +
7.1798*$heroDb['quality'] +
2.4114
) +
(
0.0161*pow($lucky, 3) -
1.2943*pow($lucky, 2) +
36.5664*$lucky -
336.144
)
) + $sysParam;
return $upLimit;
}
public static function getHeroPveTiliTotalValue($heroDb)
{
//ROUND((0.0563*角色NFT阶数^3-1.3243*角色NFT阶数^2+16.753*角色NFT阶数+5.6266)+(0.0375*角色幸运值^3-3.02*角色幸运值^2+85.3217*角色幸运值-784.3361),0)+系统参数
$sysParam = 0;
$lucky = 0;
$upLimit = round(
(
0.0563*pow($heroDb['quality'],3) -
1.3243*pow($heroDb['quality'],2) +
16.753*$heroDb['quality'] +
5.6266
) +
(
0.0375*pow($lucky, 3) -
3.02*pow($lucky, 2) +
85.3217*$lucky -
784.3361
)
) + $sysParam;
return $upLimit;
}
public static function getWeaponPvpDurabilityTotalValue($weaponDb)
{
//ROUND((0.0067*武器NFT阶数^3-0.1558*武器NFT阶数^2+1.9758*武器NFT阶数+0.8033)+(0.0044*武器幸运值^3-0.3564*武器幸运值^2+10.0625*武器幸运值-92.3784),0)+系统参数
$sysParam = 0;
$lucky = 0;
$upLimit = round(
(
0.0067*pow($heroDb['quality'],3) -
0.1558*pow($heroDb['quality'],2) +
1.9758*$heroDb['quality'] +
0.8033
) +
(
0.0044*pow($lucky, 3) -
0.3564*pow($lucky, 2) +
10.0625*$lucky -
92.3784
)
) + $sysParam;
return $upLimit;
}
public static function getWeaponPveDurabilityTotalValue($weaponDb)
{
//ROUND((0.0155*武器NFT阶数^3-0.3637*武器NFT阶数^2+4.6102*武器NFT阶数+1.8745)+(0.0104*武器幸运值^3-0.8315*武器幸运值^2+23.4792*武器幸运值-215.5496),0)+系统参数
$sysParam = 0;
$lucky = 0;
$upLimit = round(
(
0.0155*pow($heroDb['quality'],3) -
0.3637*pow($heroDb['quality'],2) +
4.6102*$heroDb['quality'] +
1.8745
) +
(
0.0104*pow($lucky, 3) -
0.8315*pow($lucky, 2) +
23.4792*$lucky -
215.5496
)
) + $sysParam;
return $upLimit;
}
public static function calcHeroPvpTiliConsume($heroDb)
{
//ROUND((最大角色体力值-当前剩余体力值)*(PVP角色体力总价值+PVE角色体力总价值)/最大角色体力值,0)
$heroMeta = mt\Item::get($heroDb['hero_id']);
if (!$heroMeta) {
return 0;
}
$cost = round(
($heroMeta['init_tili'] - $heroDb['hero_tili']) *
(1) /
$heroMeta['init_tili']
);
return $cost;
}
public static function calcWeaponPvpDurabilityConsume($weaponDb)
{
//ROUND((最大武器耐久度-当前剩余耐久度)*(PVP武器耐久度总价值+PVE武器耐久度总价值)/最大武器耐久度,0)
return 0;
}
/**
-------------------------------------------------新公式-----------------------------------------------------------
*/
//每天英雄NFT获得CEG上限值
public static function Hero_Max_CEG($heroDb){
//Hero_Max_CEG=((SIGN(英雄NFT阶数=1)*Hero_NFT_Maximum_Physical_Strength+SIGN(英雄NFT阶数>1)*Hero_Fixed_Physical_Strength)*Hero_PSA_Value+Hero_Chip_NFT_Maximum_Physical_Strength*Hero_PSA_Value)*10*CEG_Discount_Rate
return ((($heroDb['quality']==1?1:0)*self::Hero_NFT_Maximum_Physical_Strength($heroDb['quality'],$heroDb['lucky'])+($heroDb['quality']>1?1:0)*$heroDb['hero_tili'])*self::Hero_PSA_Value($heroDb['quality'])+$heroDb['chip_strength_sum'])*10*self::CEG_Discount_Rate();
}
//英雄PVP收益上限
public static function getHeroPvpDailyCegUpLimit($heroDb)
{
//Hero_Max_CEG *60%
return self::Hero_Max_CEG($heroDb)*0.6;
}
//英雄PVE收益上限
public static function getHeroPveDailyCegUpLimit($heroDb)
{
//Hero_Max_CEG *35%
return self::Hero_Max_CEG($heroDb)*0.35;
}
//每天枪械NFT获得CEG上限值
public static function Weapon_Max_CEG($weaponDb){
//Weapon_Max_CEG=((SIGN(武器NFT阶数=1)*Weapon_NFT_Maximum_Durability+SIGN(武器NFT阶数>1)*Weapon_Fixed_Durability)*Weapon_DA_Value+Weapon_Chip_NFT_Maximum_Durability*Weapon_Chip_DA_Value)*10*CEG_Discount_Rate
return ((($weaponDb['quality']==1?1:0)*self::Weapon_NFT_Maximum_Durability($weaponDb['quality'],$weaponDb['lucky'])+($weaponDb['quality']>1?1:0)*$weaponDb['durability'])*self::Weapon_DA_Value($weaponDb['quality'])+$weaponDb['chip_strength_sum'])*10*self::CEG_Discount_Rate();
}
//枪械PVP收益上限
public static function getWeaponPvpDailyCegUpLimit($weaponDb)
{
//Weapon_Max_CEG *60%
return self::Weapon_Max_CEG($weaponDb)*0.6;
}
//枪械PVE收益上限
public static function getWeaponPveDailyCegUpLimit($weaponDb)
{
//Weapon_Max_CEG *35%
return self::Weapon_Max_CEG($weaponDb)*0.35;
}
//CEG折扣比率
public static function CEG_Discount_Rate(){
//CEG_Discount_Rate=ROUND(CEG_Dynamic_Index /( CEG_Dynamic_Price / CEG_Base_Price),3)
return 1;
}
//CEC折扣比率
public static function CEC_Discount_Rate(){
//CEC_Discount_Rate=ROUND(CEC_Dynamic_Index /( CEC_Dynamic_Price / CEC_Base_Price),3)
return 1;
}
//英雄劳力值
public static function Hero_Labor_Value(){
return 1;
}
//武器劳力值
public static function Weapon_Labor_Value(){
return 1;
}
//英雄芯片劳力值
public static function Hero_Chip_Labor_Value(){
return 1;
}
//武器芯片劳力值
public static function Weapon_Chip_Labor_Value(){
return 1;
}
//芯片升星累计成本
public static function getChipCumulativeCost($grade){
//( SIGN(芯片星级<6)*(15*芯片星级*(芯片星级-1)+10)+SIGN(芯片星级>5)*SIGN(芯片星级<10)*(80*(芯片星级-4)*( 芯片星级-3)+50) +SIGN(芯片星级>9)*SIGN(芯片星级<14)*(370*(芯片星级-8)*( 芯片星级-7)*(2*芯片星级-15)/6+80*(芯片星级-8)+2100) +SIGN(芯片星级>13)*SIGN(芯片星级<16)*(600*(芯片星级-8)*(芯片星级-7)*(2*芯片星级-15)/6-14000)) *CEG_Discount_Rate
return (($grade<6?1:0)*(15*$grade*($grade-1)+10)+($grade>5?1:0)*($grade<10?1:0)*(80*($grade-4)*( $grade-3)+50) +($grade>9?1:0)*($grade<14?1:0)*(370*($grade-8)*( $grade-7)*(2*$grade-15)/6+80*($grade-8)+2100) +($grade>13?1:0)*($grade<16?1:0)*(600*($grade-8)*($grade-7)*(2*$grade-15)/6-14000)) *self::CEG_Discount_Rate();
//( SIGN(芯片星级<6)*((15*芯片星级+10)*(芯片星级-1)+10)+SIGN(芯片星级>5)*SIGN(芯片星级<10)*(80*(芯片星级-4)*( 芯片星级-3)+90) +SIGN(芯片星级>9)*SIGN(芯片星级<14)*(370*(芯片星级-8)*( 芯片星级-7)*(2*芯片星级-15)/6+80*(芯片星级-8)+2140) +SIGN(芯片星级>13)*SIGN(芯片星级<16)*(600*(芯片星级-8)*(芯片星级-7)*(2*芯片星级-15)/6-13960)) *CEG_Discount_Rate
// return (($grade<6?1:0)*((15*$grade+10)*($grade-1)+10)+($grade>5?1:0)*($grade<10?1:0)*(80*($grade-4)*($grade-3)+90)+($grade>9?1:0)*($grade<14?1:0)*(370*($grade-8)*($grade-7)*(2*$grade-15)/6+80*($grade-8)+2140)+($grade>13?1:0)*($grade<16?1:0)*(600*($grade-8)*($grade-7)*(2*$grade-15)/6-13960))*self::CEG_Discount_Rate();
}
//芯片升星成本
public static function getChipUpgradeCost($grade){
//(SIGN(芯片星级=1)*10+SIGN(芯片星级<6)*SIGN(芯片星级>1)*(30*(芯片星级-1))+SIGN(芯片星级>5)*SIGN(芯片星级<10)*(160*(芯片星级-4))-SIGN(芯片星级=6)*100+SIGN(芯片星级>9)*SIGN(芯片星级<14)*(370*(芯片星级-8)^2+80)+SIGN(芯片星级=10)*100 +SIGN(芯片星级>13)*SIGN(芯片星级<16)*(600*(芯片星级-8)^2)-SIGN(芯片星级=14)*3850) *CEG_Discount_Rate
return (($grade==1?1:0)*10+($grade<6?1:0)*($grade>1?1:0)*(30*($grade-1))+($grade>5?1:0)*($grade<10?1:0)*(160*($grade-4))-($grade==6?1:0)*100+($grade>9?1:0)*($grade<14?1:0)*(370*($grade-8)*($grade-8)+80)+($grade==10?1:0)*100+($grade>13?1:0)*($grade<16?1:0)*(600*($grade-8)*($grade-8))-($grade==14?1:0)*3850)*self::CEG_Discount_Rate();
}
//芯片幸运值
public static function getChipLuckyValue($grade){
//芯片幸运值=SIGN(芯片星数>4)*ROUND( 0.00419*芯片星数^5-0.0705*芯片星数^4 +0.24*芯片星数^3 +8.5*芯片星数^2-39.9*芯片星数+38,1)
return ($grade>4?1:0)*round(0.00419*pow($grade,5)-0.0705*pow($grade,4)+0.24*pow($grade,3)+8.5*pow($grade,2)-39.9*$grade+38,1);
}
//芯片体力值(英雄芯片和枪械芯片一样的)
public static function Hero_Chip_NFT_Maximum_Physical_Strength($grade,$lucky){
//芯片体力值命名Hero_Chip_NFT_Maximum_Physical_Strength = SIGN(英雄芯片NFT星数>4)*( 英雄芯片NFT幸运值*ROUND(1+0.04*英雄芯片NFT星数,3))
return ($grade>4?1:0)*($lucky*round(1+0.04*$grade,3));
}
//芯片回本周期(参数单位:天)
public static function Chip_Payback_Period($grade){
//ROUND( -0.0095*芯片星数^3+0.0942*芯片星数^2+5.8425*芯片星数+24.7,0)
return round(-0.0095*pow($grade,3)+0.0942*pow($grade,2)+5.8425*$grade+24.7,0);
}
//芯片衰减参数
public static function Chip_Attenuation_Parameter($grade){
//ROUND(-0.0000507*芯片星数^3+0.0024*芯片星数^2-0.0512*芯片星数+0.785,4)
return round(-0.0000507*pow($grade,3)+0.0024*pow($grade,2)-0.0512*$grade+0.785,4);
}
//每日英雄芯片体力值衰减百分比
public static function Hero_Chip_PSA_Value($grand){
//Hero_Chip_PSA_Value=MAX(0,ROUND((Chip_Payback_Period-Chip_Attenuation_Parameter* Hero_Chip_Labor_Value)/((1-Chip_Attenuation_Parameter /2)* Chip_Payback_Period ^2)/ROUND(1+0.04*英雄芯片星数,3),4))*(1+0.1*ROUND(SIN(Hero_Chip_Labor_Value),2))
$num = max(0,round((self::Chip_Payback_Period($grand)-self::Chip_Attenuation_Parameter($grand)*self::Hero_Chip_Labor_Value())/((1-self::Chip_Attenuation_Parameter($grand)/2)*pow(self::Chip_Payback_Period($grand),2))/round(1+0.04*$grand,3),4))*(1+0.1*round(sin(self::Hero_Chip_Labor_Value()),2));
return round($num,5);
}
//每日枪械芯片体力值衰减百分比
public static function Weapon_Chip_DA_Value($grand){
//Weapon_Chip_DA_Value=MAX(0,ROUND((Chip_Payback_Period-Chip_Attenuation_Parameter*Weapon_Chip_Labor_Value)/((1-Chip_Attenuation_Parameter/2)* Chip_Payback_Period^2)/ROUND(1+0.04*武器芯片星数,3),4))*(1+0.1*ROUND(SIN(Weapon_Chip_Labor_Value),2))
$num = max(0,round((self::Chip_Payback_Period($grand)-self::Chip_Attenuation_Parameter($grand)*self::Weapon_Chip_Labor_Value())/((1-self::Chip_Attenuation_Parameter($grand)/2)*pow(self::Chip_Payback_Period($grand),2))/round(1+0.04*$grand,3),4))*(1+0.1*round(sin(self::Weapon_Chip_Labor_Value()),2));
return round($num,5);
}
//芯片升级MINT费用
public static function Chip_Need_Mint_Cost($grand){
// 芯片升星累计MINT成本=(SIGN(chip星级>=5)*SIGN(chip星级<=10)*ROUND(91*chip星级*(chip星级-6.06)/100+1000/100,0)*100+SIGN(chip星级>=11)*SIGN(chip星级<=15)*ROUND(364.29*chip星级*(chip星级-17.847)/100+33446/100,0)*100)*CEG_Discount_Rate
return ($grand>=5?1:0)*($grand<=10?1:0)*round(91*$grand*($grand-6.06)/100+1000/100,0)*100+($grand>=11?1:0)*($grand<=15?1:0)*round(364.29*$grand*($grand-17.847)/100+33446/100,0)*100*self::CEG_Discount_Rate();
}
//芯片镶嵌MINT费用
public static function Chip_Inlay_Mint($grand){
//SIGN(芯片等级 >= 5) * ROUND((10+7*(芯片星级-1))*CEG_Discount_Rate,2)
return ($grand>=5?1:0)*round((10+7*($grand-1))*self::CEG_Discount_Rate(),2);
}
//芯片NFT拆卸MINT费用
public static function Chip_Demount_Mint($tili){
return round($tili*10*self::CEG_Discount_Rate());
}
//英雄NFT每次升级的CEG消耗公式
public static function Hero_Upgrade_CEG_Expend($grand){
//ROUND(43*ROUND(0.08*当前英雄等级^2+0.08*当前英雄等级+1,0)*CEG_Discount_Rate,0
return round(43*round(0.08*pow($grand,2)+0.08*$grand+1,0)*self::CEG_Discount_Rate(),0);
}
//英雄NFT每次升级的CEC消耗公式
public static function Hero_Upgrade_CEC_Expend($grand){
//ROUND (ROUND(0.09*单次CEG消耗,0)*SIGN(当前英雄等级>14)*CEC_Discount_Rate,2)
// return round(round(0.09*self::Hero_Upgrade_CEG_Expend($grand),0)*($grand>14?1:0)*self::CEC_Discount_Rate(),2);
//ROUND(ROUND(0.036*43*ROUND(0.08*当前英雄等级^2+0.08*当前英雄等级+1,0),0)*SIGN(player等级>14)*CEC_Discount_Rate,2)
return round(round(0.036*43*round(0.08*pow($grand,2)+0.08*$grand+1,0),0)*($grand>14?1:0)*self::CEC_Discount_Rate(),2);
}
//英雄NFT每次进阶的CEG消耗公式
public static function Hero_Advanced_CEG_Expend($quality){
//ROUND((ROUND(0.08*当前英雄阶数^2+0.08*当前英雄阶数+1,0)*10+100)*CEG_Discount_Rate,0)
return round((round(0.08*pow($quality,2)+0.08*$quality+1,0)*10+100)*self::CEG_Discount_Rate(),0);
}
//英雄NFT每次进阶的CEC消耗公式
public static function Hero_Advanced_CEC_Expend($quality){
//ROUND((ROUND(0.08*当前英雄阶数^2+0.08*当前英雄阶数+1,0)*1.5+10)*CEC_Discount_Rate,2)
// return round((round(0.08*pow($quality,2)+0.08*$quality+1,0)*1.5+10)*self::CEC_Discount_Rate(),2);
//ROUND((ROUND(0.08*player阶数^2+0.08*player阶数+1,0)*0.6+4)*CEC_Discount_Rate,2)
return round((round(0.08*pow($quality,2)+0.08*$quality+1,0)*0.6+4)*self::CEC_Discount_Rate(),2);
}
//英雄NFT每次进阶成功的概率公式
public static function Hero_Advanced_Probability($quality){
//SIGN(当前英雄阶数>9.5)*ROUND(0.0043*当前英雄阶数^2-0.144*当前英雄阶数+1.2629,2)+SIGN(当前英雄阶数<9.5)*ROUND(1.2-0.1*当前英雄阶数,2)
return ($quality>9.5?1:0)*round(0.0043*pow($quality,2)-0.144*$quality+1.2629,2)+($quality<9.5?1:0)*round(1.2-0.1*$quality,2);
}
//英雄NFT幸运值
public static function Hero_Advanced_Lucky_Value($quality){
//ROUND((0.0354*英雄NFT阶数^5-0.8464*英雄NFT阶数^4+10.907*英雄NFT阶数^3 -48.868*英雄NFT阶数^2+312.18*英雄NFT阶数-80)/10,1)*10
return round((0.0354*pow($quality,5)-0.8464*pow($quality,4)+10.907*pow($quality,3)-48.868*pow($quality,2)+312.18*$quality-80)/10,1)*10;
}
//英雄NFT最大体力值
public static function Hero_NFT_Maximum_Physical_Strength($quality,$lucky){
//英雄NFT幸运值*ROUND(1.1714+0.0286*当前英雄NFT阶数,3)
return $lucky*round(1.1714+0.0286*$quality,3);
}
//枪械NFT每次升级的CEG消耗公式
public static function Weapon_Upgrade_CEG_Expend($grand){
//ROUND(ROUND(25.8*ROUND(0.08*当前枪械等级^2+0.08*当前枪械等级等级+1,0),0)*CEG_Discount_Rate,0)
return round(round(25.8*round(0.08*pow($grand,2)+0.08*$grand+1,0),0)*self::CEG_Discount_Rate(),0);
}
//枪械NFT每次升级的CEC消耗公式
public static function Weapon_Upgrade_CEC_Expend($grand){
//ROUND(ROUND(0.036*ROUND(25.8*ROUND(0.08*当前枪械等级^2+0.08*当前枪械等级等级+1,0),0)*SIGN(equip等级>14)*CEC_Discount_Rate,2)
return round(round(0.036*round(25.8*round(0.08*pow($grand,2)+0.08*$grand+1,0),0)*($grand>14?1:0)*self::CEC_Discount_Rate(),2));
}
//枪械NFT每次进阶的CEG消耗公式
public static function Weapon_Advanced_CEG_Expend($quality){
//ROUND((ROUND(0.08*枪械NFT阶数^2+0.08*枪械NFT阶数+1,0)*3+30)*CEG_Discount_Rate,0)
return round((round(0.08*pow($quality,2)+0.08*$quality+1,0)*3+30)*self::CEG_Discount_Rate(),0);
}
//枪械NFT每次进阶的CEC消耗公式
public static function Weapon_Advanced_CEC_Expend($quality){
//ROUND(ROUND(ROUND(0.08*equip阶数^2+0.08*equip阶数+1,0)*0.3+2,0)*CEC_Discount_Rate,2)
return round(round(round(0.08*pow($quality,2)+0.08*$quality+1,0)*0.3+2,0)*self::CEC_Discount_Rate(),2);
}
//枪械NFT每次进阶成功的概率公式
public static function Weapon_Advanced_Probability($quality){
//SIGN(当前枪械阶数>9.5)*ROUND(0.0043*当前枪械阶数^2-0.144*当前枪械阶数+1.2629,2)+SIGN(当前枪械阶数<9.5)*ROUND(1.2-0.1*当前枪械阶数,2)
return ($quality>9.5?1:0)*round(0.0043*pow($quality,2)-0.144*$quality+1.2629,2)+($quality<9.5?1:0)*round(1.2-0.1*$quality,2);
}
//枪械NFT幸运值
public static function Weapon_Advanced_Lucky_Value($quality){
//ROUND((0.0354*枪械NFT阶数^5-0.8464*枪械NFT阶数^4+10.907*枪械NFT阶数^3 -48.868*枪械NFT阶数^2+312.18*枪械NFT阶数-80)/10,1)*3
return round((0.0354*pow($quality,5)-0.8464*pow($quality,4)+10.907*pow($quality,3)-48.868*pow($quality,2)+312.18*$quality-80)/10,1)*3;
}
//枪械NFT最大耐久度
public static function Weapon_NFT_Maximum_Durability($quality,$lucky){
//枪械NFT幸运值*ROUND(1.1714+0.0286*当前枪械NFT阶数,3)
return $lucky*round(1.1714+0.0286*$quality,3);
}
//英雄NFT碎片合成费用
public static function Hero_Parts_Synthetic_Cost($hero_count){
//ROUND(每日新增1阶英雄NFT数量前1天官方商城正价购买*6%,0)*30%*2000*CEG折扣比率
return round($hero_count*0.06,0)*0.3*2000*self::CEG_Discount_Rate();
}
//枪械NFT碎片合成费用
public static function Weapon_Parts_Synthetic_Cost($gun_count){
//ROUND(每日新增1阶枪械NFT数量前1天官方商城正价购买*6%,0)*30%*600*CEG折扣比率
return round($gun_count*0.06,0)*0.3*600*self::CEG_Discount_Rate();
}
//每日英雄体力值衰减百分比
public static function Hero_PSA_Value($quality){
//MAX(0,ROUND((Hero_Payback_Period-Hero_Attenuation_Parameter* Hero_Labor_Value)/((1-Hero_Attenuation_Parameter/2)* Hero_Payback_Period^2)/ROUND(1.1714+0.0286*英雄阶数,3),4))*(1+0.1*ROUND(SIN(Hero_Labor_Value),2))
return max(0,round((self::Hero_Payback_Period($quality)-self::Hero_Attenuation_Parameter($quality)*self::Hero_Labor_Value())/((1-self::Hero_Attenuation_Parameter($quality)/2)*pow(self::Hero_Payback_Period($quality),2))/round(1.1714+0.0286*$quality,3),4))*(1+0.1*round(sin(self::Hero_Labor_Value()),2));
}
//每日武器耐久度衰减百分比
public static function Weapon_DA_Value($quality){
//MAX(0,ROUND((Weapon_Payback_Period-Weapon_Attenuation_Parameter* Weapon_Labor_Value)/((1-Weapon_Attenuation_Parameter/2)* Weapon_Payback_Period ^2)/ROUND(1.1714+0.0286*武器阶数,3),4))*(1+0.1*ROUND(SIN(Weapon_Labor_Value),2))
return max(0,round((self::Weapon_Payback_Period($quality)-self::Weapon_Attenuation_Parameter($quality)*self::Weapon_Labor_Value())/((1-self::Weapon_Attenuation_Parameter($quality)/2)*pow(self::Weapon_Payback_Period($quality),2))/round(1.1714+0.0286*$quality,3),4))*(1+0.1*round(sin(self::Weapon_Labor_Value()),2));
}
//英雄回本周期(参数单位:天)
public static function Hero_Payback_Period($quality){
//ROUND(-0.019*英雄阶数^3+0.1884*英雄阶数^2+11.685*英雄阶数+48.765,0)
return round(-0.019*pow($quality,3)+0.1884*pow($quality,2)+11.685*$quality+48.765,0);
}
//英雄衰减参数
public static function Hero_Attenuation_Parameter($quality){
//ROUND(-0.000015*英雄阶数^3+0.0008*英雄阶数^2-0.02325*英雄阶数+0.606,3)
return round(-0.000015*pow($quality,3)+0.0008*pow($quality,2)-0.02325*$quality+0.606,3);
}
//枪械回本周期(参数单位:天)
public static function Weapon_Payback_Period($quality){
//ROUND(-0.019*武器阶数^3+0.1884*武器阶数^2+11.685*武器阶数+48.765,0)
return round(-0.019*pow($quality,3)+0.1884*pow($quality,2)+11.685*$quality+48.765,0);
}
//枪械衰减参数
public static function Weapon_Attenuation_Parameter($quality){
//ROUND(-0.000015*武器阶数^3+0.0008*武器阶数^2-0.02325*武器阶数+0.606,3)
return round(-0.000015*pow($quality,3)+0.0008*pow($quality,2)-0.02325*$quality+0.606,3);
}
}