Skip to content

Commit 089f847

Browse files
committed
feat: pve_floor_percent
added for pellet shotty
1 parent 83f8257 commit 089f847

File tree

4 files changed

+21
-8
lines changed

4 files changed

+21
-8
lines changed

build.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,8 @@ pub struct RangeFormula {
573573
pub end: StatQuadraticFormula,
574574
pub floor_percent: f64,
575575
#[serde(default)]
576+
pub pve_floor_percent: Option<f64>,
577+
#[serde(default)]
576578
pub fusion: bool,
577579
#[serde(default)]
578580
pub timestamp: u64,
@@ -603,6 +605,7 @@ impl From<RangeJson> for RangeFormula {
603605
start,
604606
end,
605607
floor_percent: value.floor_percent,
608+
pve_floor_percent: value.pve_floor_percent,
606609
fusion: value.fusion.unwrap_or_default(),
607610
timestamp: 0,
608611
}
@@ -770,6 +773,8 @@ struct RangeJson {
770773
vpp_end: f64,
771774
offset_end: f64,
772775
floor_percent: f64,
776+
#[serde(default)]
777+
pve_floor_percent: Option<f64>,
773778
fusion: Option<bool>,
774779
}
775780

build_resources/weapon_formulas.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@
926926
"3787406018": {"name": "Conditional Finality", "cat": "default", "subFam": "Conditional", "magProf": "conditional", "pve":1.245},
927927
"cat": {
928928
"default": {
929-
"range": {"vpp_start": 0.0294,"offset_start": 3.77,"vpp_end": 0.0,"offset_end": 14.5, "floor_percent": 0.001},
929+
"range": {"vpp_start": 0.0294,"offset_start": 3.77,"vpp_end": 0.0,"offset_end": 14.5, "floor_percent": 0.001, "pve_floor_percent": 0.4},
930930
"reload": {"evpp": 0.0000640462, "vpp": -0.0141721, "offset": 1.25061},
931931
"handling": {
932932
"ready":{"vpp": -0.003271255061, "offset": 0.5388744939},

src/types/rs_types.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ pub struct RangeFormula {
7575
pub start: StatQuadraticFormula,
7676
pub end: StatQuadraticFormula,
7777
pub floor_percent: f64,
78+
pub pve_floor_percent: Option<f64>,
7879
pub fusion: bool,
7980
pub timestamp: u64,
8081
}

src/weapons/stat_calc.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,19 +115,26 @@ impl Weapon {
115115
.unwrap_or(&Stat::new())
116116
.val();
117117
let ads_mult = get_ads_multiplier(self.weapon_type, self.intrinsic_hash).unwrap_or(1.0);
118-
118+
119119
let modifiers = if let Some(calc_input) = _calc_input {
120120
get_range_modifier(self.list_perks(), &calc_input, _pvp, cached_data)
121121
} else {
122122
RangeModifierResponse::default()
123123
};
124124

125-
self.range_formula.calc_range_falloff_formula(
126-
range_stat,
127-
ads_mult,
128-
modifiers,
129-
self.range_formula.floor_percent,
130-
)
125+
let pve_floor = self
126+
.range_formula
127+
.pve_floor_percent
128+
.unwrap_or(self.range_formula.floor_percent);
129+
130+
let floor = if _pvp {
131+
self.range_formula.floor_percent
132+
} else {
133+
pve_floor
134+
};
135+
136+
self.range_formula
137+
.calc_range_falloff_formula(range_stat, ads_mult, modifiers, floor)
131138
}
132139
}
133140

0 commit comments

Comments
 (0)