give RiposteMelee recovery on whiff

This commit is contained in:
do-no-van
2024-07-18 17:26:47 -05:00
parent 833606bd67
commit ed9ef355d6
6 changed files with 30 additions and 9 deletions

View File

@ -3,6 +3,7 @@ RiposteMelee(
buildup_duration: 0.4,
swing_duration: 0.1,
recover_duration: 0.2,
whiff_recovery_modifier: 0.2,
block_strength: 5.0,
melee_constructor: (
kind: Bash(

View File

@ -3,6 +3,7 @@ RiposteMelee(
buildup_duration: 0.7,
swing_duration: 0.3,
recover_duration: 0.2,
whiff_recovery_modifier: 0.2,
block_strength: 5.0,
melee_constructor: (
kind: Slash(
@ -14,4 +15,4 @@ RiposteMelee(
range: 4.0,
angle: 60.0,
),
)
)

View File

@ -3,6 +3,7 @@ RiposteMelee(
buildup_duration: 0.4,
swing_duration: 0.1,
recover_duration: 0.2,
whiff_recovery_modifier: 0.2,
block_strength: 5.0,
melee_constructor: (
kind: Slash(

View File

@ -1102,6 +1102,7 @@ pub enum CharacterAbility {
buildup_duration: f32,
swing_duration: f32,
recover_duration: f32,
whiff_recovery_modifier: f32,
block_strength: f32,
melee_constructor: MeleeConstructor,
#[serde(default)]
@ -1824,6 +1825,7 @@ impl CharacterAbility {
ref mut buildup_duration,
ref mut swing_duration,
ref mut recover_duration,
whiff_recovery_modifier: _,
ref mut block_strength,
ref mut melee_constructor,
meta: _,
@ -2987,6 +2989,7 @@ impl From<(&CharacterAbility, AbilityInfo, &JoinData<'_>)> for CharacterState {
buildup_duration,
swing_duration,
recover_duration,
whiff_recovery_modifier,
block_strength,
melee_constructor,
meta: _,
@ -2995,6 +2998,7 @@ impl From<(&CharacterAbility, AbilityInfo, &JoinData<'_>)> for CharacterState {
buildup_duration: Duration::from_secs_f32(*buildup_duration),
swing_duration: Duration::from_secs_f32(*swing_duration),
recover_duration: Duration::from_secs_f32(*recover_duration),
whiff_recovery_modifier: *whiff_recovery_modifier,
block_strength: *block_strength,
melee_constructor: *melee_constructor,
ability_info,
@ -3002,6 +3006,7 @@ impl From<(&CharacterAbility, AbilityInfo, &JoinData<'_>)> for CharacterState {
timer: Duration::default(),
stage_section: StageSection::Buildup,
exhausted: false,
whiffed: true,
}),
CharacterAbility::RapidMelee {
buildup_duration,

View File

@ -18,6 +18,8 @@ pub struct StaticData {
pub swing_duration: Duration,
/// How long the state has until exiting
pub recover_duration: Duration,
/// Modifer for recovery speed when the parry is missed
pub whiff_recovery_modifier: f32,
/// Base value that incoming damage is reduced by and converted to poise
/// damage
pub block_strength: f32,
@ -38,6 +40,8 @@ pub struct Data {
pub stage_section: StageSection,
/// Whether the attack can deal more damage
pub exhausted: bool,
/// Whether the riposte whiffed
pub whiffed: bool,
}
impl CharacterBehavior for Data {
@ -51,15 +55,16 @@ impl CharacterBehavior for Data {
match self.stage_section {
StageSection::Buildup => {
if self.timer < self.static_data.buildup_duration {
// Build up
if let CharacterState::RiposteMelee(c) = &mut update.character {
if let CharacterState::RiposteMelee(c) = &mut update.character {
if self.timer < self.static_data.buildup_duration {
// Build up
c.timer = tick_attack_or_default(data, self.timer, None);
} else {
// If duration finishes with no parry occurring transition to recover
// Transition to action happens in parry hook server event
c.timer = Duration::default();
c.stage_section = StageSection::Recover;
}
} else {
// If duration finishes with no pary occurring, end character state
// Transition to action happens in parry hook server event
end_ability(data, &mut update);
}
},
StageSection::Action => {
@ -97,7 +102,14 @@ impl CharacterBehavior for Data {
c.timer = tick_attack_or_default(
data,
self.timer,
Some(data.stats.recovery_speed_modifier),
Some(
data.stats.recovery_speed_modifier
* if c.whiffed {
self.static_data.whiff_recovery_modifier
} else {
1.0
},
),
);
}
} else {

View File

@ -1935,6 +1935,7 @@ impl ServerEvent for ParryHookEvent {
CharacterState::RiposteMelee(c) => {
c.stage_section = StageSection::Action;
c.timer = Duration::default();
c.whiffed = false;
false
},
CharacterState::BasicBlock(c) => {