Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 0 additions & 37 deletions src/training/character_specific/bowser.rs

This file was deleted.

59 changes: 55 additions & 4 deletions src/training/character_specific/mod.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,73 @@
use smash::app::{self};
use smash::lib::lua_const::*;

mod bowser;
pub mod items;
pub mod kirby;
pub mod pikmin;
pub mod ptrainer;
pub mod steve;

use std::collections::HashMap;
use training_mod_sync::LazyLock;

static CHARACTER_SPECIFIC_STATUS_MAP: LazyLock<HashMap<(i32, i32), Vec<i32>>> =
LazyLock::new(|| {
HashMap::from([
(
// Bowser Up b
(*FIGHTER_KIND_KOOPA, *FIGHTER_STATUS_KIND_SPECIAL_HI),
vec![
*FIGHTER_KOOPA_STATUS_KIND_SPECIAL_HI_G,
*FIGHTER_KOOPA_STATUS_KIND_SPECIAL_HI_A,
],
),
(
// Sora Neutral B
(*FIGHTER_KIND_TRAIL, *FIGHTER_STATUS_KIND_SPECIAL_N),
vec![
*FIGHTER_TRAIL_STATUS_KIND_SPECIAL_N1,
*FIGHTER_TRAIL_STATUS_KIND_SPECIAL_N1_SHOOT,
*FIGHTER_TRAIL_STATUS_KIND_SPECIAL_N1_END,
*FIGHTER_TRAIL_STATUS_KIND_SPECIAL_N2,
*FIGHTER_TRAIL_STATUS_KIND_SPECIAL_N3,
],
),
(
// Sora Nair / Fair
(*FIGHTER_KIND_TRAIL, *FIGHTER_STATUS_KIND_ATTACK_AIR),
vec![
*FIGHTER_TRAIL_STATUS_KIND_ATTACK_AIR_N,
*FIGHTER_TRAIL_STATUS_KIND_ATTACK_AIR_F,
],
),
(
// Krool Sideb
(*FIGHTER_KIND_KROOL, *FIGHTER_STATUS_KIND_SPECIAL_S),
vec![
*FIGHTER_KROOL_STATUS_KIND_SPECIAL_S_THROW,
*FIGHTER_KROOL_STATUS_KIND_SPECIAL_S_CATCH,
*FIGHTER_KROOL_STATUS_KIND_SPECIAL_S_FAILURE,
*FIGHTER_KROOL_STATUS_KIND_SPECIAL_S_GET,
],
),
])
});

/**
* Checks if the current status matches the expected status
* Returns true if the current_status matches a character-specific status for the expected_status
* Returns false if it does not match or if there are no character-specific statuses for the expected_status
*/
pub fn check_status(
pub unsafe fn check_character_specific_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;
let fighter_kind = app::utility::get_kind(module_accessor);
if let Some(statuses) = CHARACTER_SPECIFIC_STATUS_MAP.get(&(fighter_kind, expected_status)) {
if statuses.contains(&current_status) {
return true;
}
}

false
Expand Down
6 changes: 5 additions & 1 deletion src/training/mash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,11 @@ unsafe fn get_flag(
}

// Workaround for Character specific status
if character_specific::check_status(module_accessor, current_status, expected_status) {
if character_specific::check_character_specific_status(
module_accessor,
current_status,
expected_status,
) {
reset();
}

Expand Down
Loading