pub struct ResetObjectives<R: BattleRules> { /* private fields */ }Expand description
Event to reset a team’s objectives.
Team’s Conclusion is resetted as well since the objectives changed.
§Examples
use weasel::{
battle_rules, rules::empty::*, Battle, BattleController, BattleRules, ConcludeObjectives,
Conclusion, CreateTeam, EventTrigger, ResetObjectives, 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();
ConcludeObjectives::trigger(&mut server, team_id, Conclusion::Victory)
.fire()
.unwrap();
ResetObjectives::trigger(&mut server, team_id).fire().unwrap();
assert_eq!(
server.battle().entities().team(&team_id).unwrap().conclusion(),
None
);Implementations§
Source§impl<R: BattleRules> ResetObjectives<R>
impl<R: BattleRules> ResetObjectives<R>
Sourcepub fn trigger<P: EventProcessor<R>>(
processor: &mut P,
id: TeamId<R>,
) -> ResetObjectivesTrigger<'_, R, P>
pub fn trigger<P: EventProcessor<R>>( processor: &mut P, id: TeamId<R>, ) -> ResetObjectivesTrigger<'_, R, P>
Returns a trigger for this event.
Sourcepub fn seed(&self) -> &Option<ObjectivesSeed<R>>
pub fn seed(&self) -> &Option<ObjectivesSeed<R>>
Returns the new seed.
Trait Implementations§
Source§impl<R: BattleRules> Clone for ResetObjectives<R>
impl<R: BattleRules> Clone for ResetObjectives<R>
Source§impl<R: BattleRules> Debug for ResetObjectives<R>
impl<R: BattleRules> Debug for ResetObjectives<R>
Source§impl<'de, R: BattleRules> Deserialize<'de> for ResetObjectives<R>
impl<'de, R: BattleRules> Deserialize<'de> for ResetObjectives<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 ResetObjectives<R>
impl<R: BattleRules + 'static> Event<R> for ResetObjectives<R>
Source§impl<R: BattleRules> Serialize for ResetObjectives<R>
impl<R: BattleRules> Serialize for ResetObjectives<R>
Auto Trait Implementations§
impl<R> Freeze for ResetObjectives<R>where
<<R as BattleRules>::TR as TeamRules<R>>::Id: Freeze,
<<R as BattleRules>::TR as TeamRules<R>>::ObjectivesSeed: Freeze,
impl<R> RefUnwindSafe for ResetObjectives<R>where
<<R as BattleRules>::TR as TeamRules<R>>::Id: RefUnwindSafe,
<<R as BattleRules>::TR as TeamRules<R>>::ObjectivesSeed: RefUnwindSafe,
impl<R> Send for ResetObjectives<R>
impl<R> Sync for ResetObjectives<R>where
<<R as BattleRules>::TR as TeamRules<R>>::Id: Sync,
<<R as BattleRules>::TR as TeamRules<R>>::ObjectivesSeed: Sync,
impl<R> Unpin for ResetObjectives<R>where
<<R as BattleRules>::TR as TeamRules<R>>::Id: Unpin,
<<R as BattleRules>::TR as TeamRules<R>>::ObjectivesSeed: Unpin,
impl<R> UnsafeUnpin for ResetObjectives<R>where
<<R as BattleRules>::TR as TeamRules<R>>::Id: UnsafeUnpin,
<<R as BattleRules>::TR as TeamRules<R>>::ObjectivesSeed: UnsafeUnpin,
impl<R> UnwindSafe for ResetObjectives<R>where
<<R as BattleRules>::TR as TeamRules<R>>::Id: UnwindSafe,
<<R as BattleRules>::TR as TeamRules<R>>::ObjectivesSeed: UnwindSafe,
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