mirror of
https://github.com/jugeeya/UltimateTrainingModpack.git
synced 2024-11-30 22:00:16 +00:00
Code Formatting (#82)
* Update TrainingModpackOverlay * Apply Auto Formatter
This commit is contained in:
parent
4363935a1d
commit
b3cf1a69f4
12 changed files with 144 additions and 113 deletions
|
@ -1 +1 @@
|
|||
Subproject commit 5a5350b52d53dec2ae3c1aa1ab0a158731daf640
|
||||
Subproject commit 036171692ee4c704d6794f7c263509c316f48a9c
|
|
@ -31,7 +31,7 @@ pub enum Attack {
|
|||
UpB = 7,
|
||||
DownB = 8,
|
||||
UpSmash = 9,
|
||||
Grab = 10
|
||||
Grab = 10,
|
||||
}
|
||||
|
||||
impl From<i32> for Attack {
|
||||
|
@ -50,7 +50,7 @@ impl From<i32> for Attack {
|
|||
8 => DownB,
|
||||
9 => UpSmash,
|
||||
10 => Grab,
|
||||
_ => panic!("Invalid mash attack state {}", x)
|
||||
_ => panic!("Invalid mash attack state {}", x),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -59,16 +59,14 @@ impl Attack {
|
|||
pub fn into_attack_air_kind(&self) -> Option<i32> {
|
||||
use Attack::*;
|
||||
|
||||
Some(
|
||||
match self {
|
||||
Nair => *FIGHTER_COMMAND_ATTACK_AIR_KIND_N,
|
||||
Fair => *FIGHTER_COMMAND_ATTACK_AIR_KIND_F,
|
||||
Bair => *FIGHTER_COMMAND_ATTACK_AIR_KIND_B,
|
||||
Dair => *FIGHTER_COMMAND_ATTACK_AIR_KIND_LW,
|
||||
UpAir => *FIGHTER_COMMAND_ATTACK_AIR_KIND_HI,
|
||||
_ => return None,
|
||||
}
|
||||
)
|
||||
Some(match self {
|
||||
Nair => *FIGHTER_COMMAND_ATTACK_AIR_KIND_N,
|
||||
Fair => *FIGHTER_COMMAND_ATTACK_AIR_KIND_F,
|
||||
Bair => *FIGHTER_COMMAND_ATTACK_AIR_KIND_B,
|
||||
Dair => *FIGHTER_COMMAND_ATTACK_AIR_KIND_LW,
|
||||
UpAir => *FIGHTER_COMMAND_ATTACK_AIR_KIND_HI,
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,22 +93,20 @@ impl From<i32> for LedgeOption {
|
|||
3 => Roll,
|
||||
4 => Jump,
|
||||
5 => Attack,
|
||||
_ => panic!("Invalid ledge option {}", x)
|
||||
_ => panic!("Invalid ledge option {}", x),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl LedgeOption {
|
||||
pub fn into_status(&self) -> Option<i32> {
|
||||
Some(
|
||||
match self {
|
||||
LedgeOption::Neutral => *FIGHTER_STATUS_KIND_CLIFF_CLIMB,
|
||||
LedgeOption::Roll => *FIGHTER_STATUS_KIND_CLIFF_ESCAPE,
|
||||
LedgeOption::Jump => *FIGHTER_STATUS_KIND_CLIFF_JUMP1,
|
||||
LedgeOption::Attack => *FIGHTER_STATUS_KIND_CLIFF_ATTACK,
|
||||
_ => return None,
|
||||
}
|
||||
)
|
||||
Some(match self {
|
||||
LedgeOption::Neutral => *FIGHTER_STATUS_KIND_CLIFF_CLIMB,
|
||||
LedgeOption::Roll => *FIGHTER_STATUS_KIND_CLIFF_ESCAPE,
|
||||
LedgeOption::Jump => *FIGHTER_STATUS_KIND_CLIFF_JUMP1,
|
||||
LedgeOption::Attack => *FIGHTER_STATUS_KIND_CLIFF_ATTACK,
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,7 +118,7 @@ pub enum TechOption {
|
|||
Random = 1,
|
||||
InPlace = 2,
|
||||
Roll = 3,
|
||||
Miss = 4
|
||||
Miss = 4,
|
||||
}
|
||||
|
||||
impl From<i32> for TechOption {
|
||||
|
@ -135,7 +131,7 @@ impl From<i32> for TechOption {
|
|||
2 => InPlace,
|
||||
3 => Roll,
|
||||
4 => Miss,
|
||||
_ => panic!("Invalid tech option {}", x)
|
||||
_ => panic!("Invalid tech option {}", x),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -165,7 +161,7 @@ impl From<i32> for Mash {
|
|||
5 => Mash::RollForward,
|
||||
6 => Mash::RollBack,
|
||||
7 => Mash::Random,
|
||||
_ => panic!("Invalid mash state {}", x)
|
||||
_ => panic!("Invalid mash state {}", x),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -202,7 +198,7 @@ impl From<i32> for Defensive {
|
|||
3 => Roll,
|
||||
4 => Jab,
|
||||
5 => Shield,
|
||||
_ => panic!("Invalid mash state {}", x)
|
||||
_ => panic!("Invalid mash state {}", x),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@ pub mod consts;
|
|||
|
||||
use crate::common::consts::*;
|
||||
use smash::app::{self, lua_bind::*};
|
||||
use smash::lib::lua_const::*;
|
||||
use smash::hash40;
|
||||
use smash::lib::lua_const::*;
|
||||
|
||||
pub static mut MENU_STRUCT: consts::TrainingModpackMenu = consts::TrainingModpackMenu {
|
||||
hitbox_vis: true,
|
||||
|
@ -25,8 +25,8 @@ extern "C" {
|
|||
#[link_name = "\u{1}_ZN3app9smashball16is_training_modeEv"]
|
||||
pub fn is_training_mode() -> bool;
|
||||
|
||||
//#[link_name = "\u{1}_ZN3app7utility8get_kindEPKNS_26BattleObjectModuleAccessorE"]
|
||||
//pub fn get_kind(module_accessor: &mut app::BattleObjectModuleAccessor) -> i32;
|
||||
//#[link_name = "\u{1}_ZN3app7utility8get_kindEPKNS_26BattleObjectModuleAccessorE"]
|
||||
//pub fn get_kind(module_accessor: &mut app::BattleObjectModuleAccessor) -> i32;
|
||||
}
|
||||
|
||||
pub fn get_category(module_accessor: &mut app::BattleObjectModuleAccessor) -> i32 {
|
||||
|
@ -46,7 +46,8 @@ pub unsafe fn is_operation_cpu(module_accessor: &mut app::BattleObjectModuleAcce
|
|||
WorkModule::get_int(module_accessor, *FIGHTER_INSTANCE_WORK_ID_INT_ENTRY_ID) as i32;
|
||||
let entry_id = app::FighterEntryID(entry_id_int);
|
||||
let mgr = *(FIGHTER_MANAGER_ADDR as *mut *mut app::FighterManager);
|
||||
let fighter_information = FighterManager::get_fighter_information( mgr, entry_id) as *mut app::FighterInformation;
|
||||
let fighter_information =
|
||||
FighterManager::get_fighter_information(mgr, entry_id) as *mut app::FighterInformation;
|
||||
|
||||
FighterInformation::is_operation_cpu(fighter_information)
|
||||
}
|
||||
|
@ -72,7 +73,8 @@ pub unsafe fn is_in_shieldstun(module_accessor: &mut app::BattleObjectModuleAcce
|
|||
|
||||
pub unsafe fn is_in_landing(module_accessor: &mut app::BattleObjectModuleAccessor) -> bool {
|
||||
let status_kind = StatusModule::status_kind(module_accessor);
|
||||
(*FIGHTER_STATUS_KIND_LANDING..=*FIGHTER_STATUS_KIND_LANDING_DAMAGE_LIGHT).contains(&status_kind)
|
||||
(*FIGHTER_STATUS_KIND_LANDING..=*FIGHTER_STATUS_KIND_LANDING_DAMAGE_LIGHT)
|
||||
.contains(&status_kind)
|
||||
}
|
||||
|
||||
pub unsafe fn is_in_footstool(module_accessor: &mut app::BattleObjectModuleAccessor) -> bool {
|
||||
|
|
|
@ -160,8 +160,12 @@ pub unsafe fn get_command_flag_cat(
|
|||
) {
|
||||
if is_training_mode() {
|
||||
// Pause Effect AnimCMD if hitbox visualization is active
|
||||
MotionAnimcmdModule::set_sleep_effect(module_accessor, MENU.hitbox_vis
|
||||
&& !((*FIGHTER_STATUS_KIND_CATCH..=*FIGHTER_STATUS_KIND_TREAD_FALL).contains(&StatusModule::status_kind(module_accessor))));
|
||||
MotionAnimcmdModule::set_sleep_effect(
|
||||
module_accessor,
|
||||
MENU.hitbox_vis
|
||||
&& !((*FIGHTER_STATUS_KIND_CATCH..=*FIGHTER_STATUS_KIND_TREAD_FALL)
|
||||
.contains(&StatusModule::status_kind(module_accessor))),
|
||||
);
|
||||
}
|
||||
|
||||
// apply only once per frame
|
||||
|
@ -170,17 +174,8 @@ pub unsafe fn get_command_flag_cat(
|
|||
if !(*FIGHTER_STATUS_KIND_CATCH..=*FIGHTER_STATUS_KIND_CATCH_TURN).contains(&status_kind)
|
||||
&& !is_shielding(module_accessor)
|
||||
{
|
||||
EffectModule::set_visible_kind(
|
||||
module_accessor,
|
||||
Hash40::new("sys_shield"),
|
||||
false,
|
||||
);
|
||||
EffectModule::kill_kind(
|
||||
module_accessor,
|
||||
Hash40::new("sys_shield"),
|
||||
false,
|
||||
true,
|
||||
);
|
||||
EffectModule::set_visible_kind(module_accessor, Hash40::new("sys_shield"), false);
|
||||
EffectModule::kill_kind(module_accessor, Hash40::new("sys_shield"), false, true);
|
||||
for i in 0..8 {
|
||||
if AttackModule::is_attack(module_accessor, i, false) {
|
||||
let attack_data = *AttackModule::attack_data(module_accessor, i, false);
|
||||
|
@ -312,17 +307,8 @@ pub unsafe fn handle_set_rebound(
|
|||
if is_training_mode() && rebound == false {
|
||||
// only if we're not shielding
|
||||
if !is_shielding(module_accessor) {
|
||||
EffectModule::set_visible_kind(
|
||||
module_accessor,
|
||||
Hash40::new("sys_shield"),
|
||||
false,
|
||||
);
|
||||
EffectModule::kill_kind(
|
||||
module_accessor,
|
||||
Hash40::new("sys_shield"),
|
||||
false,
|
||||
true,
|
||||
);
|
||||
EffectModule::set_visible_kind(module_accessor, Hash40::new("sys_shield"), false);
|
||||
EffectModule::kill_kind(module_accessor, Hash40::new("sys_shield"), false, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
11
src/lib.rs
11
src/lib.rs
|
@ -9,7 +9,7 @@ mod training;
|
|||
use crate::common::*;
|
||||
|
||||
use skyline::c_str;
|
||||
use skyline::libc::{c_void, mkdir, fclose, fopen, fwrite};
|
||||
use skyline::libc::{c_void, fclose, fopen, fwrite, mkdir};
|
||||
use skyline::nro::{self, NroInfo};
|
||||
|
||||
fn nro_main(nro: &NroInfo<'_>) {
|
||||
|
@ -34,10 +34,15 @@ pub fn main() {
|
|||
|
||||
unsafe {
|
||||
let buffer = format!("{:x}", MENU as *const _ as u64);
|
||||
println!("[Training Modpack] Writing training_modpack.log with {}...", buffer);
|
||||
println!(
|
||||
"[Training Modpack] Writing training_modpack.log with {}...",
|
||||
buffer
|
||||
);
|
||||
mkdir("sd:/TrainingModpack/\u{0}".as_bytes().as_ptr(), 0777);
|
||||
let f = fopen(
|
||||
"sd:/TrainingModpack/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(),
|
||||
);
|
||||
|
||||
|
|
|
@ -1,17 +1,20 @@
|
|||
use crate::common::*;
|
||||
use crate::common::consts::*;
|
||||
use crate::common::*;
|
||||
use core::f64::consts::PI;
|
||||
use smash::app::{self, sv_system, lua_bind::*};
|
||||
use smash::app::{self, lua_bind::*, sv_system};
|
||||
use smash::hash40;
|
||||
use smash::lib::lua_const::*;
|
||||
use smash::lib::L2CValue;
|
||||
use smash::lua2cpp::L2CFighterCommon;
|
||||
|
||||
pub static mut DI_ANGLE : f64 = 0.0;
|
||||
pub static NO_DI : f64 = -69.0;
|
||||
pub static mut DI_ANGLE: f64 = 0.0;
|
||||
pub static NO_DI: f64 = -69.0;
|
||||
|
||||
#[skyline::hook(replace = smash::lua2cpp::L2CFighterCommon_FighterStatusDamage__correctDamageVectorCommon)]
|
||||
pub unsafe fn handle_correct_damage_vector_common(fighter: &mut L2CFighterCommon, arg1: L2CValue) -> L2CValue {
|
||||
pub unsafe fn handle_correct_damage_vector_common(
|
||||
fighter: &mut L2CFighterCommon,
|
||||
arg1: L2CValue,
|
||||
) -> L2CValue {
|
||||
let module_accessor = sv_system::battle_object_module_accessor(fighter.lua_state_agent);
|
||||
if is_training_mode() && is_operation_cpu(module_accessor) {
|
||||
if MENU.di_state != DirectionalInfluence::None {
|
||||
|
@ -19,7 +22,7 @@ pub unsafe fn handle_correct_damage_vector_common(fighter: &mut L2CFighterCommon
|
|||
|
||||
// Either left, right, or none
|
||||
if MENU.di_state == DirectionalInfluence::RandomInAway {
|
||||
let rand = app::sv_math::rand(hash40("fighter"), 3) ;
|
||||
let rand = app::sv_math::rand(hash40("fighter"), 3);
|
||||
// Either 0 (right) or PI (left)
|
||||
if [0, 1].contains(&rand) {
|
||||
DI_ANGLE = rand as f64 * PI;
|
||||
|
@ -33,8 +36,16 @@ pub unsafe fn handle_correct_damage_vector_common(fighter: &mut L2CFighterCommon
|
|||
}
|
||||
|
||||
if DI_ANGLE != NO_DI {
|
||||
WorkModule::set_float(module_accessor, DI_ANGLE.cos() as f32, *FIGHTER_STATUS_DAMAGE_WORK_FLOAT_VECOR_CORRECT_STICK_X);
|
||||
WorkModule::set_float(module_accessor, DI_ANGLE.sin() as f32, *FIGHTER_STATUS_DAMAGE_WORK_FLOAT_VECOR_CORRECT_STICK_Y);
|
||||
WorkModule::set_float(
|
||||
module_accessor,
|
||||
DI_ANGLE.cos() as f32,
|
||||
*FIGHTER_STATUS_DAMAGE_WORK_FLOAT_VECOR_CORRECT_STICK_X,
|
||||
);
|
||||
WorkModule::set_float(
|
||||
module_accessor,
|
||||
DI_ANGLE.sin() as f32,
|
||||
*FIGHTER_STATUS_DAMAGE_WORK_FLOAT_VECOR_CORRECT_STICK_Y,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,7 +91,10 @@ pub unsafe fn get_command_flag_cat(
|
|||
category: i32,
|
||||
flag: &mut i32,
|
||||
) {
|
||||
if MENU.ledge_state != LedgeOption::None && is_training_mode() && is_operation_cpu(module_accessor) {
|
||||
if MENU.ledge_state != LedgeOption::None
|
||||
&& is_training_mode()
|
||||
&& is_operation_cpu(module_accessor)
|
||||
{
|
||||
force_option(module_accessor);
|
||||
defensive_option(module_accessor, category, flag);
|
||||
}
|
||||
|
|
|
@ -153,7 +153,9 @@ pub unsafe fn check_button_on(
|
|||
if [*CONTROL_PAD_BUTTON_GUARD_HOLD, *CONTROL_PAD_BUTTON_GUARD].contains(&button) {
|
||||
if is_training_mode() && is_operation_cpu(module_accessor) {
|
||||
if MENU.mash_state == Mash::Airdodge
|
||||
&& (is_in_hitstun(module_accessor) || is_in_landing(module_accessor) || is_in_footstool(module_accessor))
|
||||
&& (is_in_hitstun(module_accessor)
|
||||
|| is_in_landing(module_accessor)
|
||||
|| is_in_footstool(module_accessor))
|
||||
{
|
||||
return Some(true);
|
||||
}
|
||||
|
|
|
@ -144,23 +144,21 @@ pub fn training_mods() {
|
|||
unsafe {
|
||||
LookupSymbol(
|
||||
&mut FIGHTER_MANAGER_ADDR,
|
||||
"_ZN3lib9SingletonIN3app14FighterManagerEE9instance_E\u{0}".as_bytes().as_ptr(),
|
||||
"_ZN3lib9SingletonIN3app14FighterManagerEE9instance_E\u{0}"
|
||||
.as_bytes()
|
||||
.as_ptr(),
|
||||
);
|
||||
}
|
||||
|
||||
skyline::install_hooks!(
|
||||
// Mash airdodge/jump
|
||||
handle_get_command_flag_cat,
|
||||
|
||||
// Hold/Infinite shield
|
||||
handle_check_button_on,
|
||||
handle_check_button_off,
|
||||
|
||||
handle_get_param_float,
|
||||
|
||||
// Mash attack
|
||||
handle_get_attack_air_kind,
|
||||
|
||||
// Tech options
|
||||
handle_change_motion,
|
||||
);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::common::*;
|
||||
use smash::app::{self, lua_bind::*};
|
||||
use smash::lib::lua_const::*;
|
||||
use smash::phx::{Vector3f, Hash40};
|
||||
use smash::phx::{Hash40, Vector3f};
|
||||
|
||||
#[derive(PartialEq)]
|
||||
enum SaveState {
|
||||
|
@ -68,8 +68,8 @@ pub unsafe fn save_states(module_accessor: &mut app::BattleObjectModuleAccessor)
|
|||
if *save_state == CameraMove {
|
||||
*save_state = PosMove;
|
||||
|
||||
let left_right =
|
||||
(PostureModule::pos_x(module_accessor) > 0.0) as i32 as f32 - (PostureModule::pos_x(module_accessor) < 0.0) as i32 as f32;
|
||||
let left_right = (PostureModule::pos_x(module_accessor) > 0.0) as i32 as f32
|
||||
- (PostureModule::pos_x(module_accessor) < 0.0) as i32 as f32;
|
||||
let y_pos = 20.0;
|
||||
|
||||
let pos = Vector3f {
|
||||
|
@ -81,7 +81,11 @@ pub unsafe fn save_states(module_accessor: &mut app::BattleObjectModuleAccessor)
|
|||
|
||||
// force aerial, because from aerial state we can move anywhere
|
||||
if StatusModule::situation_kind(module_accessor) == SITUATION_KIND_GROUND {
|
||||
StatusModule::change_status_request(module_accessor, *FIGHTER_STATUS_KIND_JUMP_SQUAT, false);
|
||||
StatusModule::change_status_request(
|
||||
module_accessor,
|
||||
*FIGHTER_STATUS_KIND_JUMP_SQUAT,
|
||||
false,
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -124,8 +128,7 @@ pub unsafe fn save_states(module_accessor: &mut app::BattleObjectModuleAccessor)
|
|||
*FIGHTER_STATUS_KIND_CLIFF_WAIT,
|
||||
false,
|
||||
);
|
||||
}
|
||||
else if *save_state_situation_kind == SITUATION_KIND_AIR
|
||||
} else if *save_state_situation_kind == SITUATION_KIND_AIR
|
||||
&& status != FIGHTER_STATUS_KIND_FALL
|
||||
{
|
||||
StatusModule::change_status_request(
|
||||
|
@ -133,8 +136,7 @@ pub unsafe fn save_states(module_accessor: &mut app::BattleObjectModuleAccessor)
|
|||
*FIGHTER_STATUS_KIND_FALL,
|
||||
false,
|
||||
);
|
||||
}
|
||||
else if *save_state_situation_kind == SITUATION_KIND_CLIFF
|
||||
} else if *save_state_situation_kind == SITUATION_KIND_CLIFF
|
||||
&& status != FIGHTER_STATUS_KIND_CLIFF_CATCH_MOVE
|
||||
&& status != FIGHTER_STATUS_KIND_CLIFF_CATCH
|
||||
{
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
use crate::common::consts::*;
|
||||
use crate::common::*;
|
||||
use smash::app;
|
||||
use smash::hash40;
|
||||
use smash::lib::lua_const::*;
|
||||
use smash::app::lua_bind::*;
|
||||
use smash::app::sv_system;
|
||||
use smash::hash40;
|
||||
use smash::lib::lua_const::*;
|
||||
use smash::lib::L2CValue;
|
||||
use smash::lua2cpp::L2CFighterCommon;
|
||||
|
||||
|
@ -154,8 +154,9 @@ pub unsafe fn handle_sub_guard_cont(fighter: &mut L2CFighterCommon) -> L2CValue
|
|||
|
||||
// Enable shield decay
|
||||
if is_training_mode()
|
||||
&& is_operation_cpu(module_accessor)
|
||||
&& StatusModule::prev_status_kind(module_accessor, 0) == FIGHTER_STATUS_KIND_GUARD_DAMAGE {
|
||||
&& is_operation_cpu(module_accessor)
|
||||
&& StatusModule::prev_status_kind(module_accessor, 0) == FIGHTER_STATUS_KIND_GUARD_DAMAGE
|
||||
{
|
||||
set_shield_decay(true);
|
||||
}
|
||||
|
||||
|
@ -169,7 +170,9 @@ pub unsafe fn handle_sub_guard_cont(fighter: &mut L2CFighterCommon) -> L2CValue
|
|||
|
||||
if is_training_mode() && is_operation_cpu(module_accessor) {
|
||||
if MENU.mash_state == Mash::Attack && MENU.mash_attack_state == Attack::Grab {
|
||||
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::get_int(
|
||||
module_accessor,
|
||||
*FIGHTER_INSTANCE_WORK_ID_INT_INVALID_CATCH_FRAME,
|
||||
|
@ -188,7 +191,9 @@ pub unsafe fn handle_sub_guard_cont(fighter: &mut L2CFighterCommon) -> L2CValue
|
|||
}
|
||||
}
|
||||
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(
|
||||
module_accessor,
|
||||
*FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_ESCAPE,
|
||||
|
@ -201,7 +206,9 @@ pub unsafe fn handle_sub_guard_cont(fighter: &mut L2CFighterCommon) -> L2CValue
|
|||
}
|
||||
}
|
||||
if MENU.mash_state == Mash::RollForward {
|
||||
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(
|
||||
module_accessor,
|
||||
*FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_ESCAPE,
|
||||
|
@ -214,7 +221,9 @@ pub unsafe fn handle_sub_guard_cont(fighter: &mut L2CFighterCommon) -> L2CValue
|
|||
}
|
||||
}
|
||||
if MENU.mash_state == Mash::RollBack {
|
||||
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(
|
||||
module_accessor,
|
||||
*FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_ESCAPE,
|
||||
|
@ -228,7 +237,9 @@ pub unsafe fn handle_sub_guard_cont(fighter: &mut L2CFighterCommon) -> L2CValue
|
|||
}
|
||||
if MENU.mash_state == Mash::Attack {
|
||||
if MENU.mash_attack_state == Attack::UpB {
|
||||
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(
|
||||
module_accessor,
|
||||
*FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_JUMP_SQUAT_BUTTON,
|
||||
|
@ -241,7 +252,9 @@ pub unsafe fn handle_sub_guard_cont(fighter: &mut L2CFighterCommon) -> L2CValue
|
|||
}
|
||||
}
|
||||
if MENU.mash_attack_state == Attack::UpSmash {
|
||||
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(
|
||||
module_accessor,
|
||||
*FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_JUMP_SQUAT_BUTTON,
|
||||
|
|
|
@ -1,20 +1,28 @@
|
|||
use crate::common::consts::*;
|
||||
use crate::common::*;
|
||||
use smash::app::sv_system;
|
||||
use smash::app::{self, lua_bind::*};
|
||||
use smash::hash40;
|
||||
use smash::lib::lua_const::*;
|
||||
use smash::app::sv_system;
|
||||
use smash::lib::L2CValue;
|
||||
use smash::lua2cpp::L2CFighterBase;
|
||||
|
||||
#[skyline::hook(replace = smash::lua2cpp::L2CFighterBase_change_status)]
|
||||
pub unsafe fn handle_change_status(fighter: &mut L2CFighterBase, status_kind: L2CValue, unk: L2CValue) -> L2CValue {
|
||||
pub unsafe fn handle_change_status(
|
||||
fighter: &mut L2CFighterBase,
|
||||
status_kind: L2CValue,
|
||||
unk: L2CValue,
|
||||
) -> L2CValue {
|
||||
let mut status_kind = status_kind;
|
||||
let mut unk = unk;
|
||||
let module_accessor = sv_system::battle_object_module_accessor(fighter.lua_state_agent);
|
||||
if is_training_mode() && is_operation_cpu(module_accessor) {
|
||||
let status_kind_int = status_kind.try_get_int().unwrap_or(*FIGHTER_STATUS_KIND_WAIT as u64) as i32;
|
||||
if status_kind_int == FIGHTER_STATUS_KIND_DOWN || status_kind_int == FIGHTER_STATUS_KIND_DAMAGE_FLY_REFLECT_D {
|
||||
let status_kind_int = status_kind
|
||||
.try_get_int()
|
||||
.unwrap_or(*FIGHTER_STATUS_KIND_WAIT as u64) as i32;
|
||||
if status_kind_int == FIGHTER_STATUS_KIND_DOWN
|
||||
|| status_kind_int == FIGHTER_STATUS_KIND_DAMAGE_FLY_REFLECT_D
|
||||
{
|
||||
match MENU.tech_state {
|
||||
TechOption::Random => {
|
||||
let random_statuses = vec![
|
||||
|
@ -27,7 +35,8 @@ pub unsafe fn handle_change_status(fighter: &mut L2CFighterBase, status_kind: L2
|
|||
app::sv_math::rand(hash40("fighter"), random_statuses.len() as i32)
|
||||
as usize;
|
||||
if random_statuses[random_status_index] != FIGHTER_STATUS_KIND_DOWN {
|
||||
status_kind = L2CValue::new_int(random_statuses[random_status_index] as u64);
|
||||
status_kind =
|
||||
L2CValue::new_int(random_statuses[random_status_index] as u64);
|
||||
unk = L2CValue::new_bool(true);
|
||||
}
|
||||
}
|
||||
|
@ -41,12 +50,16 @@ pub unsafe fn handle_change_status(fighter: &mut L2CFighterBase, status_kind: L2
|
|||
}
|
||||
_ => (),
|
||||
}
|
||||
} else if status_kind_int == FIGHTER_STATUS_KIND_STOP_WALL || status_kind_int == FIGHTER_STATUS_KIND_DAMAGE_FLY_REFLECT_LR {
|
||||
} else if status_kind_int == FIGHTER_STATUS_KIND_STOP_WALL
|
||||
|| status_kind_int == FIGHTER_STATUS_KIND_DAMAGE_FLY_REFLECT_LR
|
||||
{
|
||||
if MENU.tech_state != TechOption::None && MENU.tech_state != TechOption::Miss {
|
||||
status_kind = L2CValue::new_int(*FIGHTER_STATUS_KIND_PASSIVE_WALL as u64);
|
||||
unk = L2CValue::new_bool(true);
|
||||
}
|
||||
} else if status_kind_int == FIGHTER_STATUS_KIND_STOP_CEIL || status_kind_int == FIGHTER_STATUS_KIND_DAMAGE_FLY_REFLECT_U {
|
||||
} else if status_kind_int == FIGHTER_STATUS_KIND_STOP_CEIL
|
||||
|| status_kind_int == FIGHTER_STATUS_KIND_DAMAGE_FLY_REFLECT_U
|
||||
{
|
||||
if MENU.tech_state != TechOption::None && MENU.tech_state != TechOption::Miss {
|
||||
status_kind = L2CValue::new_int(*FIGHTER_STATUS_KIND_PASSIVE_CEIL as u64);
|
||||
unk = L2CValue::new_bool(true);
|
||||
|
@ -75,18 +88,12 @@ pub unsafe fn should_perform_defensive_option(
|
|||
*FIGHTER_STATUS_KIND_DOWN_STAND_FB,
|
||||
*FIGHTER_STATUS_KIND_DOWN_STAND_ATTACK,
|
||||
]
|
||||
.contains(&status)
|
||||
)
|
||||
&& (
|
||||
WorkModule::is_enable_transition_term(
|
||||
module_accessor,
|
||||
*FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_GUARD_ON,
|
||||
)
|
||||
||
|
||||
MotionModule::is_end(module_accessor)
|
||||
||
|
||||
CancelModule::is_enable_cancel(module_accessor)
|
||||
)
|
||||
.contains(&status))
|
||||
&& (WorkModule::is_enable_transition_term(
|
||||
module_accessor,
|
||||
*FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_GUARD_ON,
|
||||
) || MotionModule::is_end(module_accessor)
|
||||
|| CancelModule::is_enable_cancel(module_accessor))
|
||||
}
|
||||
|
||||
pub unsafe fn get_command_flag_cat(
|
||||
|
@ -94,7 +101,10 @@ pub unsafe fn get_command_flag_cat(
|
|||
_category: i32,
|
||||
flag: &mut i32,
|
||||
) {
|
||||
if MENU.tech_state != TechOption::None && is_training_mode() && is_operation_cpu(module_accessor) {
|
||||
if MENU.tech_state != TechOption::None
|
||||
&& is_training_mode()
|
||||
&& is_operation_cpu(module_accessor)
|
||||
{
|
||||
let prev_status = StatusModule::prev_status_kind(module_accessor, 0) as i32;
|
||||
let status = StatusModule::status_kind(module_accessor) as i32;
|
||||
if [
|
||||
|
@ -145,7 +155,10 @@ pub unsafe fn change_motion(
|
|||
module_accessor: &mut app::BattleObjectModuleAccessor,
|
||||
motion_kind: u64,
|
||||
) -> Option<u64> {
|
||||
if MENU.tech_state != TechOption::None && is_training_mode() && is_operation_cpu(module_accessor) {
|
||||
if MENU.tech_state != TechOption::None
|
||||
&& is_training_mode()
|
||||
&& is_operation_cpu(module_accessor)
|
||||
{
|
||||
if [hash40("passive_stand_f"), hash40("passive_stand_b")].contains(&motion_kind) {
|
||||
if app::sv_math::rand(hash40("fighter"), 2) != 0 {
|
||||
return Some(hash40("passive_stand_f"));
|
||||
|
|
Loading…
Reference in a new issue