[−][src]Struct weasel::team::SetRelations
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]
processor: &'a mut P,
relations: &[(TeamId<R>, TeamId<R>, Relation)]
) -> SetRelationsTrigger<'a, R, P>
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]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[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]
Vec<(TeamId<R>, TeamId<R>, Relation)>: Deserialize<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl<R: BattleRules + 'static> Event<R> for SetRelations<R>
[src]
fn verify(&self, battle: &Battle<R>) -> WeaselResult<(), R>
[src]
fn apply(&self, battle: &mut Battle<R>, _: &mut Option<EventQueue<R>>)
[src]
fn kind(&self) -> EventKind
[src]
fn box_clone(&self) -> Box<dyn Event<R> + Send>
[src]
fn as_any(&self) -> &dyn Any
[src]
fn rights<'a>(&'a self, _battle: &'a Battle<R>) -> EventRights<'a, R>
[src]
impl<R: BattleRules> Serialize for SetRelations<R> where
Vec<(TeamId<R>, TeamId<R>, Relation)>: Serialize,
[src]
Vec<(TeamId<R>, TeamId<R>, Relation)>: Serialize,
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>,
<<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>,
<<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>,
<<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>,
<<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>,
<<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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,