[][src]Struct weasel::creature::CreateCreature

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

Event to create a new creature.

Examples

use weasel::{
    battle_rules, rules::empty::*, Battle, BattleController, BattleRules, CreateCreature,
    CreateTeam, EventTrigger, 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 creature_id = 1;
let position = ();
CreateCreature::trigger(&mut server, creature_id, team_id, position)
    .fire()
    .unwrap();
assert_eq!(server.battle().entities().creatures().count(), 1);

Implementations

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

pub fn trigger<'a, P: EventProcessor<R>>(
    processor: &'a mut P,
    id: CreatureId<R>,
    team_id: TeamId<R>,
    position: Position<R>
) -> CreateCreatureTrigger<'a, R, P>
[src]

Returns a trigger for this event.

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

Returns the id of the creature to be created.

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

Returns the team id of the creature to be created.

pub fn position(&self) -> &Position<R>[src]

Returns the position that the creature will take.

pub fn statistics_seed(&self) -> &Option<StatisticsSeed<R>>[src]

Returns the seed to generate the creature's statistics.

pub fn abilities_seed(&self) -> &Option<AbilitiesSeed<R>>[src]

Returns the seed to generate the creature's abilities.

Trait Implementations

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

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

impl<'de, R: BattleRules> Deserialize<'de> for CreateCreature<R> where
    CreatureId<R>: Deserialize<'de>,
    TeamId<R>: Deserialize<'de>,
    Position<R>: Deserialize<'de>,
    Option<StatisticsSeed<R>>: Deserialize<'de>,
    Option<AbilitiesSeed<R>>: Deserialize<'de>, 
[src]

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

impl<R: BattleRules> Serialize for CreateCreature<R> where
    CreatureId<R>: Serialize,
    TeamId<R>: Serialize,
    Position<R>: Serialize,
    Option<StatisticsSeed<R>>: Serialize,
    Option<AbilitiesSeed<R>>: Serialize
[src]

Auto Trait Implementations

impl<R> RefUnwindSafe for CreateCreature<R> where
    <R as BattleRules>::AR: ActorRules<R>,
    <<R as BattleRules>::AR as ActorRules<R>>::AbilitiesSeed: RefUnwindSafe,
    <R as BattleRules>::CR: CharacterRules<R>,
    <<R as BattleRules>::CR as CharacterRules<R>>::CreatureId: RefUnwindSafe,
    <<R as BattleRules>::TR as TeamRules<R>>::Id: RefUnwindSafe,
    <<R as BattleRules>::SR as SpaceRules<R>>::Position: RefUnwindSafe,
    <<R as BattleRules>::CR as CharacterRules<R>>::StatisticsSeed: RefUnwindSafe

impl<R> Send for CreateCreature<R> where
    <R as BattleRules>::AR: ActorRules<R>,
    <<R as BattleRules>::AR as ActorRules<R>>::AbilitiesSeed: Send,
    <R as BattleRules>::CR: CharacterRules<R>,
    <<R as BattleRules>::CR as CharacterRules<R>>::CreatureId: Send,
    <<R as BattleRules>::TR as TeamRules<R>>::Id: Send,
    <<R as BattleRules>::SR as SpaceRules<R>>::Position: Send,
    <<R as BattleRules>::CR as CharacterRules<R>>::StatisticsSeed: Send

impl<R> Sync for CreateCreature<R> where
    <R as BattleRules>::AR: ActorRules<R>,
    <<R as BattleRules>::AR as ActorRules<R>>::AbilitiesSeed: Sync,
    <R as BattleRules>::CR: CharacterRules<R>,
    <<R as BattleRules>::CR as CharacterRules<R>>::CreatureId: Sync,
    <<R as BattleRules>::TR as TeamRules<R>>::Id: Sync,
    <<R as BattleRules>::SR as SpaceRules<R>>::Position: Sync,
    <<R as BattleRules>::CR as CharacterRules<R>>::StatisticsSeed: Sync

impl<R> Unpin for CreateCreature<R> where
    <R as BattleRules>::AR: ActorRules<R>,
    <<R as BattleRules>::AR as ActorRules<R>>::AbilitiesSeed: Unpin,
    <R as BattleRules>::CR: CharacterRules<R>,
    <<R as BattleRules>::CR as CharacterRules<R>>::CreatureId: Unpin,
    <<R as BattleRules>::TR as TeamRules<R>>::Id: Unpin,
    <<R as BattleRules>::SR as SpaceRules<R>>::Position: Unpin,
    <<R as BattleRules>::CR as CharacterRules<R>>::StatisticsSeed: Unpin

impl<R> UnwindSafe for CreateCreature<R> where
    <R as BattleRules>::AR: ActorRules<R>,
    <<R as BattleRules>::AR as ActorRules<R>>::AbilitiesSeed: UnwindSafe,
    <R as BattleRules>::CR: CharacterRules<R>,
    <<R as BattleRules>::CR as CharacterRules<R>>::CreatureId: UnwindSafe,
    <<R as BattleRules>::TR as TeamRules<R>>::Id: UnwindSafe,
    <<R as BattleRules>::SR as SpaceRules<R>>::Position: UnwindSafe,
    <<R as BattleRules>::CR as CharacterRules<R>>::StatisticsSeed: 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>,