rust_warrior/
actions.rs

1//! actions the player can instruct the Warrior to take
2
3/// Certain `Action`s are done one tile away, and must be done either
4/// while facing forwards or backwards.
5#[derive(Clone, Copy, Debug, PartialEq)]
6pub enum Direction {
7    Forward,
8    Backward,
9}
10
11impl Default for Direction {
12    fn default() -> Direction {
13        Direction::Forward
14    }
15}
16
17/// Certain [`Warrior`](crate::warrior::Warrior) methods correlate to
18/// an `Action`. Each turn only one action can be taken. If an action
19/// is not successful, then the turn is wasted!
20#[derive(Clone, Copy, Debug, PartialEq)]
21pub enum Action {
22    /// walk forward one tile
23    Walk(Direction),
24    /// attack an enemy unit one tile away
25    Attack(Direction),
26    /// rest to regain 10% HP
27    Rest,
28    /// rescue a captive one tile away
29    Rescue(Direction),
30    /// rotate 180 degrees
31    Pivot(Direction),
32    /// fire an arrow up to three tiles
33    Shoot(Direction),
34}