mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'ygor/skillbar-account-for-skillset' into 'master'
Make skillbar buttons account for energy cost reduction See merge request veloren/veloren!2185
This commit is contained in:
commit
e4324a3481
@ -97,6 +97,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
|
||||
|
||||
|
@ -2267,6 +2267,7 @@ impl Hud {
|
||||
let healths = ecs.read_storage::<comp::Health>();
|
||||
let inventories = ecs.read_storage::<comp::Inventory>();
|
||||
let energies = ecs.read_storage::<comp::Energy>();
|
||||
let skillsets = ecs.read_storage::<comp::SkillSet>();
|
||||
let character_states = ecs.read_storage::<comp::CharacterState>();
|
||||
let controllers = ecs.read_storage::<comp::Controller>();
|
||||
let ability_map = ecs.fetch::<comp::item::tool::AbilityMap>();
|
||||
@ -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,
|
||||
|
@ -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)
|
||||
|
@ -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<HotbarSource<'a>, 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<Color>)> {
|
||||
hotbar.get(*self).and_then(|contents| match contents {
|
||||
hotbar::SlotContents::Inventory(idx) => inventory
|
||||
@ -173,7 +174,13 @@ impl<'a> SlotKey<HotbarSource<'a>, 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<HotbarSource<'a>, 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<HotbarSource<'a>, HotbarImageSource<'a>> for HotbarSlot {
|
||||
})
|
||||
}
|
||||
|
||||
fn amount(&self, (hotbar, inventory, _, _, _): &HotbarSource<'a>) -> Option<u32> {
|
||||
fn amount(&self, (hotbar, inventory, _, _, _, _): &HotbarSource<'a>) -> Option<u32> {
|
||||
hotbar
|
||||
.get(*self)
|
||||
.and_then(|content| match content {
|
||||
|
Loading…
Reference in New Issue
Block a user