Skip to content

Commit 40ac1f3

Browse files
committed
fixes neutral b cancels and unfloat confusion for SL2
1 parent fb9aa1f commit 40ac1f3

File tree

3 files changed

+64
-30
lines changed

3 files changed

+64
-30
lines changed

fighters/mewtwo/src/acmd/specials.rs

-5
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,6 @@ unsafe extern "C" fn mewtwo_special_s_effect(fighter: &mut L2CAgentBase) {
5050
if is_excute(fighter) {
5151
EFFECT_FOLLOW_FLIP(fighter, Hash40::new("mewtwo_pk_hand"), Hash40::new("mewtwo_pk_hand"), Hash40::new("havel"), -1.5, 0, 2, 0, 0, 0, 0.4, true, *EF_FLIP_YZ);
5252
}
53-
frame(lua_state, 8.0);
54-
if is_excute(fighter) {
55-
EFFECT(fighter, Hash40::new("sys_smash_flash_s"), Hash40::new("top"), 0, 8, 13, 0, 0, 0, 1.0, 0, 0, 0, 0, 0, 0, true);
56-
LAST_EFFECT_SET_ALPHA(fighter, 0.8);
57-
}
5853
frame(lua_state, 10.0);
5954
if is_excute(fighter) {
6055
EFFECT_FOLLOW_NO_STOP(fighter, Hash40::new("mewtwo_nenriki"), Hash40::new("top"), 0, 9, 17, 0, 90, 0, 0.45, true);

fighters/mewtwo/src/opff.rs

-25
Original file line numberDiff line numberDiff line change
@@ -67,29 +67,6 @@ unsafe fn dj_upB_jump_refresh(fighter: &mut L2CFighterCommon) {
6767
}
6868
}
6969

70-
unsafe fn nspecial_cancels(boma: &mut BattleObjectModuleAccessor, status_kind: i32, situation_kind: i32) {
71-
//PM-like neutral-b canceling
72-
if status_kind == *FIGHTER_MEWTWO_STATUS_KIND_SPECIAL_N_CANCEL {
73-
if situation_kind == *SITUATION_KIND_AIR {
74-
if WorkModule::get_int(boma, *FIGHTER_MEWTWO_SPECIAL_N_STATUS_WORK_ID_INT_CANCEL_STATUS) == *FIGHTER_STATUS_KIND_ESCAPE_AIR {
75-
WorkModule::set_int(boma, *STATUS_KIND_NONE, *FIGHTER_MEWTWO_SPECIAL_N_STATUS_WORK_ID_INT_CANCEL_STATUS);
76-
}
77-
if MotionModule::is_end(boma) {
78-
StatusModule::change_status_request_from_script(boma, *FIGHTER_STATUS_KIND_FALL_AERIAL, false);
79-
}
80-
}
81-
}
82-
}
83-
84-
unsafe fn unfloat_confusion(fighter: &mut smash::lua2cpp::L2CFighterCommon, status_kind: i32) {
85-
if status_kind == FIGHTER_STATUS_KIND_SPECIAL_S
86-
&& StatusModule::is_changing(fighter.module_accessor)
87-
&& fighter.get_int(*FIGHTER_INSTANCE_WORK_ID_INT_SUPERLEAF_FALL_SLOWLY_FRAME) > 0
88-
&& fighter.get_int(*FIGHTER_INSTANCE_WORK_ID_INT_SUPERLEAF_FALL_SLOWLY_FRAME) < VarModule::get_int(fighter.battle_object, vars::common::instance::FLOAT_DURATION) {
89-
fighter.on_flag(*FIGHTER_MEWTWO_INSTANCE_WORK_ID_FLAG_SPECIAL_S_BUOYANCY);
90-
}
91-
}
92-
9370
pub unsafe fn mewtwo_teleport_wall_ride(fighter: &mut smash::lua2cpp::L2CFighterCommon, boma: &mut BattleObjectModuleAccessor, status_kind: i32, id: usize) {
9471
// Wall Ride momentum fixes
9572
let touch_right = GroundModule::is_wall_touch_line(boma, *GROUND_TOUCH_FLAG_RIGHT_SIDE as u32);
@@ -156,8 +133,6 @@ unsafe fn fastfall_specials(fighter: &mut L2CFighterCommon) {
156133

157134
pub unsafe fn moveset(fighter: &mut L2CFighterCommon, boma: &mut BattleObjectModuleAccessor, id: usize, cat: [i32 ; 4], status_kind: i32, situation_kind: i32, motion_kind: u64, stick_x: f32, stick_y: f32, facing: f32, frame: f32) {
158135
actionable_teleport_air(fighter, boma, id, status_kind, situation_kind, frame);
159-
nspecial_cancels(boma, status_kind, situation_kind);
160-
unfloat_confusion(fighter, status_kind);
161136
mewtwo_teleport_wall_ride(fighter, boma, status_kind, id);
162137
dj_upB_jump_refresh(fighter);
163138
fastfall_specials(fighter);

fighters/mewtwo/src/status.rs

+64
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,72 @@ pub unsafe extern "C" fn attack_air(fighter: &mut L2CFighterCommon) -> L2CValue
1010
common::djc::attack_air_main_status(fighter)
1111
}
1212

13+
// FIGHTER_MEWTWO_STATUS_KIND_SPECIAL_N_CANCEL //
14+
15+
unsafe extern "C" fn special_n_cancel_main(fighter: &mut L2CFighterCommon) -> L2CValue {
16+
if fighter.global_table[SITUATION_KIND] == SITUATION_KIND_GROUND {
17+
GroundModule::correct(fighter.module_accessor, GroundCorrectKind(*GROUND_CORRECT_KIND_GROUND_CLIFF_STOP));
18+
KineticModule::change_kinetic(fighter.module_accessor, *FIGHTER_KINETIC_TYPE_GROUND_STOP);
19+
MotionModule::change_motion(fighter.module_accessor, Hash40::new("special_n_cancel"), 0.0, 1.0, false, 0.0, false, false);
20+
} else {
21+
if fighter.get_int(*FIGHTER_MEWTWO_SPECIAL_N_STATUS_WORK_ID_INT_CANCEL_STATUS) == *FIGHTER_STATUS_KIND_JUMP_AERIAL {
22+
fighter.change_status(FIGHTER_STATUS_KIND_JUMP_AERIAL.into(), false.into());
23+
} // jump cancel
24+
else {
25+
GroundModule::correct(fighter.module_accessor, GroundCorrectKind(*GROUND_CORRECT_KIND_AIR));
26+
KineticModule::change_kinetic(fighter.module_accessor, *FIGHTER_KINETIC_TYPE_AIR_STOP);
27+
MotionModule::change_motion(fighter.module_accessor, Hash40::new("special_air_n_cancel"), 0.0, 1.0, false, 0.0, false, false);
28+
}
29+
}
30+
let status = fighter.get_int(*FIGHTER_MEWTWO_SPECIAL_N_STATUS_WORK_ID_INT_CANCEL_STATUS);
31+
if status == *STATUS_KIND_NONE || status == *FIGHTER_STATUS_KIND_GUARD_ON {fighter.set_int(*FIGHTER_STATUS_KIND_WAIT,*FIGHTER_MEWTWO_SPECIAL_N_STATUS_WORK_ID_INT_CANCEL_STATUS); }
32+
ControlModule::set_add_jump_mini_button_life(fighter.module_accessor, 8);
33+
fighter.main_shift(special_n_cancel_main_loop)
34+
}
35+
36+
unsafe extern "C" fn special_n_cancel_main_loop(fighter: &mut L2CFighterCommon) -> L2CValue {
37+
if fighter.global_table[PREV_SITUATION_KIND] == SITUATION_KIND_GROUND && fighter.global_table[SITUATION_KIND] == SITUATION_KIND_AIR {
38+
GroundModule::correct(fighter.module_accessor, GroundCorrectKind(*GROUND_CORRECT_KIND_AIR));
39+
KineticModule::change_kinetic(fighter.module_accessor, *FIGHTER_KINETIC_TYPE_AIR_STOP);
40+
MotionModule::change_motion_inherit_frame(fighter.module_accessor, Hash40::new("special_air_n_cancel"), -1.0, 1.0, 0.0, false, false);
41+
}
42+
else if fighter.global_table[PREV_SITUATION_KIND] == SITUATION_KIND_AIR && fighter.global_table[SITUATION_KIND] == SITUATION_KIND_GROUND {
43+
fighter.set_int(*FIGHTER_STATUS_KIND_WAIT, *FIGHTER_MEWTWO_SPECIAL_N_STATUS_WORK_ID_INT_CANCEL_STATUS);
44+
GroundModule::correct(fighter.module_accessor, GroundCorrectKind(*GROUND_CORRECT_KIND_GROUND_CLIFF_STOP));
45+
KineticModule::change_kinetic(fighter.module_accessor, *FIGHTER_KINETIC_TYPE_GROUND_STOP);
46+
MotionModule::change_motion_inherit_frame(fighter.module_accessor, Hash40::new("special_n_cancel"), -1.0, 1.0, 0.0, false, false);
47+
}
48+
if CancelModule::is_enable_cancel(fighter.module_accessor) {
49+
if fighter.is_situation(*SITUATION_KIND_GROUND) {
50+
let status = fighter.get_int(*FIGHTER_MEWTWO_SPECIAL_N_STATUS_WORK_ID_INT_CANCEL_STATUS);
51+
fighter.change_status(L2CValue::I32(status).into(), false.into());
52+
return 1.into();
53+
}
54+
if fighter.sub_air_check_fall_common().get_bool()
55+
|| fighter.sub_wait_ground_check_common(false.into()).get_bool() {
56+
return 0.into();
57+
}
58+
}
59+
if MotionModule::is_end(fighter.module_accessor) {
60+
if fighter.is_situation(*SITUATION_KIND_GROUND) {fighter.change_status(FIGHTER_STATUS_KIND_WAIT.into(), false.into()); }
61+
else {fighter.change_status(FIGHTER_STATUS_KIND_FALL_AERIAL.into(), false.into()); }
62+
}
63+
return 0.into();
64+
}
65+
66+
// FIGHTER_STATUS_KIND_SPECIAL_S //
67+
68+
pub unsafe extern "C" fn special_s_pre(fighter: &mut L2CFighterCommon) -> L2CValue {
69+
if fighter.is_flag(*FIGHTER_STATUS_WORK_ID_FLAG_RESERVE_FALL_SLOWLY) {
70+
fighter.on_flag(*FIGHTER_MEWTWO_INSTANCE_WORK_ID_FLAG_SPECIAL_S_BUOYANCY);
71+
}
72+
smashline::original_status(Pre, fighter, *FIGHTER_STATUS_KIND_SPECIAL_S)(fighter)
73+
}
74+
1375
pub fn install() {
1476
smashline::Agent::new("mewtwo")
1577
.status(Main, *FIGHTER_STATUS_KIND_ATTACK_AIR, attack_air)
78+
.status(Main, *FIGHTER_MEWTWO_STATUS_KIND_SPECIAL_N_CANCEL, special_n_cancel_main)
79+
.status(Pre, *FIGHTER_STATUS_KIND_SPECIAL_S, special_s_pre)
1680
.install();
1781
}

0 commit comments

Comments
 (0)