Skip to content

Commit 16ebe2a

Browse files
authored
Merge pull request #2219 from HDR-Development/kirby
Kirby KO Punch + Little Mac adjustments
2 parents 9835b20 + 4b69f0b commit 16ebe2a

File tree

12 files changed

+286
-465
lines changed

12 files changed

+286
-465
lines changed

dynamic/src/consts.rs

+2
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,8 @@ pub mod vars {
672672
pub use super::super::luigi::status::THUNDERHAND;
673673
pub use super::super::mariod::status::CHILL_PILL;
674674
pub const MINING_TIMER: i32 = 0x11F4;
675+
pub const KO_PUNCH_GRAVITY: i32 = 0x11F5;
676+
pub const KO_PUNCH_GRAVITY_END: i32 = 0x11F6;
675677
}
676678
}
677679

fighters/common/src/misc.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,9 @@ pub fn install() {
9393
ptrainer_stub_death_switch,
9494
// shield_damage_analog,
9595
// shield_pushback_analog
96-
);
97-
skyline::install_hooks!(
98-
//set_hit_team_hook,
99-
hero_rng_hook,
100-
psych_up_hit,
101-
);
102-
skyline::install_hooks!(
96+
// set_hit_team_hook,
97+
hero_rng_hook,
98+
psych_up_hit,
10399
krool_belly_damage_hook,
104100
);
105101
}

fighters/kirby/src/acmd/copyspecials.rs

+73-174
Large diffs are not rendered by default.

fighters/kirby/src/opff.rs

-43
Original file line numberDiff line numberDiff line change
@@ -915,48 +915,6 @@ unsafe fn wiifit_nspecial_cancels(boma: &mut BattleObjectModuleAccessor, status_
915915
}
916916
}
917917

918-
// Little Mac
919-
unsafe fn littlemac_nspecial_cancels(fighter: &mut smash::lua2cpp::L2CFighterCommon, boma: &mut BattleObjectModuleAccessor, status_kind: i32, situation_kind: i32, cat1: i32, frame: f32) {
920-
if status_kind == *FIGHTER_KIRBY_STATUS_KIND_LITTLEMAC_SPECIAL_N_START {
921-
if fighter.is_situation(*SITUATION_KIND_GROUND) {
922-
if fighter.is_cat_flag(Cat2::StickEscape) {
923-
VarModule::set_int(fighter.battle_object, vars::littlemac::status::SPECIAL_LW_CANCEL_TYPE, vars::littlemac::SPECIAL_LW_CANCEL_TYPE_ESCAPE);
924-
fighter.change_to_custom_status(statuses::littlemac::SPECIAL_LW_CANCEL, true, false);
925-
}
926-
else if fighter.is_cat_flag(Cat2::StickEscapeF) {
927-
VarModule::set_int(fighter.battle_object, vars::littlemac::status::SPECIAL_LW_CANCEL_TYPE, vars::littlemac::SPECIAL_LW_CANCEL_TYPE_ESCAPE_F);
928-
fighter.change_to_custom_status(statuses::littlemac::SPECIAL_LW_CANCEL, true, false);
929-
}
930-
else if fighter.is_cat_flag(Cat2::StickEscapeB) {
931-
VarModule::set_int(fighter.battle_object, vars::littlemac::status::SPECIAL_LW_CANCEL_TYPE, vars::littlemac::SPECIAL_LW_CANCEL_TYPE_ESCAPE_B);
932-
fighter.change_to_custom_status(statuses::littlemac::SPECIAL_LW_CANCEL, true, false);
933-
}
934-
else if (fighter.is_cat_flag(Cat1::JumpButton) || (ControlModule::is_enable_flick_jump(fighter.module_accessor) && fighter.is_cat_flag(Cat1::Jump) && fighter.sub_check_button_frick().get_bool())) {
935-
VarModule::set_int(fighter.battle_object, vars::littlemac::status::SPECIAL_LW_CANCEL_TYPE, vars::littlemac::SPECIAL_LW_CANCEL_TYPE_GROUND_JUMP);
936-
fighter.change_to_custom_status(statuses::littlemac::SPECIAL_LW_CANCEL, true, false);
937-
}
938-
if fighter.sub_check_command_guard().get_bool() {
939-
VarModule::set_int(fighter.battle_object, vars::littlemac::status::SPECIAL_LW_CANCEL_TYPE, vars::littlemac::SPECIAL_LW_CANCEL_TYPE_GUARD);
940-
fighter.change_to_custom_status(statuses::littlemac::SPECIAL_LW_CANCEL, true, false);
941-
WorkModule::unable_transition_term(fighter.module_accessor, *FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_GUARD_ON);
942-
}
943-
}
944-
else {
945-
if fighter.is_cat_flag(Cat1::AirEscape) {
946-
VarModule::set_int(fighter.battle_object, vars::littlemac::status::SPECIAL_LW_CANCEL_TYPE, vars::littlemac::SPECIAL_LW_CANCEL_TYPE_ESCAPE_AIR);
947-
fighter.change_to_custom_status(statuses::littlemac::SPECIAL_LW_CANCEL, true, false);
948-
WorkModule::unable_transition_term(fighter.module_accessor, *FIGHTER_STATUS_TRANSITION_TERM_ID_CONT_ESCAPE_AIR);
949-
}
950-
else if (fighter.is_cat_flag(Cat1::JumpButton) || (ControlModule::is_enable_flick_jump(fighter.module_accessor) && fighter.is_cat_flag(Cat1::Jump)))
951-
&& fighter.get_num_used_jumps() < fighter.get_jump_count_max()
952-
{
953-
VarModule::set_int(fighter.battle_object, vars::littlemac::status::SPECIAL_LW_CANCEL_TYPE, vars::littlemac::SPECIAL_LW_CANCEL_TYPE_JUMP_AERIAL);
954-
fighter.change_to_custom_status(statuses::littlemac::SPECIAL_LW_CANCEL_JUMP, true, false);
955-
}
956-
}
957-
}
958-
}
959-
960918
// Pac-Man
961919
unsafe fn pacman_nspecial_cancels(boma: &mut BattleObjectModuleAccessor, status_kind: i32, situation_kind: i32) {
962920
if status_kind == *FIGHTER_KIRBY_STATUS_KIND_PACMAN_SPECIAL_N_CANCEL {
@@ -1347,7 +1305,6 @@ pub unsafe fn moveset(fighter: &mut L2CFighterCommon, boma: &mut BattleObjectMod
13471305
diddy_nspecial_cancels(fighter, boma, status_kind);
13481306
lucario_nspecial_cancels(boma, status_kind, situation_kind, cat[2]);
13491307
wiifit_nspecial_cancels(boma, status_kind, situation_kind);
1350-
littlemac_nspecial_cancels(fighter, boma, status_kind, situation_kind, cat[0], frame);
13511308
pacman_nspecial_cancels(boma, status_kind, situation_kind);
13521309
brave_nspecial_cancels(fighter);
13531310
edge_nspecial_cancels(boma, status_kind, situation_kind, cat[2]);

fighters/kirby/src/status.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ mod ridley_special_n;
99
mod ganon_special_n;
1010
mod ganon_special_n_float;
1111
mod koopa_special_n;
12-
mod littlemac_special_n_cancel;
12+
mod littlemac_special_n;
1313
mod diddy_special_n_cancel;
1414
mod lucas_special_n;
1515
mod sonic;
@@ -32,14 +32,14 @@ pub fn install() {
3232
luigi_special_n::install();
3333
mario_special_n::install();
3434
mariod_special_n::install();
35+
littlemac_special_n::install();
3536
lucas_special_n::install();
3637
sonic::install();
3738
}
3839

3940
pub fn add_statuses() {
4041
special_hi_h::install();
4142
ganon_special_n_float::install();
42-
littlemac_special_n_cancel::install();
4343
diddy_special_n_cancel::install_custom();
4444
}
4545

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
use super::*;
2+
use globals::*;
3+
4+
#[skyline::from_offset(0xb96770)]
5+
fn copy_ability_reset(fighter: *mut Fighter, some_miifighter_bool: bool);
6+
7+
#[status_script(agent = "kirby", status = FIGHTER_KIRBY_STATUS_KIND_LITTLEMAC_SPECIAL_N_START, condition = LUA_SCRIPT_STATUS_FUNC_STATUS_PRE)]
8+
unsafe fn littlemac_special_n_pre(fighter: &mut L2CFighterCommon) -> L2CValue {
9+
fighter.sub_status_pre_SpecialNCommon();
10+
StatusModule::init_settings(fighter.module_accessor,
11+
app::SituationKind(*SITUATION_KIND_NONE),
12+
*FIGHTER_KINETIC_TYPE_UNIQ,
13+
*GROUND_CORRECT_KIND_KEEP as u32,
14+
app::GroundCliffCheckKind(*GROUND_CLIFF_CHECK_KIND_NONE),
15+
true,
16+
*FIGHTER_STATUS_WORK_KEEP_FLAG_NONE_FLAG,
17+
*FIGHTER_STATUS_WORK_KEEP_FLAG_NONE_INT,
18+
*FIGHTER_STATUS_WORK_KEEP_FLAG_NONE_FLOAT,
19+
0
20+
);
21+
FighterStatusModuleImpl::set_fighter_status_data(
22+
fighter.module_accessor,
23+
false,
24+
*FIGHTER_TREADED_KIND_NO_REAC,
25+
false,
26+
false,
27+
false,
28+
(*FIGHTER_LOG_MASK_FLAG_ATTACK_KIND_SPECIAL_N | *FIGHTER_LOG_MASK_FLAG_ACTION_CATEGORY_ATTACK | *FIGHTER_LOG_MASK_FLAG_ACTION_TRIGGER_ON) as u64,
29+
*FIGHTER_STATUS_ATTR_START_TURN as u32,
30+
*FIGHTER_POWER_UP_ATTACK_BIT_SPECIAL_N as u32,
31+
0
32+
);
33+
34+
0.into()
35+
}
36+
37+
#[status_script(agent = "kirby", status = FIGHTER_KIRBY_STATUS_KIND_LITTLEMAC_SPECIAL_N_START, condition = LUA_SCRIPT_STATUS_FUNC_STATUS_MAIN)]
38+
unsafe fn littlemac_special_n_main(fighter: &mut L2CFighterCommon) -> L2CValue {
39+
WorkModule::set_int(fighter.module_accessor, *FIGHTER_LOG_ATTACK_SUB_KIND_UNIQ, *FIGHTER_INSTANCE_WORK_ID_INT_TRICK_SUB);
40+
let sum_spd_x = KineticModule::get_sum_speed_x(fighter.module_accessor, *KINETIC_ENERGY_RESERVE_ATTRIBUTE_MAIN);
41+
if fighter.is_situation(*SITUATION_KIND_GROUND) {
42+
sv_kinetic_energy!(reset_energy, fighter, FIGHTER_KINETIC_ENERGY_ID_STOP, ENERGY_STOP_RESET_TYPE_GROUND, 0.0, 0.0, 0.0, 0.0, 0.0);
43+
sv_kinetic_energy!(set_speed, fighter, FIGHTER_KINETIC_ENERGY_ID_STOP, sum_spd_x * 0.3, 0.0);
44+
sv_kinetic_energy!(set_accel, fighter, FIGHTER_KINETIC_ENERGY_ID_STOP, 0.0, 0.0);
45+
sv_kinetic_energy!(reset_energy, fighter, FIGHTER_KINETIC_ENERGY_ID_MOTION, ENERGY_MOTION_RESET_TYPE_GROUND_TRANS);
46+
}
47+
else {
48+
sv_kinetic_energy!(reset_energy, fighter, FIGHTER_KINETIC_ENERGY_ID_STOP, ENERGY_STOP_RESET_TYPE_AIR, 0.0, 0.0, 0.0, 0.0, 0.0);
49+
sv_kinetic_energy!(set_speed, fighter, FIGHTER_KINETIC_ENERGY_ID_STOP, sum_spd_x * 0.3, 0.0);
50+
sv_kinetic_energy!(set_accel, fighter, FIGHTER_KINETIC_ENERGY_ID_STOP, 0.0, 0.0);
51+
sv_kinetic_energy!(reset_energy, fighter, FIGHTER_KINETIC_ENERGY_ID_MOTION, ENERGY_MOTION_RESET_TYPE_AIR_TRANS);
52+
}
53+
KineticModule::enable_energy(fighter.module_accessor, *FIGHTER_KINETIC_ENERGY_ID_STOP);
54+
KineticModule::enable_energy(fighter.module_accessor, *FIGHTER_KINETIC_ENERGY_ID_MOTION);
55+
sv_kinetic_energy!(reset_energy, fighter, FIGHTER_KINETIC_ENERGY_ID_CONTROL, ENERGY_CONTROLLER_RESET_TYPE_FREE, 0.0, 0.0, 0.0, 0.0, 0.0);
56+
KineticModule::unable_energy(fighter.module_accessor, *FIGHTER_KINETIC_ENERGY_ID_CONTROL);
57+
let motion = if fighter.is_situation(*SITUATION_KIND_GROUND) { Hash40::new("littlemac_special_n") } else { Hash40::new("littlemac_special_air_n") };
58+
MotionModule::change_motion(fighter.module_accessor, motion, 0.0, 1.0, false, 0.0, false, false);
59+
EffectModule::remove_common(fighter.module_accessor, Hash40::new("charge_max"));
60+
if !VarModule::is_flag(fighter.object(), vars::kirby::status::KO_PUNCH_GRAVITY_END) {
61+
sv_kinetic_energy!(reset_energy, fighter, FIGHTER_KINETIC_ENERGY_ID_GRAVITY, ENERGY_GRAVITY_RESET_TYPE_GRAVITY, 0.0, 0.0, 0.0, 0.0, 0.0);
62+
}
63+
KineticModule::unable_energy(fighter.module_accessor, *FIGHTER_KINETIC_ENERGY_ID_GRAVITY);
64+
notify_event_msc_cmd!(fighter, Hash40::new_raw(0x20cbc92683), 1, FIGHTER_LOG_DATA_INT_ATTACK_NUM_KIND, (*FIGHTER_LOG_ATTACK_KIND_ADDITIONS_ATTACK_02) + -1);
65+
notify_event_msc_cmd!(fighter, Hash40::new_raw(0x3a40337e2c), (*FIGHTER_LOG_ATTACK_KIND_ADDITIONS_ATTACK_02) + -1);
66+
fighter.main_shift(littlemac_special_n_main_loop)
67+
}
68+
69+
unsafe extern "C" fn littlemac_special_n_main_loop(fighter: &mut L2CFighterCommon) -> L2CValue {
70+
if CancelModule::is_enable_cancel(fighter.module_accessor) {
71+
if fighter.sub_wait_ground_check_common(false.into()).get_bool()
72+
|| fighter.sub_air_check_fall_common().get_bool() {
73+
return 1.into();
74+
}
75+
}
76+
if MotionModule::is_end(fighter.module_accessor) {
77+
let status = if fighter.is_situation(*SITUATION_KIND_GROUND) {
78+
FIGHTER_STATUS_KIND_WAIT
79+
}
80+
else {
81+
FIGHTER_STATUS_KIND_FALL
82+
};
83+
fighter.change_status(status.into(), false.into());
84+
return 0.into();
85+
}
86+
if fighter.is_prev_situation(*SITUATION_KIND_AIR) {
87+
if fighter.is_situation(*SITUATION_KIND_GROUND) {
88+
GroundModule::correct(fighter.module_accessor, GroundCorrectKind(*GROUND_CORRECT_KIND_GROUND));
89+
MotionModule::change_motion_inherit_frame(fighter.module_accessor, Hash40::new("littlemac_special_n"), -1.0, 1.0, 0.0, true, true);
90+
let mut speed_x = fighter.get_speed_x(*FIGHTER_KINETIC_ENERGY_ID_STOP);
91+
sv_kinetic_energy!(reset_energy, fighter, FIGHTER_KINETIC_ENERGY_ID_STOP, ENERGY_STOP_RESET_TYPE_GROUND, 0.0, 0.0, 0.0, 0.0, 0.0);
92+
sv_kinetic_energy!(set_speed, fighter, FIGHTER_KINETIC_ENERGY_ID_STOP, speed_x, 0.0);
93+
speed_x = fighter.get_speed_x(*FIGHTER_KINETIC_ENERGY_ID_MOTION);
94+
sv_kinetic_energy!(reset_energy, fighter, FIGHTER_KINETIC_ENERGY_ID_MOTION, ENERGY_MOTION_RESET_TYPE_GROUND_TRANS, 0.0, 0.0, 0.0, 0.0, 0.0);
95+
sv_kinetic_energy!(set_speed, fighter, FIGHTER_KINETIC_ENERGY_ID_MOTION, speed_x, 0.0);
96+
sv_kinetic_energy!(reset_energy, fighter, FIGHTER_KINETIC_ENERGY_ID_GRAVITY, ENERGY_GRAVITY_RESET_TYPE_GRAVITY, 0.0, 0.0, 0.0, 0.0, 0.0);
97+
KineticModule::unable_energy(fighter.module_accessor, *FIGHTER_KINETIC_ENERGY_ID_GRAVITY);
98+
ControlModule::set_rumble(fighter.module_accessor, Hash40::new("rbkind_landl"), 0, false, *BATTLE_OBJECT_ID_INVALID as u32);
99+
}
100+
}
101+
else {
102+
if fighter.is_situation(*SITUATION_KIND_AIR) {
103+
GroundModule::correct(fighter.module_accessor, GroundCorrectKind(*GROUND_CORRECT_KIND_AIR));
104+
MotionModule::change_motion_inherit_frame(fighter.module_accessor, Hash40::new("littlemac_special_air_n"), -1.0, 1.0, 0.0, true, true);
105+
let mut speed_x = fighter.get_speed_x(*FIGHTER_KINETIC_ENERGY_ID_STOP);
106+
sv_kinetic_energy!(reset_energy, fighter, FIGHTER_KINETIC_ENERGY_ID_STOP, ENERGY_STOP_RESET_TYPE_AIR, 0.0, 0.0, 0.0, 0.0, 0.0);
107+
sv_kinetic_energy!(set_speed, fighter, FIGHTER_KINETIC_ENERGY_ID_STOP, speed_x, 0.0);
108+
speed_x = fighter.get_speed_x(*FIGHTER_KINETIC_ENERGY_ID_MOTION);
109+
sv_kinetic_energy!(reset_energy, fighter, FIGHTER_KINETIC_ENERGY_ID_MOTION, ENERGY_MOTION_RESET_TYPE_AIR_TRANS, 0.0, 0.0, 0.0, 0.0, 0.0);
110+
sv_kinetic_energy!(set_speed, fighter, FIGHTER_KINETIC_ENERGY_ID_MOTION, speed_x, 0.0);
111+
if VarModule::is_flag(fighter.object(), vars::kirby::status::KO_PUNCH_GRAVITY_END) {
112+
sv_kinetic_energy!(reset_energy, fighter, FIGHTER_KINETIC_ENERGY_ID_GRAVITY, ENERGY_GRAVITY_RESET_TYPE_GRAVITY, 0.0, 0.0, 0.0, 0.0, 0.0);
113+
KineticModule::enable_energy(fighter.module_accessor, *FIGHTER_KINETIC_ENERGY_ID_GRAVITY);
114+
}
115+
else {
116+
KineticModule::unable_energy(fighter.module_accessor, *FIGHTER_KINETIC_ENERGY_ID_GRAVITY);
117+
}
118+
}
119+
}
120+
if VarModule::is_flag(fighter.object(), vars::kirby::status::KO_PUNCH_GRAVITY) {
121+
VarModule::on_flag(fighter.object(), vars::kirby::status::KO_PUNCH_GRAVITY_END);
122+
VarModule::off_flag(fighter.object(), vars::kirby::status::KO_PUNCH_GRAVITY);
123+
if !fighter.is_situation(*SITUATION_KIND_GROUND) {
124+
let sum_spd_y = KineticModule::get_sum_speed_y(fighter.module_accessor, *KINETIC_ENERGY_RESERVE_ATTRIBUTE_MAIN);
125+
sv_kinetic_energy!(reset_energy, fighter, FIGHTER_KINETIC_ENERGY_ID_GRAVITY, ENERGY_GRAVITY_RESET_TYPE_GRAVITY, 0.0, 0.0, 0.0, 0.0, 0.0);
126+
sv_kinetic_energy!(set_speed, fighter, FIGHTER_KINETIC_ENERGY_ID_GRAVITY, sum_spd_y);
127+
KineticModule::enable_energy(fighter.module_accessor, *FIGHTER_KINETIC_ENERGY_ID_GRAVITY);
128+
}
129+
}
130+
131+
return 0.into()
132+
}
133+
134+
#[status_script(agent = "kirby", status = FIGHTER_KIRBY_STATUS_KIND_LITTLEMAC_SPECIAL_N_START, condition = LUA_SCRIPT_STATUS_FUNC_STATUS_END)]
135+
unsafe fn littlemac_special_n_end(fighter: &mut L2CFighterCommon) -> L2CValue {
136+
WorkModule::set_int(fighter.module_accessor, *FIGHTER_LOG_ATTACK_SUB_KIND_NONE, *FIGHTER_INSTANCE_WORK_ID_INT_TRICK_SUB);
137+
EFFECT_OFF_KIND(fighter, Hash40::new("sys_starrod_bullet"), false, false);
138+
let kirb = fighter.battle_object.cast::<Fighter>();
139+
copy_ability_reset(kirb, false);
140+
EffectModule::req_on_joint(fighter.module_accessor, Hash40::new("kirby_star"), Hash40::new("top"), &Vector3f::zero(), &Vector3f::zero(), 1.0, &Vector3f::zero(), &Vector3f::zero(), false, 0, 0, 0);
141+
PLAY_SE(fighter, Hash40::new_raw(0x14cad4d75e));
142+
return 0.into()
143+
}
144+
145+
pub fn install() {
146+
install_status_scripts!(
147+
littlemac_special_n_main,
148+
littlemac_special_n_pre,
149+
littlemac_special_n_main,
150+
littlemac_special_n_end,
151+
);
152+
}

0 commit comments

Comments
 (0)