Struct Object

Source
pub struct Object<R: BattleRules> { /* private fields */ }
Expand description

An object is an inanimate entity.

Objects possess a position and a set of statistics, but they can’t start a turn nor activate abilities. They can be target of status effects.
Objects aren’t part of any team.

Trait Implementations§

Source§

impl<R: BattleRules> Character<R> for Object<R>

Source§

fn statistics<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Statistic<R>> + 'a>

Returns an iterator over statistics.
Source§

fn statistics_mut<'a>( &'a mut self, ) -> Box<dyn Iterator<Item = &'a mut Statistic<R>> + 'a>

Returns a mutable iterator over statistics.
Source§

fn statistic(&self, id: &StatisticId<R>) -> Option<&Statistic<R>>

Returns the statistic with the given id.
Source§

fn statistic_mut(&mut self, id: &StatisticId<R>) -> Option<&mut Statistic<R>>

Returns a mutable reference to the statistic with the given id.
Source§

fn add_statistic(&mut self, statistic: Statistic<R>) -> Option<Statistic<R>>

Adds a new statistic. Replaces an existing statistic with the same id. Returns the replaced statistic, if present.
Source§

fn remove_statistic(&mut self, id: &StatisticId<R>) -> Option<Statistic<R>>

Removes a statistic. Returns the removed statistic, if present.
Source§

fn statuses<'a>(&'a self) -> Box<dyn Iterator<Item = &'a AppliedStatus<R>> + 'a>

Returns an iterator over statuses.
Source§

fn statuses_mut<'a>( &'a mut self, ) -> Box<dyn Iterator<Item = &'a mut AppliedStatus<R>> + 'a>

Returns a mutable iterator over statuses.
Source§

fn status(&self, id: &StatusId<R>) -> Option<&AppliedStatus<R>>

Returns the status with the given id.
Source§

fn status_mut(&mut self, id: &StatusId<R>) -> Option<&mut AppliedStatus<R>>

Returns a mutable reference to the status with the given id.
Source§

fn add_status(&mut self, status: AppliedStatus<R>) -> Option<AppliedStatus<R>>

Adds a new status. Replaces an existing status with the same id. Returns the replaced status, if present.
Source§

fn remove_status(&mut self, id: &StatusId<R>) -> Option<AppliedStatus<R>>

Removes a status. Returns the removed status, if present.
Source§

impl<R: BattleRules> Entity<R> for Object<R>

Source§

fn entity_id(&self) -> &EntityId<R>

Returns the id of this entity.
Source§

fn position(&self) -> &Position<R>

Returns this entity position.
Source§

fn set_position(&mut self, position: Position<R>)

Sets a new position for this entity.
Source§

impl<R: BattleRules> Id for Object<R>

Source§

type Id = <<R as BattleRules>::CR as CharacterRules<R>>::ObjectId

Type of the id value.
Source§

fn id(&self) -> &ObjectId<R>

Returns a reference to the current id.

Auto Trait Implementations§

§

impl<R> Freeze for Object<R>

§

impl<R> RefUnwindSafe for Object<R>

§

impl<R> Send for Object<R>
where <<R as BattleRules>::CR as CharacterRules<R>>::Statistic: Send, <<R as BattleRules>::CR as CharacterRules<R>>::Status: Send,

§

impl<R> Sync for Object<R>
where <<R as BattleRules>::SR as SpaceRules<R>>::Position: Sync, <<R as BattleRules>::CR as CharacterRules<R>>::CreatureId: Sync, <<R as BattleRules>::CR as CharacterRules<R>>::ObjectId: Sync, <<<R as BattleRules>::CR as CharacterRules<R>>::Statistic as Id>::Id: Sync, <<R as BattleRules>::CR as CharacterRules<R>>::Statistic: Sync, <<<R as BattleRules>::CR as CharacterRules<R>>::Status as Id>::Id: Sync, <<R as BattleRules>::CR as CharacterRules<R>>::Status: Sync,

§

impl<R> Unpin for Object<R>

§

impl<R> UnwindSafe for Object<R>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V