pub struct Entities<R: BattleRules> { /* private fields */ }
Expand description
Data structure to manage ownership of teams and entities.
Implementations§
Source§impl<R: BattleRules> Entities<R>
impl<R: BattleRules> Entities<R>
Sourcepub fn creatures(&self) -> impl Iterator<Item = &Creature<R>>
pub fn creatures(&self) -> impl Iterator<Item = &Creature<R>>
Returns an iterator over creatures.
Sourcepub fn creatures_mut(&mut self) -> impl Iterator<Item = &mut Creature<R>>
pub fn creatures_mut(&mut self) -> impl Iterator<Item = &mut Creature<R>>
Returns a mutable iterator over creatures.
Sourcepub fn creature(&self, id: &CreatureId<R>) -> Option<&Creature<R>>
pub fn creature(&self, id: &CreatureId<R>) -> Option<&Creature<R>>
Returns the creature with the given id.
Sourcepub fn creature_mut(&mut self, id: &CreatureId<R>) -> Option<&mut Creature<R>>
pub fn creature_mut(&mut self, id: &CreatureId<R>) -> Option<&mut Creature<R>>
Returns a mutable reference to the creature with the given id.
Sourcepub fn objects_mut(&mut self) -> impl Iterator<Item = &mut Object<R>>
pub fn objects_mut(&mut self) -> impl Iterator<Item = &mut Object<R>>
Returns a mutable iterator over objects.
Sourcepub fn object(&self, id: &ObjectId<R>) -> Option<&Object<R>>
pub fn object(&self, id: &ObjectId<R>) -> Option<&Object<R>>
Returns the object with the given id.
Sourcepub fn object_mut(&mut self, id: &ObjectId<R>) -> Option<&mut Object<R>>
pub fn object_mut(&mut self, id: &ObjectId<R>) -> Option<&mut Object<R>>
Returns a mutable reference to the object with the given id.
Sourcepub fn teams_mut(&mut self) -> impl Iterator<Item = &mut Team<R>>
pub fn teams_mut(&mut self) -> impl Iterator<Item = &mut Team<R>>
Returns a mutable iterator over teams.
Sourcepub fn team_mut(&mut self, id: &TeamId<R>) -> Option<&mut Team<R>>
pub fn team_mut(&mut self, id: &TeamId<R>) -> Option<&mut Team<R>>
Returns a mutable reference to the team with the given id.
Sourcepub fn entities(&self) -> impl Iterator<Item = &dyn Entity<R>>
pub fn entities(&self) -> impl Iterator<Item = &dyn Entity<R>>
Returns an iterator over entities.
Sourcepub fn entities_mut(&mut self) -> impl Iterator<Item = &mut dyn Entity<R>>
pub fn entities_mut(&mut self) -> impl Iterator<Item = &mut dyn Entity<R>>
Returns a mutable iterator over entities.
Sourcepub fn entity(&self, id: &EntityId<R>) -> Option<&dyn Entity<R>>
pub fn entity(&self, id: &EntityId<R>) -> Option<&dyn Entity<R>>
Returns the entity with the given id.
Sourcepub fn entity_mut(&mut self, id: &EntityId<R>) -> Option<&mut dyn Entity<R>>
pub fn entity_mut(&mut self, id: &EntityId<R>) -> Option<&mut dyn Entity<R>>
Returns a mutable reference to the entity with the given id.
Sourcepub fn characters(&self) -> impl Iterator<Item = &dyn Character<R>>
pub fn characters(&self) -> impl Iterator<Item = &dyn Character<R>>
Returns an iterator over characters.
Sourcepub fn characters_mut(&mut self) -> impl Iterator<Item = &mut dyn Character<R>>
pub fn characters_mut(&mut self) -> impl Iterator<Item = &mut dyn Character<R>>
Returns a mutable iterator over characters.
Sourcepub fn character(&self, id: &EntityId<R>) -> Option<&dyn Character<R>>
pub fn character(&self, id: &EntityId<R>) -> Option<&dyn Character<R>>
Returns the character with the given id.
Sourcepub fn character_mut(
&mut self,
id: &EntityId<R>,
) -> Option<&mut dyn Character<R>>
pub fn character_mut( &mut self, id: &EntityId<R>, ) -> Option<&mut dyn Character<R>>
Returns a mutable reference to the character with the given id.
Sourcepub fn actors_mut(&mut self) -> impl Iterator<Item = &mut dyn Actor<R>>
pub fn actors_mut(&mut self) -> impl Iterator<Item = &mut dyn Actor<R>>
Returns a mutable iterator over actors.
Sourcepub fn actor(&self, id: &EntityId<R>) -> Option<&dyn Actor<R>>
pub fn actor(&self, id: &EntityId<R>) -> Option<&dyn Actor<R>>
Returns the character with the given id.
Sourcepub fn actor_mut(&mut self, id: &EntityId<R>) -> Option<&mut dyn Actor<R>>
pub fn actor_mut(&mut self, id: &EntityId<R>) -> Option<&mut dyn Actor<R>>
Returns a mutable reference to the actor with the given id.
Sourcepub fn relation(
&self,
first: &TeamId<R>,
second: &TeamId<R>,
) -> Option<Relation>
pub fn relation( &self, first: &TeamId<R>, second: &TeamId<R>, ) -> Option<Relation>
Returns the Relation
between two teams. Relations are symmetric.
The relation of a team towards itself is Kin
.
Sourcepub fn allies_id<'a>(
&'a self,
id: &'a TeamId<R>,
) -> impl Iterator<Item = TeamId<R>> + 'a
pub fn allies_id<'a>( &'a self, id: &'a TeamId<R>, ) -> impl Iterator<Item = TeamId<R>> + 'a
Returns all allied teams’ id of a team.
Sourcepub fn allies<'a>(
&'a self,
id: &'a TeamId<R>,
) -> impl Iterator<Item = &Team<R>> + 'a
pub fn allies<'a>( &'a self, id: &'a TeamId<R>, ) -> impl Iterator<Item = &Team<R>> + 'a
Returns all allied teams of a team.
Sourcepub fn enemies_id<'a>(
&'a self,
id: &'a TeamId<R>,
) -> impl Iterator<Item = TeamId<R>> + 'a
pub fn enemies_id<'a>( &'a self, id: &'a TeamId<R>, ) -> impl Iterator<Item = TeamId<R>> + 'a
Returns all enemy teams’ id of a team.
Sourcepub fn enemies<'a>(
&'a self,
id: &'a TeamId<R>,
) -> impl Iterator<Item = &Team<R>> + 'a
pub fn enemies<'a>( &'a self, id: &'a TeamId<R>, ) -> impl Iterator<Item = &Team<R>> + 'a
Returns all enemy teams of a team.
Sourcepub fn victorious(&self) -> impl Iterator<Item = &Team<R>>
pub fn victorious(&self) -> impl Iterator<Item = &Team<R>>
Returns all victorious teams.
Sourcepub fn victorious_id(&self) -> impl Iterator<Item = TeamId<R>> + '_
pub fn victorious_id(&self) -> impl Iterator<Item = TeamId<R>> + '_
Returns the id of all victorious teams.
Sourcepub fn defeated_id(&self) -> impl Iterator<Item = TeamId<R>> + '_
pub fn defeated_id(&self) -> impl Iterator<Item = TeamId<R>> + '_
Returns the id of all defeated teams.