添加英雄和枪械详情接口

This commit is contained in:
hujiabin 2022-08-24 16:20:11 +08:00
parent 54fc6c1e0c
commit 5b8157a036
9 changed files with 208 additions and 21 deletions

View File

@ -198,6 +198,19 @@ class Chip(object):
['token_ids', '', '芯片token id 例如token_id1 token_id2 token_id3'], ['token_ids', '', '芯片token id 例如token_id1 token_id2 token_id3'],
], '芯片信息'] ], '芯片信息']
] ]
},{
'name': 'lockChip',
'desc': '芯片加锁',
'group': 'Chip',
'url': 'webapp/index.php?c=Chip&a=lockChip',
'params': [
_common.ReqHead(),
['token_id', '', '芯片token id'],
['state', '', '1 加锁 0 释放锁'],
],
'response': [
_common.RspHead()
]
}, },

View File

@ -89,4 +89,18 @@ class Gun(object):
['property_chg', _common.PropertyChg(), '属性变更'], ['property_chg', _common.PropertyChg(), '属性变更'],
] ]
}, },
{
'name': 'gunDetails',
'desc': '武器详情',
'group': 'Gun',
'url': 'webapp/index.php?c=Gun&a=gunDetails',
'params': [
_common.ReqHead(),
['unique_id', 0, '枪械唯一id'],
],
'response': [
_common.RspHead(),
['!data', [_common.Gun()], '枪械信息']
]
},
] ]

View File

@ -150,4 +150,18 @@ class Hero(object):
['new_hero', _common.Hero(), '英雄-新'], ['new_hero', _common.Hero(), '英雄-新'],
] ]
}, },
{
'name': 'heroDetails',
'desc': '英雄详情',
'group': 'Hero',
'url': 'webapp/index.php?c=Hero&a=heroDetails',
'params': [
_common.ReqHead(),
['unique_id', 0, '英雄唯一id'],
],
'response': [
_common.RspHead(),
['!data', [_common.Hero()], '英雄信息']
]
},
] ]

View File

@ -87,6 +87,8 @@ class Gun(object):
['unlock_time', 0, '使用解锁utc时间(升级或者升阶触发),锁定期间不可战斗和做其他操作,配合lock_type使用'], ['unlock_time', 0, '使用解锁utc时间(升级或者升阶触发),锁定期间不可战斗和做其他操作,配合lock_type使用'],
['unlock_lefttime', 0, '解锁剩余时间(单位秒)'], ['unlock_lefttime', 0, '解锁剩余时间(单位秒)'],
['trade_locktime', 0, '出售锁定时间(升级或者升阶完成后触发),单位秒,只锁交易,其他的操作仍可进行'], ['trade_locktime', 0, '出售锁定时间(升级或者升阶完成后触发),单位秒,只锁交易,其他的操作仍可进行'],
['chip_ids', '', '镶嵌的芯片主键id组'],
['!chip_core', [ChipCore()], '核心加成'],
] ]
class GunSkin(object): class GunSkin(object):
@ -232,6 +234,7 @@ class Hero(object):
['def', 0, '防御'], ['def', 0, '防御'],
['advanced_count', 0, '进阶次数'], ['advanced_count', 0, '进阶次数'],
['lukcy', 0, '幸运'], ['lukcy', 0, '幸运'],
['chip_ids', '', '镶嵌的芯片主键id组'],
['!chip_core', [ChipCore()], '核心加成'], ['!chip_core', [ChipCore()], '核心加成'],
] ]
@ -668,9 +671,10 @@ class Chip(object):
['supper_state', 0, '是否锁定0 正常;1 锁住'], ['supper_state', 0, '是否锁定0 正常;1 锁住'],
['inlay_state', 0, '镶嵌状态0 未镶嵌;1 镶嵌了'], ['inlay_state', 0, '镶嵌状态0 未镶嵌;1 镶嵌了'],
['!rand_attr', [ChipAttr()], '属性'], ['!rand_attr', [ChipAttr()], '属性'],
['lucky_temporary', '', '升级成功所需增加的幸运值'], ['lucky_temporary', '', '升级成功的幸运值'],
['lucky_final', '', '最终幸运值'], ['lucky_final', '', '最终幸运值'],
['strength', '', '最终体力值'], ['strength_max', '', '最大体力值'],
['strength', '', '前一天体力值'],
['strength_temporary', '', '升级成功所得出的总体力值'], ['strength_temporary', '', '升级成功所得出的总体力值'],
] ]

View File

@ -229,7 +229,8 @@ CREATE TABLE `t_chip` (
`last_get_gold_time` int(11) NOT NULL DEFAULT '0' COMMENT '最后获取金币的时间', `last_get_gold_time` int(11) NOT NULL DEFAULT '0' COMMENT '最后获取金币的时间',
`lucky_temporary` varchar(10) NOT NULL DEFAULT '0' COMMENT '临时幸运值', `lucky_temporary` varchar(10) NOT NULL DEFAULT '0' COMMENT '临时幸运值',
`lucky_final` varchar(10) NOT NULL DEFAULT '0' COMMENT '最终幸运值', `lucky_final` varchar(10) NOT NULL DEFAULT '0' COMMENT '最终幸运值',
`strength` varchar(10) NOT NULL DEFAULT '0' COMMENT '体力值', `strength_max` varchar(10) NOT NULL DEFAULT '0' COMMENT '最大体力值',
`strength` varchar(10) NOT NULL DEFAULT '0' COMMENT '前一天体力值',
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
PRIMARY KEY (`idx`), PRIMARY KEY (`idx`),

View File

@ -244,8 +244,6 @@ class ChipController extends BaseAuthedController
$this->_rspErr(1, 'Please enter instructions'); $this->_rspErr(1, 'Please enter instructions');
return; return;
} }
$chip_main = Chip::getChipByTokenId($token_ids[0]); $chip_main = Chip::getChipByTokenId($token_ids[0]);
$chip_param = Chip::getChipByTokenId($token_ids[1]); $chip_param = Chip::getChipByTokenId($token_ids[1]);
if ($chip_param['supper_state'] == 1 || $chip_param['inlay_state'] == 1 || $chip_param['state'] == -1){ if ($chip_param['supper_state'] == 1 || $chip_param['inlay_state'] == 1 || $chip_param['state'] == -1){
@ -256,14 +254,8 @@ class ChipController extends BaseAuthedController
$this->_rspErr(1, "The selected material is too high grade"); $this->_rspErr(1, "The selected material is too high grade");
return; return;
} }
if ($chip_param['state']){ $cost = \services\FormulaService::getChipCumulativeCost($chip_param['chip_grade']);
Chip::update($token_ids[1],['state'=>0]); $this->_rspData(['data'=>$cost]);
$cost = 0;
}else{
Chip::update($token_ids[1],['state'=>1]);
$cost = \services\FormulaService::getChipCumulativeCost($chip_param['chip_grade']);
}
$this->_rspData(['data'=>$cost]);
} }
public function syntheticChip(){ public function syntheticChip(){
@ -294,7 +286,7 @@ class ChipController extends BaseAuthedController
//合成成功 //合成成功
$this->_upgraded($chip_main); $this->_upgraded($chip_main);
$chip_new = Chip::toDto(Chip::getChipByTokenId($token_id_main)); $chip_new = Chip::toDto(Chip::getChipByTokenId($token_id_main));
$chip_new['strength_temporary'] = \services\FormulaService::getChipPhysicalStrengthValue($chip_new['chip_grade'],$chip_new['lucky_temporary']); $chip_new['strength_temporary'] = \services\FormulaService::Hero_Chip_NFT_Maximum_Physical_Strength($chip_new['chip_grade'],$chip_new['lucky_temporary']);
$this->_rspData(['data'=>$chip_new]); $this->_rspData(['data'=>$chip_new]);
} }
} }
@ -306,10 +298,13 @@ class ChipController extends BaseAuthedController
return; return;
} }
$chip = Chip::getChipByTokenId($token_id); $chip = Chip::getChipByTokenId($token_id);
$strength_max = \services\FormulaService::Hero_Chip_NFT_Maximum_Physical_Strength($chip['chip_grade'],$chip['lucky_temporary']);
$fieldsKv = [ $fieldsKv = [
'supper_state' => 0,
'lucky_final'=>$chip['lucky_temporary'], 'lucky_final'=>$chip['lucky_temporary'],
'lucky_temporary'=>0, 'lucky_temporary'=>0,
'strength' => \services\FormulaService::getChipPhysicalStrengthValue($chip['chip_grade'],$chip['lucky_temporary']) 'strength_max' => $strength_max,
'strength' => $strength_max
]; ];
Chip::update($chip['token_id'],$fieldsKv); Chip::update($chip['token_id'],$fieldsKv);
$this->_rspOk(); $this->_rspOk();
@ -323,6 +318,7 @@ class ChipController extends BaseAuthedController
} }
$chip = Chip::getChipByTokenId($token_id); $chip = Chip::getChipByTokenId($token_id);
$fieldsKv = [ $fieldsKv = [
'supper_state' => 0,
'lucky_temporary'=>0, 'lucky_temporary'=>0,
]; ];
Chip::update($chip['token_id'],$fieldsKv); Chip::update($chip['token_id'],$fieldsKv);
@ -355,7 +351,7 @@ class ChipController extends BaseAuthedController
$chipList = Chip::all($chip['chip_type']); $chipList = Chip::all($chip['chip_type']);
$chipDtoList = array(); $chipDtoList = array();
foreach ($chipList as $item) { foreach ($chipList as $item) {
if ($item['supper_state']==0 && $item['inlay_state']==0 && $item['state']==0 && $item['token_id'] != $token_id && $item['chip_grade'] <= $chip['chip_grade']){ if ($item['supper_state']==0 && $item['inlay_state']==0 && $item['state']!=-1 && $item['token_id'] != $token_id && $item['chip_grade'] <= $chip['chip_grade']){
array_push($chipDtoList, $item); array_push($chipDtoList, $item);
} }
}; };
@ -411,6 +407,21 @@ class ChipController extends BaseAuthedController
$this->_rspData(['data'=>['cost'=>$cumulative_cost,'token_ids'=>implode(' ',$token_id_arr)]]); $this->_rspData(['data'=>['cost'=>$cumulative_cost,'token_ids'=>implode(' ',$token_id_arr)]]);
} }
public function lockChip(){
$token_id = trim(getReqVal('token_id', 0));
$state = trim(getReqVal('state', 0));
if (! $token_id){
$this->_rspErr(1, 'Please enter instructions');
return;
}
if ($state == 1){
Chip::update($token_id,['state'=>-1]);
}else{
Chip::update($token_id,['state'=>0]);
}
$this->_rspOk();
}
private function _doInlayHero($hero_id,$token_id){ private function _doInlayHero($hero_id,$token_id){
$chip = Chip::getChipByTokenId($token_id); $chip = Chip::getChipByTokenId($token_id);
@ -628,8 +639,14 @@ class ChipController extends BaseAuthedController
if ($new_grade == 3 || $new_grade == 5){ if ($new_grade == 3 || $new_grade == 5){
Chip::updateRandAttr($chip); Chip::updateRandAttr($chip);
} }
$lucky = ltrim(\services\FormulaService::getChipLuckyValue($new_grade),'-') ; $lucky = ltrim(\services\FormulaService::getChipLuckyValue($new_grade),'-') ;
Chip::update($chip['token_id'],['lucky_temporary'=>$lucky, 'chip_grade'=>$new_grade]); if ($new_grade>=5){
$where = ['lucky_temporary'=>$lucky, 'chip_grade'=>$new_grade,'supper_state'=>1];
}else{
$where = ['lucky_temporary'=>$lucky, 'chip_grade'=>$new_grade];
}
Chip::update($chip['token_id'],$where);
} }
private function _bestFun($upgrade_cost,$chip_param,$chip_param_out){ private function _bestFun($upgrade_cost,$chip_param,$chip_param_out){

View File

@ -10,6 +10,7 @@ require_once('models/GunTalent.php');
require_once('models/User.php'); require_once('models/User.php');
require_once('models/Gun.php'); require_once('models/Gun.php');
require_once('models/Bag.php'); require_once('models/Bag.php');
require_once('models/Chip.php');
require_once('services/PropertyChgService.php'); require_once('services/PropertyChgService.php');
@ -19,6 +20,7 @@ use models\GunTalent;
use models\User; use models\User;
use models\Gun; use models\Gun;
use models\Bag; use models\Bag;
use models\Chip;
class GunController extends BaseAuthedController { class GunController extends BaseAuthedController {
@ -40,6 +42,49 @@ class GunController extends BaseAuthedController {
)); ));
} }
public function gunDetails(){
$unique_id = trim(getReqVal('unique_id', 0));
if ( ! $unique_id) {
$this->_rspErr(1, 'Please enter instructions');
return;
}
$chipAttr = [];
$gun = Gun::find($unique_id);
$chipIdsArr = explode('|',$gun['chip_ids']);
foreach ($chipIdsArr as $val){
$chip = Chip::toDto(Chip::getChipByIdx($val));
foreach ($chip['rand_attr'] as $v){
array_push($chipAttr,$v);
}
}
$gun_attr = emptyReplace(json_decode($gun['rand_attr'], true), array());
\mt\AttrHelper::mergeAttr($gun_attr,$chipAttr);
$gun['rand_attr'] = $gun_attr;
$chipCore = [];
if (count($chipIdsArr) == 4){
$min = 15;
foreach ($chipIdsArr as $val){
$chip = Chip::getChipByIdx($val);
if ($chip['chip_grade']<$min){
$min = $chip['chip_grade'];
}
}
$chipCoreList = getMetaTable('chipCore@chipCore.php');
foreach ($chipCoreList as $val){
if ($val['chip_core_type']==2 && $val['chip_core_lv']<=$min){
array_push($chipCore,$val);
}
}
$gun['chip_core'] = $chipCore;
}else{
$gun['chip_core'] = [];
}
$this->_rspData(array(
'data' => $gun
));
}
public function talentList() public function talentList()
{ {
$talentList = array(); $talentList = array();

View File

@ -12,15 +12,19 @@ require_once('mt/Parameter.php');
require_once('models/Hero.php'); require_once('models/Hero.php');
require_once('models/Bag.php'); require_once('models/Bag.php');
require_once('models/HeroSkin.php'); require_once('models/HeroSkin.php');
require_once('models/Chip.php');
require_once('services/AwardService.php'); require_once('services/AwardService.php');
require_once('services/PropertyChgService.php'); require_once('services/PropertyChgService.php');
require_once('services/RankActivityService.php'); require_once('services/RankActivityService.php');
use phpcommon\SqlHelper; use phpcommon\SqlHelper;
use models\Hero; use models\Hero;
use models\Bag; use models\Bag;
use models\HeroSkin; use models\HeroSkin;
use models\Chip;
class HeroController extends BaseAuthedController { class HeroController extends BaseAuthedController {
@ -35,6 +39,50 @@ class HeroController extends BaseAuthedController {
)); ));
} }
public function heroDetails()
{
$unique_id = trim(getReqVal('unique_id', 0));
if ( ! $unique_id) {
$this->_rspErr(1, 'Please enter instructions');
return;
}
$chipAttr = [];
$hero = Hero::find($unique_id);
$chipIdsArr = explode('|',$hero['chip_ids']);
foreach ($chipIdsArr as $val){
$chip = Chip::toDto(Chip::getChipByIdx($val));
foreach ($chip['rand_attr'] as $v){
array_push($chipAttr,$v);
}
}
$hero_attr = emptyReplace(json_decode($hero['rand_attr'], true), array());
\mt\AttrHelper::mergeAttr($hero_attr,$chipAttr);
$hero['rand_attr'] = $hero_attr;
$chipCore = [];
if (count($chipIdsArr) == 4){
$min = 15;
foreach ($chipIdsArr as $val){
$chip = Chip::getChipByIdx($val);
if ($chip['chip_grade']<$min){
$min = $chip['chip_grade'];
}
}
$chipCoreList = getMetaTable('chipCore@chipCore.php');
foreach ($chipCoreList as $val){
if ($val['chip_core_type']==1 && $val['chip_core_lv']<=$min){
array_push($chipCore,$val);
}
}
$hero['chip_core'] = $chipCore;
}else{
$hero['chip_core'] = [];
}
$this->_rspData(array(
'data' => $hero
));
}
public function skinList() public function skinList()
{ {
$skinList = array(); $skinList = array();

View File

@ -271,7 +271,7 @@ class FormulaService extends BaseService {
return 0; return 0;
} }
public static function getCegDiscountRate(){ public static function CEG_Discount_Rate(){
//CEG_Discount_Rate=ROUND(CEG_Dynamic_Index /( CEG_Dynamic_Price / CEG_Base_Price),3) //CEG_Discount_Rate=ROUND(CEG_Dynamic_Index /( CEG_Dynamic_Price / CEG_Base_Price),3)
return 1; return 1;
} }
@ -279,7 +279,7 @@ class FormulaService extends BaseService {
//芯片升星累计成本 //芯片升星累计成本
public static function getChipCumulativeCost($grade){ 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 //( 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::getCegDiscountRate(); 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 //( 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::getCegDiscountRate();*/ /* 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::getCegDiscountRate();*/
@ -289,18 +289,49 @@ class FormulaService extends BaseService {
//芯片升星成本 //芯片升星成本
public static function getChipUpgradeCost($grade){ 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 //(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::getCegDiscountRate(); 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){ public static function getChipLuckyValue($grade){
//芯片幸运值=SIGN(芯片星数>4)*ROUND( 0.00419*芯片星数^5-0.0705*芯片星数^4 +0.24*芯片星数^3 +8.5*芯片星数^2-39.9*芯片星数+38,1) //芯片幸运值=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); 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 getChipPhysicalStrengthValue($grade,$lucky){ //芯片体力值
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)) //芯片体力值命名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)); return ($grade>4?1:0)*($lucky*round(1+0.04*$grade,3));
} }
//英雄芯片劳力值
public static function Hero_Chip_Labor_Value(){
return 1;
}
//武器芯片劳力值
public static function Weapon_Chip_Labor_Value(){
return 1;
}
//芯片回本周期(参数单位:天)
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);
}
} }