Added level up sound to skill point gain. Fixed tests.

Fixed duplicate roll description.
This commit is contained in:
Sam 2021-01-09 11:56:19 -05:00
parent 3d44ac2c35
commit c809569f6b
8 changed files with 51 additions and 43 deletions

View File

@ -27,8 +27,6 @@
"hud.skill.unlck_sceptre": "Unlocks sceptre skill tree{}", "hud.skill.unlck_sceptre": "Unlocks sceptre skill tree{}",
"hud.skill.dodge_title": "Dodge", "hud.skill.dodge_title": "Dodge",
"hud.skill.dodge": "Dodging avoids melee attacks{}", "hud.skill.dodge": "Dodging avoids melee attacks{}",
"hud.skill.dodge_title": "Roll Stamina Cost",
"hud.skill.dodge": "Rolling uses 20% less stamina{}",
"hud.skill.roll_stamina_title": "Roll Stamina Cost", "hud.skill.roll_stamina_title": "Roll Stamina Cost",
"hud.skill.roll_stamina": "Rolling uses 20% less stamina{}", "hud.skill.roll_stamina": "Rolling uses 20% less stamina{}",
"hud.skill.roll_speed_title": "Rolling Speed", "hud.skill.roll_speed_title": "Rolling Speed",

View File

@ -622,69 +622,76 @@ mod tests {
#[test] #[test]
fn test_refund_skill() { fn test_refund_skill() {
let mut skillset = SkillSet::new(); let mut skillset = SkillSet::default();
skillset.unlock_skill_group(SkillGroupType::Axes); skillset.unlock_skill_group(SkillGroupType::Weapon(ToolKind::Axe));
skillset.add_skill_points(SkillGroupType::Axes, 1); skillset.add_skill_points(SkillGroupType::Weapon(ToolKind::Axe), 1);
skillset.unlock_skill(Skill::TestAxeSkill2); skillset.unlock_skill(Skill::Axe(AxeSkill::LUnlockLeap));
assert_eq!(skillset.skill_groups[0].available_sp, 0); assert_eq!(skillset.skill_groups[1].available_sp, 0);
assert_eq!(skillset.skills.len(), 1); assert_eq!(skillset.skills.len(), 1);
assert_eq!( assert_eq!(
skillset.skills.get(&Skill::TestAxeSkill2), skillset
Some(&Skill::TestAxeSkill2) .skills
.contains_key(&Skill::Axe(AxeSkill::LUnlockLeap)),
true
); );
skillset.refund_skill(Skill::TestAxeSkill2); skillset.refund_skill(Skill::Axe(AxeSkill::LUnlockLeap));
assert_eq!(skillset.skill_groups[0].available_sp, 1); assert_eq!(skillset.skill_groups[1].available_sp, 1);
assert_eq!(skillset.skills.get(&Skill::TestAxeSkill2), None); assert_eq!(
skillset.skills.get(&Skill::Axe(AxeSkill::LUnlockLeap)),
None
);
} }
#[test] #[test]
fn test_unlock_skillgroup() { fn test_unlock_skillgroup() {
let mut skillset = SkillSet::new(); let mut skillset = SkillSet::default();
skillset.unlock_skill_group(SkillGroupType::Axes); skillset.unlock_skill_group(SkillGroupType::Weapon(ToolKind::Axe));
assert_eq!(skillset.skill_groups.len(), 1); assert_eq!(skillset.skill_groups.len(), 2);
assert_eq!( assert_eq!(
skillset.skill_groups[0], skillset.skill_groups[1],
SkillGroup::new(SkillGroupType::Axes) SkillGroup::new(SkillGroupType::Weapon(ToolKind::Axe))
); );
} }
#[test] #[test]
fn test_unlock_skill() { fn test_unlock_skill() {
let mut skillset = SkillSet::new(); let mut skillset = SkillSet::default();
skillset.unlock_skill_group(SkillGroupType::Axes); skillset.unlock_skill_group(SkillGroupType::Weapon(ToolKind::Axe));
skillset.add_skill_points(SkillGroupType::Axes, 1); skillset.add_skill_points(SkillGroupType::Weapon(ToolKind::Axe), 1);
assert_eq!(skillset.skill_groups[0].available_sp, 1); assert_eq!(skillset.skill_groups[1].available_sp, 1);
assert_eq!(skillset.skills.len(), 0); assert_eq!(skillset.skills.len(), 0);
// Try unlocking a skill with enough skill points // Try unlocking a skill with enough skill points
skillset.unlock_skill(Skill::TestAxeSkill2); skillset.unlock_skill(Skill::Axe(AxeSkill::LUnlockLeap));
assert_eq!(skillset.skill_groups[0].available_sp, 0); assert_eq!(skillset.skill_groups[1].available_sp, 0);
assert_eq!(skillset.skills.len(), 1); assert_eq!(skillset.skills.len(), 1);
assert_eq!( assert_eq!(
skillset.skills.get(&Skill::TestAxeSkill2), skillset
Some(&Skill::TestAxeSkill2) .skills
.contains_key(&Skill::Axe(AxeSkill::LUnlockLeap)),
true
); );
// Try unlocking a skill without enough skill points // Try unlocking a skill without enough skill points
skillset.unlock_skill(Skill::TestAxeSkill1); skillset.unlock_skill(Skill::Axe(AxeSkill::DsCombo));
assert_eq!(skillset.skills.len(), 1); assert_eq!(skillset.skills.len(), 1);
assert_eq!(skillset.skills.get(&Skill::TestAxeSkill1), None); assert_eq!(skillset.skills.get(&Skill::Axe(AxeSkill::DsCombo)), None);
} }
#[test] #[test]
fn test_add_skill_points() { fn test_add_skill_points() {
let mut skillset = SkillSet::new(); let mut skillset = SkillSet::default();
skillset.unlock_skill_group(SkillGroupType::Axes); skillset.unlock_skill_group(SkillGroupType::Weapon(ToolKind::Axe));
skillset.add_skill_points(SkillGroupType::Axes, 1); skillset.add_skill_points(SkillGroupType::Weapon(ToolKind::Axe), 1);
assert_eq!(skillset.skill_groups[0].available_sp, 1); assert_eq!(skillset.skill_groups[1].available_sp, 1);
} }
} }

View File

@ -22,9 +22,6 @@ pub enum Outcome {
body: comp::Body, body: comp::Body,
vel: Vec3<f32>, vel: Vec3<f32>,
}, },
LevelUp {
pos: Vec3<f32>,
},
Beam { Beam {
pos: Vec3<f32>, pos: Vec3<f32>,
heal: bool, heal: bool,
@ -37,6 +34,7 @@ pub enum Outcome {
uid: Uid, uid: Uid,
skill_tree: comp::skills::SkillGroupType, skill_tree: comp::skills::SkillGroupType,
total_points: u16, total_points: u16,
pos: Vec3<f32>,
}, },
} }
@ -45,10 +43,9 @@ impl Outcome {
match self { match self {
Outcome::Explosion { pos, .. } => Some(*pos), Outcome::Explosion { pos, .. } => Some(*pos),
Outcome::ProjectileShot { pos, .. } => Some(*pos), Outcome::ProjectileShot { pos, .. } => Some(*pos),
Outcome::LevelUp { pos } => Some(*pos),
Outcome::Beam { pos, .. } => Some(*pos), Outcome::Beam { pos, .. } => Some(*pos),
Outcome::ExpChange { .. } => None, Outcome::ExpChange { .. } => None,
Outcome::SkillPointGain { .. } => None, Outcome::SkillPointGain { pos, .. } => Some(*pos),
} }
} }
} }

View File

@ -1,7 +1,7 @@
use common::{ use common::{
comp::{ comp::{
skills::{GeneralSkill, Skill, SkillGroupType}, skills::{GeneralSkill, Skill, SkillGroupType},
CharacterState, Energy, EnergyChange, EnergySource, Health, Stats, CharacterState, Energy, EnergyChange, EnergySource, Health, Pos, Stats,
}, },
event::{EventBus, ServerEvent}, event::{EventBus, ServerEvent},
metrics::SysMetrics, metrics::SysMetrics,
@ -29,6 +29,7 @@ impl<'a> System<'a> for Sys {
WriteStorage<'a, Health>, WriteStorage<'a, Health>,
WriteStorage<'a, Energy>, WriteStorage<'a, Energy>,
ReadStorage<'a, Uid>, ReadStorage<'a, Uid>,
ReadStorage<'a, Pos>,
Write<'a, Vec<Outcome>>, Write<'a, Vec<Outcome>>,
); );
@ -44,6 +45,7 @@ impl<'a> System<'a> for Sys {
mut healths, mut healths,
mut energies, mut energies,
uids, uids,
positions,
mut outcomes, mut outcomes,
): Self::SystemData, ): Self::SystemData,
) { ) {
@ -59,11 +61,12 @@ impl<'a> System<'a> for Sys {
healths.set_event_emission(true); healths.set_event_emission(true);
// Update stats // Update stats
for (entity, uid, mut stats, mut health) in ( for (entity, uid, mut stats, mut health, pos) in (
&entities, &entities,
&uids, &uids,
&mut stats.restrict_mut(), &mut stats.restrict_mut(),
&mut healths.restrict_mut(), &mut healths.restrict_mut(),
&positions,
) )
.join() .join()
{ {
@ -104,6 +107,7 @@ impl<'a> System<'a> for Sys {
uid: *uid, uid: *uid,
skill_tree: skill_group, skill_tree: skill_group,
total_points: stat.skill_set.get_earned_sp(skill_group), total_points: stat.skill_set.get_earned_sp(skill_group),
pos: pos.0,
}); });
} }
} }

View File

@ -170,6 +170,7 @@ fn maps_roll() {
movement_duration: Duration::default(), movement_duration: Duration::default(),
recover_duration: Duration::default(), recover_duration: Duration::default(),
roll_strength: 0.0, roll_strength: 0.0,
immune_melee: false,
}, },
timer: Duration::default(), timer: Duration::default(),
stage_section: states::utils::StageSection::Buildup, stage_section: states::utils::StageSection::Buildup,

View File

@ -345,7 +345,7 @@ impl SfxMgr {
}, },
} }
}, },
Outcome::LevelUp { pos } => { Outcome::SkillPointGain { pos, .. } => {
let file_ref = "voxygen.audio.sfx.character.level_up_sound_-_shorter_wind_up"; let file_ref = "voxygen.audio.sfx.character.level_up_sound_-_shorter_wind_up";
audio.play_sfx(file_ref, *pos, None); audio.play_sfx(file_ref, *pos, None);
}, },

View File

@ -2896,6 +2896,7 @@ impl Hud {
uid, uid,
skill_tree, skill_tree,
total_points, total_points,
..
} => self.skill_point_displays.push(SkillPointGain { } => self.skill_point_displays.push(SkillPointGain {
owner: *uid, owner: *uid,
skill_tree: *skill_tree, skill_tree: *skill_tree,

View File

@ -1,8 +1,8 @@
use super::{ use super::{
img_ids::Imgs, DEFAULT_NPC, FACTION_COLOR, GROUP_COLOR, GROUP_MEMBER, HP_COLOR, LOW_HP_COLOR, img_ids::Imgs, DEFAULT_NPC, ENEMY_HP_COLOR, FACTION_COLOR, GROUP_COLOR, GROUP_MEMBER, HP_COLOR,
QUALITY_ARTIFACT, QUALITY_COMMON, QUALITY_DEBUG, QUALITY_EPIC, QUALITY_HIGH, QUALITY_LEGENDARY, LOW_HP_COLOR, QUALITY_ARTIFACT, QUALITY_COMMON, QUALITY_DEBUG, QUALITY_EPIC, QUALITY_HIGH,
QUALITY_LOW, QUALITY_MODERATE, REGION_COLOR, SAY_COLOR, STAMINA_COLOR, TELL_COLOR, TEXT_BG, QUALITY_LEGENDARY, QUALITY_LOW, QUALITY_MODERATE, REGION_COLOR, SAY_COLOR, STAMINA_COLOR,
TEXT_COLOR, XP_COLOR, ENEMY_HP_COLOR TELL_COLOR, TEXT_BG, TEXT_COLOR, XP_COLOR,
}; };
use crate::{ use crate::{
hud::get_buff_info, hud::get_buff_info,