Struct rust_warrior::warrior::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:
walk->walk_towardcheck->check_towardattack->attack_towardrescue->rescue_toward
Level 7
New abilities unlocked at this level:
Level 8
New abilities (and directional counterparts) unlocked at this level:
look->look_towardshoot->shoot_toward
Level 9
No new abilities unlocked at this level!
Implementations
sourceimpl Warrior
impl Warrior
pub fn new(
level: usize,
ahead: Vec<Tile>,
behind: Vec<Tile>,
health: i32,
facing: Direction
) -> Warrior
sourcepub fn walk(&self)
pub fn walk(&self)
Walk forward one tile.
This is an Action.
This ability is available at Level 1.
sourcepub fn walk_toward(&self, direction: Direction)
pub fn walk_toward(&self, direction: Direction)
Walk one tile toward specified direction.
This is an Action.
This ability is unlocked at Level 6.
sourcepub fn check(&self) -> Tile
pub fn check(&self) -> Tile
Check the tile in front of the Warrior.
Returns a Tile.
This ability is unlocked at Level 2.
sourcepub fn check_toward(&self, direction: Direction) -> Tile
pub fn check_toward(&self, direction: Direction) -> Tile
Check the tile toward specified direction.
Returns a Tile.
This ability is unlocked at Level 6.
sourcepub fn look(&self) -> &Vec<Tile>
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.
sourcepub fn look_toward(&self, direction: Direction) -> &Vec<Tile>
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.
sourcepub fn attack(&self)
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.
sourcepub fn attack_toward(&self, direction: Direction)
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.
sourcepub fn health(&self) -> i32
pub fn health(&self) -> i32
Check the current health of the Warrior. This ability is unlocked at Level 3.
sourcepub fn rest(&self)
pub fn rest(&self)
Rest and regain 10% of the Warrior’s HP.
This is an Action.
This ability is unlocked at Level 3.
sourcepub fn rescue(&self)
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.
sourcepub fn rescue_toward(&self, direction: Direction)
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.
sourcepub fn pivot(&self)
pub fn pivot(&self)
Rotate 180 degrees.
This is an Action.
This ability is unlocked at Level 7.
sourcepub fn shoot(&self)
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.
sourcepub fn shoot_toward(&self, direction: Direction)
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.
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more