[−][src]Trait weasel::round::RoundsRules
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
type RoundsSeed: Debug + Clone + Send + 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,
_entities: &Entities<R>,
_space: &Space<R>,
_model: &mut Self::RoundsModel,
_actor: &dyn Actor<R>,
_entropy: &mut Entropy<R>,
_metrics: &mut WriteMetrics<'_, R>
)
&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>
)
&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>
)
&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>
)
&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.