1
0
Fork 0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2024-11-28 04:44:06 +00:00

Don't tech untechables (#442)

This commit is contained in:
asimon-1 2022-12-12 22:55:15 -05:00 committed by GitHub
parent a69dc8c096
commit 1c5a5a71fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 4 deletions

View file

@ -42,6 +42,7 @@ fn nro_main(nro: &NroInfo<'_>) {
training::shield::handle_sub_guard_cont, training::shield::handle_sub_guard_cont,
training::directional_influence::handle_correct_damage_vector_common, training::directional_influence::handle_correct_damage_vector_common,
training::tech::handle_change_status, training::tech::handle_change_status,
training::tech::mod_is_enable_passive,
); );
} }
} }

View file

@ -6,11 +6,12 @@ use smash::app::{self, lua_bind::*};
use smash::hash40; use smash::hash40;
use smash::lib::lua_const::*; use smash::lib::lua_const::*;
use smash::lib::L2CValue; use smash::lib::L2CValue;
use smash::lua2cpp::L2CFighterBase; use smash::lua2cpp::{L2CFighterBase, L2CFighterCommon};
static mut TECH_ROLL_DIRECTION: Direction = Direction::empty(); static mut TECH_ROLL_DIRECTION: Direction = Direction::empty();
static mut MISS_TECH_ROLL_DIRECTION: Direction = Direction::empty(); static mut MISS_TECH_ROLL_DIRECTION: Direction = Direction::empty();
static mut FRAME_COUNTER: usize = 0; static mut FRAME_COUNTER: usize = 0;
static mut CAN_TECH: bool = false;
pub fn init() { pub fn init() {
unsafe { unsafe {
@ -18,6 +19,18 @@ pub fn init() {
} }
} }
#[skyline::hook(replace = smash::lua2cpp::L2CFighterCommon_is_enable_passive)]
pub unsafe fn mod_is_enable_passive(
fighter: &mut L2CFighterCommon,
) -> L2CValue {
let ori = original!()(fighter);
let module_accessor = sv_system::battle_object_module_accessor(fighter.lua_state_agent);
if is_training_mode() && is_operation_cpu(module_accessor) {
CAN_TECH = ori.get_bool();
}
ori
}
#[skyline::hook(replace = smash::lua2cpp::L2CFighterBase_change_status)] #[skyline::hook(replace = smash::lua2cpp::L2CFighterBase_change_status)]
pub unsafe fn handle_change_status( pub unsafe fn handle_change_status(
fighter: &mut L2CFighterBase, fighter: &mut L2CFighterBase,
@ -83,7 +96,9 @@ unsafe fn handle_grnd_tech(
let can_tech = WorkModule::is_enable_transition_term( let can_tech = WorkModule::is_enable_transition_term(
module_accessor, module_accessor,
*FIGHTER_STATUS_TRANSITION_TERM_ID_PASSIVE, *FIGHTER_STATUS_TRANSITION_TERM_ID_PASSIVE,
) && (second_prev_status != FIGHTER_STATUS_KIND_CATCHED_AIR_FALL_GANON); )
&& (second_prev_status != FIGHTER_STATUS_KIND_CATCHED_AIR_FALL_GANON)
&& CAN_TECH;
if !can_tech { if !can_tech {
return false; return false;
@ -126,7 +141,7 @@ unsafe fn handle_wall_tech(
let can_tech = WorkModule::is_enable_transition_term( let can_tech = WorkModule::is_enable_transition_term(
module_accessor, module_accessor,
*FIGHTER_STATUS_TRANSITION_TERM_ID_PASSIVE_WALL, *FIGHTER_STATUS_TRANSITION_TERM_ID_PASSIVE_WALL,
); ) && CAN_TECH;
if ![ if ![
*FIGHTER_STATUS_KIND_STOP_WALL, *FIGHTER_STATUS_KIND_STOP_WALL,
@ -168,7 +183,7 @@ unsafe fn handle_ceil_tech(
let can_tech = WorkModule::is_enable_transition_term( let can_tech = WorkModule::is_enable_transition_term(
module_accessor, module_accessor,
*FIGHTER_STATUS_TRANSITION_TERM_ID_PASSIVE_CEIL, *FIGHTER_STATUS_TRANSITION_TERM_ID_PASSIVE_CEIL,
); ) && CAN_TECH;
if ![ if ![
*FIGHTER_STATUS_KIND_STOP_CEIL, *FIGHTER_STATUS_KIND_STOP_CEIL,