1
0
Fork 0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2025-03-16 11:26:11 +00:00

Add Dash Attack (#119)

* Add Dash Attack

* Extract Method

try_change_status

* Code Formatting
This commit is contained in:
sidschingis 2020-07-29 22:58:46 +02:00 committed by GitHub
parent 1063aa5482
commit 8c03361b8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 56 additions and 16 deletions

@ -1 +1 @@
Subproject commit 1bede8c899d015e8cad641926680c2da385fd5dd
Subproject commit 5580043d20bb9c33af1703ece494e77a5f0840f0

View file

@ -82,6 +82,7 @@ pub enum Attack {
Ftilt = 14,
Utilt = 15,
Dtilt = 16,
DashAttack = 17,
Nothing = 9999,
}
@ -107,6 +108,7 @@ impl From<i32> for Attack {
14 => Ftilt,
15 => Utilt,
16 => Dtilt,
17 => DashAttack,
_ => Nothing,
}
}
@ -279,6 +281,7 @@ pub enum Action {
Ftilt = 20,
Utilt = 21,
Dtilt = 22,
DashAttack = 23,
Shield = 99,
}
@ -326,7 +329,8 @@ impl From<i32> for Action {
20 => Ftilt,
21 => Utilt,
22 => Dtilt,
99 => Action::Shield,
23 => DashAttack,
99 => Shield,
_ => Nothing,
}
}

View file

@ -6,7 +6,7 @@ pub fn check_up_b(
current_status: i32,
expected_status: i32,
) -> bool {
if !is_bowser(module_accessor){
if !is_bowser(module_accessor) {
return false;
}

View file

@ -5,7 +5,11 @@ 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 {
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;
}

View file

@ -50,7 +50,7 @@ unsafe fn should_return_none_in_check_button(
}
// Nothing to do if not toggled
if MENU.full_hop != OnOff::On{
if MENU.full_hop != OnOff::On {
return true;
}

View file

@ -100,8 +100,8 @@ pub unsafe fn get_command_flag_cat(
return 0;
}
pub fn handle_mash(module_accessor: &mut app::BattleObjectModuleAccessor){
unsafe{
pub fn handle_mash(module_accessor: &mut app::BattleObjectModuleAccessor) {
unsafe {
if !is_operation_cpu(module_accessor) {
return;
}
@ -199,6 +199,7 @@ fn attack_to_action(attack: Attack) -> Action {
Attack::Ftilt => Ftilt,
Attack::Utilt => Utilt,
Attack::Dtilt => Dtilt,
Attack::DashAttack => DashAttack,
Attack::Nothing => Nothing,
}
}
@ -354,6 +355,23 @@ unsafe fn get_attack_flag(
transition_flag = *FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_ATTACK_LW3;
status = *FIGHTER_STATUS_KIND_ATTACK_LW3;
}
DashAttack => {
let current_status = StatusModule::status_kind(module_accessor);
let is_dashing = current_status == *FIGHTER_STATUS_KIND_DASH;
// Start Dash First
if !is_dashing {
let dash_transition = *FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_DASH;
let dash_status = *FIGHTER_STATUS_KIND_DASH;
try_change_status(module_accessor, dash_status, dash_transition);
}
transition_flag = *FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_ATTACK_DASH;
status = *FIGHTER_STATUS_KIND_ATTACK_DASH;
return get_flag(module_accessor, status, transition_flag);
}
_ => return 0,
}
@ -370,11 +388,7 @@ unsafe fn get_aerial_flag(
if is_grounded(module_accessor) {
let jump_flag = *FIGHTER_STATUS_KIND_JUMP_SQUAT;
let transition_flag = *FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_JUMP_SQUAT;
let allow_transition =
WorkModule::is_enable_transition_term(module_accessor, transition_flag);
if allow_transition {
StatusModule::change_status_request_from_script(module_accessor, jump_flag, true);
}
try_change_status(module_accessor, jump_flag, transition_flag);
// Delay attack until we are airborne to get a full hop
if MENU.full_hop == OnOff::On {
@ -431,12 +445,30 @@ unsafe fn get_flag(
reset();
}
let allow_transition = WorkModule::is_enable_transition_term(module_accessor, transition_flag);
if allow_transition {
try_change_status(module_accessor, expected_status, transition_flag);
return 0;
}
fn try_change_status(
module_accessor: &mut app::BattleObjectModuleAccessor,
expected_status: i32,
transition_flag: i32,
) -> bool {
let allow_transition;
unsafe {
allow_transition = WorkModule::is_enable_transition_term(module_accessor, transition_flag);
}
if !allow_transition {
return false;
}
unsafe {
StatusModule::change_status_request_from_script(module_accessor, expected_status, true);
}
return 0;
return true;
}
pub unsafe fn perform_defensive_option() {

View file

@ -8,6 +8,7 @@ pub mod directional_influence;
pub mod shield;
pub mod tech;
mod character_specific;
pub mod combo;
mod fast_fall;
mod frame_counter;
@ -16,7 +17,6 @@ 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(