Skip to content

Commit 4cc53d4

Browse files
committed
Kriby
1 parent 90b2ff4 commit 4cc53d4

File tree

7 files changed

+234
-435
lines changed

7 files changed

+234
-435
lines changed

dynamic/src/consts.rs

+2
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,8 @@ pub mod vars {
658658
pub use super::super::luigi::status::THUNDERHAND;
659659
pub use super::super::mariod::status::CHILL_PILL;
660660
pub const MINING_TIMER: i32 = 0x11F4;
661+
pub const KO_PUNCH_GRAVITY: i32 = 0x11F5;
662+
pub const KO_PUNCH_GRAVITY_END: i32 = 0x11F6;
661663
}
662664
}
663665

fighters/kirby/src/acmd/copyspecials.rs

+71-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;
@@ -31,14 +31,14 @@ pub fn install() {
3131
luigi_special_n::install();
3232
mario_special_n::install();
3333
mariod_special_n::install();
34+
littlemac_special_n::install();
3435
lucas_special_n::install();
3536
sonic::install();
3637
}
3738

3839
pub fn add_statuses() {
3940
special_hi_h::install();
4041
ganon_special_n_float::install();
41-
littlemac_special_n_cancel::install();
4242
diddy_special_n_cancel::install();
4343
}
4444

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

0 commit comments

Comments
 (0)