[−][src]Trait weasel::fight::FightRules
Rules to determine how combat works. They manage the damage dealt, accuracy of attacks and, more in general, how to apply consequences of abilities.
Associated Types
type Impact: Clone + Debug + Send + Serialize + for<'a> Deserialize<'a>
See Impact.
type Potency: Clone + Debug + Send + Serialize + for<'a> Deserialize<'a>
See Potency.
Provided methods
fn apply_impact(
&self,
_state: &BattleState<R>,
_impact: &Self::Impact,
_event_queue: &mut Option<EventQueue<R>>,
_entropy: &mut Entropy<R>,
_metrics: &mut WriteMetrics<'_, R>
)
&self,
_state: &BattleState<R>,
_impact: &Self::Impact,
_event_queue: &mut Option<EventQueue<R>>,
_entropy: &mut Entropy<R>,
_metrics: &mut WriteMetrics<'_, R>
)
Takes an impact and generates one or more events to change the state of creatures or other objects.
The provided implementation does nothing.
fn apply_status(
&self,
_state: &BattleState<R>,
_character: &dyn Character<R>,
_application: Application<'_, R>,
_event_queue: &mut Option<EventQueue<R>>,
_entropy: &mut Entropy<R>,
_metrics: &mut WriteMetrics<'_, R>
)
&self,
_state: &BattleState<R>,
_character: &dyn Character<R>,
_application: Application<'_, R>,
_event_queue: &mut Option<EventQueue<R>>,
_entropy: &mut Entropy<R>,
_metrics: &mut WriteMetrics<'_, R>
)
Applies the side effects of a status when it's inflicted upon a character.
application
contains the context in which the status was created.
The status is automatically added to the character before the call to this method.
The provided implementation does nothing.
fn update_status(
&self,
_state: &BattleState<R>,
_character: &dyn Character<R>,
_status: &AppliedStatus<R>,
_linked_queue: &mut Option<LinkedQueue<'_, R>>,
_entropy: &mut Entropy<R>,
_metrics: &mut WriteMetrics<'_, R>
) -> bool
&self,
_state: &BattleState<R>,
_character: &dyn Character<R>,
_status: &AppliedStatus<R>,
_linked_queue: &mut Option<LinkedQueue<'_, R>>,
_entropy: &mut Entropy<R>,
_metrics: &mut WriteMetrics<'_, R>
) -> bool
Applies the periodic side effects of a status.
Returns true
if the status should end after this update.
For actors: status updates happen at the start of their turn.
For non-actor characters: status updates happen when the event EnvironmentTurn
is fired.
The provided implementation does nothing and it never ends any status.
fn delete_status(
&self,
_state: &BattleState<R>,
_character: &dyn Character<R>,
_status: &AppliedStatus<R>,
_event_queue: &mut Option<EventQueue<R>>,
_entropy: &mut Entropy<R>,
_metrics: &mut WriteMetrics<'_, R>
)
&self,
_state: &BattleState<R>,
_character: &dyn Character<R>,
_status: &AppliedStatus<R>,
_event_queue: &mut Option<EventQueue<R>>,
_entropy: &mut Entropy<R>,
_metrics: &mut WriteMetrics<'_, R>
)
Removes the side effects of a status when the latter is removed from a character.
The character is guaranteed to be affected by status
.
The status will be automatically dropped immediately after this method.
The provided implementation does nothing.