Skip to content

Commit e615e10

Browse files
authored
Merge pull request HDR-Development#2331 from HDR-Development/hitlag-kb-scaling
Crash fix
2 parents 2c64c50 + abb3326 commit e615e10

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

fighters/common/src/function_hooks/attack.rs

+9-8
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,15 @@ unsafe fn set_weapon_hitlag(ctx: &mut skyline::hooks::InlineCtx) {
158158
#[skyline::hook(offset = 0x404658, inline)]
159159
unsafe fn set_fighter_hitlag(ctx: &mut skyline::hooks::InlineCtx) {
160160
let boma = &mut *(*ctx.registers[19].x.as_ref() as *mut BattleObjectModuleAccessor);
161-
162-
let hitlag = *ctx.registers[0].w.as_ref();
163-
let kb = DamageModule::reaction(boma, 0);
164-
let max_hitlag = WorkModule::get_param_float(boma, hash40("battle_object"), hash40("hitstop_frame_max"));
165-
let attr = *((*ctx.registers[20].x.as_ref() + 0xb8) as *mut u64);
166-
if ![hash40("collision_attr_paralyze"), hash40("collision_attr_saving")].contains(&attr) {
167-
// Set hitlag for defender
168-
*ctx.registers[0].w.as_mut() = (hitlag as f32 * (0.414 * std::f32::consts::E.powf(0.0063 * kb)).clamp(1.0, 2.0)).round().min(max_hitlag) as u32;
161+
if !boma.is_item() {
162+
let hitlag = *ctx.registers[0].w.as_ref();
163+
let kb = DamageModule::reaction(boma, 0);
164+
let max_hitlag = WorkModule::get_param_float(boma, hash40("battle_object"), hash40("hitstop_frame_max"));
165+
let attr = *((*ctx.registers[20].x.as_ref() + 0xb8) as *mut u64);
166+
if ![hash40("collision_attr_paralyze"), hash40("collision_attr_saving")].contains(&attr) {
167+
// Set hitlag for defender
168+
*ctx.registers[0].w.as_mut() = (hitlag as f32 * (0.414 * std::f32::consts::E.powf(0.0063 * kb)).clamp(1.0, 2.0)).round().min(max_hitlag) as u32;
169+
}
169170
}
170171
IS_KB_CALC_EARLY = false;
171172
}

0 commit comments

Comments
 (0)