Skip to main content

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)]
6#[derive(Default)]
7pub enum Direction {
8    #[default]
9    Forward,
10    Backward,
11}
12
13
14/// Certain [`Warrior`](crate::warrior::Warrior) methods correlate to
15/// an `Action`. Each turn only one action can be taken. If an action
16/// is not successful, then the turn is wasted!
17#[derive(Clone, Copy, Debug, PartialEq)]
18pub enum Action {
19    /// walk forward one tile
20    Walk(Direction),
21    /// attack an enemy unit one tile away
22    Attack(Direction),
23    /// rest to regain 10% HP
24    Rest,
25    /// rescue a captive one tile away
26    Rescue(Direction),
27    /// rotate 180 degrees
28    Pivot(Direction),
29    /// fire an arrow up to three tiles
30    Shoot(Direction),
31}