From eb0e63912243868382a5f21d94d519bd6308990b Mon Sep 17 00:00:00 2001 From: sidschingis <SijingYou92@gmail.com> Date: Tue, 9 Jun 2020 20:46:18 +0200 Subject: [PATCH] Add Roll Options (#80) * Add Roll Options Added forward/backwards roll options * Update TrainingModpackOverlay * Change Option Order * Update TrainingModpackOverlay --- TrainingModpackOverlay | 2 +- src/common/consts.rs | 8 ++++++-- src/training/mash.rs | 10 ++++++++++ src/training/shield.rs | 27 ++++++++++++++++++++++++++- 4 files changed, 43 insertions(+), 4 deletions(-) diff --git a/TrainingModpackOverlay b/TrainingModpackOverlay index e604330..e9e4852 160000 --- a/TrainingModpackOverlay +++ b/TrainingModpackOverlay @@ -1 +1 @@ -Subproject commit e6043301ef518e9d8fb2a663c1a5aa261b3a7f41 +Subproject commit e9e48521ee22ba1d022cc639d366670aaea95b7d diff --git a/src/common/consts.rs b/src/common/consts.rs index b7dd199..5ca09b9 100644 --- a/src/common/consts.rs +++ b/src/common/consts.rs @@ -149,7 +149,9 @@ pub enum Mash { Jump = 2, Attack = 3, Spotdodge = 4, - Random = 5 + RollForward = 5, + RollBack = 6, + Random = 7, } impl From<i32> for Mash { @@ -160,7 +162,9 @@ impl From<i32> for Mash { 2 => Mash::Jump, 3 => Mash::Attack, 4 => Mash::Spotdodge, - 5 => Mash::Random, + 5 => Mash::RollForward, + 6 => Mash::RollBack, + 7 => Mash::Random, _ => panic!("Invalid mash state {}", x) } } diff --git a/src/training/mash.rs b/src/training/mash.rs index e7fde90..2843363 100644 --- a/src/training/mash.rs +++ b/src/training/mash.rs @@ -49,6 +49,16 @@ pub unsafe fn get_command_flag_cat( *flag |= *FIGHTER_PAD_CMD_CAT1_FLAG_ESCAPE; } } + Mash::RollForward => { + if category == FIGHTER_PAD_COMMAND_CATEGORY1 { + *flag |= *FIGHTER_PAD_CMD_CAT1_FLAG_ESCAPE_F; + } + } + Mash::RollBack => { + if category == FIGHTER_PAD_COMMAND_CATEGORY1 { + *flag |= *FIGHTER_PAD_CMD_CAT1_FLAG_ESCAPE_B; + } + } Mash::Attack => { if category == FIGHTER_PAD_COMMAND_CATEGORY1 { use Attack::*; diff --git a/src/training/shield.rs b/src/training/shield.rs index df20502..cb5c645 100644 --- a/src/training/shield.rs +++ b/src/training/shield.rs @@ -131,7 +131,32 @@ 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 WorkModule::is_enable_transition_term( + module_accessor, + *FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_ESCAPE, + ) { + fighter.fighter_base.change_status( + L2CValue::new_int(*FIGHTER_STATUS_KIND_ESCAPE_F as u64), + L2CValue::new_bool(true), + ); + } + } + } + if MENU.mash_state == Mash::RollBack { + 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, + ) { + fighter.fighter_base.change_status( + L2CValue::new_int(*FIGHTER_STATUS_KIND_ESCAPE_B as u64), + L2CValue::new_bool(true), + ); + } + } + } 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 {