1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//! actions the player can instruct the Warrior to take

/// Certain `Action`s are done one tile away, and must be done either
/// while facing forwards or backwards.
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum Direction {
    Forward,
    Backward,
}

impl Default for Direction {
    fn default() -> Direction {
        Direction::Forward
    }
}

/// Certain [`Warrior`](crate::warrior::Warrior) methods correlate to
/// an `Action`. Each turn only one action can be taken. If an action
/// is not successful, then the turn is wasted!
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum Action {
    /// walk forward one tile
    Walk(Direction),
    /// attack an enemy unit one tile away
    Attack(Direction),
    /// rest to regain 10% HP
    Rest,
    /// rescue a captive one tile away
    Rescue(Direction),
    /// rotate 180 degrees
    Pivot(Direction),
    /// fire an arrow up to three tiles
    Shoot(Direction),
}