[][src]Struct weasel::power::InvokePower

pub struct InvokePower<R: BattleRules> { /* fields omitted */ }

Event to make a team invoke a power.

A team can invoke a power in between actor turns or during turns of actors that belongs to itself.

Examples

use weasel::{
    battle_rules, rules::empty::*, Battle, BattleRules, CreateTeam, EntityId,
    EventTrigger, InvokePower, Server,
};

battle_rules! {}

let battle = Battle::builder(CustomRules::new()).build();
let mut server = Server::builder(battle).build();

let team_id = 1;
CreateTeam::trigger(&mut server, team_id).fire().unwrap();

let power_id = 99;
let result = InvokePower::trigger(&mut server, team_id, power_id).fire();
// We get an error because the team doesn't possess this power.
// The team's powers must defined in 'TeamRules'.
assert!(result.is_err());

Implementations

impl<R: BattleRules> InvokePower<R>[src]

pub fn trigger<P: EventProcessor<R>>(
    processor: &mut P,
    team_id: TeamId<R>,
    power_id: PowerId<R>
) -> InvokePowerTrigger<'_, R, P>
[src]

Returns a trigger for this event.

pub fn team_id(&self) -> &TeamId<R>[src]

Returns the id of the team that is invoking the power.

pub fn power_id(&self) -> &PowerId<R>[src]

Returns the id of the power to be invoked.

pub fn invocation(&self) -> &Option<Invocation<R>>[src]

Returns the invocation profile for the power.

Trait Implementations

impl<R: BattleRules> Clone for InvokePower<R>[src]

impl<R: BattleRules> Debug for InvokePower<R>[src]

impl<'de, R: BattleRules> Deserialize<'de> for InvokePower<R> where
    TeamId<R>: Deserialize<'de>,
    PowerId<R>: Deserialize<'de>,
    Option<Invocation<R>>: Deserialize<'de>, 
[src]

impl<R: BattleRules + 'static> Event<R> for InvokePower<R>[src]

impl<R: BattleRules> Serialize for InvokePower<R> where
    TeamId<R>: Serialize,
    PowerId<R>: Serialize,
    Option<Invocation<R>>: Serialize
[src]

Auto Trait Implementations

impl<R> RefUnwindSafe for InvokePower<R> where
    <<<R as BattleRules>::TR as TeamRules<R>>::Power as Id>::Id: RefUnwindSafe,
    <<R as BattleRules>::TR as TeamRules<R>>::Id: RefUnwindSafe,
    <<R as BattleRules>::TR as TeamRules<R>>::Invocation: RefUnwindSafe

impl<R> Send for InvokePower<R> where
    <<<R as BattleRules>::TR as TeamRules<R>>::Power as Id>::Id: Send,
    <<R as BattleRules>::TR as TeamRules<R>>::Id: Send,
    <<R as BattleRules>::TR as TeamRules<R>>::Invocation: Send

impl<R> Sync for InvokePower<R> where
    <<<R as BattleRules>::TR as TeamRules<R>>::Power as Id>::Id: Sync,
    <<R as BattleRules>::TR as TeamRules<R>>::Id: Sync,
    <<R as BattleRules>::TR as TeamRules<R>>::Invocation: Sync

impl<R> Unpin for InvokePower<R> where
    <<<R as BattleRules>::TR as TeamRules<R>>::Power as Id>::Id: Unpin,
    <<R as BattleRules>::TR as TeamRules<R>>::Id: Unpin,
    <<R as BattleRules>::TR as TeamRules<R>>::Invocation: Unpin

impl<R> UnwindSafe for InvokePower<R> where
    <<<R as BattleRules>::TR as TeamRules<R>>::Power as Id>::Id: UnwindSafe,
    <<R as BattleRules>::TR as TeamRules<R>>::Id: UnwindSafe,
    <<R as BattleRules>::TR as TeamRules<R>>::Invocation: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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