[−][src]Struct cellwars::Cell
A cell in the game
Implementations
impl Cell
[src]
pub fn cell_id(&self) -> u32
[src]
Gets an unique identifier for this cell. The identifier will not change for a given cell for the duration of each match.
pub fn position(&self) -> &Position
[src]
Gets the position of this cell.
pub fn health(&self) -> u32
[src]
Gets the health of this cell. This is typically a number between 1 and 100.
pub fn team_id(&self) -> u32
[src]
Gets this cell's team identifier.
pub fn age(&self) -> u32
[src]
Gets the cell's age. Every time a new chunk of cells spawn, all new cells will have an age of 0 and all of the existing cell's ages will be incremented by 1.
pub fn is_enemy(&self) -> bool
[src]
Indicates if this cell belongs to the enemy. This is a shorthand for checking if the team_id is different from yours.
pub fn can_move_to_position(&self, position: &Position) -> bool
[src]
pub fn can_move_in_direction(&self, direction: &Direction) -> bool
[src]
pub fn can_attack_position(&self, position: &Position) -> bool
[src]
pub fn can_attack_cell(&self, cell: &Cell) -> bool
[src]
Indicates if the cell can attack the given cell.
Note that this is purely a proximity check. e.g. this does not take into account whether the cell is an enemy.
Arguments
cell
- the target cell.
pub fn attack_cell(&self, cell: &Cell)
[src]
Instructs this cell to attack the given cell.
See the documentation on the restrictions on attacking too-far-away positions.
Arguments
cell
- the cell to be attacked.
pub fn attack_position(&self, position: &Position)
[src]
Instructs this cell to attack the given position.
See the documentation on the restrictions on attacking too-far-away positions.
Arguments
position
- the position to be attacked.
pub fn move_to_position(&self, position: &Position)
[src]
Instructs this cell to move into the given position.
See the documentation on the restrictions on moving into too-far-away positions and movement conflicts.
Arguments
position
- the position to move into.
pub fn move_in_direction(&self, direction: &Direction)
[src]
Instructs this cell to move into the given direction.
See the documentation on movement conflicts.
Arguments
direction
- the direction to move into.
pub fn explode(&self)
[src]
Instructs this cell to explode.
This will cause your cell to die and cause damage to all surrounding cells.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Cell
impl Send for Cell
impl Sync for Cell
impl Unpin for Cell
impl UnwindSafe for Cell
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,