1
This commit is contained in:
parent
1ddb13b8fb
commit
a34b5da0af
@ -48,8 +48,13 @@ class HeroController extends BaseAuthedController {
|
||||
$this->_rspErr(1, 'Please enter instructions');
|
||||
return;
|
||||
}
|
||||
$heroDb = Hero::find($unique_id);
|
||||
if (! $heroDb){
|
||||
$this->_rspErr(1, "You don't have the hero yet");
|
||||
return;
|
||||
}
|
||||
$chipAttr = [];
|
||||
$hero = Hero::toDto(Hero::find($unique_id));
|
||||
$hero = Hero::toDto($heroDb);
|
||||
$chipIdsArr = explode('|',$hero['chip_ids']);
|
||||
foreach ($chipIdsArr as $val){
|
||||
$chip = Chip::toDto(Chip::getChipByIdx($val));
|
||||
@ -65,14 +70,21 @@ class HeroController extends BaseAuthedController {
|
||||
$item[$v['attr_id']]['val']+= $v['val'];
|
||||
}
|
||||
}
|
||||
$hero['rand_attr'] = $item;
|
||||
$hero['rand_attr'] = $item;//芯片属性
|
||||
if ($hero['attr']){
|
||||
$hero_attr = emptyReplace(json_decode($hero['attr'], true), array());
|
||||
}else{
|
||||
$hero_attr = [];
|
||||
}
|
||||
\mt\AttrHelper::mergeAttr($hero_attr,$chipAttr);
|
||||
$hero['attr'] = $hero_attr;
|
||||
$base_attr = [
|
||||
['attr_id'=>1,'type'=>1,'val'=>$hero['hp']],
|
||||
['attr_id'=>5,'type'=>1,'val'=>$hero['speed']],
|
||||
['attr_id'=>3,'type'=>1,'val'=>$hero['atk']],
|
||||
['attr_id'=>4,'type'=>1,'val'=>$hero['def']],
|
||||
];
|
||||
\mt\AttrHelper::mergeAttr($hero_attr,$base_attr);
|
||||
$hero['attr'] = $hero_attr;//英雄总属性
|
||||
$chipCore = [];
|
||||
if (count($chipIdsArr) == 4){
|
||||
$min = 15;
|
||||
|
Loading…
x
Reference in New Issue
Block a user