1
0
Fork 0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2024-11-20 00:46:34 +00:00

Wall Tech Options (#188)

* Extract Method

* Untangle conditions

* Extract Method

* Fix Swapped Constants

* Apply No Tech Option

* Fix Bugs

* Return early on match

* Also cleanup ground tech

* Fix unused warning

* Support Wall Tech Jumps
This commit is contained in:
sidschingis 2021-01-22 20:04:58 +01:00 committed by GitHub
parent 8189c07e30
commit d24a94835e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 137 additions and 49 deletions

View file

@ -123,7 +123,10 @@ tech option among the selected
options.
CPUs will also perform a defensive
option after getting up.)"""";
option after getting up.
For wall tech jumps set it to RollF
)"""";
// Missed Tech Option

View file

@ -92,7 +92,7 @@ pub unsafe fn force_option(module_accessor: &mut app::BattleObjectModuleAccessor
}
pub unsafe fn is_enable_transition_term(
module_accessor: *mut app::BattleObjectModuleAccessor,
_module_accessor: *mut app::BattleObjectModuleAccessor,
term: i32,
) -> Option<bool> {
// Disallow cliff-climb if waiting on ledge per the current menu selection

View file

@ -41,66 +41,151 @@ unsafe fn mod_handle_change_status(
.try_get_int()
.unwrap_or(*FIGHTER_STATUS_KIND_WAIT as u64) as i32;
// Ground Tech
if status_kind_int == *FIGHTER_STATUS_KIND_DOWN
|| status_kind_int == *FIGHTER_STATUS_KIND_DAMAGE_FLY_REFLECT_D
{
let state: TechFlags = MENU.tech_state.get_random();
let state: TechFlags = MENU.tech_state.get_random();
if WorkModule::is_enable_transition_term(
let grnd_teched = handle_grnd_tech(module_accessor, status_kind, unk, status_kind_int, state);
if grnd_teched {
return;
}
let wall_teched = handle_wall_tech(module_accessor, status_kind, unk, status_kind_int, state);
if wall_teched {
return;
}
let ceil_teched = handle_ceil_tech(module_accessor, status_kind, unk, status_kind_int, state);
if ceil_teched {
return;
}
}
fn handle_grnd_tech(
module_accessor: &mut app::BattleObjectModuleAccessor,
status_kind: &mut L2CValue,
unk: &mut L2CValue,
status_kind_int: i32,
state: TechFlags,
) -> bool {
if status_kind_int != *FIGHTER_STATUS_KIND_DOWN
&& status_kind_int != *FIGHTER_STATUS_KIND_DAMAGE_FLY_REFLECT_D
{
return false;
}
unsafe {
let can_tech = WorkModule::is_enable_transition_term(
module_accessor,
*FIGHTER_STATUS_TRANSITION_TERM_ID_PASSIVE,
) {
match state {
TechFlags::IN_PLACE => {
*status_kind = FIGHTER_STATUS_KIND_PASSIVE.as_lua_int();
*unk = LUA_TRUE;
mash::perform_defensive_option();
}
TechFlags::ROLL_F => {
*status_kind = FIGHTER_STATUS_KIND_PASSIVE_FB.as_lua_int();
*unk = LUA_TRUE;
TECH_ROLL_DIRECTION = Direction::IN; // = In
mash::perform_defensive_option();
}
TechFlags::ROLL_B => {
*status_kind = FIGHTER_STATUS_KIND_PASSIVE_FB.as_lua_int();
*unk = LUA_TRUE;
TECH_ROLL_DIRECTION = Direction::OUT; // = Away
mash::perform_defensive_option();
}
_ => (),
);
if !can_tech {
return false;
}
}
match state {
TechFlags::IN_PLACE => {
*status_kind = FIGHTER_STATUS_KIND_PASSIVE.as_lua_int();
*unk = LUA_TRUE;
unsafe {
mash::perform_defensive_option();
}
}
return;
TechFlags::ROLL_F => {
*status_kind = FIGHTER_STATUS_KIND_PASSIVE_FB.as_lua_int();
*unk = LUA_TRUE;
unsafe {
TECH_ROLL_DIRECTION = Direction::IN; // = In
mash::perform_defensive_option();
}
}
TechFlags::ROLL_B => {
*status_kind = FIGHTER_STATUS_KIND_PASSIVE_FB.as_lua_int();
*unk = LUA_TRUE;
unsafe {
TECH_ROLL_DIRECTION = Direction::OUT; // = Away
mash::perform_defensive_option();
}
}
_ => (),
}
// Wall Tech
if (status_kind_int == *FIGHTER_STATUS_KIND_STOP_WALL
|| status_kind_int == *FIGHTER_STATUS_KIND_DAMAGE_FLY_REFLECT_LR)
&& WorkModule::is_enable_transition_term(
module_accessor,
*FIGHTER_STATUS_TRANSITION_TERM_ID_PASSIVE_CEIL,
)
return true;
}
fn handle_wall_tech(
module_accessor: &mut app::BattleObjectModuleAccessor,
status_kind: &mut L2CValue,
unk: &mut L2CValue,
status_kind_int: i32,
state: TechFlags,
) -> bool {
if status_kind_int != *FIGHTER_STATUS_KIND_STOP_WALL
&& status_kind_int != *FIGHTER_STATUS_KIND_DAMAGE_FLY_REFLECT_LR
{
*status_kind = FIGHTER_STATUS_KIND_PASSIVE_WALL.as_lua_int();
*unk = LUA_TRUE;
return;
return false;
}
// Ceiling Tech
if (status_kind_int == *FIGHTER_STATUS_KIND_STOP_CEIL
|| status_kind_int == *FIGHTER_STATUS_KIND_DAMAGE_FLY_REFLECT_U)
&& WorkModule::is_enable_transition_term(
if state == TechFlags::NO_TECH {
return false;
}
unsafe {
let can_tech = WorkModule::is_enable_transition_term(
module_accessor,
*FIGHTER_STATUS_TRANSITION_TERM_ID_PASSIVE_WALL,
)
{
*status_kind = FIGHTER_STATUS_KIND_PASSIVE_CEIL.as_lua_int();
*unk = LUA_TRUE;
return;
);
if !can_tech {
return false;
}
}
match state {
TechFlags::IN_PLACE => {
*status_kind = FIGHTER_STATUS_KIND_PASSIVE_WALL.as_lua_int();
*unk = LUA_TRUE;
}
TechFlags::ROLL_F => {
*status_kind = FIGHTER_STATUS_KIND_PASSIVE_WALL_JUMP.as_lua_int();
*unk = LUA_TRUE;
}
_ => (),
}
return true;
}
fn handle_ceil_tech(
module_accessor: &mut app::BattleObjectModuleAccessor,
status_kind: &mut L2CValue,
unk: &mut L2CValue,
status_kind_int: i32,
state: TechFlags,
) -> bool {
if status_kind_int != *FIGHTER_STATUS_KIND_STOP_CEIL
&& status_kind_int != *FIGHTER_STATUS_KIND_DAMAGE_FLY_REFLECT_U
{
return false;
}
if state == TechFlags::NO_TECH {
return false;
}
unsafe {
let can_tech = WorkModule::is_enable_transition_term(
module_accessor,
*FIGHTER_STATUS_TRANSITION_TERM_ID_PASSIVE_CEIL,
);
if !can_tech {
return false;
}
}
*status_kind = FIGHTER_STATUS_KIND_PASSIVE_CEIL.as_lua_int();
*unk = LUA_TRUE;
return true;
}
pub unsafe fn get_command_flag_cat(module_accessor: &mut app::BattleObjectModuleAccessor) {