mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
General combat skill tree.
UI for general skill tree
This commit is contained in:
parent
58d9534496
commit
48c98b11cf
@ -1,5 +1,6 @@
|
||||
({
|
||||
General(HealthIncrease): Some(10),
|
||||
General(EnergyIncrease): Some(5),
|
||||
Sword(TsDamage): Some(3),
|
||||
Sword(TsRegen): Some(2),
|
||||
Sword(TsSpeed): Some(3),
|
||||
@ -69,4 +70,7 @@
|
||||
Sceptre(PRadius): Some(2),
|
||||
Sceptre(PCost): Some(2),
|
||||
Sceptre(PProjSpeed): Some(2),
|
||||
Roll(Cost): Some(2),
|
||||
Roll(Strength): Some(2),
|
||||
Roll(Duration): Some(2),
|
||||
})
|
@ -1,10 +1,7 @@
|
||||
({
|
||||
UnlockGroup(Weapon(Sword)): {General(HealthIncrease): Some(1)},
|
||||
UnlockGroup(Weapon(Axe)): {General(HealthIncrease): Some(1)},
|
||||
UnlockGroup(Weapon(Hammer)): {General(HealthIncrease): Some(1)},
|
||||
UnlockGroup(Weapon(Bow)): {General(HealthIncrease): Some(1)},
|
||||
UnlockGroup(Weapon(Staff)): {General(HealthIncrease): Some(1)},
|
||||
UnlockGroup(Weapon(Sceptre)): {General(HealthIncrease): Some(1)},
|
||||
Roll(Cost): {Roll(ImmuneMelee): None},
|
||||
Roll(Strength): {Roll(ImmuneMelee): None},
|
||||
Roll(Duration): {Roll(ImmuneMelee): None},
|
||||
Sword(TsDamage): {Sword(TsCombo): None},
|
||||
Sword(TsRegen): {Sword(TsCombo): None},
|
||||
Sword(TsSpeed): {Sword(TsCombo): None},
|
||||
|
@ -1,12 +1,17 @@
|
||||
({
|
||||
General: [
|
||||
General(HealthIncrease),
|
||||
General(EnergyIncrease),
|
||||
UnlockGroup(Weapon(Sword)),
|
||||
UnlockGroup(Weapon(Axe)),
|
||||
UnlockGroup(Weapon(Hammer)),
|
||||
UnlockGroup(Weapon(Bow)),
|
||||
UnlockGroup(Weapon(Staff)),
|
||||
UnlockGroup(Weapon(Sceptre)),
|
||||
Roll(ImmuneMelee),
|
||||
Roll(Cost),
|
||||
Roll(Strength),
|
||||
Roll(Duration),
|
||||
],
|
||||
Weapon(Sword): [
|
||||
Sword(InterruptingAttacks),
|
||||
|
@ -1385,6 +1385,29 @@ impl Client {
|
||||
GeneralSkill::HealthIncrease,
|
||||
)));
|
||||
},
|
||||
"@unlock energy" => {
|
||||
self.send_msg(ClientGeneral::UnlockSkill(Skill::General(
|
||||
GeneralSkill::EnergyIncrease,
|
||||
)));
|
||||
},
|
||||
"@unlock roll melee" => {
|
||||
self.send_msg(ClientGeneral::UnlockSkill(Skill::Roll(
|
||||
RollSkill::ImmuneMelee,
|
||||
)));
|
||||
},
|
||||
"@unlock roll cost" => {
|
||||
self.send_msg(ClientGeneral::UnlockSkill(Skill::Roll(RollSkill::Cost)));
|
||||
},
|
||||
"@unlock roll strength" => {
|
||||
self.send_msg(ClientGeneral::UnlockSkill(Skill::Roll(
|
||||
RollSkill::Strength,
|
||||
)));
|
||||
},
|
||||
"@unlock roll duration" => {
|
||||
self.send_msg(ClientGeneral::UnlockSkill(Skill::Roll(
|
||||
RollSkill::Duration,
|
||||
)));
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
} else {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -256,6 +256,7 @@ impl Body {
|
||||
biped_large::Species::Dullahan => 4000,
|
||||
_ => 3000,
|
||||
},
|
||||
Body::Humanoid(_) => 750,
|
||||
_ => 1000,
|
||||
}
|
||||
}
|
||||
@ -263,7 +264,7 @@ impl Body {
|
||||
#[allow(unreachable_patterns)]
|
||||
pub fn base_health(&self) -> u32 {
|
||||
match self {
|
||||
Body::Humanoid(_) => 400,
|
||||
Body::Humanoid(_) => 500,
|
||||
Body::QuadrupedSmall(quadruped_small) => match quadruped_small.species {
|
||||
quadruped_small::Species::Boar => 360,
|
||||
quadruped_small::Species::Batfox => 200,
|
||||
|
@ -143,6 +143,10 @@ impl CharacterState {
|
||||
|
||||
pub fn is_dodge(&self) -> bool { matches!(self, CharacterState::Roll(_)) }
|
||||
|
||||
pub fn is_melee_dodge(&self) -> bool {
|
||||
matches!(self, CharacterState::Roll(d) if d.static_data.immune_melee)
|
||||
}
|
||||
|
||||
/// Compares for shallow equality (does not check internal struct equality)
|
||||
pub fn same_variant(&self, other: &Self) -> bool {
|
||||
// Check if state is the same without looking at the inner data
|
||||
|
@ -72,6 +72,7 @@ pub enum Skill {
|
||||
Staff(StaffSkill),
|
||||
Sceptre(SceptreSkill),
|
||||
UnlockGroup(SkillGroupType),
|
||||
Roll(RollSkill),
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, Serialize, Deserialize)]
|
||||
@ -202,6 +203,15 @@ pub enum SceptreSkill {
|
||||
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum GeneralSkill {
|
||||
HealthIncrease,
|
||||
EnergyIncrease,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum RollSkill {
|
||||
ImmuneMelee,
|
||||
Cost,
|
||||
Strength,
|
||||
Duration,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, Serialize, Deserialize)]
|
||||
@ -237,6 +247,8 @@ impl SkillGroup {
|
||||
pub struct SkillSet {
|
||||
pub skill_groups: Vec<SkillGroup>,
|
||||
pub skills: HashMap<Skill, Level>,
|
||||
pub modify_health: bool,
|
||||
pub modify_energy: bool,
|
||||
}
|
||||
|
||||
pub type Level = Option<u16>;
|
||||
@ -249,6 +261,8 @@ impl Default for SkillSet {
|
||||
Self {
|
||||
skill_groups: vec![SkillGroup::new(SkillGroupType::General)],
|
||||
skills: HashMap::new(),
|
||||
modify_health: false,
|
||||
modify_energy: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -312,6 +326,12 @@ impl SkillSet {
|
||||
if let Skill::UnlockGroup(group) = skill {
|
||||
self.unlock_skill_group(group);
|
||||
}
|
||||
if matches!(skill, Skill::General(GeneralSkill::HealthIncrease)) {
|
||||
self.modify_health = true;
|
||||
}
|
||||
if matches!(skill, Skill::General(GeneralSkill::EnergyIncrease)) {
|
||||
self.modify_energy = true;
|
||||
}
|
||||
self.skills.insert(skill, next_level);
|
||||
} else {
|
||||
warn!("Tried to unlock skill for skill group with insufficient SP");
|
||||
|
@ -19,6 +19,8 @@ pub struct StaticData {
|
||||
pub recover_duration: Duration,
|
||||
/// Affects the speed and distance of the roll
|
||||
pub roll_strength: f32,
|
||||
/// Affects whether you are immune to melee attacks while rolling
|
||||
pub immune_melee: bool,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
|
@ -551,21 +551,26 @@ pub fn handle_dodge_input(data: &JoinData, update: &mut StateUpdate) {
|
||||
if let Some(ability) = data
|
||||
.inventory
|
||||
.equipped(EquipSlot::Mainhand)
|
||||
.and_then(|i| i.item_config_expect().dodge_ability.as_ref())
|
||||
.and_then(|i| {
|
||||
i.item_config_expect().dodge_ability.as_ref().map(|a| {
|
||||
a.clone()
|
||||
.adjusted_by_skills(&data.stats.skill_set.skills, None)
|
||||
})
|
||||
})
|
||||
.filter(|ability| ability.requirements_paid(data, update))
|
||||
{
|
||||
if data.character.is_wield() {
|
||||
update.character = (ability, AbilityKey::Dodge).into();
|
||||
update.character = (&ability, AbilityKey::Dodge).into();
|
||||
if let CharacterState::Roll(roll) = &mut update.character {
|
||||
roll.was_wielded = true;
|
||||
}
|
||||
} else if data.character.is_stealthy() {
|
||||
update.character = (ability, AbilityKey::Dodge).into();
|
||||
update.character = (&ability, AbilityKey::Dodge).into();
|
||||
if let CharacterState::Roll(roll) = &mut update.character {
|
||||
roll.was_sneak = true;
|
||||
}
|
||||
} else {
|
||||
update.character = (ability, AbilityKey::Dodge).into();
|
||||
update.character = (&ability, AbilityKey::Dodge).into();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ impl<'a> System<'a> for Sys {
|
||||
let rad_b = body_b.radius() * scale_b;
|
||||
|
||||
// Check if entity is dodging
|
||||
let is_dodge = char_state_b_maybe.map_or(false, |c_s| c_s.is_dodge());
|
||||
let is_dodge = char_state_b_maybe.map_or(false, |c_s| c_s.is_melee_dodge());
|
||||
|
||||
// Check if it is a hit
|
||||
if entity != b
|
||||
|
@ -1,6 +1,7 @@
|
||||
use common::{
|
||||
comp::{
|
||||
skills::SkillGroupType, CharacterState, Energy, EnergyChange, EnergySource, Health, Stats,
|
||||
skills::{GeneralSkill, Skill, SkillGroupType},
|
||||
CharacterState, Energy, EnergyChange, EnergySource, Health, Stats,
|
||||
},
|
||||
event::{EventBus, ServerEvent},
|
||||
metrics::SysMetrics,
|
||||
@ -93,6 +94,45 @@ impl<'a> System<'a> for Sys {
|
||||
}
|
||||
}
|
||||
|
||||
// Apply effects from leveling skills
|
||||
for (mut stats, mut health, mut energy) in (
|
||||
&mut stats.restrict_mut(),
|
||||
&mut healths.restrict_mut(),
|
||||
&mut energies.restrict_mut(),
|
||||
)
|
||||
.join()
|
||||
{
|
||||
let stat = stats.get_unchecked();
|
||||
if stat.skill_set.modify_health {
|
||||
let mut health = health.get_mut_unchecked();
|
||||
let health_level = stat
|
||||
.skill_set
|
||||
.skills
|
||||
.get(&Skill::General(GeneralSkill::HealthIncrease))
|
||||
.copied()
|
||||
.flatten()
|
||||
.unwrap_or(0);
|
||||
health.update_max_hp(Some(stat.body_type), health_level.into());
|
||||
let mut stat = stats.get_mut_unchecked();
|
||||
stat.skill_set.modify_health = false;
|
||||
}
|
||||
let stat = stats.get_unchecked();
|
||||
if stat.skill_set.modify_energy {
|
||||
let mut energy = energy.get_mut_unchecked();
|
||||
let energy_level = stat
|
||||
.skill_set
|
||||
.skills
|
||||
.get(&Skill::General(GeneralSkill::EnergyIncrease))
|
||||
.copied()
|
||||
.flatten()
|
||||
.unwrap_or(0) as u32;
|
||||
let energy_max = stat.body_type.base_energy() + 50 * energy_level;
|
||||
energy.set_maximum(energy_max);
|
||||
let mut stat = stats.get_mut_unchecked();
|
||||
stat.skill_set.modify_energy = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Update energies
|
||||
for (character_state, mut energy) in
|
||||
(&character_states, &mut energies.restrict_mut()).join()
|
||||
|
@ -366,6 +366,8 @@ pub fn convert_stats_from_database(
|
||||
new_stats.skill_set = skills::SkillSet {
|
||||
skill_groups: convert_skill_groups_from_database(skill_groups),
|
||||
skills: convert_skills_from_database(skills),
|
||||
modify_health: true,
|
||||
modify_energy: true,
|
||||
};
|
||||
|
||||
new_stats
|
||||
|
@ -124,16 +124,8 @@ impl<'a> Widget for BuffsBar<'a> {
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.desc_text_color(TEXT_COLOR);
|
||||
if let BuffPosition::Bar = buff_position {
|
||||
let show_health = if self.health.current() != self.health.maximum() {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
};
|
||||
let show_stamina = if self.energy.current() != self.energy.maximum() {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
};
|
||||
let show_health = self.health.current() != self.health.maximum();
|
||||
let show_stamina = self.energy.current() != self.energy.maximum();
|
||||
let offset = if show_health && show_stamina {
|
||||
140.0
|
||||
} else if show_health || show_stamina {
|
||||
|
@ -14,7 +14,10 @@ use conrod_core::{
|
||||
};
|
||||
|
||||
use client::{self, Client};
|
||||
use common::comp::skills::{self, Skill};
|
||||
use common::comp::{
|
||||
item::tool::ToolKind,
|
||||
skills::{self, Skill},
|
||||
};
|
||||
use inline_tweak::*;
|
||||
|
||||
widget_ids! {
|
||||
@ -123,6 +126,19 @@ widget_ids! {
|
||||
skill_sceptre_bomb_2,
|
||||
skill_sceptre_bomb_3,
|
||||
skill_sceptre_bomb_4,
|
||||
general_combat_render,
|
||||
skill_general_stat_0,
|
||||
skill_general_stat_1,
|
||||
skill_general_tree_0,
|
||||
skill_general_tree_1,
|
||||
skill_general_tree_2,
|
||||
skill_general_tree_3,
|
||||
skill_general_tree_4,
|
||||
skill_general_tree_5,
|
||||
skill_general_roll_0,
|
||||
skill_general_roll_1,
|
||||
skill_general_roll_2,
|
||||
skill_general_roll_3,
|
||||
}
|
||||
}
|
||||
|
||||
@ -194,9 +210,18 @@ pub enum SelectedSkillTree {
|
||||
Sceptre,
|
||||
Bow,
|
||||
StaffFire,
|
||||
GeneralCombat,
|
||||
}
|
||||
|
||||
const WEAPONS: [&str; 6] = ["Sword", "Hammer", "Axe", "Sceptre", "Bow", "Fire Staff"];
|
||||
const WEAPONS: [&str; 7] = [
|
||||
"General Combat",
|
||||
"Sword",
|
||||
"Hammer",
|
||||
"Axe",
|
||||
"Sceptre",
|
||||
"Bow",
|
||||
"Fire Staff",
|
||||
];
|
||||
|
||||
pub enum Event {
|
||||
Close,
|
||||
@ -298,6 +323,7 @@ impl<'a> Widget for Diary<'a> {
|
||||
for i in WEAPONS.iter().copied().enumerate() {
|
||||
// Background weapon image
|
||||
let img = Image::new(match i.1 {
|
||||
"General Combat" => self.imgs.not_found,
|
||||
"Sword" => self.imgs.sword,
|
||||
"Hammer" => self.imgs.hammer,
|
||||
"Axe" => self.imgs.axe,
|
||||
@ -317,6 +343,10 @@ impl<'a> Widget for Diary<'a> {
|
||||
.set(state.weapon_imgs[i.0], ui);
|
||||
// Weapon icons
|
||||
if Button::image(match i.1 {
|
||||
"General Combat" => match sel_tab {
|
||||
SelectedSkillTree::GeneralCombat => self.imgs.wpn_icon_border_pressed,
|
||||
_ => self.imgs.wpn_icon_border,
|
||||
},
|
||||
"Sword" => match sel_tab {
|
||||
SelectedSkillTree::Sword => self.imgs.wpn_icon_border_pressed,
|
||||
_ => self.imgs.wpn_icon_border,
|
||||
@ -345,6 +375,10 @@ impl<'a> Widget for Diary<'a> {
|
||||
})
|
||||
.w_h(tweak!(50.0), tweak!(50.0))
|
||||
.hover_image(match i.1 {
|
||||
"General Combat" => match sel_tab {
|
||||
SelectedSkillTree::GeneralCombat => self.imgs.wpn_icon_border_pressed,
|
||||
_ => self.imgs.wpn_icon_border_mo,
|
||||
},
|
||||
"Sword" => match sel_tab {
|
||||
SelectedSkillTree::Sword => self.imgs.wpn_icon_border_pressed,
|
||||
_ => self.imgs.wpn_icon_border_mo,
|
||||
@ -372,6 +406,10 @@ impl<'a> Widget for Diary<'a> {
|
||||
_ => self.imgs.wpn_icon_border,
|
||||
})
|
||||
.press_image(match i.1 {
|
||||
"General Combat" => match sel_tab {
|
||||
SelectedSkillTree::GeneralCombat => self.imgs.wpn_icon_border_pressed,
|
||||
_ => self.imgs.wpn_icon_border_press,
|
||||
},
|
||||
"Sword" => match sel_tab {
|
||||
SelectedSkillTree::Sword => self.imgs.wpn_icon_border_pressed,
|
||||
_ => self.imgs.wpn_icon_border_press,
|
||||
@ -403,6 +441,9 @@ impl<'a> Widget for Diary<'a> {
|
||||
.was_clicked()
|
||||
{
|
||||
match i.1 {
|
||||
"General Combat" => {
|
||||
events.push(Event::ChangeWeaponTree(SelectedSkillTree::GeneralCombat))
|
||||
},
|
||||
"Sword" => events.push(Event::ChangeWeaponTree(SelectedSkillTree::Sword)),
|
||||
"Hammer" => events.push(Event::ChangeWeaponTree(SelectedSkillTree::Hammer)),
|
||||
"Axe" => events.push(Event::ChangeWeaponTree(SelectedSkillTree::Axe)),
|
||||
@ -436,6 +477,7 @@ impl<'a> Widget for Diary<'a> {
|
||||
// Number of skills per rectangle per weapon, start counting at 0
|
||||
// Maximum of 9 skills/8 indices
|
||||
let skills_top_l = match sel_tab {
|
||||
SelectedSkillTree::GeneralCombat => 2,
|
||||
SelectedSkillTree::Sword => 4,
|
||||
SelectedSkillTree::Axe => 4,
|
||||
SelectedSkillTree::Hammer => 4,
|
||||
@ -445,6 +487,7 @@ impl<'a> Widget for Diary<'a> {
|
||||
_ => 0,
|
||||
};
|
||||
let skills_top_r = match sel_tab {
|
||||
SelectedSkillTree::GeneralCombat => 6,
|
||||
SelectedSkillTree::Sword => 6,
|
||||
SelectedSkillTree::Axe => 5,
|
||||
SelectedSkillTree::Hammer => 4,
|
||||
@ -454,6 +497,7 @@ impl<'a> Widget for Diary<'a> {
|
||||
_ => 0,
|
||||
};
|
||||
let skills_bot_l = match sel_tab {
|
||||
SelectedSkillTree::GeneralCombat => 4,
|
||||
SelectedSkillTree::Sword => 5,
|
||||
SelectedSkillTree::Axe => 5,
|
||||
SelectedSkillTree::Hammer => 6,
|
||||
@ -565,14 +609,283 @@ impl<'a> Widget for Diary<'a> {
|
||||
}
|
||||
// Skill-Icons and Functionality
|
||||
// Art dimensions
|
||||
let art_size = [tweak!(490.0), tweak!(490.0)];
|
||||
let art_size = [tweak!(320.0), tweak!(320.0)];
|
||||
match sel_tab {
|
||||
SelectedSkillTree::GeneralCombat => {
|
||||
use skills::{GeneralSkill::*, RollSkill::*, SkillGroupType::*};
|
||||
use ToolKind::*;
|
||||
// General Combat
|
||||
Image::new(self.imgs.not_found)
|
||||
.wh(art_size)
|
||||
.middle_of(state.content_align)
|
||||
.graphics_for(state.content_align)
|
||||
.color(Some(Color::Rgba(1.0, 1.0, 1.0, tweak!(1.0))))
|
||||
.set(state.general_combat_render, ui);
|
||||
// Top Left skills
|
||||
// 5 1 6
|
||||
// 3 0 4
|
||||
// 8 2 7
|
||||
if Button::image(self.imgs.not_found)
|
||||
.w_h(tweak!(74.0), tweak!(74.0))
|
||||
.middle_of(state.skills_top_l[0])
|
||||
.label(&self.example_skill_count.to_string())
|
||||
.label_y(conrod_core::position::Relative::Scalar(tweak!(-28.0)))
|
||||
.label_x(conrod_core::position::Relative::Scalar(tweak!(32.0)))
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(self.fonts.cyri.scale(tweak!(16)))
|
||||
.label_font_id(self.fonts.cyri.conrod_id)
|
||||
.with_tooltip(
|
||||
self.tooltip_manager,
|
||||
"Increase Health",
|
||||
"Increases health",
|
||||
&diary_tooltip,
|
||||
TEXT_COLOR,
|
||||
)
|
||||
.set(state.skill_general_stat_0, ui)
|
||||
.was_clicked()
|
||||
{
|
||||
events.push(Event::UnlockSkill(Skill::General(HealthIncrease)));
|
||||
};
|
||||
if Button::image(self.imgs.not_found)
|
||||
.w_h(tweak!(74.0), tweak!(74.0))
|
||||
.middle_of(state.skills_top_l[1])
|
||||
.label(&self.example_skill_count.to_string())
|
||||
.label_y(conrod_core::position::Relative::Scalar(tweak!(-28.0)))
|
||||
.label_x(conrod_core::position::Relative::Scalar(tweak!(32.0)))
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(self.fonts.cyri.scale(tweak!(16)))
|
||||
.label_font_id(self.fonts.cyri.conrod_id)
|
||||
.with_tooltip(
|
||||
self.tooltip_manager,
|
||||
"Increase Energy",
|
||||
"Increases energy",
|
||||
&diary_tooltip,
|
||||
TEXT_COLOR,
|
||||
)
|
||||
.set(state.skill_general_stat_1, ui)
|
||||
.was_clicked()
|
||||
{
|
||||
events.push(Event::UnlockSkill(Skill::General(EnergyIncrease)));
|
||||
};
|
||||
// Top right skills
|
||||
if Button::image(self.imgs.not_found)
|
||||
.w_h(tweak!(74.0), tweak!(74.0))
|
||||
.middle_of(state.skills_top_r[0])
|
||||
.label(&self.example_skill_count.to_string())
|
||||
.label_y(conrod_core::position::Relative::Scalar(tweak!(-28.0)))
|
||||
.label_x(conrod_core::position::Relative::Scalar(tweak!(32.0)))
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(self.fonts.cyri.scale(tweak!(16)))
|
||||
.label_font_id(self.fonts.cyri.conrod_id)
|
||||
.with_tooltip(
|
||||
self.tooltip_manager,
|
||||
"Unlock Sword",
|
||||
"Unlocks sword skill tree",
|
||||
&diary_tooltip,
|
||||
TEXT_COLOR,
|
||||
)
|
||||
.set(state.skill_general_tree_0, ui)
|
||||
.was_clicked()
|
||||
{
|
||||
events.push(Event::UnlockSkill(Skill::UnlockGroup(Weapon(Sword))));
|
||||
};
|
||||
if Button::image(self.imgs.not_found)
|
||||
.w_h(tweak!(74.0), tweak!(74.0))
|
||||
.middle_of(state.skills_top_r[1])
|
||||
.label(&self.example_skill_count.to_string())
|
||||
.label_y(conrod_core::position::Relative::Scalar(tweak!(-28.0)))
|
||||
.label_x(conrod_core::position::Relative::Scalar(tweak!(32.0)))
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(self.fonts.cyri.scale(tweak!(16)))
|
||||
.label_font_id(self.fonts.cyri.conrod_id)
|
||||
.with_tooltip(
|
||||
self.tooltip_manager,
|
||||
"Unlock Axe",
|
||||
"Unlocks axe skill tree",
|
||||
&diary_tooltip,
|
||||
TEXT_COLOR,
|
||||
)
|
||||
.set(state.skill_general_tree_1, ui)
|
||||
.was_clicked()
|
||||
{
|
||||
events.push(Event::UnlockSkill(Skill::UnlockGroup(Weapon(Axe))));
|
||||
};
|
||||
if Button::image(self.imgs.not_found)
|
||||
.w_h(tweak!(74.0), tweak!(74.0))
|
||||
.middle_of(state.skills_top_r[2])
|
||||
.label(&self.example_skill_count.to_string())
|
||||
.label_y(conrod_core::position::Relative::Scalar(tweak!(-28.0)))
|
||||
.label_x(conrod_core::position::Relative::Scalar(tweak!(32.0)))
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(self.fonts.cyri.scale(tweak!(16)))
|
||||
.label_font_id(self.fonts.cyri.conrod_id)
|
||||
.with_tooltip(
|
||||
self.tooltip_manager,
|
||||
"Unlock Hammer",
|
||||
"Unlocks hammer skill tree",
|
||||
&diary_tooltip,
|
||||
TEXT_COLOR,
|
||||
)
|
||||
.set(state.skill_general_tree_2, ui)
|
||||
.was_clicked()
|
||||
{
|
||||
events.push(Event::UnlockSkill(Skill::UnlockGroup(Weapon(Hammer))));
|
||||
};
|
||||
if Button::image(self.imgs.not_found)
|
||||
.w_h(tweak!(74.0), tweak!(74.0))
|
||||
.middle_of(state.skills_top_r[3])
|
||||
.label(&self.example_skill_count.to_string())
|
||||
.label_y(conrod_core::position::Relative::Scalar(tweak!(-28.0)))
|
||||
.label_x(conrod_core::position::Relative::Scalar(tweak!(32.0)))
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(self.fonts.cyri.scale(tweak!(16)))
|
||||
.label_font_id(self.fonts.cyri.conrod_id)
|
||||
.with_tooltip(
|
||||
self.tooltip_manager,
|
||||
"Unlock Bow",
|
||||
"Unlocks bow skill tree",
|
||||
&diary_tooltip,
|
||||
TEXT_COLOR,
|
||||
)
|
||||
.set(state.skill_general_tree_3, ui)
|
||||
.was_clicked()
|
||||
{
|
||||
events.push(Event::UnlockSkill(Skill::UnlockGroup(Weapon(Bow))));
|
||||
};
|
||||
if Button::image(self.imgs.not_found)
|
||||
.w_h(tweak!(74.0), tweak!(74.0))
|
||||
.middle_of(state.skills_top_r[4])
|
||||
.label(&self.example_skill_count.to_string())
|
||||
.label_y(conrod_core::position::Relative::Scalar(tweak!(-28.0)))
|
||||
.label_x(conrod_core::position::Relative::Scalar(tweak!(32.0)))
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(self.fonts.cyri.scale(tweak!(16)))
|
||||
.label_font_id(self.fonts.cyri.conrod_id)
|
||||
.with_tooltip(
|
||||
self.tooltip_manager,
|
||||
"Unlock Staff",
|
||||
"Unlocks staff skill tree",
|
||||
&diary_tooltip,
|
||||
TEXT_COLOR,
|
||||
)
|
||||
.set(state.skill_general_tree_4, ui)
|
||||
.was_clicked()
|
||||
{
|
||||
events.push(Event::UnlockSkill(Skill::UnlockGroup(Weapon(Staff))));
|
||||
};
|
||||
if Button::image(self.imgs.not_found)
|
||||
.w_h(tweak!(74.0), tweak!(74.0))
|
||||
.middle_of(state.skills_top_r[5])
|
||||
.label(&self.example_skill_count.to_string())
|
||||
.label_y(conrod_core::position::Relative::Scalar(tweak!(-28.0)))
|
||||
.label_x(conrod_core::position::Relative::Scalar(tweak!(32.0)))
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(self.fonts.cyri.scale(tweak!(16)))
|
||||
.label_font_id(self.fonts.cyri.conrod_id)
|
||||
.with_tooltip(
|
||||
self.tooltip_manager,
|
||||
"Unlock Sceptre",
|
||||
"Unlocks sceptre skill tree",
|
||||
&diary_tooltip,
|
||||
TEXT_COLOR,
|
||||
)
|
||||
.set(state.skill_general_tree_5, ui)
|
||||
.was_clicked()
|
||||
{
|
||||
events.push(Event::UnlockSkill(Skill::UnlockGroup(Weapon(Sceptre))));
|
||||
};
|
||||
// Bottom left skills
|
||||
if Button::image(self.imgs.not_found)
|
||||
.w_h(tweak!(74.0), tweak!(74.0))
|
||||
.middle_of(state.skills_bot_l[0])
|
||||
.label(&self.example_skill_count.to_string())
|
||||
.label_y(conrod_core::position::Relative::Scalar(tweak!(-28.0)))
|
||||
.label_x(conrod_core::position::Relative::Scalar(tweak!(32.0)))
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(self.fonts.cyri.scale(tweak!(16)))
|
||||
.label_font_id(self.fonts.cyri.conrod_id)
|
||||
.with_tooltip(
|
||||
self.tooltip_manager,
|
||||
"Dodge",
|
||||
"Ground-yeeting dodges melee attacks",
|
||||
&diary_tooltip,
|
||||
TEXT_COLOR,
|
||||
)
|
||||
.set(state.skill_general_roll_0, ui)
|
||||
.was_clicked()
|
||||
{
|
||||
events.push(Event::UnlockSkill(Skill::Roll(ImmuneMelee)));
|
||||
};
|
||||
if Button::image(self.imgs.not_found)
|
||||
.w_h(tweak!(74.0), tweak!(74.0))
|
||||
.middle_of(state.skills_bot_l[1])
|
||||
.label(&self.example_skill_count.to_string())
|
||||
.label_y(conrod_core::position::Relative::Scalar(tweak!(-28.0)))
|
||||
.label_x(conrod_core::position::Relative::Scalar(tweak!(32.0)))
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(self.fonts.cyri.scale(tweak!(16)))
|
||||
.label_font_id(self.fonts.cyri.conrod_id)
|
||||
.with_tooltip(
|
||||
self.tooltip_manager,
|
||||
"Cost",
|
||||
"Decreases cost of ground-yeeting yourself",
|
||||
&diary_tooltip,
|
||||
TEXT_COLOR,
|
||||
)
|
||||
.set(state.skill_general_roll_1, ui)
|
||||
.was_clicked()
|
||||
{
|
||||
events.push(Event::UnlockSkill(Skill::Roll(Cost)));
|
||||
};
|
||||
if Button::image(self.imgs.not_found)
|
||||
.w_h(tweak!(74.0), tweak!(74.0))
|
||||
.middle_of(state.skills_bot_l[2])
|
||||
.label(&self.example_skill_count.to_string())
|
||||
.label_y(conrod_core::position::Relative::Scalar(tweak!(-28.0)))
|
||||
.label_x(conrod_core::position::Relative::Scalar(tweak!(32.0)))
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(self.fonts.cyri.scale(tweak!(16)))
|
||||
.label_font_id(self.fonts.cyri.conrod_id)
|
||||
.with_tooltip(
|
||||
self.tooltip_manager,
|
||||
"Strength",
|
||||
"Increases how far you ground-yeet yourself",
|
||||
&diary_tooltip,
|
||||
TEXT_COLOR,
|
||||
)
|
||||
.set(state.skill_general_roll_2, ui)
|
||||
.was_clicked()
|
||||
{
|
||||
events.push(Event::UnlockSkill(Skill::Roll(Strength)));
|
||||
};
|
||||
if Button::image(self.imgs.not_found)
|
||||
.w_h(tweak!(74.0), tweak!(74.0))
|
||||
.middle_of(state.skills_bot_l[3])
|
||||
.label(&self.example_skill_count.to_string())
|
||||
.label_y(conrod_core::position::Relative::Scalar(tweak!(-28.0)))
|
||||
.label_x(conrod_core::position::Relative::Scalar(tweak!(32.0)))
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_size(self.fonts.cyri.scale(tweak!(16)))
|
||||
.label_font_id(self.fonts.cyri.conrod_id)
|
||||
.with_tooltip(
|
||||
self.tooltip_manager,
|
||||
"Duration",
|
||||
"Increases for how long you ground-yeet yourself",
|
||||
&diary_tooltip,
|
||||
TEXT_COLOR,
|
||||
)
|
||||
.set(state.skill_general_roll_3, ui)
|
||||
.was_clicked()
|
||||
{
|
||||
events.push(Event::UnlockSkill(Skill::Roll(Duration)));
|
||||
};
|
||||
},
|
||||
SelectedSkillTree::Sword => {
|
||||
use skills::SwordSkill::*;
|
||||
// Sword
|
||||
Image::new(
|
||||
self.item_imgs
|
||||
.img_id_or_not_found_img(Tool("example_sword".to_string()).clone()),
|
||||
.img_id_or_not_found_img(Tool("example_sword".to_string())),
|
||||
)
|
||||
.wh(art_size)
|
||||
.middle_of(state.content_align)
|
||||
@ -928,7 +1241,7 @@ impl<'a> Widget for Diary<'a> {
|
||||
// Axe
|
||||
Image::new(
|
||||
self.item_imgs
|
||||
.img_id_or_not_found_img(Tool("example_axe".to_string()).clone()),
|
||||
.img_id_or_not_found_img(Tool("example_axe".to_string())),
|
||||
)
|
||||
.wh(art_size)
|
||||
.middle_of(state.content_align)
|
||||
@ -1241,7 +1554,7 @@ impl<'a> Widget for Diary<'a> {
|
||||
// Hammer
|
||||
Image::new(
|
||||
self.item_imgs
|
||||
.img_id_or_not_found_img(Tool("example_hammer".to_string()).clone()),
|
||||
.img_id_or_not_found_img(Tool("example_hammer".to_string())),
|
||||
)
|
||||
.wh(art_size)
|
||||
.middle_of(state.content_align)
|
||||
@ -1554,7 +1867,7 @@ impl<'a> Widget for Diary<'a> {
|
||||
// Bow
|
||||
Image::new(
|
||||
self.item_imgs
|
||||
.img_id_or_not_found_img(Tool("example_bow".to_string()).clone()),
|
||||
.img_id_or_not_found_img(Tool("example_bow".to_string())),
|
||||
)
|
||||
.wh(art_size)
|
||||
.middle_of(state.content_align)
|
||||
@ -1867,7 +2180,7 @@ impl<'a> Widget for Diary<'a> {
|
||||
// Staff
|
||||
Image::new(
|
||||
self.item_imgs
|
||||
.img_id_or_not_found_img(Tool("example_staff_fire".to_string()).clone()),
|
||||
.img_id_or_not_found_img(Tool("example_staff_fire".to_string())),
|
||||
)
|
||||
.wh(art_size)
|
||||
.middle_of(state.content_align)
|
||||
@ -2159,7 +2472,7 @@ impl<'a> Widget for Diary<'a> {
|
||||
// Sceptre
|
||||
Image::new(
|
||||
self.item_imgs
|
||||
.img_id_or_not_found_img(Tool("example_sceptre".to_string()).clone()),
|
||||
.img_id_or_not_found_img(Tool("example_sceptre".to_string())),
|
||||
)
|
||||
.wh(art_size)
|
||||
.middle_of(state.content_align)
|
||||
|
@ -64,7 +64,7 @@ image_ids! {
|
||||
|
||||
// Diary Window
|
||||
diary_bg: "voxygen.element.misc_bg.diary_bg",
|
||||
diary_frame: "voxygen.element.misc_bg.diary_frame",
|
||||
diary_frame: "voxygen.element.misc_bg.diary_frame",
|
||||
|
||||
// Skill Trees
|
||||
sceptre: "voxygen.element.icons.sceptre",
|
||||
|
@ -757,7 +757,7 @@ impl Hud {
|
||||
group_menu: false,
|
||||
mini_map: true,
|
||||
settings_tab: SettingsTab::Interface,
|
||||
skilltreetab: SelectedSkillTree::Sword,
|
||||
skilltreetab: SelectedSkillTree::GeneralCombat,
|
||||
social_tab: SocialTab::Online,
|
||||
want_grab: true,
|
||||
ingame: true,
|
||||
|
@ -351,16 +351,8 @@ impl<'a> Widget for Skillbar<'a> {
|
||||
.mid_bottom_with_margin_on(ui.window, 10.0)
|
||||
.set(state.ids.frame, ui);
|
||||
// Health and Stamina bar
|
||||
let show_health = if self.health.current() != self.health.maximum() {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
};
|
||||
let show_stamina = if self.energy.current() != self.energy.maximum() {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
};
|
||||
let show_health = self.health.current() != self.health.maximum();
|
||||
let show_stamina = self.energy.current() != self.energy.maximum();
|
||||
|
||||
if show_health && !self.health.is_dead {
|
||||
let offset = if show_stamina {
|
||||
@ -424,7 +416,12 @@ impl<'a> Widget for Skillbar<'a> {
|
||||
* living players */
|
||||
(self.health.maximum() / 10) as u32
|
||||
);
|
||||
let mut energy_txt = format!("{}", energy_percentage as u32);
|
||||
let mut energy_txt = format!(
|
||||
"{}/{}",
|
||||
(self.energy.current() / 10) as u32,
|
||||
(self.energy.maximum() / 10) as u32
|
||||
);
|
||||
//let mut energy_txt = format!("{}", energy_percentage as u32);
|
||||
if self.health.is_dead {
|
||||
hp_txt = self.localized_strings.get("hud.group.dead").to_string();
|
||||
energy_txt = self.localized_strings.get("hud.group.dead").to_string();
|
||||
|
Loading…
Reference in New Issue
Block a user