diff --git a/src/abilities/mod.rs b/src/abilities/mod.rs index eaa7b554..151705a7 100644 --- a/src/abilities/mod.rs +++ b/src/abilities/mod.rs @@ -1,5 +1,4 @@ -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -#[derive(Default)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)] pub enum AbilityType { GRENADE, MELEE, @@ -14,7 +13,6 @@ pub enum AbilityType { UNKNOWN, } - #[derive(Debug, Clone, Default)] pub struct AbilityDamageProfile { impact: f64, diff --git a/src/activity/damage_calc.rs b/src/activity/damage_calc.rs index 7bc92b98..8b7daf93 100644 --- a/src/activity/damage_calc.rs +++ b/src/activity/damage_calc.rs @@ -13,8 +13,7 @@ pub struct DifficultyData { const WEAPON_DELTA_EXPONENT: f64 = 0.00672; -#[derive(Debug, Clone)] -#[derive(Default)] +#[derive(Debug, Clone, Default)] pub enum DifficultyOptions { #[default] NORMAL = 1, @@ -93,14 +92,14 @@ impl From for DifficultyOptions { } } -pub(super) fn rpl_mult(_rpl: f64) -> f64 { - (1.0 + ((1.0 / 30.0) * _rpl)) / (4.0 / 3.0) +pub(super) fn rpl_mult(rpl: f64) -> f64 { + (1.0 + ((1.0 / 30.0) * rpl)) / (4.0 / 3.0) } -pub(super) fn get_gear_delta_mult(_activity: &Activity) -> f64 { - let difficulty_data: DifficultyData = _activity.difficulty.get_difficulty_data(); +pub(super) fn get_gear_delta_mult(activity: &Activity) -> f64 { + let difficulty_data: DifficultyData = activity.difficulty.get_difficulty_data(); - let epl = _activity.player.power as i32 - _activity.rpl as i32; + let epl = activity.player.power as i32 - activity.rpl as i32; if epl < -99 { return 0.0; @@ -120,16 +119,16 @@ pub(super) fn get_gear_delta_mult(_activity: &Activity) -> f64 { gear_delta_mult } -pub(super) fn get_wep_delta_mult(_activity: &Activity) -> f64 { - let difficulty_data: DifficultyData = _activity.difficulty.get_difficulty_data(); +pub(super) fn get_wep_delta_mult(activity: &Activity) -> f64 { + let difficulty_data: DifficultyData = activity.difficulty.get_difficulty_data(); - let cap = if _activity.cap < difficulty_data.cap { - _activity.cap + let cap = if activity.cap < difficulty_data.cap { + activity.cap } else { difficulty_data.cap }; - let epl = (_activity.player.wep_power as i32 - _activity.rpl as i32).clamp(-100, cap); + let epl = (activity.player.wep_power as i32 - activity.rpl as i32).clamp(-100, cap); if epl < -99 { return 0.0; @@ -150,25 +149,9 @@ pub(super) fn get_wep_delta_mult(_activity: &Activity) -> f64 { wep_delta_mult } -// add_remove_pve_bonuses( -// _rpl: f64, -// _pl: u32, -// _combatant_mult: f64, -// _difficulty: DifficultyOptions, -// _damage: f64, -// ) -> f64 { -// let rpl_mult = rpl_mult(_rpl); -// let mut tmp_activity = Activity::default(); -// tmp_activity.difficulty = _difficulty; -// tmp_activity.rpl = _rpl as u32; -// let gpl_delta = gpl_delta(tmp_activity, _pl); - -// _damage / (gpl_delta * rpl_mult * _combatant_mult) -// } - -pub fn remove_pve_bonuses(_damage: f64, _combatant_mult: f64, _activity: &Activity) -> f64 { - let rpl_mult = rpl_mult(_activity.rpl as f64); - let gpl_delta = get_gear_delta_mult(_activity); - - _damage / (gpl_delta * rpl_mult * _combatant_mult) +pub fn remove_pve_bonuses(damage: f64, combatant_mult: f64, activity: &Activity) -> f64 { + let rpl_mult = rpl_mult(activity.rpl as f64); + let gpl_delta = get_gear_delta_mult(activity); + + damage / (gpl_delta * rpl_mult * combatant_mult) } diff --git a/src/activity/mod.rs b/src/activity/mod.rs index 91a47bde..53ff0a5f 100644 --- a/src/activity/mod.rs +++ b/src/activity/mod.rs @@ -1,9 +1,8 @@ -use self::damage_calc::{get_gear_delta_mult, rpl_mult, DifficultyOptions, get_wep_delta_mult}; +use self::damage_calc::{get_gear_delta_mult, get_wep_delta_mult, rpl_mult, DifficultyOptions}; pub mod damage_calc; -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -#[derive(Default)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)] pub enum PlayerClass { #[default] Unknown = 0, @@ -12,7 +11,6 @@ pub enum PlayerClass { Warlock = 3, } - #[derive(Debug, Clone, Default)] pub struct Player { pub power: u32, @@ -46,7 +44,7 @@ impl Default for Activity { } impl Activity { pub fn get_pl_delta(&self) -> f64 { - get_gear_delta_mult(self)*get_wep_delta_mult(self) + get_gear_delta_mult(self) * get_wep_delta_mult(self) } pub fn get_rpl_mult(&self) -> f64 { rpl_mult(self.rpl as f64) diff --git a/src/d2_enums.rs b/src/d2_enums.rs index f87d7b16..23fe54e8 100644 --- a/src/d2_enums.rs +++ b/src/d2_enums.rs @@ -10,8 +10,8 @@ pub enum AmmoType { UNKNOWN = 0, } impl From for AmmoType { - fn from(_value: u32) -> AmmoType { - match _value { + fn from(value: u32) -> AmmoType { + match value { 1 => AmmoType::PRIMARY, 2 => AmmoType::SPECIAL, 3 => AmmoType::HEAVY, diff --git a/src/enemies/mod.rs b/src/enemies/mod.rs index 0b4e73ce..3bb2c1d3 100644 --- a/src/enemies/mod.rs +++ b/src/enemies/mod.rs @@ -1,7 +1,6 @@ use crate::activity::Activity; -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -#[derive(Default)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)] pub enum EnemyType { MINOR, ELITE, @@ -14,7 +13,6 @@ pub enum EnemyType { CHAMPION, } - #[derive(Debug, Clone, Default)] pub struct Enemy { pub health: f64, @@ -24,7 +22,7 @@ pub struct Enemy { pub tier: u8, } impl Enemy { - pub fn get_adjusted_health(&self, _activity: Activity) -> f64 { + pub fn get_adjusted_health(&self, _: Activity) -> f64 { self.health * (1.0 - self.damage_resistance) } } diff --git a/src/lib.rs b/src/lib.rs index d85372af..ee22148d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -33,6 +33,7 @@ use lol_alloc::{AssumeSingleThreaded, FreeListAllocator}; #[global_allocator] static ALLOCATOR: AssumeSingleThreaded = unsafe { AssumeSingleThreaded::new(FreeListAllocator::new()) }; + mod built_info { include!(concat!(env!("OUT_DIR"), "/built.rs")); } @@ -87,7 +88,7 @@ macro_rules! console_log { pub fn start() { panic::set_hook(Box::new(console_error_panic_hook::hook)); perks::map_perks(); - console_log!("D2 Calculator Loaded"); + console_log!("Oracle Engine Loaded"); } //---------------WEAPONS---------------// @@ -119,19 +120,19 @@ pub fn weapon_as_string() -> Result { #[wasm_bindgen(js_name = "setWeapon")] pub fn set_weapon( - _hash: u32, - _weapon_type_id: u8, - _intrinsic_hash: u32, - _ammo_type_id: u32, - _damage_type_id: u32, + hash: u32, + weapon_type_id: u8, + intrinsic_hash: u32, + ammo_type_id: u32, + damage_type_id: u32, ) -> Result<(), JsValue> { PERS_DATA.with(|perm_data| { let new_weapon = Weapon::generate_weapon( - _hash, - _weapon_type_id, - _intrinsic_hash, - _ammo_type_id, - _damage_type_id, + hash, + weapon_type_id, + intrinsic_hash, + ammo_type_id, + damage_type_id, ); if let Some(weapon) = new_weapon { @@ -140,7 +141,7 @@ pub fn set_weapon( logging::log( format!( "Could not find weapon data for type: {}, intrinsic: {}, Err: {:?}", - _weapon_type_id, _intrinsic_hash, new_weapon + weapon_type_id, intrinsic_hash, new_weapon ) .as_str(), LogLevel::Error.into(), @@ -166,8 +167,8 @@ pub fn get_stats() -> Result { } #[wasm_bindgen(js_name = "setStats")] -pub fn set_stats(_stats: JsValue) -> Result<(), JsValue> { - let in_stats: HashMap = serde_wasm_bindgen::from_value(_stats).unwrap(); +pub fn set_stats(stats: JsValue) -> Result<(), JsValue> { + let in_stats: HashMap = serde_wasm_bindgen::from_value(stats).unwrap(); let mut stats = HashMap::new(); for (key, value) in in_stats { stats.insert(key, Stat::from(value)); @@ -177,13 +178,13 @@ pub fn set_stats(_stats: JsValue) -> Result<(), JsValue> { } #[wasm_bindgen(js_name = "addTrait")] -pub fn add_perk(_stats: JsValue, _value: u32, _hash: u32) -> Result<(), JsValue> { - let data = perks::enhanced_check(_hash); +pub fn add_perk(stats: JsValue, value: u32, hash: u32) -> Result<(), JsValue> { + let data = perks::enhanced_check(hash); let perk = Perk { - stat_buffs: serde_wasm_bindgen::from_value(_stats).unwrap(), + stat_buffs: serde_wasm_bindgen::from_value(stats).unwrap(), enhanced: data.1, - value: _value, - raw_hash: _hash, + value, + raw_hash: hash, hash: data.0, }; PERS_DATA.with(|perm_data| perm_data.borrow_mut().weapon.add_perk(perk)); @@ -213,8 +214,8 @@ pub fn change_perk_value(perk_hash: u32, new_value: u32) { } #[wasm_bindgen(js_name = "getTraitOptions")] -pub fn get_perk_options_js(_perks: Vec) -> Result { - let options = perks::perk_options_handler::get_perk_options(_perks); +pub fn get_perk_options_js(perks: Vec) -> Result { + let options = perks::perk_options_handler::get_perk_options(perks); let value = serde_wasm_bindgen::to_value(&options); if value.is_err() { return Err(JsValue::from_str( @@ -225,48 +226,45 @@ pub fn get_perk_options_js(_perks: Vec) -> Result { } #[wasm_bindgen(js_name = "getWeaponRangeFalloff")] -pub fn get_weapon_range(_dynamic_traits: bool, _pvp: bool) -> Result { +pub fn get_weapon_range(dynamic_traits: bool, pvp: bool) -> Result { let weapon = PERS_DATA.with(|perm_data| perm_data.borrow().weapon.clone()); - if _dynamic_traits { + if dynamic_traits { Ok(weapon - .calc_range_falloff(Some(weapon.static_calc_input()), None, _pvp) + .calc_range_falloff(Some(weapon.static_calc_input()), None, pvp) .into()) } else { - Ok(weapon.calc_range_falloff(None, None, _pvp).into()) + Ok(weapon.calc_range_falloff(None, None, pvp).into()) } } #[wasm_bindgen(js_name = "getWeaponHandlingTimes")] -pub fn get_weapon_handling( - _dynamic_traits: bool, - _pvp: bool, -) -> Result { +pub fn get_weapon_handling(dynamic_traits: bool, pvp: bool) -> Result { let weapon = PERS_DATA.with(|perm_data| perm_data.borrow().weapon.clone()); - if _dynamic_traits { + if dynamic_traits { Ok(weapon - .calc_handling_times(Some(weapon.static_calc_input()), None, _pvp) + .calc_handling_times(Some(weapon.static_calc_input()), None, pvp) .into()) } else { - Ok(weapon.calc_handling_times(None, None, _pvp).into()) + Ok(weapon.calc_handling_times(None, None, pvp).into()) } } #[wasm_bindgen(js_name = "getWeaponReloadTimes")] -pub fn get_weapon_reload(_dynamic_traits: bool, _pvp: bool) -> Result { +pub fn get_weapon_reload(dynamic_traits: bool, pvp: bool) -> Result { let weapon = PERS_DATA.with(|perm_data| perm_data.borrow().weapon.clone()); - if _dynamic_traits { + if dynamic_traits { Ok(weapon - .calc_reload_time(Some(weapon.static_calc_input()), None, _pvp) + .calc_reload_time(Some(weapon.static_calc_input()), None, pvp) .into()) } else { - Ok(weapon.calc_reload_time(None, None, _pvp).into()) + Ok(weapon.calc_reload_time(None, None, pvp).into()) } } #[wasm_bindgen(js_name = "getWeaponAmmoSizes")] -pub fn get_weapon_ammo(_dynamic_traits: bool, _pvp: bool) -> Result { +pub fn get_weapon_ammo(dynamic_traits: bool, _pvp: bool) -> Result { let weapon = PERS_DATA.with(|perm_data| perm_data.borrow().weapon.clone()); - if _dynamic_traits { + if dynamic_traits { Ok(weapon .calc_ammo_sizes(Some(weapon.static_calc_input()), None, _pvp) .into()) @@ -276,9 +274,9 @@ pub fn get_weapon_ammo(_dynamic_traits: bool, _pvp: bool) -> Result Result { +pub fn get_weapon_ttk(overshield: f64) -> Result { let weapon = PERS_DATA.with(|perm_data| perm_data.borrow().weapon.clone()); - let ttk_data = weapon.calc_ttk(_overshield); + let ttk_data = weapon.calc_ttk(overshield); let js_ttk_data: Vec = ttk_data.into_iter().map(|r| r.into()).collect(); Ok(serde_wasm_bindgen::to_value(&js_ttk_data).unwrap()) } @@ -300,20 +298,20 @@ pub fn get_weapon_ttk(_overshield: f64) -> Result { #[wasm_bindgen(js_name = "getWeaponFiringData")] pub fn get_weapon_firing_data( - _dynamic_traits: bool, - _pvp: bool, + dynamic_traits: bool, + pvp: bool, _use_rpl: bool, ) -> Result { let persistent = PERS_DATA.with(|_perm_data| _perm_data.borrow().clone()); let mut response: types::rs_types::FiringResponse; - let calc_input: Option = if _dynamic_traits { + let calc_input: Option = if dynamic_traits { let mut buffer = persistent.weapon.static_calc_input(); buffer.enemy_type = &persistent.enemy.type_; Some(buffer) } else { None }; - response = persistent.weapon.calc_firing_data(calc_input, None, _pvp); + response = persistent.weapon.calc_firing_data(calc_input, None, pvp); response.apply_pve_bonuses( persistent.activity.get_rpl_mult(), persistent.activity.get_pl_delta(), @@ -328,92 +326,86 @@ pub fn get_weapon_firing_data( } #[wasm_bindgen(js_name = "getWeaponFlinch")] -pub fn get_weapon_flinch( - _dynamic_traits: bool, - _pvp: bool, - _resilience: u8, -) -> Result { +pub fn get_weapon_flinch(dynamic_traits: bool, pvp: bool, resilience: u8) -> Result { let weapon = PERS_DATA.with(|perm_data| perm_data.borrow().weapon.clone()); - if _dynamic_traits { + if dynamic_traits { Ok(weapon.calc_flinch_resist( Some(weapon.static_calc_input()), - _resilience as i32, - _pvp, + resilience as i32, + pvp, None, )) } else { - Ok(weapon.calc_flinch_resist(None, _resilience as i32, _pvp, None)) + Ok(weapon.calc_flinch_resist(None, resilience as i32, pvp, None)) } } #[wasm_bindgen(js_name = "getMiscData")] -pub fn get_misc_data(_dynamic_traits: bool, _pvp: bool) -> Result { +pub fn get_misc_data(dynamic_traits: bool, pvp: bool) -> Result { let weapon = PERS_DATA.with(|perm_data| perm_data.borrow().weapon.clone()); - if _dynamic_traits { + if dynamic_traits { Ok(serde_wasm_bindgen::to_value( - &weapon.get_misc_stats(Some(weapon.static_calc_input()), _pvp), + &weapon.get_misc_stats(Some(weapon.static_calc_input()), pvp), ) .unwrap()) } else { - Ok(serde_wasm_bindgen::to_value(&weapon.get_misc_stats(None, _pvp)).unwrap()) + Ok(serde_wasm_bindgen::to_value(&weapon.get_misc_stats(None, pvp)).unwrap()) } } #[wasm_bindgen(js_name = "setEncounter")] pub fn set_encounter( - _recommend_pl: u32, - _player_pl: u32, - _weapon_pl: u32, - _override_cap: i32, - _difficulty: JsDifficultyOptions, - _enemy_type: JsEnemyType, + recommend_pl: u32, + player_pl: u32, + weapon_pl: u32, + override_cap: i32, + difficulty: JsDifficultyOptions, + enemy_type: JsEnemyType, ) -> Result<(), JsValue> { PERS_DATA.with(|perm_data| { let activity = &mut perm_data.borrow_mut().activity; - activity.rpl = _recommend_pl; - activity.cap = _override_cap; - activity.difficulty = _difficulty.into(); - activity.player.power = _player_pl; - activity.player.wep_power = _weapon_pl; + activity.rpl = recommend_pl; + activity.cap = override_cap; + activity.difficulty = difficulty.into(); + activity.player.power = player_pl; + activity.player.wep_power = weapon_pl; }); PERS_DATA.with(|perm_data| { let enemy = &mut perm_data.borrow_mut().enemy; - enemy.type_ = _enemy_type.into(); + enemy.type_ = enemy_type.into(); }); Ok(()) } #[wasm_bindgen(js_name = "setLoggingLevel")] -pub fn set_logging_level(_level: usize) -> Result<(), JsValue> { +pub fn set_logging_level(level: usize) -> Result<(), JsValue> { PERS_DATA.with(|perm_data| { - perm_data.borrow_mut().log_level = _level.into(); + perm_data.borrow_mut().log_level = level.into(); }); Ok(()) } #[wasm_bindgen(js_name = "getModifierResponseSummary")] -pub fn get_modifier_response(_dynamic_traits: bool, _pvp: bool) -> Result { +pub fn get_modifier_response(dynamic_traits: bool, pvp: bool) -> Result { let weapon = PERS_DATA.with(|perm_data| perm_data.borrow().weapon.clone()); let modifier = weapon.get_modifier_summary( - _dynamic_traits.then_some(weapon.static_calc_input()), - _pvp, + dynamic_traits.then_some(weapon.static_calc_input()), + pvp, None, ); Ok(serde_wasm_bindgen::to_value(&modifier).unwrap()) } #[wasm_bindgen(js_name = "getScalarResponseSummary")] -pub fn get_scalar_response(_pvp: bool) -> Result { +pub fn get_scalar_response(pvp: bool) -> Result { let weapon = PERS_DATA.with(|perm_data| perm_data.borrow().weapon.clone()); let input_data = weapon.static_calc_input(); let mut cached_data = HashMap::new(); - let rmr = perks::get_range_modifier(weapon.list_perks(), &input_data, _pvp, &mut cached_data); - let rsmr = perks::get_reload_modifier(weapon.list_perks(), &input_data, _pvp, &mut cached_data); - let mmr = - perks::get_magazine_modifier(weapon.list_perks(), &input_data, _pvp, &mut cached_data); - let hmr = - perks::get_handling_modifier(weapon.list_perks(), &input_data, _pvp, &mut cached_data); - let imr = perks::get_reserve_modifier(weapon.list_perks(), &input_data, _pvp, &mut cached_data); + let rmr = perks::get_range_modifier(weapon.list_perks(), &input_data, pvp, &mut cached_data); + let rsmr = perks::get_reload_modifier(weapon.list_perks(), &input_data, pvp, &mut cached_data); + let mmr = perks::get_magazine_modifier(weapon.list_perks(), &input_data, pvp, &mut cached_data); + let hmr = perks::get_handling_modifier(weapon.list_perks(), &input_data, pvp, &mut cached_data); + let imr = perks::get_reserve_modifier(weapon.list_perks(), &input_data, pvp, &mut cached_data); Ok(JsScalarResponse { ads_range_scalar: rmr.range_zoom_scale, global_range_scalar: rmr.range_all_scale, diff --git a/src/logging.rs b/src/logging.rs index 814d9885..6eb0bc83 100644 --- a/src/logging.rs +++ b/src/logging.rs @@ -1,5 +1,4 @@ -#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] -#[derive(Default)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] pub enum LogLevel { Error, #[default] @@ -29,7 +28,6 @@ impl From for usize { } } - fn get_log_level() -> LogLevel { crate::PERS_DATA.with(|perm_data| perm_data.borrow().log_level) } diff --git a/src/perks/buff_perks.rs b/src/perks/buff_perks.rs index 33b8d960..626e5ec2 100644 --- a/src/perks/buff_perks.rs +++ b/src/perks/buff_perks.rs @@ -12,18 +12,18 @@ use super::{ ModifierResponseInput, Perks, }; -fn emp_buff(_cached_data: &mut HashMap, _desired_buff: f64) -> f64 { - let current_buff = _cached_data.get("empowering").unwrap_or(&1.0).to_owned(); - if current_buff >= _desired_buff { +fn emp_buff(cached_data: &mut HashMap, desired_buff: f64) -> f64 { + let current_buff = cached_data.get("empowering").unwrap_or(&1.0).to_owned(); + if current_buff >= desired_buff { 1.0 } else { - _cached_data.insert("empowering".to_string(), _desired_buff); - _desired_buff / current_buff + cached_data.insert("empowering".to_string(), desired_buff); + desired_buff / current_buff } } -fn surge_buff(_cached_data: &mut HashMap, _value: u32, _pvp: bool) -> f64 { - let desired_buff = match (_pvp, _value) { +fn surge_buff(cached_data: &mut HashMap, value: u32, pvp: bool) -> f64 { + let desired_buff = match (pvp, value) { (_, 0) => 1.00, (true, 1) => 1.03, (true, 2) => 1.045, @@ -35,22 +35,22 @@ fn surge_buff(_cached_data: &mut HashMap, _value: u32, _pvp: bool) (false, 4..) => 1.25, }; - let current_buff = _cached_data.get("surge").unwrap_or(&1.0).to_owned(); + let current_buff = cached_data.get("surge").unwrap_or(&1.0).to_owned(); if current_buff >= desired_buff { 1.0 } else { - _cached_data.insert("surge".to_string(), desired_buff); + cached_data.insert("surge".to_string(), desired_buff); desired_buff / current_buff } } -fn gbl_debuff(_cached_data: &mut HashMap, _desired_buff: f64) -> f64 { - let current_buff = _cached_data.get("debuff").unwrap_or(&1.0).to_owned(); - if current_buff >= _desired_buff { +fn gbl_debuff(cached_data: &mut HashMap, desired_buff: f64) -> f64 { + let current_buff = cached_data.get("debuff").unwrap_or(&1.0).to_owned(); + if current_buff >= desired_buff { 1.0 } else { - _cached_data.insert("debuff".to_string(), _desired_buff); - _desired_buff / current_buff + cached_data.insert("debuff".to_string(), desired_buff); + desired_buff / current_buff } } @@ -62,118 +62,118 @@ fn gbl_debuff(_cached_data: &mut HashMap, _desired_buff: f64) -> f6 pub fn buff_perks() { add_dmr( Perks::WellOfRadiance, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let buff = emp_buff(_input.cached_data, 1.25); + |input: ModifierResponseInput| -> DamageModifierResponse { + let buff = emp_buff(input.cached_data, 1.25); DamageModifierResponse { impact_dmg_scale: buff, explosive_dmg_scale: buff, ..Default::default() } - }), + }, ); add_dmr( Perks::NobleRounds, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value == 0 { + |input: ModifierResponseInput| -> DamageModifierResponse { + if input.value == 0 { return DamageModifierResponse::default(); } - let des_buff = if _input.pvp { 1.15 } else { 1.35 }; - let buff = emp_buff(_input.cached_data, des_buff); + let des_buff = if input.pvp { 1.15 } else { 1.35 }; + let buff = emp_buff(input.cached_data, des_buff); DamageModifierResponse { impact_dmg_scale: buff, explosive_dmg_scale: buff, ..Default::default() } - }), + }, ); add_dmr( Perks::Radiant, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let des_buff = if _input.pvp { 1.1 } else { 1.25 }; - let buff = emp_buff(_input.cached_data, des_buff); - _input.cached_data.insert("radiant".to_string(), 1.0); + |input: ModifierResponseInput| -> DamageModifierResponse { + let des_buff = if input.pvp { 1.1 } else { 1.25 }; + let buff = emp_buff(input.cached_data, des_buff); + input.cached_data.insert("radiant".to_string(), 1.0); DamageModifierResponse { impact_dmg_scale: buff, explosive_dmg_scale: buff, ..Default::default() } - }), + }, ); add_dmr( Perks::PathOfTheBurningSteps, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value == 0 || _input.calc_data.damage_type != &DamageType::SOLAR { + |input: ModifierResponseInput| -> DamageModifierResponse { + if input.value == 0 || input.calc_data.damage_type != &DamageType::SOLAR { return DamageModifierResponse::default(); } - let buff = surge_buff(_input.cached_data, _input.value, _input.pvp); + let buff = surge_buff(input.cached_data, input.value, input.pvp); DamageModifierResponse { impact_dmg_scale: buff, explosive_dmg_scale: buff, ..Default::default() } - }), + }, ); add_dmr( Perks::BannerShield, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let des_buff = if _input.pvp { 1.35 } else { 1.4 }; - let buff = emp_buff(_input.cached_data, des_buff); + |input: ModifierResponseInput| -> DamageModifierResponse { + let des_buff = if input.pvp { 1.35 } else { 1.4 }; + let buff = emp_buff(input.cached_data, des_buff); DamageModifierResponse { impact_dmg_scale: buff, explosive_dmg_scale: buff, ..Default::default() } - }), + }, ); add_dmr( Perks::EmpRift, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let des_buff = if _input.pvp { 1.15 } else { 1.2 }; - let buff = emp_buff(_input.cached_data, des_buff); + |input: ModifierResponseInput| -> DamageModifierResponse { + let des_buff = if input.pvp { 1.15 } else { 1.2 }; + let buff = emp_buff(input.cached_data, des_buff); DamageModifierResponse { impact_dmg_scale: buff, explosive_dmg_scale: buff, ..Default::default() } - }), + }, ); add_dmr( Perks::WardOfDawn, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let buff = emp_buff(_input.cached_data, 1.25); + |input: ModifierResponseInput| -> DamageModifierResponse { + let buff = emp_buff(input.cached_data, 1.25); DamageModifierResponse { impact_dmg_scale: buff, explosive_dmg_scale: buff, ..Default::default() } - }), + }, ); add_dmr( Perks::Gyrfalcon, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let des_buff = if _input.pvp { 1.0 } else { 1.35 }; - let buff = emp_buff(_input.cached_data, des_buff); + |input: ModifierResponseInput| -> DamageModifierResponse { + let des_buff = if input.pvp { 1.0 } else { 1.35 }; + let buff = emp_buff(input.cached_data, des_buff); DamageModifierResponse { impact_dmg_scale: buff, explosive_dmg_scale: buff, ..Default::default() } - }), + }, ); add_dmr( Perks::AeonInsight, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value > 0 { - let des_buff = if _input.pvp { 1.0 } else { 1.35 }; - let buff = emp_buff(_input.cached_data, des_buff); + |input: ModifierResponseInput| -> DamageModifierResponse { + if input.value > 0 { + let des_buff = if input.pvp { 1.0 } else { 1.35 }; + let buff = emp_buff(input.cached_data, des_buff); DamageModifierResponse { impact_dmg_scale: buff, explosive_dmg_scale: buff, @@ -182,31 +182,31 @@ pub fn buff_perks() { } else { DamageModifierResponse::default() } - }), + }, ); add_dmr( Perks::UmbralSharpening, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let pve_values = [1.2, 1.25, 1.35, 1.4]; - let des_buff = if _input.pvp { + let des_buff = if input.pvp { 1.0 } else { - pve_values[clamp(_input.value, 0, 3) as usize] + pve_values[clamp(input.value, 0, 3) as usize] }; - let buff = emp_buff(_input.cached_data, des_buff); + let buff = emp_buff(input.cached_data, des_buff); DamageModifierResponse { impact_dmg_scale: buff, explosive_dmg_scale: buff, ..Default::default() } - }), + }, ); add_dmr( Perks::WormByproduct, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value > 0 { + |input: ModifierResponseInput| -> DamageModifierResponse { + if input.value > 0 { DamageModifierResponse { impact_dmg_scale: 1.15, explosive_dmg_scale: 1.15, @@ -215,7 +215,7 @@ pub fn buff_perks() { } else { DamageModifierResponse::default() } - }), + }, ); // @@ -224,59 +224,59 @@ pub fn buff_perks() { add_dmr( Perks::Weaken, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let des_debuff = if _input.pvp { 1.075 } else { 1.15 }; - let debuff = gbl_debuff(_input.cached_data, des_debuff); + |input: ModifierResponseInput| -> DamageModifierResponse { + let des_debuff = if input.pvp { 1.075 } else { 1.15 }; + let debuff = gbl_debuff(input.cached_data, des_debuff); DamageModifierResponse { impact_dmg_scale: debuff, explosive_dmg_scale: debuff, ..Default::default() } - }), + }, ); add_dmr( Perks::TractorCannon, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let des_debuff = if _input.pvp { 1.5 } else { 1.3 }; - let debuff = gbl_debuff(_input.cached_data, des_debuff); + |input: ModifierResponseInput| -> DamageModifierResponse { + let des_debuff = if input.pvp { 1.5 } else { 1.3 }; + let debuff = gbl_debuff(input.cached_data, des_debuff); DamageModifierResponse { impact_dmg_scale: debuff, explosive_dmg_scale: debuff, ..Default::default() } - }), + }, ); add_dmr( Perks::MoebiusQuiver, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let des_debuff = if _input.pvp { 1.5 } else { 1.3 }; - let debuff = gbl_debuff(_input.cached_data, des_debuff); + |input: ModifierResponseInput| -> DamageModifierResponse { + let des_debuff = if input.pvp { 1.5 } else { 1.3 }; + let debuff = gbl_debuff(input.cached_data, des_debuff); DamageModifierResponse { impact_dmg_scale: debuff, explosive_dmg_scale: debuff, ..Default::default() } - }), + }, ); add_dmr( Perks::DeadFall, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let des_debuff = if _input.pvp { 1.5 } else { 1.3 }; - let debuff = gbl_debuff(_input.cached_data, des_debuff); + |input: ModifierResponseInput| -> DamageModifierResponse { + let des_debuff = if input.pvp { 1.5 } else { 1.3 }; + let debuff = gbl_debuff(input.cached_data, des_debuff); DamageModifierResponse { impact_dmg_scale: debuff, explosive_dmg_scale: debuff, ..Default::default() } - }), + }, ); add_dmr( Perks::Felwinters, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value > 0 { - let debuff = gbl_debuff(_input.cached_data, 1.3); + |input: ModifierResponseInput| -> DamageModifierResponse { + if input.value > 0 { + let debuff = gbl_debuff(input.cached_data, 1.3); DamageModifierResponse { impact_dmg_scale: debuff, explosive_dmg_scale: debuff, @@ -285,69 +285,69 @@ pub fn buff_perks() { } else { DamageModifierResponse::default() } - }), + }, ); add_dmr( Perks::EnhancedScannerAugment, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let pve_values = [1.08, 1.137, 1.173, 1.193, 1.2]; - let des_debuff = if _input.pvp { + let des_debuff = if input.pvp { 1.0 } else { - pve_values[clamp(_input.value, 0, 4) as usize] + pve_values[clamp(input.value, 0, 4) as usize] }; - let debuff = gbl_debuff(_input.cached_data, des_debuff); + let debuff = gbl_debuff(input.cached_data, des_debuff); DamageModifierResponse { impact_dmg_scale: debuff, explosive_dmg_scale: debuff, ..Default::default() } - }), + }, ); add_dmr( Perks::SurgeMod, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let damage_mod = surge_buff(_input.cached_data, _input.value, _input.pvp); + |input: ModifierResponseInput| -> DamageModifierResponse { + let damage_mod = surge_buff(input.cached_data, input.value, input.pvp); DamageModifierResponse { explosive_dmg_scale: damage_mod, impact_dmg_scale: damage_mod, ..Default::default() } - }), + }, ); add_sbr( Perks::LucentBlades, - Box::new(|_input: ModifierResponseInput| -> HashMap { - if _input.calc_data.weapon_type != &WeaponType::SWORD { + |input: ModifierResponseInput| -> HashMap { + if input.calc_data.weapon_type != &WeaponType::SWORD { return HashMap::new(); } - let stat_bump = match _input.value { + let stat_bump = match input.value { 0 => return HashMap::new(), 1 => 30, 2 => 50, 3.. => 60, }; HashMap::from([(StatHashes::CHARGE_RATE.into(), stat_bump)]) - }), + }, ); add_dmr( Perks::EternalWarrior, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let damage_mod = surge_buff(_input.cached_data, _input.value, _input.pvp); + |input: ModifierResponseInput| -> DamageModifierResponse { + let damage_mod = surge_buff(input.cached_data, input.value, input.pvp); DamageModifierResponse { explosive_dmg_scale: damage_mod, impact_dmg_scale: damage_mod, ..Default::default() } - }), + }, ); add_dmr( Perks::MantleOfBattleHarmony, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let buff = if _input.value > 0 { - surge_buff(_input.cached_data, 4, _input.pvp) + |input: ModifierResponseInput| -> DamageModifierResponse { + let buff = if input.value > 0 { + surge_buff(input.cached_data, 4, input.pvp) } else { 1.0 }; @@ -356,17 +356,17 @@ pub fn buff_perks() { explosive_dmg_scale: buff, ..Default::default() } - }), + }, ); add_dmr( Perks::MaskOfBakris, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let buff = if _input.value > 0 + |input: ModifierResponseInput| -> DamageModifierResponse { + let buff = if input.value > 0 && matches!( - _input.calc_data.damage_type, + input.calc_data.damage_type, DamageType::STASIS | DamageType::ARC ) { - surge_buff(_input.cached_data, 4, _input.pvp) + surge_buff(input.cached_data, 4, input.pvp) } else { 1.0 }; @@ -375,65 +375,65 @@ pub fn buff_perks() { explosive_dmg_scale: buff, ..Default::default() } - }), + }, ); add_dmr( Perks::SanguineAlchemy, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value == 0 || *_input.calc_data.damage_type == DamageType::KINETIC { + |input: ModifierResponseInput| -> DamageModifierResponse { + if input.value == 0 || *input.calc_data.damage_type == DamageType::KINETIC { return DamageModifierResponse::default(); } - let buff = surge_buff(_input.cached_data, 2, _input.pvp); + let buff = surge_buff(input.cached_data, 2, input.pvp); DamageModifierResponse { impact_dmg_scale: buff, explosive_dmg_scale: buff, ..Default::default() } - }), + }, ); add_dmr( Perks::Foetracers, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value == 0 { + |input: ModifierResponseInput| -> DamageModifierResponse { + if input.value == 0 { return DamageModifierResponse::default(); } - let mult = surge_buff(_input.cached_data, 4, _input.pvp); + let mult = surge_buff(input.cached_data, 4, input.pvp); DamageModifierResponse { impact_dmg_scale: mult, explosive_dmg_scale: mult, ..Default::default() } - }), + }, ); add_dmr( Perks::GlacialGuard, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value == 0 || _input.calc_data.damage_type != &DamageType::STASIS { + |input: ModifierResponseInput| -> DamageModifierResponse { + if input.value == 0 || input.calc_data.damage_type != &DamageType::STASIS { return DamageModifierResponse::default(); } - let mult = surge_buff(_input.cached_data, 4, _input.pvp); + let mult = surge_buff(input.cached_data, 4, input.pvp); DamageModifierResponse { impact_dmg_scale: mult, explosive_dmg_scale: mult, ..Default::default() } - }), + }, ); add_dmr( Perks::NoBackupPlans, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if *_input.calc_data.weapon_type != WeaponType::SHOTGUN || _input.value == 0 { + |input: ModifierResponseInput| -> DamageModifierResponse { + if *input.calc_data.weapon_type != WeaponType::SHOTGUN || input.value == 0 { return DamageModifierResponse::default(); } - let desired_buff = if _input.pvp { 1.10 } else { 1.35 }; - let buff = emp_buff(_input.cached_data, desired_buff); + let desired_buff = if input.pvp { 1.10 } else { 1.35 }; + let buff = emp_buff(input.cached_data, desired_buff); DamageModifierResponse { impact_dmg_scale: buff, explosive_dmg_scale: buff, ..Default::default() } - }), + }, ); } diff --git a/src/perks/exotic_armor.rs b/src/perks/exotic_armor.rs index a0a20bf8..014dc6ad 100644 --- a/src/perks/exotic_armor.rs +++ b/src/perks/exotic_armor.rs @@ -19,22 +19,22 @@ use super::{ pub fn exotic_armor() { add_dmr( Perks::BallindorseWrathweavers, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let mut modifier = DamageModifierResponse::default(); - let value = if _input.pvp { 1.05 } else { 1.15 }; - if _input.calc_data.damage_type == &DamageType::STASIS && _input.value >= 1 { + let value = if input.pvp { 1.05 } else { 1.15 }; + if input.calc_data.damage_type == &DamageType::STASIS && input.value >= 1 { modifier.impact_dmg_scale = value; modifier.explosive_dmg_scale = value; } modifier - }), + }, ); //doesnt work for sturm overcharge, (maybe) memento add_dmr( Perks::LuckyPants, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let perks = _input.calc_data.perk_value_map.clone(); + |input: ModifierResponseInput| -> DamageModifierResponse { + let perks = input.calc_data.perk_value_map.clone(); let perk_check = |hash: Perks| -> bool { matches!(perks.get(&hash.into()), Some(x) if x > &0) }; @@ -42,62 +42,58 @@ pub fn exotic_armor() { if perk_check(Perks::ParacausalShot) || perk_check(Perks::StormAndStress) //|| perk_check(Perks::ExplosiveShadow) //needs a way to remove only EDR? - || _input.pvp + || input.pvp { return DamageModifierResponse::default(); } - let mult = if _input.calc_data.ammo_type == &AmmoType::SPECIAL { + let mult = if input.calc_data.ammo_type == &AmmoType::SPECIAL { 0.3 } else { 0.6 }; DamageModifierResponse { - impact_dmg_scale: 1.0 + mult * _input.value.clamp(0, 10) as f64, + impact_dmg_scale: 1.0 + mult * input.value.clamp(0, 10) as f64, ..Default::default() } - }), + }, ); add_sbr( Perks::TomeOfDawn, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - let mut stats = HashMap::new(); - if _input.value > 0 { - stats.insert(StatHashes::AIRBORNE.into(), 50); - } - stats - }, - ), + |input: ModifierResponseInput| -> HashMap { + let mut stats = HashMap::new(); + if input.value > 0 { + stats.insert(StatHashes::AIRBORNE.into(), 50); + } + stats + }, ); add_flmr( Perks::TomeOfDawn, - Box::new(|_input: ModifierResponseInput| -> FlinchModifierResponse { - if _input.value > 0 { + |input: ModifierResponseInput| -> FlinchModifierResponse { + if input.value > 0 { FlinchModifierResponse { flinch_scale: 0.80 } } else { FlinchModifierResponse::default() } - }), + }, ); add_sbr( Perks::KnuckleheadRadar, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - HashMap::from([(StatHashes::AIRBORNE.into(), 20)]) - }, - ), + |_: ModifierResponseInput| -> HashMap { + HashMap::from([(StatHashes::AIRBORNE.into(), 20)]) + }, ); add_dmr( Perks::KnuckleheadRadar, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let health_percent = *_input.cached_data.get("health%").unwrap_or(&1.0); - if health_percent >= 0.3 || _input.value == 0 { + |input: ModifierResponseInput| -> DamageModifierResponse { + let health_percent = *input.cached_data.get("health%").unwrap_or(&1.0); + if health_percent >= 0.3 || input.value == 0 { return DamageModifierResponse::default(); } let modifier = 1.0 + (0.3 - health_percent); @@ -106,45 +102,41 @@ pub fn exotic_armor() { explosive_dmg_scale: modifier, crit_scale: 1.0, } - }), + }, ); //TODO: MECHANEER'S TRICKSLEEVES AUTORELOAD add_sbr( Perks::MechaneersTricksleeves, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - let mut stats = HashMap::new(); - if _input.calc_data.weapon_type == &WeaponType::SIDEARM { - stats.insert(StatHashes::AIRBORNE.into(), 50); - stats.insert(StatHashes::HANDLING.into(), 100); - stats.insert(StatHashes::RELOAD.into(), 100); - }; - stats - }, - ), + |input: ModifierResponseInput| -> HashMap { + let mut stats = HashMap::new(); + if input.calc_data.weapon_type == &WeaponType::SIDEARM { + stats.insert(StatHashes::AIRBORNE.into(), 50); + stats.insert(StatHashes::HANDLING.into(), 100); + stats.insert(StatHashes::RELOAD.into(), 100); + }; + stats + }, ); add_hmr( Perks::MechaneersTricksleeves, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.calc_data.weapon_type == &WeaponType::SIDEARM { - HandlingModifierResponse { - stat_add: 100, - ..Default::default() - } - } else { - HandlingModifierResponse::default() + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.calc_data.weapon_type == &WeaponType::SIDEARM { + HandlingModifierResponse { + stat_add: 100, + ..Default::default() } - }, - ), + } else { + HandlingModifierResponse::default() + } + }, ); add_rsmr( Perks::MechaneersTricksleeves, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - if _input.calc_data.weapon_type == &WeaponType::SIDEARM { + |input: ModifierResponseInput| -> ReloadModifierResponse { + if input.calc_data.weapon_type == &WeaponType::SIDEARM { ReloadModifierResponse { reload_stat_add: 100, ..Default::default() @@ -152,64 +144,59 @@ pub fn exotic_armor() { } else { ReloadModifierResponse::default() } - }), + }, ); add_dmr( Perks::MechaneersTricksleeves, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value == 0 || *_input.calc_data.weapon_type != WeaponType::SIDEARM { + |input: ModifierResponseInput| -> DamageModifierResponse { + if input.value == 0 || *input.calc_data.weapon_type != WeaponType::SIDEARM { return DamageModifierResponse::default(); }; - let damage_mult = if _input.pvp { 1.10 } else { 2.0 }; + let damage_mult = if input.pvp { 1.10 } else { 2.0 }; DamageModifierResponse { explosive_dmg_scale: damage_mult, impact_dmg_scale: damage_mult, ..Default::default() } - }), + }, ); add_sbr( Perks::Oathkeeper, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - let mut stats = HashMap::new(); - if _input.calc_data.weapon_type == &WeaponType::BOW { - stats.insert(StatHashes::AIRBORNE.into(), 40); - stats.insert(StatHashes::DRAW_TIME.into(), 10); - }; - stats - }, - ), + |input: ModifierResponseInput| -> HashMap { + let mut stats = HashMap::new(); + if input.calc_data.weapon_type == &WeaponType::BOW { + stats.insert(StatHashes::AIRBORNE.into(), 40); + stats.insert(StatHashes::DRAW_TIME.into(), 10); + }; + stats + }, ); /*add_fmr( - Perks::Oathkeeper, - Box::new(|_input: ModifierResponsInput| -> FiringModifierResponse { - FiringModifierResponse { - burst_delay_add: match _input.calc_data.intrinsic_hash { - 906 => -36.0 / 1100.0, - 905 => -40.0 / 1100.0, - _ => 0.0, - }, - ..Default::default() - } - }), - );*/ + Perks::Oathkeeper, + |_input: ModifierResponsInput| -> FiringModifierResponse { + FiringModifierResponse { + burst_delay_add: match _input.calc_data.intrinsic_hash { + 906 => -36.0 / 1100.0, + 905 => -40.0 / 1100.0, + _ => 0.0, + }, + ..Default::default() + } + });*/ add_sbr( Perks::SealedAhamkaraGrasps, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - let mut stats = HashMap::new(); - if _input.value > 0 { - stats.insert(StatHashes::AIRBORNE.into(), 50); - }; - stats - }, - ), + |input: ModifierResponseInput| -> HashMap { + let mut stats = HashMap::new(); + if input.value > 0 { + stats.insert(StatHashes::AIRBORNE.into(), 50); + }; + stats + }, ); //TODO: AUTORELOAD FOR SEALED AHAMKARA GRASPS @@ -217,259 +204,225 @@ pub fn exotic_armor() { //LUCKY PANTS ONLY WORKS FOR READY ?!?!?! crazy :( add_sbr( Perks::LuckyPants, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - let mut stat = HashMap::new(); - if _input.value > 0 && _input.calc_data.weapon_type == &WeaponType::HANDCANNON { - stat.insert(StatHashes::AIRBORNE.into(), 20); - stat.insert(StatHashes::HANDLING.into(), 100); - }; - stat - }, - ), + |input: ModifierResponseInput| -> HashMap { + let mut stat = HashMap::new(); + if input.value > 0 && input.calc_data.weapon_type == &WeaponType::HANDCANNON { + stat.insert(StatHashes::AIRBORNE.into(), 20); + stat.insert(StatHashes::HANDLING.into(), 100); + }; + stat + }, ); add_hmr( Perks::LuckyPants, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value > 0 && _input.calc_data.weapon_type == &WeaponType::HANDCANNON { - return HandlingModifierResponse { - draw_add: 100, - draw_scale: 0.6, - ..Default::default() - }; - } - HandlingModifierResponse::default() - }, - ), + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value > 0 && input.calc_data.weapon_type == &WeaponType::HANDCANNON { + return HandlingModifierResponse { + draw_add: 100, + draw_scale: 0.6, + ..Default::default() + }; + } + HandlingModifierResponse::default() + }, ); add_sbr( Perks::NoBackupPlans, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - let mut stats = HashMap::new(); - if _input.calc_data.weapon_type == &WeaponType::SHOTGUN { - stats.insert(StatHashes::AIRBORNE.into(), 30); - }; - stats - }, - ), + |input: ModifierResponseInput| -> HashMap { + let mut stats = HashMap::new(); + if input.calc_data.weapon_type == &WeaponType::SHOTGUN { + stats.insert(StatHashes::AIRBORNE.into(), 30); + }; + stats + }, ); add_sbr( Perks::ActiumWarRig, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - let mut stats = HashMap::new(); - if _input.calc_data.weapon_type == &WeaponType::AUTORIFLE - || _input.calc_data.weapon_type == &WeaponType::MACHINEGUN - { - stats.insert(StatHashes::AIRBORNE.into(), 30); - } - stats - }, - ), + |input: ModifierResponseInput| -> HashMap { + let mut stats = HashMap::new(); + if input.calc_data.weapon_type == &WeaponType::AUTORIFLE + || input.calc_data.weapon_type == &WeaponType::MACHINEGUN + { + stats.insert(StatHashes::AIRBORNE.into(), 30); + } + stats + }, ); //TODO: AUTORELOAD ON ACTIUM WAR RIG add_sbr( Perks::HallowfireHeart, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - HashMap::from([(StatHashes::AIRBORNE.into(), 20)]) - }, - ), + |_: ModifierResponseInput| -> HashMap { + HashMap::from([(StatHashes::AIRBORNE.into(), 20)]) + }, ); add_sbr( Perks::LionRampart, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - let mut stats = HashMap::new(); - if _input.value > 0 { - stats.insert(StatHashes::AIRBORNE.into(), 50); - }; - stats - }, - ), + |input: ModifierResponseInput| -> HashMap { + let mut stats = HashMap::new(); + if input.value > 0 { + stats.insert(StatHashes::AIRBORNE.into(), 50); + }; + stats + }, ); add_sbr( Perks::Peacekeepers, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - let mut stats = HashMap::new(); - if _input.calc_data.weapon_type == &WeaponType::SUBMACHINEGUN { - stats.insert(StatHashes::AIRBORNE.into(), 40); - stats.insert(StatHashes::HANDLING.into(), 50); - }; - stats - }, - ), + |input: ModifierResponseInput| -> HashMap { + let mut stats = HashMap::new(); + if input.calc_data.weapon_type == &WeaponType::SUBMACHINEGUN { + stats.insert(StatHashes::AIRBORNE.into(), 40); + stats.insert(StatHashes::HANDLING.into(), 50); + }; + stats + }, ); add_hmr( Perks::Peacekeepers, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.calc_data.weapon_type == &WeaponType::SUBMACHINEGUN { - return HandlingModifierResponse { - stat_add: 50, - ads_scale: 1.0, - draw_scale: 0.8, - stow_scale: 0.8, - ..Default::default() - }; - } - HandlingModifierResponse::default() - }, - ), + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.calc_data.weapon_type == &WeaponType::SUBMACHINEGUN { + return HandlingModifierResponse { + stat_add: 50, + ads_scale: 1.0, + draw_scale: 0.8, + stow_scale: 0.8, + ..Default::default() + }; + } + HandlingModifierResponse::default() + }, ); add_sbr( Perks::PeregrineGreaves, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - HashMap::from([(StatHashes::AIRBORNE.into(), 20)]) - }, - ), + |_: ModifierResponseInput| -> HashMap { + HashMap::from([(StatHashes::AIRBORNE.into(), 20)]) + }, ); add_sbr( Perks::EyeOfAnotherWorld, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - HashMap::from([(StatHashes::AIRBORNE.into(), 15)]) - }, - ), + |_: ModifierResponseInput| -> HashMap { + HashMap::from([(StatHashes::AIRBORNE.into(), 15)]) + }, ); add_sbr( Perks::AstrocyteVerse, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - let mut stats = HashMap::new(); - stats.insert(StatHashes::AIRBORNE.into(), 30); - if _input.value > 0 { - stats.insert(StatHashes::HANDLING.into(), 100); - } - stats - }, - ), + |input: ModifierResponseInput| -> HashMap { + let mut stats = HashMap::new(); + stats.insert(StatHashes::AIRBORNE.into(), 30); + if input.value > 0 { + stats.insert(StatHashes::HANDLING.into(), 100); + } + stats + }, ); add_hmr( Perks::AstrocyteVerse, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value == 0 { - return HandlingModifierResponse::default(); - } - HandlingModifierResponse { - draw_add: 100, - ..Default::default() - } - }, - ), + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value == 0 { + return HandlingModifierResponse::default(); + } + HandlingModifierResponse { + draw_add: 100, + ..Default::default() + } + }, ); add_sbr( Perks::NecroticGrips, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - let mut stats = HashMap::new(); - if _input.calc_data.intrinsic_hash == 1863355414 - || _input.calc_data.intrinsic_hash == 2965975126 - || _input.calc_data.intrinsic_hash == 2724693746 - { - //Thorn, Osteo Striga, Touch of Malice - stats.insert(StatHashes::AIRBORNE.into(), 30); - }; - stats - }, - ), + |input: ModifierResponseInput| -> HashMap { + let mut stats = HashMap::new(); + if input.calc_data.intrinsic_hash == 1863355414 + || input.calc_data.intrinsic_hash == 2965975126 + || input.calc_data.intrinsic_hash == 2724693746 + { + //Thorn, Osteo Striga, Touch of Malice + stats.insert(StatHashes::AIRBORNE.into(), 30); + }; + stats + }, ); add_sbr( Perks::BootsOfTheAssembler, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - let mut stats = HashMap::new(); - if _input.calc_data.intrinsic_hash == 2144092201 { - //Lumina - stats.insert(StatHashes::AIRBORNE.into(), 30); - }; - stats - }, - ), + |input: ModifierResponseInput| -> HashMap { + let mut stats = HashMap::new(); + if input.calc_data.intrinsic_hash == 2144092201 { + //Lumina + stats.insert(StatHashes::AIRBORNE.into(), 30); + }; + stats + }, ); add_sbr( Perks::RainOfFire, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - let mut stats = HashMap::new(); - if _input.calc_data.weapon_type == &WeaponType::FUSIONRIFLE - || _input.calc_data.weapon_type == &WeaponType::LINEARFUSIONRIFLE - { - stats.insert(StatHashes::AIRBORNE.into(), 30); - } - stats - }, - ), + |input: ModifierResponseInput| -> HashMap { + let mut stats = HashMap::new(); + if input.calc_data.weapon_type == &WeaponType::FUSIONRIFLE + || input.calc_data.weapon_type == &WeaponType::LINEARFUSIONRIFLE + { + stats.insert(StatHashes::AIRBORNE.into(), 30); + } + stats + }, ); add_sbr( Perks::SpeedloaderSlacks, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - let modifiers = match _input.value { - 0 => (0, 0, 0), - 1 => (40, 40, 30), - 2 => (40, 40, 35), - 3 => (45, 45, 40), - 4 => (50, 50, 45), - 5 => (55, 55, 50), - _ => (55, 55, 50), - }; + |input: ModifierResponseInput| -> HashMap { + let modifiers = match input.value { + 0 => (0, 0, 0), + 1 => (40, 40, 30), + 2 => (40, 40, 35), + 3 => (45, 45, 40), + 4 => (50, 50, 45), + 5 => (55, 55, 50), + _ => (55, 55, 50), + }; - HashMap::from([ - (StatHashes::RELOAD.into(), modifiers.0), - (StatHashes::HANDLING.into(), modifiers.1), //? - (StatHashes::AIRBORNE.into(), modifiers.2), - ]) - }, - ), + HashMap::from([ + (StatHashes::RELOAD.into(), modifiers.0), + (StatHashes::HANDLING.into(), modifiers.1), //? + (StatHashes::AIRBORNE.into(), modifiers.2), + ]) + }, ); add_hmr( Perks::SpeedloaderSlacks, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let handling = match _input.value { - 0 => 0, - 1 => 40, - 2 => 40, - 3 => 45, - 4 => 50, - 5 => 55, - _ => 55, - }; - HandlingModifierResponse { - stat_add: handling, - ..Default::default() - } - }, - ), + |input: ModifierResponseInput| -> HandlingModifierResponse { + let handling = match input.value { + 0 => 0, + 1 => 40, + 2 => 40, + 3 => 45, + 4 => 50, + 5 => 55, + _ => 55, + }; + HandlingModifierResponse { + stat_add: handling, + ..Default::default() + } + }, ); add_rsmr( Perks::SpeedloaderSlacks, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - let modifiers = match _input.value { + |input: ModifierResponseInput| -> ReloadModifierResponse { + let modifiers = match input.value { 0 => (0, 1.0), 1 => (40, 1.0), 2 => (40, 0.925), @@ -483,26 +436,24 @@ pub fn exotic_armor() { reload_stat_add: modifiers.0, reload_time_scale: modifiers.1, } - }), + }, ); add_sbr( Perks::LunaFaction, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - let mut stat = HashMap::new(); - if _input.value >= 1 { - stat.insert(StatHashes::RELOAD.into(), 100); - } - stat - }, - ), + |input: ModifierResponseInput| -> HashMap { + let mut stat = HashMap::new(); + if input.value >= 1 { + stat.insert(StatHashes::RELOAD.into(), 100); + } + stat + }, ); add_rsmr( Perks::LunaFaction, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - if _input.value >= 1 { + |input: ModifierResponseInput| -> ReloadModifierResponse { + if input.value >= 1 { ReloadModifierResponse { reload_stat_add: 100, reload_time_scale: 0.9, @@ -510,29 +461,103 @@ pub fn exotic_armor() { } else { ReloadModifierResponse::default() } - }), + }, ); add_rmr( Perks::LunaFaction, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { - if _input.value >= 2 { + |input: ModifierResponseInput| -> RangeModifierResponse { + if input.value >= 2 { return RangeModifierResponse { range_all_scale: 2.0, ..Default::default() }; } RangeModifierResponse::default() - }), + }, ); + add_sbr( Perks::TritonVice, - Box::new(|_input| -> HashMap { + |input| -> HashMap { let mut stats = HashMap::new(); - if _input.value > 0 && *_input.calc_data.weapon_type == WeaponType::GLAIVE { + if input.value > 0 && *input.calc_data.weapon_type == WeaponType::GLAIVE { stats.insert(StatHashes::RELOAD.into(), 50); } stats - }), - ) + }, + ); + + add_hmr( + Perks::OphidianAspect, + |_: ModifierResponseInput| -> HandlingModifierResponse { + HandlingModifierResponse { + stat_add: 35, + ..Default::default() + } + }, + ); + + add_rsmr( + Perks::OphidianAspect, + |_: ModifierResponseInput| -> ReloadModifierResponse { + ReloadModifierResponse { + reload_stat_add: 35, + reload_time_scale: 1.0, + } + }, + ); + + add_sbr( + Perks::OphidianAspect, + |_: ModifierResponseInput| -> HashMap { + let mut stats = HashMap::new(); + stats.insert(StatHashes::HANDLING.into(), 35); + stats.insert(StatHashes::RELOAD.into(), 35); + stats.insert(StatHashes::AIRBORNE.into(), 10); + stats + }, + ); + + add_sbr( + Perks::DragonShadow, + |input: ModifierResponseInput| -> HashMap { + let mut stats = HashMap::new(); + if input.value >= 1 { + stats.insert(StatHashes::HANDLING.into(), 100); + stats.insert(StatHashes::RELOAD.into(), 100); + } + stats + }, + ); + + add_hmr( + Perks::DragonShadow, + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value >= 1 { + HandlingModifierResponse { + stat_add: 100, + draw_scale: 0.7, + stow_scale: 0.7, + ..Default::default() + } + } else { + HandlingModifierResponse::default() + } + }, + ); + + add_rsmr( + Perks::DragonShadow, + |input: ModifierResponseInput| -> ReloadModifierResponse { + if input.value >= 1 { + ReloadModifierResponse { + reload_stat_add: 100, + reload_time_scale: 1.0, + } + } else { + ReloadModifierResponse::default() + } + }, + ); } diff --git a/src/perks/exotic_perks.rs b/src/perks/exotic_perks.rs index d5c90c1b..287dbeb8 100644 --- a/src/perks/exotic_perks.rs +++ b/src/perks/exotic_perks.rs @@ -19,22 +19,22 @@ use super::{ pub fn exotic_perks() { add_dmr( Perks::ParacausalShot, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let bufflist_pve = vec![1.0, 3.92, 4.0, 4.4, 5.25, 7.67, 11.71, 18.36]; let bufflist_pvp = vec![1.0, 1.01, 1.03, 1.13, 1.41, 1.96, 3.0, 4.73]; let mut damage_buff = 1.0; - if _input.calc_data.curr_mag == 1.0 { - let num_of_crits = clamp(_input.calc_data.shots_fired_this_mag as i32, 0, 7); - let bufflist = if _input.pvp { + if input.calc_data.curr_mag == 1.0 { + let num_of_crits = clamp(input.calc_data.shots_fired_this_mag as i32, 0, 7); + let bufflist = if input.pvp { &bufflist_pvp } else { &bufflist_pve }; damage_buff = bufflist[num_of_crits as usize]; }; - if _input.calc_data.time_this_mag < 0.0 { - let num_of_crits = clamp(_input.value as i32, 0, 7); - let bufflist = if _input.pvp { + if input.calc_data.time_this_mag < 0.0 { + let num_of_crits = clamp(input.value as i32, 0, 7); + let bufflist = if input.pvp { &bufflist_pvp } else { &bufflist_pve @@ -46,106 +46,88 @@ pub fn exotic_perks() { explosive_dmg_scale: damage_buff, crit_scale: 1.0, } - }), + }, ); add_sbr( Perks::HuntersTrance, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut out = HashMap::new(); - let inter_val = *_input - .calc_data - .perk_value_map - .get(&213689231) - .unwrap_or(&0); + let inter_val = *input.calc_data.perk_value_map.get(&213689231).unwrap_or(&0); let buff_val = (clamp(inter_val, 0, 7) * 5) as i32; out.insert(StatHashes::RELOAD.into(), buff_val); out.insert(StatHashes::RANGE.into(), buff_val); out.insert(StatHashes::HANDLING.into(), buff_val); out - }), + }, ); add_rsmr( Perks::HuntersTrance, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - let inter_val = *_input - .calc_data - .perk_value_map - .get(&213689231) - .unwrap_or(&0); + |input: ModifierResponseInput| -> ReloadModifierResponse { + let inter_val = *input.calc_data.perk_value_map.get(&213689231).unwrap_or(&0); let buff_val = (clamp(inter_val, 0, 7) * 5) as i32; ReloadModifierResponse { reload_stat_add: buff_val, ..Default::default() } - }), + }, ); add_rmr( Perks::HuntersTrance, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { - let inter_val = *_input - .calc_data - .perk_value_map - .get(&213689231) - .unwrap_or(&0); + |input: ModifierResponseInput| -> RangeModifierResponse { + let inter_val = *input.calc_data.perk_value_map.get(&213689231).unwrap_or(&0); let buff_val = (clamp(inter_val, 0, 7) * 5) as i32; RangeModifierResponse { range_stat_add: buff_val, ..Default::default() } - }), + }, ); add_hmr( Perks::HuntersTrance, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let inter_val = *_input - .calc_data - .perk_value_map - .get(&213689231) - .unwrap_or(&0); - let buff_val = (clamp(inter_val, 0, 7) * 5) as i32; - HandlingModifierResponse { - stat_add: buff_val, - ..Default::default() - } - }, - ), + |input: ModifierResponseInput| -> HandlingModifierResponse { + let inter_val = *input.calc_data.perk_value_map.get(&213689231).unwrap_or(&0); + let buff_val = (clamp(inter_val, 0, 7) * 5) as i32; + HandlingModifierResponse { + stat_add: buff_val, + ..Default::default() + } + }, ); add_rmr( Perks::HuntersTrace, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { - let range_ads_scale = if _input.value > 0 { 4.5 / 1.7 } else { 1.0 }; + |input: ModifierResponseInput| -> RangeModifierResponse { + let range_ads_scale = if input.value > 0 { 4.5 / 1.7 } else { 1.0 }; RangeModifierResponse { range_zoom_scale: range_ads_scale, ..Default::default() } - }), + }, ); add_dmr( Perks::MementoMori, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let mut damage_buff = 1.0; - if _input.value > 0 && _input.calc_data.total_shots_fired < 7.0 { - damage_buff = if _input.pvp { 1.285 } else { 1.5 }; + if input.value > 0 && input.calc_data.total_shots_fired < 7.0 { + damage_buff = if input.pvp { 1.285 } else { 1.5 }; }; DamageModifierResponse { impact_dmg_scale: damage_buff, explosive_dmg_scale: damage_buff, crit_scale: 1.0, } - }), + }, ); add_rmr( Perks::MementoMori, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { - let range_all_scale = if _input.value > 0 && _input.calc_data.total_shots_fired < 7.0 { + |input: ModifierResponseInput| -> RangeModifierResponse { + let range_all_scale = if input.value > 0 && input.calc_data.total_shots_fired < 7.0 { 0.85 } else { 1.0 @@ -154,26 +136,26 @@ pub fn exotic_perks() { range_all_scale, ..Default::default() } - }), + }, ); add_sbr( Perks::Roadborn, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut out = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { out.insert(StatHashes::HANDLING.into(), 20); out.insert(StatHashes::RELOAD.into(), 40); }; out - }), + }, ); add_dmr( Perks::Roadborn, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let mut crit_mult = 1.0; - if _input.value > 0 { + if input.value > 0 { crit_mult = 1.17; }; DamageModifierResponse { @@ -181,14 +163,14 @@ pub fn exotic_perks() { explosive_dmg_scale: 1.0, impact_dmg_scale: 1.0, } - }), + }, ); add_fmr( Perks::Roadborn, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { + |input: ModifierResponseInput| -> FiringModifierResponse { let mut delay_mult = 1.0; - if _input.value > 0 { + if input.value > 0 { delay_mult = 0.583; }; FiringModifierResponse { @@ -197,14 +179,14 @@ pub fn exotic_perks() { inner_burst_scale: 1.0, burst_size_add: 0.0, } - }), + }, ); add_rmr( Perks::Roadborn, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { + |input: ModifierResponseInput| -> RangeModifierResponse { let mut range_scale = 1.05; - if _input.value > 0 { + if input.value > 0 { range_scale = 1.15; //roughly }; RangeModifierResponse { @@ -213,31 +195,31 @@ pub fn exotic_perks() { range_hip_scale: 1.0, range_zoom_scale: 1.0, } - }), + }, ); add_rsmr( Perks::Roadborn, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { + |input: ModifierResponseInput| -> ReloadModifierResponse { let mut reload = 0; - if _input.value > 0 { + if input.value > 0 { reload = 40; }; ReloadModifierResponse { reload_stat_add: reload, reload_time_scale: 1.0, } - }), + }, ); add_fmr( Perks::ReignHavoc, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { + |input: ModifierResponseInput| -> FiringModifierResponse { let mut delay_mult = 1.0; - if _input.calc_data.shots_fired_this_mag >= _input.calc_data.base_mag * 0.2 { + if input.calc_data.shots_fired_this_mag >= input.calc_data.base_mag * 0.2 { delay_mult = 0.75; }; - if _input.calc_data.shots_fired_this_mag >= _input.calc_data.base_mag * 0.4 { + if input.calc_data.shots_fired_this_mag >= input.calc_data.base_mag * 0.4 { delay_mult = 0.625; }; FiringModifierResponse { @@ -246,13 +228,13 @@ pub fn exotic_perks() { inner_burst_scale: 1.0, burst_size_add: 0.0, } - }), + }, ); add_edr( Perks::ReignHavoc, - Box::new(|_input: ModifierResponseInput| -> ExtraDamageResponse { - let dmg = if _input.pvp { 65.0 } else { 65.0 * 1.3 }; + |input: ModifierResponseInput| -> ExtraDamageResponse { + let dmg = if input.pvp { 65.0 } else { 65.0 * 1.3 }; ExtraDamageResponse { additive_damage: dmg, increment_total_time: false, @@ -264,26 +246,26 @@ pub fn exotic_perks() { crit_scale: false, combatant_scale: true, } - }), + }, ); add_dmr( Perks::WormsHunger, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let val = clamp(_input.value, 0, 20); + |input: ModifierResponseInput| -> DamageModifierResponse { + let val = clamp(input.value, 0, 20); DamageModifierResponse { impact_dmg_scale: 1.0 + (val as f64) * 0.1, explosive_dmg_scale: 1.0 + (val as f64) * 0.1, crit_scale: 1.0, } - }), + }, ); add_dmr( Perks::LagragianSight, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let mut damage_buff = 1.0; - if _input.value > 0 && _input.calc_data.time_total < 30.0 { + if input.value > 0 && input.calc_data.time_total < 30.0 { damage_buff = 1.4; }; DamageModifierResponse { @@ -291,29 +273,29 @@ pub fn exotic_perks() { explosive_dmg_scale: damage_buff, crit_scale: 1.0, } - }), + }, ); add_dmr( Perks::ToM, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let mut damage_buff = 1.0; - if _input.calc_data.curr_mag == 1.0 { - damage_buff = if _input.pvp { 2.0 } else { 2.4 }; + if input.calc_data.curr_mag == 1.0 { + damage_buff = if input.pvp { 2.0 } else { 2.4 }; }; DamageModifierResponse { impact_dmg_scale: damage_buff, explosive_dmg_scale: damage_buff, crit_scale: 1.0, } - }), + }, ); add_rr( Perks::ToM, - Box::new(|_input: ModifierResponseInput| -> RefundResponse { + |input: ModifierResponseInput| -> RefundResponse { RefundResponse { - refund_mag: if _input.calc_data.curr_mag == 0.0 { + refund_mag: if input.calc_data.curr_mag == 0.0 { 1 } else { 0 @@ -322,13 +304,13 @@ pub fn exotic_perks() { crit: false, requirement: 1, } - }), + }, ); add_edr( Perks::RocketTracers, - Box::new(|_input: ModifierResponseInput| -> ExtraDamageResponse { - let dmg = if _input.pvp { 24.0 } else { 105.0 }; + |input: ModifierResponseInput| -> ExtraDamageResponse { + let dmg = if input.pvp { 24.0 } else { 105.0 }; ExtraDamageResponse { additive_damage: dmg, times_to_hit: 1, @@ -340,118 +322,68 @@ pub fn exotic_perks() { crit_scale: false, combatant_scale: true, } - }), - ); - - // add_edr_guidance_ring( - // _input: &CalculationInput, - // _input.value: u32, - // is_enhanced: bool, - // _pvp: bool, - // _cached_data: &mut HashMap, - // ) -> ExtraDamageResponse { - // ExtraDamageResponse { - // additive_damage: if _input.value > 0 { - // _input.calc_data.base_damage * _input.calc_data.base_crit_mult - // } else { - // 0.0 - // }, - // times_to_hit: 2, - // increment_total_time: false, - // time_for_additive_damage: 0.1, - // hit_at_same_time: true, - // is_dot: false, - // weapon_scale: true, - // crit_scale: false, - // combatant_scale: true, - // } - // } - - // add_edr_poison_arrows( - // _input: &CalculationInput, - // _input.value: u32, - // is_enhanced: bool, - // _pvp: bool, - // _cached_data: &mut HashMap, - // ) -> ExtraDamageResponse { - // let last_proc = _cached_data.get("poison_arrows").unwrap_or(&0.0); - // let time_diff = _input.calc_data.time_total - last_proc; - // return ExtraDamageResponse { - // additive_damage: if _input.value > 0 { - // _input.calc_data.base_damage * _input.calc_data.base_crit_mult - // } else { - // 0.0 - // }, - // times_to_hit: (time_diff / 0.5).ceil() as i32, - // increment_total_time: false, - // time_for_additive_damage: 0.5, - // hit_at_same_time: false, - // is_dot: true, - // weapon_scale: true, - // crit_scale: false, - // combatant_scale: true, - // }; - // } + }, + ); add_fmr( Perks::HakkeHeavyBurst, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { + |_: ModifierResponseInput| -> FiringModifierResponse { FiringModifierResponse { burst_size_add: -2.0, ..Default::default() } - }), + }, ); add_dmr( Perks::HakkeHeavyBurst, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let crit_scale = (1.5 + 5.0 / 51.0) / _input.calc_data.base_crit_mult; + |input: ModifierResponseInput| -> DamageModifierResponse { + let crit_scale = (1.5 + 5.0 / 51.0) / input.calc_data.base_crit_mult; DamageModifierResponse { explosive_dmg_scale: 1.48, impact_dmg_scale: 1.48, crit_scale, } - }), + }, ); add_dmr( Perks::SwoopingTalons, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let mut dmg_mult = 1.0; - if _input.value > 0 { + if input.value > 0 { dmg_mult = 1.4; } - dmg_mult += _input.calc_data.total_shots_fired * 0.04; + dmg_mult += input.calc_data.total_shots_fired * 0.04; dmg_mult = clamp(dmg_mult, 1.0, 1.4); DamageModifierResponse { impact_dmg_scale: dmg_mult, explosive_dmg_scale: dmg_mult, crit_scale: 1.0, } - }), + }, ); add_dmr( Perks::IgnitionTrigger, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let mut dmg_mult = 1.0; - if _input.value > 0 || _input.calc_data.total_shots_fired > 20.0 { - dmg_mult = if _input.pvp { 1.55 } else { 1.99 }; + if input.value > 0 || input.calc_data.total_shots_fired > 20.0 { + dmg_mult = if input.pvp { 1.55 } else { 1.99 }; } DamageModifierResponse { impact_dmg_scale: dmg_mult, explosive_dmg_scale: dmg_mult, crit_scale: 1.0, } - }), + }, ); add_dmr( Perks::CalculatedBalance, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let mut damage_mult = if _input.value > 0 { 0.2 } else { 0.0 }; + |input: ModifierResponseInput| -> DamageModifierResponse { + let mut damage_mult = if input.value > 0 { 0.2 } else { 0.0 }; let duration = 5.0; - if _input.calc_data.time_total > duration { + if input.calc_data.time_total > duration { damage_mult = 0.0; }; DamageModifierResponse { @@ -459,13 +391,13 @@ pub fn exotic_perks() { explosive_dmg_scale: 1.0 + damage_mult, crit_scale: 1.0, } - }), + }, ); add_fmr( Perks::RavenousBeast, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { - if _input.value > 0 { + |input: ModifierResponseInput| -> FiringModifierResponse { + if input.value > 0 { FiringModifierResponse { burst_delay_scale: 0.8, ..Default::default() @@ -473,17 +405,17 @@ pub fn exotic_perks() { } else { FiringModifierResponse::default() } - }), + }, ); add_dmr( Perks::RavenousBeast, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let mut damage_mult = 1.0; let mut crit_mult = 1.0; - if _input.value > 0 { - damage_mult = if _input.pvp { 2.2 } else { 2.87 }; - crit_mult = if _input.pvp { + if input.value > 0 { + damage_mult = if input.pvp { 2.2 } else { 2.87 }; + crit_mult = if input.pvp { 1.0 / (1.5 + -3.0 / 51.0) } else { 1.99 / 2.87 @@ -494,30 +426,30 @@ pub fn exotic_perks() { explosive_dmg_scale: damage_mult, crit_scale: crit_mult, } - }), + }, ); add_sbr( Perks::ReleaseTheWolves, - Box::new(|_input: ModifierResponseInput| -> HashMap { - let has_cat = _input.calc_data.perk_value_map.contains_key(&431220296); + |input: ModifierResponseInput| -> HashMap { + let has_cat = input.calc_data.perk_value_map.contains_key(&431220296); let mut out = HashMap::new(); if has_cat { - if _input.value == 0 { + if input.value == 0 { out.insert(StatHashes::STABILITY.into(), 40); - } else if _input.value == 1 { + } else if input.value == 1 { out.insert(StatHashes::RELOAD.into(), 100); } } out - }), + }, ); add_rsmr( Perks::ReleaseTheWolves, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - let has_cat = _input.calc_data.perk_value_map.contains_key(&431220296); - if _input.value == 1 && has_cat { + |input: ModifierResponseInput| -> ReloadModifierResponse { + let has_cat = input.calc_data.perk_value_map.contains_key(&431220296); + if input.value == 1 && has_cat { ReloadModifierResponse { reload_stat_add: 100, reload_time_scale: 0.85, @@ -525,13 +457,13 @@ pub fn exotic_perks() { } else { ReloadModifierResponse::default() } - }), + }, ); add_fmr( Perks::ReleaseTheWolves, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { - if _input.value > 0 { + |input: ModifierResponseInput| -> FiringModifierResponse { + if input.value > 0 { FiringModifierResponse { burst_delay_scale: 0.4, ..Default::default() @@ -539,98 +471,96 @@ pub fn exotic_perks() { } else { FiringModifierResponse::default() } - }), + }, ); add_dmr( Perks::ReleaseTheWolves, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let damage_mult = if _input.value > 0 { 1.4 } else { 1.0 }; + |input: ModifierResponseInput| -> DamageModifierResponse { + let damage_mult = if input.value > 0 { 1.4 } else { 1.0 }; DamageModifierResponse { impact_dmg_scale: damage_mult, explosive_dmg_scale: damage_mult, crit_scale: 1.0, } - }), + }, ); add_sbr( Perks::Fundamentals, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); - if _input.value == 1 { + if input.value == 1 { stats.insert(StatHashes::STABILITY.into(), 20); stats.insert(StatHashes::AIM_ASSIST.into(), 10); - } else if _input.value == 2 { + } else if input.value == 2 { stats.insert(StatHashes::AIRBORNE.into(), 20); stats.insert(StatHashes::RELOAD.into(), 35); - } else if _input.value == 3 { + } else if input.value == 3 { stats.insert(StatHashes::RANGE.into(), 5); stats.insert(StatHashes::HANDLING.into(), 25); }; stats - }), + }, ); add_hmr( Perks::Fundamentals, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let mut handling = 0; - if _input.value == 3 { - handling = 25; - } - HandlingModifierResponse { - stat_add: handling, - ..Default::default() - } - }, - ), + |input: ModifierResponseInput| -> HandlingModifierResponse { + let mut handling = 0; + if input.value == 3 { + handling = 25; + } + HandlingModifierResponse { + stat_add: handling, + ..Default::default() + } + }, ); add_rsmr( Perks::Fundamentals, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { + |input: ModifierResponseInput| -> ReloadModifierResponse { let mut reload = 0; - if _input.value == 2 { + if input.value == 2 { reload = 35; } ReloadModifierResponse { reload_stat_add: reload, ..Default::default() } - }), + }, ); add_rmr( Perks::Fundamentals, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { + |input: ModifierResponseInput| -> RangeModifierResponse { let mut range = 0; - if _input.value == 3 { + if input.value == 3 { range = 5; } RangeModifierResponse { range_stat_add: range, ..Default::default() } - }), + }, ); add_sbr( Perks::ThinTheHerd, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut out = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { out.insert(StatHashes::RELOAD.into(), 70); } out - }), + }, ); add_rsmr( Perks::ThinTheHerd, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - if _input.value > 0 { + |input: ModifierResponseInput| -> ReloadModifierResponse { + if input.value > 0 { ReloadModifierResponse { reload_stat_add: 70, ..Default::default() @@ -638,43 +568,41 @@ pub fn exotic_perks() { } else { ReloadModifierResponse::default() } - }), + }, ); add_hmr( Perks::Chimera, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value > 0 { - HandlingModifierResponse { - stat_add: 100, - ..Default::default() - } - } else { - HandlingModifierResponse::default() + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value > 0 { + HandlingModifierResponse { + stat_add: 100, + ..Default::default() } - }, - ), + } else { + HandlingModifierResponse::default() + } + }, ); add_sbr( Perks::Chimera, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut out = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { out.insert(StatHashes::RELOAD.into(), 100); } out - }), + }, ); add_dmr( Perks::FirstGlance, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let mut damage_mult = 1.0; let mut crit_mult = 1.0; - if _input.value > 0 { - if _input.calc_data.total_shots_fired == 0.0 { + if input.value > 0 { + if input.calc_data.total_shots_fired == 0.0 { damage_mult = 1.33; } else { crit_mult = 1.33; @@ -685,16 +613,16 @@ pub fn exotic_perks() { impact_dmg_scale: damage_mult, crit_scale: crit_mult, } - }), + }, ); add_dmr( Perks::FateOfAllFools, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let mut damage_mult = 1.0; let mut crit_mult = 1.0; - if _input.value as f64 > _input.calc_data.total_shots_fired { - let cc = _input.calc_data.base_crit_mult; + if input.value as f64 > input.calc_data.total_shots_fired { + let cc = input.calc_data.base_crit_mult; damage_mult = cc; crit_mult = 1.0 / cc; }; @@ -703,38 +631,38 @@ pub fn exotic_perks() { impact_dmg_scale: damage_mult, crit_scale: crit_mult, } - }), + }, ); add_dmr( Perks::HonedEdge, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let mut damage_mult = 1.0; - let has_cat = _input.calc_data.perk_value_map.contains_key(&529188544); - if _input.value == 2 { - damage_mult = if _input.pvp { 1.183 } else { 2.0 }; - } else if _input.value == 3 { - damage_mult = if _input.pvp { 1.412 } else { 3.0 }; - } else if _input.value == 4 && has_cat { - damage_mult = if _input.pvp { 1.504 * 1.2 } else { 4.0 * 1.2 }; - } else if _input.value == 4 { - damage_mult = if _input.pvp { 1.504 } else { 4.0 }; + let has_cat = input.calc_data.perk_value_map.contains_key(&529188544); + if input.value == 2 { + damage_mult = if input.pvp { 1.183 } else { 2.0 }; + } else if input.value == 3 { + damage_mult = if input.pvp { 1.412 } else { 3.0 }; + } else if input.value == 4 && has_cat { + damage_mult = if input.pvp { 1.504 * 1.2 } else { 4.0 * 1.2 }; + } else if input.value == 4 { + damage_mult = if input.pvp { 1.504 } else { 4.0 }; }; DamageModifierResponse { explosive_dmg_scale: damage_mult, impact_dmg_scale: damage_mult, crit_scale: 1.0, } - }), + }, ); add_dmr( Perks::TakenPredator, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let mut damage_mult = 1.0; - if _input.value == 1 || _input.value == 2 { + if input.value == 1 || input.value == 2 { damage_mult = 1.25; - } else if _input.value == 3 { + } else if input.value == 3 { damage_mult = 1.25 * 1.25; }; DamageModifierResponse { @@ -742,32 +670,32 @@ pub fn exotic_perks() { impact_dmg_scale: damage_mult, crit_scale: 1.0, } - }), + }, ); add_dmr( Perks::MarkovChain, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let val = clamp(_input.value, 0, 5); - let damage_mult = (1.0 / 15.0) * val as f64 * if _input.pvp { 1.0 } else { 2.0 }; + |input: ModifierResponseInput| -> DamageModifierResponse { + let val = clamp(input.value, 0, 5); + let damage_mult = (1.0 / 15.0) * val as f64 * if input.pvp { 1.0 } else { 2.0 }; DamageModifierResponse { explosive_dmg_scale: 1.0 + damage_mult, impact_dmg_scale: 1.0 + damage_mult, crit_scale: 1.0, } - }), + }, ); add_dmr( Perks::StringofCurses, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let val = clamp(_input.value, 0, 5); + |input: ModifierResponseInput| -> DamageModifierResponse { + let val = clamp(input.value, 0, 5); let mut damage_mult = 0.2 * val as f64; - if _input.pvp { + if input.pvp { damage_mult = ((damage_mult * 100.0 / 2.0) / 4.0).ceil() * 0.04; } let duration = 3.5; - if _input.calc_data.time_total > duration { + if input.calc_data.time_total > duration { damage_mult = 0.0; }; DamageModifierResponse { @@ -775,154 +703,152 @@ pub fn exotic_perks() { explosive_dmg_scale: 1.0 + damage_mult, crit_scale: 1.0, } - }), + }, ); add_dmr( Perks::StormAndStress, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value == 0 { + |input: ModifierResponseInput| -> DamageModifierResponse { + if input.value == 0 { return DamageModifierResponse::default(); } - let damage_mult = if _input.pvp { 1.8 } else { 3.62 }; + let damage_mult = if input.pvp { 1.8 } else { 3.62 }; DamageModifierResponse { explosive_dmg_scale: damage_mult, impact_dmg_scale: damage_mult, ..Default::default() } - }), + }, ); add_rmr( Perks::DualSpeedReceiver, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { - if _input.value == 0 { + |input: ModifierResponseInput| -> RangeModifierResponse { + if input.value == 0 { return RangeModifierResponse::default(); } RangeModifierResponse { range_stat_add: 30, ..Default::default() } - }), + }, ); add_sbr( Perks::DualSpeedReceiver, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut out = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { out.insert(StatHashes::ZOOM.into(), 3); out.insert(StatHashes::RANGE.into(), 30); } out - }), + }, ); add_dmr( Perks::FullStop, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { DamageModifierResponse { explosive_dmg_scale: 1.0, impact_dmg_scale: 1.0, - crit_scale: if !_input.pvp { 2.9 } else { 1.0 }, + crit_scale: if !input.pvp { 2.9 } else { 1.0 }, } - }), + }, ); add_fmr( Perks::RatPack, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { - if _input.value == 0 { + |input: ModifierResponseInput| -> FiringModifierResponse { + if input.value == 0 { return FiringModifierResponse::default(); } - let val = clamp(_input.value - 1, 0, 4); + let val = clamp(input.value - 1, 0, 4); FiringModifierResponse { burst_delay_add: val as f64 * (-0.625 / 30.0), ..Default::default() } - }), + }, ); add_mmr( Perks::RatPack, - Box::new( - |_input: ModifierResponseInput| -> MagazineModifierResponse { - let val = clamp(_input.value - 1, 0, 4); - MagazineModifierResponse { - magazine_add: val as f64 * if val == 4 { 2.25 } else { 2.0 }, - ..Default::default() - } - }, - ), + |input: ModifierResponseInput| -> MagazineModifierResponse { + let val = clamp(input.value - 1, 0, 4); + MagazineModifierResponse { + magazine_add: val as f64 * if val == 4 { 2.25 } else { 2.0 }, + ..Default::default() + } + }, ); add_fmr( Perks::RideTheBull, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { - let extra_value = _input.calc_data.shots_fired_this_mag / 10.0; - let val = clamp(_input.value + extra_value as u32, 0, 2); + |input: ModifierResponseInput| -> FiringModifierResponse { + let extra_value = input.calc_data.shots_fired_this_mag / 10.0; + let val = clamp(input.value + extra_value as u32, 0, 2); FiringModifierResponse { burst_delay_add: val as f64 * (-0.25 / 30.0), ..Default::default() } - }), + }, ); add_fmr( Perks::SpinningUp, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { - let extra_value = _input.calc_data.shots_fired_this_mag / 12.0; - let val = clamp(_input.value + extra_value as u32, 0, 2); + |input: ModifierResponseInput| -> FiringModifierResponse { + let extra_value = input.calc_data.shots_fired_this_mag / 12.0; + let val = clamp(input.value + extra_value as u32, 0, 2); FiringModifierResponse { burst_delay_add: val as f64 * (-0.5 / 30.0), ..Default::default() } - }), + }, ); add_sbr( Perks::CranialSpike, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut out = HashMap::new(); - let val = clamp(_input.value, 0, 5) as i32; + let val = clamp(input.value, 0, 5) as i32; out.insert(StatHashes::RANGE.into(), 8 * val); out.insert(StatHashes::AIM_ASSIST.into(), 4 * val); out - }), + }, ); add_rsmr( Perks::CranialSpike, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - let val = clamp(_input.value, 0, 5) as i32; + |input: ModifierResponseInput| -> ReloadModifierResponse { + let val = clamp(input.value, 0, 5) as i32; let rel = 0.97_f64.powi(val); ReloadModifierResponse { reload_time_scale: rel, ..Default::default() } - }), + }, ); add_rmr( Perks::CranialSpike, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { - let val = clamp(_input.value, 0, 5) as i32; + |input: ModifierResponseInput| -> RangeModifierResponse { + let val = clamp(input.value, 0, 5) as i32; RangeModifierResponse { range_stat_add: 8 * val, ..Default::default() } - }), + }, ); add_fmr( Perks::DarkForgedTrigger, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { - if _input.value == 0 { + |input: ModifierResponseInput| -> FiringModifierResponse { + if input.value == 0 { return FiringModifierResponse::default(); } - if _input + if input .calc_data .perk_value_map .get(&1319823571) @@ -939,13 +865,13 @@ pub fn exotic_perks() { ..Default::default() } } - }), + }, ); add_dmr( Perks::HarmonicLaser, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let buff = match (_input.value, _input.pvp) { + |input: ModifierResponseInput| -> DamageModifierResponse { + let buff = match (input.value, input.pvp) { (0, _) => 1.0, (1, true) => 1.03, (1, false) => 1.323, @@ -956,75 +882,73 @@ pub fn exotic_perks() { impact_dmg_scale: buff, ..Default::default() } - }), + }, ); add_dmr( Perks::AgersScepterCatalyst, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value > 0 { + |input: ModifierResponseInput| -> DamageModifierResponse { + if input.value > 0 { return DamageModifierResponse { impact_dmg_scale: 1.8, ..Default::default() }; } DamageModifierResponse::default() - }), + }, ); add_mmr( Perks::AgersScepterCatalyst, - Box::new( - |_input: ModifierResponseInput| -> MagazineModifierResponse { - let mag_buff = if _input.value > 0 && _input.calc_data.total_shots_fired == 0.0 { - 2.0 - } else { - 1.0 - }; - MagazineModifierResponse { - magazine_scale: mag_buff, - ..Default::default() - } - }, - ), + |input: ModifierResponseInput| -> MagazineModifierResponse { + let mag_buff = if input.value > 0 && input.calc_data.total_shots_fired == 0.0 { + 2.0 + } else { + 1.0 + }; + MagazineModifierResponse { + magazine_scale: mag_buff, + ..Default::default() + } + }, ); add_dmr( Perks::ColdFusion, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let buff = 0.0195 * clamp(_input.calc_data.total_shots_hit, 0.0, 41.0); + |input: ModifierResponseInput| -> DamageModifierResponse { + let buff = 0.0195 * clamp(input.calc_data.total_shots_hit, 0.0, 41.0); DamageModifierResponse { impact_dmg_scale: 1.0 + buff, ..Default::default() } - }), + }, ); //Queenbreaker's sights add_dmr( Perks::MarksmanSights, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |_: ModifierResponseInput| -> DamageModifierResponse { DamageModifierResponse { impact_dmg_scale: 1.38, ..Default::default() } - }), + }, ); add_fmr( Perks::MarksmanSights, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { + |_: ModifierResponseInput| -> FiringModifierResponse { FiringModifierResponse { burst_delay_add: (1800.0 / (60000.0 / 333.0)), // 300 + 333 = 633 , ..Default::default() } - }), + }, ); add_dmr( Perks::Broadside, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let buff = match _input.value { + |input: ModifierResponseInput| -> DamageModifierResponse { + let buff = match input.value { 0 => 1.0, 1 => 1.18, 2 => 1.39, @@ -1035,32 +959,32 @@ pub fn exotic_perks() { impact_dmg_scale: buff, ..Default::default() } - }), + }, ); add_fmr( Perks::TemporalUnlimiter, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { - if _input.value > 0 { + |input: ModifierResponseInput| -> FiringModifierResponse { + if input.value > 0 { return FiringModifierResponse { burst_delay_add: 0.366, ..Default::default() }; } FiringModifierResponse::default() - }), + }, ); add_dmr( Perks::TemporalUnlimiter, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value == 0 { + |input: ModifierResponseInput| -> DamageModifierResponse { + if input.value == 0 { return DamageModifierResponse::default(); } - let mut buff = if _input.pvp { 7.545 } else { 14.0 }; + let mut buff = if input.pvp { 7.545 } else { 14.0 }; //season 23 //https://www.bungie.net/7/en/News/Article/season-23-weapons-preview - if *_input.calc_data.enemy_type == EnemyType::CHAMPION { + if *input.calc_data.enemy_type == EnemyType::CHAMPION { buff *= 2.0; } DamageModifierResponse { @@ -1068,25 +992,23 @@ pub fn exotic_perks() { crit_scale: 1.875, ..Default::default() } - }), + }, ); add_mmr( Perks::FourthHorsemanCatalyst, - Box::new( - |_input: ModifierResponseInput| -> MagazineModifierResponse { - MagazineModifierResponse { - magazine_add: 1.0, - ..Default::default() - } - }, - ), + |_: ModifierResponseInput| -> MagazineModifierResponse { + MagazineModifierResponse { + magazine_add: 1.0, + ..Default::default() + } + }, ); add_dmr( Perks::BlackHole, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let buff = if _input.calc_data.total_shots_hit % 2.0 == 1.0 { + |input: ModifierResponseInput| -> DamageModifierResponse { + let buff = if input.calc_data.total_shots_hit % 2.0 == 1.0 { 1.35 } else { 1.0 @@ -1095,38 +1017,38 @@ pub fn exotic_perks() { impact_dmg_scale: buff, ..Default::default() } - }), + }, ); add_dmr( Perks::Impetus, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value > 0 { + |input: ModifierResponseInput| -> DamageModifierResponse { + if input.value > 0 { return DamageModifierResponse { impact_dmg_scale: 1.5, ..Default::default() }; } DamageModifierResponse::default() - }), + }, ); add_fmr( Perks::MarksmanSights, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { + |_: ModifierResponseInput| -> FiringModifierResponse { FiringModifierResponse { burst_delay_add: 0.333, // 300 + 333 = 633 , ..Default::default() } - }), + }, ); add_dmr( Perks::Broadhead, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let broadhead_damage = if _input.pvp { 30.0 } else { 60.0 }; - let impact_damage = _input.calc_data.curr_firing_data.damage; - let crit_mult = _input.calc_data.curr_firing_data.crit_mult; + |input: ModifierResponseInput| -> DamageModifierResponse { + let broadhead_damage = if input.pvp { 30.0 } else { 60.0 }; + let impact_damage = input.calc_data.curr_firing_data.damage; + let crit_mult = input.calc_data.curr_firing_data.crit_mult; let impact_dmg_scale = (broadhead_damage + impact_damage) / impact_damage; @@ -1138,65 +1060,65 @@ pub fn exotic_perks() { crit_scale, ..Default::default() } - }), + }, ); add_fmr( Perks::Desperation, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { + |input: ModifierResponseInput| -> FiringModifierResponse { let duration = 7.0; - if _input.value == 0 || _input.calc_data.time_total > duration { + if input.value == 0 || input.calc_data.time_total > duration { return FiringModifierResponse::default(); } FiringModifierResponse { burst_delay_scale: 0.8, ..Default::default() } - }), + }, ); add_dmr( Perks::IonicReturn, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value == 0 { + |input: ModifierResponseInput| -> DamageModifierResponse { + if input.value == 0 { return DamageModifierResponse::default(); } - let current_crit = _input.calc_data.curr_firing_data.crit_mult; + let current_crit = input.calc_data.curr_firing_data.crit_mult; let crit_scale = (current_crit + (34.0 / 51.0)) / current_crit; DamageModifierResponse { impact_dmg_scale: 1.15, crit_scale, ..Default::default() } - }), + }, ); add_dmr( Perks::Unrepentant, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value == 0 || _input.pvp { + |input: ModifierResponseInput| -> DamageModifierResponse { + if input.value == 0 || input.pvp { return DamageModifierResponse::default(); } DamageModifierResponse { impact_dmg_scale: 3.0, ..Default::default() } - }), + }, ); add_fmr( Perks::Unrepentant, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { + |input: ModifierResponseInput| -> FiringModifierResponse { let shots_in_super_burst: f64 = 6.0; - if _input.calc_data.total_shots_hit >= shots_in_super_burst || _input.value == 0 { + if input.calc_data.total_shots_hit >= shots_in_super_burst || input.value == 0 { return FiringModifierResponse::default(); } FiringModifierResponse { burst_size_add: 3.0, ..Default::default() } - }), + }, ); add_dmr( Perks::ArcConductor, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value == 0 { + |input: ModifierResponseInput| -> DamageModifierResponse { + if input.value == 0 { return DamageModifierResponse::default(); } DamageModifierResponse { @@ -1204,36 +1126,34 @@ pub fn exotic_perks() { explosive_dmg_scale: 1.1, ..Default::default() } - }), + }, ); add_hmr( Perks::ArcConductor, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value == 0 { - return HandlingModifierResponse::default(); - } - HandlingModifierResponse { - stat_add: 100, - ..Default::default() - } - }, - ), + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value == 0 { + return HandlingModifierResponse::default(); + } + HandlingModifierResponse { + stat_add: 100, + ..Default::default() + } + }, ); add_sbr( Perks::ArcConductor, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); - if _input.value == 1 { + if input.value == 1 { stats.insert(StatHashes::HANDLING.into(), 100); } stats - }), + }, ); add_dmr( Perks::VoidLeech, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value == 0 || _input.pvp { + |input: ModifierResponseInput| -> DamageModifierResponse { + if input.value == 0 || input.pvp { return DamageModifierResponse::default(); } DamageModifierResponse { @@ -1241,6 +1161,6 @@ pub fn exotic_perks() { explosive_dmg_scale: 1.2, ..Default::default() } - }), - ) + }, + ); } diff --git a/src/perks/lib.rs b/src/perks/lib.rs index ba98a68e..1d788a36 100644 --- a/src/perks/lib.rs +++ b/src/perks/lib.rs @@ -17,6 +17,7 @@ pub struct CalculationInput<'a> { pub total_shots_hit: f64, pub base_mag: f64, pub curr_mag: f64, + pub base_damage: f64, pub reserves_left: f64, pub time_total: f64, pub time_this_mag: f64, @@ -34,94 +35,96 @@ impl<'a> CalculationInput<'a> { //stuff like mag size can use this, not reload, damage, etc. #[allow(clippy::too_many_arguments)] pub fn construct_pve_sparse( - _intrinsic_hash: u32, - _firing_data: &'a FiringData, - _stats: &'a HashMap, - _perk_value_map: &'a HashMap, - _weapon_type: &'a WeaponType, - _ammo_type: &'a AmmoType, - _damage_type: &'a DamageType, - _base_damage: f64, - _base_crit_mult: f64, - _base_mag_size: i32, - _total_shots_hit: i32, - _total_time: f64, + intrinsic_hash: u32, + firing_data: &'a FiringData, + stats: &'a HashMap, + perk_value_map: &'a HashMap, + weapon_type: &'a WeaponType, + ammo_type: &'a AmmoType, + damage_type: &'a DamageType, + base_damage: f64, + base_crit_mult: f64, + base_mag_size: i32, + total_shots_hit: i32, + total_time: f64, ) -> Self { Self { - intrinsic_hash: _intrinsic_hash, - curr_firing_data: _firing_data, - base_crit_mult: _base_crit_mult, + intrinsic_hash, + curr_firing_data: firing_data, + base_crit_mult, shots_fired_this_mag: 0.0, - total_shots_fired: _total_shots_hit as f64, - total_shots_hit: _total_shots_hit as f64, - base_mag: _base_mag_size as f64, - curr_mag: _base_mag_size as f64, + total_shots_fired: total_shots_hit as f64, + total_shots_hit: total_shots_hit as f64, + base_mag: base_mag_size as f64, + curr_mag: base_mag_size as f64, reserves_left: 100.0, - time_total: _total_time, + time_total: total_time, time_this_mag: -1.0, - stats: _stats, - weapon_type: _weapon_type, - damage_type: _damage_type, - ammo_type: _ammo_type, + stats, + weapon_type, + damage_type, + ammo_type, handling_data: HandlingResponse::default(), num_reloads: 0.0, enemy_type: &EnemyType::BOSS, - perk_value_map: _perk_value_map, + perk_value_map, has_overshield: false, + base_damage } } #[allow(clippy::too_many_arguments)] pub fn construct_pvp( - _intrinsic_hash: u32, - _firing_data: &'a FiringData, - _stats: &'a HashMap, - _perk_value_map: &'a HashMap, - _weapon_type: &'a WeaponType, - _ammo_type: &'a AmmoType, - _base_damage: f64, - _base_crit_mult: f64, - _mag_size: f64, - _has_overshield: bool, - _handling_data: HandlingResponse, + intrinsic_hash: u32, + firing_data: &'a FiringData, + stats: &'a HashMap, + perk_value_map: &'a HashMap, + weapon_type: &'a WeaponType, + ammo_type: &'a AmmoType, + base_damage: f64, + base_crit_mult: f64, + mag_size: f64, + has_overshield: bool, + handling_data: HandlingResponse, ) -> Self { Self { - intrinsic_hash: _intrinsic_hash, - curr_firing_data: _firing_data, - base_crit_mult: _base_crit_mult, + intrinsic_hash, + curr_firing_data: firing_data, + base_crit_mult, shots_fired_this_mag: 0.0, total_shots_fired: 0.0, total_shots_hit: 0.0, - base_mag: _mag_size, - curr_mag: _mag_size, + base_mag: mag_size, + curr_mag: mag_size, reserves_left: 999.0, time_total: 0.0, time_this_mag: 0.0, - stats: _stats, - weapon_type: _weapon_type, + stats, + weapon_type, damage_type: &DamageType::STASIS, - ammo_type: _ammo_type, - handling_data: _handling_data, + ammo_type, + handling_data, num_reloads: 0.0, enemy_type: &EnemyType::PLAYER, - perk_value_map: _perk_value_map, - has_overshield: _has_overshield, + perk_value_map, + has_overshield, + base_damage } } #[allow(clippy::too_many_arguments)] pub fn construct_static( - _intrinsic_hash: u32, - _firing_data: &'a FiringData, - _stats: &'a HashMap, - _perk_value_map: &'a HashMap, - _weapon_type: &'a WeaponType, - _ammo_type: &'a AmmoType, - _damage_type: &'a DamageType, - _crit_mult: f64, + intrinsic_hash: u32, + firing_data: &'a FiringData, + stats: &'a HashMap, + perk_value_map: &'a HashMap, + weapon_type: &'a WeaponType, + ammo_type: &'a AmmoType, + damage_type: &'a DamageType, + crit_mult: f64, ) -> Self { Self { - intrinsic_hash: _intrinsic_hash, - curr_firing_data: _firing_data, - base_crit_mult: _crit_mult, + intrinsic_hash, + curr_firing_data: firing_data, + base_crit_mult: crit_mult, shots_fired_this_mag: 0.0, total_shots_fired: 0.0, total_shots_hit: 0.0, @@ -130,15 +133,16 @@ impl<'a> CalculationInput<'a> { reserves_left: 100.0, time_total: 0.0, time_this_mag: 0.0, - stats: _stats, - weapon_type: _weapon_type, - damage_type: _damage_type, - ammo_type: _ammo_type, + stats, + weapon_type, + damage_type, + ammo_type, handling_data: HandlingResponse::default(), num_reloads: 0.0, enemy_type: &EnemyType::ENCLAVE, - perk_value_map: _perk_value_map, + perk_value_map, has_overshield: false, + base_damage: firing_data.pve_damage } } } diff --git a/src/perks/meta_perks.rs b/src/perks/meta_perks.rs index 616e8286..df86fb0b 100644 --- a/src/perks/meta_perks.rs +++ b/src/perks/meta_perks.rs @@ -21,40 +21,40 @@ use super::{ pub fn meta_perks() { add_dmr( Perks::BuiltIn, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let mut crit_scale = 1.0; let mut dmg_scale = 1.0; - if *_input.calc_data.weapon_type == WeaponType::LINEARFUSIONRIFLE && !_input.pvp { + if *input.calc_data.weapon_type == WeaponType::LINEARFUSIONRIFLE && !input.pvp { crit_scale *= 1.15; }; - if *_input.calc_data.damage_type == DamageType::KINETIC && !_input.pvp { - if _input.calc_data.ammo_type == &AmmoType::PRIMARY { + if *input.calc_data.damage_type == DamageType::KINETIC && !input.pvp { + if input.calc_data.ammo_type == &AmmoType::PRIMARY { dmg_scale *= 1.1; - } else if _input.calc_data.ammo_type == &AmmoType::SPECIAL { + } else if input.calc_data.ammo_type == &AmmoType::SPECIAL { dmg_scale *= 1.15; }; }; - if *_input.calc_data.ammo_type == AmmoType::PRIMARY - && _input.calc_data.intrinsic_hash > 1000 - && *_input.calc_data.enemy_type == EnemyType::MINOR - && !_input.pvp + if *input.calc_data.ammo_type == AmmoType::PRIMARY + && input.calc_data.intrinsic_hash > 1000 + && *input.calc_data.enemy_type == EnemyType::MINOR + && !input.pvp { dmg_scale *= 1.4; } - if *_input.calc_data.weapon_type == WeaponType::LINEARFUSIONRIFLE - && _input.calc_data.intrinsic_hash < 1000 + if *input.calc_data.weapon_type == WeaponType::LINEARFUSIONRIFLE + && input.calc_data.intrinsic_hash < 1000 { - let charge_time = _input + let charge_time = input .calc_data .stats .get(&StatHashes::CHARGE_TIME.into()) .unwrap(); //source: https://docs.google.com/spreadsheets/d/1QaUwtOW2_RJCTK1uaIGkbCoEXDa8UStvjDQSHSDxLOM/edit#gid=497378026 //damage value updated from harm and stardust during super DR testing - let total_damage = _input.calc_data.curr_firing_data.damage - * _input.calc_data.curr_firing_data.burst_size as f64; + let total_damage = input.calc_data.curr_firing_data.damage + * input.calc_data.curr_firing_data.burst_size as f64; let stat = (charge_time.perk_val() - charge_time.base_value) as f64; dmg_scale *= 1.0 - (0.6 * stat) / total_damage; } @@ -63,41 +63,41 @@ pub fn meta_perks() { impact_dmg_scale: dmg_scale, explosive_dmg_scale: dmg_scale, } - }), + }, ); add_fmr( Perks::BuiltIn, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { + |input: ModifierResponseInput| -> FiringModifierResponse { #[allow(unused_mut)] let mut delay_add = 0.0; if matches!( - _input.calc_data.weapon_type, + input.calc_data.weapon_type, WeaponType::FUSIONRIFLE | WeaponType::LINEARFUSIONRIFLE - ) && _input.calc_data.intrinsic_hash < 1000 + ) && input.calc_data.intrinsic_hash < 1000 { - let charge_time = _input + let charge_time = input .calc_data .stats .get(&StatHashes::CHARGE_TIME.into()) .unwrap(); let stat = (charge_time.perk_val() - charge_time.base_value) as f64; - delay_add -= match _input.calc_data.weapon_type { + delay_add -= match input.calc_data.weapon_type { WeaponType::FUSIONRIFLE => stat * 0.0040, WeaponType::LINEARFUSIONRIFLE => stat * 0.0033, _ => 0.0, } } - if _input.calc_data.weapon_type == &WeaponType::BOW { - let draw_time = _input + if input.calc_data.weapon_type == &WeaponType::BOW { + let draw_time = input .calc_data .stats .get(&StatHashes::DRAW_TIME.into()) .unwrap() .clone(); - delay_add += match _input.calc_data.intrinsic_hash { + delay_add += match input.calc_data.intrinsic_hash { //Lightweights, Wishender, Ticcus, Verglas 905 | 1470121888 | 3239299468 | 2636679416 => { (draw_time.perk_val() as f64 * -4.0 + 900.0) / 1100.0 @@ -115,121 +115,113 @@ pub fn meta_perks() { burst_delay_add: delay_add, ..Default::default() } - }), + }, ); add_epr( Perks::BuiltIn, - Box::new( - |_input: ModifierResponseInput| -> ExplosivePercentResponse { - if *_input.calc_data.weapon_type == WeaponType::GRENADELAUNCHER { - let blast_radius_struct = - _input.calc_data.stats.get(&StatHashes::BLAST_RADIUS.into()); + |input: ModifierResponseInput| -> ExplosivePercentResponse { + if *input.calc_data.weapon_type == WeaponType::GRENADELAUNCHER { + let blast_radius_struct = + input.calc_data.stats.get(&StatHashes::BLAST_RADIUS.into()); - let blast_radius = blast_radius_struct.cloned().unwrap_or_default().perk_val(); + let blast_radius = blast_radius_struct.cloned().unwrap_or_default().perk_val(); - if _input.calc_data.ammo_type == &AmmoType::SPECIAL { - return ExplosivePercentResponse { - percent: 0.5 + 0.003 * blast_radius as f64, - delyed: 0.0, - retain_base_total: true, - }; - } else if _input.calc_data.ammo_type == &AmmoType::HEAVY { - return ExplosivePercentResponse { - percent: 0.7 + 0.00175 * blast_radius as f64, - delyed: 0.0, - retain_base_total: true, - }; + if input.calc_data.ammo_type == &AmmoType::SPECIAL { + return ExplosivePercentResponse { + percent: 0.5 + 0.003 * blast_radius as f64, + delyed: 0.0, + retain_base_total: true, }; - } - if *_input.calc_data.weapon_type == WeaponType::ROCKET - && _input.calc_data.intrinsic_hash < 1000 - //ensures not exotic - { + } else if input.calc_data.ammo_type == &AmmoType::HEAVY { return ExplosivePercentResponse { - percent: 0.778, + percent: 0.7 + 0.00175 * blast_radius as f64, delyed: 0.0, retain_base_total: true, }; - } - ExplosivePercentResponse { - percent: 0.0, + }; + } + if *input.calc_data.weapon_type == WeaponType::ROCKET + && input.calc_data.intrinsic_hash < 1000 + //ensures not exotic + { + return ExplosivePercentResponse { + percent: 0.778, delyed: 0.0, retain_base_total: true, - } - }, - ), + }; + } + ExplosivePercentResponse { + percent: 0.0, + delyed: 0.0, + retain_base_total: true, + } + }, ); add_hmr( Perks::DexterityMod, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let swap_scale = if _input.value > 0 { - 0.85 - clamp(_input.value, 1, 3) as f64 * 0.05 - } else { - 1.0 - }; - HandlingModifierResponse { - stow_scale: swap_scale, - draw_scale: swap_scale, - ..Default::default() - } - }, - ), + |input: ModifierResponseInput| -> HandlingModifierResponse { + let swap_scale = if input.value > 0 { + 0.85 - clamp(input.value, 1, 3) as f64 * 0.05 + } else { + 1.0 + }; + HandlingModifierResponse { + stow_scale: swap_scale, + draw_scale: swap_scale, + ..Default::default() + } + }, ); add_hmr( Perks::TargetingMod, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - HandlingModifierResponse { - ads_scale: if _input.value > 0 { 0.75 } else { 1.0 }, - ..Default::default() - } - }, - ), + |input: ModifierResponseInput| -> HandlingModifierResponse { + HandlingModifierResponse { + ads_scale: if input.value > 0 { 0.75 } else { 1.0 }, + ..Default::default() + } + }, ); add_sbr( Perks::TargetingMod, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); - if _input.value == 1 { + if input.value == 1 { stats.insert(StatHashes::AIM_ASSIST.into(), 5); - } else if _input.value == 2 { + } else if input.value == 2 { stats.insert(StatHashes::AIM_ASSIST.into(), 8); - } else if _input.value > 2 { + } else if input.value > 2 { stats.insert(StatHashes::AIM_ASSIST.into(), 10); } stats - }), + }, ); add_imr( Perks::ReserveMod, - Box::new( - |_input: ModifierResponseInput| -> InventoryModifierResponse { - let inv_buff = match _input.value { - 0 => 0, - 1 => 20, - 2 => 40, - 3 => 50, - _ => 50, - }; - InventoryModifierResponse { - inv_stat_add: inv_buff, - inv_scale: 1.0, - ..Default::default() - } - }, - ), + |input: ModifierResponseInput| -> InventoryModifierResponse { + let inv_buff = match input.value { + 0 => 0, + 1 => 20, + 2 => 40, + 3 => 50, + _ => 50, + }; + InventoryModifierResponse { + inv_stat_add: inv_buff, + inv_scale: 1.0, + ..Default::default() + } + }, ); add_sbr( Perks::ReserveMod, - Box::new(|_input: ModifierResponseInput| -> HashMap { - let inv_buff = match _input.value { + |input: ModifierResponseInput| -> HashMap { + let inv_buff = match input.value { 0 => 0, 1 => 20, 2 => 40, @@ -239,32 +231,32 @@ pub fn meta_perks() { let mut stats = HashMap::new(); stats.insert(StatHashes::INVENTORY_SIZE.into(), inv_buff); stats - }), + }, ); add_rsmr( Perks::LoaderMod, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - let stat = match _input.value { + |input: ModifierResponseInput| -> ReloadModifierResponse { + let stat = match input.value { 0 => 0, 1 => 10, 2 => 15, 3.. => 18, }; - let mult = if _input.value > 0 { 0.85 } else { 1.0 }; + let mult = if input.value > 0 { 0.85 } else { 1.0 }; ReloadModifierResponse { reload_stat_add: stat, reload_time_scale: mult, } - }), + }, ); add_sbr( Perks::LoaderMod, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); - let buff = match _input.value { + let buff = match input.value { 0 => 0, 1 => 10, 2 => 15, @@ -272,71 +264,71 @@ pub fn meta_perks() { }; stats.insert(StatHashes::RELOAD.into(), buff); stats - }), + }, ); add_flmr( Perks::UnflinchingMod, - Box::new(|_input: ModifierResponseInput| -> FlinchModifierResponse { - if _input.value > 2 { + |input: ModifierResponseInput| -> FlinchModifierResponse { + if input.value > 2 { FlinchModifierResponse { flinch_scale: 0.6 } - } else if _input.value == 2 { + } else if input.value == 2 { FlinchModifierResponse { flinch_scale: 0.7 } - } else if _input.value == 1 { + } else if input.value == 1 { FlinchModifierResponse { flinch_scale: 0.75 } } else { FlinchModifierResponse::default() } - }), + }, ); add_sbr( Perks::RallyBarricade, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |_: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); stats.insert(StatHashes::STABILITY.into(), 30); stats.insert(StatHashes::RELOAD.into(), 100); stats - }), + }, ); add_flmr( Perks::RallyBarricade, - Box::new(|_input: ModifierResponseInput| -> FlinchModifierResponse { + |_input: ModifierResponseInput| -> FlinchModifierResponse { FlinchModifierResponse { flinch_scale: 0.5 } - }), + }, ); add_rsmr( Perks::RallyBarricade, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { + |_: ModifierResponseInput| -> ReloadModifierResponse { ReloadModifierResponse { reload_stat_add: 100, reload_time_scale: 0.9, } - }), + }, ); add_rmr( Perks::RallyBarricade, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { + |_: ModifierResponseInput| -> RangeModifierResponse { RangeModifierResponse { range_all_scale: 1.1, ..Default::default() } - }), + }, ); add_fmr( Perks::AdeptChargeTime, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { + |input: ModifierResponseInput| -> FiringModifierResponse { FiringModifierResponse { - burst_delay_add: match *_input.calc_data.weapon_type { + burst_delay_add: match *input.calc_data.weapon_type { WeaponType::FUSIONRIFLE => -0.040, WeaponType::LINEARFUSIONRIFLE => -0.033, _ => 0.0, }, ..Default::default() } - }), + }, ); } diff --git a/src/perks/mod.rs b/src/perks/mod.rs index 631e2682..c696658f 100644 --- a/src/perks/mod.rs +++ b/src/perks/mod.rs @@ -69,11 +69,11 @@ pub struct Perk { pub raw_hash: u32, } -pub fn enhanced_check(_hash: u32) -> (u32, bool) { - let mut result = _hash; +pub fn enhanced_check(hash: u32) -> (u32, bool) { + let mut result = hash; let mut found = false; - for (_, (h, r)) in database::ENHANCE_PERK_MAPPING.iter().enumerate() { - if _hash == *h { + for (h, r) in database::ENHANCE_PERK_MAPPING.iter() { + if hash == *h { result = *r; found = true; break; @@ -481,7 +481,7 @@ pub struct ModifierResponseInput<'a> { pvp: bool, cached_data: &'a mut HashMap, } -type ModifierFunction = Box T>; +type ModifierFunction = fn(ModifierResponseInput) -> T; type StatMap = HashMap; type ModifierMap = HashMap>; @@ -690,21 +690,21 @@ fn add_imr(perk: Perks, func: ModifierFunction) { } pub fn get_stat_bumps( - _perks: Vec, - _input_data: CalculationInput, - _pvp: bool, - _cached_data: &mut HashMap, + perks: Vec, + input_data: CalculationInput, + pvp: bool, + cached_data: &mut HashMap, ) -> [HashMap; 2] { let mut dynamic_stats: HashMap = HashMap::new(); let mut static_stats: HashMap = HashMap::new(); - for perk in _perks { + for perk in perks { let perk_stats = PERK_FUNC_MAP.with(|pers_modifier| { let inp = ModifierResponseInput { is_enhanced: perk.enhanced, value: perk.value, - calc_data: &_input_data, - pvp: _pvp, - cached_data: _cached_data, + calc_data: &input_data, + pvp, + cached_data, }; pers_modifier.borrow().get_sbr(perk.hash.into(), inp) }); @@ -721,20 +721,20 @@ pub fn get_stat_bumps( } pub fn get_dmg_modifier( - _perks: Vec, - _input_data: &CalculationInput, - _pvp: bool, - _cached_data: &mut HashMap, + perks: Vec, + input_data: &CalculationInput, + pvp: bool, + cached_data: &mut HashMap, ) -> DamageModifierResponse { let mut dmg_modifier = DamageModifierResponse::default(); - for perk in _perks { + for perk in perks { let tmp = PERK_FUNC_MAP.with(|pers_modifier| { let inp = ModifierResponseInput { is_enhanced: perk.enhanced, value: perk.value, - calc_data: _input_data, - pvp: _pvp, - cached_data: _cached_data, + calc_data: input_data, + pvp, + cached_data, }; pers_modifier.borrow().get_dmr(perk.hash.into(), inp) }); @@ -746,20 +746,20 @@ pub fn get_dmg_modifier( } pub fn get_reload_modifier( - _perks: Vec, - _input_data: &CalculationInput, - _pvp: bool, - _cached_data: &mut HashMap, + perks: Vec, + input_data: &CalculationInput, + pvp: bool, + cached_data: &mut HashMap, ) -> ReloadModifierResponse { let mut reload_modifier = ReloadModifierResponse::default(); - for perk in _perks { + for perk in perks { let tmp = PERK_FUNC_MAP.with(|pers_modifier| { let inp = ModifierResponseInput { is_enhanced: perk.enhanced, value: perk.value, - calc_data: _input_data, - pvp: _pvp, - cached_data: _cached_data, + calc_data: input_data, + pvp, + cached_data, }; pers_modifier.borrow().get_rsmr(perk.hash.into(), inp) }); @@ -770,20 +770,20 @@ pub fn get_reload_modifier( } pub fn get_firing_modifier( - _perks: Vec, - _input_data: &CalculationInput, - _pvp: bool, - _cached_data: &mut HashMap, + perks: Vec, + input_data: &CalculationInput, + pvp: bool, + cached_data: &mut HashMap, ) -> FiringModifierResponse { let mut firing_modifier = FiringModifierResponse::default(); - for perk in _perks { + for perk in perks { let tmp = PERK_FUNC_MAP.with(|pers_modifier| { let inp = ModifierResponseInput { is_enhanced: perk.enhanced, value: perk.value, - calc_data: _input_data, - pvp: _pvp, - cached_data: _cached_data, + calc_data: input_data, + pvp, + cached_data, }; pers_modifier.borrow().get_fmr(perk.hash.into(), inp) }); @@ -796,20 +796,20 @@ pub fn get_firing_modifier( } pub fn get_handling_modifier( - _perks: Vec, - _input_data: &CalculationInput, - _pvp: bool, - _cached_data: &mut HashMap, + perks: Vec, + input_data: &CalculationInput, + pvp: bool, + cached_data: &mut HashMap, ) -> HandlingModifierResponse { let mut handling_modifier = HandlingModifierResponse::default(); - for perk in _perks { + for perk in perks { let tmp = PERK_FUNC_MAP.with(|pers_modifier| { let inp = ModifierResponseInput { is_enhanced: perk.enhanced, value: perk.value, - calc_data: _input_data, - pvp: _pvp, - cached_data: _cached_data, + calc_data: input_data, + pvp, + cached_data, }; pers_modifier.borrow().get_hmr(perk.hash.into(), inp) }); @@ -825,20 +825,20 @@ pub fn get_handling_modifier( } pub fn get_magazine_modifier( - _perks: Vec, - _input_data: &CalculationInput, - _pvp: bool, - _cached_data: &mut HashMap, + perks: Vec, + input_data: &CalculationInput, + pvp: bool, + cached_data: &mut HashMap, ) -> MagazineModifierResponse { let mut magazine_modifier = MagazineModifierResponse::default(); - for perk in _perks { + for perk in perks { let tmp = PERK_FUNC_MAP.with(|pers_modifier| { let inp = ModifierResponseInput { is_enhanced: perk.enhanced, value: perk.value, - calc_data: _input_data, - pvp: _pvp, - cached_data: _cached_data, + calc_data: input_data, + pvp, + cached_data, }; pers_modifier.borrow().get_mmr(perk.hash.into(), inp) }); @@ -850,20 +850,20 @@ pub fn get_magazine_modifier( } pub fn get_reserve_modifier( - _perks: Vec, - _input_data: &CalculationInput, - _pvp: bool, - _cached_data: &mut HashMap, + perks: Vec, + input_data: &CalculationInput, + pvp: bool, + cached_data: &mut HashMap, ) -> InventoryModifierResponse { let mut reserve_modifier = InventoryModifierResponse::default(); - for perk in _perks { + for perk in perks { let tmp = PERK_FUNC_MAP.with(|pers_modifier| { let inp = ModifierResponseInput { is_enhanced: perk.enhanced, value: perk.value, - calc_data: _input_data, - pvp: _pvp, - cached_data: _cached_data, + calc_data: input_data, + pvp, + cached_data, }; pers_modifier.borrow().get_imr(perk.hash.into(), inp) }); @@ -875,20 +875,20 @@ pub fn get_reserve_modifier( } pub fn get_range_modifier( - _perks: Vec, - _input_data: &CalculationInput, - _pvp: bool, - _cached_data: &mut HashMap, + perks: Vec, + input_data: &CalculationInput, + pvp: bool, + cached_data: &mut HashMap, ) -> RangeModifierResponse { let mut range_modifier = RangeModifierResponse::default(); - for perk in _perks { + for perk in perks { let tmp = PERK_FUNC_MAP.with(|pers_modifier| { let inp = ModifierResponseInput { is_enhanced: perk.enhanced, value: perk.value, - calc_data: _input_data, - pvp: _pvp, - cached_data: _cached_data, + calc_data: input_data, + pvp, + cached_data, }; pers_modifier.borrow().get_rmr(perk.hash.into(), inp) }); @@ -901,20 +901,20 @@ pub fn get_range_modifier( } pub fn get_refund_modifier( - _perks: Vec, - _input_data: &CalculationInput, - _pvp: bool, - _cached_data: &mut HashMap, + perks: Vec, + input_data: &CalculationInput, + pvp: bool, + cached_data: &mut HashMap, ) -> Vec { let mut refund_modifier = vec![]; - for perk in _perks { + for perk in perks { let tmp = PERK_FUNC_MAP.with(|pers_modifier| { let inp = ModifierResponseInput { is_enhanced: perk.enhanced, value: perk.value, - calc_data: _input_data, - pvp: _pvp, - cached_data: _cached_data, + calc_data: input_data, + pvp, + cached_data, }; pers_modifier.borrow().get_rr(perk.hash.into(), inp) }); @@ -926,20 +926,20 @@ pub fn get_refund_modifier( } pub fn get_extra_damage( - _perks: Vec, - _input_data: &CalculationInput, - _pvp: bool, - _cached_data: &mut HashMap, + perks: Vec, + input_data: &CalculationInput, + pvp: bool, + cached_data: &mut HashMap, ) -> Vec { let mut extra_damage = vec![]; - for perk in _perks { + for perk in perks { let tmp = PERK_FUNC_MAP.with(|pers_modifier| { let inp = ModifierResponseInput { is_enhanced: perk.enhanced, value: perk.value, - calc_data: _input_data, - pvp: _pvp, - cached_data: _cached_data, + calc_data: input_data, + pvp, + cached_data, }; pers_modifier.borrow().get_edr(perk.hash.into(), inp) }); @@ -976,18 +976,18 @@ pub fn get_extra_damage( // } pub fn get_explosion_data( - _perks: Vec, - _input_data: &CalculationInput, - _pvp: bool, + perks: Vec, + input_data: &CalculationInput, + pvp: bool, ) -> ExplosivePercentResponse { let mut highest_so_far = ExplosivePercentResponse::default(); - for perk in _perks { + for perk in perks { let tmp = PERK_FUNC_MAP.with(|pers_modifier| { let inp = ModifierResponseInput { is_enhanced: perk.enhanced, value: perk.value, - calc_data: _input_data, - pvp: _pvp, + calc_data: input_data, + pvp, cached_data: &mut HashMap::new(), }; pers_modifier.borrow().get_epr(perk.hash.into(), inp) @@ -1000,20 +1000,20 @@ pub fn get_explosion_data( } pub fn get_flinch_modifier( - _perks: Vec, - _input_data: &CalculationInput, - _pvp: bool, - _cached_data: &mut HashMap, + perks: Vec, + input_data: &CalculationInput, + pvp: bool, + cached_data: &mut HashMap, ) -> FlinchModifierResponse { let mut flinch = FlinchModifierResponse::default(); - for perk in _perks { + for perk in perks { let tmp = PERK_FUNC_MAP.with(|pers_modifier| { let inp = ModifierResponseInput { is_enhanced: perk.enhanced, value: perk.value, - calc_data: _input_data, - pvp: _pvp, - cached_data: _cached_data, + calc_data: input_data, + pvp, + cached_data, }; pers_modifier.borrow().get_flmr(perk.hash.into(), inp) }); @@ -1023,20 +1023,20 @@ pub fn get_flinch_modifier( } pub fn get_velocity_modifier( - _perks: Vec, - _input_data: &CalculationInput, - _pvp: bool, - _cached_data: &mut HashMap, + perks: Vec, + input_data: &CalculationInput, + pvp: bool, + cached_data: &mut HashMap, ) -> VelocityModifierResponse { let mut velocity = VelocityModifierResponse::default(); - for perk in _perks { + for perk in perks { let tmp = PERK_FUNC_MAP.with(|pers_modifier| { let inp = ModifierResponseInput { is_enhanced: perk.enhanced, value: perk.value, - calc_data: _input_data, - pvp: _pvp, - cached_data: _cached_data, + calc_data: input_data, + pvp, + cached_data, }; pers_modifier.borrow().get_vmr(perk.hash.into(), inp) }); @@ -1048,18 +1048,18 @@ pub fn get_velocity_modifier( impl Weapon { pub fn get_modifier_summary( &self, - _calc_input: Option, - _pvp: bool, - _cached_data: Option<&mut HashMap>, + calc_input: Option, + pvp: bool, + cached_data: Option<&mut HashMap>, ) -> HashMap { let mut default_cached_data = HashMap::new(); - let cached_data = _cached_data.unwrap_or(&mut default_cached_data); + let cached_data = cached_data.unwrap_or(&mut default_cached_data); let mut buffer: HashMap = HashMap::new(); - if _calc_input.is_none() { + if calc_input.is_none() { return buffer; } - let calc_input = _calc_input.unwrap(); + let calc_input = calc_input.unwrap(); for perk in self.list_perks() { let mod_buffer = PERK_FUNC_MAP.with(|pers_modifier| { @@ -1070,7 +1070,7 @@ impl Weapon { is_enhanced: perk.enhanced, value: perk.value, calc_data: &calc_input, - pvp: _pvp, + pvp, cached_data, }; let modifier = perk_modifiers.get_rmr(perk.hash.into(), inp); @@ -1082,7 +1082,7 @@ impl Weapon { is_enhanced: perk.enhanced, value: perk.value, calc_data: &calc_input, - pvp: _pvp, + pvp, cached_data, }; let modifier = perk_modifiers.get_dmr(perk.hash.into(), inp); @@ -1094,7 +1094,7 @@ impl Weapon { is_enhanced: perk.enhanced, value: perk.value, calc_data: &calc_input, - pvp: _pvp, + pvp, cached_data, }; let modifier = perk_modifiers.get_hmr(perk.hash.into(), inp); @@ -1106,7 +1106,7 @@ impl Weapon { is_enhanced: perk.enhanced, value: perk.value, calc_data: &calc_input, - pvp: _pvp, + pvp, cached_data, }; let modifier = perk_modifiers.get_fmr(perk.hash.into(), inp); @@ -1118,7 +1118,7 @@ impl Weapon { is_enhanced: perk.enhanced, value: perk.value, calc_data: &calc_input, - pvp: _pvp, + pvp, cached_data, }; let modifier = perk_modifiers.get_flmr(perk.hash.into(), inp); @@ -1130,7 +1130,7 @@ impl Weapon { is_enhanced: perk.enhanced, value: perk.value, calc_data: &calc_input, - pvp: _pvp, + pvp, cached_data, }; let modifier = perk_modifiers.get_rsmr(perk.hash.into(), inp); @@ -1142,7 +1142,7 @@ impl Weapon { is_enhanced: perk.enhanced, value: perk.value, calc_data: &calc_input, - pvp: _pvp, + pvp, cached_data, }; let modifier = perk_modifiers.get_mmr(perk.hash.into(), inp); @@ -1154,7 +1154,7 @@ impl Weapon { is_enhanced: perk.enhanced, value: perk.value, calc_data: &calc_input, - pvp: _pvp, + pvp, cached_data, }; let modifier = perk_modifiers.get_imr(perk.hash.into(), inp); @@ -1166,7 +1166,7 @@ impl Weapon { is_enhanced: perk.enhanced, value: perk.value, calc_data: &calc_input, - pvp: _pvp, + pvp, cached_data, }; let stat_mod = perk_modifiers.get_sbr(perk.hash.into(), inp); diff --git a/src/perks/origin_perks.rs b/src/perks/origin_perks.rs index f9651f49..d211d7c7 100644 --- a/src/perks/origin_perks.rs +++ b/src/perks/origin_perks.rs @@ -16,20 +16,20 @@ use super::{ pub fn origin_perks() { add_rr( Perks::VeistStinger, - Box::new(|_input: ModifierResponseInput| -> RefundResponse { - let data = _input.cached_data.get("veist_stinger"); + |input: ModifierResponseInput| -> RefundResponse { + let data = input.cached_data.get("veist_stinger"); let last_proc = *data.unwrap_or(&1.0); - let time_since_last_proc = _input.calc_data.time_total - last_proc; - let max_refund = _input.calc_data.base_mag - _input.calc_data.curr_mag; + let time_since_last_proc = input.calc_data.time_total - last_proc; + let max_refund = input.calc_data.base_mag - input.calc_data.curr_mag; - if _input.value == 0 || time_since_last_proc < 4.0 || max_refund == 0.0 { + if input.value == 0 || time_since_last_proc < 4.0 || max_refund == 0.0 { return RefundResponse::default(); }; - _input + input .cached_data - .insert("veist_stinger".to_string(), _input.calc_data.time_total); - let refund_amount = (_input.calc_data.base_mag / 4.0).ceil() as i32; + .insert("veist_stinger".to_string(), input.calc_data.time_total); + let refund_amount = (input.calc_data.base_mag / 4.0).ceil() as i32; let final_refund_ammount = refund_amount.clamp(0, max_refund as i32); RefundResponse { requirement: 1, @@ -37,15 +37,15 @@ pub fn origin_perks() { refund_mag: refund_amount, refund_reserves: -final_refund_ammount, } - }), + }, ); add_fmr( Perks::VeistStinger, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { + |input: ModifierResponseInput| -> FiringModifierResponse { FiringModifierResponse { - burst_delay_scale: if _input.calc_data.weapon_type == &WeaponType::BOW - && _input.value > 0 + burst_delay_scale: if input.calc_data.weapon_type == &WeaponType::BOW + && input.value > 0 { 0.85 } else { @@ -53,17 +53,17 @@ pub fn origin_perks() { }, ..Default::default() } - }), + }, ); add_dmr( Perks::HakkeBreach, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value == 0 { + |input: ModifierResponseInput| -> DamageModifierResponse { + if input.value == 0 { return DamageModifierResponse::default(); } - let buff = match _input.value { + let buff = match input.value { 1 => 1.15, 2 => 1.45, 3 => 1.30, @@ -75,66 +75,66 @@ pub fn origin_perks() { explosive_dmg_scale: buff, crit_scale: 1.0, } - }), + }, ); add_rmr( Perks::Alacrity, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { - let range_add = if _input.value > 0 { 20 } else { 0 }; + |input: ModifierResponseInput| -> RangeModifierResponse { + let range_add = if input.value > 0 { 20 } else { 0 }; RangeModifierResponse { range_stat_add: range_add, ..Default::default() } - }), + }, ); add_rsmr( Perks::Alacrity, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - let reload_add = if _input.value > 0 { 50 } else { 0 }; + |input: ModifierResponseInput| -> ReloadModifierResponse { + let reload_add = if input.value > 0 { 50 } else { 0 }; ReloadModifierResponse { reload_stat_add: reload_add, ..Default::default() } - }), + }, ); add_sbr( Perks::Alacrity, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut map = HashMap::new(); - let range = if _input.value > 0 { 20 } else { 0 }; - let reload = if _input.value > 0 { 50 } else { 0 }; - let stability = if _input.value > 0 { 20 } else { 0 }; - let aim_assist = if _input.value > 0 { 10 } else { 0 }; + let range = if input.value > 0 { 20 } else { 0 }; + let reload = if input.value > 0 { 50 } else { 0 }; + let stability = if input.value > 0 { 20 } else { 0 }; + let aim_assist = if input.value > 0 { 10 } else { 0 }; map.insert(StatHashes::RANGE.into(), range); map.insert(StatHashes::RELOAD.into(), reload); map.insert(StatHashes::STABILITY.into(), stability); map.insert(StatHashes::AIM_ASSIST.into(), aim_assist); map - }), + }, ); add_sbr( Perks::Ambush, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut map = HashMap::new(); - let range = if _input.is_enhanced { 30 } else { 20 }; - let handling = if _input.is_enhanced { 40 } else { 20 }; - if _input.calc_data.time_total < 2.0 && _input.value > 0 { + let range = if input.is_enhanced { 30 } else { 20 }; + let handling = if input.is_enhanced { 40 } else { 20 }; + if input.calc_data.time_total < 2.0 && input.value > 0 { map.insert(StatHashes::RANGE.into(), range); map.insert(StatHashes::HANDLING.into(), handling); } map - }), + }, ); add_rmr( Perks::Ambush, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { - let range_add = if _input.is_enhanced { 30 } else { 20 }; - if _input.calc_data.time_total < 2.0 && _input.value > 0 { + |input: ModifierResponseInput| -> RangeModifierResponse { + let range_add = if input.is_enhanced { 30 } else { 20 }; + if input.calc_data.time_total < 2.0 && input.value > 0 { RangeModifierResponse { range_stat_add: range_add, ..Default::default() @@ -142,33 +142,31 @@ pub fn origin_perks() { } else { RangeModifierResponse::default() } - }), + }, ); add_hmr( Perks::Ambush, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let handling_add = if _input.is_enhanced { 40 } else { 20 }; - if _input.calc_data.time_total < 2.0 && _input.value > 0 { - HandlingModifierResponse { - stat_add: handling_add, - ..Default::default() - } - } else { - HandlingModifierResponse::default() + |input: ModifierResponseInput| -> HandlingModifierResponse { + let handling_add = if input.is_enhanced { 40 } else { 20 }; + if input.calc_data.time_total < 2.0 && input.value > 0 { + HandlingModifierResponse { + stat_add: handling_add, + ..Default::default() } - }, - ), + } else { + HandlingModifierResponse::default() + } + }, ); add_dmr( Perks::Ambush, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value == 0 || _input.pvp { + |input: ModifierResponseInput| -> DamageModifierResponse { + if input.value == 0 || input.pvp { return DamageModifierResponse::default(); } - let damage_mult = if _input.calc_data.weapon_type == &WeaponType::LINEARFUSIONRIFLE { + let damage_mult = if input.calc_data.weapon_type == &WeaponType::LINEARFUSIONRIFLE { 1.0888 } else { 1.1078 @@ -179,15 +177,15 @@ pub fn origin_perks() { explosive_dmg_scale: damage_mult, crit_scale: 1.0, } - }), + }, ); add_fmr( Perks::Ambush, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { + |input: ModifierResponseInput| -> FiringModifierResponse { FiringModifierResponse { - burst_delay_scale: if _input.calc_data.weapon_type == &WeaponType::BOW - && _input.value > 0 + burst_delay_scale: if input.calc_data.weapon_type == &WeaponType::BOW + && input.value > 0 { 0.9 } else { @@ -195,31 +193,29 @@ pub fn origin_perks() { }, ..Default::default() } - }), + }, ); add_hmr( Perks::HotSwap, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let handling_add = if _input.is_enhanced { 60 } else { 30 }; - if _input.value > 0 { - HandlingModifierResponse { - stat_add: handling_add, - ..Default::default() - } - } else { - HandlingModifierResponse::default() + |input: ModifierResponseInput| -> HandlingModifierResponse { + let handling_add = if input.is_enhanced { 60 } else { 30 }; + if input.value > 0 { + HandlingModifierResponse { + stat_add: handling_add, + ..Default::default() } - }, - ), + } else { + HandlingModifierResponse::default() + } + }, ); add_rsmr( Perks::FluidDynamics, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - let reload_add = if _input.is_enhanced { 35 } else { 30 }; - if _input.calc_data.shots_fired_this_mag <= _input.calc_data.base_mag / 2.0 { + |input: ModifierResponseInput| -> ReloadModifierResponse { + let reload_add = if input.is_enhanced { 35 } else { 30 }; + if input.calc_data.shots_fired_this_mag <= input.calc_data.base_mag / 2.0 { ReloadModifierResponse { reload_stat_add: reload_add, reload_time_scale: 1.0, @@ -227,29 +223,29 @@ pub fn origin_perks() { } else { ReloadModifierResponse::default() } - }), + }, ); add_sbr( Perks::FluidDynamics, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut map = HashMap::new(); - let reload = if _input.is_enhanced { 35 } else { 30 }; - let stability = if _input.is_enhanced { 25 } else { 20 }; - if _input.calc_data.shots_fired_this_mag <= _input.calc_data.base_mag / 2.0 - && _input.value > 0 + let reload = if input.is_enhanced { 35 } else { 30 }; + let stability = if input.is_enhanced { 25 } else { 20 }; + if input.calc_data.shots_fired_this_mag <= input.calc_data.base_mag / 2.0 + && input.value > 0 { map.insert(StatHashes::RELOAD.into(), reload); map.insert(StatHashes::STABILITY.into(), stability); } map - }), + }, ); add_rsmr( Perks::QuietMoment, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - if _input.value > 0 { + |input: ModifierResponseInput| -> ReloadModifierResponse { + if input.value > 0 { ReloadModifierResponse { reload_stat_add: 40, reload_time_scale: 0.95, @@ -257,24 +253,24 @@ pub fn origin_perks() { } else { ReloadModifierResponse::default() } - }), + }, ); add_sbr( Perks::QuietMoment, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut map = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { map.insert(StatHashes::RELOAD.into(), 40); } map - }), + }, ); add_rsmr( Perks::BitterSpite, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - let val = clamp(_input.value, 0, 5) as i32; + |input: ModifierResponseInput| -> ReloadModifierResponse { + let val = clamp(input.value, 0, 5) as i32; let mult = match val { 0 => 1.0, 1 => 0.97, @@ -288,24 +284,24 @@ pub fn origin_perks() { reload_stat_add: val * 10, reload_time_scale: mult, } - }), + }, ); add_sbr( Perks::BitterSpite, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut map = HashMap::new(); - let val = clamp(_input.value, 0, 5) as i32; + let val = clamp(input.value, 0, 5) as i32; map.insert(StatHashes::RELOAD.into(), val * 10); map - }), + }, ); add_rmr( Perks::RightHook, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { - let range_add = if _input.is_enhanced { 20 } else { 10 }; - if _input.value > 0 { + |input: ModifierResponseInput| -> RangeModifierResponse { + let range_add = if input.is_enhanced { 20 } else { 10 }; + if input.value > 0 { RangeModifierResponse { range_stat_add: range_add, ..Default::default() @@ -313,84 +309,78 @@ pub fn origin_perks() { } else { RangeModifierResponse::default() } - }), + }, ); add_sbr( Perks::RightHook, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut map = HashMap::new(); - let stat_bump = if _input.is_enhanced { 20 } else { 10 }; - if _input.value > 0 { + let stat_bump = if input.is_enhanced { 20 } else { 10 }; + if input.value > 0 { map.insert(StatHashes::AIM_ASSIST.into(), stat_bump); map.insert(StatHashes::RANGE.into(), stat_bump); } map - }), + }, ); add_hmr( Perks::SearchParty, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value > 0 { - HandlingModifierResponse { - ads_scale: 0.85, - ..Default::default() - } - } else { - HandlingModifierResponse::default() + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value > 0 { + HandlingModifierResponse { + ads_scale: 0.85, + ..Default::default() } - }, - ), + } else { + HandlingModifierResponse::default() + } + }, ); add_mmr( Perks::RunnethOver, - Box::new( - |_input: ModifierResponseInput| -> MagazineModifierResponse { - let val = clamp(_input.value, 0, 5) as f64; - MagazineModifierResponse { - magazine_scale: 1.0 + val * 0.1, - ..Default::default() - } - }, - ), + |input: ModifierResponseInput| -> MagazineModifierResponse { + let val = clamp(input.value, 0, 5) as f64; + MagazineModifierResponse { + magazine_scale: 1.0 + val * 0.1, + ..Default::default() + } + }, ); add_sbr( Perks::TexBalancedStock, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut map = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { map.insert(StatHashes::HANDLING.into(), 20); map.insert(StatHashes::RELOAD.into(), 20); map.insert(StatHashes::RANGE.into(), 20); } map - }), + }, ); add_hmr( Perks::TexBalancedStock, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value > 0 { - HandlingModifierResponse { - stat_add: 50, - ..Default::default() - } - } else { - HandlingModifierResponse::default() + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value > 0 { + HandlingModifierResponse { + stat_add: 50, + ..Default::default() } - }, - ), + } else { + HandlingModifierResponse::default() + } + }, ); add_rsmr( Perks::TexBalancedStock, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - if _input.value > 0 { + |input: ModifierResponseInput| -> ReloadModifierResponse { + if input.value > 0 { ReloadModifierResponse { reload_stat_add: 20, reload_time_scale: 0.9, @@ -398,78 +388,76 @@ pub fn origin_perks() { } else { ReloadModifierResponse::default() } - }), + }, ); add_rmr( Perks::TexBalancedStock, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { - if _input.value == 0 { + |input: ModifierResponseInput| -> RangeModifierResponse { + if input.value == 0 { return RangeModifierResponse::default(); } RangeModifierResponse { range_stat_add: 20, ..Default::default() } - }), + }, ); add_sbr( Perks::SurosSynergy, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut out = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { out.insert(StatHashes::HANDLING.into(), 40); } out - }), + }, ); add_hmr( Perks::SurosSynergy, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value > 0 { - HandlingModifierResponse { - stat_add: 40, - ..Default::default() - } - } else { - HandlingModifierResponse::default() + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value > 0 { + HandlingModifierResponse { + stat_add: 40, + ..Default::default() } - }, - ), + } else { + HandlingModifierResponse::default() + } + }, ); add_flmr( Perks::SurosSynergy, - Box::new(|_input: ModifierResponseInput| -> FlinchModifierResponse { - if _input.value > 0 { + |input: ModifierResponseInput| -> FlinchModifierResponse { + if input.value > 0 { FlinchModifierResponse { flinch_scale: 0.80 } } else { FlinchModifierResponse::default() } - }), + }, ); add_sbr( Perks::HarmonicResonance, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut out = HashMap::new(); - if _input.value == 1 { + if input.value == 1 { out.insert(StatHashes::HANDLING.into(), 10); } - if _input.value > 1 { + if input.value > 1 { out.insert(StatHashes::RELOAD.into(), 20); out.insert(StatHashes::HANDLING.into(), 20); } out - }), + }, ); add_rsmr( Perks::HarmonicResonance, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - let stat_bump = if _input.value > 1 { 20 } else { 0 }; - if _input.value > 0 { + |input: ModifierResponseInput| -> ReloadModifierResponse { + let stat_bump = if input.value > 1 { 20 } else { 0 }; + if input.value > 0 { ReloadModifierResponse { reload_stat_add: stat_bump, reload_time_scale: 0.95, @@ -477,19 +465,17 @@ pub fn origin_perks() { } else { ReloadModifierResponse::default() } - }), + }, ); add_hmr( Perks::HarmonicResonance, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let stat_bump = 10 * clamp(_input.value, 0, 2); - HandlingModifierResponse { - stat_add: stat_bump as i32, - ..Default::default() - } - }, - ), + |input: ModifierResponseInput| -> HandlingModifierResponse { + let stat_bump = 10 * clamp(input.value, 0, 2); + HandlingModifierResponse { + stat_add: stat_bump as i32, + ..Default::default() + } + }, ); } diff --git a/src/perks/other_perks.rs b/src/perks/other_perks.rs index 1e227a47..28a91ee4 100644 --- a/src/perks/other_perks.rs +++ b/src/perks/other_perks.rs @@ -20,8 +20,8 @@ use super::{ pub fn other_perks() { add_rsmr( Perks::AlloyMag, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - if _input.value > 0 { + |input: ModifierResponseInput| -> ReloadModifierResponse { + if input.value > 0 { ReloadModifierResponse { reload_stat_add: 0, reload_time_scale: 0.85, @@ -29,13 +29,13 @@ pub fn other_perks() { } else { ReloadModifierResponse::default() } - }), + }, ); add_rsmr( Perks::RapidFireFrame, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - if _input.value > 0 || _input.calc_data.weapon_type == &WeaponType::SHOTGUN { + |input: ModifierResponseInput| -> ReloadModifierResponse { + if input.value > 0 || input.calc_data.weapon_type == &WeaponType::SHOTGUN { ReloadModifierResponse { reload_stat_add: 0, reload_time_scale: 0.80, @@ -43,162 +43,77 @@ pub fn other_perks() { } else { ReloadModifierResponse::default() } - }), + }, ); add_sbr( Perks::PrecisionFrame, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); - if _input.calc_data.weapon_type == &WeaponType::HANDCANNON { + if input.calc_data.weapon_type == &WeaponType::HANDCANNON { stats.insert(StatHashes::AIRBORNE.into(), 25); } stats - }), + }, ); add_hmr( Perks::SwapMag, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - HandlingModifierResponse { - draw_scale: 0.9, - stow_scale: 0.9, - ..Default::default() - } - }, - ), + |_: ModifierResponseInput| -> HandlingModifierResponse { + HandlingModifierResponse { + draw_scale: 0.9, + stow_scale: 0.9, + ..Default::default() + } + }, ); add_hmr( Perks::QuickAccessSling, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - HandlingModifierResponse { - draw_scale: 0.9, - stow_scale: 0.9, - ..Default::default() - } - }, - ), - ); - - add_hmr( - Perks::FreehandGrip, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - HandlingModifierResponse { - draw_scale: 0.95, - ..Default::default() - } - }, - ), - ); - - add_hmr( - Perks::OphidianAspect, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - HandlingModifierResponse { - stat_add: 35, - ..Default::default() - } - }, - ), - ); - - add_rsmr( - Perks::OphidianAspect, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - ReloadModifierResponse { - reload_stat_add: 35, - reload_time_scale: 1.0, + |_: ModifierResponseInput| -> HandlingModifierResponse { + HandlingModifierResponse { + draw_scale: 0.9, + stow_scale: 0.9, + ..Default::default() } - }), - ); - - add_sbr( - Perks::OphidianAspect, - Box::new(|_input: ModifierResponseInput| -> HashMap { - let mut stats = HashMap::new(); - stats.insert(StatHashes::HANDLING.into(), 35); - stats.insert(StatHashes::RELOAD.into(), 35); - stats.insert(StatHashes::AIRBORNE.into(), 10); - stats - }), - ); - - add_sbr( - Perks::DragonShadow, - Box::new(|_input: ModifierResponseInput| -> HashMap { - let mut stats = HashMap::new(); - if _input.value >= 1 { - stats.insert(StatHashes::HANDLING.into(), 100); - stats.insert(StatHashes::RELOAD.into(), 100); - } - stats - }), + }, ); add_hmr( - Perks::DragonShadow, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value >= 1 { - HandlingModifierResponse { - stat_add: 100, - draw_scale: 0.7, - stow_scale: 0.7, - ..Default::default() - } - } else { - HandlingModifierResponse::default() - } - }, - ), - ); - - add_rsmr( - Perks::DragonShadow, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - if _input.value >= 1 { - ReloadModifierResponse { - reload_stat_add: 100, - reload_time_scale: 1.0, - } - } else { - ReloadModifierResponse::default() + Perks::FreehandGrip, + |_: ModifierResponseInput| -> HandlingModifierResponse { + HandlingModifierResponse { + draw_scale: 0.95, + ..Default::default() } - }), + }, ); add_sbr( Perks::Amplified, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |_: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); stats.insert(StatHashes::HANDLING.into(), 40); stats - }), + }, ); add_hmr( Perks::Amplified, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - HandlingModifierResponse { - stat_add: 40, - draw_scale: 0.95, - stow_scale: 0.95, - ..Default::default() - } - }, - ), + |_: ModifierResponseInput| -> HandlingModifierResponse { + HandlingModifierResponse { + stat_add: 40, + draw_scale: 0.95, + stow_scale: 0.95, + ..Default::default() + } + }, ); add_rsmr( Perks::Frequency, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - if _input.value > 0 { + |input: ModifierResponseInput| -> ReloadModifierResponse { + if input.value > 0 { ReloadModifierResponse { reload_stat_add: 50, reload_time_scale: 0.8, @@ -206,24 +121,24 @@ pub fn other_perks() { } else { ReloadModifierResponse::default() } - }), + }, ); add_sbr( Perks::Tempering, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { stats.insert(StatHashes::RELOAD.into(), 50); }; stats - }), + }, ); add_rsmr( Perks::FlowState, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - if _input.value > 0 { + |input: ModifierResponseInput| -> ReloadModifierResponse { + if input.value > 0 { ReloadModifierResponse { reload_stat_add: 50, reload_time_scale: 0.8, @@ -231,98 +146,96 @@ pub fn other_perks() { } else { ReloadModifierResponse::default() } - }), + }, ); add_sbr( Perks::FlowState, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { stats.insert(StatHashes::RELOAD.into(), 50); }; stats - }), + }, ); add_sbr( Perks::Tempering, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { stats.insert(StatHashes::AIRBORNE.into(), 20); }; stats - }), + }, ); add_sbr( Perks::OnYourMark, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); - let val = clamp(_input.value, 0, 3) as i32; - if _input.value > 0 { + let val = clamp(input.value, 0, 3) as i32; + if input.value > 0 { stats.insert(StatHashes::HANDLING.into(), 20 * val); stats.insert(StatHashes::RELOAD.into(), 20 * val); }; stats - }), + }, ); add_hmr( Perks::OnYourMark, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let val = clamp(_input.value, 0, 3) as i32; - HandlingModifierResponse { - stat_add: 20 * val, - ..Default::default() - } - }, - ), + |input: ModifierResponseInput| -> HandlingModifierResponse { + let val = clamp(input.value, 0, 3) as i32; + HandlingModifierResponse { + stat_add: 20 * val, + ..Default::default() + } + }, ); add_rsmr( Perks::OnYourMark, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - let val = clamp(_input.value, 0, 3) as i32; + |input: ModifierResponseInput| -> ReloadModifierResponse { + let val = clamp(input.value, 0, 3) as i32; ReloadModifierResponse { reload_stat_add: 20 * val, - reload_time_scale: if _input.value > 0 { 0.93 } else { 1.0 }, + reload_time_scale: if input.value > 0 { 0.93 } else { 1.0 }, } - }), + }, ); add_sbr( Perks::HeatRises, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); let mut buff = 20; - if _input.value > 0 { + if input.value > 0 { buff += 50; }; stats.insert(StatHashes::AIRBORNE.into(), buff); stats - }), + }, ); add_sbr( Perks::Hedrons, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { stats.insert(StatHashes::AIRBORNE.into(), 20); stats.insert(StatHashes::AIM_ASSIST.into(), 15); stats.insert(StatHashes::STABILITY.into(), 30); }; stats - }), + }, ); add_dmr( Perks::BossSpec, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let damage_mult = if *_input.calc_data.enemy_type == EnemyType::BOSS && !_input.pvp { + |input: ModifierResponseInput| -> DamageModifierResponse { + let damage_mult = if *input.calc_data.enemy_type == EnemyType::BOSS && !input.pvp { 1.077 } else { 1.0 @@ -332,16 +245,16 @@ pub fn other_perks() { explosive_dmg_scale: damage_mult, crit_scale: 1.0, } - }), + }, ); add_dmr( Perks::MajorSpec, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { if !matches!( - *_input.calc_data.enemy_type, + *input.calc_data.enemy_type, EnemyType::ELITE | EnemyType::MINIBOSS | EnemyType::CHAMPION - ) || _input.pvp + ) || input.pvp { return DamageModifierResponse::default(); } @@ -351,16 +264,16 @@ pub fn other_perks() { explosive_dmg_scale: damage_mult, ..Default::default() } - }), + }, ); add_dmr( Perks::BigOnesSpec, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { if !matches!( - *_input.calc_data.enemy_type, + *input.calc_data.enemy_type, EnemyType::ELITE | EnemyType::MINIBOSS | EnemyType::CHAMPION | EnemyType::BOSS - ) || _input.pvp + ) || input.pvp { return DamageModifierResponse::default(); } @@ -370,13 +283,13 @@ pub fn other_perks() { explosive_dmg_scale: damage_mult, ..Default::default() } - }), + }, ); add_dmr( Perks::MinorSpec, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let damage_mult = if _input.calc_data.enemy_type == &EnemyType::MINOR && !_input.pvp { + |input: ModifierResponseInput| -> DamageModifierResponse { + let damage_mult = if input.calc_data.enemy_type == &EnemyType::MINOR && !input.pvp { 1.077 } else { 1.0 @@ -386,13 +299,13 @@ pub fn other_perks() { explosive_dmg_scale: damage_mult, crit_scale: 1.0, } - }), + }, ); add_dmr( Perks::TakenSpec, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let damage_mult = if _input.value > 0 && !_input.pvp { + |input: ModifierResponseInput| -> DamageModifierResponse { + let damage_mult = if input.value > 0 && !input.pvp { 1.1 } else { 1.0 @@ -402,36 +315,36 @@ pub fn other_perks() { explosive_dmg_scale: damage_mult, crit_scale: 1.0, } - }), + }, ); add_dmr( Perks::SpikeGrenades, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |_: ModifierResponseInput| -> DamageModifierResponse { DamageModifierResponse { impact_dmg_scale: 1.125, explosive_dmg_scale: 1.0, crit_scale: 1.0, } - }), + }, ); add_dmr( Perks::DisorientingGrenades, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |_: ModifierResponseInput| -> DamageModifierResponse { DamageModifierResponse { impact_dmg_scale: 0.75, explosive_dmg_scale: 0.75, crit_scale: 1.0, } - }), + }, ); add_dmr( Perks::FullChoke, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.calc_data.weapon_type == &WeaponType::SHOTGUN - && _input.calc_data.base_crit_mult < 1.15 + |input: ModifierResponseInput| -> DamageModifierResponse { + if input.calc_data.weapon_type == &WeaponType::SHOTGUN + && input.calc_data.base_crit_mult < 1.15 { DamageModifierResponse { impact_dmg_scale: 1.0, @@ -441,13 +354,13 @@ pub fn other_perks() { } else { DamageModifierResponse::default() } - }), + }, ); add_fmr( Perks::AcceleratedCoils, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { - if _input.calc_data.weapon_type == &WeaponType::LINEARFUSIONRIFLE { + |input: ModifierResponseInput| -> FiringModifierResponse { + if input.calc_data.weapon_type == &WeaponType::LINEARFUSIONRIFLE { return FiringModifierResponse { burst_delay_add: -0.033, ..Default::default() @@ -457,13 +370,13 @@ pub fn other_perks() { burst_delay_add: -0.040, ..Default::default() } - }), + }, ); add_fmr( Perks::LiquidCoils, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { - if _input.calc_data.weapon_type == &WeaponType::LINEARFUSIONRIFLE { + |input: ModifierResponseInput| -> FiringModifierResponse { + if input.calc_data.weapon_type == &WeaponType::LINEARFUSIONRIFLE { return FiringModifierResponse { burst_delay_add: 0.033, ..Default::default() @@ -473,35 +386,35 @@ pub fn other_perks() { burst_delay_add: 0.040, ..Default::default() } - }), + }, ); add_dmr( Perks::LiquidCoils, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |_: ModifierResponseInput| -> DamageModifierResponse { DamageModifierResponse { impact_dmg_scale: 1.02, explosive_dmg_scale: 1.02, crit_scale: 1.0, } - }), + }, ); add_dmr( Perks::AcceleratedCoils, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |_: ModifierResponseInput| -> DamageModifierResponse { DamageModifierResponse { impact_dmg_scale: 0.98, explosive_dmg_scale: 0.98, ..Default::default() } - }), + }, ); add_fmr( Perks::AssaultMag, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { - let hash = _input.calc_data.intrinsic_hash; + |input: ModifierResponseInput| -> FiringModifierResponse { + let hash = input.calc_data.intrinsic_hash; let tick_amount = if hash == 904 { 3.0 } else if hash == 906 { @@ -509,7 +422,7 @@ pub fn other_perks() { } else { 1.0 }; - if _input.calc_data.weapon_type == &WeaponType::SHOTGUN { + if input.calc_data.weapon_type == &WeaponType::SHOTGUN { FiringModifierResponse { burst_delay_add: -(tick_amount / 30.0), ..Default::default() @@ -517,43 +430,42 @@ pub fn other_perks() { } else { FiringModifierResponse::default() } - }), + }, ); add_sbr( Perks::ThreadOfAscent, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut map = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { map.insert(StatHashes::AIRBORNE.into(), 30); map.insert(StatHashes::RELOAD.into(), 40); map.insert(StatHashes::HANDLING.into(), 40); } map - }), + }, ); add_hmr( Perks::ThreadOfAscent, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value > 0 { - HandlingModifierResponse { - stat_add: 40, - draw_scale: 0.925, - stow_scale: 0.925, - ..Default::default() - } - } else { - HandlingModifierResponse::default() + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value > 0 { + HandlingModifierResponse { + stat_add: 40, + draw_scale: 0.925, + stow_scale: 0.925, + ..Default::default() } - }, - ), + } else { + HandlingModifierResponse::default() + } + }, ); + add_rsmr( Perks::ThreadOfAscent, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - if _input.value > 0 { + |input: ModifierResponseInput| -> ReloadModifierResponse { + if input.value > 0 { ReloadModifierResponse { reload_time_scale: 0.925, reload_stat_add: 40, @@ -561,6 +473,17 @@ pub fn other_perks() { } else { ReloadModifierResponse::default() } - }), + }, + ); + + add_dmr( + Perks::ImpactCasing, + |_: ModifierResponseInput| -> DamageModifierResponse { + DamageModifierResponse { + impact_dmg_scale: 1.1, + explosive_dmg_scale: 1.0, + crit_scale: 1.0, + } + }, ); } diff --git a/src/perks/perk_options_handler.rs b/src/perks/perk_options_handler.rs index c79956b2..3d196b62 100644 --- a/src/perks/perk_options_handler.rs +++ b/src/perks/perk_options_handler.rs @@ -21,7 +21,7 @@ pub struct PerkOptionData { option_type: PerkValueVariant, } impl PerkOptionData { - pub fn static_() -> PerkOptionData { + pub fn constant() -> PerkOptionData { PerkOptionData { stacks: (0, 0), options: vec![], @@ -35,88 +35,90 @@ impl PerkOptionData { option_type: PerkValueVariant::TOGGLE, } } - pub fn stacking(_stacks: u32) -> PerkOptionData { + pub fn stacking(stacks: u32) -> PerkOptionData { PerkOptionData { - stacks: (0, _stacks), + stacks: (0, stacks), options: vec![], option_type: PerkValueVariant::SLIDER, } } - pub fn stacking_min(_stacks: u32, _min_stacks: u32) -> PerkOptionData { + pub fn stacking_min(stacks: u32, min_stacks: u32) -> PerkOptionData { PerkOptionData { - stacks: (_min_stacks, _stacks), + stacks: (min_stacks, stacks), options: vec![], option_type: PerkValueVariant::SLIDER, } } - pub fn options(_options: Vec<&str>) -> PerkOptionData { - let mut options = vec!["None".to_string()]; - for option in _options { - options.push(option.to_string()); + pub fn options(options: Vec<&str>) -> PerkOptionData { + let mut options_out = vec!["None".to_string()]; + for option in options { + options_out.push(option.to_string()); } PerkOptionData { - stacks: (0, options.len() as u32 - 1), - options, + stacks: (0, options_out.len() as u32 - 1), + options: options_out, option_type: PerkValueVariant::OPTIONS, } } - pub fn options_raw(_options: Vec<&str>) -> PerkOptionData { - let mut options = vec![]; - for option in _options { - options.push(option.to_string()); + pub fn options_raw(options: Vec<&str>) -> PerkOptionData { + let mut options_out = vec![]; + for option in options { + options_out.push(option.to_string()); } PerkOptionData { - stacks: (0, options.len() as u32 - 1), - options, + stacks: (0, options_out.len() as u32 - 1), + options: options_out, option_type: PerkValueVariant::OPTIONS, } } } -fn hash_to_perk_option_data(_hash: u32) -> Option { - let perk: Perks = enhanced_check(_hash).0.into(); +fn hash_to_perk_option_data(hash: u32) -> Option { + let perk: Perks = enhanced_check(hash).0.into(); match perk { //Meta perks Perks::BuiltIn => None, - Perks::RallyBarricade => Some(PerkOptionData::static_()), - Perks::EmpRift => Some(PerkOptionData::static_()), + Perks::RallyBarricade => Some(PerkOptionData::constant()), + Perks::EmpRift => Some(PerkOptionData::constant()), //intrinsics Perks::RapidFireFrame => Some(PerkOptionData::toggle()), - Perks::PrecisionFrame => Some(PerkOptionData::static_()), + Perks::PrecisionFrame => Some(PerkOptionData::constant()), //armor //parts - Perks::ImpactCasing => Some(PerkOptionData::static_()), - Perks::SwapMag => Some(PerkOptionData::static_()), - Perks::FullChoke => Some(PerkOptionData::static_()), - Perks::SpikeGrenades => Some(PerkOptionData::static_()), + Perks::ImpactCasing => Some(PerkOptionData::constant()), + Perks::SwapMag => Some(PerkOptionData::constant()), + Perks::FullChoke => Some(PerkOptionData::constant()), + Perks::SpikeGrenades => Some(PerkOptionData::constant()), Perks::AlloyMag => Some(PerkOptionData::toggle()), - Perks::LiquidCoils => Some(PerkOptionData::static_()), - Perks::AcceleratedCoils => Some(PerkOptionData::static_()), - Perks::ChargetimeMW => Some(PerkOptionData::static_()), - Perks::DisorientingGrenades => Some(PerkOptionData::static_()), - Perks::AssaultMag => Some(PerkOptionData::static_()), - Perks::AdeptChargeTime => Some(PerkOptionData::static_()), - Perks::PhaseMag => Some(PerkOptionData::static_()), + Perks::LiquidCoils => Some(PerkOptionData::constant()), + Perks::AcceleratedCoils => Some(PerkOptionData::constant()), + Perks::ChargetimeMW => Some(PerkOptionData::constant()), + Perks::DisorientingGrenades => Some(PerkOptionData::constant()), + Perks::AssaultMag => Some(PerkOptionData::constant()), + Perks::AdeptChargeTime => Some(PerkOptionData::constant()), + Perks::PhaseMag => Some(PerkOptionData::constant()), //bow strings - Perks::SlowerStringT1 => Some(PerkOptionData::static_()), - Perks::FasterStringT1 => Some(PerkOptionData::static_()), - Perks::FasterStringT2 => Some(PerkOptionData::static_()), + Perks::SlowerStringT1 => Some(PerkOptionData::constant()), + Perks::FasterStringT1 => Some(PerkOptionData::constant()), + Perks::FasterStringT2 => Some(PerkOptionData::constant()), //mods - Perks::QuickAccessSling => Some(PerkOptionData::static_()), - Perks::BossSpec => Some(PerkOptionData::static_()), - Perks::MajorSpec => Some(PerkOptionData::static_()), - Perks::MinorSpec => Some(PerkOptionData::static_()), - Perks::BigOnesSpec => Some(PerkOptionData::static_()), + Perks::QuickAccessSling => Some(PerkOptionData::constant()), + Perks::BossSpec => Some(PerkOptionData::constant()), + Perks::MajorSpec => Some(PerkOptionData::constant()), + Perks::MinorSpec => Some(PerkOptionData::constant()), + Perks::BigOnesSpec => Some(PerkOptionData::constant()), Perks::TakenSpec => Some(PerkOptionData::toggle()), - Perks::FreehandGrip => Some(PerkOptionData::static_()), + Perks::FreehandGrip => Some(PerkOptionData::constant()), //origin | year 5+ Perks::VeistStinger => Some(PerkOptionData::toggle()), - Perks::HakkeBreach => Some(PerkOptionData::options(["Vehicle", "Stasis Crystals", "Other Constructs"].to_vec())), + Perks::HakkeBreach => Some(PerkOptionData::options( + ["Vehicle", "Stasis Crystals", "Other Constructs"].to_vec(), + )), Perks::Alacrity => Some(PerkOptionData::toggle()), Perks::FluidDynamics => Some(PerkOptionData::toggle()), Perks::QuietMoment => Some(PerkOptionData::toggle()), @@ -141,21 +143,21 @@ fn hash_to_perk_option_data(_hash: u32) -> Option { Perks::OpeningShot => Some(PerkOptionData::toggle()), Perks::MovingTarget => Some(PerkOptionData::toggle()), Perks::AmbitiousAssassin => Some(PerkOptionData::stacking(15)), - Perks::ClusterBomb => Some(PerkOptionData::static_()), - Perks::ExplosivePayload => Some(PerkOptionData::static_()), + Perks::ClusterBomb => Some(PerkOptionData::constant()), + Perks::ExplosivePayload => Some(PerkOptionData::constant()), Perks::FirmlyPlanted => Some(PerkOptionData::toggle()), - Perks::FullAutoTrigger => Some(PerkOptionData::static_()), - Perks::HeadSeeker => Some(PerkOptionData::static_()), - Perks::HighImpactReserves => Some(PerkOptionData::static_()), + Perks::FullAutoTrigger => Some(PerkOptionData::constant()), + Perks::HeadSeeker => Some(PerkOptionData::constant()), + Perks::HighImpactReserves => Some(PerkOptionData::constant()), Perks::HipFireGrip => Some(PerkOptionData::toggle()), - Perks::Snapshot => Some(PerkOptionData::static_()), + Perks::Snapshot => Some(PerkOptionData::constant()), Perks::TapTheTrigger => Some(PerkOptionData::toggle()), Perks::SlideWays => Some(PerkOptionData::toggle()), Perks::QuickDraw => Some(PerkOptionData::toggle()), - Perks::TimedPayload => Some(PerkOptionData::static_()), + Perks::TimedPayload => Some(PerkOptionData::constant()), Perks::ThreatDetector => Some(PerkOptionData::stacking(2)), Perks::SlideShot => Some(PerkOptionData::toggle()), - Perks::TripleTap => Some(PerkOptionData::static_()), + Perks::TripleTap => Some(PerkOptionData::constant()), Perks::UnderPressure => Some(PerkOptionData::toggle()), Perks::PulseMonitor => Some(PerkOptionData::toggle()), @@ -163,7 +165,7 @@ fn hash_to_perk_option_data(_hash: u32) -> Option { //lmao bozo //season 3 | year 1 - Perks::RangeFinder => Some(PerkOptionData::static_()), + Perks::RangeFinder => Some(PerkOptionData::constant()), Perks::DisruptionBreak => Some(PerkOptionData::toggle()), Perks::TrenchBarrel => Some(PerkOptionData::toggle()), Perks::Desperado => Some(PerkOptionData::toggle()), @@ -171,13 +173,13 @@ fn hash_to_perk_option_data(_hash: u32) -> Option { //season 4 | year 2 Perks::ArchersTempo => Some(PerkOptionData::toggle()), - Perks::ExplosiveHead => Some(PerkOptionData::static_()), + Perks::ExplosiveHead => Some(PerkOptionData::constant()), Perks::FeedingFrenzy => Some(PerkOptionData::stacking(5)), - Perks::FourthTimesTheCharm => Some(PerkOptionData::static_()), + Perks::FourthTimesTheCharm => Some(PerkOptionData::constant()), Perks::RapidHit => Some(PerkOptionData::stacking(5)), //season 5 | year 2 - Perks::ResevoirBurst => Some(PerkOptionData::static_()), + Perks::ResevoirBurst => Some(PerkOptionData::constant()), Perks::Surrounded => Some(PerkOptionData::toggle()), Perks::AirAssault => Some(PerkOptionData::stacking(2)), @@ -200,11 +202,11 @@ fn hash_to_perk_option_data(_hash: u32) -> Option { //TODO //season 9 | year 3 - Perks::ClownCartridge => Some(PerkOptionData::static_()), + Perks::ClownCartridge => Some(PerkOptionData::constant()), Perks::ElementalCapacitor => Some(PerkOptionData::options( ["Void", "Solar", "Arc", "Stasis", "Strand"].to_vec(), )), - Perks::Vorpal => Some(PerkOptionData::static_()), + Perks::Vorpal => Some(PerkOptionData::constant()), //season 10 | year 3 //bad season lmao @@ -213,22 +215,22 @@ fn hash_to_perk_option_data(_hash: u32) -> Option { Perks::KillingWind => Some(PerkOptionData::toggle()), //season 12 | year 4 - Perks::DualLoader => Some(PerkOptionData::static_()), + Perks::DualLoader => Some(PerkOptionData::constant()), Perks::OneForAll => Some(PerkOptionData::toggle()), Perks::Recombination => Some(PerkOptionData::stacking(10)), Perks::Reconstruction => Some(PerkOptionData::toggle()), Perks::Surplus => Some(PerkOptionData::stacking(3)), //season 13 | year 4 - Perks::ImpulseAmplifier => Some(PerkOptionData::static_()), + Perks::ImpulseAmplifier => Some(PerkOptionData::constant()), Perks::Frenzy => Some(PerkOptionData::toggle()), - Perks::LastingImpression => Some(PerkOptionData::static_()), + Perks::LastingImpression => Some(PerkOptionData::constant()), Perks::KickStart => Some(PerkOptionData::toggle()), //season 14 | year 4 Perks::Cornered => Some(PerkOptionData::toggle()), Perks::AdrenalineJunkie => Some(PerkOptionData::stacking(5)), - Perks::RewindRounds => Some(PerkOptionData::static_()), + Perks::RewindRounds => Some(PerkOptionData::constant()), Perks::HeatingUp => Some(PerkOptionData::stacking(2)), Perks::FireFly => Some(PerkOptionData::toggle()), Perks::DangerZone => Some(PerkOptionData::toggle()), @@ -246,7 +248,7 @@ fn hash_to_perk_option_data(_hash: u32) -> Option { Perks::BaitAndSwitch => Some(PerkOptionData::toggle()), Perks::CompulsiveReloader => Some(PerkOptionData::toggle()), Perks::FocusedFury => Some(PerkOptionData::toggle()), - Perks::ChillClip => Some(PerkOptionData::static_()), + Perks::ChillClip => Some(PerkOptionData::constant()), Perks::SleightOfHand => Some(PerkOptionData::stacking(3)), Perks::StatsForAll => Some(PerkOptionData::toggle()), Perks::SteadyHands => Some(PerkOptionData::toggle()), @@ -260,8 +262,8 @@ fn hash_to_perk_option_data(_hash: u32) -> Option { //season 18 | year 5 Perks::GutShot => Some(PerkOptionData::toggle()), Perks::Pugilist => Some(PerkOptionData::toggle()), - Perks::Slickdraw => Some(PerkOptionData::static_()), - Perks::UnderOver => Some(PerkOptionData::static_()), + Perks::Slickdraw => Some(PerkOptionData::constant()), + Perks::UnderOver => Some(PerkOptionData::constant()), //season 19 | year 5 Perks::CascadePoint => Some(PerkOptionData::toggle()), @@ -269,7 +271,7 @@ fn hash_to_perk_option_data(_hash: u32) -> Option { Perks::OffhandStrike => Some(PerkOptionData::toggle()), Perks::PerfectFloat => Some(PerkOptionData::toggle()), Perks::ShotSwap => Some(PerkOptionData::toggle()), - Perks::TargetLock => Some(PerkOptionData::static_()), + Perks::TargetLock => Some(PerkOptionData::constant()), //season 20 | year 6 Perks::KeepAway => Some(PerkOptionData::toggle()), @@ -278,7 +280,7 @@ fn hash_to_perk_option_data(_hash: u32) -> Option { //season 21 | year 6 Perks::CollectiveAction => Some(PerkOptionData::toggle()), - Perks::Bipod => Some(PerkOptionData::static_()), + Perks::Bipod => Some(PerkOptionData::constant()), Perks::ControlledBurst => Some(PerkOptionData::toggle()), Perks::InvisibleHand => Some(PerkOptionData::toggle()), Perks::UnsatedHunger => Some(PerkOptionData::toggle()), @@ -298,14 +300,14 @@ fn hash_to_perk_option_data(_hash: u32) -> Option { //exotics Perks::CranialSpike => Some(PerkOptionData::stacking(5)), Perks::DarkForgedTrigger => Some(PerkOptionData::toggle()), - Perks::AgersCall => Some(PerkOptionData::static_()), + Perks::AgersCall => Some(PerkOptionData::constant()), Perks::LagragianSight => Some(PerkOptionData::toggle()), Perks::StringofCurses => Some(PerkOptionData::stacking(5)), Perks::WormsHunger => Some(PerkOptionData::stacking(20)), Perks::WormByproduct => Some(PerkOptionData::toggle()), - Perks::RocketTracers => Some(PerkOptionData::static_()), + Perks::RocketTracers => Some(PerkOptionData::constant()), Perks::ParacausalShot => Some(PerkOptionData::stacking(7)), - Perks::CorruptionSpreads => Some(PerkOptionData::static_()), + Perks::CorruptionSpreads => Some(PerkOptionData::constant()), Perks::TimeSlip => Some(PerkOptionData::toggle()), Perks::ToM => Some(PerkOptionData::toggle()), Perks::IgnitionTrigger => Some(PerkOptionData::toggle()), @@ -313,18 +315,18 @@ fn hash_to_perk_option_data(_hash: u32) -> Option { Perks::ConserveMomentum => Some(PerkOptionData::stacking(15)), Perks::Impetus => Some(PerkOptionData::toggle()), Perks::FirstGlance => Some(PerkOptionData::toggle()), - Perks::PerfectFith => Some(PerkOptionData::static_()), + Perks::PerfectFith => Some(PerkOptionData::constant()), Perks::Broadside => Some(PerkOptionData::stacking(4)), Perks::FourthHorsemanCatalyst => Some(PerkOptionData::toggle()), - Perks::Stormbringer => Some(PerkOptionData::static_()), - Perks::PrismaticInferno => Some(PerkOptionData::static_()), + Perks::Stormbringer => Some(PerkOptionData::constant()), + Perks::PrismaticInferno => Some(PerkOptionData::constant()), Perks::ReignHavoc => Some(PerkOptionData::toggle()), Perks::WhisperCatalyst => Some(PerkOptionData::toggle()), Perks::Roadborn => Some(PerkOptionData::toggle()), Perks::SwoopingTalons => Some(PerkOptionData::toggle()), Perks::CalculatedBalance => Some(PerkOptionData::toggle()), Perks::RavenousBeast => Some(PerkOptionData::toggle()), - Perks::LordOfWolvesCatalyst => Some(PerkOptionData::static_()), + Perks::LordOfWolvesCatalyst => Some(PerkOptionData::constant()), Perks::ReleaseTheWolves => Some(PerkOptionData::toggle()), Perks::Fundamentals => Some(PerkOptionData::options(["Void", "Solar", "Arc"].to_vec())), Perks::ThinTheHerd => Some(PerkOptionData::toggle()), @@ -337,24 +339,24 @@ fn hash_to_perk_option_data(_hash: u32) -> Option { Perks::MarkovChain => Some(PerkOptionData::stacking(5)), Perks::StormAndStress => Some(PerkOptionData::toggle()), Perks::DualSpeedReceiver => Some(PerkOptionData::toggle()), - Perks::ExplosiveShadow => Some(PerkOptionData::static_()), - Perks::SurosLegacy => Some(PerkOptionData::static_()), + Perks::ExplosiveShadow => Some(PerkOptionData::constant()), + Perks::SurosLegacy => Some(PerkOptionData::constant()), Perks::SpinningUp => Some(PerkOptionData::stacking(2)), Perks::DarkDescent => Some(PerkOptionData::toggle()), - Perks::SleeperCatalyst => Some(PerkOptionData::static_()), + Perks::SleeperCatalyst => Some(PerkOptionData::constant()), Perks::TargetAquired => Some(PerkOptionData::toggle()), Perks::RatPack => Some(PerkOptionData::stacking_min(5, 1)), - Perks::HuntersTrance => Some(PerkOptionData::static_()), + Perks::HuntersTrance => Some(PerkOptionData::constant()), Perks::RideTheBull => Some(PerkOptionData::stacking(2)), Perks::NobleRounds => Some(PerkOptionData::toggle()), Perks::MementoMori => Some(PerkOptionData::toggle()), - Perks::TractorCannon => Some(PerkOptionData::static_()), + Perks::TractorCannon => Some(PerkOptionData::constant()), Perks::HarmonicLaser => Some(PerkOptionData::stacking(2)), Perks::AgersScepterCatalyst => Some(PerkOptionData::toggle()), Perks::ColdFusion => Some(PerkOptionData::toggle()), - Perks::BlackHole => Some(PerkOptionData::static_()), + Perks::BlackHole => Some(PerkOptionData::constant()), Perks::TemporalUnlimiter => Some(PerkOptionData::toggle()), - Perks::MarksmanSights => Some(PerkOptionData::static_()), + Perks::MarksmanSights => Some(PerkOptionData::constant()), Perks::DexterityMod => Some(PerkOptionData::stacking(3)), Perks::ReserveMod => Some(PerkOptionData::stacking(3)), Perks::LoaderMod => Some(PerkOptionData::stacking(3)), @@ -369,16 +371,16 @@ fn hash_to_perk_option_data(_hash: u32) -> Option { Perks::HeatRises => Some(PerkOptionData::toggle()), Perks::FlowState => Some(PerkOptionData::toggle()), Perks::ThreadOfAscent => Some(PerkOptionData::toggle()), - Perks::WellOfRadiance => Some(PerkOptionData::static_()), - Perks::Amplified => Some(PerkOptionData::static_()), - Perks::Radiant => Some(PerkOptionData::static_()), - Perks::Weaken => Some(PerkOptionData::static_()), - Perks::Sever => Some(PerkOptionData::static_()), - Perks::WardOfDawn => Some(PerkOptionData::static_()), - Perks::BannerShield => Some(PerkOptionData::static_()), - Perks::DeadFall => Some(PerkOptionData::static_()), - Perks::MoebiusQuiver => Some(PerkOptionData::static_()), - Perks::Broadhead => Some(PerkOptionData::static_()), + Perks::WellOfRadiance => Some(PerkOptionData::constant()), + Perks::Amplified => Some(PerkOptionData::constant()), + Perks::Radiant => Some(PerkOptionData::constant()), + Perks::Weaken => Some(PerkOptionData::constant()), + Perks::Sever => Some(PerkOptionData::constant()), + Perks::WardOfDawn => Some(PerkOptionData::constant()), + Perks::BannerShield => Some(PerkOptionData::constant()), + Perks::DeadFall => Some(PerkOptionData::constant()), + Perks::MoebiusQuiver => Some(PerkOptionData::constant()), + Perks::Broadhead => Some(PerkOptionData::constant()), Perks::HuntersTrace => Some(PerkOptionData::toggle()), Perks::Desperation => Some(PerkOptionData::toggle()), Perks::IonicReturn => Some(PerkOptionData::toggle()), @@ -387,10 +389,10 @@ fn hash_to_perk_option_data(_hash: u32) -> Option { Perks::VoidLeech => Some(PerkOptionData::toggle()), Perks::DragonShadow => Some(PerkOptionData::toggle()), - Perks::OphidianAspect => Some(PerkOptionData::static_()), + Perks::OphidianAspect => Some(PerkOptionData::constant()), Perks::TomeOfDawn => Some(PerkOptionData::toggle()), Perks::PathOfTheBurningSteps => Some(PerkOptionData::stacking(4)), - Perks::MantleOfBattleHarmony => Some(PerkOptionData::static_()), + Perks::MantleOfBattleHarmony => Some(PerkOptionData::constant()), Perks::MaskOfBakris => Some(PerkOptionData::toggle()), Perks::BallindorseWrathweavers => Some(PerkOptionData::toggle()), Perks::LunaFaction => Some(PerkOptionData::options( @@ -398,21 +400,21 @@ fn hash_to_perk_option_data(_hash: u32) -> Option { )), Perks::KnuckleheadRadar => Some(PerkOptionData::toggle()), Perks::MechaneersTricksleeves => Some(PerkOptionData::toggle()), - Perks::Oathkeeper => Some(PerkOptionData::static_()), + Perks::Oathkeeper => Some(PerkOptionData::constant()), Perks::SealedAhamkaraGrasps => Some(PerkOptionData::toggle()), Perks::LuckyPants => Some(PerkOptionData::stacking(10)), Perks::NoBackupPlans => Some(PerkOptionData::toggle()), - Perks::ActiumWarRig => Some(PerkOptionData::static_()), - Perks::HallowfireHeart => Some(PerkOptionData::static_()), + Perks::ActiumWarRig => Some(PerkOptionData::constant()), + Perks::HallowfireHeart => Some(PerkOptionData::constant()), Perks::LionRampart => Some(PerkOptionData::toggle()), - Perks::Peacekeepers => Some(PerkOptionData::static_()), - Perks::EyeOfAnotherWorld => Some(PerkOptionData::static_()), + Perks::Peacekeepers => Some(PerkOptionData::constant()), + Perks::EyeOfAnotherWorld => Some(PerkOptionData::constant()), Perks::AstrocyteVerse => Some(PerkOptionData::toggle()), - Perks::NecroticGrips => Some(PerkOptionData::static_()), - Perks::BootsOfTheAssembler => Some(PerkOptionData::static_()), - Perks::RainOfFire => Some(PerkOptionData::static_()), + Perks::NecroticGrips => Some(PerkOptionData::constant()), + Perks::BootsOfTheAssembler => Some(PerkOptionData::constant()), + Perks::RainOfFire => Some(PerkOptionData::constant()), Perks::SpeedloaderSlacks => Some(PerkOptionData::stacking(5)), - Perks::PeregrineGreaves => Some(PerkOptionData::static_()), + Perks::PeregrineGreaves => Some(PerkOptionData::constant()), Perks::Gyrfalcon => Some(PerkOptionData::toggle()), Perks::AeonInsight => Some(PerkOptionData::toggle()), Perks::Felwinters => Some(PerkOptionData::toggle()), @@ -424,27 +426,27 @@ fn hash_to_perk_option_data(_hash: u32) -> Option { //misc Perks::UmbralSharpening => Some(PerkOptionData::stacking(5)), Perks::EnhancedScannerAugment => Some(PerkOptionData::toggle()), - Perks::Demolitionist => Some(PerkOptionData::static_()), - Perks::FullStop => Some(PerkOptionData::static_()), - Perks::HakkeHeavyBurst => Some(PerkOptionData::static_()), + Perks::Demolitionist => Some(PerkOptionData::constant()), + Perks::FullStop => Some(PerkOptionData::constant()), + Perks::HakkeHeavyBurst => Some(PerkOptionData::constant()), Perks::EternalWarrior => Some(PerkOptionData::stacking(4)), Perks::Ignore => None, } } -pub fn enh_hash_to_perk_option_data(_hash: u32) -> Option { - let perk: Perks = enhanced_check(_hash).0.into(); +pub fn enh_hash_to_perk_option_data(hash: u32) -> Option { + let perk: Perks = enhanced_check(hash).0.into(); match perk { Perks::Recombination => Some(PerkOptionData::stacking(8)), Perks::ExplosiveLight => Some(PerkOptionData::stacking(7)), - _ => hash_to_perk_option_data(_hash), + _ => hash_to_perk_option_data(hash), } } -pub fn get_perk_options(_perks: Vec) -> HashMap { +pub fn get_perk_options(perks: Vec) -> HashMap { let mut options = HashMap::new(); - for perk in _perks { + for perk in perks { // let data = if _input._is_enhanced {enh_hash_to_perk_option_data(perk)} else {hash_to_perk_option_data(perk)}; let data = hash_to_perk_option_data(perk); if let Some(value) = data { diff --git a/src/perks/year_1_perks.rs b/src/perks/year_1_perks.rs index e9fc62f6..6b732d6d 100644 --- a/src/perks/year_1_perks.rs +++ b/src/perks/year_1_perks.rs @@ -21,33 +21,31 @@ use super::{ pub fn year_1_perks() { add_sbr( Perks::ThreatDetector, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - let stats = match _input.value { - 0 => (0, 0, 0), - 1 => (15, 15, 25), - _ => (40, 55, 100), - }; - let mut out = HashMap::new(); - out.insert(StatHashes::STABILITY.into(), stats.0); - out.insert(StatHashes::RELOAD.into(), stats.1); - out.insert(StatHashes::HANDLING.into(), stats.2); - out - }, - ), + |input: ModifierResponseInput| -> HashMap { + let stats = match input.value { + 0 => (0, 0, 0), + 1 => (15, 15, 25), + _ => (40, 55, 100), + }; + let mut out = HashMap::new(); + out.insert(StatHashes::STABILITY.into(), stats.0); + out.insert(StatHashes::RELOAD.into(), stats.1); + out.insert(StatHashes::HANDLING.into(), stats.2); + out + }, ); add_dmr( Perks::HighImpactReserves, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let mut out_dmg_scale = 1.0; - let base = if _input.pvp { 0.03 } else { 0.121 }; - let max = if _input.pvp { 0.06 } else { 0.256 }; - let threshold_divisor = if _input.is_enhanced { 4.0 / 3.0 } else { 2.0 }; - if _input.calc_data.curr_mag <= _input.calc_data.curr_mag / threshold_divisor { + let base = if input.pvp { 0.03 } else { 0.121 }; + let max = if input.pvp { 0.06 } else { 0.256 }; + let threshold_divisor = if input.is_enhanced { 4.0 / 3.0 } else { 2.0 }; + if input.calc_data.curr_mag <= input.calc_data.curr_mag / threshold_divisor { let t = 1.0 - - (_input.calc_data.curr_mag - 1.0) - / ((_input.calc_data.base_mag / threshold_divisor) - 1.0); + - (input.calc_data.curr_mag - 1.0) + / ((input.calc_data.base_mag / threshold_divisor) - 1.0); if t > 0.0 { out_dmg_scale = lerp(base, max, t); } @@ -57,83 +55,79 @@ pub fn year_1_perks() { explosive_dmg_scale: out_dmg_scale, crit_scale: 1.0, } - }), + }, ); //Confirmed by harm <3 add_hmr( Perks::ThreatDetector, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let val = clamp(_input.value, 0, 2) as i32; - let stat = match val { - 0 => 0, - 1 => 25, - 2 => 100, - _ => 100, - }; - let time_scale = 0.9_f64.powi(val); - HandlingModifierResponse { - stat_add: stat, - draw_scale: time_scale, - stow_scale: time_scale, - ads_scale: time_scale, - ..Default::default() - } - }, - ), + |input: ModifierResponseInput| -> HandlingModifierResponse { + let val = clamp(input.value, 0, 2) as i32; + let stat = match val { + 0 => 0, + 1 => 25, + 2 => 100, + _ => 100, + }; + let time_scale = 0.9_f64.powi(val); + HandlingModifierResponse { + stat_add: stat, + draw_scale: time_scale, + stow_scale: time_scale, + ads_scale: time_scale, + ..Default::default() + } + }, ); add_rsmr( Perks::ThreatDetector, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { + |input: ModifierResponseInput| -> ReloadModifierResponse { let mut reload = 0; - if _input.value == 1 { + if input.value == 1 { reload = 15; - } else if _input.value == 2 { + } else if input.value == 2 { reload = 55; }; ReloadModifierResponse { reload_stat_add: reload, reload_time_scale: 1.0, } - }), + }, ); add_mmr( Perks::AmbitiousAssassin, - Box::new( - |_input: ModifierResponseInput| -> MagazineModifierResponse { - let val = clamp(_input.value, 0, 15) as f64; - if _input.calc_data.total_shots_fired == 0.0 { - let mut mag_mult = 1.0; - if *_input.calc_data.ammo_type == AmmoType::PRIMARY { - mag_mult += 0.2 * val; - } else { - mag_mult += 0.1 * val; - }; - return MagazineModifierResponse { - magazine_stat_add: 0, - magazine_scale: clamp(mag_mult, 1.0, 2.5), - magazine_add: 0.0, - }; + |input: ModifierResponseInput| -> MagazineModifierResponse { + let val = clamp(input.value, 0, 15) as f64; + if input.calc_data.total_shots_fired == 0.0 { + let mut mag_mult = 1.0; + if *input.calc_data.ammo_type == AmmoType::PRIMARY { + mag_mult += 0.2 * val; + } else { + mag_mult += 0.1 * val; }; - MagazineModifierResponse { + return MagazineModifierResponse { magazine_stat_add: 0, - magazine_scale: 1.0, + magazine_scale: clamp(mag_mult, 1.0, 2.5), magazine_add: 0.0, - } - }, - ), + }; + }; + MagazineModifierResponse { + magazine_stat_add: 0, + magazine_scale: 1.0, + magazine_add: 0.0, + } + }, ); add_dmr( Perks::BoxBreathing, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.calc_data.total_shots_fired == 0.0 && _input.value > 0 { + |input: ModifierResponseInput| -> DamageModifierResponse { + if input.calc_data.total_shots_fired == 0.0 && input.value > 0 { let mut crit_mult = - (_input.calc_data.base_crit_mult + 1.0) / _input.calc_data.base_crit_mult; - if *_input.calc_data.weapon_type == WeaponType::SCOUTRIFLE { + (input.calc_data.base_crit_mult + 1.0) / input.calc_data.base_crit_mult; + if *input.calc_data.weapon_type == WeaponType::SCOUTRIFLE { crit_mult *= 0.95; } return DamageModifierResponse { @@ -143,28 +137,28 @@ pub fn year_1_perks() { }; }; DamageModifierResponse::default() - }), + }, ); add_fmr( Perks::Desperado, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { + |input: ModifierResponseInput| -> FiringModifierResponse { let mut delay_mult = 1.0; - let duration = if _input.is_enhanced { 7.0 } else { 6.0 }; - if _input.calc_data.time_total < duration && _input.value > 0 { + let duration = if input.is_enhanced { 7.0 } else { 6.0 }; + if input.calc_data.time_total < duration && input.value > 0 { delay_mult = 0.7; }; FiringModifierResponse { burst_delay_scale: delay_mult, ..Default::default() } - }), + }, ); add_dmr( Perks::ExplosivePayload, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.pvp { + |input: ModifierResponseInput| -> DamageModifierResponse { + if input.pvp { DamageModifierResponse::default() } else { DamageModifierResponse { @@ -173,160 +167,146 @@ pub fn year_1_perks() { crit_scale: 1.0, } } - }), + }, ); add_epr( Perks::ExplosivePayload, - Box::new( - |_input: ModifierResponseInput| -> ExplosivePercentResponse { - ExplosivePercentResponse { - percent: 0.5, - delyed: 0.0, - retain_base_total: true, - } - }, - ), + |_: ModifierResponseInput| -> ExplosivePercentResponse { + ExplosivePercentResponse { + percent: 0.5, + delyed: 0.0, + retain_base_total: true, + } + }, ); add_dmr( Perks::TimedPayload, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.pvp { + |input: ModifierResponseInput| -> DamageModifierResponse { + if input.pvp { DamageModifierResponse::default() } else { - // let damage_mult = ((1.0 / _input.calc_data.base_crit_mult) * 0.15) + 1.0; + // let damage_mult = ((1.0 / input.calc_data.base_crit_mult) * 0.15) + 1.0; DamageModifierResponse { impact_dmg_scale: 1.0, explosive_dmg_scale: 1.3, crit_scale: 1.0, } } - }), + }, ); add_epr( Perks::TimedPayload, - Box::new( - |_input: ModifierResponseInput| -> ExplosivePercentResponse { - ExplosivePercentResponse { - percent: 0.5, - delyed: 0.6, - retain_base_total: true, - } - }, - ), + |_: ModifierResponseInput| -> ExplosivePercentResponse { + ExplosivePercentResponse { + percent: 0.5, + delyed: 0.6, + retain_base_total: true, + } + }, ); add_sbr( Perks::FieldPrep, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - let mut out = HashMap::new(); - if _input.value > 0 { - let reload = if _input.is_enhanced { 55 } else { 50 }; - out.insert(StatHashes::RELOAD.into(), reload); - }; - let mut reserves = if _input.is_enhanced { 40 } else { 30 }; - if *_input.calc_data.weapon_type == WeaponType::GRENADELAUNCHER { - reserves -= 10; - }; - out.insert(StatHashes::INVENTORY_SIZE.into(), reserves); - out - }, - ), + |input: ModifierResponseInput| -> HashMap { + let mut out = HashMap::new(); + if input.value > 0 { + let reload = if input.is_enhanced { 55 } else { 50 }; + out.insert(StatHashes::RELOAD.into(), reload); + }; + let mut reserves = if input.is_enhanced { 40 } else { 30 }; + if *input.calc_data.weapon_type == WeaponType::GRENADELAUNCHER { + reserves -= 10; + }; + out.insert(StatHashes::INVENTORY_SIZE.into(), reserves); + out + }, ); add_rsmr( Perks::FieldPrep, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { + |input: ModifierResponseInput| -> ReloadModifierResponse { let mut reload = 0; let mut reload_mult = 1.0; - if _input.value > 0 { - reload = if _input.is_enhanced { 55 } else { 50 }; - reload_mult = if _input.is_enhanced { 0.77 } else { 0.8 }; + if input.value > 0 { + reload = if input.is_enhanced { 55 } else { 50 }; + reload_mult = if input.is_enhanced { 0.77 } else { 0.8 }; }; ReloadModifierResponse { reload_stat_add: reload, reload_time_scale: reload_mult, } - }), + }, ); add_imr( Perks::FieldPrep, - Box::new( - |_input: ModifierResponseInput| -> InventoryModifierResponse { - InventoryModifierResponse { - inv_stat_add: if _input.is_enhanced { 40 } else { 30 }, - ..Default::default() - } - }, - ), + |input: ModifierResponseInput| -> InventoryModifierResponse { + InventoryModifierResponse { + inv_stat_add: if input.is_enhanced { 40 } else { 30 }, + ..Default::default() + } + }, ); add_hmr( Perks::FieldPrep, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value >= 1 { - HandlingModifierResponse { - stow_scale: 0.8, - draw_scale: 0.8, - ..Default::default() - } - } else { - HandlingModifierResponse::default() + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value >= 1 { + HandlingModifierResponse { + stow_scale: 0.8, + draw_scale: 0.8, + ..Default::default() } - }, - ), + } else { + HandlingModifierResponse::default() + } + }, ); add_sbr( Perks::FirmlyPlanted, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - let mut handling = if _input.is_enhanced { 35 } else { 30 }; - let mut stabiltiy = if _input.is_enhanced { 25 } else { 20 }; - if *_input.calc_data.weapon_type == WeaponType::FUSIONRIFLE { - handling /= 2; - stabiltiy /= 2; - }; - let mut out = HashMap::new(); - if _input.value > 0 { - out.insert(StatHashes::HANDLING.into(), handling); - out.insert(StatHashes::STABILITY.into(), stabiltiy); - } - out - }, - ), + |input: ModifierResponseInput| -> HashMap { + let mut handling = if input.is_enhanced { 35 } else { 30 }; + let mut stabiltiy = if input.is_enhanced { 25 } else { 20 }; + if *input.calc_data.weapon_type == WeaponType::FUSIONRIFLE { + handling /= 2; + stabiltiy /= 2; + }; + let mut out = HashMap::new(); + if input.value > 0 { + out.insert(StatHashes::HANDLING.into(), handling); + out.insert(StatHashes::STABILITY.into(), stabiltiy); + } + out + }, ); add_hmr( Perks::FirmlyPlanted, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let mut handling = if _input.is_enhanced { 35 } else { 30 }; - if *_input.calc_data.weapon_type == WeaponType::FUSIONRIFLE { - handling /= 2; - }; - if _input.value > 0 { - HandlingModifierResponse { - stat_add: handling, - ..Default::default() - } - } else { - HandlingModifierResponse::default() + |input: ModifierResponseInput| -> HandlingModifierResponse { + let mut handling = if input.is_enhanced { 35 } else { 30 }; + if *input.calc_data.weapon_type == WeaponType::FUSIONRIFLE { + handling /= 2; + }; + if input.value > 0 { + HandlingModifierResponse { + stat_add: handling, + ..Default::default() } - }, - ), + } else { + HandlingModifierResponse::default() + } + }, ); add_fmr( Perks::FullAutoTrigger, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { + |input: ModifierResponseInput| -> FiringModifierResponse { let mut delay_mult = 1.0; - if *_input.calc_data.weapon_type == WeaponType::SHOTGUN { + if *input.calc_data.weapon_type == WeaponType::SHOTGUN { delay_mult = 0.91; }; FiringModifierResponse { @@ -335,42 +315,40 @@ pub fn year_1_perks() { inner_burst_scale: 1.0, burst_size_add: 0.0, } - }), + }, ); add_rr( Perks::TripleTap, - Box::new(|_input: ModifierResponseInput| -> RefundResponse { + |_: ModifierResponseInput| -> RefundResponse { RefundResponse { crit: true, requirement: 3, refund_mag: 1, refund_reserves: 0, } - }), + }, ); add_sbr( Perks::HipFireGrip, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - let mut out = HashMap::new(); - if _input.value > 0 { - out.insert(StatHashes::AIM_ASSIST.into(), 15); - out.insert(StatHashes::STABILITY.into(), 25); - }; - out - }, - ), + |input: ModifierResponseInput| -> HashMap { + let mut out = HashMap::new(); + if input.value > 0 { + out.insert(StatHashes::AIM_ASSIST.into(), 15); + out.insert(StatHashes::STABILITY.into(), 25); + }; + out + }, ); add_rmr( Perks::HipFireGrip, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { + |input: ModifierResponseInput| -> RangeModifierResponse { let mut hf_range_scale = 1.2; - if *_input.calc_data.weapon_type == WeaponType::FUSIONRIFLE - || *_input.calc_data.weapon_type == WeaponType::SHOTGUN - || _input.calc_data.intrinsic_hash == 2770223582 + if *input.calc_data.weapon_type == WeaponType::FUSIONRIFLE + || *input.calc_data.weapon_type == WeaponType::SHOTGUN + || input.calc_data.intrinsic_hash == 2770223582 //last word { hf_range_scale = 1.0; @@ -381,62 +359,47 @@ pub fn year_1_perks() { range_hip_scale: hf_range_scale, range_zoom_scale: 1.0, } - }), - ); - - add_dmr( - Perks::ImpactCasing, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - DamageModifierResponse { - impact_dmg_scale: 1.1, - explosive_dmg_scale: 1.0, - crit_scale: 1.0, - } - }), + }, ); add_sbr( Perks::MovingTarget, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - let aim_assist = if _input.is_enhanced { 11 } else { 10 }; - let mut out = HashMap::new(); - if _input.value >= 1 { - out.insert(StatHashes::AIM_ASSIST.into(), aim_assist); - } - out - }, - ), + |input: ModifierResponseInput| -> HashMap { + let aim_assist = if input.is_enhanced { 11 } else { 10 }; + let mut out = HashMap::new(); + if input.value >= 1 { + out.insert(StatHashes::AIM_ASSIST.into(), aim_assist); + } + out + }, ); add_sbr( Perks::OpeningShot, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - let mut aim_assist:f64 = if _input.is_enhanced { 25.0 } else { 20.0 }; - let mut range: f64 = if _input.is_enhanced { 30.0 } else { 25.0 }; - let mut out = HashMap::new(); - if *_input.calc_data.ammo_type == AmmoType::SPECIAL { - aim_assist /= 2.0; - range /= 2.0; - } - if _input.value > 0 { - out.insert(StatHashes::AIM_ASSIST.into(), aim_assist.ceil() as i32); - out.insert(StatHashes::RANGE.into(), range.ceil() as i32); - } - out - }, - ), + |input: ModifierResponseInput| -> HashMap { + let mut aim_assist: f64 = if input.is_enhanced { 25.0 } else { 20.0 }; + let mut range: f64 = if input.is_enhanced { 30.0 } else { 25.0 }; + let mut out = HashMap::new(); + if *input.calc_data.ammo_type == AmmoType::SPECIAL { + aim_assist /= 2.0; + range /= 2.0; + } + if input.value > 0 { + out.insert(StatHashes::AIM_ASSIST.into(), aim_assist.ceil() as i32); + out.insert(StatHashes::RANGE.into(), range.ceil() as i32); + } + out + }, ); add_rmr( Perks::OpeningShot, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { - let mut range: f64 = if _input.is_enhanced { 30.0 } else { 25.0 }; - if _input.calc_data.total_shots_fired != 0.0 || _input.value == 0 { + |input: ModifierResponseInput| -> RangeModifierResponse { + let mut range: f64 = if input.is_enhanced { 30.0 } else { 25.0 }; + if input.calc_data.total_shots_fired != 0.0 || input.value == 0 { range = 0.0; }; - if *_input.calc_data.ammo_type == AmmoType::SPECIAL { + if *input.calc_data.ammo_type == AmmoType::SPECIAL { range /= 2.0; } RangeModifierResponse { @@ -445,27 +408,25 @@ pub fn year_1_perks() { range_hip_scale: 1.0, range_zoom_scale: 1.0, } - }), + }, ); add_sbr( Perks::Outlaw, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - let mut out = HashMap::new(); - if _input.value > 0 { - out.insert(StatHashes::RELOAD.into(), 70); - } - out - }, - ), + |input: ModifierResponseInput| -> HashMap { + let mut out = HashMap::new(); + if input.value > 0 { + out.insert(StatHashes::RELOAD.into(), 70); + } + out + }, ); add_rsmr( Perks::Outlaw, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - let duration = if _input.is_enhanced { 7.0 } else { 6.0 }; - if _input.value > 0 && _input.calc_data.time_total < duration { + |input: ModifierResponseInput| -> ReloadModifierResponse { + let duration = if input.is_enhanced { 7.0 } else { 6.0 }; + if input.value > 0 && input.calc_data.time_total < duration { ReloadModifierResponse { reload_stat_add: 70, reload_time_scale: 0.9, @@ -473,44 +434,40 @@ pub fn year_1_perks() { } else { ReloadModifierResponse::default() } - }), + }, ); add_vmr( Perks::RangeFinder, - Box::new( - |_input: ModifierResponseInput| -> VelocityModifierResponse { - VelocityModifierResponse { - velocity_scaler: 1.05, - } - }, - ), + |_: ModifierResponseInput| -> VelocityModifierResponse { + VelocityModifierResponse { + velocity_scaler: 1.05, + } + }, ); add_sbr( Perks::SlideShot, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - let stability = if _input.is_enhanced { 35 } else { 30 }; - let range = if _input.is_enhanced { 25 } else { 20 }; - let mut out = HashMap::new(); - if _input.value > 0 { - out.insert(StatHashes::STABILITY.into(), stability); - out.insert(StatHashes::RANGE.into(), range); - } - out - }, - ), + |input: ModifierResponseInput| -> HashMap { + let stability = if input.is_enhanced { 35 } else { 30 }; + let range = if input.is_enhanced { 25 } else { 20 }; + let mut out = HashMap::new(); + if input.value > 0 { + out.insert(StatHashes::STABILITY.into(), stability); + out.insert(StatHashes::RANGE.into(), range); + } + out + }, ); add_rmr( Perks::SlideShot, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { + |input: ModifierResponseInput| -> RangeModifierResponse { let range; - if *_input.calc_data.weapon_type == WeaponType::FUSIONRIFLE { + if *input.calc_data.weapon_type == WeaponType::FUSIONRIFLE { range = 0; //only applies to first proj so like should do alot less - } else if _input.value > 0 { - range = if _input.is_enhanced { 25 } else { 20 } + } else if input.value > 0 { + range = if input.is_enhanced { 25 } else { 20 } } else { range = 0; } @@ -518,81 +475,73 @@ pub fn year_1_perks() { range_stat_add: range, ..Default::default() } - }), + }, ); add_sbr( Perks::SlideWays, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - let stability = if _input.is_enhanced { 25 } else { 20 }; - let handling = if _input.is_enhanced { 25 } else { 20 }; - let mut out = HashMap::new(); - if _input.value > 0 { - out.insert(StatHashes::STABILITY.into(), stability); - out.insert(StatHashes::HANDLING.into(), handling); - } - out - }, - ), + |input: ModifierResponseInput| -> HashMap { + let stability = if input.is_enhanced { 25 } else { 20 }; + let handling = if input.is_enhanced { 25 } else { 20 }; + let mut out = HashMap::new(); + if input.value > 0 { + out.insert(StatHashes::STABILITY.into(), stability); + out.insert(StatHashes::HANDLING.into(), handling); + } + out + }, ); add_hmr( Perks::SlideWays, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let handling = if _input.value > 0 { 20 } else { 0 }; - HandlingModifierResponse { - stat_add: handling, - ..Default::default() - } - }, - ), + |input: ModifierResponseInput| -> HandlingModifierResponse { + let handling = if input.value > 0 { 20 } else { 0 }; + HandlingModifierResponse { + stat_add: handling, + ..Default::default() + } + }, ); add_hmr( Perks::Snapshot, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let mut ads_mult = 0.5; - if *_input.calc_data.ammo_type == AmmoType::SPECIAL { - ads_mult = 0.8; //its 0.8 from my testing idk - }; - HandlingModifierResponse { - ads_scale: ads_mult, - ..Default::default() - } - }, - ), + |input: ModifierResponseInput| -> HandlingModifierResponse { + let mut ads_mult = 0.5; + if *input.calc_data.ammo_type == AmmoType::SPECIAL { + ads_mult = 0.8; //its 0.8 from my testing idk + }; + HandlingModifierResponse { + ads_scale: ads_mult, + ..Default::default() + } + }, ); add_sbr( Perks::TapTheTrigger, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - let mut stability = if _input.is_enhanced { 44 } else { 40 }; - if *_input.calc_data.weapon_type == WeaponType::FUSIONRIFLE { - stability /= 4; - } - let mut out = HashMap::new(); - if _input.value > 0 { - out.insert(StatHashes::STABILITY.into(), stability); - } - out - }, - ), + |input: ModifierResponseInput| -> HashMap { + let mut stability = if input.is_enhanced { 44 } else { 40 }; + if *input.calc_data.weapon_type == WeaponType::FUSIONRIFLE { + stability /= 4; + } + let mut out = HashMap::new(); + if input.value > 0 { + out.insert(StatHashes::STABILITY.into(), stability); + } + out + }, ); add_dmr( Perks::Rampage, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let val = clamp(_input.value, 0, 3); + |input: ModifierResponseInput| -> DamageModifierResponse { + let val = clamp(input.value, 0, 3); let mut damage_mult = 1.1_f64.powi(val as i32) - 1.0; - let duration = if _input.is_enhanced { 5.0 } else { 4.0 }; - if _input.calc_data.time_total > duration { + let duration = if input.is_enhanced { 5.0 } else { 4.0 }; + if input.calc_data.time_total > duration { damage_mult = 0.0; }; - if _input.calc_data.perk_value_map.contains_key(&630329983) && !_input.pvp { + if input.calc_data.perk_value_map.contains_key(&630329983) && !input.pvp { //huckleberry damage_mult *= 2.0; } @@ -601,15 +550,15 @@ pub fn year_1_perks() { explosive_dmg_scale: 1.0 + damage_mult, crit_scale: 1.0, } - }), + }, ); add_dmr( Perks::KillClip, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let mut damage_mult = if _input.value > 0 { 0.25 } else { 0.0 }; - let duration = if _input.is_enhanced { 5.0 } else { 4.0 }; - if _input.calc_data.time_total > duration { + |input: ModifierResponseInput| -> DamageModifierResponse { + let mut damage_mult = if input.value > 0 { 0.25 } else { 0.0 }; + let duration = if input.is_enhanced { 5.0 } else { 4.0 }; + if input.calc_data.time_total > duration { damage_mult = 0.0; }; DamageModifierResponse { @@ -617,15 +566,15 @@ pub fn year_1_perks() { explosive_dmg_scale: 1.0 + damage_mult, crit_scale: 1.0, } - }), + }, ); add_dmr( Perks::BackupPlan, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let mut damage_mult = if _input.value > 0 { 0.2 } else { 0.0 }; - let duration = if _input.is_enhanced { 2.2 } else { 2.0 }; - if _input.calc_data.time_total > duration { + |input: ModifierResponseInput| -> DamageModifierResponse { + let mut damage_mult = if input.value > 0 { 0.2 } else { 0.0 }; + let duration = if input.is_enhanced { 2.2 } else { 2.0 }; + if input.calc_data.time_total > duration { damage_mult = 0.0; }; DamageModifierResponse { @@ -633,62 +582,58 @@ pub fn year_1_perks() { explosive_dmg_scale: 1.0 - damage_mult, crit_scale: 1.0, } - }), + }, ); add_fmr( Perks::BackupPlan, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { - let mut firing_mult = if _input.value > 0 { 0.7 } else { 1.0 }; - let duration = if _input.is_enhanced { 2.2 } else { 2.0 }; - if _input.calc_data.time_total > duration { + |input: ModifierResponseInput| -> FiringModifierResponse { + let mut firing_mult = if input.value > 0 { 0.7 } else { 1.0 }; + let duration = if input.is_enhanced { 2.2 } else { 2.0 }; + if input.calc_data.time_total > duration { firing_mult = 0.0; }; FiringModifierResponse { burst_delay_scale: firing_mult, ..Default::default() } - }), + }, ); add_hmr( Perks::BackupPlan, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let mut handling_add = if _input.value > 0 { 100 } else { 0 }; - let duration = if _input.is_enhanced { 2.2 } else { 2.0 }; - if _input.calc_data.time_total > duration { - handling_add = 0; - }; - HandlingModifierResponse { - stat_add: handling_add, - ..Default::default() - } - }, - ), + |input: ModifierResponseInput| -> HandlingModifierResponse { + let mut handling_add = if input.value > 0 { 100 } else { 0 }; + let duration = if input.is_enhanced { 2.2 } else { 2.0 }; + if input.calc_data.time_total > duration { + handling_add = 0; + }; + HandlingModifierResponse { + stat_add: handling_add, + ..Default::default() + } + }, ); add_sbr( Perks::BackupPlan, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - let mut handling = if _input.value > 0 { 100 } else { 0 }; - let duration = if _input.is_enhanced { 2.2 } else { 2.0 }; - if _input.calc_data.time_total > duration { - handling = 0; - }; - let mut out = HashMap::new(); - if _input.value > 0 { - out.insert(StatHashes::HANDLING.into(), handling); - } - out - }, - ), + |input: ModifierResponseInput| -> HashMap { + let mut handling = if input.value > 0 { 100 } else { 0 }; + let duration = if input.is_enhanced { 2.2 } else { 2.0 }; + if input.calc_data.time_total > duration { + handling = 0; + }; + let mut out = HashMap::new(); + if input.value > 0 { + out.insert(StatHashes::HANDLING.into(), handling); + } + out + }, ); add_edr( Perks::ClusterBomb, - Box::new(|_input: ModifierResponseInput| -> ExtraDamageResponse { + |_: ModifierResponseInput| -> ExtraDamageResponse { ExtraDamageResponse { additive_damage: 350.0 * 0.04, combatant_scale: true, @@ -700,16 +645,16 @@ pub fn year_1_perks() { hit_at_same_time: true, is_dot: false, } - }), + }, ); add_dmr( Perks::DisruptionBreak, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let mut damage_mult = if _input.value > 0 { 0.5 } else { 0.0 }; - let duration = if _input.is_enhanced { 5.0 } else { 4.0 }; - if _input.calc_data.time_total > duration - || _input.calc_data.damage_type != &DamageType::KINETIC + |input: ModifierResponseInput| -> DamageModifierResponse { + let mut damage_mult = if input.value > 0 { 0.5 } else { 0.0 }; + let duration = if input.is_enhanced { 5.0 } else { 4.0 }; + if input.calc_data.time_total > duration + || input.calc_data.damage_type != &DamageType::KINETIC { damage_mult = 0.0; }; @@ -718,87 +663,77 @@ pub fn year_1_perks() { explosive_dmg_scale: 1.0 + damage_mult, crit_scale: 1.0, } - }), + }, ); add_hmr( Perks::QuickDraw, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value > 0 { - HandlingModifierResponse { - draw_add: 100, - draw_scale: 0.95, - ..Default::default() - } - } else { - HandlingModifierResponse::default() + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value > 0 { + HandlingModifierResponse { + draw_add: 100, + draw_scale: 0.95, + ..Default::default() } - }, - ), + } else { + HandlingModifierResponse::default() + } + }, ); add_sbr( Perks::QuickDraw, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - let mut map = HashMap::new(); - if _input.value > 0 { - map.insert(StatHashes::HANDLING.into(), 100); - } - map - }, - ), + |input: ModifierResponseInput| -> HashMap { + let mut map = HashMap::new(); + if input.value > 0 { + map.insert(StatHashes::HANDLING.into(), 100); + } + map + }, ); add_hmr( Perks::PulseMonitor, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value > 0 { - HandlingModifierResponse { - stat_add: 50, - draw_scale: 0.95, - stow_scale: 0.95, - ..Default::default() - } - } else { - HandlingModifierResponse::default() + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value > 0 { + HandlingModifierResponse { + stat_add: 50, + draw_scale: 0.95, + stow_scale: 0.95, + ..Default::default() } - }, - ), + } else { + HandlingModifierResponse::default() + } + }, ); add_sbr( Perks::PulseMonitor, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - let mut map = HashMap::new(); - if _input.value > 0 { - map.insert(StatHashes::HANDLING.into(), 50); - } - map - }, - ), + |input: ModifierResponseInput| -> HashMap { + let mut map = HashMap::new(); + if input.value > 0 { + map.insert(StatHashes::HANDLING.into(), 50); + } + map + }, ); add_sbr( Perks::UnderDog, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - let mut map = HashMap::new(); - if _input.value > 0 { - map.insert(StatHashes::RELOAD.into(), 100); - } - map - }, - ), + |input: ModifierResponseInput| -> HashMap { + let mut map = HashMap::new(); + if input.value > 0 { + map.insert(StatHashes::RELOAD.into(), 100); + } + map + }, ); add_rsmr( Perks::UnderDog, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - if _input.value > 0 { + |input: ModifierResponseInput| -> ReloadModifierResponse { + if input.value > 0 { ReloadModifierResponse { reload_stat_add: 100, reload_time_scale: 0.9, @@ -806,35 +741,33 @@ pub fn year_1_perks() { } else { ReloadModifierResponse::default() } - }), + }, ); add_sbr( Perks::UnderPressure, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - let mut map = HashMap::new(); - let buff = if _input.is_enhanced { 35 } else { 30 }; - if _input.value > 0 { - map.insert(StatHashes::STABILITY.into(), buff); - } - map - }, - ), + |input: ModifierResponseInput| -> HashMap { + let mut map = HashMap::new(); + let buff = if input.is_enhanced { 35 } else { 30 }; + if input.value > 0 { + map.insert(StatHashes::STABILITY.into(), buff); + } + map + }, ); add_fmr( Perks::PhaseMag, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { + |_: ModifierResponseInput| -> FiringModifierResponse { FiringModifierResponse { burst_delay_add: 1.0 / 30.0, ..Default::default() } - }), + }, ); add_dmr( Perks::PhaseMag, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { //set up precision smg to get damage values from let precision = Weapon::generate_weapon( 0, 24, //smg @@ -844,10 +777,10 @@ pub fn year_1_perks() { ) .unwrap(); - let p_data = precision.get_damage_profile(_input.pvp); + let p_data = precision.get_damage_profile(input.pvp); - let lightweight_body = _input.calc_data.curr_firing_data.damage; - let lightweight_crit = _input.calc_data.curr_firing_data.crit_mult; + let lightweight_body = input.calc_data.curr_firing_data.damage; + let lightweight_crit = input.calc_data.curr_firing_data.crit_mult; let precision_body = p_data.0; let precision_crit = p_data.2; @@ -856,6 +789,6 @@ pub fn year_1_perks() { explosive_dmg_scale: precision_body / lightweight_body, crit_scale: precision_crit / lightweight_crit, } - }), + }, ); } diff --git a/src/perks/year_2_perks.rs b/src/perks/year_2_perks.rs index 1a81cd05..c5138878 100644 --- a/src/perks/year_2_perks.rs +++ b/src/perks/year_2_perks.rs @@ -19,19 +19,19 @@ use super::{ pub fn year_2_perks() { add_sbr( Perks::AirAssault, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); - let ae_per_stack = if _input.is_enhanced { 35 } else { 30 }; - let ae = ae_per_stack * _input.value as i32; + let ae_per_stack = if input.is_enhanced { 35 } else { 30 }; + let ae = ae_per_stack * input.value as i32; stats.insert(StatHashes::AIRBORNE.into(), ae); stats - }), + }, ); add_fmr( Perks::ArchersTempo, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { - let delay = match (_input.value, _input.calc_data.intrinsic_hash) { + |input: ModifierResponseInput| -> FiringModifierResponse { + let delay = match (input.value, input.calc_data.intrinsic_hash) { (0, _) => 1.0, (1.., 1699724249) => 0.5625, //levi breath (1.., _) => 0.75, @@ -40,13 +40,13 @@ pub fn year_2_perks() { burst_delay_scale: delay, ..Default::default() } - }), + }, ); add_dmr( Perks::ExplosiveHead, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.pvp { + |input: ModifierResponseInput| -> DamageModifierResponse { + if input.pvp { DamageModifierResponse::default() } else { DamageModifierResponse { @@ -55,26 +55,24 @@ pub fn year_2_perks() { crit_scale: 1.0, } } - }), + }, ); add_epr( Perks::ExplosiveHead, - Box::new( - |_input: ModifierResponseInput| -> ExplosivePercentResponse { - ExplosivePercentResponse { - percent: 0.5, - delyed: if _input.pvp { 0.0 } else { 0.2 }, - retain_base_total: true, - } - }, - ), + |input: ModifierResponseInput| -> ExplosivePercentResponse { + ExplosivePercentResponse { + percent: 0.5, + delyed: if input.pvp { 0.0 } else { 0.2 }, + retain_base_total: true, + } + }, ); add_rsmr( Perks::FeedingFrenzy, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - let val = clamp(_input.value, 0, 5); + |input: ModifierResponseInput| -> ReloadModifierResponse { + let val = clamp(input.value, 0, 5); let duration = 3.5; let mut reload_mult = 1.0; let mut reload = 0; @@ -94,7 +92,7 @@ pub fn year_2_perks() { reload = 100; reload_mult = 0.8; }; - if _input.calc_data.time_total > duration { + if input.calc_data.time_total > duration { reload = 0; reload_mult = 1.0; }; @@ -102,14 +100,14 @@ pub fn year_2_perks() { reload_stat_add: reload, reload_time_scale: reload_mult, } - }), + }, ); add_sbr( Perks::FeedingFrenzy, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); - let val = clamp(_input.value, 0, 5); + let val = clamp(input.value, 0, 5); let duration = 3.5; let mut reload = 0; if val == 1 { @@ -123,19 +121,19 @@ pub fn year_2_perks() { } else if val == 5 { reload = 100; }; - if _input.calc_data.time_total > duration { + if input.calc_data.time_total > duration { reload = 0; }; stats.insert(StatHashes::RELOAD.into(), reload); stats - }), + }, ); add_dmr( Perks::FiringLine, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let mut crit_mult = 1.0; - if _input.value > 0 { + if input.value > 0 { crit_mult = 1.2; } DamageModifierResponse { @@ -143,30 +141,30 @@ pub fn year_2_perks() { explosive_dmg_scale: 1.0, impact_dmg_scale: 1.0, } - }), + }, ); add_rr( Perks::FourthTimesTheCharm, - Box::new(|_input: ModifierResponseInput| -> RefundResponse { + |_: ModifierResponseInput| -> RefundResponse { RefundResponse { crit: true, requirement: 4, refund_mag: 2, refund_reserves: 0, } - }), + }, ); add_dmr( Perks::KillingTally, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let val = clamp(_input.value, 0, 3); + |input: ModifierResponseInput| -> DamageModifierResponse { + let val = clamp(input.value, 0, 3); let mut damage_mult = 0.1 * val as f64; - if _input.pvp { + if input.pvp { damage_mult *= 0.5; }; - if _input.calc_data.num_reloads > 0.0 { + if input.calc_data.num_reloads > 0.0 { damage_mult = 0.0; }; DamageModifierResponse { @@ -174,32 +172,30 @@ pub fn year_2_perks() { explosive_dmg_scale: 1.0 + damage_mult, crit_scale: 1.0, } - }), + }, ); add_mmr( Perks::OverFlow, - Box::new( - |_input: ModifierResponseInput| -> MagazineModifierResponse { - let mut mag_scale = if _input.value > 0 { 2.0 } else { 1.0 }; - if _input.is_enhanced && _input.value > 0 { - mag_scale *= 1.1; - }; - if _input.calc_data.total_shots_fired > 0.0 { - mag_scale = 1.0; - }; - MagazineModifierResponse { - magazine_stat_add: 0, - magazine_scale: mag_scale, - magazine_add: 0.0, - } - }, - ), + |input: ModifierResponseInput| -> MagazineModifierResponse { + let mut mag_scale = if input.value > 0 { 2.0 } else { 1.0 }; + if input.is_enhanced && input.value > 0 { + mag_scale *= 1.1; + }; + if input.calc_data.total_shots_fired > 0.0 { + mag_scale = 1.0; + }; + MagazineModifierResponse { + magazine_stat_add: 0, + magazine_scale: mag_scale, + magazine_add: 0.0, + } + }, ); add_rsmr( Perks::RapidHit, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { + |input: ModifierResponseInput| -> ReloadModifierResponse { let values = [ (0, 1.0), (5, 0.99), @@ -209,7 +205,7 @@ pub fn year_2_perks() { (60, 0.93), ]; let entry_to_get = clamp( - _input.value + _input.calc_data.shots_fired_this_mag as u32, + input.value + input.calc_data.shots_fired_this_mag as u32, 0, 5, ); @@ -217,16 +213,16 @@ pub fn year_2_perks() { reload_stat_add: values[entry_to_get as usize].0, reload_time_scale: values[entry_to_get as usize].1, } - }), + }, ); add_sbr( Perks::RapidHit, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let rel_values = [0, 5, 30, 35, 45, 60]; let stab_values = [0, 2, 12, 14, 18, 25]; let entry_to_get = clamp( - _input.value + _input.calc_data.shots_fired_this_mag as u32, + input.value + input.calc_data.shots_fired_this_mag as u32, 0, 5, ); @@ -237,13 +233,13 @@ pub fn year_2_perks() { stab_values[entry_to_get as usize], ); stats - }), + }, ); add_dmr( Perks::ResevoirBurst, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let damage_mult = if _input.calc_data.curr_mag >= _input.calc_data.base_mag { + |input: ModifierResponseInput| -> DamageModifierResponse { + let damage_mult = if input.calc_data.curr_mag >= input.calc_data.base_mag { 1.25 } else { 1.0 @@ -253,20 +249,20 @@ pub fn year_2_perks() { explosive_dmg_scale: damage_mult, ..Default::default() } - }), + }, ); add_dmr( Perks::Surrounded, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let mut damage_mult = 1.0; - if _input.value > 0 { - damage_mult = if *_input.calc_data.weapon_type == WeaponType::SWORD { + if input.value > 0 { + damage_mult = if *input.calc_data.weapon_type == WeaponType::SWORD { 1.35 } else { 1.4 }; - if _input.is_enhanced { + if input.is_enhanced { damage_mult *= 1.05; }; }; @@ -275,14 +271,14 @@ pub fn year_2_perks() { explosive_dmg_scale: damage_mult, crit_scale: 1.0, } - }), + }, ); add_dmr( Perks::FullCourt, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let mut damage_mult = 1.0; - if _input.value > 0 { + if input.value > 0 { damage_mult = 1.25; }; DamageModifierResponse { @@ -290,16 +286,16 @@ pub fn year_2_perks() { explosive_dmg_scale: damage_mult, crit_scale: 1.0, } - }), + }, ); add_dmr( Perks::Swashbuckler, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let val = clamp(_input.value, 0, 5); - let duration = if _input.is_enhanced { 6.0 } else { 4.5 }; + |input: ModifierResponseInput| -> DamageModifierResponse { + let val = clamp(input.value, 0, 5); + let duration = if input.is_enhanced { 6.0 } else { 4.5 }; let mut dmg_boost = 0.067 * val as f64; - if _input.calc_data.time_total > duration { + if input.calc_data.time_total > duration { dmg_boost = 0.0; }; DamageModifierResponse { @@ -307,15 +303,15 @@ pub fn year_2_perks() { explosive_dmg_scale: 1.0 + dmg_boost, crit_scale: 1.0, } - }), + }, ); add_dmr( Perks::MultikillClip, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let val = clamp(_input.value, 0, 5); + |input: ModifierResponseInput| -> DamageModifierResponse { + let val = clamp(input.value, 0, 5); let mut damage_mult = (1.0 / 6.0) * val as f64; - if _input.calc_data.num_reloads > 0.0 { + if input.calc_data.num_reloads > 0.0 { damage_mult = 0.0; }; DamageModifierResponse { @@ -323,19 +319,19 @@ pub fn year_2_perks() { explosive_dmg_scale: 1.0 + damage_mult, crit_scale: 1.0, } - }), + }, ); add_dmr( Perks::ExplosiveLight, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let shots = if _input.is_enhanced { 7.0 } else { 6.0 }; - let shots_left = _input.value as f64 * shots - _input.calc_data.total_shots_fired; + |input: ModifierResponseInput| -> DamageModifierResponse { + let shots = if input.is_enhanced { 7.0 } else { 6.0 }; + let shots_left = input.value as f64 * shots - input.calc_data.total_shots_fired; if shots_left <= 0.0 { return DamageModifierResponse::default(); }; - let mult = match _input.calc_data.weapon_type { + let mult = match input.calc_data.weapon_type { WeaponType::ROCKET => (1.25, 1.25), WeaponType::GRENADELAUNCHER => (1.6, 1.0), _ => (1.0, 1.0), @@ -345,55 +341,53 @@ pub fn year_2_perks() { impact_dmg_scale: mult.1, crit_scale: 1.0, } - }), + }, ); add_sbr( Perks::ExplosiveLight, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut out = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { out.insert(StatHashes::BLAST_RADIUS.into(), 100); }; out - }), + }, ); add_sbr( Perks::EyeOfTheStorm, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut out = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { out.insert(StatHashes::HANDLING.into(), 30); }; out - }), + }, ); add_hmr( Perks::EyeOfTheStorm, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value > 0 { - HandlingModifierResponse { - stat_add: 30, - ..Default::default() - } - } else { - HandlingModifierResponse::default() + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value > 0 { + HandlingModifierResponse { + stat_add: 30, + ..Default::default() } - }, - ), + } else { + HandlingModifierResponse::default() + } + }, ); add_flmr( Perks::NoDistractions, - Box::new(|_input: ModifierResponseInput| -> FlinchModifierResponse { - if _input.value > 0 { + |input: ModifierResponseInput| -> FlinchModifierResponse { + if input.value > 0 { FlinchModifierResponse { flinch_scale: 0.65 } } else { FlinchModifierResponse::default() } - }), + }, ); } diff --git a/src/perks/year_3_perks.rs b/src/perks/year_3_perks.rs index 1ab3abe9..d0953cf8 100644 --- a/src/perks/year_3_perks.rs +++ b/src/perks/year_3_perks.rs @@ -18,83 +18,79 @@ use super::{ pub fn year_3_perks() { add_mmr( Perks::ClownCartridge, - Box::new( - |_input: ModifierResponseInput| -> MagazineModifierResponse { - MagazineModifierResponse { - magazine_add: 0.0, - magazine_scale: 1.5, - magazine_stat_add: 0, - } - }, - ), + |_: ModifierResponseInput| -> MagazineModifierResponse { + MagazineModifierResponse { + magazine_add: 0.0, + magazine_scale: 1.5, + magazine_stat_add: 0, + } + }, ); add_sbr( Perks::ElementalCapacitor, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); - let ev = if _input.is_enhanced { 5 } else { 0 }; - if _input.value == 1 { + let ev = if input.is_enhanced { 5 } else { 0 }; + if input.value == 1 { stats.insert(StatHashes::STABILITY.into(), 20 + ev); - } else if _input.value == 2 { + } else if input.value == 2 { stats.insert(StatHashes::RELOAD.into(), 50 + ev); - } else if _input.value == 3 { + } else if input.value == 3 { stats.insert(StatHashes::HANDLING.into(), 50 + ev); - } else if _input.value == 4 { + } else if input.value == 4 { stats.insert(StatHashes::RECOIL_DIR.into(), 20 + ev); - } else if _input.value == 5 { + } else if input.value == 5 { stats.insert(StatHashes::AIRBORNE.into(), 20 + ev); }; stats - }), + }, ); add_hmr( Perks::ElementalCapacitor, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let mut handling = 0; - if _input.value == 3 { - handling = if _input.is_enhanced { 55 } else { 50 }; - }; - HandlingModifierResponse { - stat_add: handling, - ..Default::default() - } - }, - ), + |input: ModifierResponseInput| -> HandlingModifierResponse { + let mut handling = 0; + if input.value == 3 { + handling = if input.is_enhanced { 55 } else { 50 }; + }; + HandlingModifierResponse { + stat_add: handling, + ..Default::default() + } + }, ); add_rsmr( Perks::ElementalCapacitor, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { + |input: ModifierResponseInput| -> ReloadModifierResponse { let mut reload = 0; - if _input.value == 2 { - reload = if _input.is_enhanced { 55 } else { 50 }; + if input.value == 2 { + reload = if input.is_enhanced { 55 } else { 50 }; }; ReloadModifierResponse { reload_stat_add: reload, ..Default::default() } - }), + }, ); add_sbr( Perks::KillingWind, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { stats.insert(StatHashes::HANDLING.into(), 40); stats.insert(StatHashes::RANGE.into(), 20); }; stats - }), + }, ); add_rmr( Perks::KillingWind, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { - if _input.value > 0 { + |input: ModifierResponseInput| -> RangeModifierResponse { + if input.value > 0 { RangeModifierResponse { range_stat_add: 20, range_all_scale: 1.05, @@ -109,47 +105,45 @@ pub fn year_3_perks() { range_hip_scale: 1.0, } } - }), + }, ); add_hmr( Perks::KillingWind, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value > 0 { - HandlingModifierResponse { - stat_add: 40, - ..Default::default() - } - } else { - HandlingModifierResponse::default() + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value > 0 { + HandlingModifierResponse { + stat_add: 40, + ..Default::default() } - }, - ), + } else { + HandlingModifierResponse::default() + } + }, ); add_dmr( Perks::LastingImpression, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |_: ModifierResponseInput| -> DamageModifierResponse { DamageModifierResponse { impact_dmg_scale: 1.0, explosive_dmg_scale: 1.25, crit_scale: 1.0, } - }), + }, ); add_dmr( Perks::Vorpal, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let mut buff = 1.0; - if (*_input.calc_data.enemy_type == EnemyType::BOSS - || *_input.calc_data.enemy_type == EnemyType::MINIBOSS - || *_input.calc_data.enemy_type == EnemyType::CHAMPION - || *_input.calc_data.enemy_type == EnemyType::VEHICLE) - && !_input.pvp + if (*input.calc_data.enemy_type == EnemyType::BOSS + || *input.calc_data.enemy_type == EnemyType::MINIBOSS + || *input.calc_data.enemy_type == EnemyType::CHAMPION + || *input.calc_data.enemy_type == EnemyType::VEHICLE) + && !input.pvp { - buff = match *_input.calc_data.ammo_type { + buff = match *input.calc_data.ammo_type { AmmoType::HEAVY => 1.1, AmmoType::SPECIAL => 1.15, AmmoType::PRIMARY => 1.2, @@ -161,56 +155,54 @@ pub fn year_3_perks() { explosive_dmg_scale: buff, crit_scale: 1.0, } - }), + }, ); add_sbr( Perks::TrenchBarrel, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut buffer: HashMap = HashMap::new(); - let bump = if _input.is_enhanced { 35 } else { 30 }; - if _input.value > 0 { + let bump = if input.is_enhanced { 35 } else { 30 }; + if input.value > 0 { buffer.insert(StatHashes::HANDLING.into(), bump); //reload unknown buffer.insert(StatHashes::RELOAD.into(), bump); } buffer - }), + }, ); add_hmr( Perks::TrenchBarrel, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value == 0 { - return HandlingModifierResponse::default(); - } - HandlingModifierResponse { - stat_add: if _input.is_enhanced { 35 } else { 30 }, - ..Default::default() - } - }, - ), + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value == 0 { + return HandlingModifierResponse::default(); + } + HandlingModifierResponse { + stat_add: if input.is_enhanced { 35 } else { 30 }, + ..Default::default() + } + }, ); //ready for when someone finds the reload information add_rsmr( Perks::TrenchBarrel, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - if _input.value == 0 { + |input: ModifierResponseInput| -> ReloadModifierResponse { + if input.value == 0 { return ReloadModifierResponse::default(); } ReloadModifierResponse { - reload_stat_add: if _input.is_enhanced { 35 } else { 30 }, + reload_stat_add: if input.is_enhanced { 35 } else { 30 }, ..Default::default() } - }), + }, ); add_dmr( Perks::TrenchBarrel, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value > 0 { + |input: ModifierResponseInput| -> DamageModifierResponse { + if input.value > 0 { return DamageModifierResponse { impact_dmg_scale: 1.5, explosive_dmg_scale: 1.5, @@ -218,6 +210,6 @@ pub fn year_3_perks() { }; } DamageModifierResponse::default() - }), + }, ); } diff --git a/src/perks/year_4_perks.rs b/src/perks/year_4_perks.rs index 8416e5f6..86ef167d 100644 --- a/src/perks/year_4_perks.rs +++ b/src/perks/year_4_perks.rs @@ -16,15 +16,15 @@ use super::{ pub fn year_4_perks() { add_dmr( Perks::Adagio, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let duration = if _input.is_enhanced { 8.0 } else { 7.0 }; + |input: ModifierResponseInput| -> DamageModifierResponse { + let duration = if input.is_enhanced { 8.0 } else { 7.0 }; let mut dmg_boost = 0.3; - if *_input.calc_data.weapon_type == WeaponType::BOW - || *_input.calc_data.weapon_type == WeaponType::SHOTGUN + if *input.calc_data.weapon_type == WeaponType::BOW + || *input.calc_data.weapon_type == WeaponType::SHOTGUN { dmg_boost = 0.2; }; - if _input.calc_data.time_total > duration || _input.value == 0 { + if input.calc_data.time_total > duration || input.value == 0 { dmg_boost = 0.0; }; DamageModifierResponse { @@ -32,15 +32,15 @@ pub fn year_4_perks() { explosive_dmg_scale: 1.0 + dmg_boost, crit_scale: 1.0, } - }), + }, ); add_fmr( Perks::Adagio, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { - let duration = if _input.is_enhanced { 8.0 } else { 7.0 }; + |input: ModifierResponseInput| -> FiringModifierResponse { + let duration = if input.is_enhanced { 8.0 } else { 7.0 }; let mut firing_slow = 1.2; - if _input.calc_data.time_total > duration || _input.value == 0 { + if input.calc_data.time_total > duration || input.value == 0 { firing_slow = 1.0; }; FiringModifierResponse { @@ -49,25 +49,25 @@ pub fn year_4_perks() { inner_burst_scale: firing_slow, burst_size_add: 0.0, } - }), + }, ); add_sbr( Perks::Adagio, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut map = HashMap::new(); - let duration = if _input.is_enhanced { 8.0 } else { 7.0 }; - if _input.calc_data.time_total <= duration && _input.value > 0 { + let duration = if input.is_enhanced { 8.0 } else { 7.0 }; + if input.calc_data.time_total <= duration && input.value > 0 { map.insert(StatHashes::RANGE.into(), 10); } map - }), + }, ); add_rmr( Perks::Adagio, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { - if _input.value == 0 { + |input: ModifierResponseInput| -> RangeModifierResponse { + if input.value == 0 { return RangeModifierResponse::default(); } @@ -75,16 +75,16 @@ pub fn year_4_perks() { range_stat_add: 10, ..Default::default() } - }), + }, ); add_dmr( Perks::AdrenalineJunkie, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let val = clamp(_input.value, 0, 5); - let duration = if _input.is_enhanced { 6.0 } else { 4.5 }; + |input: ModifierResponseInput| -> DamageModifierResponse { + let val = clamp(input.value, 0, 5); + let duration = if input.is_enhanced { 6.0 } else { 4.5 }; let mut dmg_boost = 0.067 * val as f64; - if _input.calc_data.time_total > duration { + if input.calc_data.time_total > duration { dmg_boost = 0.0; }; DamageModifierResponse { @@ -92,41 +92,39 @@ pub fn year_4_perks() { explosive_dmg_scale: 1.0 + dmg_boost, crit_scale: 1.0, } - }), + }, ); add_sbr( Perks::AdrenalineJunkie, - Box::new(|_input: ModifierResponseInput| -> HashMap { - let duration = if _input.is_enhanced { 6.0 } else { 4.5 }; + |input: ModifierResponseInput| -> HashMap { + let duration = if input.is_enhanced { 6.0 } else { 4.5 }; let mut handling = 0; - if _input.calc_data.time_total <= duration && _input.value > 0 { + if input.calc_data.time_total <= duration && input.value > 0 { handling = 20; }; let mut out = HashMap::new(); out.insert(StatHashes::HANDLING.into(), handling); out - }), + }, ); add_hmr( Perks::AdrenalineJunkie, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let handling = if _input.value > 0 { 20 } else { 0 }; - HandlingModifierResponse { - stat_add: handling, - ..Default::default() - } - }, - ), + |input: ModifierResponseInput| -> HandlingModifierResponse { + let handling = if input.value > 0 { 20 } else { 0 }; + HandlingModifierResponse { + stat_add: handling, + ..Default::default() + } + }, ); add_fmr( Perks::Cornered, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { + |input: ModifierResponseInput| -> FiringModifierResponse { let mut delay_mult = 1.0; - if _input.value > 0 { + if input.value > 0 { delay_mult = 0.85; }; FiringModifierResponse { @@ -135,15 +133,15 @@ pub fn year_4_perks() { inner_burst_scale: 1.0, burst_size_add: 0.0, } - }), + }, ); add_sbr( Perks::Ensemble, - Box::new(|_input: ModifierResponseInput| -> HashMap { - let handling = if _input.is_enhanced { 35 } else { 30 }; - let reload = if _input.is_enhanced { 45 } else { 40 }; - if _input.value > 0 { + |input: ModifierResponseInput| -> HashMap { + let handling = if input.is_enhanced { 35 } else { 30 }; + let reload = if input.is_enhanced { 45 } else { 40 }; + if input.value > 0 { let mut out = HashMap::new(); out.insert(StatHashes::HANDLING.into(), handling); out.insert(StatHashes::RELOAD.into(), reload); @@ -151,31 +149,29 @@ pub fn year_4_perks() { } else { HashMap::new() } - }), + }, ); add_hmr( Perks::Ensemble, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let handling = if _input.is_enhanced { 35 } else { 30 }; - if _input.value > 0 { - HandlingModifierResponse { - stat_add: handling, - ..Default::default() - } - } else { - HandlingModifierResponse::default() + |input: ModifierResponseInput| -> HandlingModifierResponse { + let handling = if input.is_enhanced { 35 } else { 30 }; + if input.value > 0 { + HandlingModifierResponse { + stat_add: handling, + ..Default::default() } - }, - ), + } else { + HandlingModifierResponse::default() + } + }, ); add_rsmr( Perks::Ensemble, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - let reload = if _input.is_enhanced { 45 } else { 40 }; - if _input.value > 0 { + |input: ModifierResponseInput| -> ReloadModifierResponse { + let reload = if input.is_enhanced { 45 } else { 40 }; + if input.value > 0 { ReloadModifierResponse { reload_stat_add: reload, reload_time_scale: 1.0, @@ -186,53 +182,51 @@ pub fn year_4_perks() { reload_time_scale: 1.0, } } - }), + }, ); add_rsmr( Perks::Frenzy, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { + |input: ModifierResponseInput| -> ReloadModifierResponse { let mut reload = 0; - if _input.value > 0 { + if input.value > 0 { reload = 100; }; - if _input.calc_data.time_total > 12.0 { + if input.calc_data.time_total > 12.0 { reload = 100; }; ReloadModifierResponse { reload_stat_add: reload, reload_time_scale: 1.0, } - }), + }, ); add_hmr( Perks::Frenzy, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let mut handling = 0; - if _input.value > 0 { - handling = 100; - }; - if _input.calc_data.time_total > 12.0 { - handling = 100; - }; - HandlingModifierResponse { - stat_add: handling, - ..Default::default() - } - }, - ), + |input: ModifierResponseInput| -> HandlingModifierResponse { + let mut handling = 0; + if input.value > 0 { + handling = 100; + }; + if input.calc_data.time_total > 12.0 { + handling = 100; + }; + HandlingModifierResponse { + stat_add: handling, + ..Default::default() + } + }, ); add_dmr( Perks::Frenzy, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let mut dmg = 0.0; - if _input.value > 0 { + if input.value > 0 { dmg = 0.15; }; - if _input.calc_data.time_total > 12.0 { + if input.calc_data.time_total > 12.0 { dmg = 0.15; }; DamageModifierResponse { @@ -240,19 +234,19 @@ pub fn year_4_perks() { explosive_dmg_scale: 1.0 + dmg, crit_scale: 1.0, } - }), + }, ); add_sbr( Perks::Frenzy, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut handling = 0; let mut reload = 0; - if _input.value > 0 { + if input.value > 0 { handling = 100; reload = 100; }; - if _input.calc_data.time_total > 12.0 { + if input.calc_data.time_total > 12.0 { handling = 100; reload = 100; }; @@ -260,14 +254,14 @@ pub fn year_4_perks() { out.insert(StatHashes::HANDLING.into(), handling); out.insert(StatHashes::RELOAD.into(), reload); out - }), + }, ); add_rsmr( Perks::ImpulseAmplifier, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - let reload = if _input.is_enhanced { 25 } else { 20 }; - let reload_mult = if *_input.calc_data.weapon_type == WeaponType::ROCKET { + |input: ModifierResponseInput| -> ReloadModifierResponse { + let reload = if input.is_enhanced { 25 } else { 20 }; + let reload_mult = if *input.calc_data.weapon_type == WeaponType::ROCKET { 0.8 } else { 0.85 @@ -276,34 +270,32 @@ pub fn year_4_perks() { reload_stat_add: reload, reload_time_scale: reload_mult, } - }), + }, ); add_sbr( Perks::ImpulseAmplifier, - Box::new(|_input: ModifierResponseInput| -> HashMap { - let reload = if _input.is_enhanced { 25 } else { 20 }; + |input: ModifierResponseInput| -> HashMap { + let reload = if input.is_enhanced { 25 } else { 20 }; let mut out = HashMap::new(); out.insert(StatHashes::RELOAD.into(), reload); out - }), + }, ); add_vmr( Perks::ImpulseAmplifier, - Box::new( - |_input: ModifierResponseInput| -> VelocityModifierResponse { - VelocityModifierResponse { - velocity_scaler: 1.35, - } - }, - ), + |_: ModifierResponseInput| -> VelocityModifierResponse { + VelocityModifierResponse { + velocity_scaler: 1.35, + } + }, ); add_sbr( Perks::PerpetualMotion, - Box::new(|_input: ModifierResponseInput| -> HashMap { - let val = clamp(_input.value, 0, 2); + |input: ModifierResponseInput| -> HashMap { + let val = clamp(input.value, 0, 2); let mut stat_bump = 0; if val == 1 { stat_bump = 10; @@ -315,32 +307,30 @@ pub fn year_4_perks() { out.insert(StatHashes::HANDLING.into(), stat_bump); out.insert(StatHashes::STABILITY.into(), stat_bump); out - }), + }, ); add_hmr( Perks::PerpetualMotion, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let val = clamp(_input.value, 0, 2); - let mut stat_bump = 0; - if val == 1 { - stat_bump = 10; - } else if val == 2 { - stat_bump = 20; - }; - HandlingModifierResponse { - stat_add: stat_bump, - ..Default::default() - } - }, - ), + |input: ModifierResponseInput| -> HandlingModifierResponse { + let val = clamp(input.value, 0, 2); + let mut stat_bump = 0; + if val == 1 { + stat_bump = 10; + } else if val == 2 { + stat_bump = 20; + }; + HandlingModifierResponse { + stat_add: stat_bump, + ..Default::default() + } + }, ); add_rsmr( Perks::PerpetualMotion, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - let val = clamp(_input.value, 0, 2); + |input: ModifierResponseInput| -> ReloadModifierResponse { + let val = clamp(input.value, 0, 2); let mut stat_bump = 0; if val == 1 { stat_bump = 10; @@ -351,89 +341,85 @@ pub fn year_4_perks() { reload_stat_add: stat_bump, reload_time_scale: 1.0, } - }), + }, ); add_sbr( Perks::PerfectFloat, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut out = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { out.insert(StatHashes::AIRBORNE.into(), 30); }; out - }), + }, ); add_flmr( Perks::PerfectFloat, - Box::new(|_input: ModifierResponseInput| -> FlinchModifierResponse { - let val = if _input.value > 0 { 0.65 } else { 1.0 }; + |input: ModifierResponseInput| -> FlinchModifierResponse { + let val = if input.value > 0 { 0.65 } else { 1.0 }; FlinchModifierResponse { flinch_scale: val } - }), + }, ); add_sbr( Perks::Pugilist, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut out = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { out.insert(StatHashes::HANDLING.into(), 35); }; out - }), + }, ); add_hmr( Perks::Pugilist, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let mut handling = 0; - if _input.value > 0 { - handling = 35; - }; - HandlingModifierResponse { - stat_add: handling, - ..Default::default() - } - }, - ), + |input: ModifierResponseInput| -> HandlingModifierResponse { + let mut handling = 0; + if input.value > 0 { + handling = 35; + }; + HandlingModifierResponse { + stat_add: handling, + ..Default::default() + } + }, ); add_mmr( Perks::Reconstruction, - Box::new( - |_input: ModifierResponseInput| -> MagazineModifierResponse { - let mag_scale = if _input.value > 0 { 2.0 } else { 1.0 }; - MagazineModifierResponse { - magazine_stat_add: 0, - magazine_scale: mag_scale, - magazine_add: 0.0, - } - }, - ), + |input: ModifierResponseInput| -> MagazineModifierResponse { + let mag_scale = if input.value > 0 { 2.0 } else { 1.0 }; + MagazineModifierResponse { + magazine_stat_add: 0, + magazine_scale: mag_scale, + magazine_add: 0.0, + } + }, ); add_sbr( Perks::DangerZone, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut out = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { out.insert(StatHashes::BLAST_RADIUS.into(), 100); }; out - }), + }, ); add_dmr( Perks::OneForAll, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let mut dmg = 0.0; - let duration = if _input.is_enhanced { 11.0 } else { 10.0 }; - if _input.value > 0 { + let duration = if input.is_enhanced { 11.0 } else { 10.0 }; + if input.value > 0 { dmg = 0.35; }; - if _input.calc_data.time_total > duration { + if input.calc_data.time_total > duration { dmg = 0.0; }; DamageModifierResponse { @@ -441,24 +427,24 @@ pub fn year_4_perks() { explosive_dmg_scale: 1.0 + dmg, crit_scale: 1.0, } - }), + }, ); add_sbr( Perks::FireFly, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut buffer: HashMap = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { buffer.insert(StatHashes::RELOAD.into(), 50); } buffer - }), + }, ); add_rsmr( Perks::FireFly, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - if _input.value > 0 { + |input: ModifierResponseInput| -> ReloadModifierResponse { + if input.value > 0 { ReloadModifierResponse { reload_stat_add: 50, reload_time_scale: 1.0, @@ -466,19 +452,19 @@ pub fn year_4_perks() { } else { ReloadModifierResponse::default() } - }), + }, ); add_dmr( Perks::GoldenTricorn, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let val = clamp(_input.value, 0, 2); + |input: ModifierResponseInput| -> DamageModifierResponse { + let val = clamp(input.value, 0, 2); let mut duration = if val == 2 { 10.0 } else { 7.0 }; - if _input.is_enhanced && val == 1 { + if input.is_enhanced && val == 1 { duration += 1.0; }; let damage_mult = if val == 2 { 0.5 } else { 0.15 }; - if _input.value > 0 && _input.calc_data.time_total < duration { + if input.value > 0 && input.calc_data.time_total < duration { DamageModifierResponse { impact_dmg_scale: 1.0 + damage_mult, explosive_dmg_scale: 1.0 + damage_mult, @@ -487,15 +473,15 @@ pub fn year_4_perks() { } else { DamageModifierResponse::default() } - }), + }, ); add_dmr( Perks::Harmony, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let mut damage_mult = if _input.value > 0 { 0.20 } else { 0.0 }; - let duration = if _input.is_enhanced { 8.0 } else { 7.0 }; - if _input.calc_data.time_total > duration { + |input: ModifierResponseInput| -> DamageModifierResponse { + let mut damage_mult = if input.value > 0 { 0.20 } else { 0.0 }; + let duration = if input.is_enhanced { 8.0 } else { 7.0 }; + if input.calc_data.time_total > duration { damage_mult = 0.0; }; DamageModifierResponse { @@ -503,83 +489,79 @@ pub fn year_4_perks() { explosive_dmg_scale: 1.0 + damage_mult, crit_scale: 1.0, } - }), + }, ); add_hmr( Perks::Harmony, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let handling = if _input.value > 0 { 15 } else { 0 }; - HandlingModifierResponse { - stat_add: handling, - ..Default::default() - } - }, - ), + |input: ModifierResponseInput| -> HandlingModifierResponse { + let handling = if input.value > 0 { 15 } else { 0 }; + HandlingModifierResponse { + stat_add: handling, + ..Default::default() + } + }, ); add_sbr( Perks::Harmony, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut out = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { out.insert(StatHashes::HANDLING.into(), 15); } out - }), + }, ); add_sbr( Perks::Surplus, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut out = HashMap::new(); - if _input.value == 1 { + if input.value == 1 { out.insert(StatHashes::HANDLING.into(), 10); out.insert(StatHashes::RELOAD.into(), 5); out.insert(StatHashes::STABILITY.into(), 5); - } else if _input.value == 2 { + } else if input.value == 2 { out.insert(StatHashes::HANDLING.into(), 25); out.insert(StatHashes::RELOAD.into(), 25); out.insert(StatHashes::STABILITY.into(), 15); - } else if _input.value == 3 { + } else if input.value == 3 { out.insert(StatHashes::HANDLING.into(), 50); out.insert(StatHashes::RELOAD.into(), 50); out.insert(StatHashes::STABILITY.into(), 25); } out - }), + }, ); add_hmr( Perks::Surplus, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let handling = if _input.value == 1 { - 10 - } else if _input.value == 2 { - 25 - } else if _input.value == 3 { - 50 - } else { - 0 - }; - HandlingModifierResponse { - stat_add: handling, - ..Default::default() - } - }, - ), + |input: ModifierResponseInput| -> HandlingModifierResponse { + let handling = if input.value == 1 { + 10 + } else if input.value == 2 { + 25 + } else if input.value == 3 { + 50 + } else { + 0 + }; + HandlingModifierResponse { + stat_add: handling, + ..Default::default() + } + }, ); add_rsmr( Perks::Surplus, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - let reload = if _input.value == 1 { + |input: ModifierResponseInput| -> ReloadModifierResponse { + let reload = if input.value == 1 { 5 - } else if _input.value == 2 { + } else if input.value == 2 { 25 - } else if _input.value == 3 { + } else if input.value == 3 { 50 } else { 0 @@ -588,53 +570,51 @@ pub fn year_4_perks() { reload_stat_add: reload, reload_time_scale: 1.0, } - }), + }, ); add_sbr( Perks::HeatingUp, - Box::new(|_input: ModifierResponseInput| -> HashMap { - let val = clamp(_input.value, 0, 2) as i32; + |input: ModifierResponseInput| -> HashMap { + let val = clamp(input.value, 0, 2) as i32; let mut out = HashMap::new(); out.insert(StatHashes::RECOIL_DIR.into(), 20 * val); out.insert(StatHashes::STABILITY.into(), 15 * val); out - }), + }, ); add_sbr( Perks::TunnelVision, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut out = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { out.insert(StatHashes::AIM_ASSIST.into(), 20); } out - }), + }, ); add_hmr( Perks::TunnelVision, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value > 0 { - HandlingModifierResponse { - ads_scale: 0.85, - ..Default::default() - } - } else { - HandlingModifierResponse::default() + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value > 0 { + HandlingModifierResponse { + ads_scale: 0.85, + ..Default::default() } - }, - ), + } else { + HandlingModifierResponse::default() + } + }, ); add_dmr( Perks::KickStart, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { const DURATION: f64 = 1.0; const MULT: f64 = 1.15; - if _input.value == 0 || _input.calc_data.time_total > DURATION { + if input.value == 0 || input.calc_data.time_total > DURATION { return DamageModifierResponse::default(); } @@ -643,37 +623,37 @@ pub fn year_4_perks() { explosive_dmg_scale: MULT, ..Default::default() } - }), + }, ); add_fmr( Perks::KickStart, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { - let mut fire_rate_mult = if _input.value > 0 { 0.20 } else { 0.0 }; + |input: ModifierResponseInput| -> FiringModifierResponse { + let mut fire_rate_mult = if input.value > 0 { 0.20 } else { 0.0 }; let duration = 1.0; - if _input.calc_data.time_total > duration { + if input.calc_data.time_total > duration { fire_rate_mult = 0.0; }; FiringModifierResponse { burst_delay_scale: 1.0 - fire_rate_mult, ..Default::default() } - }), + }, ); add_dmr( Perks::Recombination, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { //to make sure it doesn't go over the max stacks - let val = if _input.is_enhanced { - clamp(_input.value, 0, 8) as f64 + let val = if input.is_enhanced { + clamp(input.value, 0, 8) as f64 } else { - clamp(_input.value, 0, 10) as f64 + clamp(input.value, 0, 10) as f64 }; //dmg buff per stack depends on enhancement and pvp let buff = 1.0 - + if _input.calc_data.total_shots_fired == 0.0 { - match (_input.is_enhanced, _input.pvp) { + + if input.calc_data.total_shots_fired == 0.0 { + match (input.is_enhanced, input.pvp) { (false, false) => 0.1 * val, (false, true) => 0.05 * val, (true, false) => 0.125 * val, @@ -686,6 +666,6 @@ pub fn year_4_perks() { impact_dmg_scale: buff, ..Default::default() } - }), + }, ); } diff --git a/src/perks/year_5_perks.rs b/src/perks/year_5_perks.rs index 543546f8..22a3c05a 100644 --- a/src/perks/year_5_perks.rs +++ b/src/perks/year_5_perks.rs @@ -15,12 +15,12 @@ use super::{ pub fn year_5_perks() { add_fmr( Perks::CascadePoint, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { - let duration = if _input.is_enhanced { 3.0 } else { 2.5 }; + |input: ModifierResponseInput| -> FiringModifierResponse { + let duration = if input.is_enhanced { 3.0 } else { 2.5 }; let mut delay_mult = 1.0; - if _input.calc_data.time_total < duration && _input.value > 0 { - if *_input.calc_data.weapon_type == WeaponType::MACHINEGUN - || *_input.calc_data.weapon_type == WeaponType::SUBMACHINEGUN + if input.calc_data.time_total < duration && input.value > 0 { + if *input.calc_data.weapon_type == WeaponType::MACHINEGUN + || *input.calc_data.weapon_type == WeaponType::SUBMACHINEGUN { delay_mult = 0.7; } else { @@ -33,85 +33,85 @@ pub fn year_5_perks() { inner_burst_scale: 1.0, burst_size_add: 0.0, } - }), + }, ); add_sbr( Perks::Encore, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut map = HashMap::new(); - let val = clamp(_input.value, 0, 4) as i32; + let val = clamp(input.value, 0, 4) as i32; let stability_boost = 8 * val; let range_boost = 5 * val; map.insert(StatHashes::RANGE.into(), range_boost); map.insert(StatHashes::STABILITY.into(), stability_boost); map - }), + }, ); add_rmr( Perks::Encore, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { - let val = clamp(_input.value, 0, 4) as i32; + |input: ModifierResponseInput| -> RangeModifierResponse { + let val = clamp(input.value, 0, 4) as i32; let range_boost = 5 * val; RangeModifierResponse { range_stat_add: range_boost, ..Default::default() } - }), + }, ); add_dmr( Perks::FocusedFury, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let shots_needed = (_input.calc_data.base_mag - * (_input.calc_data.curr_firing_data.burst_size as f64)) + |input: ModifierResponseInput| -> DamageModifierResponse { + let shots_needed = (input.calc_data.base_mag + * (input.calc_data.curr_firing_data.burst_size as f64)) / 2.0; - let dmg_boost = - if _input.calc_data.total_shots_fired >= shots_needed || _input.value > 0 { - 1.2 - } else { - 1.0 - }; + let dmg_boost = if input.calc_data.total_shots_fired >= shots_needed || input.value > 0 + { + 1.2 + } else { + 1.0 + }; DamageModifierResponse { impact_dmg_scale: dmg_boost, explosive_dmg_scale: dmg_boost, crit_scale: 1.0, } - }), + }, ); add_rmr( Perks::FragileFocus, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { - let range_bonus = if _input.value > 0 { 20 } else { 0 }; + |input: ModifierResponseInput| -> RangeModifierResponse { + let range_bonus = if input.value > 0 { 20 } else { 0 }; RangeModifierResponse { range_stat_add: range_bonus, range_all_scale: 1.0, range_hip_scale: 1.0, range_zoom_scale: 1.0, } - }), + }, ); add_sbr( Perks::FragileFocus, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut map = HashMap::new(); let mut range_bonus = 0; - if _input.value > 0 { + if input.value > 0 { range_bonus = 20; }; map.insert(StatHashes::RANGE.into(), range_bonus); map - }), + }, ); add_dmr( Perks::GutShot, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value == 0 { + |input: ModifierResponseInput| -> DamageModifierResponse { + if input.value == 0 { return DamageModifierResponse::default(); } let high_weapons = [ @@ -122,14 +122,14 @@ pub fn year_5_perks() { ]; let dmg_scale: f64; let crit_scale: f64; - if high_weapons.contains(_input.calc_data.weapon_type) { + if high_weapons.contains(input.calc_data.weapon_type) { dmg_scale = 1.2; crit_scale = 1.0 / 1.2; } else { dmg_scale = 1.1; crit_scale = 1.0 / 1.1; }; - // if _input.calc_data.base_crit_mult <= 1.0 { + // if input.calc_data.base_crit_mult <= 1.0 { // crit_scale = 1.0; // } DamageModifierResponse { @@ -137,27 +137,27 @@ pub fn year_5_perks() { explosive_dmg_scale: dmg_scale, crit_scale, } - }), + }, ); add_sbr( Perks::OffhandStrike, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut map = HashMap::new(); let mut stability_boost = 0; - if _input.value > 0 { + if input.value > 0 { stability_boost = 30; }; map.insert(StatHashes::STABILITY.into(), stability_boost); map - }), + }, ); add_rmr( Perks::OffhandStrike, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { + |input: ModifierResponseInput| -> RangeModifierResponse { let mut range_hip_mult = 1.0; - if _input.value > 0 { + if input.value > 0 { range_hip_mult = 1.45; }; RangeModifierResponse { @@ -166,41 +166,39 @@ pub fn year_5_perks() { range_hip_scale: range_hip_mult, range_zoom_scale: 1.0, } - }), + }, ); add_hmr( Perks::Slickdraw, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - HandlingModifierResponse { - stat_add: 100, - stow_scale: 1.0, - draw_scale: 0.95, - ..Default::default() - } - }, - ), + |_: ModifierResponseInput| -> HandlingModifierResponse { + HandlingModifierResponse { + stat_add: 100, + stow_scale: 1.0, + draw_scale: 0.95, + ..Default::default() + } + }, ); add_sbr( Perks::Slickdraw, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |_: ModifierResponseInput| -> HashMap { let mut map = HashMap::new(); map.insert(StatHashes::HANDLING.into(), 100); map - }), + }, ); add_sbr( Perks::StatsForAll, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut out = HashMap::new(); let mut stability_boost = 0; let mut range_boost = 0; let mut reload_boost = 0; let mut handling_boost = 0; - if _input.value > 0 { + if input.value > 0 { stability_boost = 10; range_boost = 10; reload_boost = 35; @@ -211,32 +209,30 @@ pub fn year_5_perks() { out.insert(StatHashes::RELOAD.into(), reload_boost); out.insert(StatHashes::HANDLING.into(), handling_boost); out - }), + }, ); add_hmr( Perks::StatsForAll, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let mut handling_boost = 0; - let duration = if _input.is_enhanced { 11.0 } else { 10.0 }; - if _input.value > 0 && _input.calc_data.time_total < duration { - handling_boost = 35; - }; - HandlingModifierResponse { - stat_add: handling_boost, - ..Default::default() - } - }, - ), + |input: ModifierResponseInput| -> HandlingModifierResponse { + let mut handling_boost = 0; + let duration = if input.is_enhanced { 11.0 } else { 10.0 }; + if input.value > 0 && input.calc_data.time_total < duration { + handling_boost = 35; + }; + HandlingModifierResponse { + stat_add: handling_boost, + ..Default::default() + } + }, ); add_rmr( Perks::StatsForAll, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { + |input: ModifierResponseInput| -> RangeModifierResponse { let mut range = 0; let mut range_mult = 1.0; - if _input.value > 0 { + if input.value > 0 { range = 10; range_mult = 1.05; }; @@ -246,16 +242,16 @@ pub fn year_5_perks() { range_hip_scale: 1.0, range_zoom_scale: 1.0, } - }), + }, ); add_rsmr( Perks::StatsForAll, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { + |input: ModifierResponseInput| -> ReloadModifierResponse { let mut reload = 0; let mut reload_mult = 1.0; - let duration = if _input.is_enhanced { 11.0 } else { 10.0 }; - if _input.value > 0 && _input.calc_data.time_total < duration { + let duration = if input.is_enhanced { 11.0 } else { 10.0 }; + if input.value > 0 && input.calc_data.time_total < duration { reload = 35; reload_mult = 0.95; }; @@ -263,60 +259,58 @@ pub fn year_5_perks() { reload_stat_add: reload, reload_time_scale: reload_mult, } - }), + }, ); add_sbr( Perks::SteadyHands, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut map = HashMap::new(); let mut handling = 0; - if _input.value > 0 { + if input.value > 0 { handling = 100; }; map.insert(StatHashes::HANDLING.into(), handling); map - }), + }, ); add_hmr( Perks::SteadyHands, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let mut handling_mult = 1.0; - let mut handling = 0; - let duration = if _input.is_enhanced { 9.0 } else { 8.5 }; - if _input.value > 0 && _input.calc_data.time_total < duration { - handling_mult = 0.825; - handling = 100; - }; - HandlingModifierResponse { - stat_add: handling, - stow_scale: handling_mult, - draw_scale: handling_mult, - ..Default::default() - } - }, - ), + |input: ModifierResponseInput| -> HandlingModifierResponse { + let mut handling_mult = 1.0; + let mut handling = 0; + let duration = if input.is_enhanced { 9.0 } else { 8.5 }; + if input.value > 0 && input.calc_data.time_total < duration { + handling_mult = 0.825; + handling = 100; + }; + HandlingModifierResponse { + stat_add: handling, + stow_scale: handling_mult, + draw_scale: handling_mult, + ..Default::default() + } + }, ); add_dmr( Perks::TargetLock, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let nerf = 0.625; //patch 7.1.5 - let enh_increase = if _input.is_enhanced { 1.2 } else { 1.0 }; + let enh_increase = if input.is_enhanced { 1.2 } else { 1.0 }; let low_end_dmg = 0.0934 * enh_increase * nerf; let high_end_dmg = 0.4005 * enh_increase * nerf; let formula_start = -0.35; let formula_end = 1.1350; - let percent_of_mag = _input.calc_data.shots_fired_this_mag / _input.calc_data.base_mag; + let percent_of_mag = input.calc_data.shots_fired_this_mag / input.calc_data.base_mag; let buff = if (percent_of_mag < 0.125 - && *_input.calc_data.weapon_type != WeaponType::SUBMACHINEGUN) + && *input.calc_data.weapon_type != WeaponType::SUBMACHINEGUN) || (percent_of_mag < 0.2 - && *_input.calc_data.weapon_type == WeaponType::SUBMACHINEGUN) + && *input.calc_data.weapon_type == WeaponType::SUBMACHINEGUN) { 0.0 } else if percent_of_mag > formula_end { @@ -332,16 +326,16 @@ pub fn year_5_perks() { explosive_dmg_scale: buff + 1.0, crit_scale: 1.0, } - }), + }, ); add_dmr( Perks::UnderOver, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let mut buff = 1.0_f64; - if _input.calc_data.has_overshield { - buff += if _input.pvp { 0.2 } else { 1.25 }; - if _input.is_enhanced { + if input.calc_data.has_overshield { + buff += if input.pvp { 0.2 } else { 1.25 }; + if input.is_enhanced { buff *= 1.05; } } @@ -350,45 +344,43 @@ pub fn year_5_perks() { explosive_dmg_scale: buff, crit_scale: 1.0, } - }), + }, ); add_sbr( Perks::WellRounded, - Box::new(|_input: ModifierResponseInput| -> HashMap { - let val = clamp(_input.value, 0, 2) as i32; + |input: ModifierResponseInput| -> HashMap { + let val = clamp(input.value, 0, 2) as i32; let mut map = HashMap::new(); - let stat_base = if _input.is_enhanced { 12 } else { 10 }; + let stat_base = if input.is_enhanced { 12 } else { 10 }; let stat_bump = stat_base * val; map.insert(StatHashes::STABILITY.into(), stat_bump); map.insert(StatHashes::RANGE.into(), stat_bump); map.insert(StatHashes::HANDLING.into(), stat_bump); map - }), + }, ); add_hmr( Perks::WellRounded, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let val = clamp(_input.value, 0, 2) as i32; - //due to ease of activation and upkeep will assume its always active - // let mut duration = if _input.is_enhanced {9.0} else {8.5}; - let stat_base = if _input.is_enhanced { 12 } else { 10 }; - let handling = stat_base * val; - HandlingModifierResponse { - stat_add: handling, - ..Default::default() - } - }, - ), + |input: ModifierResponseInput| -> HandlingModifierResponse { + let val = clamp(input.value, 0, 2) as i32; + //due to ease of activation and upkeep will assume its always active + // let mut duration = if input.is_enhanced {9.0} else {8.5}; + let stat_base = if input.is_enhanced { 12 } else { 10 }; + let handling = stat_base * val; + HandlingModifierResponse { + stat_add: handling, + ..Default::default() + } + }, ); add_rmr( Perks::WellRounded, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { - let val = clamp(_input.value, 0, 2) as i32; - let stat_base = if _input.is_enhanced { 12 } else { 10 }; + |input: ModifierResponseInput| -> RangeModifierResponse { + let val = clamp(input.value, 0, 2) as i32; + let stat_base = if input.is_enhanced { 12 } else { 10 }; let range = stat_base * val; RangeModifierResponse { range_stat_add: range, @@ -396,13 +388,13 @@ pub fn year_5_perks() { range_hip_scale: 1.0, range_zoom_scale: 1.0, } - }), + }, ); add_dmr( Perks::BaitAndSwitch, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value == 0 { + |input: ModifierResponseInput| -> DamageModifierResponse { + if input.value == 0 { return DamageModifierResponse::default(); } DamageModifierResponse { @@ -410,15 +402,15 @@ pub fn year_5_perks() { explosive_dmg_scale: 1.30, crit_scale: 1.0, } - }), + }, ); add_rsmr( Perks::CompulsiveReloader, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - let reload_add = if _input.is_enhanced { 55 } else { 50 }; - if _input.calc_data.shots_fired_this_mag <= _input.calc_data.base_mag / 2.0 - && _input.value > 0 + |input: ModifierResponseInput| -> ReloadModifierResponse { + let reload_add = if input.is_enhanced { 55 } else { 50 }; + if input.calc_data.shots_fired_this_mag <= input.calc_data.base_mag / 2.0 + && input.value > 0 { ReloadModifierResponse { reload_stat_add: reload_add, @@ -427,27 +419,27 @@ pub fn year_5_perks() { } else { ReloadModifierResponse::default() } - }), + }, ); add_sbr( Perks::CompulsiveReloader, - Box::new(|_input: ModifierResponseInput| -> HashMap { - let reload_add = if _input.is_enhanced { 55 } else { 50 }; + |input: ModifierResponseInput| -> HashMap { + let reload_add = if input.is_enhanced { 55 } else { 50 }; let mut map = HashMap::new(); - if _input.calc_data.shots_fired_this_mag <= _input.calc_data.base_mag / 2.0 - && _input.value > 0 + if input.calc_data.shots_fired_this_mag <= input.calc_data.base_mag / 2.0 + && input.value > 0 { map.insert(StatHashes::RELOAD.into(), reload_add); } map - }), + }, ); add_sbr( Perks::SleightOfHand, - Box::new(|_input: ModifierResponseInput| -> HashMap { - let val = clamp(_input.value, 0, 3) as i32; + |input: ModifierResponseInput| -> HashMap { + let val = clamp(input.value, 0, 3) as i32; let mut map = HashMap::new(); let stat_base = 10; let stat_bump = stat_base * val; @@ -455,90 +447,86 @@ pub fn year_5_perks() { map.insert(StatHashes::RELOAD.into(), stat_bump); map.insert(StatHashes::HANDLING.into(), stat_bump); map - }), + }, ); add_hmr( Perks::SleightOfHand, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let val = clamp(_input.value, 0, 3) as i32; - let stat_base = 10; - let handling = stat_base * val; - HandlingModifierResponse { - stat_add: handling, - ..Default::default() - } - }, - ), + |input: ModifierResponseInput| -> HandlingModifierResponse { + let val = clamp(input.value, 0, 3) as i32; + let stat_base = 10; + let handling = stat_base * val; + HandlingModifierResponse { + stat_add: handling, + ..Default::default() + } + }, ); add_rsmr( Perks::SleightOfHand, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - let val = clamp(_input.value, 0, 3) as i32; + |input: ModifierResponseInput| -> ReloadModifierResponse { + let val = clamp(input.value, 0, 3) as i32; let stat_base = 10; let reload = stat_base * val; ReloadModifierResponse { reload_stat_add: reload, ..Default::default() } - }), + }, ); add_hmr( Perks::ShotSwap, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let mut handling_mult = 1.0; - let mut handling = 0; - if _input.value > 0 { - handling_mult = 0.95; - handling = 100; - }; - HandlingModifierResponse { - draw_add: handling, - stow_add: handling, - stow_scale: handling_mult, - draw_scale: handling_mult, - ..Default::default() - } - }, - ), + |input: ModifierResponseInput| -> HandlingModifierResponse { + let mut handling_mult = 1.0; + let mut handling = 0; + if input.value > 0 { + handling_mult = 0.95; + handling = 100; + }; + HandlingModifierResponse { + draw_add: handling, + stow_add: handling, + stow_scale: handling_mult, + draw_scale: handling_mult, + ..Default::default() + } + }, ); add_sbr( Perks::ShotSwap, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut map = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { map.insert(StatHashes::HANDLING.into(), 100); } map - }), + }, ); add_fmr( Perks::SuccesfulWarmup, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { - if _input.value == 0 { + |input: ModifierResponseInput| -> FiringModifierResponse { + if input.value == 0 { return FiringModifierResponse::default(); } FiringModifierResponse { burst_delay_scale: 0.625, ..Default::default() } - }), + }, ); add_dmr( Perks::UnstoppableForce, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let scalar = if _input.value >= 1 { 1.20 } else { 1.0 }; + |input: ModifierResponseInput| -> DamageModifierResponse { + let scalar = if input.value >= 1 { 1.20 } else { 1.0 }; DamageModifierResponse { impact_dmg_scale: scalar, explosive_dmg_scale: scalar, crit_scale: 1.0, } - }), + }, ); } diff --git a/src/perks/year_6_perks.rs b/src/perks/year_6_perks.rs index 193b26cd..e7b3938f 100644 --- a/src/perks/year_6_perks.rs +++ b/src/perks/year_6_perks.rs @@ -17,74 +17,74 @@ use super::{ pub fn year_6_perks() { add_sbr( Perks::KeepAway, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut map = HashMap::new(); let mut range_bonus = 0; let mut reload_bonus = 0; - let ev = if _input.is_enhanced { 2 } else { 0 }; - if _input.value > 0 { + let ev = if input.is_enhanced { 2 } else { 0 }; + if input.value > 0 { range_bonus = 10 + ev; reload_bonus = 30 + ev; }; map.insert(StatHashes::RANGE.into(), range_bonus); map.insert(StatHashes::RELOAD.into(), reload_bonus); map - }), + }, ); add_rmr( Perks::KeepAway, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { - let ev = if _input.is_enhanced { 2 } else { 0 }; - let range_bonus = if _input.value > 0 { 10 + ev } else { 0 }; + |input: ModifierResponseInput| -> RangeModifierResponse { + let ev = if input.is_enhanced { 2 } else { 0 }; + let range_bonus = if input.value > 0 { 10 + ev } else { 0 }; RangeModifierResponse { range_stat_add: range_bonus, ..Default::default() } - }), + }, ); add_rsmr( Perks::KeepAway, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - let ev = if _input.is_enhanced { 2 } else { 0 }; - let reload_bonus = if _input.value > 0 { 30 + ev } else { 0 }; + |input: ModifierResponseInput| -> ReloadModifierResponse { + let ev = if input.is_enhanced { 2 } else { 0 }; + let reload_bonus = if input.value > 0 { 30 + ev } else { 0 }; ReloadModifierResponse { reload_stat_add: reload_bonus, ..Default::default() } - }), + }, ); add_sbr( Perks::FieldTested, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut map = HashMap::new(); - if _input.value > 4 { + if input.value > 4 { map.insert(StatHashes::RANGE.into(), 20); map.insert(StatHashes::RELOAD.into(), 55); - } else if _input.value == 4 { + } else if input.value == 4 { map.insert(StatHashes::RANGE.into(), 12); map.insert(StatHashes::RELOAD.into(), 35); - } else if _input.value == 3 { + } else if input.value == 3 { map.insert(StatHashes::RANGE.into(), 9); map.insert(StatHashes::RELOAD.into(), 20); - } else if _input.value == 2 { + } else if input.value == 2 { map.insert(StatHashes::RANGE.into(), 6); map.insert(StatHashes::RELOAD.into(), 10); - } else if _input.value == 1 { + } else if input.value == 1 { map.insert(StatHashes::RELOAD.into(), 5); map.insert(StatHashes::RANGE.into(), 3); } map - }), + }, ); // add_hmr( // Perks::FieldTested, - // Box::new( - // |_input: ModifierResponseInput| -> HandlingModifierResponse { - // let val = clamp(_input.value, 0, 5) as i32; + // + // |input: ModifierResponseInput| -> HandlingModifierResponse { + // let val = clamp(input.value, 0, 5) as i32; // HandlingModifierResponse { // stat_add: val * 5, // ..Default::default() @@ -95,17 +95,17 @@ pub fn year_6_perks() { add_rsmr( Perks::FieldTested, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { + |input: ModifierResponseInput| -> ReloadModifierResponse { let reload_bump; - if _input.value > 4 { + if input.value > 4 { reload_bump = 55; - } else if _input.value == 4 { + } else if input.value == 4 { reload_bump = 35; - } else if _input.value == 3 { + } else if input.value == 3 { reload_bump = 20; - } else if _input.value == 2 { + } else if input.value == 2 { reload_bump = 10; - } else if _input.value == 1 { + } else if input.value == 1 { reload_bump = 5; } else { reload_bump = 0; @@ -114,22 +114,22 @@ pub fn year_6_perks() { reload_stat_add: reload_bump, ..Default::default() } - }), + }, ); add_rmr( Perks::FieldTested, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { + |input: ModifierResponseInput| -> RangeModifierResponse { let range_bump; - if _input.value > 4 { + if input.value > 4 { range_bump = 20; - } else if _input.value == 4 { + } else if input.value == 4 { range_bump = 12; - } else if _input.value == 3 { + } else if input.value == 3 { range_bump = 9; - } else if _input.value == 2 { + } else if input.value == 2 { range_bump = 6; - } else if _input.value == 1 { + } else if input.value == 1 { range_bump = 3; } else { range_bump = 0; @@ -138,13 +138,13 @@ pub fn year_6_perks() { range_stat_add: range_bump, ..Default::default() } - }), + }, ); add_dmr( Perks::ParacausalAffinity, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value > 0 { + |input: ModifierResponseInput| -> DamageModifierResponse { + if input.value > 0 { DamageModifierResponse { explosive_dmg_scale: 1.2, impact_dmg_scale: 1.2, @@ -153,26 +153,24 @@ pub fn year_6_perks() { } else { DamageModifierResponse::default() } - }), + }, ); add_mmr( Perks::EnviousAssassin, - Box::new( - |_input: ModifierResponseInput| -> MagazineModifierResponse { - let val = _input.value as f64; - MagazineModifierResponse { - magazine_scale: 1.0 + clamp(0.1 * val, 0.0, 2.0), - ..Default::default() - } - }, - ), + |input: ModifierResponseInput| -> MagazineModifierResponse { + let val = input.value as f64; + MagazineModifierResponse { + magazine_scale: 1.0 + clamp(0.1 * val, 0.0, 2.0), + ..Default::default() + } + }, ); add_dmr( Perks::CollectiveAction, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let buff = match (_input.pvp, _input.value) { + |input: ModifierResponseInput| -> DamageModifierResponse { + let buff = match (input.pvp, input.value) { (_, 0) => 1.0, (true, 1..) => 1.1, (false, 1..) => 1.2, @@ -182,70 +180,66 @@ pub fn year_6_perks() { explosive_dmg_scale: buff, ..Default::default() } - }), + }, ); add_dmr( Perks::Bipod, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + |_: ModifierResponseInput| -> DamageModifierResponse { DamageModifierResponse { impact_dmg_scale: 0.75, explosive_dmg_scale: 0.75, ..Default::default() } - }), + }, ); add_mmr( Perks::Bipod, - Box::new( - |_input: ModifierResponseInput| -> MagazineModifierResponse { - MagazineModifierResponse { - magazine_scale: 2.0, - ..Default::default() - } - }, - ), + |_: ModifierResponseInput| -> MagazineModifierResponse { + MagazineModifierResponse { + magazine_scale: 2.0, + ..Default::default() + } + }, ); add_imr( Perks::Bipod, - Box::new( - |_input: ModifierResponseInput| -> InventoryModifierResponse { - InventoryModifierResponse { - inv_add: 5, - ..Default::default() - } - }, - ), + |_: ModifierResponseInput| -> InventoryModifierResponse { + InventoryModifierResponse { + inv_add: 5, + ..Default::default() + } + }, ); add_fmr( Perks::Bipod, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { + |_: ModifierResponseInput| -> FiringModifierResponse { FiringModifierResponse { burst_delay_scale: 0.75, ..Default::default() } - }), + }, ); add_fmr( Perks::ControlledBurst, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { - if _input.value > 0 { + |input: ModifierResponseInput| -> FiringModifierResponse { + if input.value > 0 { return FiringModifierResponse { burst_delay_scale: 0.9, ..Default::default() }; } FiringModifierResponse::default() - }), + }, ); add_dmr( Perks::ControlledBurst, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value > 0 { + |input: ModifierResponseInput| -> DamageModifierResponse { + if input.value > 0 { return DamageModifierResponse { impact_dmg_scale: 1.2, explosive_dmg_scale: 1.2, @@ -253,222 +247,208 @@ pub fn year_6_perks() { }; } DamageModifierResponse::default() - }), + }, ); add_sbr( Perks::InvisibleHand, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { stats.insert(StatHashes::STABILITY.into(), 25); } stats - }), + }, ); add_sbr( Perks::UnsatedHunger, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { stats.insert(StatHashes::STABILITY.into(), 20); stats.insert(StatHashes::HANDLING.into(), 60); stats.insert(StatHashes::RELOAD.into(), 60); } stats - }), + }, ); add_rsmr( Perks::UnsatedHunger, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - if _input.value > 0 { + |input: ModifierResponseInput| -> ReloadModifierResponse { + if input.value > 0 { return ReloadModifierResponse { reload_stat_add: 60, ..Default::default() }; } ReloadModifierResponse::default() - }), + }, ); add_hmr( Perks::UnsatedHunger, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value > 0 { - return HandlingModifierResponse { - stat_add: 60, - ..Default::default() - }; - } - HandlingModifierResponse::default() - }, - ), + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value > 0 { + return HandlingModifierResponse { + stat_add: 60, + ..Default::default() + }; + } + HandlingModifierResponse::default() + }, ); add_hmr( Perks::Discord, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value > 0 { - return HandlingModifierResponse { - ads_scale: 0.75, - ..Default::default() - }; - } - HandlingModifierResponse::default() - }, - ), + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value > 0 { + return HandlingModifierResponse { + ads_scale: 0.75, + ..Default::default() + }; + } + HandlingModifierResponse::default() + }, ); add_sbr( Perks::Discord, - Box::new(|_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { stats.insert(StatHashes::AIRBORNE.into(), 30); } stats - }), + }, ); add_dmr( Perks::PrecisionInstrument, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let max_percent = if _input.is_enhanced { 0.30 } else { 0.25 }; + |input: ModifierResponseInput| -> DamageModifierResponse { + let max_percent = if input.is_enhanced { 0.30 } else { 0.25 }; let max_stacks = 6.0; - let shots_hit = _input.calc_data.total_shots_hit; + let shots_hit = input.calc_data.total_shots_hit; - let stacks = clamp(_input.value as f64 + shots_hit, 0.0, max_stacks); + let stacks = clamp(input.value as f64 + shots_hit, 0.0, max_stacks); DamageModifierResponse { crit_scale: 1.0 + stacks * max_percent / max_stacks, ..Default::default() } - }), + }, ); add_rsmr( Perks::LooseChange, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - if _input.value == 0 { + |input: ModifierResponseInput| -> ReloadModifierResponse { + if input.value == 0 { return ReloadModifierResponse::default(); } ReloadModifierResponse { reload_stat_add: 50, ..Default::default() } - }), + }, ); add_sbr( Perks::LooseChange, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - if _input.value == 0 { - return HashMap::new(); - } - HashMap::from([ - (StatHashes::RELOAD.into(), 50), - (StatHashes::AIM_ASSIST.into(), 20), - ]) - }, - ), + |input: ModifierResponseInput| -> HashMap { + if input.value == 0 { + return HashMap::new(); + } + HashMap::from([ + (StatHashes::RELOAD.into(), 50), + (StatHashes::AIM_ASSIST.into(), 20), + ]) + }, ); add_dmr( Perks::HighGround, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value == 0 { + |input: ModifierResponseInput| -> DamageModifierResponse { + if input.value == 0 { return DamageModifierResponse::default(); } - let mult = if _input.pvp { 1.1 } else { 1.2 }; + let mult = if input.pvp { 1.1 } else { 1.2 }; DamageModifierResponse { impact_dmg_scale: mult, explosive_dmg_scale: mult, ..Default::default() } - }), + }, ); add_sbr( Perks::HeadRush, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - if _input.value == 0 { - return HashMap::new(); - } - HashMap::from([ - (StatHashes::RELOAD.into(), 10), - (StatHashes::HANDLING.into(), 0), - ]) - }, - ), + |input: ModifierResponseInput| -> HashMap { + if input.value == 0 { + return HashMap::new(); + } + HashMap::from([ + (StatHashes::RELOAD.into(), 10), + (StatHashes::HANDLING.into(), 0), + ]) + }, ); add_hmr( Perks::HeadRush, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value == 0 { - return HandlingModifierResponse::default(); - } - //unknown at time - HandlingModifierResponse { - ..Default::default() - } - }, - ), + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value == 0 { + return HandlingModifierResponse::default(); + } + //unknown at time + HandlingModifierResponse { + ..Default::default() + } + }, ); add_rsmr( Perks::HeadRush, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - if _input.value == 0 { + |input: ModifierResponseInput| -> ReloadModifierResponse { + if input.value == 0 { return ReloadModifierResponse::default(); } ReloadModifierResponse { reload_stat_add: 10, ..Default::default() } - }), + }, ); add_sbr( Perks::EnlightendAction, - Box::new( - |_input: ModifierResponseInput| -> HashMap { - let shots_hit = _input.calc_data.total_shots_hit as i32; - let value = _input.value as i32; - let stat_per_stack = 10; - let max_stacks = 5; + |input: ModifierResponseInput| -> HashMap { + let shots_hit = input.calc_data.total_shots_hit as i32; + let value = input.value as i32; + let stat_per_stack = 10; + let max_stacks = 5; - let stat_bump = clamp(value + shots_hit, 0, max_stacks) * stat_per_stack; - HashMap::from([ - (StatHashes::RELOAD.into(), stat_bump), - (StatHashes::HANDLING.into(), stat_bump), - ]) - }, - ), + let stat_bump = clamp(value + shots_hit, 0, max_stacks) * stat_per_stack; + HashMap::from([ + (StatHashes::RELOAD.into(), stat_bump), + (StatHashes::HANDLING.into(), stat_bump), + ]) + }, ); add_hmr( Perks::EnlightendAction, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let shots_hit = _input.calc_data.total_shots_hit as i32; - let value = _input.value as i32; - let stat_per_stack = 10; - let max_stacks = 5; + |input: ModifierResponseInput| -> HandlingModifierResponse { + let shots_hit = input.calc_data.total_shots_hit as i32; + let value = input.value as i32; + let stat_per_stack = 10; + let max_stacks = 5; - let stat_bump = clamp(value + shots_hit, 0, max_stacks) * stat_per_stack; - HandlingModifierResponse { - stat_add: stat_bump, - ..Default::default() - } - }, - ), + let stat_bump = clamp(value + shots_hit, 0, max_stacks) * stat_per_stack; + HandlingModifierResponse { + stat_add: stat_bump, + ..Default::default() + } + }, ); add_rsmr( Perks::EnlightendAction, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - let shots_hit = _input.calc_data.total_shots_hit as i32; - let value = _input.value as i32; + |input: ModifierResponseInput| -> ReloadModifierResponse { + let shots_hit = input.calc_data.total_shots_hit as i32; + let value = input.value as i32; let stat_per_stack = 10; let max_stacks = 5; @@ -477,14 +457,14 @@ pub fn year_6_perks() { reload_stat_add: stat_bump, ..Default::default() } - }), + }, ); add_dmr( Perks::SwordLogic, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let buff = match (_input.pvp, _input.value) { + |input: ModifierResponseInput| -> DamageModifierResponse { + let buff = match (input.pvp, input.value) { (_, 0) => 1.0, - (false, 1..=3) => 1.05 + (0.1 * _input.value as f64), + (false, 1..=3) => 1.05 + (0.1 * input.value as f64), (false, 4..) => 1.5, (true, 1 | 2) => 1.2, (true, 3..) => 1.35, @@ -494,50 +474,48 @@ pub fn year_6_perks() { explosive_dmg_scale: buff, ..Default::default() } - }), + }, ); add_sbr( Perks::NobleDeeds, - Box::new(|_input: ModifierResponseInput| -> HashMap { - if _input.value == 0 { + |input: ModifierResponseInput| -> HashMap { + if input.value == 0 { return HashMap::new(); } HashMap::from([ (StatHashes::HANDLING.into(), 30), (StatHashes::RELOAD.into(), 30), ]) - }), + }, ); add_rsmr( Perks::NobleDeeds, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - if _input.value == 0 { + |input: ModifierResponseInput| -> ReloadModifierResponse { + if input.value == 0 { return ReloadModifierResponse::default(); } ReloadModifierResponse { reload_stat_add: 30, ..Default::default() } - }), + }, ); add_hmr( Perks::NobleDeeds, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value == 0 { - return HandlingModifierResponse::default(); - } - HandlingModifierResponse { - stat_add: 30, - ..Default::default() - } - }, - ), + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value == 0 { + return HandlingModifierResponse::default(); + } + HandlingModifierResponse { + stat_add: 30, + ..Default::default() + } + }, ); add_fmr( Perks::Onslaught, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { - let buff = match _input.value { + |input: ModifierResponseInput| -> FiringModifierResponse { + let buff = match input.value { 0 => 1.0, 1 => 0.84, 2 => 0.72, @@ -548,12 +526,12 @@ pub fn year_6_perks() { burst_delay_scale: buff, ..Default::default() } - }), + }, ); add_rsmr( Perks::Onslaught, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - let buff = match _input.value { + |input: ModifierResponseInput| -> ReloadModifierResponse { + let buff = match input.value { 0 => 0, 1 => 15, 2 => 25, @@ -564,12 +542,12 @@ pub fn year_6_perks() { reload_stat_add: buff, ..Default::default() } - }), + }, ); add_sbr( Perks::Onslaught, - Box::new(|_input: ModifierResponseInput| -> HashMap { - let buff = match _input.value { + |input: ModifierResponseInput| -> HashMap { + let buff = match input.value { 0 => 0, 1 => 15, 2 => 25, @@ -577,34 +555,34 @@ pub fn year_6_perks() { _ => 35, }; HashMap::from([(StatHashes::RELOAD.into(), buff)]) - }), + }, ); add_dmr( Perks::Sever, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let debuff = if _input.pvp { 0.85 } else { 1.0 }; + |input: ModifierResponseInput| -> DamageModifierResponse { + let debuff = if input.pvp { 0.85 } else { 1.0 }; DamageModifierResponse { impact_dmg_scale: debuff, explosive_dmg_scale: debuff, ..Default::default() } - }), + }, ); add_dmr( Perks::DesperateMeasures, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let buff = _input.value.clamp(0, 3) as f64 * 0.1 + 1.0; + |input: ModifierResponseInput| -> DamageModifierResponse { + let buff = input.value.clamp(0, 3) as f64 * 0.1 + 1.0; DamageModifierResponse { impact_dmg_scale: buff, explosive_dmg_scale: buff, ..Default::default() } - }), + }, ); add_dmr( Perks::MasterOfArms, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value == 0 { + |input: ModifierResponseInput| -> DamageModifierResponse { + if input.value == 0 { return DamageModifierResponse::default(); } DamageModifierResponse { @@ -612,6 +590,6 @@ pub fn year_6_perks() { explosive_dmg_scale: 1.15, ..Default::default() } - }), + }, ); } diff --git a/src/test.rs b/src/test.rs index 35b37b76..b650707e 100644 --- a/src/test.rs +++ b/src/test.rs @@ -345,5 +345,8 @@ fn test_phase_mag() { let p_data = precision.calc_firing_data(Some(precision.static_calc_input()), None, true); assert_eq!(lw_data.burst_delay, p_data.burst_delay); assert_eq!(lw_data.pvp_crit_mult, p_data.pvp_crit_mult); - assert_eq!(f64::trunc(lw_data.pvp_impact_damage*10000.0)/10000.0, p_data.pvp_impact_damage); + assert_eq!( + f64::trunc(lw_data.pvp_impact_damage * 10000.0) / 10000.0, + p_data.pvp_impact_damage + ); } diff --git a/src/types/rs_types.rs b/src/types/rs_types.rs index cda1a1e7..f4256303 100644 --- a/src/types/rs_types.rs +++ b/src/types/rs_types.rs @@ -205,20 +205,20 @@ pub struct FiringResponse { impl FiringResponse { pub fn apply_pve_bonuses( &mut self, - _rpl_mult: f64, - _gpl_mult: f64, - _pve_mult: f64, - _combatant_mult: f64, + rpl_mult: f64, + gpl_mult: f64, + pve_mult: f64, + combatant_mult: f64, ) { crate::logging::log( format!( "rpl: {}, gpl: {}, pve: {}, combat_mult: {}", - _rpl_mult, _gpl_mult, _pve_mult, _combatant_mult + rpl_mult, gpl_mult, pve_mult, combatant_mult ) .as_str(), crate::logging::LogLevel::Debug.into(), ); - self.pve_impact_damage *= _rpl_mult * _gpl_mult * _pve_mult * _combatant_mult; - self.pve_explosion_damage *= _rpl_mult * _gpl_mult * _pve_mult * _combatant_mult; + self.pve_impact_damage *= rpl_mult * gpl_mult * pve_mult * combatant_mult; + self.pve_explosion_damage *= rpl_mult * gpl_mult * pve_mult * combatant_mult; } } diff --git a/src/weapons/dps_calc.rs b/src/weapons/dps_calc.rs index 634b6c72..9cd6335e 100644 --- a/src/weapons/dps_calc.rs +++ b/src/weapons/dps_calc.rs @@ -11,10 +11,10 @@ use crate::perks::*; use crate::types::rs_types::DpsResponse; //first entry in tuple is refund to mag, second is too reserves -pub fn calc_refund(_shots_hit_this_mag: i32, _refunds: Vec) -> (i32, i32) { +pub fn calc_refund(shots_hit_this_mag: i32, refunds: Vec) -> (i32, i32) { let mut refund_ammount = (0, 0); - for refund in _refunds { - if _shots_hit_this_mag % refund.requirement == 0 { + for refund in refunds { + if shots_hit_this_mag % refund.requirement == 0 { refund_ammount.0 += refund.refund_mag; refund_ammount.1 += refund.refund_reserves; } @@ -55,35 +55,35 @@ impl ExtraDamageBuffInfo { } } pub fn calc_extra_dmg( - _total_time: f64, - _extra_dmg_entries: Vec, - _dmg_buffs: ExtraDamageBuffInfo, + total_time: f64, + extra_dmg_entries: Vec, + dmg_buffs: ExtraDamageBuffInfo, ) -> ExtraDamageResult { let mut extra_time = 0.0; let mut extra_dmg = 0.0; let mut extra_hits = 0; let mut extra_time_dmg: Vec<(f64, f64)> = Vec::new(); - for entry in _extra_dmg_entries { + for entry in extra_dmg_entries { if entry.additive_damage > 0.0 { if entry.hit_at_same_time { let mut bonus_dmg = entry.additive_damage * entry.times_to_hit as f64; - bonus_dmg *= _dmg_buffs.get_buff_amount(&entry); + bonus_dmg *= dmg_buffs.get_buff_amount(&entry); extra_dmg += bonus_dmg; if entry.increment_total_time { extra_time += entry.time_for_additive_damage }; - extra_time_dmg.push((_total_time + entry.time_for_additive_damage, bonus_dmg)); + extra_time_dmg.push((total_time + entry.time_for_additive_damage, bonus_dmg)); extra_hits += entry.times_to_hit; } else if !entry.is_dot { for i in 0..entry.times_to_hit { let mut bonus_dmg = entry.additive_damage; - bonus_dmg *= _dmg_buffs.get_buff_amount(&entry); + bonus_dmg *= dmg_buffs.get_buff_amount(&entry); extra_dmg += bonus_dmg; if entry.increment_total_time { extra_time += entry.time_for_additive_damage }; extra_time_dmg.push(( - _total_time + entry.time_for_additive_damage * i as f64, + total_time + entry.time_for_additive_damage * i as f64, bonus_dmg, )); extra_hits += 1; @@ -92,13 +92,13 @@ pub fn calc_extra_dmg( //all dot does is increment time backwards for i in 0..entry.times_to_hit { let mut bonus_dmg = entry.additive_damage; - bonus_dmg *= _dmg_buffs.get_buff_amount(&entry); + bonus_dmg *= dmg_buffs.get_buff_amount(&entry); extra_dmg += bonus_dmg; if entry.increment_total_time { extra_time += entry.time_for_additive_damage }; extra_time_dmg.push(( - _total_time - entry.time_for_additive_damage * i as f64, + total_time - entry.time_for_additive_damage * i as f64, bonus_dmg, )); extra_hits += 1; @@ -114,8 +114,8 @@ pub fn calc_extra_dmg( } } -pub fn complex_dps_calc(_weapon: Weapon, _enemy: Enemy, _pl_dmg_mult: f64) -> DpsResponse { - let weapon = Rc::new(_weapon.clone()); +pub fn complex_dps_calc(weapon: Weapon, enemy: Enemy, pl_dmg_mult: f64) -> DpsResponse { + let weapon = Rc::new(weapon.clone()); let stats = weapon.stats.clone(); let weapon_type = weapon.weapon_type; let ammo_type = weapon.ammo_type; @@ -129,7 +129,7 @@ pub fn complex_dps_calc(_weapon: Weapon, _enemy: Enemy, _pl_dmg_mult: f64) -> Dp let base_mag = weapon.calc_ammo_sizes(None, None, false).mag_size; let maximum_shots = if base_mag * 5 < 15 { 15 } else { base_mag * 5 }; - let firing_settings = _weapon.firing_data; + let firing_settings = weapon.firing_data; let perks = weapon.list_perks(); let burst_size = firing_settings.burst_size as f64; @@ -188,7 +188,7 @@ pub fn complex_dps_calc(_weapon: Weapon, _enemy: Enemy, _pl_dmg_mult: f64) -> Dp weapon_type: &weapon_type, stats: &stats, perk_value_map: &weapon.perk_value_map_update(), - enemy_type: &_enemy.type_, + enemy_type: &enemy.type_, shots_fired_this_mag: shots_this_mag as f64, total_shots_fired: total_shots_fired as f64, total_shots_hit: total_shots_hit as f64, @@ -220,8 +220,8 @@ pub fn complex_dps_calc(_weapon: Weapon, _enemy: Enemy, _pl_dmg_mult: f64) -> Dp let dmg = { ((impact_dmg * dmg_mods.impact_dmg_scale) * (crit_mult * dmg_mods.crit_scale) + (explosion_dmg * dmg_mods.explosive_dmg_scale)) - * _pl_dmg_mult - * weapon.damage_mods.get_mod(&_enemy.type_) + * pl_dmg_mult + * weapon.damage_mods.get_mod(&enemy.type_) * weapon.damage_mods.pve }; @@ -290,7 +290,7 @@ pub fn complex_dps_calc(_weapon: Weapon, _enemy: Enemy, _pl_dmg_mult: f64) -> Dp weapon_type: &weapon_type, stats: &stats, perk_value_map: &weapon.perk_value_map_update(), - enemy_type: &_enemy.type_, + enemy_type: &enemy.type_, shots_fired_this_mag: shots_this_mag as f64, total_shots_fired: total_shots_fired as f64, total_shots_hit: total_shots_hit as f64, @@ -312,12 +312,12 @@ pub fn complex_dps_calc(_weapon: Weapon, _enemy: Enemy, _pl_dmg_mult: f64) -> Dp &mut pers_calc_data, ); let buffs = ExtraDamageBuffInfo { - pl_buff: _pl_dmg_mult, + pl_buff: pl_dmg_mult, impact_buff: dmg_mods.impact_dmg_scale, explosive_buff: dmg_mods.explosive_dmg_scale, pve_buff: weapon.damage_mods.pve, crit_buff: crit_mult * dmg_mods.crit_scale, - combatant_buff: weapon.damage_mods.get_mod(&_enemy.type_), + combatant_buff: weapon.damage_mods.get_mod(&enemy.type_), }; let tmp_out_data = calc_extra_dmg(total_time, extra_dmg_responses, buffs); total_damage += tmp_out_data.extra_dmg; @@ -398,7 +398,7 @@ pub fn complex_dps_calc(_weapon: Weapon, _enemy: Enemy, _pl_dmg_mult: f64) -> Dp weapon_type: &weapon_type, stats: &stats, perk_value_map: &weapon.perk_value_map_update(), - enemy_type: &_enemy.type_, + enemy_type: &enemy.type_, shots_fired_this_mag: shots_this_mag as f64, total_shots_fired: total_shots_fired as f64, total_shots_hit: total_shots_hit as f64, diff --git a/src/weapons/mod.rs b/src/weapons/mod.rs index b844087d..2b037edd 100644 --- a/src/weapons/mod.rs +++ b/src/weapons/mod.rs @@ -52,9 +52,9 @@ impl Default for Stat { } impl From for Stat { - fn from(_val: i32) -> Self { + fn from(val: i32) -> Self { Stat { - base_value: _val, + base_value: val, part_value: 0, perk_value: 0, } @@ -83,12 +83,12 @@ pub struct Weapon { pub ammo_type: AmmoType, } impl Weapon { - pub fn add_perk(&mut self, _perk: Perk) { - self.perks.insert(_perk.hash, _perk); + pub fn add_perk(&mut self, perk: Perk) { + self.perks.insert(perk.hash, perk); self.update_stats(); } - pub fn remove_perk(&mut self, _perk_hash: u32) { - self.perks.remove(&_perk_hash); + pub fn remove_perk(&mut self, perk_hash: u32) { + self.perks.remove(&perk_hash); self.update_stats(); } pub fn reset_perks(&mut self) { @@ -112,10 +112,10 @@ impl Weapon { } perk_map } - pub fn change_perk_val(&mut self, _perk_hash: u32, _val: u32) { - let perk_opt = self.perks.get_mut(&_perk_hash); + pub fn change_perk_val(&mut self, perk_hash: u32, val: u32) { + let perk_opt = self.perks.get_mut(&perk_hash); if let Some(perk) = perk_opt { - perk.value = _val; + perk.value = val; } self.update_stats(); } @@ -152,7 +152,7 @@ impl Weapon { ) } - pub fn sparse_calc_input(&self, _total_shots_fired: i32, _total_time: f64) -> CalculationInput { + pub fn sparse_calc_input(&self, total_shots_fired: i32, total_time: f64) -> CalculationInput { CalculationInput::construct_pve_sparse( self.intrinsic_hash, &self.firing_data, @@ -164,16 +164,16 @@ impl Weapon { self.firing_data.damage, self.firing_data.crit_mult, self.calc_ammo_sizes(None, None, false).mag_size, - _total_shots_fired, - _total_time, + total_shots_fired, + total_time, ) } pub fn pvp_calc_input( &self, - _total_shots_fired: f64, - _total_shots_hit: f64, - _total_time: f64, - _overshield: bool, + total_shots_fired: f64, + total_shots_hit: f64, + total_time: f64, + overshield: bool, ) -> CalculationInput { let base_mag = self.calc_ammo_sizes(None, None, true).mag_size as f64; let mut tmp = CalculationInput::construct_pvp( @@ -186,14 +186,14 @@ impl Weapon { self.firing_data.damage, self.firing_data.crit_mult, base_mag, - _overshield, + overshield, self.calc_handling_times(None, None, true), ); - tmp.time_this_mag = _total_time; - tmp.time_total = _total_time; - tmp.shots_fired_this_mag = _total_shots_fired; - tmp.total_shots_fired = _total_shots_fired; - tmp.total_shots_hit = _total_shots_hit; + tmp.time_this_mag = total_time; + tmp.time_total = total_time; + tmp.shots_fired_this_mag = total_shots_fired; + tmp.total_shots_fired = total_shots_fired; + tmp.total_shots_hit = total_shots_hit; tmp.damage_type = &self.damage_type; tmp } diff --git a/src/weapons/reserve_calc.rs b/src/weapons/reserve_calc.rs index ff68e087..26f89b76 100644 --- a/src/weapons/reserve_calc.rs +++ b/src/weapons/reserve_calc.rs @@ -6,15 +6,11 @@ enum ReserveIDs { SpecialGrenadeLaunchers, SmallGrenadeLaunchers, LargeGrenadeLaunchers, - ErianasVow, LinearFusions, SmallMachineGuns, LargeMachineGuns, - Xenophage, - Overture, RocketLaunchers, Shotguns, - ForeRunner, SniperRifles, Glaive, TraceRifles, @@ -29,6 +25,7 @@ enum ReserveIDs { Bastion, ConditionalFinality, DelicateTomb, + ForeRunner, //energy exotic special BuriedBloodline, @@ -39,6 +36,7 @@ enum ReserveIDs { LorentzDriver, Merciless, Telesto, + ErianasVow, Tessellation, //exotic heavy @@ -60,7 +58,9 @@ enum ReserveIDs { Truth, TwoTailedFox, Winterbite, - WhisperOfTheWorm + WhisperOfTheWorm, + Xenophage, + Overture, } impl From for ReserveIDs { fn from(id: u32) -> Self { @@ -71,15 +71,11 @@ impl From for ReserveIDs { 231 => ReserveIDs::LargeGrenadeLaunchers, 232 => ReserveIDs::SpecialGrenadeLaunchers, 233 => ReserveIDs::SmallGrenadeLaunchers, - 3174300811 => ReserveIDs::ErianasVow, 2201 => ReserveIDs::LinearFusions, 81 => ReserveIDs::SmallMachineGuns, 82 => ReserveIDs::LargeMachineGuns, - 2261491232 => ReserveIDs::Xenophage, - 2940035732 => ReserveIDs::Overture, 101 => ReserveIDs::RocketLaunchers, 71 => ReserveIDs::Shotguns, - 2984682260 => ReserveIDs::ForeRunner, 121 => ReserveIDs::SniperRifles, 331 => ReserveIDs::Glaive, 251 => ReserveIDs::TraceRifles, @@ -90,6 +86,7 @@ impl From for ReserveIDs { 1701 => ReserveIDs::RocketAssistedFrame, //kinetic exotic special + 2984682260 => ReserveIDs::ForeRunner, 2564164194 => ReserveIDs::Arbalest, 1186480754 => ReserveIDs::Bastion, 3787406018 => ReserveIDs::ConditionalFinality, @@ -105,6 +102,7 @@ impl From for ReserveIDs { 656200654 => ReserveIDs::Merciless, 1927916065 => ReserveIDs::Telesto, 2769013282 => ReserveIDs::Tessellation, + 3174300811 => ReserveIDs::ErianasVow, //heavy 389268985 => ReserveIDs::Anarchy, @@ -126,137 +124,138 @@ impl From for ReserveIDs { 3649430342 => ReserveIDs::TwoTailedFox, 1207608520 => ReserveIDs::Winterbite, 281315705 => ReserveIDs::WhisperOfTheWorm, + 2261491232 => ReserveIDs::Xenophage, + 2940035732 => ReserveIDs::Overture, _ => ReserveIDs::Primary, } } } -pub fn calc_reserves(_mag_size: f64, _mag_stat: i32, _inv_stat: i32, _id: u32, _scale: f64) -> i32 { - let id = ReserveIDs::from(_id); +pub fn calc_reserves(mag_size: f64, mag_stat: i32, inv_stat: i32, id: u32, scale: f64) -> i32 { + let id = ReserveIDs::from(id); let raw_size: f64 = match id { ReserveIDs::Primary => 9999.0, - ReserveIDs::SmallMachineGuns => small_machinegun(_mag_size, _mag_stat, _inv_stat), - ReserveIDs::TraceRifles => trace_rifle(_mag_size, _mag_stat, _inv_stat), - ReserveIDs::Glaive => glaives(_mag_size, _mag_stat, _inv_stat), - ReserveIDs::SniperRifles => sniper_rifles(_mag_size, _mag_stat, _inv_stat), - ReserveIDs::Shotguns => shotguns(_mag_size, _mag_stat, _inv_stat), - ReserveIDs::RocketLaunchers => rockets(_mag_size, _mag_stat, _inv_stat), - ReserveIDs::RapidFireSniper => rapid_fire_sniper(_mag_size, _mag_stat, _inv_stat), - ReserveIDs::RapidFireShotgun => rapid_fire_shotgun(_mag_size, _mag_stat, _inv_stat), - ReserveIDs::Fusions => fusions(_mag_size, _mag_stat, _inv_stat), - ReserveIDs::LinearFusions => linear_fusion_rifle(_mag_size, _mag_stat, _inv_stat), - ReserveIDs::LargeMachineGuns => rapid_fire_machinegun(_mag_size, _mag_stat, _inv_stat), - ReserveIDs::HighInventoryRockets => high_inventory_rockets(_mag_size, _mag_stat, _inv_stat), + ReserveIDs::SmallMachineGuns => small_machinegun(mag_size, mag_stat, inv_stat), + ReserveIDs::TraceRifles => trace_rifle(mag_size, inv_stat), + ReserveIDs::Glaive => glaives(mag_stat, inv_stat), + ReserveIDs::SniperRifles => sniper_rifles(mag_stat, inv_stat), + ReserveIDs::Shotguns => shotguns(mag_size, inv_stat), + ReserveIDs::RocketLaunchers => rockets(inv_stat), + ReserveIDs::RapidFireSniper => rapid_fire_sniper(mag_stat, inv_stat), + ReserveIDs::RapidFireShotgun => rapid_fire_shotgun(mag_size, inv_stat), + ReserveIDs::Fusions => fusions(inv_stat), + ReserveIDs::LinearFusions => linear_fusion_rifle(inv_stat), + ReserveIDs::LargeMachineGuns => rapid_fire_machinegun(mag_size, inv_stat), + ReserveIDs::HighInventoryRockets => high_inventory_rockets(inv_stat), ReserveIDs::AggressiveLinearFusionRifle => { - aggressive_linear_fusion_rifle(_mag_size, _mag_stat, _inv_stat) + aggressive_linear_fusion_rifle(mag_stat, inv_stat) } ReserveIDs::SpecialGrenadeLaunchers => { - special_grenade_launcher(_mag_size, _mag_stat, _inv_stat) + special_grenade_launcher(inv_stat) } ReserveIDs::SmallGrenadeLaunchers => { - adaptive_grenade_launcher(_mag_size, _mag_stat, _inv_stat) + adaptive_grenade_launcher(inv_stat) } ReserveIDs::LargeGrenadeLaunchers => { - rapid_grenade_launcher(_mag_size, _mag_stat, _inv_stat) + rapid_grenade_launcher(inv_stat) } - ReserveIDs::RocketAssistedFrame => rocket_assisted(_mag_size, _mag_stat, _inv_stat), + ReserveIDs::RocketAssistedFrame => rocket_assisted(inv_stat), //exotic kinetic special - ReserveIDs::ForeRunner => forerunner(_mag_size, _mag_stat, _inv_stat), - ReserveIDs::Arbalest => arbalest(_inv_stat), - ReserveIDs::Bastion => bastion(_inv_stat), + ReserveIDs::ForeRunner => forerunner(inv_stat), + ReserveIDs::Arbalest => arbalest(inv_stat), + ReserveIDs::Bastion => bastion(inv_stat), //exotic energy special - ReserveIDs::BuriedBloodline => buried_bloodline(_inv_stat), - ReserveIDs::ErianasVow => eriana_vow(_mag_size, _mag_stat, _inv_stat), - ReserveIDs::ConditionalFinality => conditional_finality(_inv_stat), - ReserveIDs::DeadMessenger => dead_messenger(_inv_stat), - ReserveIDs::DelicateTomb => delicate_tomb(_inv_stat), - ReserveIDs::ExDiris => ex_diris(_inv_stat), - ReserveIDs::Jotunn => jotunn(_inv_stat), + ReserveIDs::BuriedBloodline => buried_bloodline(inv_stat), + ReserveIDs::ErianasVow => eriana_vow(inv_stat), + ReserveIDs::ConditionalFinality => conditional_finality(inv_stat), + ReserveIDs::DeadMessenger => dead_messenger(inv_stat), + ReserveIDs::DelicateTomb => delicate_tomb(inv_stat), + ReserveIDs::ExDiris => ex_diris(inv_stat), + ReserveIDs::Jotunn => jotunn(inv_stat), ReserveIDs::LordOfWolves => 100.0, - ReserveIDs::LorentzDriver => lorentz_driver(_inv_stat), - ReserveIDs::Merciless => merciless(_inv_stat), - ReserveIDs::Telesto => telesto(_inv_stat), - ReserveIDs::Tessellation => tessellation(_inv_stat), + ReserveIDs::LorentzDriver => lorentz_driver(inv_stat), + ReserveIDs::Merciless => merciless(inv_stat), + ReserveIDs::Telesto => telesto(inv_stat), + ReserveIDs::Tessellation => tessellation(inv_stat), //exotic heavy - ReserveIDs::Anarchy => anarchy(_inv_stat), - ReserveIDs::DeathBringer => deathbringer(_inv_stat), - ReserveIDs::DragonsBreath => dragons_breath(_inv_stat), - ReserveIDs::EyesOfTomorrow => eyes_of_tomorrow(_inv_stat), - ReserveIDs::Gjallarhorn => gjallarhorn(_inv_stat), - ReserveIDs::HierApparent => hier_apparent(_inv_stat), - ReserveIDs::LegendOfAcrius => legend_of_acrius(_inv_stat), - ReserveIDs::OneThousandVoices => one_thousand_voices(_inv_stat), - ReserveIDs::Overture => overture(_mag_size, _mag_stat, _inv_stat), - ReserveIDs::SleeperSimulant => sleeper_simulant(_inv_stat), - ReserveIDs::Xenophage => xenophage(_mag_size, _mag_stat, _inv_stat), - ReserveIDs::LeviathansBreath => leviathans_breath(_inv_stat), - ReserveIDs::Parasite => parasite(_inv_stat), + ReserveIDs::Anarchy => anarchy(inv_stat), + ReserveIDs::DeathBringer => deathbringer(inv_stat), + ReserveIDs::DragonsBreath => dragons_breath(inv_stat), + ReserveIDs::EyesOfTomorrow => eyes_of_tomorrow(inv_stat), + ReserveIDs::Gjallarhorn => gjallarhorn(inv_stat), + ReserveIDs::HierApparent => hier_apparent(inv_stat), + ReserveIDs::LegendOfAcrius => legend_of_acrius(inv_stat), + ReserveIDs::OneThousandVoices => one_thousand_voices(inv_stat), + ReserveIDs::Overture => overture(inv_stat), + ReserveIDs::SleeperSimulant => sleeper_simulant(inv_stat), + ReserveIDs::Xenophage => xenophage(inv_stat), + ReserveIDs::LeviathansBreath => leviathans_breath(inv_stat), + ReserveIDs::Parasite => parasite(inv_stat), ReserveIDs::TheColony => 28.0, ReserveIDs::TheProspector => 35.0, - ReserveIDs::TheQueenbreaker => queenbreaker(_inv_stat), - ReserveIDs::TheWardcliffCoil => wardcliff_coil(_inv_stat), - ReserveIDs::TractorCannon => tractor_cannon(_inv_stat), - ReserveIDs::Truth => truth(_inv_stat), - ReserveIDs::TwoTailedFox => two_tailed_fox(_inv_stat), - ReserveIDs::Winterbite => winterbite(_inv_stat), - ReserveIDs::WhisperOfTheWorm => whisper_of_the_worm(_mag_size, _mag_stat, _inv_stat) - //placeholders + ReserveIDs::TheQueenbreaker => queenbreaker(inv_stat), + ReserveIDs::TheWardcliffCoil => wardcliff_coil(inv_stat), + ReserveIDs::TractorCannon => tractor_cannon(inv_stat), + ReserveIDs::Truth => truth(inv_stat), + ReserveIDs::TwoTailedFox => two_tailed_fox(inv_stat), + ReserveIDs::Winterbite => winterbite(inv_stat), + ReserveIDs::WhisperOfTheWorm => whisper_of_the_worm(mag_stat, inv_stat), }; - let size = raw_size * _scale; + let size = raw_size * scale; size.ceil() as i32 } -fn small_machinegun(_mag_size: f64, _mag_stat: i32, _inv_stat: i32) -> f64 { +fn small_machinegun(mag_size: f64, mag_stat: i32, inv_stat: i32) -> f64 { let base_machine_gun = 225.0; - let round_amount = _mag_size.ceil() - _mag_size; - let offset = (-0.875 + round_amount * 2.0) * (2.0 - ((100.0 - _mag_stat as f64) / 100.0)) * 1.5; + let round_amount = mag_size.ceil() - mag_size; + let offset = (-0.875 + round_amount * 2.0) * (2.0 - ((100.0 - mag_stat as f64) / 100.0)) * 1.5; base_machine_gun + offset - + _inv_stat as f64 * ((base_machine_gun + offset) * 2.0 - (base_machine_gun + offset)) + + inv_stat as f64 * ((base_machine_gun + offset) * 2.0 - (base_machine_gun + offset)) / 100.0 } -fn rapid_fire_machinegun(_mag_size: f64, _mag_stat: i32, _inv_stat: i32) -> f64 { +fn rapid_fire_machinegun(mag_size: f64, inv_stat: i32) -> f64 { let rapid_fire_mg = 345.0; - let round_amount = _mag_size.ceil() - _mag_size; + let round_amount = mag_size.ceil() - mag_size; let offset = (-0.25 + round_amount * 2.85) * 1.5; rapid_fire_mg + offset - + _inv_stat as f64 * ((rapid_fire_mg + offset) * 2.0 - (rapid_fire_mg + offset)) / 100.0 + + inv_stat as f64 * ((rapid_fire_mg + offset) * 2.0 - (rapid_fire_mg + offset)) / 100.0 } -fn trace_rifle(_mag_size: f64, _mag_stat: i32, _inv_stat: i32) -> f64 { - let mult = _inv_stat as f64 * 0.025 + 3.5; - _mag_size.ceil() * mult +fn trace_rifle(mag_size: f64, inv_stat: i32) -> f64 { + let mult = inv_stat as f64 * 0.025 + 3.5; + mag_size.ceil() * mult } -fn glaives(_mag_size: f64, _mag_stat: i32, _inv_stat: i32) -> f64 { - let vpp = if _mag_stat >= 100 { 0.16875 } else { 0.18 }; - let offset = if _mag_stat >= 100 { 13.5 } else { 14.4 }; - vpp * _inv_stat as f64 + offset +fn glaives(mag_stat: i32, inv_stat: i32) -> f64 { + let vpp = if mag_stat >= 100 { 0.16875 } else { 0.18 }; + let offset = if mag_stat >= 100 { 13.5 } else { 14.4 }; + vpp * inv_stat as f64 + offset } -fn sniper_rifles(_mag_size: f64, _mag_stat: i32, _inv_stat: i32) -> f64 { - let vpp = if _mag_stat >= 100 { 0.14 } else { 0.12 }; - let offset = if _mag_stat >= 100 { 14.0 } else { 12.0 }; - vpp * _inv_stat as f64 + offset -} -fn whisper_of_the_worm(_mag_size: f64, _mag_stat: i32, _inv_stat: i32) -> f64 { - let vpp = if _mag_stat >= 100 { 0.14 } else { 0.12 }; - let offset = if _mag_stat >= 100 { 20.0 } else { 18.0 }; - vpp * _inv_stat as f64 + offset -} -fn rapid_fire_sniper(_mag_size: f64, _mag_stat: i32, _inv_stat: i32) -> f64 { - let vpp = if _mag_stat >= 100 { 0.182 } else { 0.156 }; - let offset: f64 = if _mag_stat >= 100 { 18.2 } else { 15.6 }; - (vpp * _inv_stat as f64) + offset -} -fn shotguns(_mag_size: f64, _mag_stat: i32, _inv_stat: i32) -> f64 { - let offset = match _mag_size.ceil() as i32 { +fn sniper_rifles(mag_stat: i32, inv_stat: i32) -> f64 { + let vpp = if mag_stat >= 100 { 0.14 } else { 0.12 }; + let offset = if mag_stat >= 100 { 14.0 } else { 12.0 }; + vpp * inv_stat as f64 + offset +} +fn whisper_of_the_worm(mag_stat: i32, inv_stat: i32) -> f64 { + let vpp = if mag_stat >= 100 { 0.14 } else { 0.12 }; + let offset = if mag_stat >= 100 { 20.0 } else { 18.0 }; + vpp * inv_stat as f64 + offset +} +fn rapid_fire_sniper(mag_stat: i32, inv_stat: i32) -> f64 { + let vpp = if mag_stat >= 100 { 0.182 } else { 0.156 }; + let offset: f64 = if mag_stat >= 100 { 18.2 } else { 15.6 }; + (vpp * inv_stat as f64) + offset +} +fn shotguns(mag_size: f64, inv_stat: i32) -> f64 { + let offset = match mag_size.ceil() as i32 { 4 => 14.0, 5 => 13.133, 6 => 12.6, @@ -266,11 +265,11 @@ fn shotguns(_mag_size: f64, _mag_stat: i32, _inv_stat: i32) -> f64 { }; let vpp = ((offset * (5.0 / 3.0)) - offset) / 100.0; - vpp * _inv_stat as f64 + offset + vpp * inv_stat as f64 + offset } -fn rapid_fire_shotgun(_mag_size: f64, _mag_stat: i32, _inv_stat: i32) -> f64 { - let offset = match _mag_size.ceil() as i32 { +fn rapid_fire_shotgun(mag_size: f64, inv_stat: i32) -> f64 { + let offset = match mag_size.ceil() as i32 { 4 => 14.0, 5 => 13.133, 6 => 12.6, @@ -280,58 +279,58 @@ fn rapid_fire_shotgun(_mag_size: f64, _mag_stat: i32, _inv_stat: i32) -> f64 { }; let vpp = ((offset * (5.0 / 3.0)) - offset) / 100.0; - vpp * _inv_stat as f64 + offset + 8.0 + vpp * inv_stat as f64 + offset + 8.0 } -fn linear_fusion_rifle(_mag_size: f64, _mag_stat: i32, _inv_stat: i32) -> f64 { +fn linear_fusion_rifle(inv_stat: i32) -> f64 { let offset = 15.6; - 0.08 * _inv_stat as f64 + offset + 0.08 * inv_stat as f64 + offset } -fn rockets(_mag_size: f64, _mag_stat: i32, _inv_stat: i32) -> f64 { - _inv_stat as f64 * 0.05 + 4.5 +fn rockets(inv_stat: i32) -> f64 { + inv_stat as f64 * 0.05 + 4.5 } -fn high_inventory_rockets(_mag_size: f64, _mag_stat: i32, _inv_stat: i32) -> f64 { - _inv_stat as f64 * 0.05 + 6.5 +fn high_inventory_rockets(inv_stat: i32) -> f64 { + inv_stat as f64 * 0.05 + 6.5 } -fn fusions(_mag_size: f64, _mag_stat: i32, _inv_stat: i32) -> f64 { +fn fusions(inv_stat: i32) -> f64 { let vpp = 0.12; let offset = 9.6; - vpp * _inv_stat as f64 + offset + vpp * inv_stat as f64 + offset } -fn aggressive_linear_fusion_rifle(_mag_size: f64, _mag_stat: i32, _inv_stat: i32) -> f64 { - let offset = match _mag_stat { +fn aggressive_linear_fusion_rifle(mag_stat: i32, inv_stat: i32) -> f64 { + let offset = match mag_stat { 0..=69 => 16.5, 70..=90 => 16.0, 91..=100 => 15.5, _ => 15.5, }; let vpp = ((offset * 1.4375) - offset) / 100.0; - vpp * _inv_stat as f64 + offset + vpp * inv_stat as f64 + offset } -fn rocket_assisted(_mag_size: f64, _mag_stat: i32, _inv_stat: i32) -> f64 { +fn rocket_assisted(inv_stat: i32) -> f64 { let offset = 15.6; - 0.08 * _inv_stat as f64 + offset + 0.08 * inv_stat as f64 + offset } -fn heavy_compressed_wave(_mag_size: f64, _mag_stat: i32, _inv_stat: i32) -> f64 { +fn heavy_compressed_wave(inv_stat: i32) -> f64 { let offset = 20.6; - 0.075 * _inv_stat as f64 + offset + 0.075 * inv_stat as f64 + offset } -fn special_grenade_launcher(_mag_size: f64, _mag_stat: i32, _inv_stat: i32) -> f64 { +fn special_grenade_launcher(inv_stat: i32) -> f64 { let vpp = 0.05; let offset = 18.0; - vpp * _inv_stat as f64 + offset + vpp * inv_stat as f64 + offset } -fn adaptive_grenade_launcher(_mag_size: f64, _mag_stat: i32, _inv_stat: i32) -> f64 { +fn adaptive_grenade_launcher(inv_stat: i32) -> f64 { let vpp = 0.08; let offset = 20.0; - vpp * _inv_stat as f64 + offset + vpp * inv_stat as f64 + offset } -fn rapid_grenade_launcher(_mag_size: f64, _mag_stat: i32, _inv_stat: i32) -> f64 { +fn rapid_grenade_launcher(inv_stat: i32) -> f64 { let vpp = 0.1; let offset = 25.0; - vpp * _inv_stat as f64 + offset + vpp * inv_stat as f64 + offset } -fn forerunner(_mag_size: f64, _mag_stat: i32, _inv_stat: i32) -> f64 { - match _inv_stat { +fn forerunner(inv_stat: i32) -> f64 { + match inv_stat { 56 => 72.0, 76 => 79.0, 96 => 85.0, @@ -339,8 +338,8 @@ fn forerunner(_mag_size: f64, _mag_stat: i32, _inv_stat: i32) -> f64 { } } -fn overture(_mag_size: f64, _mag_stat: i32, _inv_stat: i32) -> f64 { - match _inv_stat { +fn overture(inv_stat: i32) -> f64 { + match inv_stat { 45 => 60.0, 65 => 63.0, 85 => 67.0, @@ -348,241 +347,241 @@ fn overture(_mag_size: f64, _mag_stat: i32, _inv_stat: i32) -> f64 { } } -fn xenophage(_mag_size: f64, _mag_stat: i32, _inv_stat: i32) -> f64 { - match _inv_stat { +fn xenophage(inv_stat: i32) -> f64 { + match inv_stat { 3 => 28.0, _ => 34.0, } } -fn eriana_vow(_mag_size: f64, _mag_stat: i32, _inv_stat: i32) -> f64 { - match _inv_stat { +fn eriana_vow(inv_stat: i32) -> f64 { + match inv_stat { 0 => 30.0, 20 => 34.0, 40 => 38.0, _ => 40.0, } } -fn leviathans_breath(_inv_stat: i32) -> f64 { - if _inv_stat >= 80 { +fn leviathans_breath(inv_stat: i32) -> f64 { + if inv_stat >= 80 { 15.0 } else { 8.0 } } -fn anarchy(_inv_stat: i32) -> f64 { - match _inv_stat { +fn anarchy(inv_stat: i32) -> f64 { + match inv_stat { 0 => 23.0, 20 => 25.0, 40 => 27.0, _ => 28.0, } } -fn arbalest(_inv_stat: i32) -> f64 { - match _inv_stat { +fn arbalest(inv_stat: i32) -> f64 { + match inv_stat { 34 => 20.0, 54 => 22.0, 74 => 23.0, _ => 24.0, } } -fn bastion(_inv_stat: i32) -> f64 { - match _inv_stat { +fn bastion(inv_stat: i32) -> f64 { + match inv_stat { 30 => 15.0, 50 => 17.0, 70 => 20.0, _ => 21.0, } } -fn buried_bloodline(_inv_stat: i32) -> f64 { - match _inv_stat { +fn buried_bloodline(inv_stat: i32) -> f64 { + match inv_stat { 50 => 62.0, 70 => 67.0, 90 => 72.0, _ => 75.0, } } -fn conditional_finality(_inv_stat: i32) -> f64 { - match _inv_stat { +fn conditional_finality(inv_stat: i32) -> f64 { + match inv_stat { 51 => 18.0, 71 => 20.0, 91 => 22.0, _ => 22.0, } } -fn dead_messenger(_inv_stat: i32) -> f64 { - match _inv_stat { +fn dead_messenger(inv_stat: i32) -> f64 { + match inv_stat { 0..=89 => 22.0, 90 => 23.0, _ => 23.0, } } -fn deathbringer(_inv_stat: i32) -> f64 { - match _inv_stat { +fn deathbringer(inv_stat: i32) -> f64 { + match inv_stat { 36 => 9.0, 56 => 10.0, 86 => 11.0, _ => 11.0, } } -fn delicate_tomb(_inv_stat: i32) -> f64 { - match _inv_stat { +fn delicate_tomb(inv_stat: i32) -> f64 { + match inv_stat { 55 => 23.0, 75 => 26.0, 95 => 29.0, _ => 30.0, } } -fn dragons_breath(_inv_stat: i32) -> f64 { - match _inv_stat { +fn dragons_breath(inv_stat: i32) -> f64 { + match inv_stat { 50 => 9.0, 70 => 10.0, 90 => 11.0, _ => 12.0, } } -fn ex_diris(_inv_stat: i32) -> f64 { - match _inv_stat { +fn ex_diris(inv_stat: i32) -> f64 { + match inv_stat { 70 => 32.0, _ => 33.0, } } -fn eyes_of_tomorrow(_inv_stat: i32) -> f64 { - match _inv_stat { +fn eyes_of_tomorrow(inv_stat: i32) -> f64 { + match inv_stat { 20 => 8.0, 40 => 9.0, 60 => 10.0, _ => 10.0, } } -fn gjallarhorn(_inv_stat: i32) -> f64 { - match _inv_stat { +fn gjallarhorn(inv_stat: i32) -> f64 { + match inv_stat { 50 => 9.0, 70 => 10.0, 90 => 11.0, _ => 12.0, } } -fn hier_apparent(_inv_stat: i32) -> f64 { - match _inv_stat { +fn hier_apparent(inv_stat: i32) -> f64 { + match inv_stat { 50 => 500.0, 70 => 540.0, 90 => 580.0, _ => 600.0, } } -fn jotunn(_inv_stat: i32) -> f64 { - match _inv_stat { +fn jotunn(inv_stat: i32) -> f64 { + match inv_stat { 26 => 17.0, 46 => 20.0, 66 => 22.0, _ => 24.0, } } -fn legend_of_acrius(_inv_stat: i32) -> f64 { - match _inv_stat { +fn legend_of_acrius(inv_stat: i32) -> f64 { + match inv_stat { 0 => 16.0, 20 => 17.0, 40 => 19.0, _ => 19.0, } } -fn lorentz_driver(_inv_stat: i32) -> f64 { - match _inv_stat { +fn lorentz_driver(inv_stat: i32) -> f64 { + match inv_stat { 35 => 20.0, 55 => 21.0, 75 => 22.0, _ => 23.0, } } -fn merciless(_inv_stat: i32) -> f64 { - match _inv_stat { +fn merciless(inv_stat: i32) -> f64 { + match inv_stat { 55 => 17.0, 75 => 19.0, 95 => 21.0, _ => 22.0, } } -fn one_thousand_voices(_inv_stat: i32) -> f64 { - match _inv_stat { +fn one_thousand_voices(inv_stat: i32) -> f64 { + match inv_stat { 80 => 11.0, _ => 12.0, } } -fn parasite(_inv_stat: i32) -> f64 { - match _inv_stat { +fn parasite(inv_stat: i32) -> f64 { + match inv_stat { 0 => 13.0, 20 => 15.0, 40 => 16.0, _ => 17.0, } } -fn sleeper_simulant(_inv_stat: i32) -> f64 { - match _inv_stat { +fn sleeper_simulant(inv_stat: i32) -> f64 { + match inv_stat { 10 => 13.0, 30 => 14.0, 50 => 16.0, _ => 16.0, } } -fn telesto(_inv_stat: i32) -> f64 { - match _inv_stat { +fn telesto(inv_stat: i32) -> f64 { + match inv_stat { 55 => 21.0, 75 => 22.0, 95 => 22.0, _ => 22.0, } } -fn tessellation(_inv_stat: i32) -> f64 { - match _inv_stat { +fn tessellation(inv_stat: i32) -> f64 { + match inv_stat { 33 => 16.0, 53 => 19.0, 73 => 21.0, _ => 23.0, } } -fn queenbreaker(_inv_stat: i32) -> f64 { - match _inv_stat { +fn queenbreaker(inv_stat: i32) -> f64 { + match inv_stat { 40 => 21.0, 60 => 22.0, 80 => 24.0, _ => 24.0, } } -fn wardcliff_coil(_inv_stat: i32) -> f64 { - match _inv_stat { +fn wardcliff_coil(inv_stat: i32) -> f64 { + match inv_stat { 0 => 6.0, 20 => 7.0, 40 => 8.0, _ => 8.0, } } -fn tractor_cannon(_inv_stat: i32) -> f64 { - match _inv_stat { +fn tractor_cannon(inv_stat: i32) -> f64 { + match inv_stat { 0 => 17.0, 20 => 18.0, 40 => 20.0, _ => 21.0, } } -fn truth(_inv_stat: i32) -> f64 { - match _inv_stat { +fn truth(inv_stat: i32) -> f64 { + match inv_stat { 40 => 9.0, 60 => 10.0, 80 => 11.0, _ => 11.0, } } -fn two_tailed_fox(_inv_stat: i32) -> f64 { - match _inv_stat { +fn two_tailed_fox(inv_stat: i32) -> f64 { + match inv_stat { 30 => 8.0, 50 => 9.0, 70 => 10.0, _ => 10.0, } } -fn winterbite(_inv_stat: i32) -> f64 { - match _inv_stat { +fn winterbite(inv_stat: i32) -> f64 { + match inv_stat { 0 => 9.0, 20 => 12.0, 40 => 15.0, diff --git a/src/weapons/stat_calc.rs b/src/weapons/stat_calc.rs index fdf96f10..6bece19b 100644 --- a/src/weapons/stat_calc.rs +++ b/src/weapons/stat_calc.rs @@ -21,8 +21,8 @@ use crate::{ }; impl ReloadFormula { - fn calc_reload_time_formula(&self, _reload_stat: i32) -> ReloadResponse { - let reload_time = self.reload_data.solve_at(_reload_stat as f64); + fn calc_reload_time_formula(&self, reload_stat: i32) -> ReloadResponse { + let reload_time = self.reload_data.solve_at(reload_stat as f64); ReloadResponse { reload_time, ammo_time: reload_time * self.ammo_percent, @@ -34,12 +34,12 @@ impl Weapon { //TODO: Change this to use piece wise linears instead of approx quadratics pub fn calc_reload_time( &self, - _calc_input: Option, - _cached_data: Option<&mut HashMap>, - _pvp: bool, + calc_input: Option, + cached_data: Option<&mut HashMap>, + pvp: bool, ) -> ReloadResponse { let mut default_chd_dt = HashMap::new(); - let cached_data = _cached_data.unwrap_or(&mut default_chd_dt); + let cached_data = cached_data.unwrap_or(&mut default_chd_dt); let mut reload_stat = self .stats @@ -51,8 +51,8 @@ impl Weapon { reload_stat = reload_stat.clamp(0, 85); } - let modifiers = if let Some(calc_input) = _calc_input { - get_reload_modifier(self.list_perks(), &calc_input, _pvp, cached_data) + let modifiers = if let Some(calc_input) = calc_input { + get_reload_modifier(self.list_perks(), &calc_input, pvp, cached_data) } else { ReloadModifierResponse::default() }; @@ -71,24 +71,24 @@ impl Weapon { impl RangeFormula { fn calc_range_falloff_formula( &self, - _range_stat: i32, + range_stat: i32, ads_mult: f64, - _modifiers: RangeModifierResponse, - _floor: f64, + modifiers: RangeModifierResponse, + floor: f64, ) -> RangeResponse { - let range_stat = (_range_stat + _modifiers.range_stat_add).clamp(0, 100) as f64; + let range_stat = (range_stat + modifiers.range_stat_add).clamp(0, 100) as f64; - let start = self.start.solve_at(range_stat) * _modifiers.range_all_scale; - let end = self.end.solve_at(range_stat) * _modifiers.range_all_scale; + let start = self.start.solve_at(range_stat) * modifiers.range_all_scale; + let end = self.end.solve_at(range_stat) * modifiers.range_all_scale; RangeResponse { - hip_falloff_start: start * _modifiers.range_hip_scale, - hip_falloff_end: end * _modifiers.range_hip_scale, + hip_falloff_start: start * modifiers.range_hip_scale, + hip_falloff_end: end * modifiers.range_hip_scale, - ads_falloff_start: start * ads_mult * _modifiers.range_zoom_scale, - ads_falloff_end: end * ads_mult * _modifiers.range_zoom_scale, + ads_falloff_start: start * ads_mult * modifiers.range_zoom_scale, + ads_falloff_end: end * ads_mult * modifiers.range_zoom_scale, - floor_percent: _floor, + floor_percent: floor, timestamp: self.timestamp, } } @@ -96,12 +96,12 @@ impl RangeFormula { impl Weapon { pub fn calc_range_falloff( &self, - _calc_input: Option, - _cached_data: Option<&mut HashMap>, - _pvp: bool, + calc_input: Option, + cached_data: Option<&mut HashMap>, + pvp: bool, ) -> RangeResponse { let mut default_chd_dt = HashMap::new(); - let cached_data = _cached_data.unwrap_or(&mut default_chd_dt); + let cached_data = cached_data.unwrap_or(&mut default_chd_dt); let range_stat = self .stats @@ -110,8 +110,8 @@ impl Weapon { .val(); let ads_mult = get_ads_multiplier(self.weapon_type, self.intrinsic_hash).unwrap_or(1.0); - let modifiers = if let Some(calc_input) = _calc_input { - get_range_modifier(self.list_perks(), &calc_input, _pvp, cached_data) + let modifiers = if let Some(calc_input) = calc_input { + get_range_modifier(self.list_perks(), &calc_input, pvp, cached_data) } else { RangeModifierResponse::default() }; @@ -128,20 +128,20 @@ impl Weapon { impl HandlingFormula { fn calc_handling_times_formula( &self, - _handling_stat: i32, - _modifiers: HandlingModifierResponse, + handling_stat: i32, + modifiers: HandlingModifierResponse, ) -> HandlingResponse { - let handling_stat = _handling_stat + _modifiers.stat_add; + let handling_stat = handling_stat + modifiers.stat_add; let ready_time = - self.ready.solve_at_i(handling_stat + _modifiers.draw_add) * _modifiers.draw_scale; + self.ready.solve_at_i(handling_stat + modifiers.draw_add) * modifiers.draw_scale; - let stow_time = (self.stow.solve_at_i(handling_stat + _modifiers.stow_add) - * _modifiers.stow_scale) + let stow_time = (self.stow.solve_at_i(handling_stat + modifiers.stow_add) + * modifiers.stow_scale) .clamp(self.stow.solve_at(100.0), f64::INFINITY); let ads_time = - self.ads.solve_at_i(handling_stat + _modifiers.ads_add) * _modifiers.ads_scale; + self.ads.solve_at_i(handling_stat + modifiers.ads_add) * modifiers.ads_scale; HandlingResponse { ready_time, @@ -154,12 +154,12 @@ impl HandlingFormula { impl Weapon { pub fn calc_handling_times( &self, - _calc_input: Option, - _cached_data: Option<&mut HashMap>, - _pvp: bool, + calc_input: Option, + cached_data: Option<&mut HashMap>, + pvp: bool, ) -> HandlingResponse { let mut default_chd_dt = HashMap::new(); - let cached_data = _cached_data.unwrap_or(&mut default_chd_dt); + let cached_data = cached_data.unwrap_or(&mut default_chd_dt); let handling_stat = self .stats @@ -167,8 +167,8 @@ impl Weapon { .unwrap_or(&Stat::new()) .val(); - let modifiers = if let Some(calc_input) = _calc_input { - get_handling_modifier(self.list_perks(), &calc_input, _pvp, cached_data) + let modifiers = if let Some(calc_input) = calc_input { + get_handling_modifier(self.list_perks(), &calc_input, pvp, cached_data) } else { HandlingModifierResponse::default() }; @@ -181,42 +181,42 @@ impl Weapon { impl AmmoFormula { fn calc_ammo_size_formula( &self, - _mag_stat: i32, - _mag_modifiers: MagazineModifierResponse, - _reserve_stat: i32, - _inv_modifiers: InventoryModifierResponse, - _calc_inv: bool, - _inv_id: u32, + mag_stat: i32, + mag_modifiers: MagazineModifierResponse, + reserve_stat: i32, + inv_modifiers: InventoryModifierResponse, + calc_inv: bool, + inv_id: u32, ) -> AmmoResponse { - let mag_stat = (_mag_stat + _mag_modifiers.magazine_stat_add).clamp(0, 100) as f64; - let inv_stat = (_reserve_stat + _inv_modifiers.inv_stat_add).clamp(0, 100) as f64; + let new_mag_stat = (mag_stat + mag_modifiers.magazine_stat_add).clamp(0, 100) as f64; + let inv_stat = (reserve_stat + inv_modifiers.inv_stat_add).clamp(0, 100) as f64; let raw_mag_size = - (self.mag.evpp * (mag_stat.powi(2))) + (self.mag.vpp * mag_stat) + self.mag.offset; + (self.mag.evpp * (new_mag_stat.powi(2))) + (self.mag.vpp * new_mag_stat) + self.mag.offset; let mut mag_size = - (((self.mag.evpp * (mag_stat.powi(2))) + (self.mag.vpp * mag_stat) + self.mag.offset) + (((self.mag.evpp * (new_mag_stat.powi(2))) + (self.mag.vpp * new_mag_stat) + self.mag.offset) .ceil() - * _mag_modifiers.magazine_scale - + _mag_modifiers.magazine_add) + * mag_modifiers.magazine_scale + + mag_modifiers.magazine_add) .ceil() as i32; if mag_size < 1 { mag_size = 1; } let mut reserve_size = 1; - if _calc_inv { + if calc_inv { reserve_size = calc_reserves( raw_mag_size, - _mag_stat, + mag_stat, inv_stat as i32, - _inv_id, - _inv_modifiers.inv_scale, + inv_id, + inv_modifiers.inv_scale, ); } AmmoResponse { mag_size, - reserve_size: reserve_size + _inv_modifiers.inv_add, + reserve_size: reserve_size + inv_modifiers.inv_add, timestamp: self.timestamp, } } @@ -224,9 +224,9 @@ impl AmmoFormula { impl Weapon { pub fn calc_ammo_sizes( &self, - _calc_input: Option, - _cached_data: Option<&mut HashMap>, - _pvp: bool, + calc_input: Option, + cached_data: Option<&mut HashMap>, + pvp: bool, ) -> AmmoResponse { let mag_stat = self .stats @@ -240,18 +240,18 @@ impl Weapon { .val(); let mut out; let mut default_chd_dt = HashMap::new(); - let cached_data = _cached_data.unwrap_or(&mut default_chd_dt); - if _calc_input.is_some() { + let cached_data = cached_data.unwrap_or(&mut default_chd_dt); + if calc_input.is_some() { let mag_modifiers = get_magazine_modifier( self.list_perks(), - &_calc_input.clone().unwrap(), - _pvp, + &calc_input.clone().unwrap(), + pvp, cached_data, ); let inv_modifiers = get_reserve_modifier( self.list_perks(), - &_calc_input.clone().unwrap(), - _pvp, + &calc_input.clone().unwrap(), + pvp, cached_data, ); out = self.ammo_formula.calc_ammo_size_formula( @@ -286,31 +286,31 @@ impl Weapon { impl Weapon { pub fn calc_firing_data( &self, - _calc_input: Option, - _cached_data: Option<&mut HashMap>, - _pvp: bool, + calc_input: Option, + cached_data: Option<&mut HashMap>, + pvp: bool, ) -> FiringResponse { let pve_damage_modifiers: DamageModifierResponse; let pvp_damage_modifiers: DamageModifierResponse; let firing_modifiers: FiringModifierResponse; let mut default_cached_data = HashMap::new(); - let cached_data = _cached_data.unwrap_or(&mut default_cached_data); - if _calc_input.is_some() { + let cached_data = cached_data.unwrap_or(&mut default_cached_data); + if calc_input.is_some() { firing_modifiers = get_firing_modifier( self.list_perks(), - &_calc_input.clone().unwrap(), - _pvp, + &calc_input.clone().unwrap(), + pvp, cached_data, ); pvp_damage_modifiers = get_dmg_modifier( self.list_perks(), - &_calc_input.clone().unwrap(), + &calc_input.clone().unwrap(), true, &mut cached_data.clone(), ); pve_damage_modifiers = get_dmg_modifier( self.list_perks(), - &_calc_input.clone().unwrap(), + &calc_input.clone().unwrap(), false, &mut cached_data.clone(), ); @@ -319,7 +319,7 @@ impl Weapon { pvp_damage_modifiers = DamageModifierResponse::default(); pve_damage_modifiers = DamageModifierResponse::default(); }; - let tmp_dmg_prof = self.get_damage_profile(_pvp); + let tmp_dmg_prof = self.get_damage_profile(pvp); let impact_dmg = tmp_dmg_prof.0; let explosion_dmg = tmp_dmg_prof.1; let crit_mult = tmp_dmg_prof.2; @@ -368,21 +368,21 @@ impl Weapon { } impl Weapon { - pub fn get_damage_profile(&self, _pvp: bool) -> (f64, f64, f64, f64) { - let mut impact = if _pvp { + pub fn get_damage_profile(&self, pvp: bool) -> (f64, f64, f64, f64) { + let mut impact = if pvp { self.firing_data.damage } else { self.firing_data.pve_damage }; let mut explosion = 0.0_f64; - let mut crit = if _pvp { + let mut crit = if pvp { self.firing_data.crit_mult } else { self.firing_data.pve_crit_mult }; let mut delay = 0.0; - let epr = get_explosion_data(self.list_perks(), &self.static_calc_input(), _pvp); + let epr = get_explosion_data(self.list_perks(), &self.static_calc_input(), pvp); if epr.percent > 0.0 { explosion = impact * epr.percent; impact *= 1.0 - epr.percent; @@ -402,10 +402,10 @@ impl Weapon { //flinch resist can be negative pub fn calc_flinch_resist( &self, - _calc_input: Option, - _resillience: i32, - _pvp: bool, - _cached_data: Option<&mut HashMap>, + calc_input: Option, + resillience: i32, + pvp: bool, + cached_data: Option<&mut HashMap>, ) -> f64 { /* Todo: @@ -413,11 +413,11 @@ impl Weapon { Perfect Float */ let mut default_cached_data = HashMap::new(); - let cached_data = _cached_data.unwrap_or(&mut default_cached_data); + let cached_data = cached_data.unwrap_or(&mut default_cached_data); let mut total_scaler = 1.0; //resil - let resillience: f64 = _resillience.clamp(0, 10).into(); + let resillience: f64 = resillience.clamp(0, 10).into(); total_scaler *= 1.0 - resillience * 0.01; //stability @@ -448,9 +448,9 @@ impl Weapon { .clamp(0, 100) .into(); total_scaler *= 1.0 - ((total_stability - 20.0) / 80.0 * stability_percent); - if let Some(calc_input) = _calc_input { + if let Some(calc_input) = calc_input { total_scaler *= - get_flinch_modifier(self.list_perks(), &calc_input, _pvp, cached_data).flinch_scale; + get_flinch_modifier(self.list_perks(), &calc_input, pvp, cached_data).flinch_scale; } total_scaler @@ -513,12 +513,12 @@ fn get_ads_multiplier(weapon_type: WeaponType, intrinsic_hash: u32) -> Result, - _pvp: bool, - _cached_data: Option<&mut HashMap>, + calc_input: Option, + pvp: bool, + cached_data: Option<&mut HashMap>, ) -> MetersPerSecond { let mut default_cached_data = HashMap::new(); - let cached_data = _cached_data.unwrap_or(&mut default_cached_data); + let cached_data = cached_data.unwrap_or(&mut default_cached_data); //Range/Velocity stat to m/s let mut velocity = match self.weapon_type { @@ -555,8 +555,8 @@ impl Weapon { _ => 0.0, }; - if let Some(calc_input) = _calc_input { - velocity *= get_velocity_modifier(self.list_perks(), &calc_input, _pvp, cached_data) + if let Some(calc_input) = calc_input { + velocity *= get_velocity_modifier(self.list_perks(), &calc_input, pvp, cached_data) .velocity_scaler; } velocity @@ -572,7 +572,7 @@ impl Weapon { .perk_val() .clamp(0, 100) .into(); - if self.perks.get(&1449897496).is_some() && self.weapon_type == WeaponType::BOW { + if self.perks.contains_key(&1449897496) && self.weapon_type == WeaponType::BOW { return Seconds::INFINITY; } match self.intrinsic_hash { @@ -611,8 +611,8 @@ impl Weapon { impl Weapon { pub fn get_misc_stats( &self, - _calc_input: Option, - _pvp: bool, + calc_input: Option, + pvp: bool, ) -> HashMap { let mut buffer: HashMap = HashMap::new(); let mut cached_data: HashMap = HashMap::new(); @@ -623,7 +623,7 @@ impl Weapon { ) { buffer.insert( "velocity".to_string(), - self.calc_projectile_velocity(_calc_input, _pvp, Some(&mut cached_data)), + self.calc_projectile_velocity(calc_input, pvp, Some(&mut cached_data)), ); }; diff --git a/src/weapons/ttk_calc.rs b/src/weapons/ttk_calc.rs index 5af59010..73a654cb 100644 --- a/src/weapons/ttk_calc.rs +++ b/src/weapons/ttk_calc.rs @@ -43,16 +43,16 @@ pub struct ResillienceSummary { pub optimal_ttk: OptimalKillData, } -pub fn calc_ttk(_weapon: &Weapon, _overshield: f64) -> Vec { +pub fn calc_ttk(weapon: &Weapon, overshield: f64) -> Vec { let mut ttk_data: Vec = Vec::new(); let mut persistent_data: HashMap = HashMap::new(); - let tmp_dmg_prof = _weapon.get_damage_profile(true); + let tmp_dmg_prof = weapon.get_damage_profile(true); let impact_dmg = tmp_dmg_prof.0; let explosion_dmg = tmp_dmg_prof.1; let mut crit_mult = tmp_dmg_prof.2; // let damage_delay = tmp_dmg_prof.3; - if _weapon.weapon_type == WeaponType::SHOTGUN && _weapon.firing_data.burst_size == 12 { + if weapon.weapon_type == WeaponType::SHOTGUN && weapon.firing_data.burst_size == 12 { crit_mult = 1.0; // shawty has no crits } @@ -74,20 +74,20 @@ pub fn calc_ttk(_weapon: &Weapon, _overshield: f64) -> Vec { persistent_data.insert("empowering".to_string(), 1.0); persistent_data.insert("debuff".to_string(), 1.0); persistent_data.insert("surge".to_string(), 1.0); - let calc_input = _weapon.pvp_calc_input( + let calc_input = weapon.pvp_calc_input( opt_bullets_fired, opt_bullets_hit, opt_time_taken, - (_overshield - opt_damage_dealt) > 0.0, + (overshield - opt_damage_dealt) > 0.0, ); let dmg_mods = get_dmg_modifier( - _weapon.list_perks().clone(), + weapon.list_perks().clone(), &calc_input, true, &mut persistent_data, ); let firing_mods = get_firing_modifier( - _weapon.list_perks().clone(), + weapon.list_perks().clone(), &calc_input, true, &mut persistent_data, @@ -100,12 +100,11 @@ pub fn calc_ttk(_weapon: &Weapon, _overshield: f64) -> Vec { let head_diff = ((impact_dmg * dmg_mods.impact_dmg_scale) * critical_multiplier) - (impact_dmg * dmg_mods.impact_dmg_scale); - let shot_burst_delay = (_weapon.firing_data.burst_delay + firing_mods.burst_delay_add) + let shot_burst_delay = (weapon.firing_data.burst_delay + firing_mods.burst_delay_add) * firing_mods.burst_delay_scale; let shot_inner_burst_delay = - _weapon.firing_data.inner_burst_delay * firing_mods.inner_burst_scale; - let shot_burst_size = - _weapon.firing_data.burst_size as f64 + firing_mods.burst_size_add; + weapon.firing_data.inner_burst_delay * firing_mods.inner_burst_scale; + let shot_burst_size = weapon.firing_data.burst_size as f64 + firing_mods.burst_size_add; let mut shot_delay = if opt_bullets_hit % shot_burst_size > 0.0 && opt_bullets_hit > 0.0 { @@ -116,25 +115,25 @@ pub fn calc_ttk(_weapon: &Weapon, _overshield: f64) -> Vec { shot_burst_delay }; - if _weapon.hash == 4289226715 { // vex mythoclast - } else if _weapon.weapon_type == WeaponType::LINEARFUSIONRIFLE { + if weapon.hash == 4289226715 { // vex mythoclast + } else if weapon.weapon_type == WeaponType::LINEARFUSIONRIFLE { shot_delay *= 1.95; - } else if _weapon.weapon_type == WeaponType::FUSIONRIFLE { + } else if weapon.weapon_type == WeaponType::FUSIONRIFLE { shot_delay *= 1.45; } - let ammo_fired = if _weapon.firing_data.one_ammo { + let ammo_fired = if weapon.firing_data.one_ammo { opt_bullets_hit / shot_burst_size } else { opt_bullets_fired }; if ammo_fired - mag_expended - >= _weapon + >= weapon .calc_ammo_sizes(Some(calc_input.clone()), Some(&mut persistent_data), true) .mag_size .into() { - shot_delay += _weapon + shot_delay += weapon .calc_reload_time(Some(calc_input.clone()), Some(&mut persistent_data), true) .reload_time; mag_expended += ammo_fired; @@ -197,39 +196,38 @@ pub fn calc_ttk(_weapon: &Weapon, _overshield: f64) -> Vec { persistent_data.insert("empowering".to_string(), 1.0); persistent_data.insert("debuff".to_string(), 1.0); persistent_data.insert("surge".to_string(), 1.0); - let calc_input = _weapon.pvp_calc_input( + let calc_input = weapon.pvp_calc_input( bdy_bullets_fired, bdy_bullets_hit, bdy_time_taken, - (_overshield - bdy_damage_dealt) > 0.0, + (overshield - bdy_damage_dealt) > 0.0, ); let dmg_mods = get_dmg_modifier( - _weapon.list_perks().clone(), + weapon.list_perks().clone(), &calc_input, true, &mut persistent_data, ); let firing_mods = get_firing_modifier( - _weapon.list_perks().clone(), + weapon.list_perks().clone(), &calc_input, true, &mut persistent_data, ); /////////////////////////////// - let tmp_dmg_prof = _weapon.get_damage_profile(true); + let tmp_dmg_prof = weapon.get_damage_profile(true); let impact_dmg = tmp_dmg_prof.0; let explosion_dmg = tmp_dmg_prof.1; let body_damage = (impact_dmg * dmg_mods.impact_dmg_scale) + (explosion_dmg * dmg_mods.explosive_dmg_scale); - let shot_burst_delay = (_weapon.firing_data.burst_delay + firing_mods.burst_delay_add) + let shot_burst_delay = (weapon.firing_data.burst_delay + firing_mods.burst_delay_add) * firing_mods.burst_delay_scale; let shot_inner_burst_delay = - _weapon.firing_data.inner_burst_delay * firing_mods.inner_burst_scale; - let shot_burst_size = - _weapon.firing_data.burst_size as f64 + firing_mods.burst_size_add; + weapon.firing_data.inner_burst_delay * firing_mods.inner_burst_scale; + let shot_burst_size = weapon.firing_data.burst_size as f64 + firing_mods.burst_size_add; let mut shot_delay = if bdy_bullets_hit % shot_burst_size > 0.0 && bdy_bullets_hit > 0.0 { @@ -240,25 +238,25 @@ pub fn calc_ttk(_weapon: &Weapon, _overshield: f64) -> Vec { shot_burst_delay }; - if _weapon.hash == 4289226715 { //vex mythoclast - } else if _weapon.weapon_type == WeaponType::LINEARFUSIONRIFLE { + if weapon.hash == 4289226715 { //vex mythoclast + } else if weapon.weapon_type == WeaponType::LINEARFUSIONRIFLE { shot_delay *= 1.95; - } else if _weapon.weapon_type == WeaponType::FUSIONRIFLE { + } else if weapon.weapon_type == WeaponType::FUSIONRIFLE { shot_delay *= 1.45; } - let ammo_fired = if _weapon.firing_data.one_ammo { + let ammo_fired = if weapon.firing_data.one_ammo { bdy_bullets_hit / shot_burst_size } else { bdy_bullets_fired }; if ammo_fired - mag_expended - >= _weapon + >= weapon .calc_ammo_sizes(Some(calc_input.clone()), Some(&mut persistent_data), true) .mag_size .into() { - shot_delay += _weapon + shot_delay += weapon .calc_reload_time(Some(calc_input.clone()), Some(&mut persistent_data), true) .reload_time; mag_expended += ammo_fired; @@ -292,7 +290,7 @@ pub fn calc_ttk(_weapon: &Weapon, _overshield: f64) -> Vec { } impl Weapon { - pub fn calc_ttk(&self, _overshield: f64) -> Vec { - calc_ttk(self, _overshield) + pub fn calc_ttk(&self, overshield: f64) -> Vec { + calc_ttk(self, overshield) } } diff --git a/src/weapons/weapon_constructor.rs b/src/weapons/weapon_constructor.rs index 476ca612..9650b0bb 100644 --- a/src/weapons/weapon_constructor.rs +++ b/src/weapons/weapon_constructor.rs @@ -13,28 +13,28 @@ use crate::{ use super::{FiringData, Weapon}; fn get_data_pointers( - _weapon_type_id: u8, + weapon_type_id: u8, intrinsic_hash: BungieHash, weapon_hash: BungieHash, ) -> Option { let pointer_map: HashMap = HashMap::from(database::DATA_POINTERS); - if let Some(weapon) = pointer_map.get(&WeaponPath(_weapon_type_id as u32, weapon_hash)) { + if let Some(weapon) = pointer_map.get(&WeaponPath(weapon_type_id as u32, weapon_hash)) { return Some(*weapon); } pointer_map - .get(&WeaponPath(_weapon_type_id as u32, intrinsic_hash)) + .get(&WeaponPath(weapon_type_id as u32, intrinsic_hash)) .cloned() } impl Weapon { pub fn generate_weapon( - _hash: u32, - _weapon_type_id: u8, - _intrinsic_hash: u32, - _ammo_type_id: u32, - _damage_type_id: u32, + hash: u32, + weapon_type_id: u8, + intrinsic_hash: u32, + ammo_type_id: u32, + damage_type_id: u32, ) -> Option { - let data_pointer_result = get_data_pointers(_weapon_type_id, _intrinsic_hash, _hash); + let data_pointer_result = get_data_pointers(weapon_type_id, intrinsic_hash, hash); let data_pointer = data_pointer_result?; @@ -50,13 +50,13 @@ impl Weapon { let ammo_formula: AmmoFormula = database::AMMO_DATA[data_pointer.a]; - let weapon_type = WeaponType::from(_weapon_type_id as u32); - let ammo_type = AmmoType::from(_ammo_type_id); - let damage_type = DamageType::from(_damage_type_id); - let intrinsic_alias = enhanced_check(_intrinsic_hash).0; + let weapon_type = WeaponType::from(weapon_type_id as u32); + let ammo_type = AmmoType::from(ammo_type_id); + let damage_type = DamageType::from(damage_type_id); + let intrinsic_alias = enhanced_check(intrinsic_hash).0; Some(Weapon { intrinsic_hash: intrinsic_alias, - hash: _hash, + hash, perks: HashMap::from([ ( intrinsic_alias, @@ -65,7 +65,7 @@ impl Weapon { enhanced: false, value: 0, hash: intrinsic_alias, - raw_hash: _intrinsic_hash, + raw_hash: intrinsic_hash, }, ), (