Changed exp/sp progression for sword skill tree

This commit is contained in:
Sam 2022-10-20 17:57:17 -04:00
parent a21ce80daf
commit 5674923a54
3 changed files with 26 additions and 58 deletions

View File

@ -1,32 +0,0 @@
({
Sword(BalancedFinisher): 1,
Sword(OffensiveCombo): 2,
Sword(OffensiveFinisher): 3,
Sword(OffensiveAdvance): 3,
Sword(CripplingCombo): 4,
Sword(CripplingFinisher): 5,
Sword(CripplingStrike): 5,
Sword(CripplingGouge): 5,
Sword(CleavingCombo): 4,
Sword(CleavingFinisher): 5,
Sword(CleavingSpin): 5,
Sword(CleavingDive): 5,
Sword(DefensiveCombo): 2,
Sword(DefensiveBulwark): 3,
Sword(DefensiveRetreat): 3,
Sword(ParryingCombo): 4,
Sword(ParryingParry): 5,
Sword(ParryingRiposte): 5,
Sword(ParryingCounter): 5,
Sword(HeavyCombo): 4,
Sword(HeavyFinisher): 5,
Sword(HeavyPommelStrike): 5,
Sword(HeavyFortitude): 5,
Sword(MobilityCombo): 2,
Sword(MobilityFeint): 3,
Sword(MobilityAgility): 3,
Sword(ReachingCombo): 4,
Sword(ReachingCharge): 5,
Sword(ReachingFlurry): 5,
Sword(ReachingSkewer): 5,
})

View File

@ -124,12 +124,6 @@ lazy_static! {
}
hashes
};
// Loads the cost in skill points per level needed to purchase a skill
pub static ref SKILL_COST: HashMap<Skill, u16> = {
SkillCostMap::load_expect_cloned(
"common.skill_trees.skill_cost",
).0
};
}
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, Serialize, Deserialize, Ord, PartialOrd)]
@ -143,17 +137,30 @@ impl SkillGroupKind {
/// Changing this is forward compatible with persistence and will
/// automatically force a respec for skill group kinds that are affected.
pub fn skill_point_cost(self, level: u16) -> u32 {
const EXP_INCREMENT: f32 = 10.0;
const STARTING_EXP: f32 = 70.0;
const EXP_CEILING: f32 = 1000.0;
const SCALING_FACTOR: f32 = 0.125;
(EXP_INCREMENT
* (EXP_CEILING
/ EXP_INCREMENT
/ (1.0
+ std::f32::consts::E.powf(-SCALING_FACTOR * level as f32)
* (EXP_CEILING / STARTING_EXP - 1.0)))
.floor()) as u32
use std::f32::consts::E;
match self {
Self::Weapon(ToolKind::Sword) => {
let level = level as f32;
((400.0 * (level / (level + 20.0)).powi(2)
+ 2.0 * level.sqrt()
+ 4.0 * E.powf(0.025 * level))
.min(u32::MAX as f32) as u32)
.saturating_mul(25)
},
_ => {
const EXP_INCREMENT: f32 = 10.0;
const STARTING_EXP: f32 = 70.0;
const EXP_CEILING: f32 = 1000.0;
const SCALING_FACTOR: f32 = 0.125;
(EXP_INCREMENT
* (EXP_CEILING
/ EXP_INCREMENT
/ (1.0
+ E.powf(-SCALING_FACTOR * level as f32)
* (EXP_CEILING / STARTING_EXP - 1.0)))
.floor()) as u32
},
}
}
/// Gets the total amount of skill points that can be spent in a particular

View File

@ -1,5 +1,5 @@
use crate::comp::skillset::{
SkillGroupKind, SKILL_COST, SKILL_GROUP_LOOKUP, SKILL_MAX_LEVEL, SKILL_PREREQUISITES,
SkillGroupKind, SKILL_GROUP_LOOKUP, SKILL_MAX_LEVEL, SKILL_PREREQUISITES,
};
use serde::{Deserialize, Serialize};
@ -209,14 +209,7 @@ impl Skill {
}
/// Returns the cost in skill points of unlocking a particular skill
pub fn skill_cost(&self, level: u16) -> u16 {
// TODO: Better balance the costs later
SKILL_COST
.get(self)
.copied()
.unwrap_or(1)
.saturating_mul(level)
}
pub fn skill_cost(&self, level: u16) -> u16 { level }
/// Returns the maximum level a skill can reach, returns None if the skill
/// doesn't level