Skill point prerequisites and costs

This commit is contained in:
Sam 2022-03-07 01:10:27 -05:00
parent 5d5fbde291
commit eacbdefb75
4 changed files with 87 additions and 2 deletions

View File

@ -0,0 +1,36 @@
({
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,
Sword(AirSlashCombo): 4,
Sword(AirSlashVertical): 5,
Sword(AirSlashHorizontal): 5,
Sword(AirSlashWhirlwind): 5,
})

View File

@ -1,4 +1,34 @@
({
Sword(OffensiveFinisher): {Sword(OffensiveCombo): 1},
Sword(OffensiveAdvance): {Sword(OffensiveCombo): 1},
Sword(CripplingCombo): {Sword(OffensiveCombo): 1},
Sword(CripplingFinisher): {Sword(CripplingCombo): 1},
Sword(CripplingStrike): {Sword(CripplingCombo): 1},
Sword(CripplingGouge): {Sword(CripplingCombo): 1},
Sword(CleavingCombo): {Sword(OffensiveCombo): 1},
Sword(CleavingFinisher): {Sword(CleavingCombo): 1},
Sword(CleavingSpin): {Sword(CleavingCombo): 1},
Sword(CleavingDive): {Sword(CleavingCombo): 1},
Sword(DefensiveBulwark): {Sword(DefensiveCombo): 1},
Sword(DefensiveRetreat): {Sword(DefensiveCombo): 1},
Sword(ParryingCombo): {Sword(DefensiveCombo): 1},
Sword(ParryingParry): {Sword(ParryingCombo): 1},
Sword(ParryingRiposte): {Sword(ParryingCombo): 1},
Sword(ParryingCounter): {Sword(ParryingCombo): 1},
Sword(HeavyCombo): {Sword(DefensiveCombo): 1},
Sword(HeavyFinisher): {Sword(HeavyCombo): 1},
Sword(HeavyPommelStrike): {Sword(HeavyCombo): 1},
Sword(HeavyFortitude): {Sword(HeavyCombo): 1},
Sword(MobilityFeint): {Sword(MobilityCombo): 1},
Sword(MobilityAgility): {Sword(MobilityCombo): 1},
Sword(ReachingCombo): {Sword(MobilityCombo): 1},
Sword(ReachingCharge): {Sword(ReachingCombo): 1},
Sword(ReachingFlurry): {Sword(ReachingCombo): 1},
Sword(ReachingSkewer): {Sword(ReachingCombo): 1},
Sword(AirSlashCombo): {Sword(MobilityCombo): 1},
Sword(AirSlashVertical): {Sword(AirSlashCombo): 1},
Sword(AirSlashHorizontal): {Sword(AirSlashCombo): 1},
Sword(AirSlashWhirlwind): {Sword(AirSlashCombo): 1},
Axe(LDamage): {Axe(UnlockLeap): 1},
Axe(LKnockback): {Axe(UnlockLeap): 1},
Axe(LCost): {Axe(UnlockLeap): 1},

View File

@ -56,6 +56,15 @@ impl Asset for SkillPrerequisitesMap {
const EXTENSION: &'static str = "ron";
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct SkillCostMap(HashMap<Skill, u16>);
impl Asset for SkillCostMap {
type Loader = assets::RonLoader;
const EXTENSION: &'static str = "ron";
}
lazy_static! {
// Determines the skills that comprise each skill group.
//
@ -115,6 +124,12 @@ 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)]

View File

@ -1,5 +1,5 @@
use crate::comp::skillset::{
SkillGroupKind, SKILL_GROUP_LOOKUP, SKILL_MAX_LEVEL, SKILL_PREREQUISITES,
SkillGroupKind, SKILL_COST, SKILL_GROUP_LOOKUP, SKILL_MAX_LEVEL, SKILL_PREREQUISITES,
};
use serde::{Deserialize, Serialize};
@ -215,7 +215,11 @@ 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
level
SKILL_COST
.get(self)
.copied()
.unwrap_or(1)
.saturating_mul(level)
}
/// Returns the maximum level a skill can reach, returns None if the skill