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

Add Power Dragon to Buff Options (#620)

* Initial attempt at hooking power dragon func, will be better just to rewrite

* working translation

* cleanup, add buff option

* Rename Power Dragon buff

* Fixed Null ptr comparison (kinda)

* clippy >.>
This commit is contained in:
GradualSyrup 2023-09-02 19:45:12 -05:00 committed by GitHub
parent d867616f4f
commit 7721a34fc0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 102 additions and 0 deletions

View file

@ -1,5 +1,6 @@
use smash::app::{self, lua_bind::*}; use smash::app::{self, lua_bind::*};
use smash::lib::lua_const::*; use smash::lib::lua_const::*;
use smash::phx::{Hash40, Vector3f};
use crate::common::consts::*; use crate::common::consts::*;
use crate::is_operation_cpu; use crate::is_operation_cpu;
@ -90,6 +91,8 @@ pub unsafe fn handle_buffs(
return buff_sepiroth(module_accessor); return buff_sepiroth(module_accessor);
} else if fighter_kind == *FIGHTER_KIND_SHULK { } else if fighter_kind == *FIGHTER_KIND_SHULK {
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) {
return buff_minmin(module_accessor);
} }
true true
} }
@ -290,3 +293,98 @@ unsafe fn buff_wiifit(module_accessor: &mut app::BattleObjectModuleAccessor, sta
} }
false false
} }
unsafe fn buff_minmin(module_accessor: &mut app::BattleObjectModuleAccessor) -> bool {
// Handle all of Min Min's effect setup, copied from 710122a340
VisibilityModule::set_status_default(
module_accessor,
Hash40 { hash: 0x59a6ef56c },
Hash40 { hash: 0x9b7cb3e40 },
);
VisibilityModule::set_status_default(
module_accessor,
Hash40 { hash: 0xa9ffaf181 },
Hash40 { hash: 0xef190b4e8 },
);
let article_spiralleft =
ArticleModule::get_article(module_accessor, *FIGHTER_TANTAN_GENERATE_ARTICLE_SPIRALLEFT);
if !article_spiralleft.is_null() {
VisibilityModule::set_status_default(
module_accessor,
Hash40 { hash: 0x6ec1f4d21 },
Hash40 { hash: 0xa9aba8db6 },
);
VisibilityModule::set(
module_accessor,
Hash40 { hash: 0x59a6ef56c },
Hash40 { hash: 0xadd214353 },
);
}
let arm_l_big_frame = WorkModule::get_param_int(module_accessor, 0xdf05c072b, 0xf4fd45d48);
WorkModule::set_int(
module_accessor,
arm_l_big_frame,
*FIGHTER_TANTAN_INSTANCE_WORK_ID_INT_ARM_L_BIG_FRAME,
);
WorkModule::on_flag(
module_accessor,
*FIGHTER_TANTAN_INSTANCE_WORK_ID_FLAG_DRAGONIZE_L,
);
let mut reinforce_l_effect_handle_l = WorkModule::get_int(
module_accessor,
*FIGHTER_TANTAN_INSTANCE_WORK_ID_INT_REINFORCE_L_EFFECT_HANDLE_L,
);
if reinforce_l_effect_handle_l != 0 {
EffectModule::kill(
module_accessor,
reinforce_l_effect_handle_l as u32,
false,
true,
);
}
let pos_and_rot = Vector3f {
x: 0.0,
y: 0.0,
z: 0.0,
};
let scale_vec = Vector3f {
x: 1.0,
y: 1.0,
z: 1.0,
};
reinforce_l_effect_handle_l = EffectModule::req(
module_accessor,
Hash40 { hash: 0x12600df9d4 },
&pos_and_rot,
&pos_and_rot,
1.0,
0,
-1,
false,
0,
) as i32;
EffectModule::set_scale(
module_accessor,
reinforce_l_effect_handle_l as u32,
&scale_vec,
);
WorkModule::set_int(
module_accessor,
reinforce_l_effect_handle_l,
*FIGHTER_TANTAN_INSTANCE_WORK_ID_INT_REINFORCE_L_EFFECT_HANDLE_L,
);
MotionModule::add_motion_partial(
module_accessor,
*FIGHTER_TANTAN_MOTION_PART_SET_KIND_DRAGON,
Hash40 { hash: 0xc86296416 },
0.0,
1.0,
false,
false,
0.0,
true,
true,
false,
);
true
}

View file

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

View file

@ -733,6 +733,7 @@ bitflags! {
const MONAD_SHIELD = 0x800; const MONAD_SHIELD = 0x800;
const MONAD_BUSTER = 0x1000; const MONAD_BUSTER = 0x1000;
const MONAD_SMASH = 0x2000; const MONAD_SMASH = 0x2000;
const POWER_DRAGON = 0x4000;
} }
} }
@ -755,6 +756,7 @@ impl BuffOption {
BuffOption::MONAD_SHIELD => *FIGHTER_SHULK_MONAD_TYPE_SHIELD, BuffOption::MONAD_SHIELD => *FIGHTER_SHULK_MONAD_TYPE_SHIELD,
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,
_ => return None, _ => return None,
}) })
} }
@ -804,6 +806,7 @@ impl fmt::Display for BuffOption {
BuffOption::MONAD_SHIELD => "Shield", BuffOption::MONAD_SHIELD => "Shield",
BuffOption::MONAD_BUSTER => "Buster", BuffOption::MONAD_BUSTER => "Buster",
BuffOption::MONAD_SMASH => "Smash", BuffOption::MONAD_SMASH => "Smash",
BuffOption::POWER_DRAGON => "Power Dragon",
_ => combination_string.as_str(), _ => combination_string.as_str(),
} }
) )