[][src]Struct weasel::ability::ActivateAbility

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

Event to make an actor activate an ability.

Examples

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

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 creature_id = 1;
let position = ();
CreateCreature::trigger(&mut server, creature_id, team_id, position)
    .fire()
    .unwrap();
StartRound::trigger(&mut server, EntityId::Creature(creature_id))
    .fire()
    .unwrap();

let ability_id = 99;
let result =
    ActivateAbility::trigger(&mut server, EntityId::Creature(creature_id), ability_id)
        .fire();
// We get an error because the creature doesn't know this ability.
// The set of abilities known by creatures must defined in 'ActorRules'.
assert!(result.is_err());

Implementations

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

pub fn trigger<P: EventProcessor<R>>(
    processor: &mut P,
    entity_id: EntityId<R>,
    ability_id: AbilityId<R>
) -> ActivateAbilityTrigger<R, P>
[src]

Returns a trigger for this event.

pub fn entity_id(&self) -> &EntityId<R>[src]

Returns the id of the actor who is activating the ability.

pub fn ability_id(&self) -> &AbilityId<R>[src]

Returns the id of the ability to be activated.

pub fn activation(&self) -> &Option<Activation<R>>[src]

Returns the activation profile for the ability.

Trait Implementations

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

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

impl<'de, R: BattleRules> Deserialize<'de> for ActivateAbility<R> where
    EntityId<R>: Deserialize<'de>,
    AbilityId<R>: Deserialize<'de>,
    Option<Activation<R>>: Deserialize<'de>, 
[src]

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

impl<R: BattleRules> Serialize for ActivateAbility<R> where
    EntityId<R>: Serialize,
    AbilityId<R>: Serialize,
    Option<Activation<R>>: Serialize
[src]

Auto Trait Implementations

impl<R> RefUnwindSafe for ActivateAbility<R> where
    <R as BattleRules>::AR: ActorRules<R>,
    <<R as BattleRules>::AR as ActorRules<R>>::Activation: RefUnwindSafe,
    <<R as BattleRules>::CR as CharacterRules<R>>::CreatureId: RefUnwindSafe,
    <<<R as BattleRules>::AR as ActorRules<R>>::Ability as Id>::Id: RefUnwindSafe,
    <<R as BattleRules>::CR as CharacterRules<R>>::ObjectId: RefUnwindSafe

impl<R> Send for ActivateAbility<R> where
    <R as BattleRules>::AR: ActorRules<R>,
    <<R as BattleRules>::AR as ActorRules<R>>::Activation: Send,
    <<R as BattleRules>::CR as CharacterRules<R>>::CreatureId: Send,
    <<<R as BattleRules>::AR as ActorRules<R>>::Ability as Id>::Id: Send,
    <<R as BattleRules>::CR as CharacterRules<R>>::ObjectId: Send

impl<R> Sync for ActivateAbility<R> where
    <R as BattleRules>::AR: ActorRules<R>,
    <<R as BattleRules>::AR as ActorRules<R>>::Activation: Sync,
    <<R as BattleRules>::CR as CharacterRules<R>>::CreatureId: Sync,
    <<<R as BattleRules>::AR as ActorRules<R>>::Ability as Id>::Id: Sync,
    <<R as BattleRules>::CR as CharacterRules<R>>::ObjectId: Sync

impl<R> Unpin for ActivateAbility<R> where
    <R as BattleRules>::AR: ActorRules<R>,
    <<R as BattleRules>::AR as ActorRules<R>>::Activation: Unpin,
    <<R as BattleRules>::CR as CharacterRules<R>>::CreatureId: Unpin,
    <<<R as BattleRules>::AR as ActorRules<R>>::Ability as Id>::Id: Unpin,
    <<R as BattleRules>::CR as CharacterRules<R>>::ObjectId: Unpin

impl<R> UnwindSafe for ActivateAbility<R> where
    <R as BattleRules>::AR: ActorRules<R>,
    <<R as BattleRules>::AR as ActorRules<R>>::Activation: UnwindSafe,
    <<R as BattleRules>::CR as CharacterRules<R>>::CreatureId: UnwindSafe,
    <<<R as BattleRules>::AR as ActorRules<R>>::Ability as Id>::Id: UnwindSafe,
    <<R as BattleRules>::CR as CharacterRules<R>>::ObjectId: 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>,