[][src]Trait weasel::fight::FightRules

pub trait FightRules<R: BattleRules> {
    type Impact: Clone + Debug + Send + Serialize + for<'a> Deserialize<'a>;
    type Potency: Clone + Debug + Send + Serialize + for<'a> Deserialize<'a>;
    fn apply_impact(
        &self,
        _state: &BattleState<R>,
        _impact: &Self::Impact,
        _event_queue: &mut Option<EventQueue<R>>,
        _entropy: &mut Entropy<R>,
        _metrics: &mut WriteMetrics<'_, R>
    ) { ... }
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>
    ) { ... }
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 { ... }
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>
    ) { ... } }

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.

Loading content...

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>
)

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>
)

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

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>
)

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.

Loading content...

Implementors

impl<R: BattleRules> FightRules<R> for EmptyFightRules[src]

type Impact = ()

type Potency = ()

Loading content...