修改英雄、枪械属性
This commit is contained in:
parent
ae0c533ddf
commit
3945836bef
@ -81,14 +81,16 @@ class Gun(object):
|
||||
['quality', 0, '品阶'],
|
||||
['durability', 0, '耐久'],
|
||||
['ceg_uplimit', 0, 'ceg今天获取上限'],
|
||||
['!attr', [Attr()], '属性'],
|
||||
['!attr_base', [Attr()], '枪械基础属性'],
|
||||
['!attr_pro', [Attr()], '枪械升级升阶加成属性'],
|
||||
['!attr_chip', [Attr()], '枪械芯片加成属性'],
|
||||
['try_count', 0, '剩余体验次数 当state=1时才有意义'],
|
||||
['lock_type', 0, '0:无锁 1:升级 2:升阶 3:派遣中'],
|
||||
['unlock_time', 0, '使用解锁utc时间(升级或者升阶触发),锁定期间不可战斗和做其他操作,配合lock_type使用'],
|
||||
['unlock_lefttime', 0, '解锁剩余时间(单位秒)'],
|
||||
['trade_locktime', 0, '出售锁定时间(升级或者升阶完成后触发),单位秒,只锁交易,其他的操作仍可进行'],
|
||||
['chip_ids', '', '镶嵌的芯片主键id组'],
|
||||
['!chip_core', [ChipCore()], '核心加成'],
|
||||
['!chip_core', [ChipCore()], '芯片核心加成'],
|
||||
]
|
||||
|
||||
class GunSkin(object):
|
||||
@ -218,8 +220,10 @@ class Hero(object):
|
||||
['skill_lv2', 0, '被动技能unique_id'],
|
||||
['ceg_uplimit', 0, 'ceg今天获取上限'],
|
||||
['pve_ceg_uplimit', 0, 'pve ceg今天获取上限'],
|
||||
['!attr', [Attr()], '英雄总属性'],
|
||||
['!rand_attr', [Attr()], '芯片属性'],
|
||||
['!attr_base', [Attr()], '英雄基础属性'],
|
||||
['!attr_pro', [Attr()], '英雄升级升阶提升属性'],
|
||||
['!attr_skill', [Attr()], '英雄技能提升属性'],
|
||||
['!attr_chip', [Attr()], '英雄芯片提升属性'],
|
||||
['try_count', 0, '剩余体验次数 当state=1时才有意义'],
|
||||
['lock_type', 0, '0:无锁 1:升级 2:升阶 3:派遣中'],
|
||||
['unlock_lefttime', 0, '解锁剩余时间(单位秒)'],
|
||||
@ -236,7 +240,8 @@ class Hero(object):
|
||||
['advanced_count', 0, '进阶次数'],
|
||||
['lukcy', 0, '幸运'],
|
||||
['chip_ids', '', '镶嵌的芯片主键id组'],
|
||||
['!chip_core', [ChipCore()], '核心加成'],
|
||||
['skill_points', '', '技能点'],
|
||||
['!chip_core', [ChipCore()], '芯片核心加成'],
|
||||
['!skill_common', [], '通用属性'],
|
||||
]
|
||||
|
||||
|
@ -48,6 +48,7 @@ const kHAT_FireRate = 9;
|
||||
const kHAT_Volume = 10;
|
||||
const kHAT_MaxHp = 11;
|
||||
const kHAT_ShotView = 12;
|
||||
const kHAT_View = 13;
|
||||
const kHAT_ReloadTime = 14;
|
||||
|
||||
const kHAT_WeaponDmg = 20;
|
||||
@ -65,6 +66,10 @@ const kHAT_RecoverHpAdd = 31;
|
||||
const kHAT_SkillTime = 32;
|
||||
const kHAT_WeaponThrowRange = 33;
|
||||
const kHAT_LUCKY = 34;
|
||||
const kHAT_Critical = 42;
|
||||
const kHAT_CriDamage = 43;
|
||||
const kHAT_Dodge = 44;
|
||||
const kHAT_Ruduce = 45;
|
||||
|
||||
const kHAT_ABS_VAL = 1;
|
||||
const kHAT_RATE_VAL = 2;
|
||||
|
@ -28,10 +28,8 @@ class ChipController extends BaseAuthedController
|
||||
$chipList = Chip::all($type);
|
||||
$chipDtoList = array();
|
||||
foreach ($chipList as $item) {
|
||||
// array_push($chipDtoList, $item);
|
||||
array_push($chipDtoList, Chip::toDto($item));
|
||||
}
|
||||
// print_r($chipDtoList);die;
|
||||
$this->_rspData(array(
|
||||
'data' => $chipDtoList,
|
||||
));
|
||||
@ -493,7 +491,7 @@ class ChipController extends BaseAuthedController
|
||||
// Chip::update($chip['token_id'],['strength'=>$tili]);
|
||||
// }
|
||||
// $this->_rspOk();
|
||||
echo $this->_getV(TN_HERO_LEVEL_UP, 0);
|
||||
print_r(Chip::getChipByIdx(10052)) ;
|
||||
}
|
||||
|
||||
|
||||
@ -605,7 +603,8 @@ class ChipController extends BaseAuthedController
|
||||
}
|
||||
|
||||
private function _inLayNewAttr($hero_id){
|
||||
$hero = Hero::find($hero_id);
|
||||
$heroDb = Hero::find($hero_id);
|
||||
$hero = Hero::toDto($heroDb);
|
||||
$chipAttr = [];
|
||||
if (! $hero['chip_ids'] ){
|
||||
return $hero;
|
||||
@ -625,9 +624,15 @@ class ChipController extends BaseAuthedController
|
||||
}
|
||||
}
|
||||
}
|
||||
$hero_attr = emptyReplace(json_decode($hero['rand_attr'], true), array());
|
||||
\mt\AttrHelper::mergeAttr($hero_attr,$chipAttr);
|
||||
$hero['rand_attr'] = $hero_attr;
|
||||
$item = [];
|
||||
foreach ($chipAttr as $k=>$v){
|
||||
if (!isset($item[$v['attr_id']])){
|
||||
$item[$v['attr_id']] = $v;
|
||||
}else{
|
||||
$item[$v['attr_id']]['val']+= $v['val'];
|
||||
}
|
||||
}
|
||||
$hero['attr_chip'] = $item;//芯片属性
|
||||
return $hero;
|
||||
}
|
||||
|
||||
|
@ -71,8 +71,7 @@ class GunController extends BaseAuthedController {
|
||||
}
|
||||
}
|
||||
|
||||
$gun['rand_attr'] = $item;//芯片属性
|
||||
\mt\AttrHelper::mergeAttr($gun['attr'],$chipAttr);
|
||||
$gun['attr_chip'] = $item;//芯片属性
|
||||
$chipCore = [];
|
||||
if (count($chipIdsArr) == 4){
|
||||
$min = 15;
|
||||
|
@ -70,21 +70,7 @@ class HeroController extends BaseAuthedController {
|
||||
$item[$v['attr_id']]['val']+= $v['val'];
|
||||
}
|
||||
}
|
||||
$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);
|
||||
$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;//英雄总属性
|
||||
$hero['attr_chip'] = $item;//芯片属性
|
||||
$chipCore = [];
|
||||
if (count($chipIdsArr) == 4){
|
||||
$min = 15;
|
||||
|
@ -54,7 +54,7 @@ class UserController extends BaseAuthedController {
|
||||
|
||||
private function addChip(){
|
||||
$list1 = [130001,130002,130003,130004,130005,130006,130007,130008,130009,130010];
|
||||
$list2 = [130011,130012,130013,130014,130015,130016,130017];
|
||||
$list2 = [130011,130012,130013,130014,130015,130016];
|
||||
for ($i=1;$i<=15;$i++){
|
||||
$itemId1 = $list1[rand(0,9)];
|
||||
$itemMeta = mt\Item::get($itemId1);
|
||||
|
@ -140,9 +140,10 @@ class Gun extends BaseModel {
|
||||
$unlockTime = $row['unlock_time'];
|
||||
}
|
||||
$itemMeta = mt\Item::get($row['gun_id']);
|
||||
$baseAttr=[];
|
||||
if ($itemMeta) {
|
||||
$baseAttr = mt\Item::getBaseAttrs($itemMeta);
|
||||
mt\AttrHelper::mergeAttr($attr, $baseAttr);
|
||||
// mt\AttrHelper::mergeAttr($attr, $baseAttr);
|
||||
}
|
||||
$todayGetGold = $row['today_get_gold'];
|
||||
$lastGetGoldTime = $row['last_get_gold_time'];
|
||||
@ -165,7 +166,8 @@ class Gun extends BaseModel {
|
||||
'ceg_uplimit' => 0,
|
||||
'pve_ceg_uplimit' => 0,
|
||||
'raw_pve_ceg_uplimit' => 0,
|
||||
'attr' => $attr,
|
||||
'attr_base' => $baseAttr,
|
||||
'attr_pro' => $attr,
|
||||
'try_count' => $row['try_count'],
|
||||
'today_get_gold' => $todayGetGold,
|
||||
'last_get_gold_time' => $lastGetGoldTime,
|
||||
|
@ -7,6 +7,7 @@ require_once('mt/HeroLevel.php');
|
||||
require_once('mt/HeroQuality.php');
|
||||
require_once('mt/AttrHelper.php');
|
||||
require_once('mt/Item.php');
|
||||
require_once('mt/SkillCommon.php');
|
||||
require_once('models/HeroSkin.php');
|
||||
require_once('services/NftService.php');
|
||||
require_once('services/FormulaService.php');
|
||||
@ -144,40 +145,18 @@ class Hero extends BaseModel {
|
||||
myself()->_getNowDaySeconds()) {
|
||||
$todayPveGetCeg = 0;
|
||||
}
|
||||
$hp = 0;
|
||||
$speed = 0;
|
||||
$atk = 0;
|
||||
$def = 0;
|
||||
$baseAttr=[];
|
||||
$heroMeta = mt\Hero::get($row['hero_id']);
|
||||
if ($heroMeta) {
|
||||
$newAttr = emptyReplace(json_decode($row['rand_attr'], true), array());
|
||||
$baseAttr = mt\Hero::getHeroAttr($heroMeta);
|
||||
mt\AttrHelper::mergeAttr($newAttr, $baseAttr);
|
||||
$hp = $heroMeta['hp'] * (1 + mt\AttrHelper::getRateValEx($newAttr, kHAT_Hp));
|
||||
$speed = $heroMeta['move_speed'] * (1 + mt\AttrHelper::getRateValEx($newAttr, kHAT_Speed));
|
||||
$atk = $heroMeta['damage'] * (1 + mt\AttrHelper::getRateValEx($newAttr, kHAT_Atk));
|
||||
$def = $heroMeta['defence'] * (1 + mt\AttrHelper::getRateValEx($newAttr, kHAT_Def));
|
||||
if ($qualityMeta) {
|
||||
$hp = $hp * (1 + $qualityMeta['promote'] / 100.0);
|
||||
}
|
||||
if ($qualityMeta) {
|
||||
$speed *= (1 + $qualityMeta['promote'] / 100.0);
|
||||
}
|
||||
/*if ($qualityMeta) {
|
||||
$speed *= (1 + $qualityMeta['promote'] / 100.0);
|
||||
}*/
|
||||
if ($qualityMeta) {
|
||||
$atk *= (1 + $qualityMeta['promote'] / 100.0);
|
||||
}
|
||||
if ($qualityMeta) {
|
||||
$def *= (1 + $qualityMeta['promote'] / 100.0);
|
||||
}
|
||||
}
|
||||
{
|
||||
$hp = round($hp, 2);
|
||||
$speed = round($speed, 2);
|
||||
$atk = round($atk, 2);
|
||||
$def = round($def, 2);
|
||||
$skill_common = explode("|",$row['skill_common']);
|
||||
$attr_skill = [];
|
||||
foreach ($skill_common as $val){
|
||||
$item = mt\SkillCommon::getAttrBySkillCommon($val);
|
||||
if ($item){
|
||||
array_push($attr_skill,$item);
|
||||
}
|
||||
}
|
||||
$heroLucky = $qualityMeta ? $qualityMeta['lucky'] : 0;
|
||||
$dto = array(
|
||||
@ -194,7 +173,9 @@ class Hero extends BaseModel {
|
||||
'ceg_uplimit' => 0,
|
||||
'pve_ceg_uplimit' => 0,
|
||||
'raw_pve_ceg_uplimit' => 0,
|
||||
'attr' => $attr,
|
||||
'attr_base' => $baseAttr,
|
||||
'attr_pro' => $attr,
|
||||
'attr_skill' => $attr_skill,
|
||||
'try_count' => $row['try_count'],
|
||||
'lock_type' => $lockType,
|
||||
'unlock_time' => $unlockTime,
|
||||
@ -205,15 +186,10 @@ class Hero extends BaseModel {
|
||||
'today_pve_get_ceg' => $todayPveGetCeg,
|
||||
'last_pve_get_ceg_time' => $lastPveGetCegTime,
|
||||
'unlock_trade_time' => $row['unlock_trade_time'],
|
||||
|
||||
'hp' => $hp,
|
||||
'speed' => $speed,
|
||||
'atk' => $atk,
|
||||
'def' => $def,
|
||||
'advanced_count' => $row['advanced_count'],
|
||||
'lucky' => $heroLucky,
|
||||
'chip_ids' => $row['chip_ids'],
|
||||
'skill_common' => explode("|",$row['skill_common']),
|
||||
'skill_common' => $skill_common,
|
||||
'skill_points' => $row['skill_points'],
|
||||
);
|
||||
$dto['ceg_uplimit'] = FormulaService::getHeroPvpDailyCegUpLimit($dto);
|
||||
|
@ -34,8 +34,24 @@ class Hero {
|
||||
),
|
||||
array(
|
||||
'attr_id' => kHAT_Speed,
|
||||
'field_name' => 'move_speed'
|
||||
'field_name' => 'move_speed5'
|
||||
),array(
|
||||
'attr_id' => kHAT_Critical,
|
||||
'field_name' => 'crit_atk'
|
||||
),array(
|
||||
'attr_id' => kHAT_CriDamage,
|
||||
'field_name' => 'crit_atk_damage'
|
||||
),array(
|
||||
'attr_id' => kHAT_Dodge,
|
||||
'field_name' => 'miss'
|
||||
),array(
|
||||
'attr_id' => kHAT_Ruduce,
|
||||
'field_name' => 'miss_damage_ruduce'
|
||||
),
|
||||
// array(
|
||||
// 'attr_id' => kHAT_View,
|
||||
// 'field_name' => ''
|
||||
// ),
|
||||
);
|
||||
$attr = array();
|
||||
foreach ($fields as $field) {
|
||||
|
@ -21,4 +21,18 @@ class SkillCommon {
|
||||
return getXVal(self::getMetaList(), $id);
|
||||
}
|
||||
|
||||
public static function getAttrBySkillCommon($id){
|
||||
$mateOne = self::get($id);
|
||||
if ($mateOne['skill_level']>0){
|
||||
return [
|
||||
'attr_id' => $mateOne['attr_id'],
|
||||
'type' => $mateOne['attr_add_type'],
|
||||
'val' => $mateOne['attr_number']
|
||||
];
|
||||
}else{
|
||||
return [];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user