diff --git a/CHANGELOG.md b/CHANGELOG.md index 31335a5a0e..1911d5a2f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -96,6 +96,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Server now denies any running trades when a user exits to the character selection screen. - Sfx volume changes now also change the ambient sounds volume - Staff fire shockwave ability no longer has an unlimited vertical range +- Skillbar buttons correctly account for skill points when checking if player has enough stamina for the ability. ## [0.9.0] - 2021-03-20 diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index a08f66aa5a..6827cbefbe 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -2267,6 +2267,7 @@ impl Hud { let healths = ecs.read_storage::(); let inventories = ecs.read_storage::(); let energies = ecs.read_storage::(); + let skillsets = ecs.read_storage::(); let character_states = ecs.read_storage::(); let controllers = ecs.read_storage::(); let ability_map = ecs.fetch::(); @@ -2289,12 +2290,14 @@ impl Hud { Some(health), Some(inventory), Some(energy), + Some(skillset), Some(_character_state), Some(_controller), ) = ( healths.get(entity), inventories.get(entity), energies.get(entity), + skillsets.get(entity), character_states.get(entity), controllers.get(entity).map(|c| &c.inputs), ) { @@ -2308,6 +2311,7 @@ impl Hud { &health, &inventory, &energy, + &skillset, //&character_state, self.pulse, //&controller, diff --git a/voxygen/src/hud/skillbar.rs b/voxygen/src/hud/skillbar.rs index 7d5146c949..4eb3eb22b0 100644 --- a/voxygen/src/hud/skillbar.rs +++ b/voxygen/src/hud/skillbar.rs @@ -26,7 +26,7 @@ use common::comp::{ tool::{AbilityMap, Tool, ToolKind}, Hands, Item, ItemKind, MaterialStatManifest, }, - Energy, Health, Inventory, + Energy, Health, Inventory, SkillSet, }; use conrod_core::{ color, @@ -142,6 +142,7 @@ pub struct Skillbar<'a> { health: &'a Health, inventory: &'a Inventory, energy: &'a Energy, + skillset: &'a SkillSet, // character_state: &'a CharacterState, // controller: &'a ControllerInputs, hotbar: &'a hotbar::State, @@ -169,6 +170,7 @@ impl<'a> Skillbar<'a> { health: &'a Health, inventory: &'a Inventory, energy: &'a Energy, + skillset: &'a SkillSet, // character_state: &'a CharacterState, pulse: f32, // controller: &'a ControllerInputs, @@ -191,6 +193,7 @@ impl<'a> Skillbar<'a> { health, inventory, energy, + skillset, common: widget::CommonBuilder::default(), // character_state, pulse, @@ -449,6 +452,7 @@ impl<'a> Widget for Skillbar<'a> { self.hotbar, self.inventory, self.energy, + self.skillset, self.ability_map, self.msm, ); // TODO: avoid this @@ -739,6 +743,7 @@ impl<'a> Widget for Skillbar<'a> { >= tool .get_abilities(&self.msm, item.components(), self.ability_map) .secondary + .adjusted_by_skills(self.skillset, Some(tool.kind)) .get_energy_cost() { Color::Rgba(1.0, 1.0, 1.0, 1.0) diff --git a/voxygen/src/hud/slots.rs b/voxygen/src/hud/slots.rs index 4af2858f8c..db61ca550a 100644 --- a/voxygen/src/hud/slots.rs +++ b/voxygen/src/hud/slots.rs @@ -10,7 +10,7 @@ use common::comp::{ ItemKind, MaterialStatManifest, }, slot::InvSlotId, - Energy, Inventory, + Energy, Inventory, SkillSet, }; use conrod_core::{image, Color}; use specs::Entity as EcsEntity; @@ -126,6 +126,7 @@ type HotbarSource<'a> = ( &'a hotbar::State, &'a Inventory, &'a Energy, + &'a SkillSet, &'a AbilityMap, &'a MaterialStatManifest, ); @@ -136,7 +137,7 @@ impl<'a> SlotKey, HotbarImageSource<'a>> for HotbarSlot { fn image_key( &self, - (hotbar, inventory, energy, ability_map, msm): &HotbarSource<'a>, + (hotbar, inventory, energy, skillset, ability_map, msm): &HotbarSource<'a>, ) -> Option<(Self::ImageKey, Option)> { hotbar.get(*self).and_then(|contents| match contents { hotbar::SlotContents::Inventory(idx) => inventory @@ -173,7 +174,13 @@ impl<'a> SlotKey, HotbarImageSource<'a>> for HotbarSlot { .abilities .get(0) { - if energy.current() >= skill.1.get_energy_cost() { + if energy.current() + >= skill + .1 + .clone() + .adjusted_by_skills(skillset, Some(tool.kind)) + .get_energy_cost() + { Some(Color::Rgba(1.0, 1.0, 1.0, 1.0)) } else { Some(Color::Rgba(0.3, 0.3, 0.3, 0.8)) @@ -217,7 +224,13 @@ impl<'a> SlotKey, HotbarImageSource<'a>> for HotbarSlot { .abilities .get(skill_index) { - if energy.current() >= skill.1.get_energy_cost() { + if energy.current() + >= skill + .1 + .clone() + .adjusted_by_skills(skillset, Some(tool.kind)) + .get_energy_cost() + { Some(Color::Rgba(1.0, 1.0, 1.0, 1.0)) } else { Some(Color::Rgba(0.3, 0.3, 0.3, 0.8)) @@ -232,7 +245,7 @@ impl<'a> SlotKey, HotbarImageSource<'a>> for HotbarSlot { }) } - fn amount(&self, (hotbar, inventory, _, _, _): &HotbarSource<'a>) -> Option { + fn amount(&self, (hotbar, inventory, _, _, _, _): &HotbarSource<'a>) -> Option { hotbar .get(*self) .and_then(|content| match content {