1
0
Fork 0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2025-01-19 17:00:15 +00:00

OoS quick fixes

This commit is contained in:
jugeeya 2020-05-15 08:48:34 -07:00
parent fb0c650a91
commit 376985e05d
4 changed files with 61 additions and 43 deletions

View file

@ -13,7 +13,7 @@ use crate::common::consts::*;
use crate::common::*; use crate::common::*;
use skyline::c_str; use skyline::c_str;
use skyline::libc::{c_void, fclose, fopen, fwrite}; use skyline::libc::{c_void, mkdir, fclose, fopen, fwrite};
use skyline::nro::{self, NroInfo}; use skyline::nro::{self, NroInfo};
use smash::app::lua_bind::*; use smash::app::lua_bind::*;
use smash::app::sv_system::{self}; use smash::app::sv_system::{self};
@ -25,35 +25,63 @@ use smash::lua2cpp::L2CFighterCommon;
#[skyline::hook(replace = smash::lua2cpp::L2CFighterCommon_sub_guard_cont)] #[skyline::hook(replace = smash::lua2cpp::L2CFighterCommon_sub_guard_cont)]
pub unsafe fn handle_sub_guard_cont(fighter: &mut L2CFighterCommon) -> L2CValue { pub unsafe fn handle_sub_guard_cont(fighter: &mut L2CFighterCommon) -> L2CValue {
let module_accessor = sv_system::battle_object_module_accessor(fighter.lua_state_agent); let module_accessor = sv_system::battle_object_module_accessor(fighter.lua_state_agent);
if (*menu).MASH_STATE == MASH_ATTACK && (*menu).ATTACK_STATE == MASH_GRAB { if is_training_mode() && is_operation_cpu(module_accessor) {
if StatusModule::prev_status_kind(module_accessor, 0) == FIGHTER_STATUS_KIND_GUARD_DAMAGE { if (*menu).MASH_STATE == MASH_ATTACK && (*menu).ATTACK_STATE == MASH_GRAB {
if WorkModule::get_int( if StatusModule::prev_status_kind(module_accessor, 0) == FIGHTER_STATUS_KIND_GUARD_DAMAGE {
module_accessor, if WorkModule::get_int(
*FIGHTER_INSTANCE_WORK_ID_INT_INVALID_CATCH_FRAME, module_accessor,
) == 0 *FIGHTER_INSTANCE_WORK_ID_INT_INVALID_CATCH_FRAME,
{ ) == 0
{
if WorkModule::is_enable_transition_term(
module_accessor,
*FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_CATCH,
) {
fighter.fighter_base.change_status(
L2CValue::new_int(*FIGHTER_STATUS_KIND_CATCH as u64),
L2CValue::new_bool(true),
);
}
}
}
}
if (*menu).MASH_STATE == MASH_SPOTDODGE {
if StatusModule::prev_status_kind(module_accessor, 0) == FIGHTER_STATUS_KIND_GUARD_DAMAGE {
if WorkModule::is_enable_transition_term( if WorkModule::is_enable_transition_term(
module_accessor, module_accessor,
*FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_CATCH, *FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_ESCAPE,
) { ) {
fighter.fighter_base.change_status( fighter.fighter_base.change_status(
L2CValue::new_int(*FIGHTER_STATUS_KIND_CATCH as u64), L2CValue::new_int(*FIGHTER_STATUS_KIND_ESCAPE as u64),
L2CValue::new_bool(true), L2CValue::new_bool(true),
); );
} }
} }
} }
} if (*menu).MASH_STATE == MASH_UP_B {
if (*menu).MASH_STATE == MASH_SPOTDODGE { if StatusModule::prev_status_kind(module_accessor, 0) == FIGHTER_STATUS_KIND_GUARD_DAMAGE {
if StatusModule::prev_status_kind(module_accessor, 0) == FIGHTER_STATUS_KIND_GUARD_DAMAGE { // if WorkModule::is_enable_transition_term(
if WorkModule::is_enable_transition_term( // module_accessor,
module_accessor, // *FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_JUMP_SQUAT_BUTTON,
*FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_ESCAPE, // ) {
) { fighter.fighter_base.change_status(
fighter.fighter_base.change_status( L2CValue::new_int(*FIGHTER_STATUS_KIND_SPECIAL_HI as u64),
L2CValue::new_int(*FIGHTER_STATUS_KIND_ESCAPE as u64), L2CValue::new_bool(false),
L2CValue::new_bool(true), );
); // }
}
}
if (*menu).MASH_STATE == MASH_UP_SMASH {
if StatusModule::prev_status_kind(module_accessor, 0) == FIGHTER_STATUS_KIND_GUARD_DAMAGE {
// if WorkModule::is_enable_transition_term(
// module_accessor,
// *FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_JUMP_SQUAT_BUTTON,
// ) {
fighter.fighter_base.change_status(
L2CValue::new_int(*FIGHTER_STATUS_KIND_ATTACK_HI4_START as u64),
L2CValue::new_bool(false),
);
// }
} }
} }
} }
@ -81,8 +109,9 @@ pub fn main() {
common::menu = &mut common::menu_struct; common::menu = &mut common::menu_struct;
let buffer = format!("{:x}", common::menu as u64); let buffer = format!("{:x}", common::menu as u64);
println!("Writing training_modpack.log with {}...\n", buffer); println!("Writing training_modpack.log with {}...\n", buffer);
mkdir("sd:/TrainingModpack/\u{0}".as_bytes().as_ptr(), 0777);
let f = fopen( let f = fopen(
"sd:/SaltySD/training_modpack.log\u{0}".as_bytes().as_ptr(), "sd:/TrainingModpack/training_modpack.log\u{0}".as_bytes().as_ptr(),
"w\u{0}".as_bytes().as_ptr(), "w\u{0}".as_bytes().as_ptr(),
); );

View file

@ -73,10 +73,6 @@ pub unsafe fn get_command_flag_cat(
MASH_GRAB => *flag |= *FIGHTER_PAD_CMD_CAT1_FLAG_CATCH, MASH_GRAB => *flag |= *FIGHTER_PAD_CMD_CAT1_FLAG_CATCH,
_ => (), _ => (),
} }
} else if category == 1 {
if (*menu).ATTACK_STATE == MASH_GRAB {
*flag |= *FIGHTER_PAD_CMD_CAT1_FLAG_CATCH;
}
} }
} }
MASH_RANDOM => { MASH_RANDOM => {
@ -152,16 +148,5 @@ pub unsafe fn check_button_on(
} }
} }
if [*CONTROL_PAD_BUTTON_ATTACK, *CONTROL_PAD_BUTTON_CATCH].contains(&button) {
if is_training_mode() && is_operation_cpu(module_accessor) {
if (*menu).MASH_STATE == MASH_ATTACK
&& (*menu).ATTACK_STATE == MASH_GRAB
&& is_in_shieldstun(module_accessor)
{
return Some(true);
}
}
}
None None
} }

View file

@ -44,6 +44,10 @@ pub unsafe fn should_hold_shield(module_accessor: &mut app::BattleObjectModuleAc
// We will only drop shield if we are in shieldstun and our attack can be performed OOS // We will only drop shield if we are in shieldstun and our attack can be performed OOS
if (*menu).MASH_STATE == MASH_ATTACK { if (*menu).MASH_STATE == MASH_ATTACK {
if [MASH_NEUTRAL_B, MASH_SIDE_B, MASH_DOWN_B].contains(&(*menu).ATTACK_STATE) { if [MASH_NEUTRAL_B, MASH_SIDE_B, MASH_DOWN_B].contains(&(*menu).ATTACK_STATE) {
return false;
}
if [MASH_SPOTDODGE, MASH_GRAB].contains(&(*menu).ATTACK_STATE) {
return true; return true;
} }
} }

View file

@ -68,12 +68,12 @@ pub unsafe fn should_perform_defensive_option(
*FIGHTER_STATUS_KIND_DOWN_STAND_ATTACK, *FIGHTER_STATUS_KIND_DOWN_STAND_ATTACK,
] ]
.contains(&prev_status) .contains(&prev_status)
// || [ || [
// *FIGHTER_STATUS_KIND_DOWN_STAND, *FIGHTER_STATUS_KIND_DOWN_STAND,
// *FIGHTER_STATUS_KIND_DOWN_STAND_FB, *FIGHTER_STATUS_KIND_DOWN_STAND_FB,
// *FIGHTER_STATUS_KIND_DOWN_STAND_ATTACK, *FIGHTER_STATUS_KIND_DOWN_STAND_ATTACK,
// ] ]
// .contains(&status) .contains(&status)
) )
&& ( && (
WorkModule::is_enable_transition_term( WorkModule::is_enable_transition_term(