PlayerEffectContext

Struct PlayerEffectContext 

Source
pub struct PlayerEffectContext<'effect, 'context, 'battle, 'data>
where 'data: 'battle, 'battle: 'context, 'context: 'effect,
{ /* private fields */ }
Expand description

The context of an Effect applying on a Player in a battle.

See Context for more information on how context objects work.

Implementations§

Source§

impl<'effect, 'context, 'battle, 'data> PlayerEffectContext<'effect, 'context, 'battle, 'data>

Source

pub fn as_battle_context<'side_effect>( &'side_effect self, ) -> &'side_effect Context<'battle, 'data>

Returns a reference to the inner Context.

Source

pub fn as_battle_context_mut<'side_effect>( &'side_effect mut self, ) -> &'side_effect mut Context<'battle, 'data>

Returns a mutable reference to the inner Context.

Source

pub fn as_effect_context<'side_effect>( &'side_effect self, ) -> &'side_effect EffectContext<'context, 'battle, 'data>

Returns a reference to the inner EffectContext.

Source

pub fn as_effect_context_mut<'side_effect>( &'side_effect mut self, ) -> &'side_effect mut EffectContext<'context, 'battle, 'data>

Returns a mutable reference to the inner EffectContext.

Source

pub fn source_context<'applying_effect>( &'applying_effect mut self, ) -> Result<Option<MonContext<'applying_effect, 'applying_effect, 'applying_effect, 'battle, 'data>>>

Creates a new MonContext for the effect source, scoped to the lifetime of this context.

Source

pub fn forward_player_effect_context<'side_effect>( &'side_effect mut self, effect_handle: EffectHandle, ) -> Result<PlayerEffectContext<'side_effect, 'side_effect, 'battle, 'data>>

Creates a new SideEffectContext for the same target side but different effect, using this effect as its source, scoped to the lifetime of this context.

Source

pub fn source_side_effect_context<'side_effect>( &'side_effect mut self, ) -> Result<Option<SideEffectContext<'side_effect, 'side_effect, 'battle, 'data>>>

Creates a new SideEffectContext for the source effect with the same target side, scoped to the lifetime of this context.

Source

pub fn battle(&self) -> &CoreBattle<'data>

Returns a reference to the CoreBattle.

Source

pub fn battle_mut(&mut self) -> &mut CoreBattle<'data>

Returns a mutable reference to the CoreBattle.

Source

pub fn effect_handle(&self) -> &EffectHandle

Returns the EffectHandle for the Effect.

Source

pub fn effect(&self) -> &Effect<'_>

Returns a reference to the Effect.

Source

pub fn effect_mut(&mut self) -> &mut Effect<'context>

Returns a mutable reference to the Effect.

Source

pub fn source_effect_handle(&self) -> Option<&EffectHandle>

Returns a reference to the source EffectHandle, if it exists.

Source

pub fn player(&self) -> &Player

Returns a reference to the target Player.

Source

pub fn player_mut(&mut self) -> &mut Player

Returns a mutable reference to the target Player.

Source

pub fn source_handle(&self) -> Option<MonHandle>

Returns the MonHandle for the source Mon, if one exists.

Source

pub fn has_source(&self) -> bool

Checks if the effect has a source Mon.

Source

pub fn source(&self) -> Option<&Mon>

Returns a reference to the source Mon, if one exists.

Source

pub fn source_mut(&mut self) -> Option<&mut Mon>

Returns a mutable reference to the source Mon, if one exists.

Auto Trait Implementations§

§

impl<'effect, 'context, 'battle, 'data> !Freeze for PlayerEffectContext<'effect, 'context, 'battle, 'data>

§

impl<'effect, 'context, 'battle, 'data> !RefUnwindSafe for PlayerEffectContext<'effect, 'context, 'battle, 'data>

§

impl<'effect, 'context, 'battle, 'data> !Send for PlayerEffectContext<'effect, 'context, 'battle, 'data>

§

impl<'effect, 'context, 'battle, 'data> !Sync for PlayerEffectContext<'effect, 'context, 'battle, 'data>

§

impl<'effect, 'context, 'battle, 'data> Unpin for PlayerEffectContext<'effect, 'context, 'battle, 'data>

§

impl<'effect, 'context, 'battle, 'data> !UnwindSafe for PlayerEffectContext<'effect, 'context, 'battle, 'data>

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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<'a, 'b, T> UnsafelyDetachBorrow<'a, 'b, T> for T

Source§

unsafe fn unsafely_detach_borrow(&'a self) -> &'b T

Unsafely detaches an immutable borrow, attaching a new lifetime. Read more
Source§

impl<'a, 'b, T> UnsafelyDetachBorrowMut<'a, 'b, T> for T

Source§

unsafe fn unsafely_detach_borrow_mut(&'a mut self) -> &'b mut T

Unsafely detaches a mutable borrow, attaching a new lifetime. Read more
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<'a, T> Captures<'a> for T
where T: ?Sized,