[][src]Trait weasel::team::TeamRules

pub trait TeamRules<R: BattleRules> {
    type Id: Hash + Eq + PartialOrd + Clone + Debug + Serialize + for<'a> Deserialize<'a>;
    type ObjectivesSeed: Clone + Debug + Serialize + for<'a> Deserialize<'a>;
    type Objectives: Default;
    fn allow_new_entity(
        &self,
        _state: &BattleState<R>,
        _team: &Team<R>,
        _type: EntityAddition<R>
    ) -> bool { ... }
fn generate_objectives(
        &self,
        _seed: &Option<Self::ObjectivesSeed>
    ) -> Self::Objectives { ... }
fn check_objectives_on_event(
        &self,
        _state: &BattleState<R>,
        _team: &Team<R>,
        _metrics: &ReadMetrics<R>
    ) -> Option<Conclusion> { ... }
fn check_objectives_on_round(
        &self,
        _state: &BattleState<R>,
        _team: &Team<R>,
        _metrics: &ReadMetrics<R>
    ) -> Option<Conclusion> { ... } }

Collection of rules to manage teams of creatures.

Associated Types

Loading content...

Provided methods

fn allow_new_entity(
    &self,
    _state: &BattleState<R>,
    _team: &Team<R>,
    _type: EntityAddition<R>
) -> bool

Checks if the addition of a new entity in the given team is allowed.

The provided implementation accepts any new entity.

fn generate_objectives(
    &self,
    _seed: &Option<Self::ObjectivesSeed>
) -> Self::Objectives

Generate the objectives for a team.

The provided implementation returns Objectives::default().
If you set team Conclusion manually, you may avoid implementing this method.

fn check_objectives_on_event(
    &self,
    _state: &BattleState<R>,
    _team: &Team<R>,
    _metrics: &ReadMetrics<R>
) -> Option<Conclusion>

Checks if the team has completed its objectives. This check is called after every event.

The provided implementation does not return any conclusion.
If you set team Conclusion manually, you may avoid implementing this method.

Returns the Conclusion for this team, or none if it did not reach any.

fn check_objectives_on_round(
    &self,
    _state: &BattleState<R>,
    _team: &Team<R>,
    _metrics: &ReadMetrics<R>
) -> Option<Conclusion>

Checks if the team has completed its objectives. This check is called every time a round ends.

The provided implementation does not return any conclusion.
If you set team Conclusion manually, you may avoid implementing this method.

Returns the Conclusion for this team, or none if it did not reach any.

Loading content...

Implementors

impl<R: BattleRules> TeamRules<R> for EmptyTeamRules[src]

type Id = u32

type ObjectivesSeed = ()

type Objectives = ()

Loading content...