147 lines
6.0 KiB
Rust
147 lines
6.0 KiB
Rust
|
|
use crate::stats_skills::{Stat, StatSet, ProficiencySet, SkillProficiency, StandardSkills};
|
||
|
|
|
||
|
|
pub struct Player {
|
||
|
|
pub strength_score: u8,
|
||
|
|
pub dexterity_score: u8,
|
||
|
|
pub constitution_score: u8,
|
||
|
|
pub intelligence_score: u8,
|
||
|
|
pub wisdom_score: u8,
|
||
|
|
pub charisma_score: u8,
|
||
|
|
pub level: u8,
|
||
|
|
|
||
|
|
// saves
|
||
|
|
pub dexterity_save_proficiency: SkillProficiency,
|
||
|
|
pub strength_save_proficiency: SkillProficiency,
|
||
|
|
pub constitution_save_proficiency: SkillProficiency,
|
||
|
|
pub intelligence_save_proficiency: SkillProficiency,
|
||
|
|
pub wisdom_save_proficiency: SkillProficiency,
|
||
|
|
pub charisma_save_proficiency: SkillProficiency,
|
||
|
|
|
||
|
|
// skills
|
||
|
|
// dexterity: Acrobatics, SleightOfHand, Stealth
|
||
|
|
pub acrobatics_proficiency: SkillProficiency,
|
||
|
|
pub sleight_of_hand_proficiency: SkillProficiency,
|
||
|
|
pub stealth_proficiency: SkillProficiency,
|
||
|
|
// strength: Athletics
|
||
|
|
pub athletics_proficiency: SkillProficiency,
|
||
|
|
// constitution: none
|
||
|
|
// intelligence: Arcana, History, Investigation, Nature, Religion
|
||
|
|
pub arcana_proficiency: SkillProficiency,
|
||
|
|
pub history_proficiency: SkillProficiency,
|
||
|
|
pub investigation_proficiency: SkillProficiency,
|
||
|
|
pub nature_proficiency: SkillProficiency,
|
||
|
|
pub religion_proficiency: SkillProficiency,
|
||
|
|
// wisdom: Animal Handling, Insight, Medicine, Perception, Survival
|
||
|
|
pub animal_handling_proficiency: SkillProficiency,
|
||
|
|
pub insight_proficiency: SkillProficiency,
|
||
|
|
pub medicine_proficiency: SkillProficiency,
|
||
|
|
pub perception_proficiency: SkillProficiency,
|
||
|
|
pub survival_proficiency: SkillProficiency,
|
||
|
|
// charisma: Deception, Intimidation, Performance, Persuasion
|
||
|
|
pub deception_proficiency: SkillProficiency,
|
||
|
|
pub intimidation_proficiency: SkillProficiency,
|
||
|
|
pub performance_proficiency: SkillProficiency,
|
||
|
|
pub persuasion_proficiency: SkillProficiency
|
||
|
|
}
|
||
|
|
|
||
|
|
impl Default for Player {
|
||
|
|
fn default() -> Self {
|
||
|
|
return Player {
|
||
|
|
strength_score: 10,
|
||
|
|
dexterity_score: 10,
|
||
|
|
constitution_score: 10,
|
||
|
|
intelligence_score: 10,
|
||
|
|
wisdom_score: 10,
|
||
|
|
charisma_score: 10,
|
||
|
|
|
||
|
|
level: 1,
|
||
|
|
|
||
|
|
dexterity_save_proficiency: SkillProficiency::None,
|
||
|
|
strength_save_proficiency: SkillProficiency::None,
|
||
|
|
constitution_save_proficiency: SkillProficiency::None,
|
||
|
|
intelligence_save_proficiency: SkillProficiency::None,
|
||
|
|
wisdom_save_proficiency: SkillProficiency::None,
|
||
|
|
charisma_save_proficiency: SkillProficiency::None,
|
||
|
|
|
||
|
|
acrobatics_proficiency: SkillProficiency::None,
|
||
|
|
sleight_of_hand_proficiency: SkillProficiency::None,
|
||
|
|
stealth_proficiency: SkillProficiency::None,
|
||
|
|
|
||
|
|
athletics_proficiency: SkillProficiency::None,
|
||
|
|
|
||
|
|
arcana_proficiency: SkillProficiency::None,
|
||
|
|
history_proficiency: SkillProficiency::None,
|
||
|
|
investigation_proficiency: SkillProficiency::None,
|
||
|
|
nature_proficiency: SkillProficiency::None,
|
||
|
|
religion_proficiency: SkillProficiency::None,
|
||
|
|
|
||
|
|
animal_handling_proficiency: SkillProficiency::None,
|
||
|
|
insight_proficiency: SkillProficiency::None,
|
||
|
|
medicine_proficiency: SkillProficiency::None,
|
||
|
|
perception_proficiency: SkillProficiency::None,
|
||
|
|
survival_proficiency: SkillProficiency::None,
|
||
|
|
|
||
|
|
deception_proficiency: SkillProficiency::None,
|
||
|
|
intimidation_proficiency: SkillProficiency::None,
|
||
|
|
performance_proficiency: SkillProficiency::None,
|
||
|
|
persuasion_proficiency: SkillProficiency::None
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
impl StatSet for Player {
|
||
|
|
fn strength(&self) -> &impl Stat {
|
||
|
|
return &self.strength_score;
|
||
|
|
}
|
||
|
|
fn dexterity(&self) -> &impl Stat {
|
||
|
|
return &self.dexterity_score;
|
||
|
|
}
|
||
|
|
fn constitution(&self) -> &impl Stat {
|
||
|
|
return &self.constitution_score;
|
||
|
|
}
|
||
|
|
fn intelligence(&self) -> &impl Stat {
|
||
|
|
return &self.intelligence_score;
|
||
|
|
}
|
||
|
|
fn wisdom(&self) -> &impl Stat {
|
||
|
|
return &self.wisdom_score;
|
||
|
|
}
|
||
|
|
fn charisma(&self) -> &impl Stat {
|
||
|
|
return &self.charisma_score;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
impl ProficiencySet for Player {
|
||
|
|
fn get_proficiency(&self, skill: StandardSkills) -> SkillProficiency {
|
||
|
|
match skill {
|
||
|
|
StandardSkills::DexteritySave => self.dexterity_save_proficiency,
|
||
|
|
StandardSkills::StrengthSave => self.strength_save_proficiency,
|
||
|
|
StandardSkills::ConstitutionSave => self.constitution_save_proficiency,
|
||
|
|
StandardSkills::IntelligenceSave => self.intelligence_save_proficiency,
|
||
|
|
StandardSkills::WisdomSave => self.wisdom_save_proficiency,
|
||
|
|
StandardSkills::CharismaSave => self.charisma_save_proficiency,
|
||
|
|
StandardSkills::Acrobatics => self.acrobatics_proficiency,
|
||
|
|
StandardSkills::SleightOfHand => self.sleight_of_hand_proficiency,
|
||
|
|
StandardSkills::Stealth => self.stealth_proficiency,
|
||
|
|
StandardSkills::Athletics => self.athletics_proficiency,
|
||
|
|
StandardSkills::Arcana => self.arcana_proficiency,
|
||
|
|
StandardSkills::History => self.history_proficiency,
|
||
|
|
StandardSkills::Investigation => self.investigation_proficiency,
|
||
|
|
StandardSkills::Nature => self.nature_proficiency,
|
||
|
|
StandardSkills::Religion => self.religion_proficiency,
|
||
|
|
StandardSkills::AnimalHandling => self.animal_handling_proficiency,
|
||
|
|
StandardSkills::Insight => self.insight_proficiency,
|
||
|
|
StandardSkills::Medicine => self.medicine_proficiency,
|
||
|
|
StandardSkills::Perception => self.perception_proficiency,
|
||
|
|
StandardSkills::Survival => self.survival_proficiency,
|
||
|
|
StandardSkills::Deception => self.deception_proficiency,
|
||
|
|
StandardSkills::Intimidation => self.intimidation_proficiency,
|
||
|
|
StandardSkills::Performance => self.performance_proficiency,
|
||
|
|
StandardSkills::Persuasion => self.persuasion_proficiency
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
fn get_proficiency_modifier(&self) -> u8 {
|
||
|
|
return ((self.level - 1) / 4) + 2;
|
||
|
|
}
|
||
|
|
}
|