pub struct TalentTree {
pub id: u64,
pub name: String,
pub description: String,
pub class_restriction: Option<String>,
pub nodes: HashMap<u64, TalentNode>,
pub edges: Vec<TalentEdge>,
pub tiers: Vec<TalentTreeTier>,
pub total_points_invested: u32,
pub mastery_bonus_thresholds: Vec<(u32, Vec<(String, f32, f32)>)>,
}Fields§
§id: u64§name: String§description: String§class_restriction: Option<String>§nodes: HashMap<u64, TalentNode>§edges: Vec<TalentEdge>§tiers: Vec<TalentTreeTier>§total_points_invested: u32§mastery_bonus_thresholds: Vec<(u32, Vec<(String, f32, f32)>)>Implementations§
Source§impl TalentTree
impl TalentTree
pub fn new(id: u64, name: impl Into<String>) -> Self
pub fn add_node(&mut self, node: TalentNode)
pub fn connect(&mut self, from: u64, to: u64, prerequisite: bool)
pub fn mutually_exclude(&mut self, a: u64, b: u64)
pub fn prerequisites_met(&self, node_id: u64) -> bool
pub fn mutual_exclusions_clear(&self, node_id: u64) -> bool
pub fn can_invest_in(&self, node_id: u64, available_points: u32) -> bool
pub fn invest_point(&mut self, node_id: u64) -> bool
pub fn refund_node(&mut self, node_id: u64) -> bool
pub fn active_mastery_bonuses(&self) -> Vec<&(u32, Vec<(String, f32, f32)>)>
pub fn compute_all_stat_mods(&self) -> Vec<(String, f32, f32)>
pub fn tier_completion_pct(&self, tier_idx: u32) -> f32
pub fn build_dependency_graph(&self) -> HashMap<u64, Vec<u64>>
pub fn topological_sort(&self) -> Vec<u64>
Trait Implementations§
Source§impl Clone for TalentTree
impl Clone for TalentTree
Auto Trait Implementations§
impl Freeze for TalentTree
impl RefUnwindSafe for TalentTree
impl Send for TalentTree
impl Sync for TalentTree
impl Unpin for TalentTree
impl UnsafeUnpin for TalentTree
impl UnwindSafe for TalentTree
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.