[][src]Struct rust_warrior::warrior::Warrior

pub struct Warrior { /* fields omitted */ }

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:

  • walk

Level 2

New abilities unlocked at this level:

  • check
  • attack

Level 3

New abilities unlocked at this level:

  • health
  • rest

Level 4

No new abilities unlocked at this level!

Level 5

New abilities unlocked at this level:

  • rescue

Level 6

The following abilities now have a directional counterpart:

  • walk -> walk_toward
  • check -> check_toward
  • attack -> attack_toward
  • rescue -> rescue_toward

Level 7

New abilities unlocked at this level:

  • pivot

Level 8

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

  • look -> look_toward
  • shoot -> shoot_toward

Level 9

No new abilities unlocked at this level!

Methods

impl Warrior[src]

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

pub fn walk(&self)[src]

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

pub fn walk_toward(&self, direction: Direction)[src]

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

pub fn check(&self) -> Tile[src]

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

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

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

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

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

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

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

pub fn attack(&self)[src]

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

pub fn attack_toward(&self, direction: Direction)[src]

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

pub fn health(&self) -> i32[src]

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

pub fn rest(&self)[src]

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

pub fn rescue(&self)[src]

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

pub fn rescue_toward(&self, direction: Direction)[src]

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

pub fn pivot(&self)[src]

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

pub fn shoot(&self)[src]

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

pub fn shoot_toward(&self, direction: Direction)[src]

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

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

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

Auto Trait Implementations

impl !RefUnwindSafe for Warrior

impl Send for Warrior

impl !Sync for Warrior

impl Unpin for Warrior

impl UnwindSafe for Warrior

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Any for T where
    T: Any

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Event for T where
    T: Send + Sync + 'static, 

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Resource for T where
    T: Any + Send + Sync

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = !

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.