[][src]Trait weasel::round::RoundsRules

pub trait RoundsRules<R: BattleRules> {
    type RoundsSeed: Debug + Clone + Send + Serialize + for<'a> Deserialize<'a>;
    type RoundsModel;
    fn generate_model(
        &self,
        seed: &Option<Self::RoundsSeed>
    ) -> Self::RoundsModel; fn eligible(
        &self,
        _model: &Self::RoundsModel,
        _actor: &dyn Actor<R>
    ) -> bool { ... }
fn on_start(
        &self,
        _entities: &Entities<R>,
        _space: &Space<R>,
        _model: &mut Self::RoundsModel,
        _actor: &dyn Actor<R>,
        _entropy: &mut Entropy<R>,
        _metrics: &mut WriteMetrics<'_, R>
    ) { ... }
fn on_end(
        &self,
        _entities: &Entities<R>,
        _space: &Space<R>,
        _model: &mut Self::RoundsModel,
        _actor: &dyn Actor<R>,
        _entropy: &mut Entropy<R>,
        _metrics: &mut WriteMetrics<'_, R>
    ) { ... }
fn on_actor_added(
        &self,
        _model: &mut Self::RoundsModel,
        _actor: &dyn Actor<R>,
        _entropy: &mut Entropy<R>,
        _metrics: &mut WriteMetrics<'_, R>
    ) { ... }
fn on_actor_removed(
        &self,
        _model: &mut Self::RoundsModel,
        _actor: &dyn Actor<R>,
        _entropy: &mut Entropy<R>,
        _metrics: &mut WriteMetrics<'_, R>
    ) { ... } }

Rules to determine the order of turns among actors.

These rules must provide to the battle system the information needed to know if an actor can take an action in a given moment. In other words, they manage the time dimension, which is by definition divided in turns and rounds.

Associated Types

Loading content...

Required methods

fn generate_model(&self, seed: &Option<Self::RoundsSeed>) -> Self::RoundsModel

Generates a RoundsModel starting from a RoundsSeed.

Loading content...

Provided methods

fn eligible(&self, _model: &Self::RoundsModel, _actor: &dyn Actor<R>) -> bool

Returns whether the given actor is eligible to start a new round.

The provided implementation accepts any actor.

fn on_start(
    &self,
    _entities: &Entities<R>,
    _space: &Space<R>,
    _model: &mut Self::RoundsModel,
    _actor: &dyn Actor<R>,
    _entropy: &mut Entropy<R>,
    _metrics: &mut WriteMetrics<'_, R>
)

Invoked when a new turn begins.

The provided implementation does nothing.

fn on_end(
    &self,
    _entities: &Entities<R>,
    _space: &Space<R>,
    _model: &mut Self::RoundsModel,
    _actor: &dyn Actor<R>,
    _entropy: &mut Entropy<R>,
    _metrics: &mut WriteMetrics<'_, R>
)

Invoked when the current turn ends.

The provided implementation does nothing.

fn on_actor_added(
    &self,
    _model: &mut Self::RoundsModel,
    _actor: &dyn Actor<R>,
    _entropy: &mut Entropy<R>,
    _metrics: &mut WriteMetrics<'_, R>
)

Invoked when a new actor is added to the battle.

The provided implementation does nothing.

fn on_actor_removed(
    &self,
    _model: &mut Self::RoundsModel,
    _actor: &dyn Actor<R>,
    _entropy: &mut Entropy<R>,
    _metrics: &mut WriteMetrics<'_, R>
)

Invoked when an actor is removed from the battle.

The provided implementation does nothing.

Loading content...

Implementors

impl<R: BattleRules> RoundsRules<R> for EmptyRoundsRules[src]

type RoundsSeed = ()

type RoundsModel = ()

Loading content...