[][src]Struct weasel::team::SetRelations

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

Event to set diplomatic relations between teams. Relations are symmetric.

Examples

use weasel::{
    battle_rules, rules::empty::*, Battle, BattleController, BattleRules, CreateTeam,
    EventTrigger, Relation, Server, SetRelations,
};

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();

SetRelations::trigger(&mut server, &[(team_blue_id, team_red_id, Relation::Ally)])
    .fire()
    .unwrap();
assert_eq!(
    server.battle().entities().relation(&team_blue_id, &team_red_id),
    Some(Relation::Ally)
);

Implementations

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

pub fn trigger<'a, P: EventProcessor<R>>(
    processor: &'a mut P,
    relations: &[(TeamId<R>, TeamId<R>, Relation)]
) -> SetRelationsTrigger<'a, R, P>
[src]

Returns a trigger for this event.

pub fn relations(&self) -> &Vec<(TeamId<R>, TeamId<R>, Relation)>[src]

Returns all relation changes.

Trait Implementations

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

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

impl<'de, R: BattleRules> Deserialize<'de> for SetRelations<R> where
    Vec<(TeamId<R>, TeamId<R>, Relation)>: Deserialize<'de>, 
[src]

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

impl<R: BattleRules> Serialize for SetRelations<R> where
    Vec<(TeamId<R>, TeamId<R>, Relation)>: Serialize
[src]

Auto Trait Implementations

impl<R> RefUnwindSafe for SetRelations<R> where
    <<R as BattleRules>::TR as TeamRules<R>>::Id: RefUnwindSafe,
    <R as BattleRules>::TR: TeamRules<R>, 

impl<R> Send for SetRelations<R> where
    <<R as BattleRules>::TR as TeamRules<R>>::Id: Send,
    <R as BattleRules>::TR: TeamRules<R>, 

impl<R> Sync for SetRelations<R> where
    <<R as BattleRules>::TR as TeamRules<R>>::Id: Sync,
    <R as BattleRules>::TR: TeamRules<R>, 

impl<R> Unpin for SetRelations<R> where
    <<R as BattleRules>::TR as TeamRules<R>>::Id: Unpin,
    <R as BattleRules>::TR: TeamRules<R>, 

impl<R> UnwindSafe for SetRelations<R> where
    <<R as BattleRules>::TR as TeamRules<R>>::Id: UnwindSafe,
    <R as BattleRules>::TR: TeamRules<R>, 

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>,