pub struct SetRelations<R: BattleRules> { /* private fields */ }
Expand description
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§
Source§impl<R: BattleRules> SetRelations<R>
impl<R: BattleRules> SetRelations<R>
Trait Implementations§
Source§impl<R: BattleRules> Clone for SetRelations<R>
impl<R: BattleRules> Clone for SetRelations<R>
Source§impl<R: BattleRules> Debug for SetRelations<R>
impl<R: BattleRules> Debug for SetRelations<R>
Source§impl<'de, R: BattleRules> Deserialize<'de> for SetRelations<R>
impl<'de, R: BattleRules> Deserialize<'de> for SetRelations<R>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<R: BattleRules + 'static> Event<R> for SetRelations<R>
impl<R: BattleRules + 'static> Event<R> for SetRelations<R>
Auto Trait Implementations§
impl<R> Freeze for SetRelations<R>
impl<R> RefUnwindSafe for SetRelations<R>
impl<R> Send for SetRelations<R>
impl<R> Sync for SetRelations<R>
impl<R> Unpin for SetRelations<R>
impl<R> UnwindSafe for SetRelations<R>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more