/** * 英雄战斗力计算 * @param $player_id 玩家ID * @param $hero_attr 英雄属性 * @param $fit_level 合体等级 * @param $rune_list 符文列表 * @param $attr_per 属性百分比 * @param $skill_list 技能列表 add by chengt * @param $union_attr 公会科技 * */ public function calc_fight($player_id, $hero_attr, $fit_level, $rune_list, $attr_per, $skill_list, $union_attr = false, $remote = array(), $remote_player = array()) { $life = $hero_attr['life']; $def = $hero_attr['def']; $attack = $hero_attr['attack']; #星级属性百分比加成 $life += intval($life * ($attr_per / 10000)); $def += intval($def * ($attr_per / 10000)); $attack += intval($attack * ($attr_per / 10000)); #战斗力计算前加上潜能属性 $life += $hero_attr['potential_life']; $attack += $hero_attr['potential_attack']; $def += $hero_attr['potential_def']; #合体属性加成 $life += $hero_attr['fit_life']; $def += $hero_attr['fit_def']; $attack += $hero_attr['fit_attack']; #合体属性百分比加成 if (Com_Array::is_good_arr($hero_attr['fit_attr_per'])) { $life += intval($life * ($hero_attr['fit_attr_per']['hp_per'] / 10000)); $def += intval($def * ($hero_attr['fit_attr_per']['arm_per'] / 10000)); $attack += intval($attack * ($hero_attr['fit_attr_per']['atk_per'] / 10000)); } #技能百分比加成 $life += intval($life * ($hero_attr['skill_life'] / 100)); $def += intval($def * ($hero_attr['skill_def'] / 100)); $attack += intval($attack * ($hero_attr['skill_attack'] / 100)); #成长值百分比加成 $attr_table = $this->get_hero_attr_table($hero_attr['hero_code']); $life += intval($life * $this->calc_grow_attar($hero_attr['grow_rate'], $attr_table['grow'])); $def += intval($def * $this->calc_grow_attar($hero_attr['grow_rate'], $attr_table['grow'])); $attack += intval($attack * $this->calc_grow_attar($hero_attr['grow_rate'], $attr_table['grow'])); if ($union_attr === false) { #获取英雄公会科技属性加成 $objPlayerDetail = $this->get_data('PlayerDetail'); // if(!empty($remote_player)){ // $objPlayerDetail->set_remote($remote_player); // } $union_attr = $objPlayerDetail->get_player_detail($player_id, 'union_hero_attr'); // $objPlayerDetail->clear_remote(); // unset($objPlayerDetail); } $hero_fight = 0; #公会科技加成 if (!empty($union_attr)) { // Com_Log::write("hero_calc_fight.".$player_id,"union_attr:".var_export($union_attr,true)); $union_fight = Formula_Fpower::calc_fpower($union_attr); $hero_fight += $union_fight; // Com_Log::write("hero_calc_fight.".$player_id,"union_fight:".var_export($union_fight,true)); } if (isset($hero_attr['fit_other_attr']) && Com_Array::is_good_arr($hero_attr['fit_other_attr'])) { $hero_attr['fit_other_attr']['hp'] = $life; $hero_attr['fit_other_attr']['arm'] = $def; $hero_attr['fit_other_attr']['atk_min'] = $attack; } else { $hero_attr['fit_other_attr'] = array('hp' => $life, 'arm' => $def, 'atk_min' => $attack); } // $fit_level = $fit_level - 1 < 0 ? 0 : $fit_level - 1; // $extra_fight_ratio = 1 + ($fit_level) / 9/* + $rune_level * 0.05*/; // Com_Log::write("hero_calc_fight.".$player_id,"fit_other_attr:".var_export($hero_attr['fit_other_attr'],true)); $fit_other_fight = Formula_Fpower::calc_fpower($hero_attr['fit_other_attr']); $hero_fight += $fit_other_fight; // Com_Log::write("hero_calc_fight.".$player_id,"extra_fight_ratio:".var_export($extra_fight_ratio,true)); Com_Log::write("hero_calc_fight." . $player_id, "fit_other_fight:" . var_export($fit_other_fight, true)); // $all_fight = intval($hero_fight * $extra_fight_ratio); $all_fight = $hero_fight; $rune_list = Com_FmtData::cus_json_decode($rune_list); if (Com_Array::is_good_arr($rune_list)) { $objPlayerProp = $this->get_data('PlayerProp'); // if(!empty($remote)){ // $objPlayerProp->set_remote($remote_player); // } foreach ($rune_list as $nune_data) { if ($nune_data['state'] == 2) { $arr_prop_detail = $objPlayerProp->get_player_prop_detail($player_id, $nune_data['id']); $rune_fight = intval(Formula_SkillFpower::$hero_run[$arr_prop_detail['quality']]); $all_fight += $rune_fight; // Com_Log::write("hero_calc_fight.".$player_id,"rune_fight:".var_export($rune_fight,true)); } } // $objPlayerProp->clear_remote(); // unset($objPlayerProp); } if ($skill_list) { if (is_string($skill_list)) { $skill_list = json_decode($skill_list, true); } foreach ($skill_list as $val) { if ($val['state'] > 0) { $skill_fight = intval(Formula_SkillFpower::$hero_skill[$val['lvl']]); $all_fight += $skill_fight; // Com_Log::write("hero_calc_fight.".$player_id,"skill_fight:".var_export($skill_fight,true)); } } } return $all_fight; }
/** * 道具属性结构体 * @param $data * @return array */ public static function get_item_additions(&$data) { $attr_index = Cache_ItemKey::getInstance()->get_item_key(); $role_index = Cache_RoleKey::getInstance()->get_item_key(); // echo "sub_type:".$data['sub_type']."<br>"; $out = array(); $arr_other = array(); $fpower_calc = array(); $fpower_base_calc = array(); if ($data['type'] == 1 || $data['type'] == 6) { if (empty($data['player_prop_id'])) { // $attrData = Cache_EquipBaseAttr::getInstance()->get_equip_base_attr($data['sub_type'],$data['quality'],$data['level'],$data['star_level']); $obj = new Game_Prop(); $attrData = $obj->get_equip_attr($data); unset($obj); // Com_Log::log($attrData,'cache_prop',1); $data['base_attr'] = $attrData['base_attr']; $data['addition_attr'] = $attrData['addition_attr']; $data['base_attr'] = $attrData['base_attr']; $data['level'] = $attrData['level']; $data['intensive_level'] = $attrData['intensive_level']; $data['intensive_desc'] = $attrData['intensive_desc']; } # ---------------------------------------------------------------- # 星图加成信息 # ---------------------------------------------------------------- $star_map = array(); $we_swallow_revise_info = array(); if (!empty($data['star_map_desc'])) { if (is_string($data['star_map_desc'])) { $data['star_map_desc'] = json_decode($data['star_map_desc'], true); } $star_map = self::parse_star_map($data['star_map_desc']); } # ---------------------------------------------------------------- # 基础属性 # ---------------------------------------------------------------- if (!empty($data['base_attr'])) { if (is_string($data['base_attr'])) { $data['base_attr'] = json_decode($data['base_attr'], true); } list($key, $val) = each($data['base_attr']); //基础属性 就一个 # atk相关特殊处理,将atk与atk_max替换成atk_min,因为role_key只有atk_min if ($key == 'atk' || $key == 'atk_max') { $key = 'atk_min'; } $fpower_base_calc[$key] += $val; # ---------------------------------------------------------------- # 强化属性加成 # ---------------------------------------------------------------- if (!empty($data['intensive_desc'])) { if (is_string($data['intensive_desc'])) { $data['intensive_desc'] = json_decode($data['intensive_desc'], true); } list($i_key, $i_val) = each($data['intensive_desc']); //强化属性 if ($i_key == 'atk' || $i_key == 'atk_max') { $i_key = 'atk_min'; } if (isset($star_map['intensify'])) { $i_val += ceil($i_val * ($star_map['intensify'] / 10000)); //星图加成 } $fpower_calc[$i_key] += $i_val; } $fpower_calc[$key] += $val; $out[] = array(0 => intval($attr_index['equip_base_val']), 1 => array(0 => $role_index[$key], 1 => ceil($val), 2 => 0, 3 => $i_val)); } # ---------------------------------------------------------------- # 附加属性 # ---------------------------------------------------------------- if (!empty($data['addition_attr']) && is_array($data['addition_attr'])) { $out_additional = array(); foreach ($data['addition_attr'] as $key => $val) { # -------------------------------------------------------- # 翅膀装备吞噬属性加成 # -------------------------------------------------------- if (!empty($data['we_swallow_info']) && is_array($data['we_swallow_info']['swallow_attr'])) { if (isset($data['we_swallow_info']['swallow_attr'][$key])) { $add_val = $data['we_swallow_info']['swallow_attr'][$key]; if ($key == 'atk' || $key == 'atk_max') { $key = 'atk_min'; } $fpower_calc[$key] += $add_val; } } # -------------------------------------------------------- # 星图加成 # -------------------------------------------------------- if (isset($star_map['additional'])) { $val += $val * ($star_map['additional'] / 10000); } # atk相关特殊处理,将atk与atk_max替换成atk_min,因为role_key只有atk_min if ($key == 'atk' || $key == 'atk_max') { $key = 'atk_min'; } $fpower_base_calc[$key] += $val; if (in_array($key, Cache_AttrConfig::getInstance()->get_percent_key())) { $show_type = 1; //前端显示百分比 } else { $show_type = 0; } $out_additional[] = array(0 => $role_index[$key], 1 => ceil($val), 2 => $show_type, 3 => ceil($add_val), 'sort_priority' => self::$_sort_priority[$key]); $fpower_calc[$key] += $val; } # 排序 Com_Array::multisort($out_additional, array('sort_priority' => 'asc')); unset($out_additional['sort_priority']); $out[] = array(0 => $attr_index['equip_additional'], 1 => $out_additional); } # ---------------------------------------------------------------- # 洗练属性 # ---------------------------------------------------------------- if ($data['type'] == 1) { # 只有装备类才获取 if (empty($data['refine_attr']) || empty($data['refine_info'])) { # 为空显示默认洗练属性 if (!Com_Util::is_first_charge_item($data['prop_id'])) { list($data['refine_attr'], $data['refine_info']) = TenYear::getInstance('Game_EquipRefine')->extend_refine($data['sub_type'], $data['level']); } } if (!empty($data['refine_attr']) && is_array($data['refine_attr'])) { $out_refine = array(); $attr_perfection_sum = 0; $attr_progress_sum = 0; foreach ($data['refine_attr'] as $attr_seq => $attr_info) { # -------------------------------------------------------- # 注意,这两项的取值必须在key做转换之前,否则在key转换后可能导致取不到值 # -------------------------------------------------------- $attr_limit = $data['refine_info']['attr_info'][$attr_seq]['refine_attr_value'] + $data['refine_info']['attr_info'][$attr_seq]['attr_stint']; $attr_ratio = $data['refine_info']['attr_info'][$attr_seq]['attr_ratio']; $attr_progress = ceil($data['refine_info']['attr_info'][$attr_seq]['en_refine_attr_value'] / $data['refine_info']['attr_info'][$attr_seq]['attr_stint'] * 10000); # atk相关特殊处理,将atk与atk_max替换成atk_min,因为role_key只有atk_min if (!is_array($attr_info)) { continue; } # TODO: 为了兼容旧的洗练数据,以后要清档上功能,可以除去这行 list($key, $val) = each($attr_info); if ($key == 'atk' || $key == 'atk_max') { $key = 'atk_min'; } $fpower_base_calc[$key] += $val; $fpower_calc[$key] += $val; $out_refine[] = array(0 => $role_index[$key], 1 => ceil($val), 2 => 0, 3 => $attr_limit, 'sort_priority' => self::$_sort_priority[$key]); $attr_perfection_sum += $attr_ratio; $attr_progress_sum += $attr_progress; } # 排序 Com_Array::multisort($out_refine, array('sort_priority' => 'asc')); unset($out_refine['sort_priority']); $out[] = array(0 => $attr_index['equip_refine'], 1 => $out_refine); $out[] = array(0 => $attr_index['equip_refine_perfection'], 1 => ceil($attr_perfection_sum / 5)); $out[] = array(0 => $attr_index['equip_en_refine_progress'], 1 => ceil($attr_progress_sum / $data['refine_info']['last_refine_type'])); } } #策划要一个道具的基础属性战力 $fpower_base = Formula_Fpower::calc_fpower($fpower_base_calc); $out[] = array(0 => intval($attr_index['raw_fpower']), 1 => $fpower_base); # ---------------------------------------------------------------- # 强化等级 # ---------------------------------------------------------------- if (!empty($data['intensive_level'])) { $out[] = array(0 => $attr_index['intensive_level'], 1 => $data['intensive_level']); } # ---------------------------------------------------------------- # 最大强化等级 # ---------------------------------------------------------------- if ($data['type'] == 1) { # 只有装备类才获取 $intensify_lv_limit = TenYear::getInstance('Game_EquipIntensifier')->get_intensify_lv_limit_by_item_level($data['level']); $out[] = array(0 => $attr_index['intensify_max'], 1 => $intensify_lv_limit); } # ---------------------------------------------------------------- # 强化属性 # ---------------------------------------------------------------- if (!empty($data['intensive_desc'])) { if (is_string($data['intensive_desc'])) { $data['intensive_desc'] = json_decode($data['intensive_desc'], true); } $val = 0; list($key, $val) = each($data['intensive_desc']); //强化属性 # atk相关特殊处理,将atk与atk_max替换成atk_min,因为role_key只有atk_min if ($key == 'atk' || $key == 'atk_max') { $key = 'atk_min'; } if (isset($star_map['intensify'])) { $val += ceil($val * ($star_map['intensify'] / 10000)); //星图加成 } $fpower_calc[$key] += $val; $out[] = array(0 => $attr_index['equip_strengthen_val'], 1 => $val); } # ---------------------------------------------------------------- # 翅膀装备吞噬等级与经验 # ---------------------------------------------------------------- if ($data['type'] == 6) { # 只有翅膀装备类才获取 if (!empty($data['we_swallow_info'])) { $out[] = array(0 => $attr_index['wing_equip_swallow_lv'], 1 => $data['we_swallow_info']['swallow_lv']); $out[] = array(0 => $attr_index['wing_equip_swallow_exp'], 1 => $data['we_swallow_info']['swallow_exp']); } else { $out[] = array(0 => $attr_index['wing_equip_swallow_lv'], 1 => 0); $out[] = array(0 => $attr_index['wing_equip_swallow_exp'], 1 => 0); } } # ---------------------------------------------------------------- # 镶嵌宝石属性 # ---------------------------------------------------------------- $gem_item = array(); $gem_configs = array(); $hole_stint = TenYear::getInstance('Game_EquipInlayGems')->get_prop_inlay_gem_hole_stint($data); # 孔位上限 for ($i = 1; $i <= $hole_stint; $i++) { //镶嵌部分 if (!empty($data['inlay_gems'][$i])) { $gem_id = $data['inlay_gems'][$i]; if (!isset($gem_configs[$gem_id])) { $gem_configs[$gem_id] = Cache_Forge::getInstance()->get_inlay_gems_by_id($gem_id); } $attr = self::parse_gem_config_attr($gem_configs[$gem_id]); $out_additional = array(); $gem_fpower = 0; if (!empty($attr)) { foreach ($attr as $key => $val) { if ($key == 'atk' || $key == 'atk_max') { $key = 'atk_min'; } if (isset($star_map['gem'])) { $val += ceil($val * ($star_map['gem'] / 10000)); //星图加成 } /** if(in_array($key,Cache_AttrConfig::getInstance()->get_percent_key())){ $show_type = 1; //前端显示百分比 } else{ $show_type = 0; } **/ if (isset($role_index[$key])) { $fpower_calc[$key] += $val; $out_additional[] = array(0 => $role_index[$key], 1 => intval($val)); } } $gem_fpower += Formula_Fpower::calc_fpower($attr); } $gem_item[] = array(0 => $i, 1 => self::get_prop_struct($gem_configs[$gem_id]), 2 => $gem_fpower, 3 => $out_additional); //0 sid 1 战力 2 属性 } else { $gem_item[] = array(0 => $i, 1 => array(), 2 => 0, 3 => array()); //0 sid 1 战力 2 属性 } } $out[] = array(0 => $attr_index['gem'], 1 => $gem_item); //星图属性 if (isset($data['star_map_id']) && $data['star_map_id'] > 0) { $star_attr = array(); $star_map_config = Cache_Prop::getInstance()->get_prop_info($data['star_map_id']); $star_attr['star'] = self::get_prop_struct($star_map_config); $star_attr['power'] = 0; //战力计算 $star_attr['property'] = array(); $star_map_info = Cache_Forge::getInstance()->get_star_map_config_byid($data['star_map_id']); if ($star_map_info) { foreach ($star_map_info as $k => $v) { $a = array(); $a['addition_type'] = self::$_star_map_attr_enum[$v['data']]; #$a['addition_key'] = $v['data']; $a['addition_val'] = $v['data_value']; if (isset($attr_index[$k])) { // if(!isset($attr_index[$k])){ // Com_Log::log($k,'addition',1); // } $a['condition_type'] = 0; $a['condition_key'] = array('k' => $attr_index[$k], 'v' => $v['limit_value'], 'per' => 0); } else { if ($k == 'inlay_gems_lv') { $a['condition_type'] = 1; } elseif ($k == 'inlay_gems') { $a['condition_type'] = 2; } elseif ($k == 'activate') { $a['condition_type'] = 3; } $a['condition_key'] = array('k' => 0, 'v' => $v['limit_value'], 'per' => 0); } $star_attr['property'][] = $a; } } $out[] = array(0 => $attr_index['star'], 1 => $star_attr); } # ---------------------------------------------------------------- # 吞噬属性:需要写死传回已配置的所有吞噬属性,即便当前道具尚未有激活任意项吞噬属性,也需要用初始值填充 # ---------------------------------------------------------------- list($allow_swallow_sub_type, $allow_swallow_id) = TenYear::getInstance('Game_EquipSwallow')->get_swallow_restriction_info($data['sub_type']); $distinct_swallow_list = Cache_Forge::getInstance()->get_distinct_swallow_list(); foreach ($distinct_swallow_list as $swallow_info) { if (!empty($allow_swallow_id) && !in_array($swallow_info['swallow_id'], $allow_swallow_id)) { continue; } $swallow[$swallow_info['swallow_id']] = array('swallow_id' => $swallow_info['swallow_id'], 'swallow_lv' => 0, 'swallow_exp' => 0); } if (!empty($data['swallow_info'])) { foreach ($data['swallow_info'] as $swallow_id => $swallow_info) { $swallow[$swallow_id] = array('id' => $swallow_info['swallow_id'], 'lv' => $swallow_info['swallow_lv'], 'value' => $swallow_info['swallow_exp']); } } $out[] = array(0 => $attr_index['swallow'], 1 => $swallow); if (!empty($data['equip_view'])) { if (is_string($data['equip_view'])) { $equip_view = $data['equip_view']; } else { $equip_view = implode(':', $data['equip_view']); } if ($equip_view == '0:0:0:0' || $equip_view == '0:0:0') { $equip_view = ''; } } $out[] = array(0 => $attr_index['equip_view'], 1 => $equip_view); if (!empty($fpower_calc)) { // Com_Log::log('============[start]===========','equip_fpower',1); // Com_Log::log("prop_id:{$data['prop_id']}",'equip_fpower',1); // Com_Log::log($fpower_calc,'equip_fpower',1); $data['fpower'] = Formula_Fpower::calc_fpower($fpower_calc); // Com_Log::log("fpower:{$data['fpower']}",'equip_fpower',1); // Com_Log::log('============[end]===========','equip_fpower',1); } else { $data['fpower'] = 0; } } foreach (self::$_out_base_keys as $key) { if ($key == 'bind_type') { #特殊处理下 if (isset($attr_index[$key]) && isset($data['bind_flag'])) { $out[] = array(0 => intval($attr_index[$key]), 1 => intval($data['bind_flag'])); } } elseif ($key == 'star_level') { if ($data['star_level'] > 10) { $data['star_level'] = $data['show_star']; } $out[] = array(0 => intval($attr_index[$key]), 1 => intval($data['star_level'])); } else { if (isset($attr_index[$key]) && isset($data[$key]) && !empty($data[$key])) { $out[] = array(0 => intval($attr_index[$key]), 1 => intval($data[$key])); } } } return $out; }
/** * @Purpose: * 创建单个翅膀数据 * @Param $player_id 玩家ID * @Param $wing_id 翅膀ID */ private function create_wing($data) { $id = $data['id']; $wing['id'] = $data['id']; $wing['lvl'] = $data['level']; $wing['attr'] = $this->format_table_field($data['attr_add']); Com_Log::log("{$wing['id']} wing fight attr :" . var_export($wing['attr'], true), 'wing_fight', 1); $wing['fight'] = Formula_Fpower::calc_fpower($wing['attr']); Com_Log::log("{$wing['id']} wing fight base :{$wing['fight']}", 'wing_fight', 1); //技能分解 $skill_data = explode("|", $data['skill_id']); $wing['skill_id'] = $skill_data; #翅膀技能加上战力 if (is_array($wing['skill_id'])) { foreach ($wing['skill_id'] as $skill_id) { $max_level = Cache_Skill::getInstance()->get_skill_max_level($skill_id); $wing['fight'] += intval(Formula_SkillFpower::$wing_skill[$max_level]); } } else { $max_level = Cache_Skill::getInstance()->get_skill_max_level($wing['skill_id']); $wing['fight'] += intval(Formula_SkillFpower::$wing_skill[$max_level]); } Com_Log::log("{$wing['id']} wing fight add skill:{$wing['fight']}", 'wing_fight', 1); /* if (Com_Array::is_good_arr($skill_data)) { foreach ($skill_data as $second_layer) { $wing['skill_id'][] = explode(":", $second_layer); } } */ #$wing[$id]['attr'] = json_encode($wing[$id]['attr']); $wing['show'] = 1; $wing['activation'] = 0; $wing['synthetic'] = 1; if ($data['condition']) { list($type, $value) = explode("|", $data['condition']); if ($type == 4) { #$wing['synthetic'] = 0; $wing['activation'] = 0; $item = explode(":", $value); $wing['condition'] = array($type, $item, 0); /* $l_data = explode(":", $data['show_condition']); if ($l_data[0] != 0) { $wing['show'] = 0; } */ } else { $value = $value > 0 ? $value : 0; $wing['condition'] = array($type, array($value)); } } $wing['state'] = 0; $wing['sort'] = $data['sort']; $wing['avatar'] = $data['avatar']; $wing['name'] = strval($data['name']); $wing['repair_flag'] = $this->repair_flag; return $wing; }
/** * 获取所有等级阶段女神的战斗力 * @param $fairy_attr 精灵属性 */ public function get_fairy_all_level_fight() { $fairy_fight_list = array(); for ($i = 1; $i <= 2; $i++) { $fairy_list_table = $this->get_fairy_table_data_by_type($i); if (!empty($fairy_list_table) && Com_Array::is_good_arr($fairy_list_table)) { $shield_lvl = 0; $rune_num = 0; foreach ($fairy_list_table as $base_data) { if ($base_data['sid'] > 0) { $all_fight = 0; $fairy_shield_table = $this->get_fairy_shield_table_data($base_data['sid'], 0); if (!empty($fairy_shield_table)) { $fight['hp'] = $fairy_shield_table['hp']; $fight['atk_min'] = $fairy_shield_table['attck']; $fight['arm'] = $fairy_shield_table['def']; $all_fight += Formula_Fpower::calc_fpower($fight); } if ($base_data['shield_lvl'] > 0) { $shield_lvl = $base_data['shield_lvl']; } if ($shield_lvl > 0) { $all_fight += intval(Formula_SkillFpower::$fairy_skill[$shield_lvl]); } if ($base_data['attribute'] > 0) { $rune_num++; } if ($rune_num > 0) { $all_fight += intval(Formula_SkillFpower::$fairy_rune[$rune_num]); } $fairy_fight_list[$i][$base_data['lvl']] = $all_fight; } } } } $rtn_data = empty($fairy_fight_list) ? array() : $fairy_fight_list; return $rtn_data; }
/** * 获取每一个套装的数据格式 * @param $val * @param int $player_id * @return array */ public function get_fashion_data($val, $player_id = 0, $timeliness = 0) { $attr_val = array(); $fpower = 0; if ($val['attr_val']) { $attr = $this->parse_data($val['attr_val']); $fpower = Formula_Fpower::calc_fpower($attr); foreach ($attr as $key => $v) { $attr_val[] = array('key' => Cache_RoleKey::getInstance()->get_item_key($key), 'val' => $v); } } if ($val['material']) { $materials = $this->parse_data($val['material']); if (!empty($materials)) { list($key, $v) = each($materials); $material_id = $key; $material_num = $v; } } else { $material_id = 0; $material_num = 0; } return array('sid' => $val['sid'], 'name' => $val['name'], 'type' => $val['type'], 'icon' => $val['icon'], 'attr' => $attr_val, 'times' => $timeliness, 'avatar' => $val['equip_view'], 'sign' => $val['label'], 'signTime' => $val['label_time'], 'player_id' => $player_id, 'material_id' => $material_id, 'material_num' => $material_num, 'material_desc' => $val['material_desc'], 'career_type' => $val['career_type'], 'level' => $val['level'], 'obtain_desc' => $val['obtain_desc'], 'fpower' => $fpower); }
/** * 计算圣器模块战力 * @param $player_id */ public function calc_sq_fpower($player_id) { //$player_detail = $this->get_data('PlayerDetail')->get_player_detail($player_id, array( 'train_info')); $player_detail = is_null($this->player_detail) || !isset($this->player_detail['train_info']) ? $this->get_data('PlayerDetail')->get_player_detail($player_id, array('train_info')) : $this->player_detail; $sum_power = 0; if ($player_detail['train_info']) { foreach ($player_detail['train_info'] as $train_type => $train_info) { $train_detail_for_specified_train_type = $train_info['train_detail']; $sum_add_attr_info = array(); foreach ($train_detail_for_specified_train_type as $key => $val) { if (!empty($val['train_attr_info'])) { foreach ($val['train_attr_info'] as $attr_key => $attr_val) { $sum_add_attr_info[$attr_key] += $attr_val; } } } $sum_power += Formula_Fpower::calc_fpower($sum_add_attr_info); } } $train_set_attr_addition = $this->get_game('Train')->get_player_train_set_attr_addition($player_id); # 培养套装加成信息 if (!empty($train_set_attr_addition)) { $attr = array(); foreach ($train_set_attr_addition as $attr_key => $attr_val) { if (!is_numeric($attr_key)) { # 忽略技能等级的加成 $attr[$attr_key] += $attr_val; } } $sum_power += Formula_Fpower::calc_fpower($attr); } return ceil($sum_power); }