1
0
Fork 0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2024-11-24 02:44:17 +00:00

Add Wario waft options to buff menu (#626)

* add wario waft options to buff menu

* remove comment

* get waft threshold values from params rather than guessing

* more friendly menu names

* set GASS_LEVEL to be safe

* format and cleanup

* use match instead of if

* fix compile warning

* Fix clippy

* Fix clippy again

* fix formatting again

---------

Co-authored-by: jugeeya <jugeeya@live.com>
This commit is contained in:
Mohammad Saad 2023-09-07 13:40:37 -04:00 committed by GitHub
parent 696376930d
commit 633686c6c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 57 additions and 0 deletions

View file

@ -1,4 +1,5 @@
use smash::app::{self, lua_bind::*}; use smash::app::{self, lua_bind::*};
use smash::hash40;
use smash::lib::lua_const::*; use smash::lib::lua_const::*;
use smash::phx::{Hash40, Vector3f}; use smash::phx::{Hash40, Vector3f};
@ -93,6 +94,8 @@ pub unsafe fn handle_buffs(
return buff_shulk(module_accessor, status); return buff_shulk(module_accessor, status);
} else if fighter_kind == *FIGHTER_KIND_TANTAN && menu_vec.contains(&BuffOption::POWER_DRAGON) { } else if fighter_kind == *FIGHTER_KIND_TANTAN && menu_vec.contains(&BuffOption::POWER_DRAGON) {
return buff_minmin(module_accessor); return buff_minmin(module_accessor);
} else if fighter_kind == *FIGHTER_KIND_WARIO {
return buff_wario(module_accessor);
} }
true true
} }
@ -233,6 +236,43 @@ unsafe fn buff_sepiroth(module_accessor: &mut app::BattleObjectModuleAccessor) -
false false
} }
unsafe fn buff_wario(module_accessor: &mut app::BattleObjectModuleAccessor) -> bool {
if !is_buffing(module_accessor) {
let waft_level: BuffOption = MENU.buff_state.wario_buffs().get_random();
let waft_count_secs = match waft_level {
BuffOption::WAFT_MINI => WorkModule::get_param_float(
module_accessor,
hash40("param_special_lw"),
hash40("gass_middle_time"),
) as i32,
BuffOption::WAFT_HALF => WorkModule::get_param_float(
module_accessor,
hash40("param_special_lw"),
hash40("gass_large_time"),
) as i32,
BuffOption::WAFT_FULL => WorkModule::get_param_float(
module_accessor,
hash40("param_special_lw"),
hash40("gass_max_time"),
) as i32,
_ => return true,
};
let waft_count_frames = waft_count_secs * 60;
WorkModule::set_int(
module_accessor,
waft_count_frames,
*FIGHTER_WARIO_INSTANCE_WORK_ID_INT_GASS_COUNT,
);
WorkModule::set_int(
module_accessor,
waft_level.into_int().unwrap(),
*FIGHTER_WARIO_INSTANCE_WORK_ID_INT_GASS_LEVEL,
);
}
start_buff(module_accessor);
true
}
unsafe fn buff_shulk(module_accessor: &mut app::BattleObjectModuleAccessor, status: i32) -> bool { unsafe fn buff_shulk(module_accessor: &mut app::BattleObjectModuleAccessor, status: i32) -> bool {
let current_art = MENU.buff_state.shulk_buffs().get_random(); let current_art = MENU.buff_state.shulk_buffs().get_random();
if current_art == BuffOption::empty() { if current_art == BuffOption::empty() {

View file

@ -431,6 +431,7 @@ pub unsafe fn save_states(module_accessor: &mut app::BattleObjectModuleAccessor)
*FIGHTER_KIND_WIIFIT, *FIGHTER_KIND_WIIFIT,
*FIGHTER_KIND_SHULK, *FIGHTER_KIND_SHULK,
*FIGHTER_KIND_TANTAN, *FIGHTER_KIND_TANTAN,
*FIGHTER_KIND_WARIO,
] ]
.contains(&fighter_kind); .contains(&fighter_kind);

View file

@ -734,6 +734,9 @@ bitflags! {
const MONAD_BUSTER = 0x1000; const MONAD_BUSTER = 0x1000;
const MONAD_SMASH = 0x2000; const MONAD_SMASH = 0x2000;
const POWER_DRAGON = 0x4000; const POWER_DRAGON = 0x4000;
const WAFT_MINI = 0x8000;
const WAFT_HALF = 0x10000;
const WAFT_FULL = 0x20000;
} }
} }
@ -757,6 +760,9 @@ impl BuffOption {
BuffOption::MONAD_BUSTER => *FIGHTER_SHULK_MONAD_TYPE_BUSTER, BuffOption::MONAD_BUSTER => *FIGHTER_SHULK_MONAD_TYPE_BUSTER,
BuffOption::MONAD_SMASH => *FIGHTER_SHULK_MONAD_TYPE_SMASH, BuffOption::MONAD_SMASH => *FIGHTER_SHULK_MONAD_TYPE_SMASH,
BuffOption::POWER_DRAGON => 1, BuffOption::POWER_DRAGON => 1,
BuffOption::WAFT_MINI => *FIGHTER_WARIO_GASS_LEVEL_M,
BuffOption::WAFT_HALF => *FIGHTER_WARIO_GASS_LEVEL_L,
BuffOption::WAFT_FULL => *FIGHTER_WARIO_GASS_LEVEL_FLY,
_ => return None, _ => return None,
}) })
} }
@ -783,6 +789,13 @@ impl BuffOption {
.union(BuffOption::MONAD_SMASH); .union(BuffOption::MONAD_SMASH);
self.intersection(shulk_buffs_bitflags) self.intersection(shulk_buffs_bitflags)
} }
pub fn wario_buffs(self) -> BuffOption {
let wario_buffs_bitflags = BuffOption::WAFT_MINI
.union(BuffOption::WAFT_HALF)
.union(BuffOption::WAFT_FULL);
self.intersection(wario_buffs_bitflags)
}
} }
impl fmt::Display for BuffOption { impl fmt::Display for BuffOption {
@ -807,6 +820,9 @@ impl fmt::Display for BuffOption {
BuffOption::MONAD_BUSTER => "Buster", BuffOption::MONAD_BUSTER => "Buster",
BuffOption::MONAD_SMASH => "Smash", BuffOption::MONAD_SMASH => "Smash",
BuffOption::POWER_DRAGON => "Power Dragon", BuffOption::POWER_DRAGON => "Power Dragon",
BuffOption::WAFT_MINI => "Mini Waft",
BuffOption::WAFT_HALF => "Half Waft",
BuffOption::WAFT_FULL => "Full Waft",
_ => combination_string.as_str(), _ => combination_string.as_str(),
} }
) )