[][src]Trait weasel::character::CharacterRules

pub trait CharacterRules<R: BattleRules> {
    type CreatureId: Hash + Eq + Clone + Debug + Serialize + for<'a> Deserialize<'a>;
    type Statistic: Id + 'static;
    type StatisticsSeed: Clone + Debug + Serialize + for<'a> Deserialize<'a>;
    type StatisticsAlteration: Clone + Debug + Serialize + for<'a> Deserialize<'a>;
    fn generate_statistics(
        &self,
        _seed: &Option<Self::StatisticsSeed>,
        _entropy: &mut Entropy<R>,
        _metrics: &mut WriteMetrics<R>
    ) -> Box<dyn Iterator<Item = Self::Statistic>> { ... }
fn alter(
        &self,
        _character: &mut dyn Character<R>,
        _alteration: &Self::StatisticsAlteration,
        _entropy: &mut Entropy<R>,
        _metrics: &mut WriteMetrics<R>
    ) -> Option<Transmutation> { ... } }

Rules to define the structure and the behavior of characters.

Associated Types

Loading content...

Provided methods

fn generate_statistics(
    &self,
    _seed: &Option<Self::StatisticsSeed>,
    _entropy: &mut Entropy<R>,
    _metrics: &mut WriteMetrics<R>
) -> Box<dyn Iterator<Item = Self::Statistic>>

Generates all statistics of a creature. Statistics should have unique ids, otherwise only the last entry will be persisted.

The provided implementation generates an empty set of statistics.

fn alter(
    &self,
    _character: &mut dyn Character<R>,
    _alteration: &Self::StatisticsAlteration,
    _entropy: &mut Entropy<R>,
    _metrics: &mut WriteMetrics<R>
) -> Option<Transmutation>

Alters one or more statistics starting from the given alteration object.
Returns an optional Transmutation to be applied to the character as result of this alteration.

The provided implementation does nothing.

Loading content...

Implementors

Loading content...