[−][src]Trait weasel::event::Event
An event is the only mean to apply a change to the world.
Required methods
fn verify(&self, battle: &Battle<R>) -> WeaselResult<(), R>
Verifies if this event can be applied to the world.
fn apply(&self, battle: &mut Battle<R>, queue: &mut Option<EventQueue<R>>)
Applies this event to the world. This method is called only if verify
succeeded.
If there's a failure inside this method, it immediately panic because we can't guarantee any consistency in the state of the world.
Events generated by this event are stored into queue
, if there's one.
Noe that they will keep a link with the original event.
fn kind(&self) -> EventKind
Returns the kind of this event.
fn box_clone(&self) -> Box<dyn Event<R> + Send>
Clones this event as a trait object.
fn as_any(&self) -> &dyn Any
Returns an Any
reference this event.
Provided methods
fn rights<'a>(&'a self, _battle: &'a Battle<R>) -> EventRights<'a, R>
Returns the access rights required by this event.
The provided implementation returns EventRights::Server
.
Implementors
impl<R: BattleRules + 'static> Event<R> for ActivateAbility<R>
[src]
fn verify(&self, battle: &Battle<R>) -> WeaselResult<(), R>
[src]
fn apply(&self, battle: &mut Battle<R>, event_queue: &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 + 'static> Event<R> for AlterAbilities<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]
impl<R: BattleRules + 'static> Event<R> for RegenerateAbilities<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]
impl<R: BattleRules + 'static> Event<R> for EndBattle<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]
impl<R: BattleRules + 'static> Event<R> for AlterStatistics<R>
[src]
fn verify(&self, battle: &Battle<R>) -> WeaselResult<(), R>
[src]
fn apply(&self, battle: &mut Battle<R>, event_queue: &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]
impl<R: BattleRules + 'static> Event<R> for RegenerateStatistics<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]
impl<R: BattleRules + 'static> Event<R> for ConvertCreature<R>
[src]
fn verify(&self, battle: &Battle<R>) -> WeaselResult<(), R>
[src]
fn apply(
&self,
battle: &mut Battle<R>,
_event_queue: &mut Option<EventQueue<R>>
)
[src]
&self,
battle: &mut Battle<R>,
_event_queue: &mut Option<EventQueue<R>>
)