From 3557aeab68b98eebfda041614cd291231cc97884 Mon Sep 17 00:00:00 2001 From: oh-yes-0-fps Date: Sun, 21 Apr 2024 23:30:51 -0400 Subject: [PATCH 1/7] remove underscore from function arguments --- .../build-script-src/formula_types.rs | 2 + .../build-script-src/json_database.rs | 31 + boboswaggins_kitchen/build-script-src/main.rs | 16 + src/abilities/mod.rs | 4 +- src/activity/damage_calc.rs | 45 +- src/activity/mod.rs | 8 +- src/d2_enums.rs | 4 +- src/enemies/mod.rs | 6 +- src/lib.rs | 156 ++--- src/logging.rs | 4 +- src/perks/buff_perks.rs | 172 +++--- src/perks/exotic_armor.rs | 228 +++++--- src/perks/exotic_perks.rs | 548 ++++++++---------- src/perks/meta_perks.rs | 112 ++-- src/perks/mod.rs | 2 +- src/perks/origin_perks.rs | 180 +++--- src/perks/other_perks.rs | 219 +++---- src/perks/perk_options_handler.rs | 4 +- src/perks/year_1_perks.rs | 317 +++++----- src/perks/year_2_perks.rs | 114 ++-- src/perks/year_3_perks.rs | 78 +-- src/perks/year_4_perks.rs | 238 ++++---- src/perks/year_5_perks.rs | 168 +++--- src/perks/year_6_perks.rs | 204 +++---- src/test.rs | 5 +- src/types/rs_types.rs | 14 +- src/weapons/dps_calc.rs | 46 +- src/weapons/mod.rs | 44 +- src/weapons/reserve_calc.rs | 5 +- src/weapons/stat_calc.rs | 2 +- src/weapons/ttk_calc.rs | 64 +- src/weapons/weapon_constructor.rs | 30 +- 32 files changed, 1511 insertions(+), 1559 deletions(-) create mode 100644 boboswaggins_kitchen/build-script-src/formula_types.rs create mode 100644 boboswaggins_kitchen/build-script-src/json_database.rs create mode 100644 boboswaggins_kitchen/build-script-src/main.rs diff --git a/boboswaggins_kitchen/build-script-src/formula_types.rs b/boboswaggins_kitchen/build-script-src/formula_types.rs new file mode 100644 index 00000000..930fd975 --- /dev/null +++ b/boboswaggins_kitchen/build-script-src/formula_types.rs @@ -0,0 +1,2 @@ + +include!("../src/types/formula_types.rs"); \ No newline at end of file diff --git a/boboswaggins_kitchen/build-script-src/json_database.rs b/boboswaggins_kitchen/build-script-src/json_database.rs new file mode 100644 index 00000000..49cb246a --- /dev/null +++ b/boboswaggins_kitchen/build-script-src/json_database.rs @@ -0,0 +1,31 @@ +use std::path::Path; + +use thiserror::Error; + +#[derive(Debug, Error)] +pub enum FormulaFileError { + #[error("Failed to write formula source file")] + WriteError(#[from] std::io::Error), + #[error("Failed to serialize formula json")] + SerializeError(#[from] serde_json::Error), +} + +fn json_0_float() -> Value { + Value::Number(Number::from_f64(0.0).unwrap()) +} + +fn json_1_float() -> Value { + Value::Number(Number::from_f64(1.0).unwrap()) +} + + +pub fn write_formula_file(path: &Path) -> Result<(), FormulaFileError> { + + + + + + + + Ok(()) +} \ No newline at end of file diff --git a/boboswaggins_kitchen/build-script-src/main.rs b/boboswaggins_kitchen/build-script-src/main.rs new file mode 100644 index 00000000..42c47540 --- /dev/null +++ b/boboswaggins_kitchen/build-script-src/main.rs @@ -0,0 +1,16 @@ +use std::{env, path::Path}; + +mod rs_types; +mod json_database; + +fn main() { + let mut opts = built::Options::default(); + opts.set_dependencies(true); + + let src = env::var("CARGO_MANIFEST_DIR").unwrap(); + let built_dst = Path::new(&env::var("OUT_DIR").unwrap()).join("built.rs"); + let formula_dst = Path::new(&env::var("OUT_DIR").unwrap()).join("formulas.rs"); + + built::write_built_file_with_opts(&opts, src.as_ref(), &built_dst) + .expect("Failed to acquire build-time information"); +} 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..703e4d51 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, @@ -97,10 +96,10 @@ 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..b19d5586 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -31,8 +31,8 @@ use lol_alloc::{AssumeSingleThreaded, FreeListAllocator}; // SAFETY: This application is single threaded, so using AssumeSingleThreaded is allowed. #[cfg(target_arch = "wasm32")] #[global_allocator] -static ALLOCATOR: AssumeSingleThreaded = - unsafe { AssumeSingleThreaded::new(FreeListAllocator::new()) }; +static ALLOCATOR: AssumeSingleThreaded = unsafe { AssumeSingleThreaded::new(FreeListAllocator::new()) }; + mod built_info { include!(concat!(env!("OUT_DIR"), "/built.rs")); } @@ -87,7 +87,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 +119,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 +140,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 +166,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 +177,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 +213,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 +225,48 @@ 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, + 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 +276,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 +300,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(), @@ -329,91 +329,91 @@ pub fn get_weapon_firing_data( #[wasm_bindgen(js_name = "getWeaponFlinch")] pub fn get_weapon_flinch( - _dynamic_traits: bool, - _pvp: bool, - _resilience: u8, + 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 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); + 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); + 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 1df06fad..0329d3ee 100644 --- a/src/perks/buff_perks.rs +++ b/src/perks/buff_perks.rs @@ -12,17 +12,17 @@ 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(); +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); + cached_data.insert("empowering".to_string(), _desired_buff); _desired_buff / current_buff } } -fn surge_buff(_cached_data: &mut HashMap, _value: u32, _pvp: bool) -> f64 { +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, @@ -35,11 +35,11 @@ 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 } } @@ -62,8 +62,8 @@ 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); + Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + let buff = emp_buff(input.cached_data, 1.25); DamageModifierResponse { impact_dmg_scale: buff, explosive_dmg_scale: buff, @@ -74,12 +74,12 @@ pub fn buff_perks() { add_dmr( Perks::NobleRounds, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value == 0 { + Box::new(|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, @@ -90,10 +90,10 @@ pub fn buff_perks() { 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); + 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); DamageModifierResponse { impact_dmg_scale: buff, explosive_dmg_scale: buff, @@ -104,11 +104,11 @@ pub fn buff_perks() { add_dmr( Perks::PathOfTheBurningSteps, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value == 0 || _input.calc_data.damage_type != &DamageType::SOLAR { + Box::new(|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, @@ -119,9 +119,9 @@ pub fn buff_perks() { 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); + 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); DamageModifierResponse { impact_dmg_scale: buff, explosive_dmg_scale: buff, @@ -132,9 +132,9 @@ pub fn buff_perks() { 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); + 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); DamageModifierResponse { impact_dmg_scale: buff, explosive_dmg_scale: buff, @@ -145,8 +145,8 @@ pub fn buff_perks() { add_dmr( Perks::WardOfDawn, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let buff = emp_buff(_input.cached_data, 1.25); + Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + let buff = emp_buff(input.cached_data, 1.25); DamageModifierResponse { impact_dmg_scale: buff, explosive_dmg_scale: buff, @@ -157,9 +157,9 @@ pub fn buff_perks() { 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); + 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); DamageModifierResponse { impact_dmg_scale: buff, explosive_dmg_scale: buff, @@ -170,10 +170,10 @@ pub fn buff_perks() { 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); + 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); DamageModifierResponse { impact_dmg_scale: buff, explosive_dmg_scale: buff, @@ -187,14 +187,14 @@ pub fn buff_perks() { add_dmr( Perks::UmbralSharpening, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|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, @@ -205,8 +205,8 @@ pub fn buff_perks() { add_dmr( Perks::WormByproduct, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value > 0 { + Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + if input.value > 0 { DamageModifierResponse { impact_dmg_scale: 1.15, explosive_dmg_scale: 1.15, @@ -224,9 +224,9 @@ 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); + 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); DamageModifierResponse { impact_dmg_scale: debuff, explosive_dmg_scale: debuff, @@ -237,9 +237,9 @@ pub fn buff_perks() { 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); + 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); DamageModifierResponse { impact_dmg_scale: debuff, explosive_dmg_scale: debuff, @@ -250,9 +250,9 @@ pub fn buff_perks() { 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); + 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); DamageModifierResponse { impact_dmg_scale: debuff, explosive_dmg_scale: debuff, @@ -262,9 +262,9 @@ pub fn buff_perks() { ); 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); + 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); DamageModifierResponse { impact_dmg_scale: debuff, explosive_dmg_scale: debuff, @@ -274,9 +274,9 @@ pub fn buff_perks() { ); add_dmr( Perks::Felwinters, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value > 0 { - let debuff = gbl_debuff(_input.cached_data, 1.3); + Box::new(|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, @@ -290,14 +290,14 @@ pub fn buff_perks() { add_dmr( Perks::EnhancedScannerAugment, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|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, @@ -307,8 +307,8 @@ pub fn buff_perks() { ); add_dmr( Perks::SurgeMod, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let damage_mod = surge_buff(_input.cached_data, _input.value, _input.pvp); + Box::new(|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, @@ -318,11 +318,11 @@ pub fn buff_perks() { ); add_sbr( Perks::LucentBlades, - Box::new(|_input: ModifierResponseInput| -> HashMap { - if _input.calc_data.weapon_type != &WeaponType::SWORD { + Box::new(|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, @@ -333,8 +333,8 @@ pub fn buff_perks() { ); add_dmr( Perks::EternalWarrior, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let damage_mod = surge_buff(_input.cached_data, _input.value, _input.pvp); + Box::new(|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, @@ -345,9 +345,9 @@ pub fn buff_perks() { add_dmr( Perks::MantleOfBattleHarmony, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let buff = if _input.value > 0 { - surge_buff(_input.cached_data, 4, _input.pvp) + Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + let buff = if input.value > 0 { + surge_buff(input.cached_data, 4, input.pvp) } else { 1.0 }; @@ -360,13 +360,13 @@ pub fn buff_perks() { ); add_dmr( Perks::MaskOfBakris, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let buff = if _input.value > 0 + Box::new(|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 }; @@ -379,12 +379,12 @@ pub fn buff_perks() { ); add_dmr( Perks::SanguineAlchemy, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value == 0 || *_input.calc_data.damage_type == DamageType::KINETIC { + Box::new(|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, @@ -395,11 +395,11 @@ pub fn buff_perks() { ); add_dmr( Perks::Foetracers, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value == 0 { + Box::new(|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, @@ -409,11 +409,11 @@ pub fn buff_perks() { ); add_dmr( Perks::GlacialGuard, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value == 0 { + Box::new(|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, @@ -423,12 +423,12 @@ pub fn buff_perks() { ); add_dmr( Perks::NoBackupPlans, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if *_input.calc_data.weapon_type != WeaponType::SHOTGUN || _input.value == 0 { + Box::new(|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, diff --git a/src/perks/exotic_armor.rs b/src/perks/exotic_armor.rs index a0a20bf8..62633085 100644 --- a/src/perks/exotic_armor.rs +++ b/src/perks/exotic_armor.rs @@ -19,10 +19,10 @@ use super::{ pub fn exotic_armor() { add_dmr( Perks::BallindorseWrathweavers, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|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; } @@ -33,8 +33,8 @@ pub fn exotic_armor() { //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(); + Box::new(|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,19 +42,19 @@ 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() } }), @@ -63,9 +63,9 @@ pub fn exotic_armor() { add_sbr( Perks::TomeOfDawn, 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(), 50); } stats @@ -75,8 +75,8 @@ pub fn exotic_armor() { add_flmr( Perks::TomeOfDawn, - Box::new(|_input: ModifierResponseInput| -> FlinchModifierResponse { - if _input.value > 0 { + Box::new(|input: ModifierResponseInput| -> FlinchModifierResponse { + if input.value > 0 { FlinchModifierResponse { flinch_scale: 0.80 } } else { FlinchModifierResponse::default() @@ -87,7 +87,7 @@ pub fn exotic_armor() { add_sbr( Perks::KnuckleheadRadar, Box::new( - |_input: ModifierResponseInput| -> HashMap { + |_: ModifierResponseInput| -> HashMap { HashMap::from([(StatHashes::AIRBORNE.into(), 20)]) }, ), @@ -95,9 +95,9 @@ pub fn exotic_armor() { 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 { + 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 { return DamageModifierResponse::default(); } let modifier = 1.0 + (0.3 - health_percent); @@ -114,9 +114,9 @@ pub fn exotic_armor() { add_sbr( Perks::MechaneersTricksleeves, Box::new( - |_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); - if _input.calc_data.weapon_type == &WeaponType::SIDEARM { + 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); @@ -129,8 +129,8 @@ pub fn exotic_armor() { add_hmr( Perks::MechaneersTricksleeves, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.calc_data.weapon_type == &WeaponType::SIDEARM { + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.calc_data.weapon_type == &WeaponType::SIDEARM { HandlingModifierResponse { stat_add: 100, ..Default::default() @@ -143,8 +143,8 @@ pub fn exotic_armor() { ); add_rsmr( Perks::MechaneersTricksleeves, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - if _input.calc_data.weapon_type == &WeaponType::SIDEARM { + Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + if input.calc_data.weapon_type == &WeaponType::SIDEARM { ReloadModifierResponse { reload_stat_add: 100, ..Default::default() @@ -157,12 +157,12 @@ pub fn exotic_armor() { add_dmr( Perks::MechaneersTricksleeves, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value == 0 || *_input.calc_data.weapon_type != WeaponType::SIDEARM { + Box::new(|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, @@ -174,9 +174,9 @@ pub fn exotic_armor() { add_sbr( Perks::Oathkeeper, Box::new( - |_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); - if _input.calc_data.weapon_type == &WeaponType::BOW { + if input.calc_data.weapon_type == &WeaponType::BOW { stats.insert(StatHashes::AIRBORNE.into(), 40); stats.insert(StatHashes::DRAW_TIME.into(), 10); }; @@ -202,9 +202,9 @@ pub fn exotic_armor() { add_sbr( Perks::SealedAhamkaraGrasps, 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(), 50); }; stats @@ -218,9 +218,9 @@ pub fn exotic_armor() { add_sbr( Perks::LuckyPants, Box::new( - |_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut stat = HashMap::new(); - if _input.value > 0 && _input.calc_data.weapon_type == &WeaponType::HANDCANNON { + if input.value > 0 && input.calc_data.weapon_type == &WeaponType::HANDCANNON { stat.insert(StatHashes::AIRBORNE.into(), 20); stat.insert(StatHashes::HANDLING.into(), 100); }; @@ -232,8 +232,8 @@ pub fn exotic_armor() { add_hmr( Perks::LuckyPants, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value > 0 && _input.calc_data.weapon_type == &WeaponType::HANDCANNON { + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value > 0 && input.calc_data.weapon_type == &WeaponType::HANDCANNON { return HandlingModifierResponse { draw_add: 100, draw_scale: 0.6, @@ -248,9 +248,9 @@ pub fn exotic_armor() { add_sbr( Perks::NoBackupPlans, Box::new( - |_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); - if _input.calc_data.weapon_type == &WeaponType::SHOTGUN { + if input.calc_data.weapon_type == &WeaponType::SHOTGUN { stats.insert(StatHashes::AIRBORNE.into(), 30); }; stats @@ -261,10 +261,10 @@ pub fn exotic_armor() { add_sbr( Perks::ActiumWarRig, Box::new( - |_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); - if _input.calc_data.weapon_type == &WeaponType::AUTORIFLE - || _input.calc_data.weapon_type == &WeaponType::MACHINEGUN + if input.calc_data.weapon_type == &WeaponType::AUTORIFLE + || input.calc_data.weapon_type == &WeaponType::MACHINEGUN { stats.insert(StatHashes::AIRBORNE.into(), 30); } @@ -278,7 +278,7 @@ pub fn exotic_armor() { add_sbr( Perks::HallowfireHeart, Box::new( - |_input: ModifierResponseInput| -> HashMap { + |_: ModifierResponseInput| -> HashMap { HashMap::from([(StatHashes::AIRBORNE.into(), 20)]) }, ), @@ -287,9 +287,9 @@ pub fn exotic_armor() { add_sbr( Perks::LionRampart, 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(), 50); }; stats @@ -300,9 +300,9 @@ pub fn exotic_armor() { add_sbr( Perks::Peacekeepers, Box::new( - |_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); - if _input.calc_data.weapon_type == &WeaponType::SUBMACHINEGUN { + if input.calc_data.weapon_type == &WeaponType::SUBMACHINEGUN { stats.insert(StatHashes::AIRBORNE.into(), 40); stats.insert(StatHashes::HANDLING.into(), 50); }; @@ -314,8 +314,8 @@ pub fn exotic_armor() { add_hmr( Perks::Peacekeepers, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.calc_data.weapon_type == &WeaponType::SUBMACHINEGUN { + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.calc_data.weapon_type == &WeaponType::SUBMACHINEGUN { return HandlingModifierResponse { stat_add: 50, ads_scale: 1.0, @@ -332,7 +332,7 @@ pub fn exotic_armor() { add_sbr( Perks::PeregrineGreaves, Box::new( - |_input: ModifierResponseInput| -> HashMap { + |_: ModifierResponseInput| -> HashMap { HashMap::from([(StatHashes::AIRBORNE.into(), 20)]) }, ), @@ -341,7 +341,7 @@ pub fn exotic_armor() { add_sbr( Perks::EyeOfAnotherWorld, Box::new( - |_input: ModifierResponseInput| -> HashMap { + |_: ModifierResponseInput| -> HashMap { HashMap::from([(StatHashes::AIRBORNE.into(), 15)]) }, ), @@ -350,10 +350,10 @@ pub fn exotic_armor() { add_sbr( Perks::AstrocyteVerse, Box::new( - |_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); stats.insert(StatHashes::AIRBORNE.into(), 30); - if _input.value > 0 { + if input.value > 0 { stats.insert(StatHashes::HANDLING.into(), 100); } stats @@ -364,8 +364,8 @@ pub fn exotic_armor() { add_hmr( Perks::AstrocyteVerse, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value == 0 { + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value == 0 { return HandlingModifierResponse::default(); } HandlingModifierResponse { @@ -379,11 +379,11 @@ pub fn exotic_armor() { add_sbr( Perks::NecroticGrips, Box::new( - |_input: ModifierResponseInput| -> HashMap { + |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 + 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); @@ -396,9 +396,9 @@ pub fn exotic_armor() { add_sbr( Perks::BootsOfTheAssembler, Box::new( - |_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); - if _input.calc_data.intrinsic_hash == 2144092201 { + if input.calc_data.intrinsic_hash == 2144092201 { //Lumina stats.insert(StatHashes::AIRBORNE.into(), 30); }; @@ -410,10 +410,10 @@ pub fn exotic_armor() { add_sbr( Perks::RainOfFire, Box::new( - |_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); - if _input.calc_data.weapon_type == &WeaponType::FUSIONRIFLE - || _input.calc_data.weapon_type == &WeaponType::LINEARFUSIONRIFLE + if input.calc_data.weapon_type == &WeaponType::FUSIONRIFLE + || input.calc_data.weapon_type == &WeaponType::LINEARFUSIONRIFLE { stats.insert(StatHashes::AIRBORNE.into(), 30); } @@ -425,8 +425,8 @@ pub fn exotic_armor() { add_sbr( Perks::SpeedloaderSlacks, Box::new( - |_input: ModifierResponseInput| -> HashMap { - let modifiers = match _input.value { + |input: ModifierResponseInput| -> HashMap { + let modifiers = match input.value { 0 => (0, 0, 0), 1 => (40, 40, 30), 2 => (40, 40, 35), @@ -448,8 +448,8 @@ pub fn exotic_armor() { add_hmr( Perks::SpeedloaderSlacks, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let handling = match _input.value { + |input: ModifierResponseInput| -> HandlingModifierResponse { + let handling = match input.value { 0 => 0, 1 => 40, 2 => 40, @@ -468,8 +468,8 @@ pub fn exotic_armor() { add_rsmr( Perks::SpeedloaderSlacks, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - let modifiers = match _input.value { + Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + let modifiers = match input.value { 0 => (0, 1.0), 1 => (40, 1.0), 2 => (40, 0.925), @@ -489,9 +489,9 @@ pub fn exotic_armor() { add_sbr( Perks::LunaFaction, Box::new( - |_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut stat = HashMap::new(); - if _input.value >= 1 { + if input.value >= 1 { stat.insert(StatHashes::RELOAD.into(), 100); } stat @@ -501,8 +501,8 @@ pub fn exotic_armor() { add_rsmr( Perks::LunaFaction, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - if _input.value >= 1 { + Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + if input.value >= 1 { ReloadModifierResponse { reload_stat_add: 100, reload_time_scale: 0.9, @@ -515,8 +515,8 @@ pub fn exotic_armor() { add_rmr( Perks::LunaFaction, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { - if _input.value >= 2 { + Box::new(|input: ModifierResponseInput| -> RangeModifierResponse { + if input.value >= 2 { return RangeModifierResponse { range_all_scale: 2.0, ..Default::default() @@ -525,14 +525,92 @@ pub fn exotic_armor() { RangeModifierResponse::default() }), ); + add_sbr( Perks::TritonVice, - Box::new(|_input| -> HashMap { + Box::new(|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, + Box::new( + |_: ModifierResponseInput| -> HandlingModifierResponse { + HandlingModifierResponse { + stat_add: 35, + ..Default::default() + } + }, + ), + ); + + add_rsmr( + Perks::OphidianAspect, + Box::new(|_: ModifierResponseInput| -> ReloadModifierResponse { + ReloadModifierResponse { + reload_stat_add: 35, + reload_time_scale: 1.0, + } + }), + ); + + add_sbr( + Perks::OphidianAspect, + Box::new(|_: 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() + } + }), + ); } diff --git a/src/perks/exotic_perks.rs b/src/perks/exotic_perks.rs index d5c90c1b..b36786ab 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 { + Box::new(|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 @@ -51,13 +51,9 @@ pub fn exotic_perks() { add_sbr( Perks::HuntersTrance, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|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); @@ -68,12 +64,8 @@ pub fn exotic_perks() { add_rsmr( Perks::HuntersTrance, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - let inter_val = *_input - .calc_data - .perk_value_map - .get(&213689231) - .unwrap_or(&0); + Box::new(|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, @@ -84,12 +76,8 @@ pub fn exotic_perks() { add_rmr( Perks::HuntersTrance, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { - let inter_val = *_input - .calc_data - .perk_value_map - .get(&213689231) - .unwrap_or(&0); + Box::new(|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, @@ -100,26 +88,20 @@ pub fn exotic_perks() { 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() - } - }, - ), + 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() + } + }), ); add_rmr( Perks::HuntersTrace, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { - let range_ads_scale = if _input.value > 0 { 4.5 / 1.7 } else { 1.0 }; + Box::new(|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() @@ -129,10 +111,10 @@ pub fn exotic_perks() { add_dmr( Perks::MementoMori, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|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, @@ -144,8 +126,8 @@ pub fn exotic_perks() { 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 { + Box::new(|input: ModifierResponseInput| -> RangeModifierResponse { + let range_all_scale = if input.value > 0 && input.calc_data.total_shots_fired < 7.0 { 0.85 } else { 1.0 @@ -159,9 +141,9 @@ pub fn exotic_perks() { add_sbr( Perks::Roadborn, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|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); }; @@ -171,9 +153,9 @@ pub fn exotic_perks() { add_dmr( Perks::Roadborn, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { let mut crit_mult = 1.0; - if _input.value > 0 { + if input.value > 0 { crit_mult = 1.17; }; DamageModifierResponse { @@ -186,9 +168,9 @@ pub fn exotic_perks() { add_fmr( Perks::Roadborn, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { + Box::new(|input: ModifierResponseInput| -> FiringModifierResponse { let mut delay_mult = 1.0; - if _input.value > 0 { + if input.value > 0 { delay_mult = 0.583; }; FiringModifierResponse { @@ -202,9 +184,9 @@ pub fn exotic_perks() { add_rmr( Perks::Roadborn, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { + Box::new(|input: ModifierResponseInput| -> RangeModifierResponse { let mut range_scale = 1.05; - if _input.value > 0 { + if input.value > 0 { range_scale = 1.15; //roughly }; RangeModifierResponse { @@ -218,9 +200,9 @@ pub fn exotic_perks() { add_rsmr( Perks::Roadborn, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { + Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { let mut reload = 0; - if _input.value > 0 { + if input.value > 0 { reload = 40; }; ReloadModifierResponse { @@ -232,12 +214,12 @@ pub fn exotic_perks() { add_fmr( Perks::ReignHavoc, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { + Box::new(|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 { @@ -251,8 +233,8 @@ pub fn exotic_perks() { add_edr( Perks::ReignHavoc, - Box::new(|_input: ModifierResponseInput| -> ExtraDamageResponse { - let dmg = if _input.pvp { 65.0 } else { 65.0 * 1.3 }; + Box::new(|input: ModifierResponseInput| -> ExtraDamageResponse { + let dmg = if input.pvp { 65.0 } else { 65.0 * 1.3 }; ExtraDamageResponse { additive_damage: dmg, increment_total_time: false, @@ -269,8 +251,8 @@ pub fn exotic_perks() { add_dmr( Perks::WormsHunger, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let val = clamp(_input.value, 0, 20); + Box::new(|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, @@ -281,9 +263,9 @@ pub fn exotic_perks() { add_dmr( Perks::LagragianSight, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|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 { @@ -296,10 +278,10 @@ pub fn exotic_perks() { add_dmr( Perks::ToM, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|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, @@ -311,9 +293,9 @@ pub fn exotic_perks() { add_rr( Perks::ToM, - Box::new(|_input: ModifierResponseInput| -> RefundResponse { + Box::new(|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 @@ -327,8 +309,8 @@ pub fn exotic_perks() { add_edr( Perks::RocketTracers, - Box::new(|_input: ModifierResponseInput| -> ExtraDamageResponse { - let dmg = if _input.pvp { 24.0 } else { 105.0 }; + Box::new(|input: ModifierResponseInput| -> ExtraDamageResponse { + let dmg = if input.pvp { 24.0 } else { 105.0 }; ExtraDamageResponse { additive_damage: dmg, times_to_hit: 1, @@ -343,59 +325,9 @@ pub fn exotic_perks() { }), ); - // 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 { + Box::new(|_: ModifierResponseInput| -> FiringModifierResponse { FiringModifierResponse { burst_size_add: -2.0, ..Default::default() @@ -405,8 +337,8 @@ pub fn exotic_perks() { add_dmr( Perks::HakkeHeavyBurst, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let crit_scale = (1.5 + 5.0 / 51.0) / _input.calc_data.base_crit_mult; + Box::new(|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, @@ -417,12 +349,12 @@ pub fn exotic_perks() { add_dmr( Perks::SwoopingTalons, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|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, @@ -433,10 +365,10 @@ pub fn exotic_perks() { ); add_dmr( Perks::IgnitionTrigger, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|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, @@ -448,10 +380,10 @@ pub fn exotic_perks() { add_dmr( Perks::CalculatedBalance, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let mut damage_mult = if _input.value > 0 { 0.2 } else { 0.0 }; + Box::new(|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 { @@ -464,8 +396,8 @@ pub fn exotic_perks() { add_fmr( Perks::RavenousBeast, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { - if _input.value > 0 { + Box::new(|input: ModifierResponseInput| -> FiringModifierResponse { + if input.value > 0 { FiringModifierResponse { burst_delay_scale: 0.8, ..Default::default() @@ -478,12 +410,12 @@ pub fn exotic_perks() { add_dmr( Perks::RavenousBeast, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|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 @@ -499,13 +431,13 @@ pub fn exotic_perks() { add_sbr( Perks::ReleaseTheWolves, - Box::new(|_input: ModifierResponseInput| -> HashMap { - let has_cat = _input.calc_data.perk_value_map.contains_key(&431220296); + Box::new(|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); } } @@ -515,9 +447,9 @@ pub fn exotic_perks() { 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 { + Box::new(|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, @@ -530,8 +462,8 @@ pub fn exotic_perks() { add_fmr( Perks::ReleaseTheWolves, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { - if _input.value > 0 { + Box::new(|input: ModifierResponseInput| -> FiringModifierResponse { + if input.value > 0 { FiringModifierResponse { burst_delay_scale: 0.4, ..Default::default() @@ -544,8 +476,8 @@ pub fn exotic_perks() { add_dmr( Perks::ReleaseTheWolves, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let damage_mult = if _input.value > 0 { 1.4 } else { 1.0 }; + Box::new(|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, @@ -556,15 +488,15 @@ pub fn exotic_perks() { add_sbr( Perks::Fundamentals, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|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); }; @@ -574,25 +506,23 @@ pub fn exotic_perks() { 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() - } - }, - ), + Box::new(|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 { + Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { let mut reload = 0; - if _input.value == 2 { + if input.value == 2 { reload = 35; } ReloadModifierResponse { @@ -604,9 +534,9 @@ pub fn exotic_perks() { add_rmr( Perks::Fundamentals, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { + Box::new(|input: ModifierResponseInput| -> RangeModifierResponse { let mut range = 0; - if _input.value == 3 { + if input.value == 3 { range = 5; } RangeModifierResponse { @@ -618,9 +548,9 @@ pub fn exotic_perks() { add_sbr( Perks::ThinTheHerd, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|input: ModifierResponseInput| -> HashMap { let mut out = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { out.insert(StatHashes::RELOAD.into(), 70); } out @@ -629,8 +559,8 @@ pub fn exotic_perks() { add_rsmr( Perks::ThinTheHerd, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - if _input.value > 0 { + Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + if input.value > 0 { ReloadModifierResponse { reload_stat_add: 70, ..Default::default() @@ -643,25 +573,23 @@ pub fn exotic_perks() { add_hmr( Perks::Chimera, - Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value > 0 { - HandlingModifierResponse { - stat_add: 100, - ..Default::default() - } - } else { - HandlingModifierResponse::default() + Box::new(|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 { + Box::new(|input: ModifierResponseInput| -> HashMap { let mut out = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { out.insert(StatHashes::RELOAD.into(), 100); } out @@ -670,11 +598,11 @@ pub fn exotic_perks() { add_dmr( Perks::FirstGlance, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|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; @@ -690,11 +618,11 @@ pub fn exotic_perks() { add_dmr( Perks::FateOfAllFools, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|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; }; @@ -708,17 +636,17 @@ pub fn exotic_perks() { add_dmr( Perks::HonedEdge, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|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, @@ -730,11 +658,11 @@ pub fn exotic_perks() { add_dmr( Perks::TakenPredator, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|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 { @@ -747,9 +675,9 @@ pub fn exotic_perks() { 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 }; + 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 }; DamageModifierResponse { explosive_dmg_scale: 1.0 + damage_mult, impact_dmg_scale: 1.0 + damage_mult, @@ -760,14 +688,14 @@ pub fn exotic_perks() { add_dmr( Perks::StringofCurses, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let val = clamp(_input.value, 0, 5); + Box::new(|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 { @@ -780,12 +708,12 @@ pub fn exotic_perks() { add_dmr( Perks::StormAndStress, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value == 0 { + Box::new(|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, @@ -796,8 +724,8 @@ pub fn exotic_perks() { add_rmr( Perks::DualSpeedReceiver, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { - if _input.value == 0 { + Box::new(|input: ModifierResponseInput| -> RangeModifierResponse { + if input.value == 0 { return RangeModifierResponse::default(); } RangeModifierResponse { @@ -809,9 +737,9 @@ pub fn exotic_perks() { add_sbr( Perks::DualSpeedReceiver, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|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); } @@ -821,22 +749,22 @@ pub fn exotic_perks() { add_dmr( Perks::FullStop, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|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 { + Box::new(|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), @@ -847,22 +775,20 @@ pub fn exotic_perks() { 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() - } - }, - ), + 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() + } + }), ); 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); + 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); FiringModifierResponse { burst_delay_add: val as f64 * (-0.25 / 30.0), ..Default::default() @@ -872,9 +798,9 @@ pub fn exotic_perks() { 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); + 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); FiringModifierResponse { burst_delay_add: val as f64 * (-0.5 / 30.0), ..Default::default() @@ -884,9 +810,9 @@ pub fn exotic_perks() { add_sbr( Perks::CranialSpike, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|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 @@ -895,8 +821,8 @@ pub fn exotic_perks() { add_rsmr( Perks::CranialSpike, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - let val = clamp(_input.value, 0, 5) as i32; + Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + let val = clamp(input.value, 0, 5) as i32; let rel = 0.97_f64.powi(val); ReloadModifierResponse { reload_time_scale: rel, @@ -907,8 +833,8 @@ pub fn exotic_perks() { add_rmr( Perks::CranialSpike, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { - let val = clamp(_input.value, 0, 5) as i32; + Box::new(|input: ModifierResponseInput| -> RangeModifierResponse { + let val = clamp(input.value, 0, 5) as i32; RangeModifierResponse { range_stat_add: 8 * val, ..Default::default() @@ -918,11 +844,11 @@ pub fn exotic_perks() { add_fmr( Perks::DarkForgedTrigger, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { - if _input.value == 0 { + Box::new(|input: ModifierResponseInput| -> FiringModifierResponse { + if input.value == 0 { return FiringModifierResponse::default(); } - if _input + if input .calc_data .perk_value_map .get(&1319823571) @@ -944,8 +870,8 @@ pub fn exotic_perks() { add_dmr( Perks::HarmonicLaser, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let buff = match (_input.value, _input.pvp) { + Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + let buff = match (input.value, input.pvp) { (0, _) => 1.0, (1, true) => 1.03, (1, false) => 1.323, @@ -961,8 +887,8 @@ pub fn exotic_perks() { add_dmr( Perks::AgersScepterCatalyst, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value > 0 { + Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + if input.value > 0 { return DamageModifierResponse { impact_dmg_scale: 1.8, ..Default::default() @@ -974,25 +900,23 @@ pub fn exotic_perks() { 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() - } - }, - ), + 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() + } + }), ); add_dmr( Perks::ColdFusion, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let buff = 0.0195 * clamp(_input.calc_data.total_shots_hit, 0.0, 41.0); + Box::new(|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() @@ -1003,7 +927,7 @@ pub fn exotic_perks() { //Queenbreaker's sights add_dmr( Perks::MarksmanSights, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|_: ModifierResponseInput| -> DamageModifierResponse { DamageModifierResponse { impact_dmg_scale: 1.38, ..Default::default() @@ -1013,7 +937,7 @@ pub fn exotic_perks() { add_fmr( Perks::MarksmanSights, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { + Box::new(|_: ModifierResponseInput| -> FiringModifierResponse { FiringModifierResponse { burst_delay_add: (1800.0 / (60000.0 / 333.0)), // 300 + 333 = 633 , ..Default::default() @@ -1023,8 +947,8 @@ pub fn exotic_perks() { add_dmr( Perks::Broadside, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let buff = match _input.value { + Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + let buff = match input.value { 0 => 1.0, 1 => 1.18, 2 => 1.39, @@ -1040,8 +964,8 @@ pub fn exotic_perks() { add_fmr( Perks::TemporalUnlimiter, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { - if _input.value > 0 { + Box::new(|input: ModifierResponseInput| -> FiringModifierResponse { + if input.value > 0 { return FiringModifierResponse { burst_delay_add: 0.366, ..Default::default() @@ -1053,14 +977,14 @@ pub fn exotic_perks() { add_dmr( Perks::TemporalUnlimiter, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value == 0 { + Box::new(|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 { @@ -1073,20 +997,18 @@ pub fn exotic_perks() { add_mmr( Perks::FourthHorsemanCatalyst, - Box::new( - |_input: ModifierResponseInput| -> MagazineModifierResponse { - MagazineModifierResponse { - magazine_add: 1.0, - ..Default::default() - } - }, - ), + Box::new(|_: 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 { + Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + let buff = if input.calc_data.total_shots_hit % 2.0 == 1.0 { 1.35 } else { 1.0 @@ -1100,8 +1022,8 @@ pub fn exotic_perks() { add_dmr( Perks::Impetus, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value > 0 { + Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + if input.value > 0 { return DamageModifierResponse { impact_dmg_scale: 1.5, ..Default::default() @@ -1113,7 +1035,7 @@ pub fn exotic_perks() { add_fmr( Perks::MarksmanSights, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { + Box::new(|_: ModifierResponseInput| -> FiringModifierResponse { FiringModifierResponse { burst_delay_add: 0.333, // 300 + 333 = 633 , ..Default::default() @@ -1123,10 +1045,10 @@ pub fn exotic_perks() { 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; + 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; let impact_dmg_scale = (broadhead_damage + impact_damage) / impact_damage; @@ -1142,9 +1064,9 @@ pub fn exotic_perks() { ); add_fmr( Perks::Desperation, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { + Box::new(|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 { @@ -1155,11 +1077,11 @@ pub fn exotic_perks() { ); add_dmr( Perks::IonicReturn, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value == 0 { + Box::new(|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, @@ -1170,8 +1092,8 @@ pub fn exotic_perks() { ); add_dmr( Perks::Unrepentant, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value == 0 || _input.pvp { + Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + if input.value == 0 || input.pvp { return DamageModifierResponse::default(); } DamageModifierResponse { @@ -1182,9 +1104,9 @@ pub fn exotic_perks() { ); add_fmr( Perks::Unrepentant, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { + Box::new(|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 { @@ -1195,8 +1117,8 @@ pub fn exotic_perks() { ); add_dmr( Perks::ArcConductor, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value == 0 { + Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + if input.value == 0 { return DamageModifierResponse::default(); } DamageModifierResponse { @@ -1209,8 +1131,8 @@ pub fn exotic_perks() { add_hmr( Perks::ArcConductor, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value == 0 { + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value == 0 { return HandlingModifierResponse::default(); } HandlingModifierResponse { @@ -1222,9 +1144,9 @@ pub fn exotic_perks() { ); add_sbr( Perks::ArcConductor, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|input: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); - if _input.value == 1 { + if input.value == 1 { stats.insert(StatHashes::HANDLING.into(), 100); } stats @@ -1232,8 +1154,8 @@ pub fn exotic_perks() { ); add_dmr( Perks::VoidLeech, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value == 0 || _input.pvp { + Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + if input.value == 0 || input.pvp { return DamageModifierResponse::default(); } DamageModifierResponse { diff --git a/src/perks/meta_perks.rs b/src/perks/meta_perks.rs index 616e8286..726f351f 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 { + Box::new(|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; } @@ -68,36 +68,36 @@ pub fn meta_perks() { add_fmr( Perks::BuiltIn, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { + Box::new(|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 @@ -121,20 +121,20 @@ pub fn meta_perks() { add_epr( Perks::BuiltIn, Box::new( - |_input: ModifierResponseInput| -> ExplosivePercentResponse { - if *_input.calc_data.weapon_type == WeaponType::GRENADELAUNCHER { + |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.calc_data.stats.get(&StatHashes::BLAST_RADIUS.into()); let blast_radius = blast_radius_struct.cloned().unwrap_or_default().perk_val(); - if _input.calc_data.ammo_type == &AmmoType::SPECIAL { + 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 { + } else if input.calc_data.ammo_type == &AmmoType::HEAVY { return ExplosivePercentResponse { percent: 0.7 + 0.00175 * blast_radius as f64, delyed: 0.0, @@ -142,8 +142,8 @@ pub fn meta_perks() { }; }; } - if *_input.calc_data.weapon_type == WeaponType::ROCKET - && _input.calc_data.intrinsic_hash < 1000 + if *input.calc_data.weapon_type == WeaponType::ROCKET + && input.calc_data.intrinsic_hash < 1000 //ensures not exotic { return ExplosivePercentResponse { @@ -164,9 +164,9 @@ pub fn meta_perks() { 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 + |input: ModifierResponseInput| -> HandlingModifierResponse { + let swap_scale = if input.value > 0 { + 0.85 - clamp(input.value, 1, 3) as f64 * 0.05 } else { 1.0 }; @@ -182,9 +182,9 @@ pub fn meta_perks() { add_hmr( Perks::TargetingMod, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { + |input: ModifierResponseInput| -> HandlingModifierResponse { HandlingModifierResponse { - ads_scale: if _input.value > 0 { 0.75 } else { 1.0 }, + ads_scale: if input.value > 0 { 0.75 } else { 1.0 }, ..Default::default() } }, @@ -193,13 +193,13 @@ pub fn meta_perks() { add_sbr( Perks::TargetingMod, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|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 @@ -209,8 +209,8 @@ pub fn meta_perks() { add_imr( Perks::ReserveMod, Box::new( - |_input: ModifierResponseInput| -> InventoryModifierResponse { - let inv_buff = match _input.value { + |input: ModifierResponseInput| -> InventoryModifierResponse { + let inv_buff = match input.value { 0 => 0, 1 => 20, 2 => 40, @@ -228,8 +228,8 @@ pub fn meta_perks() { add_sbr( Perks::ReserveMod, - Box::new(|_input: ModifierResponseInput| -> HashMap { - let inv_buff = match _input.value { + Box::new(|input: ModifierResponseInput| -> HashMap { + let inv_buff = match input.value { 0 => 0, 1 => 20, 2 => 40, @@ -244,14 +244,14 @@ pub fn meta_perks() { add_rsmr( Perks::LoaderMod, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - let stat = match _input.value { + Box::new(|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, @@ -262,9 +262,9 @@ pub fn meta_perks() { add_sbr( Perks::LoaderMod, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|input: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); - let buff = match _input.value { + let buff = match input.value { 0 => 0, 1 => 10, 2 => 15, @@ -277,12 +277,12 @@ pub fn meta_perks() { add_flmr( Perks::UnflinchingMod, - Box::new(|_input: ModifierResponseInput| -> FlinchModifierResponse { - if _input.value > 2 { + Box::new(|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() @@ -292,7 +292,7 @@ pub fn meta_perks() { add_sbr( Perks::RallyBarricade, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|_: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); stats.insert(StatHashes::STABILITY.into(), 30); stats.insert(StatHashes::RELOAD.into(), 100); @@ -309,7 +309,7 @@ pub fn meta_perks() { add_rsmr( Perks::RallyBarricade, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { + Box::new(|_: ModifierResponseInput| -> ReloadModifierResponse { ReloadModifierResponse { reload_stat_add: 100, reload_time_scale: 0.9, @@ -319,7 +319,7 @@ pub fn meta_perks() { add_rmr( Perks::RallyBarricade, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { + Box::new(|_: ModifierResponseInput| -> RangeModifierResponse { RangeModifierResponse { range_all_scale: 1.1, ..Default::default() @@ -328,9 +328,9 @@ pub fn meta_perks() { ); add_fmr( Perks::AdeptChargeTime, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { + Box::new(|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, diff --git a/src/perks/mod.rs b/src/perks/mod.rs index 631e2682..5a7d3b0d 100644 --- a/src/perks/mod.rs +++ b/src/perks/mod.rs @@ -72,7 +72,7 @@ pub struct Perk { 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() { + for (h, r) in database::ENHANCE_PERK_MAPPING.iter() { if _hash == *h { result = *r; found = true; diff --git a/src/perks/origin_perks.rs b/src/perks/origin_perks.rs index f9651f49..570a4b63 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"); + Box::new(|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, @@ -42,10 +42,10 @@ pub fn origin_perks() { add_fmr( Perks::VeistStinger, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { + Box::new(|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 { @@ -58,12 +58,12 @@ pub fn origin_perks() { add_dmr( Perks::HakkeBreach, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value == 0 { + Box::new(|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, @@ -80,8 +80,8 @@ pub fn origin_perks() { add_rmr( Perks::Alacrity, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { - let range_add = if _input.value > 0 { 20 } else { 0 }; + Box::new(|input: ModifierResponseInput| -> RangeModifierResponse { + let range_add = if input.value > 0 { 20 } else { 0 }; RangeModifierResponse { range_stat_add: range_add, ..Default::default() @@ -91,8 +91,8 @@ pub fn origin_perks() { add_rsmr( Perks::Alacrity, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - let reload_add = if _input.value > 0 { 50 } else { 0 }; + Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + let reload_add = if input.value > 0 { 50 } else { 0 }; ReloadModifierResponse { reload_stat_add: reload_add, ..Default::default() @@ -102,12 +102,12 @@ pub fn origin_perks() { add_sbr( Perks::Alacrity, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|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); @@ -118,11 +118,11 @@ pub fn origin_perks() { add_sbr( Perks::Ambush, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|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); } @@ -132,9 +132,9 @@ pub fn origin_perks() { 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 { + 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 { RangeModifierResponse { range_stat_add: range_add, ..Default::default() @@ -148,9 +148,9 @@ pub fn origin_perks() { 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 { + |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() @@ -164,11 +164,11 @@ pub fn origin_perks() { add_dmr( Perks::Ambush, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value == 0 || _input.pvp { + Box::new(|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 @@ -184,10 +184,10 @@ pub fn origin_perks() { add_fmr( Perks::Ambush, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { + Box::new(|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 { @@ -201,9 +201,9 @@ pub fn origin_perks() { add_hmr( Perks::HotSwap, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let handling_add = if _input.is_enhanced { 60 } else { 30 }; - if _input.value > 0 { + |input: ModifierResponseInput| -> HandlingModifierResponse { + let handling_add = if input.is_enhanced { 60 } else { 30 }; + if input.value > 0 { HandlingModifierResponse { stat_add: handling_add, ..Default::default() @@ -217,9 +217,9 @@ pub fn origin_perks() { 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 { + 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 { ReloadModifierResponse { reload_stat_add: reload_add, reload_time_scale: 1.0, @@ -232,12 +232,12 @@ pub fn origin_perks() { add_sbr( Perks::FluidDynamics, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|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); @@ -248,8 +248,8 @@ pub fn origin_perks() { add_rsmr( Perks::QuietMoment, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - if _input.value > 0 { + Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + if input.value > 0 { ReloadModifierResponse { reload_stat_add: 40, reload_time_scale: 0.95, @@ -262,9 +262,9 @@ pub fn origin_perks() { add_sbr( Perks::QuietMoment, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|input: ModifierResponseInput| -> HashMap { let mut map = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { map.insert(StatHashes::RELOAD.into(), 40); } map @@ -273,8 +273,8 @@ pub fn origin_perks() { add_rsmr( Perks::BitterSpite, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - let val = clamp(_input.value, 0, 5) as i32; + Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + let val = clamp(input.value, 0, 5) as i32; let mult = match val { 0 => 1.0, 1 => 0.97, @@ -293,9 +293,9 @@ pub fn origin_perks() { add_sbr( Perks::BitterSpite, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|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 }), @@ -303,9 +303,9 @@ pub fn origin_perks() { add_rmr( Perks::RightHook, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { - let range_add = if _input.is_enhanced { 20 } else { 10 }; - if _input.value > 0 { + Box::new(|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() @@ -318,10 +318,10 @@ pub fn origin_perks() { add_sbr( Perks::RightHook, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|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); } @@ -332,8 +332,8 @@ pub fn origin_perks() { add_hmr( Perks::SearchParty, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value > 0 { + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value > 0 { HandlingModifierResponse { ads_scale: 0.85, ..Default::default() @@ -348,8 +348,8 @@ pub fn origin_perks() { add_mmr( Perks::RunnethOver, Box::new( - |_input: ModifierResponseInput| -> MagazineModifierResponse { - let val = clamp(_input.value, 0, 5) as f64; + |input: ModifierResponseInput| -> MagazineModifierResponse { + let val = clamp(input.value, 0, 5) as f64; MagazineModifierResponse { magazine_scale: 1.0 + val * 0.1, ..Default::default() @@ -360,9 +360,9 @@ pub fn origin_perks() { add_sbr( Perks::TexBalancedStock, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|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); @@ -374,8 +374,8 @@ pub fn origin_perks() { add_hmr( Perks::TexBalancedStock, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value > 0 { + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value > 0 { HandlingModifierResponse { stat_add: 50, ..Default::default() @@ -389,8 +389,8 @@ pub fn origin_perks() { add_rsmr( Perks::TexBalancedStock, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - if _input.value > 0 { + Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + if input.value > 0 { ReloadModifierResponse { reload_stat_add: 20, reload_time_scale: 0.9, @@ -402,8 +402,8 @@ pub fn origin_perks() { ); add_rmr( Perks::TexBalancedStock, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { - if _input.value == 0 { + Box::new(|input: ModifierResponseInput| -> RangeModifierResponse { + if input.value == 0 { return RangeModifierResponse::default(); } RangeModifierResponse { @@ -414,9 +414,9 @@ pub fn origin_perks() { ); add_sbr( Perks::SurosSynergy, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|input: ModifierResponseInput| -> HashMap { let mut out = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { out.insert(StatHashes::HANDLING.into(), 40); } out @@ -426,8 +426,8 @@ pub fn origin_perks() { add_hmr( Perks::SurosSynergy, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value > 0 { + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value > 0 { HandlingModifierResponse { stat_add: 40, ..Default::default() @@ -441,8 +441,8 @@ pub fn origin_perks() { add_flmr( Perks::SurosSynergy, - Box::new(|_input: ModifierResponseInput| -> FlinchModifierResponse { - if _input.value > 0 { + Box::new(|input: ModifierResponseInput| -> FlinchModifierResponse { + if input.value > 0 { FlinchModifierResponse { flinch_scale: 0.80 } } else { FlinchModifierResponse::default() @@ -452,12 +452,12 @@ pub fn origin_perks() { add_sbr( Perks::HarmonicResonance, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|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); } @@ -467,9 +467,9 @@ pub fn origin_perks() { add_rsmr( Perks::HarmonicResonance, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - let stat_bump = if _input.value > 1 { 20 } else { 0 }; - if _input.value > 0 { + Box::new(|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, @@ -483,8 +483,8 @@ pub fn origin_perks() { add_hmr( Perks::HarmonicResonance, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let stat_bump = 10 * clamp(_input.value, 0, 2); + |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..84abf348 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 { + Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + if input.value > 0 { ReloadModifierResponse { reload_stat_add: 0, reload_time_scale: 0.85, @@ -34,8 +34,8 @@ pub fn other_perks() { add_rsmr( Perks::RapidFireFrame, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - if _input.value > 0 || _input.calc_data.weapon_type == &WeaponType::SHOTGUN { + Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + if input.value > 0 || input.calc_data.weapon_type == &WeaponType::SHOTGUN { ReloadModifierResponse { reload_stat_add: 0, reload_time_scale: 0.80, @@ -48,9 +48,9 @@ pub fn other_perks() { add_sbr( Perks::PrecisionFrame, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|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 @@ -60,7 +60,7 @@ pub fn other_perks() { add_hmr( Perks::SwapMag, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { + |_: ModifierResponseInput| -> HandlingModifierResponse { HandlingModifierResponse { draw_scale: 0.9, stow_scale: 0.9, @@ -73,7 +73,7 @@ pub fn other_perks() { add_hmr( Perks::QuickAccessSling, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { + |_: ModifierResponseInput| -> HandlingModifierResponse { HandlingModifierResponse { draw_scale: 0.9, stow_scale: 0.9, @@ -86,7 +86,7 @@ pub fn other_perks() { add_hmr( Perks::FreehandGrip, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { + |_: ModifierResponseInput| -> HandlingModifierResponse { HandlingModifierResponse { draw_scale: 0.95, ..Default::default() @@ -95,86 +95,9 @@ pub fn other_perks() { ), ); - 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, - } - }), - ); - - 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() - } - }), - ); - add_sbr( Perks::Amplified, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|_: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); stats.insert(StatHashes::HANDLING.into(), 40); stats @@ -184,7 +107,7 @@ pub fn other_perks() { add_hmr( Perks::Amplified, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { + |_: ModifierResponseInput| -> HandlingModifierResponse { HandlingModifierResponse { stat_add: 40, draw_scale: 0.95, @@ -197,8 +120,8 @@ pub fn other_perks() { add_rsmr( Perks::Frequency, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - if _input.value > 0 { + Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + if input.value > 0 { ReloadModifierResponse { reload_stat_add: 50, reload_time_scale: 0.8, @@ -211,9 +134,9 @@ pub fn other_perks() { add_sbr( Perks::Tempering, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|input: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { stats.insert(StatHashes::RELOAD.into(), 50); }; stats @@ -222,8 +145,8 @@ pub fn other_perks() { add_rsmr( Perks::FlowState, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - if _input.value > 0 { + Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + if input.value > 0 { ReloadModifierResponse { reload_stat_add: 50, reload_time_scale: 0.8, @@ -236,9 +159,9 @@ pub fn other_perks() { add_sbr( Perks::FlowState, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|input: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { stats.insert(StatHashes::RELOAD.into(), 50); }; stats @@ -247,9 +170,9 @@ pub fn other_perks() { add_sbr( Perks::Tempering, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|input: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { stats.insert(StatHashes::AIRBORNE.into(), 20); }; stats @@ -258,10 +181,10 @@ pub fn other_perks() { add_sbr( Perks::OnYourMark, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|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); }; @@ -272,8 +195,8 @@ pub fn other_perks() { add_hmr( Perks::OnYourMark, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let val = clamp(_input.value, 0, 3) as i32; + |input: ModifierResponseInput| -> HandlingModifierResponse { + let val = clamp(input.value, 0, 3) as i32; HandlingModifierResponse { stat_add: 20 * val, ..Default::default() @@ -284,21 +207,21 @@ pub fn other_perks() { add_rsmr( Perks::OnYourMark, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - let val = clamp(_input.value, 0, 3) as i32; + Box::new(|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 { + Box::new(|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); @@ -308,9 +231,9 @@ pub fn other_perks() { add_sbr( Perks::Hedrons, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|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); @@ -321,8 +244,8 @@ pub fn other_perks() { add_dmr( Perks::BossSpec, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let damage_mult = if *_input.calc_data.enemy_type == EnemyType::BOSS && !_input.pvp { + Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + let damage_mult = if *input.calc_data.enemy_type == EnemyType::BOSS && !input.pvp { 1.077 } else { 1.0 @@ -337,11 +260,11 @@ pub fn other_perks() { add_dmr( Perks::MajorSpec, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|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(); } @@ -356,11 +279,11 @@ pub fn other_perks() { add_dmr( Perks::BigOnesSpec, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|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(); } @@ -375,8 +298,8 @@ pub fn other_perks() { add_dmr( Perks::MinorSpec, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let damage_mult = if _input.calc_data.enemy_type == &EnemyType::MINOR && !_input.pvp { + Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + let damage_mult = if input.calc_data.enemy_type == &EnemyType::MINOR && !input.pvp { 1.077 } else { 1.0 @@ -391,8 +314,8 @@ pub fn other_perks() { add_dmr( Perks::TakenSpec, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let damage_mult = if _input.value > 0 && !_input.pvp { + Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + let damage_mult = if input.value > 0 && !input.pvp { 1.1 } else { 1.0 @@ -407,7 +330,7 @@ pub fn other_perks() { add_dmr( Perks::SpikeGrenades, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|_: ModifierResponseInput| -> DamageModifierResponse { DamageModifierResponse { impact_dmg_scale: 1.125, explosive_dmg_scale: 1.0, @@ -418,7 +341,7 @@ pub fn other_perks() { add_dmr( Perks::DisorientingGrenades, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|_: ModifierResponseInput| -> DamageModifierResponse { DamageModifierResponse { impact_dmg_scale: 0.75, explosive_dmg_scale: 0.75, @@ -429,9 +352,9 @@ pub fn other_perks() { 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 + Box::new(|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, @@ -446,8 +369,8 @@ pub fn other_perks() { add_fmr( Perks::AcceleratedCoils, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { - if _input.calc_data.weapon_type == &WeaponType::LINEARFUSIONRIFLE { + Box::new(|input: ModifierResponseInput| -> FiringModifierResponse { + if input.calc_data.weapon_type == &WeaponType::LINEARFUSIONRIFLE { return FiringModifierResponse { burst_delay_add: -0.033, ..Default::default() @@ -462,8 +385,8 @@ pub fn other_perks() { add_fmr( Perks::LiquidCoils, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { - if _input.calc_data.weapon_type == &WeaponType::LINEARFUSIONRIFLE { + Box::new(|input: ModifierResponseInput| -> FiringModifierResponse { + if input.calc_data.weapon_type == &WeaponType::LINEARFUSIONRIFLE { return FiringModifierResponse { burst_delay_add: 0.033, ..Default::default() @@ -478,7 +401,7 @@ pub fn other_perks() { add_dmr( Perks::LiquidCoils, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|_: ModifierResponseInput| -> DamageModifierResponse { DamageModifierResponse { impact_dmg_scale: 1.02, explosive_dmg_scale: 1.02, @@ -489,7 +412,7 @@ pub fn other_perks() { add_dmr( Perks::AcceleratedCoils, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|_: ModifierResponseInput| -> DamageModifierResponse { DamageModifierResponse { impact_dmg_scale: 0.98, explosive_dmg_scale: 0.98, @@ -500,8 +423,8 @@ pub fn other_perks() { add_fmr( Perks::AssaultMag, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { - let hash = _input.calc_data.intrinsic_hash; + Box::new(|input: ModifierResponseInput| -> FiringModifierResponse { + let hash = input.calc_data.intrinsic_hash; let tick_amount = if hash == 904 { 3.0 } else if hash == 906 { @@ -509,7 +432,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() @@ -522,9 +445,9 @@ pub fn other_perks() { add_sbr( Perks::ThreadOfAscent, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|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); @@ -536,8 +459,8 @@ pub fn other_perks() { add_hmr( Perks::ThreadOfAscent, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value > 0 { + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value > 0 { HandlingModifierResponse { stat_add: 40, draw_scale: 0.925, @@ -550,10 +473,11 @@ pub fn other_perks() { }, ), ); + add_rsmr( Perks::ThreadOfAscent, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - if _input.value > 0 { + Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + if input.value > 0 { ReloadModifierResponse { reload_time_scale: 0.925, reload_stat_add: 40, @@ -563,4 +487,15 @@ pub fn other_perks() { } }), ); + + add_dmr( + Perks::ImpactCasing, + Box::new(|_: 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 836b292a..d02c9404 100644 --- a/src/perks/perk_options_handler.rs +++ b/src/perks/perk_options_handler.rs @@ -116,7 +116,9 @@ fn hash_to_perk_option_data(_hash: u32) -> Option { //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()), diff --git a/src/perks/year_1_perks.rs b/src/perks/year_1_perks.rs index e9fc62f6..002789e2 100644 --- a/src/perks/year_1_perks.rs +++ b/src/perks/year_1_perks.rs @@ -22,8 +22,8 @@ pub fn year_1_perks() { add_sbr( Perks::ThreatDetector, Box::new( - |_input: ModifierResponseInput| -> HashMap { - let stats = match _input.value { + |input: ModifierResponseInput| -> HashMap { + let stats = match input.value { 0 => (0, 0, 0), 1 => (15, 15, 25), _ => (40, 55, 100), @@ -39,15 +39,15 @@ pub fn year_1_perks() { add_dmr( Perks::HighImpactReserves, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|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); } @@ -64,8 +64,8 @@ pub fn year_1_perks() { add_hmr( Perks::ThreatDetector, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let val = clamp(_input.value, 0, 2) as i32; + |input: ModifierResponseInput| -> HandlingModifierResponse { + let val = clamp(input.value, 0, 2) as i32; let stat = match val { 0 => 0, 1 => 25, @@ -86,11 +86,11 @@ pub fn year_1_perks() { add_rsmr( Perks::ThreatDetector, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { + Box::new(|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 { @@ -103,11 +103,11 @@ pub fn year_1_perks() { 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 { + |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 { + if *input.calc_data.ammo_type == AmmoType::PRIMARY { mag_mult += 0.2 * val; } else { mag_mult += 0.1 * val; @@ -129,11 +129,11 @@ pub fn year_1_perks() { add_dmr( Perks::BoxBreathing, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.calc_data.total_shots_fired == 0.0 && _input.value > 0 { + Box::new(|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 { @@ -148,10 +148,10 @@ pub fn year_1_perks() { add_fmr( Perks::Desperado, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { + Box::new(|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 { @@ -163,8 +163,8 @@ pub fn year_1_perks() { add_dmr( Perks::ExplosivePayload, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.pvp { + Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + if input.pvp { DamageModifierResponse::default() } else { DamageModifierResponse { @@ -179,7 +179,7 @@ pub fn year_1_perks() { add_epr( Perks::ExplosivePayload, Box::new( - |_input: ModifierResponseInput| -> ExplosivePercentResponse { + |_: ModifierResponseInput| -> ExplosivePercentResponse { ExplosivePercentResponse { percent: 0.5, delyed: 0.0, @@ -191,11 +191,11 @@ pub fn year_1_perks() { add_dmr( Perks::TimedPayload, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.pvp { + Box::new(|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, @@ -208,7 +208,7 @@ pub fn year_1_perks() { add_epr( Perks::TimedPayload, Box::new( - |_input: ModifierResponseInput| -> ExplosivePercentResponse { + |_: ModifierResponseInput| -> ExplosivePercentResponse { ExplosivePercentResponse { percent: 0.5, delyed: 0.6, @@ -221,14 +221,14 @@ pub fn year_1_perks() { add_sbr( Perks::FieldPrep, Box::new( - |_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut out = HashMap::new(); - if _input.value > 0 { - let reload = if _input.is_enhanced { 55 } else { 50 }; + 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 { + 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); @@ -239,12 +239,12 @@ pub fn year_1_perks() { add_rsmr( Perks::FieldPrep, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { + Box::new(|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, @@ -256,9 +256,9 @@ pub fn year_1_perks() { add_imr( Perks::FieldPrep, Box::new( - |_input: ModifierResponseInput| -> InventoryModifierResponse { + |input: ModifierResponseInput| -> InventoryModifierResponse { InventoryModifierResponse { - inv_stat_add: if _input.is_enhanced { 40 } else { 30 }, + inv_stat_add: if input.is_enhanced { 40 } else { 30 }, ..Default::default() } }, @@ -268,8 +268,8 @@ pub fn year_1_perks() { add_hmr( Perks::FieldPrep, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value >= 1 { + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value >= 1 { HandlingModifierResponse { stow_scale: 0.8, draw_scale: 0.8, @@ -285,15 +285,15 @@ pub fn year_1_perks() { 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 { + |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 { + if input.value > 0 { out.insert(StatHashes::HANDLING.into(), handling); out.insert(StatHashes::STABILITY.into(), stabiltiy); } @@ -305,12 +305,12 @@ pub fn year_1_perks() { 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 { + |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 { + if input.value > 0 { HandlingModifierResponse { stat_add: handling, ..Default::default() @@ -324,9 +324,9 @@ pub fn year_1_perks() { add_fmr( Perks::FullAutoTrigger, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { + Box::new(|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 { @@ -340,7 +340,7 @@ pub fn year_1_perks() { add_rr( Perks::TripleTap, - Box::new(|_input: ModifierResponseInput| -> RefundResponse { + Box::new(|_: ModifierResponseInput| -> RefundResponse { RefundResponse { crit: true, requirement: 3, @@ -353,9 +353,9 @@ pub fn year_1_perks() { add_sbr( Perks::HipFireGrip, 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(), 15); out.insert(StatHashes::STABILITY.into(), 25); }; @@ -366,11 +366,11 @@ pub fn year_1_perks() { add_rmr( Perks::HipFireGrip, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { + Box::new(|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; @@ -384,24 +384,13 @@ pub fn year_1_perks() { }), ); - 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 }; + |input: ModifierResponseInput| -> HashMap { + let aim_assist = if input.is_enhanced { 11 } else { 10 }; let mut out = HashMap::new(); - if _input.value >= 1 { + if input.value >= 1 { out.insert(StatHashes::AIM_ASSIST.into(), aim_assist); } out @@ -412,15 +401,15 @@ pub fn year_1_perks() { 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 }; + |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 { + if *input.calc_data.ammo_type == AmmoType::SPECIAL { aim_assist /= 2.0; range /= 2.0; } - if _input.value > 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); } @@ -431,12 +420,12 @@ pub fn year_1_perks() { 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 { + 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 { range = 0.0; }; - if *_input.calc_data.ammo_type == AmmoType::SPECIAL { + if *input.calc_data.ammo_type == AmmoType::SPECIAL { range /= 2.0; } RangeModifierResponse { @@ -451,9 +440,9 @@ pub fn year_1_perks() { add_sbr( Perks::Outlaw, 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 @@ -463,9 +452,9 @@ pub fn year_1_perks() { 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 { + 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 { ReloadModifierResponse { reload_stat_add: 70, reload_time_scale: 0.9, @@ -479,7 +468,7 @@ pub fn year_1_perks() { add_vmr( Perks::RangeFinder, Box::new( - |_input: ModifierResponseInput| -> VelocityModifierResponse { + |_: ModifierResponseInput| -> VelocityModifierResponse { VelocityModifierResponse { velocity_scaler: 1.05, } @@ -490,11 +479,11 @@ pub fn year_1_perks() { 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 }; + |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 { + if input.value > 0 { out.insert(StatHashes::STABILITY.into(), stability); out.insert(StatHashes::RANGE.into(), range); } @@ -505,12 +494,12 @@ pub fn year_1_perks() { add_rmr( Perks::SlideShot, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { + Box::new(|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; } @@ -524,11 +513,11 @@ pub fn year_1_perks() { 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 }; + |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 { + if input.value > 0 { out.insert(StatHashes::STABILITY.into(), stability); out.insert(StatHashes::HANDLING.into(), handling); } @@ -540,8 +529,8 @@ pub fn year_1_perks() { add_hmr( Perks::SlideWays, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let handling = if _input.value > 0 { 20 } else { 0 }; + |input: ModifierResponseInput| -> HandlingModifierResponse { + let handling = if input.value > 0 { 20 } else { 0 }; HandlingModifierResponse { stat_add: handling, ..Default::default() @@ -553,9 +542,9 @@ pub fn year_1_perks() { add_hmr( Perks::Snapshot, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { + |input: ModifierResponseInput| -> HandlingModifierResponse { let mut ads_mult = 0.5; - if *_input.calc_data.ammo_type == AmmoType::SPECIAL { + if *input.calc_data.ammo_type == AmmoType::SPECIAL { ads_mult = 0.8; //its 0.8 from my testing idk }; HandlingModifierResponse { @@ -569,13 +558,13 @@ pub fn year_1_perks() { 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 { + |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 { + if input.value > 0 { out.insert(StatHashes::STABILITY.into(), stability); } out @@ -585,14 +574,14 @@ pub fn year_1_perks() { add_dmr( Perks::Rampage, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let val = clamp(_input.value, 0, 3); + Box::new(|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; } @@ -606,10 +595,10 @@ pub fn year_1_perks() { 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 { + 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 { damage_mult = 0.0; }; DamageModifierResponse { @@ -622,10 +611,10 @@ pub fn year_1_perks() { 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 { + 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 { damage_mult = 0.0; }; DamageModifierResponse { @@ -638,10 +627,10 @@ pub fn year_1_perks() { 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 { + 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 { firing_mult = 0.0; }; FiringModifierResponse { @@ -654,10 +643,10 @@ pub fn year_1_perks() { 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 { + |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 { @@ -671,14 +660,14 @@ pub fn year_1_perks() { 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 { + |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 { + if input.value > 0 { out.insert(StatHashes::HANDLING.into(), handling); } out @@ -688,7 +677,7 @@ pub fn year_1_perks() { add_edr( Perks::ClusterBomb, - Box::new(|_input: ModifierResponseInput| -> ExtraDamageResponse { + Box::new(|_: ModifierResponseInput| -> ExtraDamageResponse { ExtraDamageResponse { additive_damage: 350.0 * 0.04, combatant_scale: true, @@ -705,11 +694,11 @@ pub fn year_1_perks() { 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 + 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 { damage_mult = 0.0; }; @@ -724,8 +713,8 @@ pub fn year_1_perks() { add_hmr( Perks::QuickDraw, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value > 0 { + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value > 0 { HandlingModifierResponse { draw_add: 100, draw_scale: 0.95, @@ -741,9 +730,9 @@ pub fn year_1_perks() { add_sbr( Perks::QuickDraw, 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 @@ -754,8 +743,8 @@ pub fn year_1_perks() { add_hmr( Perks::PulseMonitor, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value > 0 { + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value > 0 { HandlingModifierResponse { stat_add: 50, draw_scale: 0.95, @@ -772,9 +761,9 @@ pub fn year_1_perks() { add_sbr( Perks::PulseMonitor, 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(), 50); } map @@ -785,9 +774,9 @@ pub fn year_1_perks() { add_sbr( Perks::UnderDog, 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(), 100); } map @@ -797,8 +786,8 @@ pub fn year_1_perks() { add_rsmr( Perks::UnderDog, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - if _input.value > 0 { + Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + if input.value > 0 { ReloadModifierResponse { reload_stat_add: 100, reload_time_scale: 0.9, @@ -812,10 +801,10 @@ pub fn year_1_perks() { add_sbr( Perks::UnderPressure, Box::new( - |_input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut map = HashMap::new(); - let buff = if _input.is_enhanced { 35 } else { 30 }; - if _input.value > 0 { + let buff = if input.is_enhanced { 35 } else { 30 }; + if input.value > 0 { map.insert(StatHashes::STABILITY.into(), buff); } map @@ -824,7 +813,7 @@ pub fn year_1_perks() { ); add_fmr( Perks::PhaseMag, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { + Box::new(|_: ModifierResponseInput| -> FiringModifierResponse { FiringModifierResponse { burst_delay_add: 1.0 / 30.0, ..Default::default() @@ -834,7 +823,7 @@ pub fn year_1_perks() { add_dmr( Perks::PhaseMag, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { //set up precision smg to get damage values from let precision = Weapon::generate_weapon( 0, 24, //smg @@ -844,10 +833,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; diff --git a/src/perks/year_2_perks.rs b/src/perks/year_2_perks.rs index 1a81cd05..8a47b1e3 100644 --- a/src/perks/year_2_perks.rs +++ b/src/perks/year_2_perks.rs @@ -19,10 +19,10 @@ use super::{ pub fn year_2_perks() { add_sbr( Perks::AirAssault, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|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 }), @@ -30,8 +30,8 @@ pub fn year_2_perks() { add_fmr( Perks::ArchersTempo, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { - let delay = match (_input.value, _input.calc_data.intrinsic_hash) { + Box::new(|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, @@ -45,8 +45,8 @@ pub fn year_2_perks() { add_dmr( Perks::ExplosiveHead, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.pvp { + Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + if input.pvp { DamageModifierResponse::default() } else { DamageModifierResponse { @@ -61,10 +61,10 @@ pub fn year_2_perks() { add_epr( Perks::ExplosiveHead, Box::new( - |_input: ModifierResponseInput| -> ExplosivePercentResponse { + |input: ModifierResponseInput| -> ExplosivePercentResponse { ExplosivePercentResponse { percent: 0.5, - delyed: if _input.pvp { 0.0 } else { 0.2 }, + delyed: if input.pvp { 0.0 } else { 0.2 }, retain_base_total: true, } }, @@ -73,8 +73,8 @@ pub fn year_2_perks() { add_rsmr( Perks::FeedingFrenzy, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - let val = clamp(_input.value, 0, 5); + Box::new(|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 +94,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; }; @@ -107,9 +107,9 @@ pub fn year_2_perks() { add_sbr( Perks::FeedingFrenzy, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|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,7 +123,7 @@ 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); @@ -133,9 +133,9 @@ pub fn year_2_perks() { add_dmr( Perks::FiringLine, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { let mut crit_mult = 1.0; - if _input.value > 0 { + if input.value > 0 { crit_mult = 1.2; } DamageModifierResponse { @@ -148,7 +148,7 @@ pub fn year_2_perks() { add_rr( Perks::FourthTimesTheCharm, - Box::new(|_input: ModifierResponseInput| -> RefundResponse { + Box::new(|_: ModifierResponseInput| -> RefundResponse { RefundResponse { crit: true, requirement: 4, @@ -160,13 +160,13 @@ pub fn year_2_perks() { add_dmr( Perks::KillingTally, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let val = clamp(_input.value, 0, 3); + Box::new(|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 { @@ -180,12 +180,12 @@ pub fn year_2_perks() { 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 { + |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 { + if input.calc_data.total_shots_fired > 0.0 { mag_scale = 1.0; }; MagazineModifierResponse { @@ -199,7 +199,7 @@ pub fn year_2_perks() { add_rsmr( Perks::RapidHit, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { + Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { let values = [ (0, 1.0), (5, 0.99), @@ -209,7 +209,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, ); @@ -222,11 +222,11 @@ pub fn year_2_perks() { add_sbr( Perks::RapidHit, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|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, ); @@ -242,8 +242,8 @@ pub fn year_2_perks() { add_dmr( Perks::ResevoirBurst, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let damage_mult = if _input.calc_data.curr_mag >= _input.calc_data.base_mag { + Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + let damage_mult = if input.calc_data.curr_mag >= input.calc_data.base_mag { 1.25 } else { 1.0 @@ -258,15 +258,15 @@ pub fn year_2_perks() { add_dmr( Perks::Surrounded, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|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; }; }; @@ -280,9 +280,9 @@ pub fn year_2_perks() { add_dmr( Perks::FullCourt, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { let mut damage_mult = 1.0; - if _input.value > 0 { + if input.value > 0 { damage_mult = 1.25; }; DamageModifierResponse { @@ -295,11 +295,11 @@ pub fn year_2_perks() { 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 }; + Box::new(|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 { @@ -312,10 +312,10 @@ pub fn year_2_perks() { add_dmr( Perks::MultikillClip, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let val = clamp(_input.value, 0, 5); + Box::new(|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 { @@ -328,14 +328,14 @@ pub fn year_2_perks() { 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; + 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; 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), @@ -350,9 +350,9 @@ pub fn year_2_perks() { add_sbr( Perks::ExplosiveLight, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|input: ModifierResponseInput| -> HashMap { let mut out = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { out.insert(StatHashes::BLAST_RADIUS.into(), 100); }; out @@ -361,9 +361,9 @@ pub fn year_2_perks() { add_sbr( Perks::EyeOfTheStorm, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|input: ModifierResponseInput| -> HashMap { let mut out = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { out.insert(StatHashes::HANDLING.into(), 30); }; out @@ -373,8 +373,8 @@ pub fn year_2_perks() { add_hmr( Perks::EyeOfTheStorm, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value > 0 { + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value > 0 { HandlingModifierResponse { stat_add: 30, ..Default::default() @@ -388,8 +388,8 @@ pub fn year_2_perks() { add_flmr( Perks::NoDistractions, - Box::new(|_input: ModifierResponseInput| -> FlinchModifierResponse { - if _input.value > 0 { + Box::new(|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..9b012c8a 100644 --- a/src/perks/year_3_perks.rs +++ b/src/perks/year_3_perks.rs @@ -19,7 +19,7 @@ pub fn year_3_perks() { add_mmr( Perks::ClownCartridge, Box::new( - |_input: ModifierResponseInput| -> MagazineModifierResponse { + |_: ModifierResponseInput| -> MagazineModifierResponse { MagazineModifierResponse { magazine_add: 0.0, magazine_scale: 1.5, @@ -31,18 +31,18 @@ pub fn year_3_perks() { add_sbr( Perks::ElementalCapacitor, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|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 @@ -52,10 +52,10 @@ pub fn year_3_perks() { add_hmr( Perks::ElementalCapacitor, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { + |input: ModifierResponseInput| -> HandlingModifierResponse { let mut handling = 0; - if _input.value == 3 { - handling = if _input.is_enhanced { 55 } else { 50 }; + if input.value == 3 { + handling = if input.is_enhanced { 55 } else { 50 }; }; HandlingModifierResponse { stat_add: handling, @@ -67,10 +67,10 @@ pub fn year_3_perks() { add_rsmr( Perks::ElementalCapacitor, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { + Box::new(|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, @@ -81,9 +81,9 @@ pub fn year_3_perks() { add_sbr( Perks::KillingWind, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|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); }; @@ -93,8 +93,8 @@ pub fn year_3_perks() { add_rmr( Perks::KillingWind, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { - if _input.value > 0 { + Box::new(|input: ModifierResponseInput| -> RangeModifierResponse { + if input.value > 0 { RangeModifierResponse { range_stat_add: 20, range_all_scale: 1.05, @@ -115,8 +115,8 @@ pub fn year_3_perks() { add_hmr( Perks::KillingWind, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value > 0 { + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value > 0 { HandlingModifierResponse { stat_add: 40, ..Default::default() @@ -130,7 +130,7 @@ pub fn year_3_perks() { add_dmr( Perks::LastingImpression, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|_: ModifierResponseInput| -> DamageModifierResponse { DamageModifierResponse { impact_dmg_scale: 1.0, explosive_dmg_scale: 1.25, @@ -141,15 +141,15 @@ pub fn year_3_perks() { add_dmr( Perks::Vorpal, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|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, @@ -166,10 +166,10 @@ pub fn year_3_perks() { add_sbr( Perks::TrenchBarrel, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|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); @@ -181,12 +181,12 @@ pub fn year_3_perks() { add_hmr( Perks::TrenchBarrel, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value == 0 { + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value == 0 { return HandlingModifierResponse::default(); } HandlingModifierResponse { - stat_add: if _input.is_enhanced { 35 } else { 30 }, + stat_add: if input.is_enhanced { 35 } else { 30 }, ..Default::default() } }, @@ -196,12 +196,12 @@ pub fn year_3_perks() { //ready for when someone finds the reload information add_rsmr( Perks::TrenchBarrel, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - if _input.value == 0 { + Box::new(|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() } }), @@ -209,8 +209,8 @@ pub fn year_3_perks() { add_dmr( Perks::TrenchBarrel, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value > 0 { + Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + if input.value > 0 { return DamageModifierResponse { impact_dmg_scale: 1.5, explosive_dmg_scale: 1.5, diff --git a/src/perks/year_4_perks.rs b/src/perks/year_4_perks.rs index 8416e5f6..c4549ee3 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 }; + Box::new(|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 { @@ -37,10 +37,10 @@ pub fn year_4_perks() { add_fmr( Perks::Adagio, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { - let duration = if _input.is_enhanced { 8.0 } else { 7.0 }; + Box::new(|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 { @@ -54,10 +54,10 @@ pub fn year_4_perks() { add_sbr( Perks::Adagio, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|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 @@ -66,8 +66,8 @@ pub fn year_4_perks() { add_rmr( Perks::Adagio, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { - if _input.value == 0 { + Box::new(|input: ModifierResponseInput| -> RangeModifierResponse { + if input.value == 0 { return RangeModifierResponse::default(); } @@ -80,11 +80,11 @@ pub fn year_4_perks() { 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 }; + Box::new(|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 { @@ -97,10 +97,10 @@ pub fn year_4_perks() { add_sbr( Perks::AdrenalineJunkie, - Box::new(|_input: ModifierResponseInput| -> HashMap { - let duration = if _input.is_enhanced { 6.0 } else { 4.5 }; + Box::new(|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(); @@ -112,8 +112,8 @@ pub fn year_4_perks() { add_hmr( Perks::AdrenalineJunkie, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let handling = if _input.value > 0 { 20 } else { 0 }; + |input: ModifierResponseInput| -> HandlingModifierResponse { + let handling = if input.value > 0 { 20 } else { 0 }; HandlingModifierResponse { stat_add: handling, ..Default::default() @@ -124,9 +124,9 @@ pub fn year_4_perks() { add_fmr( Perks::Cornered, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { + Box::new(|input: ModifierResponseInput| -> FiringModifierResponse { let mut delay_mult = 1.0; - if _input.value > 0 { + if input.value > 0 { delay_mult = 0.85; }; FiringModifierResponse { @@ -140,10 +140,10 @@ pub fn year_4_perks() { 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 { + 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 { let mut out = HashMap::new(); out.insert(StatHashes::HANDLING.into(), handling); out.insert(StatHashes::RELOAD.into(), reload); @@ -157,9 +157,9 @@ pub fn year_4_perks() { add_hmr( Perks::Ensemble, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let handling = if _input.is_enhanced { 35 } else { 30 }; - if _input.value > 0 { + |input: ModifierResponseInput| -> HandlingModifierResponse { + let handling = if input.is_enhanced { 35 } else { 30 }; + if input.value > 0 { HandlingModifierResponse { stat_add: handling, ..Default::default() @@ -173,9 +173,9 @@ pub fn year_4_perks() { add_rsmr( Perks::Ensemble, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - let reload = if _input.is_enhanced { 45 } else { 40 }; - if _input.value > 0 { + Box::new(|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, @@ -191,12 +191,12 @@ pub fn year_4_perks() { add_rsmr( Perks::Frenzy, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { + Box::new(|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 { @@ -209,12 +209,12 @@ pub fn year_4_perks() { add_hmr( Perks::Frenzy, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { + |input: ModifierResponseInput| -> HandlingModifierResponse { let mut handling = 0; - if _input.value > 0 { + if input.value > 0 { handling = 100; }; - if _input.calc_data.time_total > 12.0 { + if input.calc_data.time_total > 12.0 { handling = 100; }; HandlingModifierResponse { @@ -227,12 +227,12 @@ pub fn year_4_perks() { add_dmr( Perks::Frenzy, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|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 { @@ -245,14 +245,14 @@ pub fn year_4_perks() { add_sbr( Perks::Frenzy, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|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; }; @@ -265,9 +265,9 @@ pub fn year_4_perks() { 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 { + 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 { 0.8 } else { 0.85 @@ -281,8 +281,8 @@ pub fn year_4_perks() { add_sbr( Perks::ImpulseAmplifier, - Box::new(|_input: ModifierResponseInput| -> HashMap { - let reload = if _input.is_enhanced { 25 } else { 20 }; + Box::new(|input: ModifierResponseInput| -> HashMap { + let reload = if input.is_enhanced { 25 } else { 20 }; let mut out = HashMap::new(); out.insert(StatHashes::RELOAD.into(), reload); out @@ -292,7 +292,7 @@ pub fn year_4_perks() { add_vmr( Perks::ImpulseAmplifier, Box::new( - |_input: ModifierResponseInput| -> VelocityModifierResponse { + |_: ModifierResponseInput| -> VelocityModifierResponse { VelocityModifierResponse { velocity_scaler: 1.35, } @@ -302,8 +302,8 @@ pub fn year_4_perks() { add_sbr( Perks::PerpetualMotion, - Box::new(|_input: ModifierResponseInput| -> HashMap { - let val = clamp(_input.value, 0, 2); + Box::new(|input: ModifierResponseInput| -> HashMap { + let val = clamp(input.value, 0, 2); let mut stat_bump = 0; if val == 1 { stat_bump = 10; @@ -321,8 +321,8 @@ pub fn year_4_perks() { add_hmr( Perks::PerpetualMotion, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let val = clamp(_input.value, 0, 2); + |input: ModifierResponseInput| -> HandlingModifierResponse { + let val = clamp(input.value, 0, 2); let mut stat_bump = 0; if val == 1 { stat_bump = 10; @@ -339,8 +339,8 @@ pub fn year_4_perks() { add_rsmr( Perks::PerpetualMotion, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - let val = clamp(_input.value, 0, 2); + Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + let val = clamp(input.value, 0, 2); let mut stat_bump = 0; if val == 1 { stat_bump = 10; @@ -356,9 +356,9 @@ pub fn year_4_perks() { add_sbr( Perks::PerfectFloat, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|input: ModifierResponseInput| -> HashMap { let mut out = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { out.insert(StatHashes::AIRBORNE.into(), 30); }; out @@ -367,17 +367,17 @@ pub fn year_4_perks() { add_flmr( Perks::PerfectFloat, - Box::new(|_input: ModifierResponseInput| -> FlinchModifierResponse { - let val = if _input.value > 0 { 0.65 } else { 1.0 }; + Box::new(|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 { + Box::new(|input: ModifierResponseInput| -> HashMap { let mut out = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { out.insert(StatHashes::HANDLING.into(), 35); }; out @@ -387,9 +387,9 @@ pub fn year_4_perks() { add_hmr( Perks::Pugilist, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { + |input: ModifierResponseInput| -> HandlingModifierResponse { let mut handling = 0; - if _input.value > 0 { + if input.value > 0 { handling = 35; }; HandlingModifierResponse { @@ -403,8 +403,8 @@ pub fn year_4_perks() { add_mmr( Perks::Reconstruction, Box::new( - |_input: ModifierResponseInput| -> MagazineModifierResponse { - let mag_scale = if _input.value > 0 { 2.0 } else { 1.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, @@ -416,9 +416,9 @@ pub fn year_4_perks() { add_sbr( Perks::DangerZone, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|input: ModifierResponseInput| -> HashMap { let mut out = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { out.insert(StatHashes::BLAST_RADIUS.into(), 100); }; out @@ -427,13 +427,13 @@ pub fn year_4_perks() { add_dmr( Perks::OneForAll, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|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 { @@ -446,9 +446,9 @@ pub fn year_4_perks() { add_sbr( Perks::FireFly, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|input: ModifierResponseInput| -> HashMap { let mut buffer: HashMap = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { buffer.insert(StatHashes::RELOAD.into(), 50); } buffer @@ -457,8 +457,8 @@ pub fn year_4_perks() { add_rsmr( Perks::FireFly, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - if _input.value > 0 { + Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + if input.value > 0 { ReloadModifierResponse { reload_stat_add: 50, reload_time_scale: 1.0, @@ -471,14 +471,14 @@ pub fn year_4_perks() { add_dmr( Perks::GoldenTricorn, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let val = clamp(_input.value, 0, 2); + Box::new(|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, @@ -492,10 +492,10 @@ pub fn year_4_perks() { 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 { + 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 { damage_mult = 0.0; }; DamageModifierResponse { @@ -509,8 +509,8 @@ pub fn year_4_perks() { add_hmr( Perks::Harmony, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let handling = if _input.value > 0 { 15 } else { 0 }; + |input: ModifierResponseInput| -> HandlingModifierResponse { + let handling = if input.value > 0 { 15 } else { 0 }; HandlingModifierResponse { stat_add: handling, ..Default::default() @@ -521,9 +521,9 @@ pub fn year_4_perks() { add_sbr( Perks::Harmony, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|input: ModifierResponseInput| -> HashMap { let mut out = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { out.insert(StatHashes::HANDLING.into(), 15); } out @@ -532,17 +532,17 @@ pub fn year_4_perks() { add_sbr( Perks::Surplus, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|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); @@ -554,12 +554,12 @@ pub fn year_4_perks() { add_hmr( Perks::Surplus, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let handling = if _input.value == 1 { + |input: ModifierResponseInput| -> HandlingModifierResponse { + let handling = if input.value == 1 { 10 - } else if _input.value == 2 { + } else if input.value == 2 { 25 - } else if _input.value == 3 { + } else if input.value == 3 { 50 } else { 0 @@ -574,12 +574,12 @@ pub fn year_4_perks() { add_rsmr( Perks::Surplus, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - let reload = if _input.value == 1 { + Box::new(|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 @@ -593,8 +593,8 @@ pub fn year_4_perks() { add_sbr( Perks::HeatingUp, - Box::new(|_input: ModifierResponseInput| -> HashMap { - let val = clamp(_input.value, 0, 2) as i32; + Box::new(|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); @@ -604,9 +604,9 @@ pub fn year_4_perks() { add_sbr( Perks::TunnelVision, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|input: ModifierResponseInput| -> HashMap { let mut out = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { out.insert(StatHashes::AIM_ASSIST.into(), 20); } out @@ -616,8 +616,8 @@ pub fn year_4_perks() { add_hmr( Perks::TunnelVision, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value > 0 { + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value > 0 { HandlingModifierResponse { ads_scale: 0.85, ..Default::default() @@ -631,10 +631,10 @@ pub fn year_4_perks() { add_dmr( Perks::KickStart, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|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(); } @@ -648,10 +648,10 @@ pub fn year_4_perks() { add_fmr( Perks::KickStart, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { - let mut fire_rate_mult = if _input.value > 0 { 0.20 } else { 0.0 }; + Box::new(|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 { @@ -663,17 +663,17 @@ pub fn year_4_perks() { add_dmr( Perks::Recombination, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|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, diff --git a/src/perks/year_5_perks.rs b/src/perks/year_5_perks.rs index 2841c549..a651a6bc 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 }; + Box::new(|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 { @@ -38,9 +38,9 @@ pub fn year_5_perks() { add_sbr( Perks::Encore, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|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); @@ -51,8 +51,8 @@ pub fn year_5_perks() { add_rmr( Perks::Encore, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { - let val = clamp(_input.value, 0, 4) as i32; + Box::new(|input: ModifierResponseInput| -> RangeModifierResponse { + let val = clamp(input.value, 0, 4) as i32; let range_boost = 5 * val; RangeModifierResponse { range_stat_add: range_boost, @@ -63,13 +63,13 @@ pub fn year_5_perks() { 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)) + Box::new(|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 { + if input.calc_data.total_shots_fired >= shots_needed || input.value > 0 { 1.2 } else { 1.0 @@ -84,8 +84,8 @@ pub fn year_5_perks() { add_rmr( Perks::FragileFocus, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { - let range_bonus = if _input.value > 0 { 20 } else { 0 }; + Box::new(|input: ModifierResponseInput| -> RangeModifierResponse { + let range_bonus = if input.value > 0 { 20 } else { 0 }; RangeModifierResponse { range_stat_add: range_bonus, range_all_scale: 1.0, @@ -97,10 +97,10 @@ pub fn year_5_perks() { add_sbr( Perks::FragileFocus, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|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); @@ -110,7 +110,7 @@ pub fn year_5_perks() { add_dmr( Perks::GutShot, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { let high_weapons = [ WeaponType::AUTORIFLE, WeaponType::HANDCANNON, @@ -119,14 +119,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 { @@ -139,10 +139,10 @@ pub fn year_5_perks() { add_sbr( Perks::OffhandStrike, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|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); @@ -152,9 +152,9 @@ pub fn year_5_perks() { add_rmr( Perks::OffhandStrike, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { + Box::new(|input: ModifierResponseInput| -> RangeModifierResponse { let mut range_hip_mult = 1.0; - if _input.value > 0 { + if input.value > 0 { range_hip_mult = 1.45; }; RangeModifierResponse { @@ -169,7 +169,7 @@ pub fn year_5_perks() { add_hmr( Perks::Slickdraw, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { + |_: ModifierResponseInput| -> HandlingModifierResponse { HandlingModifierResponse { stat_add: 100, stow_scale: 1.0, @@ -182,7 +182,7 @@ pub fn year_5_perks() { add_sbr( Perks::Slickdraw, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|_: ModifierResponseInput| -> HashMap { let mut map = HashMap::new(); map.insert(StatHashes::HANDLING.into(), 100); map @@ -191,13 +191,13 @@ pub fn year_5_perks() { add_sbr( Perks::StatsForAll, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|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; @@ -214,10 +214,10 @@ pub fn year_5_perks() { add_hmr( Perks::StatsForAll, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { + |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 { + 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 { @@ -230,10 +230,10 @@ pub fn year_5_perks() { add_rmr( Perks::StatsForAll, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { + Box::new(|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; }; @@ -248,11 +248,11 @@ pub fn year_5_perks() { add_rsmr( Perks::StatsForAll, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { + Box::new(|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; }; @@ -265,10 +265,10 @@ pub fn year_5_perks() { add_sbr( Perks::SteadyHands, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|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); @@ -279,11 +279,11 @@ pub fn year_5_perks() { add_hmr( Perks::SteadyHands, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { + |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 { + 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; }; @@ -299,21 +299,21 @@ pub fn year_5_perks() { add_dmr( Perks::TargetLock, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|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 { @@ -334,11 +334,11 @@ pub fn year_5_perks() { add_dmr( Perks::UnderOver, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|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; } } @@ -352,10 +352,10 @@ pub fn year_5_perks() { add_sbr( Perks::WellRounded, - Box::new(|_input: ModifierResponseInput| -> HashMap { - let val = clamp(_input.value, 0, 2) as i32; + Box::new(|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); @@ -367,11 +367,11 @@ pub fn year_5_perks() { add_hmr( Perks::WellRounded, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let val = clamp(_input.value, 0, 2) as i32; + |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 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, @@ -383,9 +383,9 @@ pub fn year_5_perks() { 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 }; + Box::new(|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, @@ -398,8 +398,8 @@ pub fn year_5_perks() { add_dmr( Perks::BaitAndSwitch, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value == 0 { + Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + if input.value == 0 { return DamageModifierResponse::default(); } DamageModifierResponse { @@ -412,10 +412,10 @@ pub fn year_5_perks() { 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 + 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 { ReloadModifierResponse { reload_stat_add: reload_add, @@ -429,11 +429,11 @@ pub fn year_5_perks() { add_sbr( Perks::CompulsiveReloader, - Box::new(|_input: ModifierResponseInput| -> HashMap { - let reload_add = if _input.is_enhanced { 55 } else { 50 }; + Box::new(|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); } @@ -443,8 +443,8 @@ pub fn year_5_perks() { add_sbr( Perks::SleightOfHand, - Box::new(|_input: ModifierResponseInput| -> HashMap { - let val = clamp(_input.value, 0, 3) as i32; + Box::new(|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; @@ -458,8 +458,8 @@ pub fn year_5_perks() { add_hmr( Perks::SleightOfHand, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - let val = clamp(_input.value, 0, 3) as i32; + |input: ModifierResponseInput| -> HandlingModifierResponse { + let val = clamp(input.value, 0, 3) as i32; let stat_base = 10; let handling = stat_base * val; HandlingModifierResponse { @@ -472,8 +472,8 @@ pub fn year_5_perks() { add_rsmr( Perks::SleightOfHand, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - let val = clamp(_input.value, 0, 3) as i32; + Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + let val = clamp(input.value, 0, 3) as i32; let stat_base = 10; let reload = stat_base * val; ReloadModifierResponse { @@ -486,10 +486,10 @@ pub fn year_5_perks() { add_hmr( Perks::ShotSwap, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { + |input: ModifierResponseInput| -> HandlingModifierResponse { let mut handling_mult = 1.0; let mut handling = 0; - if _input.value > 0 { + if input.value > 0 { handling_mult = 0.95; handling = 100; }; @@ -506,9 +506,9 @@ pub fn year_5_perks() { add_sbr( Perks::ShotSwap, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|input: ModifierResponseInput| -> HashMap { let mut map = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { map.insert(StatHashes::HANDLING.into(), 100); } map @@ -517,8 +517,8 @@ pub fn year_5_perks() { add_fmr( Perks::SuccesfulWarmup, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { - if _input.value == 0 { + Box::new(|input: ModifierResponseInput| -> FiringModifierResponse { + if input.value == 0 { return FiringModifierResponse::default(); } FiringModifierResponse { @@ -529,8 +529,8 @@ pub fn year_5_perks() { ); add_dmr( Perks::UnstoppableForce, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let scalar = if _input.value >= 1 { 1.20 } else { 1.0 }; + Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + let scalar = if input.value >= 1 { 1.20 } else { 1.0 }; DamageModifierResponse { impact_dmg_scale: scalar, explosive_dmg_scale: scalar, diff --git a/src/perks/year_6_perks.rs b/src/perks/year_6_perks.rs index 193b26cd..b014a1e6 100644 --- a/src/perks/year_6_perks.rs +++ b/src/perks/year_6_perks.rs @@ -17,12 +17,12 @@ use super::{ pub fn year_6_perks() { add_sbr( Perks::KeepAway, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|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; }; @@ -34,9 +34,9 @@ pub fn year_6_perks() { 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 }; + 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 }; RangeModifierResponse { range_stat_add: range_bonus, ..Default::default() @@ -46,9 +46,9 @@ pub fn year_6_perks() { 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 }; + 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 }; ReloadModifierResponse { reload_stat_add: reload_bonus, ..Default::default() @@ -58,21 +58,21 @@ pub fn year_6_perks() { add_sbr( Perks::FieldTested, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|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); } @@ -83,8 +83,8 @@ pub fn year_6_perks() { // 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 { + Box::new(|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; @@ -119,17 +119,17 @@ pub fn year_6_perks() { add_rmr( Perks::FieldTested, - Box::new(|_input: ModifierResponseInput| -> RangeModifierResponse { + Box::new(|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; @@ -143,8 +143,8 @@ pub fn year_6_perks() { add_dmr( Perks::ParacausalAffinity, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value > 0 { + Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + if input.value > 0 { DamageModifierResponse { explosive_dmg_scale: 1.2, impact_dmg_scale: 1.2, @@ -159,8 +159,8 @@ pub fn year_6_perks() { add_mmr( Perks::EnviousAssassin, Box::new( - |_input: ModifierResponseInput| -> MagazineModifierResponse { - let val = _input.value as f64; + |input: ModifierResponseInput| -> MagazineModifierResponse { + let val = input.value as f64; MagazineModifierResponse { magazine_scale: 1.0 + clamp(0.1 * val, 0.0, 2.0), ..Default::default() @@ -171,8 +171,8 @@ pub fn year_6_perks() { add_dmr( Perks::CollectiveAction, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let buff = match (_input.pvp, _input.value) { + Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + let buff = match (input.pvp, input.value) { (_, 0) => 1.0, (true, 1..) => 1.1, (false, 1..) => 1.2, @@ -187,7 +187,7 @@ pub fn year_6_perks() { add_dmr( Perks::Bipod, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { + Box::new(|_: ModifierResponseInput| -> DamageModifierResponse { DamageModifierResponse { impact_dmg_scale: 0.75, explosive_dmg_scale: 0.75, @@ -199,7 +199,7 @@ pub fn year_6_perks() { add_mmr( Perks::Bipod, Box::new( - |_input: ModifierResponseInput| -> MagazineModifierResponse { + |_: ModifierResponseInput| -> MagazineModifierResponse { MagazineModifierResponse { magazine_scale: 2.0, ..Default::default() @@ -211,7 +211,7 @@ pub fn year_6_perks() { add_imr( Perks::Bipod, Box::new( - |_input: ModifierResponseInput| -> InventoryModifierResponse { + |_: ModifierResponseInput| -> InventoryModifierResponse { InventoryModifierResponse { inv_add: 5, ..Default::default() @@ -222,7 +222,7 @@ pub fn year_6_perks() { add_fmr( Perks::Bipod, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { + Box::new(|_: ModifierResponseInput| -> FiringModifierResponse { FiringModifierResponse { burst_delay_scale: 0.75, ..Default::default() @@ -232,8 +232,8 @@ pub fn year_6_perks() { add_fmr( Perks::ControlledBurst, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { - if _input.value > 0 { + Box::new(|input: ModifierResponseInput| -> FiringModifierResponse { + if input.value > 0 { return FiringModifierResponse { burst_delay_scale: 0.9, ..Default::default() @@ -244,8 +244,8 @@ pub fn year_6_perks() { ); add_dmr( Perks::ControlledBurst, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value > 0 { + Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + if input.value > 0 { return DamageModifierResponse { impact_dmg_scale: 1.2, explosive_dmg_scale: 1.2, @@ -257,9 +257,9 @@ pub fn year_6_perks() { ); add_sbr( Perks::InvisibleHand, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|input: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { stats.insert(StatHashes::STABILITY.into(), 25); } stats @@ -267,9 +267,9 @@ pub fn year_6_perks() { ); add_sbr( Perks::UnsatedHunger, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|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); @@ -280,8 +280,8 @@ pub fn year_6_perks() { add_rsmr( Perks::UnsatedHunger, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - if _input.value > 0 { + Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + if input.value > 0 { return ReloadModifierResponse { reload_stat_add: 60, ..Default::default() @@ -293,8 +293,8 @@ pub fn year_6_perks() { add_hmr( Perks::UnsatedHunger, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value > 0 { + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value > 0 { return HandlingModifierResponse { stat_add: 60, ..Default::default() @@ -308,8 +308,8 @@ pub fn year_6_perks() { add_hmr( Perks::Discord, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value > 0 { + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value > 0 { return HandlingModifierResponse { ads_scale: 0.75, ..Default::default() @@ -322,9 +322,9 @@ pub fn year_6_perks() { add_sbr( Perks::Discord, - Box::new(|_input: ModifierResponseInput| -> HashMap { + Box::new(|input: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); - if _input.value > 0 { + if input.value > 0 { stats.insert(StatHashes::AIRBORNE.into(), 30); } stats @@ -333,12 +333,12 @@ pub fn year_6_perks() { add_dmr( Perks::PrecisionInstrument, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let max_percent = if _input.is_enhanced { 0.30 } else { 0.25 }; + Box::new(|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, @@ -349,8 +349,8 @@ pub fn year_6_perks() { add_rsmr( Perks::LooseChange, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - if _input.value == 0 { + Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + if input.value == 0 { return ReloadModifierResponse::default(); } ReloadModifierResponse { @@ -363,8 +363,8 @@ pub fn year_6_perks() { add_sbr( Perks::LooseChange, Box::new( - |_input: ModifierResponseInput| -> HashMap { - if _input.value == 0 { + |input: ModifierResponseInput| -> HashMap { + if input.value == 0 { return HashMap::new(); } HashMap::from([ @@ -377,11 +377,11 @@ pub fn year_6_perks() { add_dmr( Perks::HighGround, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value == 0 { + Box::new(|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, @@ -393,8 +393,8 @@ pub fn year_6_perks() { add_sbr( Perks::HeadRush, Box::new( - |_input: ModifierResponseInput| -> HashMap { - if _input.value == 0 { + |input: ModifierResponseInput| -> HashMap { + if input.value == 0 { return HashMap::new(); } HashMap::from([ @@ -407,8 +407,8 @@ pub fn year_6_perks() { add_hmr( Perks::HeadRush, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value == 0 { + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value == 0 { return HandlingModifierResponse::default(); } //unknown at time @@ -420,8 +420,8 @@ pub fn year_6_perks() { ); add_rsmr( Perks::HeadRush, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - if _input.value == 0 { + Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + if input.value == 0 { return ReloadModifierResponse::default(); } ReloadModifierResponse { @@ -433,9 +433,9 @@ pub fn year_6_perks() { 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; + |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; @@ -450,9 +450,9 @@ pub fn year_6_perks() { 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; + |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; @@ -466,9 +466,9 @@ pub fn year_6_perks() { ); 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; + Box::new(|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; @@ -481,10 +481,10 @@ pub fn year_6_perks() { ); add_dmr( Perks::SwordLogic, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let buff = match (_input.pvp, _input.value) { + Box::new(|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, @@ -498,8 +498,8 @@ pub fn year_6_perks() { ); add_sbr( Perks::NobleDeeds, - Box::new(|_input: ModifierResponseInput| -> HashMap { - if _input.value == 0 { + Box::new(|input: ModifierResponseInput| -> HashMap { + if input.value == 0 { return HashMap::new(); } HashMap::from([ @@ -510,8 +510,8 @@ pub fn year_6_perks() { ); add_rsmr( Perks::NobleDeeds, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - if _input.value == 0 { + Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + if input.value == 0 { return ReloadModifierResponse::default(); } ReloadModifierResponse { @@ -523,8 +523,8 @@ pub fn year_6_perks() { add_hmr( Perks::NobleDeeds, Box::new( - |_input: ModifierResponseInput| -> HandlingModifierResponse { - if _input.value == 0 { + |input: ModifierResponseInput| -> HandlingModifierResponse { + if input.value == 0 { return HandlingModifierResponse::default(); } HandlingModifierResponse { @@ -536,8 +536,8 @@ pub fn year_6_perks() { ); add_fmr( Perks::Onslaught, - Box::new(|_input: ModifierResponseInput| -> FiringModifierResponse { - let buff = match _input.value { + Box::new(|input: ModifierResponseInput| -> FiringModifierResponse { + let buff = match input.value { 0 => 1.0, 1 => 0.84, 2 => 0.72, @@ -552,8 +552,8 @@ pub fn year_6_perks() { ); add_rsmr( Perks::Onslaught, - Box::new(|_input: ModifierResponseInput| -> ReloadModifierResponse { - let buff = match _input.value { + Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + let buff = match input.value { 0 => 0, 1 => 15, 2 => 25, @@ -568,8 +568,8 @@ pub fn year_6_perks() { ); add_sbr( Perks::Onslaught, - Box::new(|_input: ModifierResponseInput| -> HashMap { - let buff = match _input.value { + Box::new(|input: ModifierResponseInput| -> HashMap { + let buff = match input.value { 0 => 0, 1 => 15, 2 => 25, @@ -581,8 +581,8 @@ pub fn year_6_perks() { ); add_dmr( Perks::Sever, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let debuff = if _input.pvp { 0.85 } else { 1.0 }; + Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + let debuff = if input.pvp { 0.85 } else { 1.0 }; DamageModifierResponse { impact_dmg_scale: debuff, explosive_dmg_scale: debuff, @@ -592,8 +592,8 @@ pub fn year_6_perks() { ); add_dmr( Perks::DesperateMeasures, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - let buff = _input.value.clamp(0, 3) as f64 * 0.1 + 1.0; + Box::new(|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, @@ -603,8 +603,8 @@ pub fn year_6_perks() { ); add_dmr( Perks::MasterOfArms, - Box::new(|_input: ModifierResponseInput| -> DamageModifierResponse { - if _input.value == 0 { + Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + if input.value == 0 { return DamageModifierResponse::default(); } DamageModifierResponse { 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..1e54529e 100644 --- a/src/weapons/reserve_calc.rs +++ b/src/weapons/reserve_calc.rs @@ -60,7 +60,7 @@ enum ReserveIDs { Truth, TwoTailedFox, Winterbite, - WhisperOfTheWorm + WhisperOfTheWorm, } impl From for ReserveIDs { fn from(id: u32) -> Self { @@ -203,8 +203,7 @@ pub fn calc_reserves(_mag_size: f64, _mag_stat: i32, _inv_stat: i32, _id: u32, _ 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::WhisperOfTheWorm => whisper_of_the_worm(_mag_size, _mag_stat, _inv_stat), //placeholders }; let size = raw_size * _scale; size.ceil() as i32 diff --git a/src/weapons/stat_calc.rs b/src/weapons/stat_calc.rs index fdf96f10..0574eeaa 100644 --- a/src/weapons/stat_calc.rs +++ b/src/weapons/stat_calc.rs @@ -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 { diff --git a/src/weapons/ttk_calc.rs b/src/weapons/ttk_calc.rs index 5af59010..8460df1b 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,12 @@ 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; + 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.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 +116,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 +197,39 @@ 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; + 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.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 +240,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 +292,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, }, ), ( From 7b4e4aef4b01944386af1f8a54ac555b408949da Mon Sep 17 00:00:00 2001 From: oh-yes-0-fps Date: Sun, 21 Apr 2024 23:53:31 -0400 Subject: [PATCH 2/7] removed boxed perks --- src/lib.rs | 20 +- src/perks/buff_perks.rs | 104 +++--- src/perks/exotic_armor.rs | 557 ++++++++++++++---------------- src/perks/exotic_perks.rs | 334 +++++++++--------- src/perks/meta_perks.rs | 176 +++++----- src/perks/mod.rs | 2 +- src/perks/origin_perks.rs | 236 ++++++------- src/perks/other_perks.rs | 220 ++++++------ src/perks/year_1_perks.rs | 704 ++++++++++++++++++-------------------- src/perks/year_2_perks.rs | 142 ++++---- src/perks/year_3_perks.rs | 114 +++--- src/perks/year_4_perks.rs | 346 +++++++++---------- src/perks/year_5_perks.rs | 266 +++++++------- src/perks/year_6_perks.rs | 334 +++++++++--------- src/weapons/ttk_calc.rs | 6 +- 15 files changed, 1669 insertions(+), 1892 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index b19d5586..ee22148d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -31,7 +31,8 @@ use lol_alloc::{AssumeSingleThreaded, FreeListAllocator}; // SAFETY: This application is single threaded, so using AssumeSingleThreaded is allowed. #[cfg(target_arch = "wasm32")] #[global_allocator] -static ALLOCATOR: AssumeSingleThreaded = unsafe { AssumeSingleThreaded::new(FreeListAllocator::new()) }; +static ALLOCATOR: AssumeSingleThreaded = + unsafe { AssumeSingleThreaded::new(FreeListAllocator::new()) }; mod built_info { include!(concat!(env!("OUT_DIR"), "/built.rs")); @@ -237,10 +238,7 @@ pub fn get_weapon_range(dynamic_traits: bool, pvp: bool) -> Result 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 { Ok(weapon @@ -328,11 +326,7 @@ 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 { Ok(weapon.calc_flinch_resist( @@ -409,10 +403,8 @@ pub fn get_scalar_response(pvp: bool) -> Result { 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 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, diff --git a/src/perks/buff_perks.rs b/src/perks/buff_perks.rs index 0329d3ee..32a34ab3 100644 --- a/src/perks/buff_perks.rs +++ b/src/perks/buff_perks.rs @@ -62,19 +62,19 @@ fn gbl_debuff(_cached_data: &mut HashMap, _desired_buff: f64) -> f6 pub fn buff_perks() { add_dmr( Perks::WellOfRadiance, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |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 { + |input: ModifierResponseInput| -> DamageModifierResponse { if input.value == 0 { return DamageModifierResponse::default(); } @@ -85,12 +85,12 @@ pub fn buff_perks() { explosive_dmg_scale: buff, ..Default::default() } - }), + }, ); add_dmr( Perks::Radiant, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |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); @@ -99,12 +99,12 @@ pub fn buff_perks() { explosive_dmg_scale: buff, ..Default::default() } - }), + }, ); add_dmr( Perks::PathOfTheBurningSteps, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { if input.value == 0 || input.calc_data.damage_type != &DamageType::SOLAR { return DamageModifierResponse::default(); } @@ -114,12 +114,12 @@ pub fn buff_perks() { explosive_dmg_scale: buff, ..Default::default() } - }), + }, ); add_dmr( Perks::BannerShield, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let des_buff = if input.pvp { 1.35 } else { 1.4 }; let buff = emp_buff(input.cached_data, des_buff); DamageModifierResponse { @@ -127,12 +127,12 @@ pub fn buff_perks() { explosive_dmg_scale: buff, ..Default::default() } - }), + }, ); add_dmr( Perks::EmpRift, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let des_buff = if input.pvp { 1.15 } else { 1.2 }; let buff = emp_buff(input.cached_data, des_buff); DamageModifierResponse { @@ -140,24 +140,24 @@ pub fn buff_perks() { explosive_dmg_scale: buff, ..Default::default() } - }), + }, ); add_dmr( Perks::WardOfDawn, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |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 { + |input: ModifierResponseInput| -> DamageModifierResponse { let des_buff = if input.pvp { 1.0 } else { 1.35 }; let buff = emp_buff(input.cached_data, des_buff); DamageModifierResponse { @@ -165,12 +165,12 @@ pub fn buff_perks() { explosive_dmg_scale: buff, ..Default::default() } - }), + }, ); add_dmr( Perks::AeonInsight, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |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); @@ -182,12 +182,12 @@ 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 { 1.0 @@ -200,12 +200,12 @@ pub fn buff_perks() { explosive_dmg_scale: buff, ..Default::default() } - }), + }, ); add_dmr( Perks::WormByproduct, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { if input.value > 0 { DamageModifierResponse { impact_dmg_scale: 1.15, @@ -215,7 +215,7 @@ pub fn buff_perks() { } else { DamageModifierResponse::default() } - }), + }, ); // @@ -224,7 +224,7 @@ pub fn buff_perks() { add_dmr( Perks::Weaken, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let des_debuff = if input.pvp { 1.075 } else { 1.15 }; let debuff = gbl_debuff(input.cached_data, des_debuff); DamageModifierResponse { @@ -232,12 +232,12 @@ pub fn buff_perks() { explosive_dmg_scale: debuff, ..Default::default() } - }), + }, ); add_dmr( Perks::TractorCannon, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let des_debuff = if input.pvp { 1.5 } else { 1.3 }; let debuff = gbl_debuff(input.cached_data, des_debuff); DamageModifierResponse { @@ -245,12 +245,12 @@ pub fn buff_perks() { explosive_dmg_scale: debuff, ..Default::default() } - }), + }, ); add_dmr( Perks::MoebiusQuiver, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let des_debuff = if input.pvp { 1.5 } else { 1.3 }; let debuff = gbl_debuff(input.cached_data, des_debuff); DamageModifierResponse { @@ -258,11 +258,11 @@ pub fn buff_perks() { explosive_dmg_scale: debuff, ..Default::default() } - }), + }, ); add_dmr( Perks::DeadFall, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let des_debuff = if input.pvp { 1.5 } else { 1.3 }; let debuff = gbl_debuff(input.cached_data, des_debuff); DamageModifierResponse { @@ -270,11 +270,11 @@ pub fn buff_perks() { explosive_dmg_scale: debuff, ..Default::default() } - }), + }, ); add_dmr( Perks::Felwinters, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { if input.value > 0 { let debuff = gbl_debuff(input.cached_data, 1.3); DamageModifierResponse { @@ -285,12 +285,12 @@ 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 { 1.0 @@ -303,22 +303,22 @@ pub fn buff_perks() { explosive_dmg_scale: debuff, ..Default::default() } - }), + }, ); add_dmr( Perks::SurgeMod, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |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 { + |input: ModifierResponseInput| -> HashMap { if input.calc_data.weapon_type != &WeaponType::SWORD { return HashMap::new(); } @@ -329,23 +329,23 @@ pub fn buff_perks() { 3.. => 60, }; HashMap::from([(StatHashes::CHARGE_RATE.into(), stat_bump)]) - }), + }, ); add_dmr( Perks::EternalWarrior, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |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 { + |input: ModifierResponseInput| -> DamageModifierResponse { let buff = if input.value > 0 { surge_buff(input.cached_data, 4, input.pvp) } else { @@ -356,11 +356,11 @@ pub fn buff_perks() { explosive_dmg_scale: buff, ..Default::default() } - }), + }, ); add_dmr( Perks::MaskOfBakris, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let buff = if input.value > 0 && matches!( input.calc_data.damage_type, @@ -375,11 +375,11 @@ pub fn buff_perks() { explosive_dmg_scale: buff, ..Default::default() } - }), + }, ); add_dmr( Perks::SanguineAlchemy, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { if input.value == 0 || *input.calc_data.damage_type == DamageType::KINETIC { return DamageModifierResponse::default(); } @@ -391,11 +391,11 @@ pub fn buff_perks() { explosive_dmg_scale: buff, ..Default::default() } - }), + }, ); add_dmr( Perks::Foetracers, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { if input.value == 0 { return DamageModifierResponse::default(); } @@ -405,11 +405,11 @@ pub fn buff_perks() { explosive_dmg_scale: mult, ..Default::default() } - }), + }, ); add_dmr( Perks::GlacialGuard, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { if input.value == 0 { return DamageModifierResponse::default(); } @@ -419,11 +419,11 @@ pub fn buff_perks() { explosive_dmg_scale: mult, ..Default::default() } - }), + }, ); add_dmr( Perks::NoBackupPlans, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { if *input.calc_data.weapon_type != WeaponType::SHOTGUN || input.value == 0 { return DamageModifierResponse::default(); } @@ -434,6 +434,6 @@ pub fn buff_perks() { explosive_dmg_scale: buff, ..Default::default() } - }), + }, ); } diff --git a/src/perks/exotic_armor.rs b/src/perks/exotic_armor.rs index 62633085..014dc6ad 100644 --- a/src/perks/exotic_armor.rs +++ b/src/perks/exotic_armor.rs @@ -19,7 +19,7 @@ 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 { @@ -27,13 +27,13 @@ pub fn exotic_armor() { modifier.explosive_dmg_scale = value; } modifier - }), + }, ); //doesnt work for sturm overcharge, (maybe) memento add_dmr( Perks::LuckyPants, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let perks = input.calc_data.perk_value_map.clone(); let perk_check = @@ -57,45 +57,41 @@ pub fn exotic_armor() { 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 { + |input: ModifierResponseInput| -> FlinchModifierResponse { if input.value > 0 { FlinchModifierResponse { flinch_scale: 0.80 } } else { FlinchModifierResponse::default() } - }), + }, ); add_sbr( Perks::KnuckleheadRadar, - Box::new( - |_: 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 { + |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(); @@ -106,44 +102,40 @@ 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 { + |input: ModifierResponseInput| -> ReloadModifierResponse { if input.calc_data.weapon_type == &WeaponType::SIDEARM { ReloadModifierResponse { reload_stat_add: 100, @@ -152,12 +144,12 @@ pub fn exotic_armor() { } else { ReloadModifierResponse::default() } - }), + }, ); add_dmr( Perks::MechaneersTricksleeves, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { if input.value == 0 || *input.calc_data.weapon_type != WeaponType::SIDEARM { return DamageModifierResponse::default(); }; @@ -168,48 +160,43 @@ pub fn exotic_armor() { 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,258 +204,224 @@ 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( - |_: 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( - |_: ModifierResponseInput| -> HashMap { - HashMap::from([(StatHashes::AIRBORNE.into(), 20)]) - }, - ), + |_: ModifierResponseInput| -> HashMap { + HashMap::from([(StatHashes::AIRBORNE.into(), 20)]) + }, ); add_sbr( Perks::EyeOfAnotherWorld, - Box::new( - |_: 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 { + |input: ModifierResponseInput| -> ReloadModifierResponse { let modifiers = match input.value { 0 => (0, 1.0), 1 => (40, 1.0), @@ -483,25 +436,23 @@ 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 { + |input: ModifierResponseInput| -> ReloadModifierResponse { if input.value >= 1 { ReloadModifierResponse { reload_stat_add: 100, @@ -510,12 +461,12 @@ pub fn exotic_armor() { } else { ReloadModifierResponse::default() } - }), + }, ); add_rmr( Perks::LunaFaction, - Box::new(|input: ModifierResponseInput| -> RangeModifierResponse { + |input: ModifierResponseInput| -> RangeModifierResponse { if input.value >= 2 { return RangeModifierResponse { range_all_scale: 2.0, @@ -523,86 +474,82 @@ pub fn exotic_armor() { }; } 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 { stats.insert(StatHashes::RELOAD.into(), 50); } stats - }), + }, ); add_hmr( Perks::OphidianAspect, - Box::new( - |_: ModifierResponseInput| -> HandlingModifierResponse { - HandlingModifierResponse { - stat_add: 35, - ..Default::default() - } - }, - ), + |_: ModifierResponseInput| -> HandlingModifierResponse { + HandlingModifierResponse { + stat_add: 35, + ..Default::default() + } + }, ); add_rsmr( Perks::OphidianAspect, - Box::new(|_: ModifierResponseInput| -> ReloadModifierResponse { + |_: ModifierResponseInput| -> ReloadModifierResponse { ReloadModifierResponse { reload_stat_add: 35, reload_time_scale: 1.0, } - }), + }, ); add_sbr( Perks::OphidianAspect, - Box::new(|_: ModifierResponseInput| -> HashMap { + |_: 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 { + |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() + |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 { + |input: ModifierResponseInput| -> ReloadModifierResponse { if input.value >= 1 { ReloadModifierResponse { reload_stat_add: 100, @@ -611,6 +558,6 @@ pub fn exotic_armor() { } else { ReloadModifierResponse::default() } - }), + }, ); } diff --git a/src/perks/exotic_perks.rs b/src/perks/exotic_perks.rs index b36786ab..287dbeb8 100644 --- a/src/perks/exotic_perks.rs +++ b/src/perks/exotic_perks.rs @@ -19,7 +19,7 @@ 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; @@ -46,12 +46,12 @@ 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 buff_val = (clamp(inter_val, 0, 7) * 5) as i32; @@ -59,59 +59,59 @@ pub fn exotic_perks() { out.insert(StatHashes::RANGE.into(), buff_val); out.insert(StatHashes::HANDLING.into(), buff_val); out - }), + }, ); add_rsmr( Perks::HuntersTrance, - Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + |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 { + |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 { + |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 { + |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 }; @@ -121,12 +121,12 @@ pub fn exotic_perks() { explosive_dmg_scale: damage_buff, crit_scale: 1.0, } - }), + }, ); add_rmr( Perks::MementoMori, - Box::new(|input: ModifierResponseInput| -> RangeModifierResponse { + |input: ModifierResponseInput| -> RangeModifierResponse { let range_all_scale = if input.value > 0 && input.calc_data.total_shots_fired < 7.0 { 0.85 } else { @@ -136,24 +136,24 @@ 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 { 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 { crit_mult = 1.17; @@ -163,12 +163,12 @@ 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 { delay_mult = 0.583; @@ -179,12 +179,12 @@ 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 { range_scale = 1.15; //roughly @@ -195,12 +195,12 @@ 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 { reload = 40; @@ -209,12 +209,12 @@ pub fn exotic_perks() { 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 { delay_mult = 0.75; @@ -228,12 +228,12 @@ pub fn exotic_perks() { inner_burst_scale: 1.0, burst_size_add: 0.0, } - }), + }, ); add_edr( Perks::ReignHavoc, - Box::new(|input: ModifierResponseInput| -> ExtraDamageResponse { + |input: ModifierResponseInput| -> ExtraDamageResponse { let dmg = if input.pvp { 65.0 } else { 65.0 * 1.3 }; ExtraDamageResponse { additive_damage: dmg, @@ -246,24 +246,24 @@ pub fn exotic_perks() { crit_scale: false, combatant_scale: true, } - }), + }, ); add_dmr( Perks::WormsHunger, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |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 { damage_buff = 1.4; @@ -273,12 +273,12 @@ 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 }; @@ -288,12 +288,12 @@ pub fn exotic_perks() { 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 { 1 @@ -304,12 +304,12 @@ pub fn exotic_perks() { crit: false, requirement: 1, } - }), + }, ); add_edr( Perks::RocketTracers, - Box::new(|input: ModifierResponseInput| -> ExtraDamageResponse { + |input: ModifierResponseInput| -> ExtraDamageResponse { let dmg = if input.pvp { 24.0 } else { 105.0 }; ExtraDamageResponse { additive_damage: dmg, @@ -322,34 +322,34 @@ pub fn exotic_perks() { crit_scale: false, combatant_scale: true, } - }), + }, ); add_fmr( Perks::HakkeHeavyBurst, - Box::new(|_: ModifierResponseInput| -> FiringModifierResponse { + |_: ModifierResponseInput| -> FiringModifierResponse { FiringModifierResponse { burst_size_add: -2.0, ..Default::default() } - }), + }, ); add_dmr( Perks::HakkeHeavyBurst, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |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 { dmg_mult = 1.4; @@ -361,11 +361,11 @@ pub fn exotic_perks() { 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 }; @@ -375,12 +375,12 @@ pub fn exotic_perks() { explosive_dmg_scale: dmg_mult, crit_scale: 1.0, } - }), + }, ); add_dmr( Perks::CalculatedBalance, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |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 { @@ -391,12 +391,12 @@ pub fn exotic_perks() { explosive_dmg_scale: 1.0 + damage_mult, crit_scale: 1.0, } - }), + }, ); add_fmr( Perks::RavenousBeast, - Box::new(|input: ModifierResponseInput| -> FiringModifierResponse { + |input: ModifierResponseInput| -> FiringModifierResponse { if input.value > 0 { FiringModifierResponse { burst_delay_scale: 0.8, @@ -405,12 +405,12 @@ 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 { @@ -426,12 +426,12 @@ pub fn exotic_perks() { explosive_dmg_scale: damage_mult, crit_scale: crit_mult, } - }), + }, ); add_sbr( Perks::ReleaseTheWolves, - Box::new(|input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let has_cat = input.calc_data.perk_value_map.contains_key(&431220296); let mut out = HashMap::new(); if has_cat { @@ -442,12 +442,12 @@ pub fn exotic_perks() { } } out - }), + }, ); add_rsmr( Perks::ReleaseTheWolves, - Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + |input: ModifierResponseInput| -> ReloadModifierResponse { let has_cat = input.calc_data.perk_value_map.contains_key(&431220296); if input.value == 1 && has_cat { ReloadModifierResponse { @@ -457,12 +457,12 @@ pub fn exotic_perks() { } else { ReloadModifierResponse::default() } - }), + }, ); add_fmr( Perks::ReleaseTheWolves, - Box::new(|input: ModifierResponseInput| -> FiringModifierResponse { + |input: ModifierResponseInput| -> FiringModifierResponse { if input.value > 0 { FiringModifierResponse { burst_delay_scale: 0.4, @@ -471,24 +471,24 @@ pub fn exotic_perks() { } else { FiringModifierResponse::default() } - }), + }, ); add_dmr( Perks::ReleaseTheWolves, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |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 { stats.insert(StatHashes::STABILITY.into(), 20); @@ -501,12 +501,12 @@ pub fn exotic_perks() { stats.insert(StatHashes::HANDLING.into(), 25); }; stats - }), + }, ); add_hmr( Perks::Fundamentals, - Box::new(|input: ModifierResponseInput| -> HandlingModifierResponse { + |input: ModifierResponseInput| -> HandlingModifierResponse { let mut handling = 0; if input.value == 3 { handling = 25; @@ -515,12 +515,12 @@ pub fn exotic_perks() { 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 { reload = 35; @@ -529,12 +529,12 @@ pub fn exotic_perks() { 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 { range = 5; @@ -543,23 +543,23 @@ pub fn exotic_perks() { 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 { out.insert(StatHashes::RELOAD.into(), 70); } out - }), + }, ); add_rsmr( Perks::ThinTheHerd, - Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + |input: ModifierResponseInput| -> ReloadModifierResponse { if input.value > 0 { ReloadModifierResponse { reload_stat_add: 70, @@ -568,12 +568,12 @@ pub fn exotic_perks() { } else { ReloadModifierResponse::default() } - }), + }, ); add_hmr( Perks::Chimera, - Box::new(|input: ModifierResponseInput| -> HandlingModifierResponse { + |input: ModifierResponseInput| -> HandlingModifierResponse { if input.value > 0 { HandlingModifierResponse { stat_add: 100, @@ -582,23 +582,23 @@ pub fn exotic_perks() { } else { HandlingModifierResponse::default() } - }), + }, ); add_sbr( Perks::Chimera, - Box::new(|input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let mut out = HashMap::new(); 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 { @@ -613,12 +613,12 @@ 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 { @@ -631,12 +631,12 @@ 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 { @@ -653,12 +653,12 @@ pub fn exotic_perks() { 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 { damage_mult = 1.25; @@ -670,12 +670,12 @@ pub fn exotic_perks() { impact_dmg_scale: damage_mult, crit_scale: 1.0, } - }), + }, ); add_dmr( Perks::MarkovChain, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |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 { @@ -683,12 +683,12 @@ pub fn exotic_perks() { impact_dmg_scale: 1.0 + damage_mult, crit_scale: 1.0, } - }), + }, ); add_dmr( Perks::StringofCurses, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let val = clamp(input.value, 0, 5); let mut damage_mult = 0.2 * val as f64; if input.pvp { @@ -703,12 +703,12 @@ pub fn exotic_perks() { explosive_dmg_scale: 1.0 + damage_mult, crit_scale: 1.0, } - }), + }, ); add_dmr( Perks::StormAndStress, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { if input.value == 0 { return DamageModifierResponse::default(); } @@ -719,12 +719,12 @@ pub fn exotic_perks() { impact_dmg_scale: damage_mult, ..Default::default() } - }), + }, ); add_rmr( Perks::DualSpeedReceiver, - Box::new(|input: ModifierResponseInput| -> RangeModifierResponse { + |input: ModifierResponseInput| -> RangeModifierResponse { if input.value == 0 { return RangeModifierResponse::default(); } @@ -732,35 +732,35 @@ pub fn exotic_perks() { 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 { 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 }, } - }), + }, ); add_fmr( Perks::RatPack, - Box::new(|input: ModifierResponseInput| -> FiringModifierResponse { + |input: ModifierResponseInput| -> FiringModifierResponse { if input.value == 0 { return FiringModifierResponse::default(); } @@ -770,81 +770,81 @@ pub fn exotic_perks() { burst_delay_add: val as f64 * (-0.625 / 30.0), ..Default::default() } - }), + }, ); add_mmr( Perks::RatPack, - Box::new(|input: ModifierResponseInput| -> MagazineModifierResponse { + |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 { + |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 { + |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; 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 { + |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 { + |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 { + |input: ModifierResponseInput| -> FiringModifierResponse { if input.value == 0 { return FiringModifierResponse::default(); } @@ -865,12 +865,12 @@ pub fn exotic_perks() { ..Default::default() } } - }), + }, ); add_dmr( Perks::HarmonicLaser, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let buff = match (input.value, input.pvp) { (0, _) => 1.0, (1, true) => 1.03, @@ -882,12 +882,12 @@ pub fn exotic_perks() { impact_dmg_scale: buff, ..Default::default() } - }), + }, ); add_dmr( Perks::AgersScepterCatalyst, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { if input.value > 0 { return DamageModifierResponse { impact_dmg_scale: 1.8, @@ -895,12 +895,12 @@ pub fn exotic_perks() { }; } DamageModifierResponse::default() - }), + }, ); add_mmr( Perks::AgersScepterCatalyst, - Box::new(|input: ModifierResponseInput| -> MagazineModifierResponse { + |input: ModifierResponseInput| -> MagazineModifierResponse { let mag_buff = if input.value > 0 && input.calc_data.total_shots_fired == 0.0 { 2.0 } else { @@ -910,44 +910,44 @@ pub fn exotic_perks() { magazine_scale: mag_buff, ..Default::default() } - }), + }, ); add_dmr( Perks::ColdFusion, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |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(|_: ModifierResponseInput| -> DamageModifierResponse { + |_: ModifierResponseInput| -> DamageModifierResponse { DamageModifierResponse { impact_dmg_scale: 1.38, ..Default::default() } - }), + }, ); add_fmr( Perks::MarksmanSights, - Box::new(|_: 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 { + |input: ModifierResponseInput| -> DamageModifierResponse { let buff = match input.value { 0 => 1.0, 1 => 1.18, @@ -959,12 +959,12 @@ pub fn exotic_perks() { impact_dmg_scale: buff, ..Default::default() } - }), + }, ); add_fmr( Perks::TemporalUnlimiter, - Box::new(|input: ModifierResponseInput| -> FiringModifierResponse { + |input: ModifierResponseInput| -> FiringModifierResponse { if input.value > 0 { return FiringModifierResponse { burst_delay_add: 0.366, @@ -972,12 +972,12 @@ pub fn exotic_perks() { }; } FiringModifierResponse::default() - }), + }, ); add_dmr( Perks::TemporalUnlimiter, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { if input.value == 0 { return DamageModifierResponse::default(); } @@ -992,22 +992,22 @@ pub fn exotic_perks() { crit_scale: 1.875, ..Default::default() } - }), + }, ); add_mmr( Perks::FourthHorsemanCatalyst, - Box::new(|_: ModifierResponseInput| -> MagazineModifierResponse { + |_: ModifierResponseInput| -> MagazineModifierResponse { MagazineModifierResponse { magazine_add: 1.0, ..Default::default() } - }), + }, ); add_dmr( Perks::BlackHole, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let buff = if input.calc_data.total_shots_hit % 2.0 == 1.0 { 1.35 } else { @@ -1017,12 +1017,12 @@ pub fn exotic_perks() { impact_dmg_scale: buff, ..Default::default() } - }), + }, ); add_dmr( Perks::Impetus, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { if input.value > 0 { return DamageModifierResponse { impact_dmg_scale: 1.5, @@ -1030,22 +1030,22 @@ pub fn exotic_perks() { }; } DamageModifierResponse::default() - }), + }, ); add_fmr( Perks::MarksmanSights, - Box::new(|_: ModifierResponseInput| -> FiringModifierResponse { + |_: ModifierResponseInput| -> FiringModifierResponse { FiringModifierResponse { burst_delay_add: 0.333, // 300 + 333 = 633 , ..Default::default() } - }), + }, ); add_dmr( Perks::Broadhead, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |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; @@ -1060,11 +1060,11 @@ 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 { return FiringModifierResponse::default(); @@ -1073,11 +1073,11 @@ pub fn exotic_perks() { burst_delay_scale: 0.8, ..Default::default() } - }), + }, ); add_dmr( Perks::IonicReturn, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { if input.value == 0 { return DamageModifierResponse::default(); } @@ -1088,11 +1088,11 @@ pub fn exotic_perks() { crit_scale, ..Default::default() } - }), + }, ); add_dmr( Perks::Unrepentant, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { if input.value == 0 || input.pvp { return DamageModifierResponse::default(); } @@ -1100,11 +1100,11 @@ pub fn exotic_perks() { 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 { return FiringModifierResponse::default(); @@ -1113,11 +1113,11 @@ pub fn exotic_perks() { burst_size_add: 3.0, ..Default::default() } - }), + }, ); add_dmr( Perks::ArcConductor, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { if input.value == 0 { return DamageModifierResponse::default(); } @@ -1126,35 +1126,33 @@ 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 { stats.insert(StatHashes::HANDLING.into(), 100); } stats - }), + }, ); add_dmr( Perks::VoidLeech, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { if input.value == 0 || input.pvp { return DamageModifierResponse::default(); } @@ -1163,6 +1161,6 @@ pub fn exotic_perks() { explosive_dmg_scale: 1.2, ..Default::default() } - }), - ) + }, + ); } diff --git a/src/perks/meta_perks.rs b/src/perks/meta_perks.rs index 726f351f..df86fb0b 100644 --- a/src/perks/meta_perks.rs +++ b/src/perks/meta_perks.rs @@ -21,7 +21,7 @@ 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 { @@ -63,12 +63,12 @@ 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; @@ -115,85 +115,79 @@ 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 { stats.insert(StatHashes::AIM_ASSIST.into(), 5); @@ -203,32 +197,30 @@ pub fn meta_perks() { 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 { + |input: ModifierResponseInput| -> HashMap { let inv_buff = match input.value { 0 => 0, 1 => 20, @@ -239,12 +231,12 @@ 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 { + |input: ModifierResponseInput| -> ReloadModifierResponse { let stat = match input.value { 0 => 0, 1 => 10, @@ -257,12 +249,12 @@ pub fn meta_perks() { 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 { 0 => 0, @@ -272,12 +264,12 @@ pub fn meta_perks() { }; stats.insert(StatHashes::RELOAD.into(), buff); stats - }), + }, ); add_flmr( Perks::UnflinchingMod, - Box::new(|input: ModifierResponseInput| -> FlinchModifierResponse { + |input: ModifierResponseInput| -> FlinchModifierResponse { if input.value > 2 { FlinchModifierResponse { flinch_scale: 0.6 } } else if input.value == 2 { @@ -287,48 +279,48 @@ pub fn meta_perks() { } else { FlinchModifierResponse::default() } - }), + }, ); add_sbr( Perks::RallyBarricade, - Box::new(|_: 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(|_: ModifierResponseInput| -> ReloadModifierResponse { + |_: ModifierResponseInput| -> ReloadModifierResponse { ReloadModifierResponse { reload_stat_add: 100, reload_time_scale: 0.9, } - }), + }, ); add_rmr( Perks::RallyBarricade, - Box::new(|_: 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 { WeaponType::FUSIONRIFLE => -0.040, @@ -337,6 +329,6 @@ pub fn meta_perks() { }, ..Default::default() } - }), + }, ); } diff --git a/src/perks/mod.rs b/src/perks/mod.rs index 5a7d3b0d..c8d65e9f 100644 --- a/src/perks/mod.rs +++ b/src/perks/mod.rs @@ -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>; diff --git a/src/perks/origin_perks.rs b/src/perks/origin_perks.rs index 570a4b63..d211d7c7 100644 --- a/src/perks/origin_perks.rs +++ b/src/perks/origin_perks.rs @@ -16,7 +16,7 @@ use super::{ pub fn origin_perks() { add_rr( Perks::VeistStinger, - Box::new(|input: ModifierResponseInput| -> RefundResponse { + |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; @@ -37,12 +37,12 @@ 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 @@ -53,12 +53,12 @@ pub fn origin_perks() { }, ..Default::default() } - }), + }, ); add_dmr( Perks::HakkeBreach, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { if input.value == 0 { return DamageModifierResponse::default(); } @@ -75,34 +75,34 @@ pub fn origin_perks() { explosive_dmg_scale: buff, crit_scale: 1.0, } - }), + }, ); add_rmr( Perks::Alacrity, - Box::new(|input: ModifierResponseInput| -> RangeModifierResponse { + |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 { + |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 }; @@ -113,12 +113,12 @@ pub fn origin_perks() { 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 }; @@ -127,12 +127,12 @@ pub fn origin_perks() { map.insert(StatHashes::HANDLING.into(), handling); } map - }), + }, ); add_rmr( Perks::Ambush, - Box::new(|input: ModifierResponseInput| -> RangeModifierResponse { + |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 { @@ -142,29 +142,27 @@ 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 { + |input: ModifierResponseInput| -> DamageModifierResponse { if input.value == 0 || input.pvp { return DamageModifierResponse::default(); } @@ -179,12 +177,12 @@ 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 @@ -195,29 +193,27 @@ 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 { + |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 { @@ -227,12 +223,12 @@ 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 }; @@ -243,12 +239,12 @@ pub fn origin_perks() { map.insert(StatHashes::STABILITY.into(), stability); } map - }), + }, ); add_rsmr( Perks::QuietMoment, - Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + |input: ModifierResponseInput| -> ReloadModifierResponse { if input.value > 0 { ReloadModifierResponse { reload_stat_add: 40, @@ -257,23 +253,23 @@ 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 { map.insert(StatHashes::RELOAD.into(), 40); } map - }), + }, ); add_rsmr( Perks::BitterSpite, - Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + |input: ModifierResponseInput| -> ReloadModifierResponse { let val = clamp(input.value, 0, 5) as i32; let mult = match val { 0 => 1.0, @@ -288,22 +284,22 @@ 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; map.insert(StatHashes::RELOAD.into(), val * 10); map - }), + }, ); add_rmr( Perks::RightHook, - Box::new(|input: ModifierResponseInput| -> RangeModifierResponse { + |input: ModifierResponseInput| -> RangeModifierResponse { let range_add = if input.is_enhanced { 20 } else { 10 }; if input.value > 0 { RangeModifierResponse { @@ -313,12 +309,12 @@ 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 { @@ -326,41 +322,37 @@ pub fn origin_perks() { 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 { map.insert(StatHashes::HANDLING.into(), 20); @@ -368,28 +360,26 @@ pub fn origin_perks() { 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 { + |input: ModifierResponseInput| -> ReloadModifierResponse { if input.value > 0 { ReloadModifierResponse { reload_stat_add: 20, @@ -398,11 +388,11 @@ pub fn origin_perks() { } else { ReloadModifierResponse::default() } - }), + }, ); add_rmr( Perks::TexBalancedStock, - Box::new(|input: ModifierResponseInput| -> RangeModifierResponse { + |input: ModifierResponseInput| -> RangeModifierResponse { if input.value == 0 { return RangeModifierResponse::default(); } @@ -410,49 +400,47 @@ pub fn origin_perks() { 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 { 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 { + |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 { out.insert(StatHashes::HANDLING.into(), 10); @@ -462,12 +450,12 @@ pub fn origin_perks() { out.insert(StatHashes::HANDLING.into(), 20); } out - }), + }, ); add_rsmr( Perks::HarmonicResonance, - Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + |input: ModifierResponseInput| -> ReloadModifierResponse { let stat_bump = if input.value > 1 { 20 } else { 0 }; if input.value > 0 { ReloadModifierResponse { @@ -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 84abf348..28a91ee4 100644 --- a/src/perks/other_perks.rs +++ b/src/perks/other_perks.rs @@ -20,7 +20,7 @@ use super::{ pub fn other_perks() { add_rsmr( Perks::AlloyMag, - Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + |input: ModifierResponseInput| -> ReloadModifierResponse { if input.value > 0 { ReloadModifierResponse { reload_stat_add: 0, @@ -29,12 +29,12 @@ pub fn other_perks() { } else { ReloadModifierResponse::default() } - }), + }, ); add_rsmr( Perks::RapidFireFrame, - Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + |input: ModifierResponseInput| -> ReloadModifierResponse { if input.value > 0 || input.calc_data.weapon_type == &WeaponType::SHOTGUN { ReloadModifierResponse { reload_stat_add: 0, @@ -43,84 +43,76 @@ 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 { stats.insert(StatHashes::AIRBORNE.into(), 25); } stats - }), + }, ); add_hmr( Perks::SwapMag, - Box::new( - |_: 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( - |_: 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::FreehandGrip, - Box::new( - |_: ModifierResponseInput| -> HandlingModifierResponse { - HandlingModifierResponse { - draw_scale: 0.95, - ..Default::default() - } - }, - ), + |_: ModifierResponseInput| -> HandlingModifierResponse { + HandlingModifierResponse { + draw_scale: 0.95, + ..Default::default() + } + }, ); add_sbr( Perks::Amplified, - Box::new(|_: ModifierResponseInput| -> HashMap { + |_: ModifierResponseInput| -> HashMap { let mut stats = HashMap::new(); stats.insert(StatHashes::HANDLING.into(), 40); stats - }), + }, ); add_hmr( Perks::Amplified, - Box::new( - |_: 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 { + |input: ModifierResponseInput| -> ReloadModifierResponse { if input.value > 0 { ReloadModifierResponse { reload_stat_add: 50, @@ -129,23 +121,23 @@ 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 { stats.insert(StatHashes::RELOAD.into(), 50); }; stats - }), + }, ); add_rsmr( Perks::FlowState, - Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + |input: ModifierResponseInput| -> ReloadModifierResponse { if input.value > 0 { ReloadModifierResponse { reload_stat_add: 50, @@ -154,34 +146,34 @@ 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 { 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 { 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 { @@ -189,36 +181,34 @@ pub fn other_perks() { 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 { + |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 }, } - }), + }, ); 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 { @@ -226,12 +216,12 @@ pub fn other_perks() { }; 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 { stats.insert(StatHashes::AIRBORNE.into(), 20); @@ -239,12 +229,12 @@ pub fn other_perks() { stats.insert(StatHashes::STABILITY.into(), 30); }; stats - }), + }, ); add_dmr( Perks::BossSpec, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let damage_mult = if *input.calc_data.enemy_type == EnemyType::BOSS && !input.pvp { 1.077 } else { @@ -255,12 +245,12 @@ 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, EnemyType::ELITE | EnemyType::MINIBOSS | EnemyType::CHAMPION @@ -274,12 +264,12 @@ 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, EnemyType::ELITE | EnemyType::MINIBOSS | EnemyType::CHAMPION | EnemyType::BOSS @@ -293,12 +283,12 @@ pub fn other_perks() { explosive_dmg_scale: damage_mult, ..Default::default() } - }), + }, ); add_dmr( Perks::MinorSpec, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let damage_mult = if input.calc_data.enemy_type == &EnemyType::MINOR && !input.pvp { 1.077 } else { @@ -309,12 +299,12 @@ pub fn other_perks() { explosive_dmg_scale: damage_mult, crit_scale: 1.0, } - }), + }, ); add_dmr( Perks::TakenSpec, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let damage_mult = if input.value > 0 && !input.pvp { 1.1 } else { @@ -325,34 +315,34 @@ pub fn other_perks() { explosive_dmg_scale: damage_mult, crit_scale: 1.0, } - }), + }, ); add_dmr( Perks::SpikeGrenades, - Box::new(|_: 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(|_: 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 { + |input: ModifierResponseInput| -> DamageModifierResponse { if input.calc_data.weapon_type == &WeaponType::SHOTGUN && input.calc_data.base_crit_mult < 1.15 { @@ -364,12 +354,12 @@ pub fn other_perks() { } else { DamageModifierResponse::default() } - }), + }, ); add_fmr( Perks::AcceleratedCoils, - Box::new(|input: ModifierResponseInput| -> FiringModifierResponse { + |input: ModifierResponseInput| -> FiringModifierResponse { if input.calc_data.weapon_type == &WeaponType::LINEARFUSIONRIFLE { return FiringModifierResponse { burst_delay_add: -0.033, @@ -380,12 +370,12 @@ pub fn other_perks() { burst_delay_add: -0.040, ..Default::default() } - }), + }, ); add_fmr( Perks::LiquidCoils, - Box::new(|input: ModifierResponseInput| -> FiringModifierResponse { + |input: ModifierResponseInput| -> FiringModifierResponse { if input.calc_data.weapon_type == &WeaponType::LINEARFUSIONRIFLE { return FiringModifierResponse { burst_delay_add: 0.033, @@ -396,34 +386,34 @@ pub fn other_perks() { burst_delay_add: 0.040, ..Default::default() } - }), + }, ); add_dmr( Perks::LiquidCoils, - Box::new(|_: 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(|_: 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 { + |input: ModifierResponseInput| -> FiringModifierResponse { let hash = input.calc_data.intrinsic_hash; let tick_amount = if hash == 904 { 3.0 @@ -440,12 +430,12 @@ 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 { map.insert(StatHashes::AIRBORNE.into(), 30); @@ -453,30 +443,28 @@ pub fn other_perks() { 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 { + |input: ModifierResponseInput| -> ReloadModifierResponse { if input.value > 0 { ReloadModifierResponse { reload_time_scale: 0.925, @@ -485,17 +473,17 @@ pub fn other_perks() { } else { ReloadModifierResponse::default() } - }), + }, ); add_dmr( Perks::ImpactCasing, - Box::new(|_: ModifierResponseInput| -> DamageModifierResponse { + |_: ModifierResponseInput| -> DamageModifierResponse { DamageModifierResponse { impact_dmg_scale: 1.1, explosive_dmg_scale: 1.0, crit_scale: 1.0, } - }), + }, ); } diff --git a/src/perks/year_1_perks.rs b/src/perks/year_1_perks.rs index 002789e2..6b732d6d 100644 --- a/src/perks/year_1_perks.rs +++ b/src/perks/year_1_perks.rs @@ -21,25 +21,23 @@ 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 }; @@ -57,36 +55,34 @@ 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 { reload = 15; @@ -97,39 +93,37 @@ pub fn year_1_perks() { 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 { + |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; @@ -143,12 +137,12 @@ 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 { @@ -158,12 +152,12 @@ pub fn year_1_perks() { burst_delay_scale: delay_mult, ..Default::default() } - }), + }, ); add_dmr( Perks::ExplosivePayload, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { if input.pvp { DamageModifierResponse::default() } else { @@ -173,25 +167,23 @@ pub fn year_1_perks() { crit_scale: 1.0, } } - }), + }, ); add_epr( Perks::ExplosivePayload, - Box::new( - |_: 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 { + |input: ModifierResponseInput| -> DamageModifierResponse { if input.pvp { DamageModifierResponse::default() } else { @@ -202,44 +194,40 @@ pub fn year_1_perks() { crit_scale: 1.0, } } - }), + }, ); add_epr( Perks::TimedPayload, - Box::new( - |_: 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 { @@ -250,81 +238,73 @@ pub fn year_1_perks() { 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 { delay_mult = 0.91; @@ -335,38 +315,36 @@ pub fn year_1_perks() { inner_burst_scale: 1.0, burst_size_add: 0.0, } - }), + }, ); add_rr( Perks::TripleTap, - Box::new(|_: 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 @@ -381,46 +359,42 @@ pub fn year_1_perks() { range_hip_scale: hf_range_scale, range_zoom_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 { + |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; @@ -434,25 +408,23 @@ 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 { + |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 { @@ -462,39 +434,35 @@ pub fn year_1_perks() { } else { ReloadModifierResponse::default() } - }), + }, ); add_vmr( Perks::RangeFinder, - Box::new( - |_: 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 { range = 0; //only applies to first proj so like should do alot less @@ -507,74 +475,66 @@ 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 { + |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 }; @@ -590,12 +550,12 @@ 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 { + |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 { @@ -606,12 +566,12 @@ 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 { + |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 { @@ -622,12 +582,12 @@ 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 { + |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 { @@ -637,47 +597,43 @@ pub fn year_1_perks() { 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(|_: ModifierResponseInput| -> ExtraDamageResponse { + |_: ModifierResponseInput| -> ExtraDamageResponse { ExtraDamageResponse { additive_damage: 350.0 * 0.04, combatant_scale: true, @@ -689,12 +645,12 @@ pub fn year_1_perks() { hit_at_same_time: true, is_dot: false, } - }), + }, ); add_dmr( Perks::DisruptionBreak, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |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 @@ -707,86 +663,76 @@ 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 { + |input: ModifierResponseInput| -> ReloadModifierResponse { if input.value > 0 { ReloadModifierResponse { reload_stat_add: 100, @@ -795,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(|_: 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 @@ -845,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 8a47b1e3..c5138878 100644 --- a/src/perks/year_2_perks.rs +++ b/src/perks/year_2_perks.rs @@ -19,18 +19,18 @@ 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; stats.insert(StatHashes::AIRBORNE.into(), ae); stats - }), + }, ); add_fmr( Perks::ArchersTempo, - Box::new(|input: ModifierResponseInput| -> FiringModifierResponse { + |input: ModifierResponseInput| -> FiringModifierResponse { let delay = match (input.value, input.calc_data.intrinsic_hash) { (0, _) => 1.0, (1.., 1699724249) => 0.5625, //levi breath @@ -40,12 +40,12 @@ pub fn year_2_perks() { burst_delay_scale: delay, ..Default::default() } - }), + }, ); add_dmr( Perks::ExplosiveHead, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { if input.pvp { DamageModifierResponse::default() } else { @@ -55,25 +55,23 @@ 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 { + |input: ModifierResponseInput| -> ReloadModifierResponse { let val = clamp(input.value, 0, 5); let duration = 3.5; let mut reload_mult = 1.0; @@ -102,12 +100,12 @@ 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 duration = 3.5; @@ -128,12 +126,12 @@ pub fn year_2_perks() { }; 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 { crit_mult = 1.2; @@ -143,24 +141,24 @@ pub fn year_2_perks() { explosive_dmg_scale: 1.0, impact_dmg_scale: 1.0, } - }), + }, ); add_rr( Perks::FourthTimesTheCharm, - Box::new(|_: ModifierResponseInput| -> RefundResponse { + |_: ModifierResponseInput| -> RefundResponse { RefundResponse { crit: true, requirement: 4, refund_mag: 2, refund_reserves: 0, } - }), + }, ); add_dmr( Perks::KillingTally, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let val = clamp(input.value, 0, 3); let mut damage_mult = 0.1 * val as f64; if input.pvp { @@ -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), @@ -217,12 +213,12 @@ 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( @@ -237,12 +233,12 @@ pub fn year_2_perks() { stab_values[entry_to_get as usize], ); stats - }), + }, ); add_dmr( Perks::ResevoirBurst, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let damage_mult = if input.calc_data.curr_mag >= input.calc_data.base_mag { 1.25 } else { @@ -253,12 +249,12 @@ 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 { @@ -275,12 +271,12 @@ 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 { damage_mult = 1.25; @@ -290,12 +286,12 @@ pub fn year_2_perks() { explosive_dmg_scale: damage_mult, crit_scale: 1.0, } - }), + }, ); add_dmr( Perks::Swashbuckler, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |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; @@ -307,12 +303,12 @@ 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 { + |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 { @@ -323,12 +319,12 @@ 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 { + |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 { @@ -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 { 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 { 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 { + |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 9b012c8a..d0953cf8 100644 --- a/src/perks/year_3_perks.rs +++ b/src/perks/year_3_perks.rs @@ -18,20 +18,18 @@ use super::{ pub fn year_3_perks() { add_mmr( Perks::ClownCartridge, - Box::new( - |_: 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 { @@ -46,28 +44,26 @@ pub fn year_3_perks() { 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 }; @@ -76,24 +72,24 @@ pub fn year_3_perks() { 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 { stats.insert(StatHashes::HANDLING.into(), 40); stats.insert(StatHashes::RANGE.into(), 20); }; stats - }), + }, ); add_rmr( Perks::KillingWind, - Box::new(|input: ModifierResponseInput| -> RangeModifierResponse { + |input: ModifierResponseInput| -> RangeModifierResponse { if input.value > 0 { RangeModifierResponse { range_stat_add: 20, @@ -109,39 +105,37 @@ 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(|_: 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 @@ -161,12 +155,12 @@ 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 { @@ -175,28 +169,26 @@ pub fn year_3_perks() { 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 { + |input: ModifierResponseInput| -> ReloadModifierResponse { if input.value == 0 { return ReloadModifierResponse::default(); } @@ -204,12 +196,12 @@ pub fn year_3_perks() { reload_stat_add: if input.is_enhanced { 35 } else { 30 }, ..Default::default() } - }), + }, ); add_dmr( Perks::TrenchBarrel, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { if input.value > 0 { return DamageModifierResponse { impact_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 c4549ee3..86ef167d 100644 --- a/src/perks/year_4_perks.rs +++ b/src/perks/year_4_perks.rs @@ -16,7 +16,7 @@ use super::{ pub fn year_4_perks() { add_dmr( Perks::Adagio, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |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 @@ -32,12 +32,12 @@ 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 { + |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 { @@ -49,24 +49,24 @@ 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 { map.insert(StatHashes::RANGE.into(), 10); } map - }), + }, ); add_rmr( Perks::Adagio, - Box::new(|input: ModifierResponseInput| -> RangeModifierResponse { + |input: ModifierResponseInput| -> RangeModifierResponse { if input.value == 0 { return RangeModifierResponse::default(); } @@ -75,12 +75,12 @@ pub fn year_4_perks() { range_stat_add: 10, ..Default::default() } - }), + }, ); add_dmr( Perks::AdrenalineJunkie, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |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; @@ -92,12 +92,12 @@ 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 { + |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 { @@ -106,25 +106,23 @@ pub fn year_4_perks() { 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 { delay_mult = 0.85; @@ -135,12 +133,12 @@ pub fn year_4_perks() { inner_burst_scale: 1.0, burst_size_add: 0.0, } - }), + }, ); add_sbr( Perks::Ensemble, - Box::new(|input: ModifierResponseInput| -> HashMap { + |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 { @@ -151,29 +149,27 @@ 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 { + |input: ModifierResponseInput| -> ReloadModifierResponse { let reload = if input.is_enhanced { 45 } else { 40 }; if input.value > 0 { ReloadModifierResponse { @@ -186,12 +182,12 @@ 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 { reload = 100; @@ -203,31 +199,29 @@ pub fn year_4_perks() { 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 { dmg = 0.15; @@ -240,12 +234,12 @@ 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 { @@ -260,12 +254,12 @@ 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 { + |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 @@ -276,33 +270,31 @@ pub fn year_4_perks() { reload_stat_add: reload, reload_time_scale: reload_mult, } - }), + }, ); add_sbr( Perks::ImpulseAmplifier, - Box::new(|input: ModifierResponseInput| -> HashMap { + |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( - |_: ModifierResponseInput| -> VelocityModifierResponse { - VelocityModifierResponse { - velocity_scaler: 1.35, - } - }, - ), + |_: ModifierResponseInput| -> VelocityModifierResponse { + VelocityModifierResponse { + velocity_scaler: 1.35, + } + }, ); add_sbr( Perks::PerpetualMotion, - Box::new(|input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let val = clamp(input.value, 0, 2); let mut stat_bump = 0; if val == 1 { @@ -315,31 +307,29 @@ 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 { + |input: ModifierResponseInput| -> ReloadModifierResponse { let val = clamp(input.value, 0, 2); let mut stat_bump = 0; if val == 1 { @@ -351,83 +341,79 @@ 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 { out.insert(StatHashes::AIRBORNE.into(), 30); }; out - }), + }, ); add_flmr( Perks::PerfectFloat, - Box::new(|input: ModifierResponseInput| -> FlinchModifierResponse { + |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 { 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 { 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 { @@ -441,23 +427,23 @@ 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 { buffer.insert(StatHashes::RELOAD.into(), 50); } buffer - }), + }, ); add_rsmr( Perks::FireFly, - Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + |input: ModifierResponseInput| -> ReloadModifierResponse { if input.value > 0 { ReloadModifierResponse { reload_stat_add: 50, @@ -466,12 +452,12 @@ pub fn year_4_perks() { } else { ReloadModifierResponse::default() } - }), + }, ); add_dmr( Perks::GoldenTricorn, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |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 { @@ -487,12 +473,12 @@ pub fn year_4_perks() { } else { DamageModifierResponse::default() } - }), + }, ); add_dmr( Perks::Harmony, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |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 { @@ -503,36 +489,34 @@ 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 { 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 { out.insert(StatHashes::HANDLING.into(), 10); @@ -548,33 +532,31 @@ pub fn year_4_perks() { 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 { + |input: ModifierResponseInput| -> ReloadModifierResponse { let reload = if input.value == 1 { 5 } else if input.value == 2 { @@ -588,50 +570,48 @@ pub fn year_4_perks() { reload_stat_add: reload, reload_time_scale: 1.0, } - }), + }, ); add_sbr( Perks::HeatingUp, - Box::new(|input: ModifierResponseInput| -> HashMap { + |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 { 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 { @@ -643,12 +623,12 @@ pub fn year_4_perks() { explosive_dmg_scale: MULT, ..Default::default() } - }), + }, ); add_fmr( Perks::KickStart, - Box::new(|input: ModifierResponseInput| -> FiringModifierResponse { + |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 { @@ -658,12 +638,12 @@ pub fn year_4_perks() { 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 @@ -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 a651a6bc..a8607604 100644 --- a/src/perks/year_5_perks.rs +++ b/src/perks/year_5_perks.rs @@ -15,7 +15,7 @@ use super::{ pub fn year_5_perks() { add_fmr( Perks::CascadePoint, - Box::new(|input: ModifierResponseInput| -> FiringModifierResponse { + |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 { @@ -33,12 +33,12 @@ 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 stability_boost = 8 * val; @@ -46,45 +46,45 @@ pub fn year_5_perks() { map.insert(StatHashes::RANGE.into(), range_boost); map.insert(StatHashes::STABILITY.into(), stability_boost); map - }), + }, ); add_rmr( Perks::Encore, - Box::new(|input: ModifierResponseInput| -> RangeModifierResponse { + |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 { + |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 { + |input: ModifierResponseInput| -> RangeModifierResponse { let range_bonus = if input.value > 0 { 20 } else { 0 }; RangeModifierResponse { range_stat_add: range_bonus, @@ -92,12 +92,12 @@ pub fn year_5_perks() { 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 { @@ -105,12 +105,12 @@ pub fn year_5_perks() { }; map.insert(StatHashes::RANGE.into(), range_bonus); map - }), + }, ); add_dmr( Perks::GutShot, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let high_weapons = [ WeaponType::AUTORIFLE, WeaponType::HANDCANNON, @@ -134,12 +134,12 @@ 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 { @@ -147,12 +147,12 @@ pub fn year_5_perks() { }; 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 { range_hip_mult = 1.45; @@ -163,35 +163,33 @@ pub fn year_5_perks() { range_hip_scale: range_hip_mult, range_zoom_scale: 1.0, } - }), + }, ); add_hmr( Perks::Slickdraw, - Box::new( - |_: 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(|_: 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; @@ -208,29 +206,27 @@ 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 { @@ -243,12 +239,12 @@ 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 }; @@ -260,12 +256,12 @@ 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 { @@ -273,33 +269,31 @@ pub fn year_5_perks() { }; 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 low_end_dmg = 0.0934 * enh_increase * nerf; @@ -329,12 +323,12 @@ 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 }; @@ -347,12 +341,12 @@ pub fn year_5_perks() { explosive_dmg_scale: buff, crit_scale: 1.0, } - }), + }, ); add_sbr( Perks::WellRounded, - Box::new(|input: ModifierResponseInput| -> HashMap { + |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 }; @@ -361,29 +355,27 @@ pub fn year_5_perks() { 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 { + |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; @@ -393,12 +385,12 @@ pub fn year_5_perks() { range_hip_scale: 1.0, range_zoom_scale: 1.0, } - }), + }, ); add_dmr( Perks::BaitAndSwitch, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { if input.value == 0 { return DamageModifierResponse::default(); } @@ -407,12 +399,12 @@ pub fn year_5_perks() { explosive_dmg_scale: 1.30, crit_scale: 1.0, } - }), + }, ); add_rsmr( Perks::CompulsiveReloader, - Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + |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 @@ -424,12 +416,12 @@ pub fn year_5_perks() { } else { ReloadModifierResponse::default() } - }), + }, ); add_sbr( Perks::CompulsiveReloader, - Box::new(|input: ModifierResponseInput| -> HashMap { + |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 @@ -438,12 +430,12 @@ pub fn year_5_perks() { map.insert(StatHashes::RELOAD.into(), reload_add); } map - }), + }, ); add_sbr( Perks::SleightOfHand, - Box::new(|input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let val = clamp(input.value, 0, 3) as i32; let mut map = HashMap::new(); let stat_base = 10; @@ -452,27 +444,25 @@ 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 { + |input: ModifierResponseInput| -> ReloadModifierResponse { let val = clamp(input.value, 0, 3) as i32; let stat_base = 10; let reload = stat_base * val; @@ -480,44 +470,42 @@ pub fn year_5_perks() { 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 { map.insert(StatHashes::HANDLING.into(), 100); } map - }), + }, ); add_fmr( Perks::SuccesfulWarmup, - Box::new(|input: ModifierResponseInput| -> FiringModifierResponse { + |input: ModifierResponseInput| -> FiringModifierResponse { if input.value == 0 { return FiringModifierResponse::default(); } @@ -525,17 +513,17 @@ pub fn year_5_perks() { burst_delay_scale: 0.625, ..Default::default() } - }), + }, ); add_dmr( Perks::UnstoppableForce, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |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 b014a1e6..e7b3938f 100644 --- a/src/perks/year_6_perks.rs +++ b/src/perks/year_6_perks.rs @@ -17,7 +17,7 @@ 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; @@ -29,36 +29,36 @@ pub fn year_6_perks() { map.insert(StatHashes::RANGE.into(), range_bonus); map.insert(StatHashes::RELOAD.into(), reload_bonus); map - }), + }, ); add_rmr( Perks::KeepAway, - Box::new(|input: ModifierResponseInput| -> RangeModifierResponse { + |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 { + |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 { map.insert(StatHashes::RANGE.into(), 20); @@ -77,12 +77,12 @@ pub fn year_6_perks() { 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; // HandlingModifierResponse { @@ -95,7 +95,7 @@ pub fn year_6_perks() { add_rsmr( Perks::FieldTested, - Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + |input: ModifierResponseInput| -> ReloadModifierResponse { let reload_bump; if input.value > 4 { reload_bump = 55; @@ -114,12 +114,12 @@ 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 { range_bump = 20; @@ -138,12 +138,12 @@ pub fn year_6_perks() { range_stat_add: range_bump, ..Default::default() } - }), + }, ); add_dmr( Perks::ParacausalAffinity, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { if input.value > 0 { DamageModifierResponse { explosive_dmg_scale: 1.2, @@ -153,25 +153,23 @@ 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 { + |input: ModifierResponseInput| -> DamageModifierResponse { let buff = match (input.pvp, input.value) { (_, 0) => 1.0, (true, 1..) => 1.1, @@ -182,57 +180,53 @@ pub fn year_6_perks() { explosive_dmg_scale: buff, ..Default::default() } - }), + }, ); add_dmr( Perks::Bipod, - Box::new(|_: ModifierResponseInput| -> DamageModifierResponse { + |_: ModifierResponseInput| -> DamageModifierResponse { DamageModifierResponse { impact_dmg_scale: 0.75, explosive_dmg_scale: 0.75, ..Default::default() } - }), + }, ); add_mmr( Perks::Bipod, - Box::new( - |_: ModifierResponseInput| -> MagazineModifierResponse { - MagazineModifierResponse { - magazine_scale: 2.0, - ..Default::default() - } - }, - ), + |_: ModifierResponseInput| -> MagazineModifierResponse { + MagazineModifierResponse { + magazine_scale: 2.0, + ..Default::default() + } + }, ); add_imr( Perks::Bipod, - Box::new( - |_: ModifierResponseInput| -> InventoryModifierResponse { - InventoryModifierResponse { - inv_add: 5, - ..Default::default() - } - }, - ), + |_: ModifierResponseInput| -> InventoryModifierResponse { + InventoryModifierResponse { + inv_add: 5, + ..Default::default() + } + }, ); add_fmr( Perks::Bipod, - Box::new(|_: ModifierResponseInput| -> FiringModifierResponse { + |_: ModifierResponseInput| -> FiringModifierResponse { FiringModifierResponse { burst_delay_scale: 0.75, ..Default::default() } - }), + }, ); add_fmr( Perks::ControlledBurst, - Box::new(|input: ModifierResponseInput| -> FiringModifierResponse { + |input: ModifierResponseInput| -> FiringModifierResponse { if input.value > 0 { return FiringModifierResponse { burst_delay_scale: 0.9, @@ -240,11 +234,11 @@ pub fn year_6_perks() { }; } FiringModifierResponse::default() - }), + }, ); add_dmr( Perks::ControlledBurst, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { if input.value > 0 { return DamageModifierResponse { impact_dmg_scale: 1.2, @@ -253,21 +247,21 @@ 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 { 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 { stats.insert(StatHashes::STABILITY.into(), 20); @@ -275,12 +269,12 @@ pub fn year_6_perks() { stats.insert(StatHashes::RELOAD.into(), 60); } stats - }), + }, ); add_rsmr( Perks::UnsatedHunger, - Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + |input: ModifierResponseInput| -> ReloadModifierResponse { if input.value > 0 { return ReloadModifierResponse { reload_stat_add: 60, @@ -288,52 +282,48 @@ pub fn year_6_perks() { }; } 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 { stats.insert(StatHashes::AIRBORNE.into(), 30); } stats - }), + }, ); add_dmr( Perks::PrecisionInstrument, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |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; @@ -344,12 +334,12 @@ pub fn year_6_perks() { crit_scale: 1.0 + stacks * max_percent / max_stacks, ..Default::default() } - }), + }, ); add_rsmr( Perks::LooseChange, - Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + |input: ModifierResponseInput| -> ReloadModifierResponse { if input.value == 0 { return ReloadModifierResponse::default(); } @@ -357,27 +347,25 @@ pub fn year_6_perks() { 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 { + |input: ModifierResponseInput| -> DamageModifierResponse { if input.value == 0 { return DamageModifierResponse::default(); } @@ -388,39 +376,35 @@ pub fn year_6_perks() { 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 { + |input: ModifierResponseInput| -> ReloadModifierResponse { if input.value == 0 { return ReloadModifierResponse::default(); } @@ -428,45 +412,41 @@ pub fn year_6_perks() { 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 { + |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; @@ -477,11 +457,11 @@ pub fn year_6_perks() { reload_stat_add: stat_bump, ..Default::default() } - }), + }, ); add_dmr( Perks::SwordLogic, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |input: ModifierResponseInput| -> DamageModifierResponse { let buff = match (input.pvp, input.value) { (_, 0) => 1.0, (false, 1..=3) => 1.05 + (0.1 * input.value as f64), @@ -494,11 +474,11 @@ pub fn year_6_perks() { explosive_dmg_scale: buff, ..Default::default() } - }), + }, ); add_sbr( Perks::NobleDeeds, - Box::new(|input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { if input.value == 0 { return HashMap::new(); } @@ -506,11 +486,11 @@ pub fn year_6_perks() { (StatHashes::HANDLING.into(), 30), (StatHashes::RELOAD.into(), 30), ]) - }), + }, ); add_rsmr( Perks::NobleDeeds, - Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + |input: ModifierResponseInput| -> ReloadModifierResponse { if input.value == 0 { return ReloadModifierResponse::default(); } @@ -518,25 +498,23 @@ pub fn year_6_perks() { 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 { + |input: ModifierResponseInput| -> FiringModifierResponse { let buff = match input.value { 0 => 1.0, 1 => 0.84, @@ -548,11 +526,11 @@ pub fn year_6_perks() { burst_delay_scale: buff, ..Default::default() } - }), + }, ); add_rsmr( Perks::Onslaught, - Box::new(|input: ModifierResponseInput| -> ReloadModifierResponse { + |input: ModifierResponseInput| -> ReloadModifierResponse { let buff = match input.value { 0 => 0, 1 => 15, @@ -564,11 +542,11 @@ pub fn year_6_perks() { reload_stat_add: buff, ..Default::default() } - }), + }, ); add_sbr( Perks::Onslaught, - Box::new(|input: ModifierResponseInput| -> HashMap { + |input: ModifierResponseInput| -> HashMap { let buff = match input.value { 0 => 0, 1 => 15, @@ -577,33 +555,33 @@ pub fn year_6_perks() { _ => 35, }; HashMap::from([(StatHashes::RELOAD.into(), buff)]) - }), + }, ); add_dmr( Perks::Sever, - Box::new(|input: ModifierResponseInput| -> DamageModifierResponse { + |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 { + |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 { + |input: ModifierResponseInput| -> DamageModifierResponse { if input.value == 0 { return DamageModifierResponse::default(); } @@ -612,6 +590,6 @@ pub fn year_6_perks() { explosive_dmg_scale: 1.15, ..Default::default() } - }), + }, ); } diff --git a/src/weapons/ttk_calc.rs b/src/weapons/ttk_calc.rs index 8460df1b..73a654cb 100644 --- a/src/weapons/ttk_calc.rs +++ b/src/weapons/ttk_calc.rs @@ -104,8 +104,7 @@ pub fn calc_ttk(weapon: &Weapon, overshield: f64) -> Vec { * 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; + 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 { @@ -228,8 +227,7 @@ pub fn calc_ttk(weapon: &Weapon, overshield: f64) -> Vec { * 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; + 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 { From a245ab3c903e6e724fa3bcd4ad2a84cdeb7feaf3 Mon Sep 17 00:00:00 2001 From: oh-yes-0-fps Date: Mon, 22 Apr 2024 00:01:07 -0400 Subject: [PATCH 3/7] idk what this was :skull: --- .../build-script-src/formula_types.rs | 2 -- .../build-script-src/json_database.rs | 31 ------------------- boboswaggins_kitchen/build-script-src/main.rs | 16 ---------- 3 files changed, 49 deletions(-) delete mode 100644 boboswaggins_kitchen/build-script-src/formula_types.rs delete mode 100644 boboswaggins_kitchen/build-script-src/json_database.rs delete mode 100644 boboswaggins_kitchen/build-script-src/main.rs diff --git a/boboswaggins_kitchen/build-script-src/formula_types.rs b/boboswaggins_kitchen/build-script-src/formula_types.rs deleted file mode 100644 index 930fd975..00000000 --- a/boboswaggins_kitchen/build-script-src/formula_types.rs +++ /dev/null @@ -1,2 +0,0 @@ - -include!("../src/types/formula_types.rs"); \ No newline at end of file diff --git a/boboswaggins_kitchen/build-script-src/json_database.rs b/boboswaggins_kitchen/build-script-src/json_database.rs deleted file mode 100644 index 49cb246a..00000000 --- a/boboswaggins_kitchen/build-script-src/json_database.rs +++ /dev/null @@ -1,31 +0,0 @@ -use std::path::Path; - -use thiserror::Error; - -#[derive(Debug, Error)] -pub enum FormulaFileError { - #[error("Failed to write formula source file")] - WriteError(#[from] std::io::Error), - #[error("Failed to serialize formula json")] - SerializeError(#[from] serde_json::Error), -} - -fn json_0_float() -> Value { - Value::Number(Number::from_f64(0.0).unwrap()) -} - -fn json_1_float() -> Value { - Value::Number(Number::from_f64(1.0).unwrap()) -} - - -pub fn write_formula_file(path: &Path) -> Result<(), FormulaFileError> { - - - - - - - - Ok(()) -} \ No newline at end of file diff --git a/boboswaggins_kitchen/build-script-src/main.rs b/boboswaggins_kitchen/build-script-src/main.rs deleted file mode 100644 index 42c47540..00000000 --- a/boboswaggins_kitchen/build-script-src/main.rs +++ /dev/null @@ -1,16 +0,0 @@ -use std::{env, path::Path}; - -mod rs_types; -mod json_database; - -fn main() { - let mut opts = built::Options::default(); - opts.set_dependencies(true); - - let src = env::var("CARGO_MANIFEST_DIR").unwrap(); - let built_dst = Path::new(&env::var("OUT_DIR").unwrap()).join("built.rs"); - let formula_dst = Path::new(&env::var("OUT_DIR").unwrap()).join("formulas.rs"); - - built::write_built_file_with_opts(&opts, src.as_ref(), &built_dst) - .expect("Failed to acquire build-time information"); -} From 40f558a2185cee05598ea298a327bf8aea987d8b Mon Sep 17 00:00:00 2001 From: oh-yes-0-fps Date: Mon, 22 Apr 2024 14:38:08 -0400 Subject: [PATCH 4/7] removed underscored in forgotten files --- src/perks/perk_options_handler.rs | 218 +++++++++--------- src/weapons/reserve_calc.rs | 368 +++++++++++++++--------------- 2 files changed, 293 insertions(+), 293 deletions(-) diff --git a/src/perks/perk_options_handler.rs b/src/perks/perk_options_handler.rs index d02c9404..2275ff3d 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,84 +35,84 @@ 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()), @@ -143,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()), @@ -165,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()), @@ -173,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)), @@ -202,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 @@ -215,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()), @@ -248,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,10 +260,10 @@ fn hash_to_perk_option_data(_hash: u32) -> Option { Perks::WellRounded => Some(PerkOptionData::stacking(2)), //season 18 | year 5 - Perks::GutShot => Some(PerkOptionData::static_()), + Perks::GutShot => Some(PerkOptionData::constant()), 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()), @@ -271,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()), @@ -280,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()), @@ -300,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()), @@ -315,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()), @@ -339,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)), @@ -371,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()), @@ -389,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( @@ -400,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()), @@ -426,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/weapons/reserve_calc.rs b/src/weapons/reserve_calc.rs index 1e54529e..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 @@ -61,6 +59,8 @@ enum ReserveIDs { TwoTailedFox, Winterbite, 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,136 +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, @@ -265,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, @@ -279,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, @@ -338,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, @@ -347,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, From 0371504efa584a606c439657a43e0a5c55f91887 Mon Sep 17 00:00:00 2001 From: oh-yes-0-fps Date: Tue, 23 Apr 2024 09:21:31 -0400 Subject: [PATCH 5/7] silly goofball --- src/activity/damage_calc.rs | 4 +- src/perks/buff_perks.rs | 20 +-- src/perks/mod.rs | 240 ++++++++++++++++++------------------ 3 files changed, 132 insertions(+), 132 deletions(-) diff --git a/src/activity/damage_calc.rs b/src/activity/damage_calc.rs index 703e4d51..8b7daf93 100644 --- a/src/activity/damage_calc.rs +++ b/src/activity/damage_calc.rs @@ -92,8 +92,8 @@ 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 { diff --git a/src/perks/buff_perks.rs b/src/perks/buff_perks.rs index 0b9002bc..795e1c88 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 { +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 { + 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, @@ -44,13 +44,13 @@ fn surge_buff(cached_data: &mut HashMap, _value: u32, _pvp: bool) - } } -fn gbl_debuff(_cached_data: &mut HashMap, _desired_buff: f64) -> f64 { +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 { + 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 } } diff --git a/src/perks/mod.rs b/src/perks/mod.rs index c8d65e9f..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() { - if _hash == *h { + if hash == *h { result = *r; found = true; break; @@ -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); From aa31a5685c12a8b10a3b1ab78f26df395f69f826 Mon Sep 17 00:00:00 2001 From: oh-yes-0-fps Date: Tue, 23 Apr 2024 09:30:23 -0400 Subject: [PATCH 6/7] bleh :3 --- src/perks/buff_perks.rs | 6 +- src/weapons/stat_calc.rs | 190 +++++++++++++++++++-------------------- 2 files changed, 98 insertions(+), 98 deletions(-) diff --git a/src/perks/buff_perks.rs b/src/perks/buff_perks.rs index 795e1c88..626e5ec2 100644 --- a/src/perks/buff_perks.rs +++ b/src/perks/buff_perks.rs @@ -44,12 +44,12 @@ fn surge_buff(cached_data: &mut HashMap, value: u32, pvp: bool) -> } } -fn gbl_debuff(_cached_data: &mut HashMap, desired_buff: f64) -> f64 { - let current_buff = _cached_data.get("debuff").unwrap_or(&1.0).to_owned(); +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); + cached_data.insert("debuff".to_string(), desired_buff); desired_buff / current_buff } } diff --git a/src/weapons/stat_calc.rs b/src/weapons/stat_calc.rs index 0574eeaa..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 @@ -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)), ); }; From a3ef69e953d68820ba4c9122e9dbc600b6483868 Mon Sep 17 00:00:00 2001 From: oh-yes-0-fps Date: Tue, 23 Apr 2024 10:12:06 -0400 Subject: [PATCH 7/7] RAAHHHHH --- src/perks/lib.rs | 130 ++++++++++++++++++++++++----------------------- 1 file changed, 67 insertions(+), 63 deletions(-) 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 } } }