Target the specific attack types, to handle TripeStrike etc...

Removed the Axe sfx until the animations show the swing
This commit is contained in:
Shane Handley 2020-04-04 18:48:17 +11:00
parent 0516af8c57
commit 802bce1698
25 changed files with 130 additions and 63 deletions

View File

@ -23,45 +23,44 @@
],
threshold: 0.5,
),
Attack(Bow(BasicBow)): (
Attack(DashMelee, Sword(BasicSword)): (
files: [
"voxygen.audio.sfx.weapon.whoosh_normal_01",
"voxygen.audio.sfx.weapon.whoosh_normal_02",
"voxygen.audio.sfx.weapon.whoosh_normal_03",
"voxygen.audio.sfx.weapon.whoosh_normal_04",
],
threshold: 1.2,
),
Attack(TripleStrike, Sword(BasicSword)): (
files: [
"voxygen.audio.sfx.weapon.sword_triple_strike_01",
"voxygen.audio.sfx.weapon.sword_triple_strike_02",
"voxygen.audio.sfx.weapon.sword_triple_strike_03",
],
threshold: 0.8,
),
Attack(BasicRanged, Bow(BasicBow)): (
files: [
"voxygen.audio.sfx.weapon.bow_attack_01",
"voxygen.audio.sfx.weapon.bow_attack_02",
"voxygen.audio.sfx.weapon.bow_attack_03",
"voxygen.audio.sfx.weapon.bow_attack_04",
],
threshold: 0.5,
),
Attack(Sword(BasicSword)): (
Attack(BasicMelee, Hammer(BasicHammer)): (
files: [
"voxygen.audio.sfx.weapon.sword_attack_01",
"voxygen.audio.sfx.weapon.sword_attack_02",
"voxygen.audio.sfx.weapon.sword_attack_03",
"voxygen.audio.sfx.weapon.sword_attack_04",
"voxygen.audio.sfx.weapon.whoosh_low_01",
"voxygen.audio.sfx.weapon.whoosh_low_02",
"voxygen.audio.sfx.weapon.whoosh_low_03",
],
threshold: 0.5,
),
Attack(Hammer(BasicHammer)): (
Attack(BasicMelee, Staff(BasicStaff)): (
files: [
"voxygen.audio.sfx.weapon.hammer_attack_01",
"voxygen.audio.sfx.weapon.hammer_attack_02",
"voxygen.audio.sfx.weapon.hammer_attack_03",
],
threshold: 0.5,
),
Attack(Staff(BasicStaff)): (
files: [
"voxygen.audio.sfx.weapon.staff_attack_01",
"voxygen.audio.sfx.weapon.staff_attack_02",
"voxygen.audio.sfx.weapon.staff_attack_03",
],
threshold: 0.5,
),
Attack(Axe(BasicAxe)): (
files: [
"voxygen.audio.sfx.weapon.hammer_attack_01",
"voxygen.audio.sfx.weapon.hammer_attack_02",
"voxygen.audio.sfx.weapon.hammer_attack_03",
"voxygen.audio.sfx.weapon.whoosh_normal_01",
"voxygen.audio.sfx.weapon.whoosh_normal_02",
"voxygen.audio.sfx.weapon.whoosh_normal_03",
"voxygen.audio.sfx.weapon.whoosh_normal_04",
],
threshold: 0.5,
),

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
assets/voxygen/audio/sfx/weapon/sword_triple_strike_01.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/weapon/sword_triple_strike_02.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/weapon/sword_triple_strike_03.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/weapon/whoosh_normal_01.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/weapon/whoosh_normal_02.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/weapon/whoosh_normal_03.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/audio/sfx/weapon/whoosh_normal_04.wav (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -10,6 +10,30 @@ use specs::{Component, FlaggedStorage};
use specs_idvs::IDVStorage;
use std::time::Duration;
#[derive(Copy, Clone, Hash, Eq, PartialEq, Debug, Serialize, Deserialize)]
pub enum CharacterAbilityType {
BasicMelee,
BasicRanged,
Boost,
DashMelee,
BasicBlock,
TripleStrike,
}
impl From<&CharacterState> for CharacterAbilityType {
fn from(state: &CharacterState) -> Self {
match state {
CharacterState::BasicMelee(_) => Self::BasicMelee,
CharacterState::BasicRanged(_) => Self::BasicRanged,
CharacterState::Boost(_) => Self::Boost,
CharacterState::DashMelee(_) => Self::DashMelee,
CharacterState::BasicBlock => Self::BasicBlock,
CharacterState::TripleStrike(_) => Self::TripleStrike,
_ => Self::BasicMelee,
}
}
}
#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
pub enum CharacterAbility {
BasicMelee {

View File

@ -16,7 +16,7 @@ mod stats;
mod visual;
// Reexports
pub use ability::{CharacterAbility, ItemConfig, Loadout};
pub use ability::{CharacterAbility, CharacterAbilityType, ItemConfig, Loadout};
pub use admin::Admin;
pub use agent::{Agent, Alignment, SpeechBubble, SPEECH_BUBBLE_DURATION};
pub use body::{

View File

@ -1,5 +1,5 @@
use crate::{comp, sync::Uid, util::Dir};
use comp::{item::ToolKind, InventoryUpdateEvent, Item};
use comp::{item::ToolKind, CharacterAbilityType, InventoryUpdateEvent};
use parking_lot::Mutex;
use serde::Deserialize;
use specs::Entity as EcsEntity;
@ -39,7 +39,7 @@ pub enum SfxEvent {
Fall,
ExperienceGained,
LevelUp,
Attack(ToolKind),
Attack(CharacterAbilityType, ToolKind),
Wield(ToolKind),
Unwield(ToolKind),
Inventory(InventoryUpdateEvent),

View File

@ -5,7 +5,7 @@ use crate::audio::sfx::{SfxTriggerItem, SfxTriggers};
use common::{
comp::{
item::{Item, ItemKind},
CharacterState, ItemConfig, Loadout, Pos,
CharacterAbilityType, CharacterState, ItemConfig, Loadout, Pos,
},
event::{EventBus, SfxEvent, SfxEventItem},
state::State,
@ -143,7 +143,10 @@ impl CombatEventMapper {
{
// Check for attacking states
if character_state.is_attack() {
return SfxEvent::Attack(data.kind);
return SfxEvent::Attack(
CharacterAbilityType::from(character_state),
data.kind,
);
} else {
if let Some(wield_event) = match (
previous_state.weapon_drawn,

View File

@ -2,8 +2,8 @@ use super::*;
use common::{
assets,
comp::{
item::tool::{AxeKind, BowKind, ToolKind},
CharacterState, ItemConfig, Loadout,
item::tool::{AxeKind, BowKind, SwordKind, ToolKind},
CharacterAbilityType, CharacterState, ItemConfig, Loadout,
},
event::SfxEvent,
states,
@ -94,5 +94,52 @@ fn maps_basic_melee() {
Some(&loadout),
);
assert_eq!(result, SfxEvent::Attack(ToolKind::Axe(AxeKind::BasicAxe)));
assert_eq!(
result,
SfxEvent::Attack(
CharacterAbilityType::BasicMelee,
ToolKind::Axe(AxeKind::BasicAxe)
)
);
}
#[test]
fn maps_triple_strike() {
let mut loadout = Loadout::default();
loadout.active_item = Some(ItemConfig {
item: assets::load_expect_cloned("common.items.weapons.starter_sword"),
ability1: None,
ability2: None,
ability3: None,
block_ability: None,
dodge_ability: None,
});
let result = CombatEventMapper::map_event(
&CharacterState::TripleStrike(states::triple_strike::Data {
base_damage: 10,
stage: states::triple_strike::Stage::First,
stage_time_active: Duration::default(),
stage_exhausted: false,
initialized: true,
transition_style: states::triple_strike::TransitionStyle::Hold(
states::triple_strike::HoldingState::Released,
),
}),
&PreviousEntityState {
event: SfxEvent::Idle,
time: Instant::now(),
weapon_drawn: true,
},
Some(&loadout),
);
assert_eq!(
result,
SfxEvent::Attack(
CharacterAbilityType::TripleStrike,
ToolKind::Sword(SwordKind::BasicSword)
)
);
}