This commit is contained in:
hujiabin 2022-08-30 14:23:31 +08:00
parent a34b5da0af
commit 844d06b3ec

View File

@ -77,7 +77,7 @@ class HeroController extends BaseAuthedController {
$hero_attr = [];
}
\mt\AttrHelper::mergeAttr($hero_attr,$chipAttr);
$base_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']],
@ -120,15 +120,20 @@ class HeroController extends BaseAuthedController {
}
$item = explode('|',$heroDb['skill_common']);
$skill_common = \mt\SkillCommon::get($item[$skillIndex]);
if ($skill_common['skill_level'] == 10){
$this->_rspErr(1, "Max level");
if (!$skill_common){
$this->_rspErr(1, "You don't have the skill yet");
return;
}
if($heroDb['quality'] < $skill_common['skill_limit_star']){
$next_skill_common = \mt\SkillCommon::get($skill_common['nextlv_skill']);
if (! $next_skill_common){
$this->_rspErr(1, "It's already the highest level");
return;
}
if($heroDb['quality'] < $next_skill_common['skill_limit_star']){
$this->_rspErr(1, "Hero level is not enough");
return;
}
if($heroDb['skill_points'] < $skill_common['skill_point_cost']){
if($heroDb['skill_points'] < $next_skill_common['skill_point_cost']){
$this->_rspErr(1, "Not enough hero skill points");
return;
}
@ -136,7 +141,7 @@ class HeroController extends BaseAuthedController {
$item[$skillIndex] = $skill_common['nextlv_skill'];
$where = [
'skill_common'=>implode('|',$item),
'skill_points'=>$heroDb['skill_points']-$skill_common['skill_point_cost'],
'skill_points'=>$heroDb['skill_points']-$next_skill_common['skill_point_cost'],
'modifytime' => $this->_getNowTime()
];
Hero::update($heroUniId, $where);
@ -166,15 +171,16 @@ class HeroController extends BaseAuthedController {
$this->_rspErr(1, "You don't have the skill yet");
return;
}
if ($skill['level_skill'] == 15){
$this->_rspErr(1, "Max level");
$next_skill = \mt\Skill::get($skill['nextlv_skill']);
if (!$next_skill){
$this->_rspErr(1, "It's already the highest level");
return;
}
if($heroDb['quality'] < $skill['skill_limit_star']){
if($heroDb['quality'] < $next_skill['skill_limit_star']){
$this->_rspErr(1, "Hero level is not enough");
return;
}
if(! $heroDb['skill_points'] || $heroDb['skill_points'] < $skill['skill_point']){
if(! $heroDb['skill_points'] || $heroDb['skill_points'] < $next_skill['skill_point']){
$this->_rspErr(1, "Not enough hero skill points");
return;
}