Warrior

Struct Warrior 

Source
pub struct Warrior { /* private fields */ }
Expand description

An interface the player can interact with to control the Warrior in the game. An instance is passed to Player via the play_turn method. The player must pick one Action to perform each turn. Not all abilities are an Action. Warrior abilities are unlocked as the player progresses through the levels.

§Level Guide

Level 1

Available abilities:

Level 2

New abilities unlocked at this level:

Level 3

New abilities unlocked at this level:

Level 4

No new abilities unlocked at this level!

Level 5

New abilities unlocked at this level:

Level 6

The following abilities now have a directional counterpart:

Level 7

New abilities unlocked at this level:

Level 8

New abilities (and directional counterparts) unlocked at this level:

Level 9

No new abilities unlocked at this level!

Implementations§

Source§

impl Warrior

Source

pub fn new( level: usize, ahead: Vec<Tile>, behind: Vec<Tile>, health: i32, facing: Direction, ) -> Warrior

Source

pub fn walk(&self)

Walk forward one tile. This is an Action. This ability is available at Level 1.

Source

pub fn walk_toward(&self, direction: Direction)

Walk one tile toward specified direction. This is an Action. This ability is unlocked at Level 6.

Source

pub fn check(&self) -> Tile

Check the tile in front of the Warrior. Returns a Tile. This ability is unlocked at Level 2.

Source

pub fn check_toward(&self, direction: Direction) -> Tile

Check the tile toward specified direction. Returns a Tile. This ability is unlocked at Level 6.

Source

pub fn look(&self) -> &Vec<Tile>

Check three tiles in front of the Warrior. Returns a vector of up to three Tiles. This ability is unlocked at Level 8.

Source

pub fn look_toward(&self, direction: Direction) -> &Vec<Tile>

Check three tiles toward specified direction. Returns a vector of up to three Tiles. This ability is unlocked at Level 8.

Source

pub fn attack(&self)

Attempt to attack an enemy in the tile in front of the Warrior. This is an Action. This ability is unlocked at Level 2.

Source

pub fn attack_toward(&self, direction: Direction)

Attempt to attack an enemy one tile away in specified direction. This is an Action. This ability is unlocked at Level 6.

Source

pub fn health(&self) -> i32

Check the current health of the Warrior. This ability is unlocked at Level 3.

Source

pub fn rest(&self)

Rest and regain 10% of the Warrior’s HP. This is an Action. This ability is unlocked at Level 3.

Source

pub fn rescue(&self)

Attempt to rescue a Captive in front of the Warrior. This is an Action. This ability is unlocked at Level 5.

Source

pub fn rescue_toward(&self, direction: Direction)

Attempt to rescue a Captive one tile away in specified direction. This is an Action. This ability is unlocked at Level 6.

Source

pub fn pivot(&self)

Rotate 180 degrees. This is an Action. This ability is unlocked at Level 7.

Source

pub fn shoot(&self)

Fire an arrow up to three tiles in front of the Warrior. This is an Action. This ability is unlocked at Level 8.

Source

pub fn shoot_toward(&self, direction: Direction)

Fire an arrow up to three tiles toward specified direction. This is an Action. This ability is unlocked at Level 8.

Source

pub fn action(&self) -> Option<Action>

Some Action the Warrior has performed; None if no action has been performed.

Source

pub fn warnings(&self) -> Vec<String>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.