diff --git a/source/taunt_toggles.h b/source/taunt_toggles.h index a18776c..c7dc4d8 100644 --- a/source/taunt_toggles.h +++ b/source/taunt_toggles.h @@ -55,6 +55,13 @@ const char* mash_items[] = { "None", "Airdodge", "Jump", "Attack", "Random" }; #define SHIELD_HOLD 2 const char* shield_items[] = { "None", "Infinite", "Hold" }; +// Defensive States +#define RANDOM_DEFENSIVE 1 +#define DEFENSIVE_SHIELD 2 +#define DEFENSIVE_SPOTDODGE 3 +#define DEFENSIVE_JAB 4 +const char* defensive_items[] = { "None", "Random", "Flash Shield", "Spotdodge", "Jab" }; + struct TrainingModpackMenu { bool HITBOX_VIS = 1; int DI_STATE = NONE; @@ -63,6 +70,7 @@ struct TrainingModpackMenu { int TECH_STATE = RANDOM_TECH; int MASH_STATE = NONE; int SHIELD_STATE = NONE; + int DEFENSIVE_STATE = RANDOM_DEFENSIVE; char print_buffer[256]; u64 print_buffer_len = 0; } menu; diff --git a/source/training/common.hpp b/source/training/common.hpp index de643a9..dc66fe8 100644 --- a/source/training/common.hpp +++ b/source/training/common.hpp @@ -32,4 +32,23 @@ bool is_in_landing(u64 module_accessor) { int status_kind = StatusModule::status_kind(module_accessor); return status_kind >= FIGHTER_STATUS_KIND_LANDING && status_kind <= FIGHTER_STATUS_KIND_LANDING_DAMAGE_LIGHT; +} + +void perform_defensive_option(u64 module_accessor) { + if (menu.DEFENSIVE_STATE == RANDOM_DEFENSIVE) { + const int NUM_GROUND_STATUSES = 3; + int random_statuses[NUM_GROUND_STATUSES] = { + FIGHTER_STATUS_KIND_ESCAPE, + FIGHTER_STATUS_KIND_ATTACK, + FIGHTER_STATUS_KIND_GUARD_ON + }; + + int random_status_index = app::sv_math::rand(hash40("fighter"), NUM_GROUND_STATUSES); + StatusModule::change_status_request_from_script(module_accessor, random_statuses[random_status_index], 1); + } else if (menu.DEFENSIVE_STATE == DEFENSIVE_SHIELD) + StatusModule::change_status_request_from_script(module_accessor, FIGHTER_STATUS_KIND_GUARD_ON, 1); + else if (menu.DEFENSIVE_STATE == DEFENSIVE_SPOTDODGE) + StatusModule::change_status_request_from_script(module_accessor, FIGHTER_STATUS_KIND_ESCAPE, 1); + else if (menu.DEFENSIVE_STATE == DEFENSIVE_JAB) + StatusModule::change_status_request_from_script(module_accessor, FIGHTER_STATUS_KIND_ATTACK, 1); } \ No newline at end of file diff --git a/source/training/ledge.hpp b/source/training/ledge.hpp index 6962119..932296c 100644 --- a/source/training/ledge.hpp +++ b/source/training/ledge.hpp @@ -13,7 +13,7 @@ void force_option(u64 module_accessor) { if (frame == random_frame || frame > 30.0) { int status = 0; - int ledge_case = menu.LEDGE_STATE - 1; + int ledge_case = menu.LEDGE_STATE; if (menu.LEDGE_STATE == RANDOM_LEDGE) ledge_case = app::sv_math::rand(hash40("fighter"), 4) + 1; @@ -47,15 +47,7 @@ void defensive_option(u64 module_accessor, int category, int& flag) { status == FIGHTER_STATUS_KIND_CLIFF_ATTACK || status == FIGHTER_STATUS_KIND_CLIFF_ESCAPE) && WorkModule::is_enable_transition_term(module_accessor, FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_ESCAPE)) { - const int NUM_GROUND_STATUSES = 3; - int random_statuses[NUM_GROUND_STATUSES] = { - FIGHTER_STATUS_KIND_ESCAPE, - FIGHTER_STATUS_KIND_ATTACK, - FIGHTER_STATUS_KIND_GUARD_ON - }; - - int random_status_index = app::sv_math::rand(hash40("fighter"), NUM_GROUND_STATUSES); - StatusModule::change_status_request_from_script(module_accessor, random_statuses[random_status_index], 1); + perform_defensive_option(module_accessor); } } diff --git a/source/training/tech.h b/source/training/tech.h index 8117387..a015a75 100644 --- a/source/training/tech.h +++ b/source/training/tech.h @@ -70,15 +70,7 @@ void get_command_flag_cat(u64 module_accessor, int category, int& flag) { status == FIGHTER_STATUS_KIND_DOWN_STAND_FB || status == FIGHTER_STATUS_KIND_DOWN_STAND_ATTACK) && WorkModule::is_enable_transition_term(module_accessor, FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_GUARD_ON)) { - const int NUM_GROUND_STATUSES = 3; - int random_statuses[NUM_GROUND_STATUSES] = { - FIGHTER_STATUS_KIND_ESCAPE, - FIGHTER_STATUS_KIND_ATTACK, - FIGHTER_STATUS_KIND_GUARD_ON - }; - - int random_status_index = app::sv_math::rand(hash40("fighter"), NUM_GROUND_STATUSES); - StatusModule::change_status_request_from_script(module_accessor, random_statuses[random_status_index], 1); + perform_defensive_option(module_accessor); } } }