[][src]Struct weasel::creature::ConvertCreature

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

Event to move a creature from its current team to another one.

Examples

use weasel::{
    battle_rules, rules::empty::*, Actor, Battle, BattleController, BattleRules,
    ConvertCreature, CreateCreature, CreateTeam, EventTrigger, Server,
};

battle_rules! {}

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

let team_blue_id = 1;
let team_red_id = 2;
CreateTeam::trigger(&mut server, team_blue_id).fire().unwrap();
CreateTeam::trigger(&mut server, team_red_id).fire().unwrap();
let creature_id = 1;
let position = ();
CreateCreature::trigger(&mut server, creature_id, team_blue_id, position)
    .fire()
    .unwrap();

ConvertCreature::trigger(&mut server, creature_id, team_red_id).fire().unwrap();
assert_eq!(
    *server
        .battle()
        .entities()
        .creature(&creature_id)
        .unwrap()
        .team_id(),
    team_red_id
);

Implementations

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

pub fn trigger<P: EventProcessor<R>>(
    processor: &mut P,
    creature_id: CreatureId<R>,
    team_id: TeamId<R>
) -> ConvertCreatureTrigger<'_, R, P>
[src]

Returns a trigger for this event.

pub fn creature_id(&self) -> &CreatureId<R>[src]

Returns the id of the creature to be converted.

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

Returns the id of the team that this creature should join.

Trait Implementations

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

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

impl<'de, R: BattleRules> Deserialize<'de> for ConvertCreature<R> where
    CreatureId<R>: Deserialize<'de>,
    TeamId<R>: Deserialize<'de>, 
[src]

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

impl<R: BattleRules> Serialize for ConvertCreature<R> where
    CreatureId<R>: Serialize,
    TeamId<R>: Serialize
[src]

Auto Trait Implementations

impl<R> RefUnwindSafe for ConvertCreature<R> where
    <<R as BattleRules>::CR as CharacterRules<R>>::CreatureId: RefUnwindSafe,
    <<R as BattleRules>::TR as TeamRules<R>>::Id: RefUnwindSafe

impl<R> Send for ConvertCreature<R> where
    <<R as BattleRules>::CR as CharacterRules<R>>::CreatureId: Send,
    <<R as BattleRules>::TR as TeamRules<R>>::Id: Send

impl<R> Sync for ConvertCreature<R> where
    <<R as BattleRules>::CR as CharacterRules<R>>::CreatureId: Sync,
    <<R as BattleRules>::TR as TeamRules<R>>::Id: Sync

impl<R> Unpin for ConvertCreature<R> where
    <<R as BattleRules>::CR as CharacterRules<R>>::CreatureId: Unpin,
    <<R as BattleRules>::TR as TeamRules<R>>::Id: Unpin

impl<R> UnwindSafe for ConvertCreature<R> where
    <<R as BattleRules>::CR as CharacterRules<R>>::CreatureId: UnwindSafe,
    <<R as BattleRules>::TR as TeamRules<R>>::Id: 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>,