Rolling can now only interrupt abilities when in buildup

This commit is contained in:
Sam 2022-02-17 14:14:47 -05:00
parent 7b27b63122
commit 1e0dfe003d
73 changed files with 83 additions and 123 deletions

View File

@ -51,6 +51,5 @@ ComboMelee(
speed_increase: 0.1,
max_speed_increase: 0.6,
scales_from_combo: 2,
is_interruptible: false,
ori_modifier: 1.0,
)

View File

@ -16,7 +16,6 @@ SpinMelee(
energy_cost: 10.0,
is_infinite: true,
movement_behavior: AxeHover,
is_interruptible: false,
forward_speed: 0.0,
num_spins: 1,
specifier: None,

View File

@ -51,6 +51,5 @@ ComboMelee(
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 0,
is_interruptible: false,
ori_modifier: 0.7,
)

View File

@ -24,5 +24,4 @@ DashMelee(
recover_duration: 0.8,
ori_modifier: 0.1,
charge_through: false,
is_interruptible: false,
)
)

View File

@ -29,6 +29,5 @@ ComboMelee(
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 0,
is_interruptible: false,
ori_modifier: 0.8,
)
)

View File

@ -29,6 +29,5 @@ ComboMelee(
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 0,
is_interruptible: false,
ori_modifier: 0.8,
)
)

View File

@ -23,6 +23,5 @@ ComboMelee(
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 0,
is_interruptible: false,
ori_modifier: 0.6,
)
)

View File

@ -23,6 +23,5 @@ ComboMelee(
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 0,
is_interruptible: false,
ori_modifier: 0.65,
)

View File

@ -24,5 +24,4 @@ DashMelee(
recover_duration: 2.0,
ori_modifier: 0.3,
charge_through: false,
is_interruptible: false,
)

View File

@ -55,6 +55,5 @@ ComboMelee(
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 0,
is_interruptible: false,
ori_modifier: 0.65,
)

View File

@ -24,5 +24,4 @@ DashMelee(
recover_duration: 1.4,
ori_modifier: 0.3,
charge_through: false,
is_interruptible: false,
)

View File

@ -55,6 +55,5 @@ ComboMelee(
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 0,
is_interruptible: false,
ori_modifier: 0.7,
)

View File

@ -73,6 +73,5 @@ ComboMelee(
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 0,
is_interruptible: false,
ori_modifier: 0.7,
)

View File

@ -73,6 +73,5 @@ ComboMelee(
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 0,
is_interruptible: false,
ori_modifier: 0.7,
)

View File

@ -23,6 +23,5 @@ ComboMelee(
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 0,
is_interruptible: false,
ori_modifier: 0.6,
)

View File

@ -55,6 +55,5 @@ ComboMelee(
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 0,
is_interruptible: false,
ori_modifier: 0.6,
)

View File

@ -23,6 +23,5 @@ ComboMelee(
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 0,
is_interruptible: false,
ori_modifier: 0.6,
)

View File

@ -23,6 +23,5 @@ ComboMelee(
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 0,
is_interruptible: false,
ori_modifier: 0.65,
)

View File

@ -15,7 +15,6 @@ SpinMelee(
energy_cost: 0.0,
is_infinite: true,
movement_behavior: Stationary,
is_interruptible: false,
forward_speed: 0.0,
num_spins: 1,
specifier: Some(CultistVortex),

View File

@ -31,5 +31,4 @@ DashMelee(
recover_duration: 3.4,
ori_modifier: 0.1,
charge_through: false,
is_interruptible: false,
)

View File

@ -24,5 +24,4 @@ DashMelee(
recover_duration: 2.4,
ori_modifier: 0.3,
charge_through: false,
is_interruptible: true,
)

View File

@ -51,6 +51,5 @@ ComboMelee(
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 0,
is_interruptible: false,
ori_modifier: 0.6,
)

View File

@ -23,6 +23,5 @@ ComboMelee(
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 0,
is_interruptible: false,
ori_modifier: 0.6,
)

View File

@ -55,6 +55,5 @@ ComboMelee(
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 0,
is_interruptible: false,
ori_modifier: 0.65,
)

View File

@ -24,5 +24,4 @@ DashMelee(
recover_duration: 2.0,
ori_modifier: 0.3,
charge_through: false,
is_interruptible: false,
)

View File

@ -55,6 +55,5 @@ ComboMelee(
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 0,
is_interruptible: false,
ori_modifier: 0.7,
)

View File

@ -24,5 +24,4 @@ DashMelee(
recover_duration: 2.0,
ori_modifier: 0.3,
charge_through: false,
is_interruptible: false,
)

View File

@ -71,6 +71,5 @@ ComboMelee(
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 0,
is_interruptible: false,
ori_modifier: 0.8,
)

View File

@ -55,6 +55,5 @@ ComboMelee(
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 0,
is_interruptible: false,
ori_modifier: 0.7,
)

View File

@ -23,6 +23,5 @@ ComboMelee(
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 0,
is_interruptible: false,
ori_modifier: 0.7,
)

View File

@ -55,6 +55,5 @@ ComboMelee(
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 0,
is_interruptible: false,
ori_modifier: 0.7,
)

View File

@ -24,5 +24,4 @@ DashMelee(
recover_duration: 2.2,
ori_modifier: 0.3,
charge_through: false,
is_interruptible: false,
)

View File

@ -39,6 +39,5 @@ ComboMelee(
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 0,
is_interruptible: false,
ori_modifier: 0.7,
)

View File

@ -39,6 +39,5 @@ ComboMelee(
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 0,
is_interruptible: false,
ori_modifier: 0.8,
)

View File

@ -24,5 +24,4 @@ DashMelee(
recover_duration: 2.0,
ori_modifier: 0.3,
charge_through: false,
is_interruptible: false,
)

View File

@ -55,6 +55,5 @@ ComboMelee(
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 0,
is_interruptible: false,
ori_modifier: 0.8,
)

View File

@ -23,6 +23,5 @@ ComboMelee(
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 0,
is_interruptible: false,
ori_modifier: 0.7,
)

View File

@ -23,6 +23,5 @@ ComboMelee(
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 0,
is_interruptible: false,
ori_modifier: 0.7,
)

View File

@ -16,7 +16,6 @@ SpinMelee(
energy_cost: 0,
is_infinite: false,
movement_behavior: Stationary,
is_interruptible: false,
forward_speed: 0.0,
num_spins: 1,
specifier: None,

View File

@ -24,5 +24,4 @@ DashMelee(
recover_duration: 1.8,
ori_modifier: 0.3,
charge_through: false,
is_interruptible: false,
)

View File

@ -23,6 +23,5 @@ ComboMelee(
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 0,
is_interruptible: false,
ori_modifier: 0.7,
)

View File

@ -55,6 +55,5 @@ ComboMelee(
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 0,
is_interruptible: false,
ori_modifier: 0.7,
)

View File

@ -23,6 +23,5 @@ ComboMelee(
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 0,
is_interruptible: false,
ori_modifier: 0.7,
)

View File

@ -55,6 +55,5 @@ ComboMelee(
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 0,
is_interruptible: false,
ori_modifier: 0.6,
)

View File

@ -25,5 +25,4 @@ DashMelee(
recover_duration: 1.0,
ori_modifier: 0.3,
charge_through: false,
is_interruptible: false,
)

View File

@ -16,7 +16,6 @@ SpinMelee(
energy_cost: 0,
is_infinite: true,
movement_behavior: ForwardGround,
is_interruptible: false,
forward_speed: 0.0,
num_spins: 1,
specifier: None,

View File

@ -23,6 +23,5 @@ ComboMelee(
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 0,
is_interruptible: false,
ori_modifier: 0.7,
)

View File

@ -29,6 +29,5 @@ ComboMelee(
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 0,
is_interruptible: false,
ori_modifier: 0.7,
)

View File

@ -21,6 +21,5 @@ ComboMelee(
speed_increase: 0.1,
max_speed_increase: 0.4,
scales_from_combo: 2,
is_interruptible: false,
ori_modifier: 1.0,
)

View File

@ -39,6 +39,5 @@ ComboMelee(
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 0,
is_interruptible: false,
ori_modifier: 0.65,
)

View File

@ -24,5 +24,4 @@ DashMelee(
recover_duration: 0.8,
ori_modifier: 0.3,
charge_through: false,
is_interruptible: true,
)

View File

@ -51,6 +51,5 @@ ComboMelee(
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 2,
is_interruptible: false,
ori_modifier: 0.75,
)

View File

@ -24,5 +24,4 @@ DashMelee(
recover_duration: 0.9,
ori_modifier: 0.3,
charge_through: false,
is_interruptible: true,
)

View File

@ -51,6 +51,5 @@ ComboMelee(
speed_increase: 0.0,
max_speed_increase: 0.0,
scales_from_combo: 0,
is_interruptible: false,
ori_modifier: 0.7,
)

View File

@ -464,7 +464,6 @@ pub enum CharacterAbility {
melee_constructor: MeleeConstructor,
ori_modifier: f32,
charge_through: bool,
is_interruptible: bool,
meta: Option<AbilityMeta>,
},
BasicBlock {
@ -492,7 +491,6 @@ pub enum CharacterAbility {
speed_increase: f32,
max_speed_increase: f32,
scales_from_combo: u32,
is_interruptible: bool,
ori_modifier: f32,
meta: Option<AbilityMeta>,
},
@ -518,7 +516,6 @@ pub enum CharacterAbility {
energy_cost: f32,
is_infinite: bool,
movement_behavior: spin_melee::MovementBehavior,
is_interruptible: bool,
forward_speed: f32,
num_spins: u32,
specifier: Option<spin_melee::FrontendSpecifier>,
@ -824,7 +821,6 @@ impl CharacterAbility {
ref mut melee_constructor,
ori_modifier: _,
charge_through: _,
is_interruptible: _,
meta: _,
} => {
*buildup_duration /= stats.speed;
@ -870,7 +866,6 @@ impl CharacterAbility {
speed_increase: _,
max_speed_increase: _,
scales_from_combo: _,
is_interruptible: _,
ori_modifier: _,
meta: _,
} => {
@ -913,7 +908,6 @@ impl CharacterAbility {
ref mut melee_constructor,
is_infinite: _,
movement_behavior: _,
is_interruptible: _,
forward_speed: _,
num_spins: _,
specifier: _,
@ -1810,7 +1804,6 @@ impl From<(&CharacterAbility, AbilityInfo, &JoinData<'_>)> for CharacterState {
melee_constructor,
ori_modifier,
charge_through,
is_interruptible,
meta: _,
} => CharacterState::DashMelee(dash_melee::Data {
static_data: dash_melee::StaticData {
@ -1823,7 +1816,6 @@ impl From<(&CharacterAbility, AbilityInfo, &JoinData<'_>)> for CharacterState {
recover_duration: Duration::from_secs_f32(*recover_duration),
melee_constructor: *melee_constructor,
ori_modifier: *ori_modifier,
is_interruptible: *is_interruptible,
ability_info,
},
auto_charge: false,
@ -1882,7 +1874,6 @@ impl From<(&CharacterAbility, AbilityInfo, &JoinData<'_>)> for CharacterState {
speed_increase,
max_speed_increase,
scales_from_combo,
is_interruptible,
ori_modifier,
meta: _,
} => CharacterState::ComboMelee(combo_melee::Data {
@ -1895,7 +1886,6 @@ impl From<(&CharacterAbility, AbilityInfo, &JoinData<'_>)> for CharacterState {
speed_increase: 1.0 - *speed_increase,
max_speed_increase: *max_speed_increase,
scales_from_combo: *scales_from_combo,
is_interruptible: *is_interruptible,
ori_modifier: *ori_modifier as f32,
ability_info,
},
@ -1950,7 +1940,6 @@ impl From<(&CharacterAbility, AbilityInfo, &JoinData<'_>)> for CharacterState {
energy_cost,
is_infinite,
movement_behavior,
is_interruptible,
forward_speed,
num_spins,
specifier,
@ -1964,7 +1953,6 @@ impl From<(&CharacterAbility, AbilityInfo, &JoinData<'_>)> for CharacterState {
energy_cost: *energy_cost,
is_infinite: *is_infinite,
movement_behavior: *movement_behavior,
is_interruptible: *is_interruptible,
forward_speed: *forward_speed,
num_spins: *num_spins,
ability_info,

View File

@ -451,6 +451,44 @@ impl CharacterState {
CharacterState::SpriteInteract(_) => None,
}
}
pub fn stage_section(&self) -> Option<StageSection> {
match &self {
CharacterState::Idle(_) => None,
CharacterState::Talk => None,
CharacterState::Climb(_) => None,
CharacterState::Wallrun(_) => None,
CharacterState::Glide(_) => None,
CharacterState::GlideWield(_) => None,
CharacterState::Stunned(data) => Some(data.stage_section),
CharacterState::Sit => None,
CharacterState::Dance => None,
CharacterState::BasicBlock(data) => Some(data.stage_section),
CharacterState::Roll(data) => Some(data.stage_section),
CharacterState::Wielding(_) => None,
CharacterState::Equipping(_) => None,
CharacterState::ComboMelee(data) => Some(data.stage_section),
CharacterState::ComboMelee2(data) => data.stage_section,
CharacterState::BasicMelee(data) => Some(data.stage_section),
CharacterState::BasicRanged(data) => Some(data.stage_section),
CharacterState::Boost(_) => None,
CharacterState::DashMelee(data) => Some(data.stage_section),
CharacterState::LeapMelee(data) => Some(data.stage_section),
CharacterState::SpinMelee(data) => Some(data.stage_section),
CharacterState::ChargedMelee(data) => Some(data.stage_section),
CharacterState::ChargedRanged(data) => Some(data.stage_section),
CharacterState::RepeaterRanged(data) => Some(data.stage_section),
CharacterState::Shockwave(data) => Some(data.stage_section),
CharacterState::BasicBeam(data) => Some(data.stage_section),
CharacterState::BasicAura(data) => Some(data.stage_section),
CharacterState::Blink(data) => Some(data.stage_section),
CharacterState::BasicSummon(data) => Some(data.stage_section),
CharacterState::SelfBuff(data) => Some(data.stage_section),
CharacterState::SpriteSummon(data) => Some(data.stage_section),
CharacterState::UseItem(data) => Some(data.stage_section),
CharacterState::SpriteInteract(data) => Some(data.stage_section),
}
}
}
impl Default for CharacterState {

View File

@ -147,9 +147,7 @@ impl CharacterBehavior for Data {
}
// At end of state logic so an interrupt isn't overwritten
if !input_is_pressed(data, self.static_data.ability_info.input) {
handle_dodge_input(data, &mut update);
}
handle_dodge_interrupt(data, &mut update, None);
update
}

View File

@ -221,9 +221,7 @@ impl CharacterBehavior for Data {
}
// At end of state logic so an interrupt isn't overwritten
if !input_is_pressed(data, self.static_data.ability_info.input) {
handle_dodge_input(data, &mut update);
}
handle_dodge_interrupt(data, &mut update, None);
update
}

View File

@ -97,9 +97,7 @@ impl CharacterBehavior for Data {
}
// At end of state logic so an interrupt isn't overwritten
if !input_is_pressed(data, self.static_data.ability_info.input) {
handle_dodge_input(data, &mut update);
}
handle_dodge_interrupt(data, &mut update, None);
update
}

View File

@ -136,9 +136,7 @@ impl CharacterBehavior for Data {
}
// At end of state logic so an interrupt isn't overwritten
if !input_is_pressed(data, self.static_data.ability_info.input) {
handle_dodge_input(data, &mut update);
}
handle_dodge_interrupt(data, &mut update, None);
update
}

View File

@ -139,9 +139,7 @@ impl CharacterBehavior for Data {
}
// At end of state logic so an interrupt isn't overwritten
if !input_is_pressed(data, self.static_data.ability_info.input) {
handle_dodge_input(data, &mut update);
}
handle_dodge_interrupt(data, &mut update, None);
update
}

View File

@ -172,9 +172,7 @@ impl CharacterBehavior for Data {
}
// At end of state logic so an interrupt isn't overwritten
if !input_is_pressed(data, self.static_data.ability_info.input) {
handle_dodge_input(data, &mut update);
}
handle_dodge_interrupt(data, &mut update, None);
update
}

View File

@ -184,9 +184,7 @@ impl CharacterBehavior for Data {
}
// At end of state logic so an interrupt isn't overwritten
if !input_is_pressed(data, self.static_data.ability_info.input) {
handle_dodge_input(data, &mut update);
}
handle_dodge_interrupt(data, &mut update, None);
update
}

View File

@ -132,8 +132,6 @@ pub struct StaticData {
pub max_speed_increase: f32,
/// Number of times damage scales with combo
pub scales_from_combo: u32,
/// Whether the state can be interrupted by other abilities
pub is_interruptible: bool,
/// Adjusts turning rate during the attack
pub ori_modifier: f32,
/// What key is used to press ability
@ -364,9 +362,7 @@ impl CharacterBehavior for Data {
}
// At end of state logic so an interrupt isn't overwritten
if !input_is_pressed(data, self.static_data.ability_info.input) {
handle_dodge_input(data, &mut update);
}
handle_dodge_interrupt(data, &mut update, None);
update
}

View File

@ -97,9 +97,7 @@ impl CharacterBehavior for Data {
handle_orientation(data, &mut update, 1.0, None);
handle_move(data, &mut update, 0.7);
if !input_is_pressed(data, InputKind::Primary) {
handle_dodge_input(data, &mut update);
}
handle_dodge_interrupt(data, &mut update, Some(InputKind::Primary));
let strike_data =
self.static_data.strikes[self.completed_strikes % self.static_data.strikes.len()];

View File

@ -30,8 +30,6 @@ pub struct StaticData {
pub melee_constructor: MeleeConstructor,
/// How fast can you turn during charge
pub ori_modifier: f32,
/// Whether the state can be interrupted by other abilities
pub is_interruptible: bool,
/// What key is used to press ability
pub ability_info: AbilityInfo,
}
@ -247,9 +245,7 @@ impl CharacterBehavior for Data {
}
// At end of state logic so an interrupt isn't overwritten
if !input_is_pressed(data, self.static_data.ability_info.input) {
handle_dodge_input(data, &mut update);
}
handle_dodge_interrupt(data, &mut update, None);
update
}

View File

@ -155,9 +155,7 @@ impl CharacterBehavior for Data {
}
// At end of state logic so an interrupt isn't overwritten
if !input_is_pressed(data, self.static_data.ability_info.input) {
handle_dodge_input(data, &mut update);
}
handle_dodge_interrupt(data, &mut update, None);
update
}

View File

@ -160,9 +160,7 @@ impl CharacterBehavior for Data {
}
// At end of state logic so an interrupt isn't overwritten
if !input_is_pressed(data, self.static_data.ability_info.input) {
handle_dodge_input(data, &mut update);
}
handle_dodge_interrupt(data, &mut update, None);
update
}

View File

@ -116,9 +116,7 @@ impl CharacterBehavior for Data {
}
// At end of state logic so an interrupt isn't overwritten
if !input_is_pressed(data, self.static_data.ability_info.input) {
handle_dodge_input(data, &mut update);
}
handle_dodge_interrupt(data, &mut update, None);
update
}

View File

@ -169,9 +169,7 @@ impl CharacterBehavior for Data {
}
// At end of state logic so an interrupt isn't overwritten
if !input_is_pressed(data, self.static_data.ability_info.input) {
handle_dodge_input(data, &mut update);
}
handle_dodge_interrupt(data, &mut update, None);
update
}

View File

@ -28,8 +28,6 @@ pub struct StaticData {
pub is_infinite: bool,
/// Used to dictate how movement functions in this state
pub movement_behavior: MovementBehavior,
/// Whether the state can be interrupted by other abilities
pub is_interruptible: bool,
/// Used for forced forward movement
pub forward_speed: f32,
/// Number of spins
@ -167,9 +165,7 @@ impl CharacterBehavior for Data {
}
// At end of state logic so an interrupt isn't overwritten
if !input_is_pressed(data, self.static_data.ability_info.input) {
handle_dodge_input(data, &mut update);
}
handle_dodge_interrupt(data, &mut update, None);
update
}

View File

@ -1042,6 +1042,31 @@ pub fn handle_dodge_input(data: &JoinData<'_>, update: &mut StateUpdate) {
}
}
/// Contains logic for dodge interrupt
pub fn handle_dodge_interrupt(
data: &JoinData,
update: &mut StateUpdate,
input_override: Option<InputKind>,
) {
// Check that the input used to enter current character state (if there was one)
// is not pressed
if input_override
.or(data.character.ability_info().map(|a| a.input))
.map_or(true, |input| !input_is_pressed(data, input))
{
// If there is a stage section, only roll during
if data
.character
.stage_section()
.map_or(true, |stage_section| {
matches!(stage_section, StageSection::Buildup)
})
{
handle_dodge_input(data, update);
}
}
}
pub fn is_strafing(data: &JoinData<'_>, update: &StateUpdate) -> bool {
// TODO: Don't always check `character.is_aimed()`, allow the frontend to
// control whether the player strafes during an aimed `CharacterState`.

View File

@ -86,6 +86,7 @@ fn maps_basic_melee() {
range: 3.5,
angle: 15.0,
damage_effect: None,
multi_target: false,
},
ori_modifier: 1.0,
ability_info: empty_ability_info(),
@ -147,7 +148,6 @@ fn matches_ability_stage() {
speed_increase: 0.05,
max_speed_increase: 0.8,
scales_from_combo: 2,
is_interruptible: true,
ori_modifier: 1.0,
ability_info: empty_ability_info(),
},
@ -209,7 +209,6 @@ fn ignores_different_ability_stage() {
speed_increase: 0.05,
max_speed_increase: 0.8,
scales_from_combo: 2,
is_interruptible: true,
ori_modifier: 1.0,
ability_info: empty_ability_info(),
},