[−][src]Trait weasel::round::RoundsRules
Rules to determine the order of rounds 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 (or rounds).
Associated Types
type RoundsSeed: Debug + Clone + Serialize + for<'a> Deserialize<'a>
See RoundsSeed.
type RoundsModel
See RoundsModel.
Required methods
fn generate_model(&self, seed: &Option<Self::RoundsSeed>) -> Self::RoundsModel
Generates a RoundsModel
starting from a RoundsSeed
.
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,
_model: &mut Self::RoundsModel,
_actor: &dyn Actor<R>,
_entropy: &mut Entropy<R>,
_metrics: &mut WriteMetrics<R>
)
&self,
_model: &mut Self::RoundsModel,
_actor: &dyn Actor<R>,
_entropy: &mut Entropy<R>,
_metrics: &mut WriteMetrics<R>
)
Invoked when a new round begins.
The provided implementation does nothing.
fn on_end(
&self,
_model: &mut Self::RoundsModel,
_actor: &dyn Actor<R>,
_entropy: &mut Entropy<R>,
_metrics: &mut WriteMetrics<R>
)
&self,
_model: &mut Self::RoundsModel,
_actor: &dyn Actor<R>,
_entropy: &mut Entropy<R>,
_metrics: &mut WriteMetrics<R>
)
Invoked when the current round 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>
)
&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.