This commit is contained in:
Sam
2023-05-14 20:16:08 -04:00
parent 3bdde16881
commit af0a9ca3a4
4 changed files with 67 additions and 27 deletions

View File

@ -1,22 +1,10 @@
ComboMelee2( SelfBuff(
strikes: [ buildup_duration: 0.3,
( cast_duration: 0.2,
melee_constructor: ( recover_duration: 0.1,
kind: Slash( buff_kind: Reckless,
damage: 4, buff_strength: 0.5,
poise: 5, buff_duration: Some(15.0),
knockback: 0, combo_cost: 10,
energy_regen: 5, energy_cost: 0,
), )
range: 3.0,
angle: 45.0,
),
buildup_duration: 0.15,
swing_duration: 0.05,
hit_timing: 0.5,
recover_duration: 0.1,
ori_modifier: 0.6,
),
],
energy_cost_per_strike: 0,
)

View File

@ -812,6 +812,8 @@ pub enum CharacterAbility {
buff_duration: Option<Secs>, buff_duration: Option<Secs>,
energy_cost: f32, energy_cost: f32,
#[serde(default)] #[serde(default)]
combo_cost: u32,
#[serde(default)]
meta: AbilityMeta, meta: AbilityMeta,
}, },
SpriteSummon { SpriteSummon {
@ -937,7 +939,6 @@ impl CharacterAbility {
| CharacterAbility::ChargedMelee { energy_cost, .. } | CharacterAbility::ChargedMelee { energy_cost, .. }
| CharacterAbility::Shockwave { energy_cost, .. } | CharacterAbility::Shockwave { energy_cost, .. }
| CharacterAbility::BasicBlock { energy_cost, .. } | CharacterAbility::BasicBlock { energy_cost, .. }
| CharacterAbility::SelfBuff { energy_cost, .. }
| CharacterAbility::RiposteMelee { energy_cost, .. } | CharacterAbility::RiposteMelee { energy_cost, .. }
| CharacterAbility::ComboMelee2 { | CharacterAbility::ComboMelee2 {
energy_cost_per_strike: energy_cost, energy_cost_per_strike: energy_cost,
@ -969,6 +970,11 @@ impl CharacterAbility {
energy_cost, energy_cost,
minimum_combo, minimum_combo,
.. ..
}
| CharacterAbility::SelfBuff {
energy_cost,
combo_cost: minimum_combo,
..
} => { } => {
data.combo.map_or(false, |c| c.counter() >= *minimum_combo) data.combo.map_or(false, |c| c.counter() >= *minimum_combo)
&& update.energy.try_change_by(-*energy_cost).is_ok() && update.energy.try_change_by(-*energy_cost).is_ok()
@ -1447,6 +1453,7 @@ impl CharacterAbility {
ref mut buff_strength, ref mut buff_strength,
buff_duration: _, buff_duration: _,
ref mut energy_cost, ref mut energy_cost,
combo_cost: _,
meta: _, meta: _,
} => { } => {
*buff_strength *= stats.diminished_buff_strength(); *buff_strength *= stats.diminished_buff_strength();
@ -1603,9 +1610,17 @@ impl CharacterAbility {
0 0
} }
}, },
FinisherMelee { minimum_combo, .. } | RapidMelee { minimum_combo, .. } => { FinisherMelee {
*minimum_combo minimum_combo: combo,
}, ..
}
| RapidMelee {
minimum_combo: combo,
..
}
| SelfBuff {
combo_cost: combo, ..
} => *combo,
BasicMelee { .. } BasicMelee { .. }
| BasicRanged { .. } | BasicRanged { .. }
| RepeaterRanged { .. } | RepeaterRanged { .. }
@ -1618,7 +1633,6 @@ impl CharacterAbility {
| ChargedRanged { .. } | ChargedRanged { .. }
| Shockwave { .. } | Shockwave { .. }
| BasicBlock { .. } | BasicBlock { .. }
| SelfBuff { .. }
| ComboMelee2 { .. } | ComboMelee2 { .. }
| DiveMelee { .. } | DiveMelee { .. }
| RiposteMelee { .. } | RiposteMelee { .. }
@ -2657,6 +2671,7 @@ impl From<(&CharacterAbility, AbilityInfo, &JoinData<'_>)> for CharacterState {
buff_strength, buff_strength,
buff_duration, buff_duration,
energy_cost: _, energy_cost: _,
combo_cost,
meta: _, meta: _,
} => CharacterState::SelfBuff(self_buff::Data { } => CharacterState::SelfBuff(self_buff::Data {
static_data: self_buff::StaticData { static_data: self_buff::StaticData {
@ -2666,6 +2681,7 @@ impl From<(&CharacterAbility, AbilityInfo, &JoinData<'_>)> for CharacterState {
buff_kind: *buff_kind, buff_kind: *buff_kind,
buff_strength: *buff_strength, buff_strength: *buff_strength,
buff_duration: *buff_duration, buff_duration: *buff_duration,
combo_cost: *combo_cost,
ability_info, ability_info,
}, },
timer: Duration::default(), timer: Duration::default(),

View File

@ -29,6 +29,7 @@ pub struct StaticData {
pub buff_strength: f32, pub buff_strength: f32,
/// How long buff lasts /// How long buff lasts
pub buff_duration: Option<Secs>, pub buff_duration: Option<Secs>,
pub combo_cost: u32,
/// What key is used to press ability /// What key is used to press ability
pub ability_info: AbilityInfo, pub ability_info: AbilityInfo,
} }
@ -60,6 +61,11 @@ impl CharacterBehavior for Data {
..*self ..*self
}); });
} else { } else {
// Consume combo
output_events.emit_server(ServerEvent::ComboChange {
entity: data.entity,
change: -(self.static_data.combo_cost as i32),
});
// Creates buff // Creates buff
let buff = Buff::new( let buff = Buff::new(
self.static_data.buff_kind, self.static_data.buff_kind,

View File

@ -164,6 +164,36 @@ impl Animation for SelfBuffAnimation {
next.shorts.orientation.rotate_x(move2 * 0.2); next.shorts.orientation.rotate_x(move2 * 0.2);
next.shorts.position += Vec3::new(0.0, move2 * 1.0, 0.0); next.shorts.position += Vec3::new(0.0, move2 * 1.0, 0.0);
}, },
Some("common.abilities.axe.berserk") => {
let (move1, move2, move3) = match stage_section {
Some(StageSection::Movement) => (anim_time, 0.0, 0.0),
Some(StageSection::Action) => (1.0, anim_time, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
_ => (0.0, 0.0, 0.0),
};
let pullback = 1.0 - move3;
let move1 = move1 * pullback;
let move2 = move2 * pullback;
next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2);
next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
* Quaternion::rotation_y(s_a.ac.4)
* Quaternion::rotation_z(s_a.ac.5);
next.control.orientation.rotate_z(move1 * -2.0);
next.control.orientation.rotate_x(move1 * -3.5);
next.control.position += Vec3::new(move1 * 14.0, move1 * -6.0, move1 * 15.0);
next.head.orientation.rotate_x(move2 * 0.6);
next.chest.orientation.rotate_x(move2 * 0.4);
},
_ => {}, _ => {},
} }