mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Added skill point costs to tooltips.
This commit is contained in:
parent
ae8c8b47f1
commit
4f552a736e
@ -222,7 +222,7 @@ pub enum SkillGroupType {
|
||||
|
||||
impl SkillGroupType {
|
||||
/// Gets the cost in experience of earning a skill point
|
||||
pub fn skill_point_cost(self) -> u16 { 300 }
|
||||
pub fn skill_point_cost(self) -> u16 { 200 }
|
||||
|
||||
/// Gets the total amount of skill points that can be spent in a particular
|
||||
/// skill group
|
||||
@ -526,6 +526,16 @@ impl SkillSet {
|
||||
skill_groups.next().map_or(0, |s_g| s_g.exp)
|
||||
}
|
||||
|
||||
/// Gets skill point cost to purchase skill of next level
|
||||
pub fn skill_point_cost(&self, skill: Skill) -> u16 {
|
||||
let next_level = if self.skills.contains_key(&skill) {
|
||||
self.skills.get(&skill).copied().flatten().map(|l| l + 1)
|
||||
} else {
|
||||
skill.get_max_level().map(|_| 1)
|
||||
};
|
||||
skill.skill_cost(next_level)
|
||||
}
|
||||
|
||||
/// Checks if player has sufficient skill points to purchase a skill
|
||||
pub fn sufficient_skill_points(&self, skill: Skill) -> bool {
|
||||
if let Some(skill_group_type) = SkillSet::get_skill_group_type_for_skill(&skill) {
|
||||
@ -534,12 +544,7 @@ impl SkillSet {
|
||||
.iter()
|
||||
.find(|x| x.skill_group_type == skill_group_type)
|
||||
{
|
||||
let next_level = if self.skills.contains_key(&skill) {
|
||||
self.skills.get(&skill).copied().flatten().map(|l| l + 1)
|
||||
} else {
|
||||
skill.get_max_level().map(|_| 1)
|
||||
};
|
||||
let needed_sp = skill.skill_cost(next_level);
|
||||
let needed_sp = self.skill_point_cost(skill);
|
||||
skill_group.available_sp > needed_sp
|
||||
} else {
|
||||
false
|
||||
|
@ -172,7 +172,9 @@ pub fn handle_destroy(server: &mut Server, entity: EcsEntity, cause: HealthSourc
|
||||
} else {
|
||||
return;
|
||||
};
|
||||
let (entity_stats, entity_health) = if let (Some(entity_stats), Some(entity_health)) = (stats.get(entity), healths.get(entity)) {
|
||||
let (entity_stats, entity_health) = if let (Some(entity_stats), Some(entity_health)) =
|
||||
(stats.get(entity), healths.get(entity))
|
||||
{
|
||||
(entity_stats, entity_health)
|
||||
} else {
|
||||
return;
|
||||
@ -190,8 +192,10 @@ pub fn handle_destroy(server: &mut Server, entity: EcsEntity, cause: HealthSourc
|
||||
const MAX_EXP_DIST: f32 = 150.0;
|
||||
// Attacker gets same as exp of everyone else
|
||||
const ATTACKER_EXP_WEIGHT: f32 = 1.0;
|
||||
// TODO: Scale xp from skillset rather than health, when NPCs have their own skillsets
|
||||
let mut exp_reward = entity_stats.body_type.base_exp() as f32 * (entity_health.maximum() as f32 / entity_stats.body_type.base_health() as f32);
|
||||
// TODO: Scale xp from skillset rather than health, when NPCs have their own
|
||||
// skillsets
|
||||
let mut exp_reward = entity_stats.body_type.base_exp() as f32
|
||||
* (entity_health.maximum() as f32 / entity_stats.body_type.base_health() as f32);
|
||||
|
||||
// Distribute EXP to group
|
||||
let positions = state.ecs().read_storage::<Pos>();
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user