mirror of
https://github.com/jugeeya/UltimateTrainingModpack.git
synced 2025-02-17 14:40:31 +00:00
Update Character Specifics / Fast Fall (#112)
* Add Module Added separate module for character specific handling * Formatting * Update Fast Fall Updated status check Check against possible statuses instead of impossible ones * Add Character Check * Apply Character Check
This commit is contained in:
parent
2dc8b1b5b9
commit
2aba252f10
5 changed files with 94 additions and 25 deletions
37
src/training/character_specific/bowser.rs
Normal file
37
src/training/character_specific/bowser.rs
Normal file
|
@ -0,0 +1,37 @@
|
|||
use smash::app::{self};
|
||||
use smash::lib::lua_const::*;
|
||||
|
||||
pub fn check_up_b(
|
||||
module_accessor: &mut app::BattleObjectModuleAccessor,
|
||||
current_status: i32,
|
||||
expected_status: i32,
|
||||
) -> bool {
|
||||
if !is_bowser(module_accessor){
|
||||
return false;
|
||||
}
|
||||
|
||||
if expected_status != *FIGHTER_STATUS_KIND_SPECIAL_HI {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Grounded up B
|
||||
if current_status == *FIGHTER_KOOPA_STATUS_KIND_SPECIAL_HI_G {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Aerial up B
|
||||
if current_status == *FIGHTER_KOOPA_STATUS_KIND_SPECIAL_HI_A {
|
||||
return true;
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
|
||||
fn is_bowser(module_accessor: &mut app::BattleObjectModuleAccessor) -> bool {
|
||||
let fighter_id;
|
||||
unsafe {
|
||||
fighter_id = app::utility::get_kind(module_accessor);
|
||||
}
|
||||
|
||||
fighter_id == *FIGHTER_KIND_KOOPA
|
||||
}
|
14
src/training/character_specific/mod.rs
Normal file
14
src/training/character_specific/mod.rs
Normal file
|
@ -0,0 +1,14 @@
|
|||
use smash::app::{self};
|
||||
|
||||
mod bowser;
|
||||
|
||||
/**
|
||||
* Checks if the current status matches the expected status
|
||||
*/
|
||||
pub fn check_status(module_accessor: &mut app::BattleObjectModuleAccessor, current_status: i32, expected_status: i32) -> bool {
|
||||
if bowser::check_up_b(module_accessor, current_status, expected_status) {
|
||||
return true;
|
||||
}
|
||||
|
||||
false
|
||||
}
|
|
@ -44,8 +44,7 @@ pub unsafe fn get_command_flag_cat(
|
|||
return;
|
||||
}
|
||||
|
||||
// Can't fastfall in hitstun // tumble // meteor
|
||||
if is_in_hitstun(module_accessor) {
|
||||
if !is_correct_status(module_accessor) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -55,7 +54,7 @@ pub unsafe fn get_command_flag_cat(
|
|||
}
|
||||
|
||||
// Check delay
|
||||
if frame_counter::should_delay(MENU.fast_fall_delay,FRAME_COUNTER) {
|
||||
if frame_counter::should_delay(MENU.fast_fall_delay, FRAME_COUNTER) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -69,12 +68,40 @@ pub unsafe fn get_command_flag_cat(
|
|||
add_spark_effect(module_accessor);
|
||||
}
|
||||
|
||||
pub fn is_falling(module_accessor: &mut app::BattleObjectModuleAccessor) -> bool {
|
||||
/**
|
||||
* Returns true for viable fast fall status
|
||||
*/
|
||||
fn is_correct_status(module_accessor: &mut app::BattleObjectModuleAccessor) -> bool {
|
||||
let status;
|
||||
|
||||
unsafe {
|
||||
let y_speed =
|
||||
KineticModule::get_sum_speed_y(module_accessor, *FIGHTER_KINETIC_ENERGY_ID_GRAVITY);
|
||||
y_speed < 0.0 && StatusModule::status_kind(module_accessor) == FIGHTER_STATUS_KIND_FALL
|
||||
status = StatusModule::status_kind(module_accessor);
|
||||
}
|
||||
|
||||
// Allow fast fall when falling
|
||||
if status == FIGHTER_STATUS_KIND_FALL {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Allow fast fall during aerials
|
||||
if status == FIGHTER_STATUS_KIND_ATTACK_AIR {
|
||||
return true;
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the character is moving downwards
|
||||
*/
|
||||
pub fn is_falling(module_accessor: &mut app::BattleObjectModuleAccessor) -> bool {
|
||||
let y_speed;
|
||||
unsafe {
|
||||
y_speed =
|
||||
KineticModule::get_sum_speed_y(module_accessor, *FIGHTER_KINETIC_ENERGY_ID_GRAVITY);
|
||||
}
|
||||
|
||||
y_speed < 0.0
|
||||
}
|
||||
|
||||
unsafe fn add_spark_effect(module_accessor: &mut app::BattleObjectModuleAccessor) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use crate::common::consts::*;
|
||||
use crate::common::*;
|
||||
use crate::training::character_specific;
|
||||
use crate::training::fast_fall;
|
||||
use crate::training::shield;
|
||||
use smash::app::{self, lua_bind::*};
|
||||
|
@ -383,35 +384,24 @@ unsafe fn get_aerial_flag(
|
|||
*/
|
||||
unsafe fn get_flag(
|
||||
module_accessor: &mut app::BattleObjectModuleAccessor,
|
||||
status: i32,
|
||||
expected_status: i32,
|
||||
action_flag: i32,
|
||||
) -> i32 {
|
||||
// let current_status = StatusModule::prev_status_kind(module_accessor,0);
|
||||
let current_status = StatusModule::status_kind(module_accessor);
|
||||
if current_status == status {
|
||||
if current_status == expected_status {
|
||||
// Reset Buffer
|
||||
reset();
|
||||
}
|
||||
|
||||
// Workaround for Bowser upB
|
||||
check_bowser_up_b(current_status);
|
||||
// Workaround for Character specific status
|
||||
if character_specific::check_status(module_accessor, current_status, expected_status) {
|
||||
reset();
|
||||
}
|
||||
|
||||
return action_flag;
|
||||
}
|
||||
|
||||
fn check_bowser_up_b(current_status: i32) {
|
||||
// Grounded up B
|
||||
if current_status == *FIGHTER_KOOPA_STATUS_KIND_SPECIAL_HI_G {
|
||||
reset();
|
||||
return;
|
||||
}
|
||||
|
||||
// Aerial up B
|
||||
if current_status == *FIGHTER_KOOPA_STATUS_KIND_SPECIAL_HI_A {
|
||||
reset();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
pub unsafe fn perform_defensive_option() {
|
||||
reset();
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ mod ledge;
|
|||
mod left_stick;
|
||||
mod mash;
|
||||
mod save_states;
|
||||
mod character_specific;
|
||||
|
||||
#[skyline::hook(replace = WorkModule::get_param_float)]
|
||||
pub unsafe fn handle_get_param_float(
|
||||
|
|
Loading…
Reference in a new issue