Basic attacking unit.
More...
#include <common.hpp>
|
| Ant (int id, int player, int x, int y, int hp, int level, int age, AntState state) |
| Construct a new ant with given information.
|
|
void | move (int direction) |
| Move the ant in a specified direction.
|
|
int | max_hp () const |
| HP limit of this ant.
|
|
int | reward () const |
| Reward for killing this ant.
|
|
bool | is_alive () const |
| Check if the ant is alive, including states AntState::Alive and AntState::Frozen.
|
|
bool | is_in_range (int x, int y, int range) const |
| Check if the ant stays in a circle with given point as the center.
|
|
bool | is_attackable_from (int player, int x, int y, int range) const |
| Check if the ant is attackable by a player from given position and range.
|
|
|
int | id |
|
int | player |
|
int | x |
|
int | y |
|
int | hp |
|
int | level |
|
int | age |
|
AntState | state |
|
std::vector< int > | path |
|
int | evasion |
|
bool | deflector |
|
|
static constexpr int | AGE_LIMIT = 32 |
|
static constexpr int | MAX_HP_INFO [] = {10, 25, 50} |
|
static constexpr int | REWARD_INFO [] = {3, 5, 7} |
|
◆ is_alive()
bool Ant::is_alive |
( |
| ) |
const |
|
inline |
Check if the ant is alive, including states AntState::Alive and AntState::Frozen.
- Returns
- Whether the ant is alive.
◆ is_attackable_from()
bool Ant::is_attackable_from |
( |
int |
player, |
|
|
int |
x, |
|
|
int |
y, |
|
|
int |
range |
|
) |
| const |
|
inline |
Check if the ant is attackable by a player from given position and range.
- Parameters
-
x | The x-coordinate of the center point. |
y | The y-coordinate of the center point. |
range | The radius of the |
- Returns
- Whether the ant is attackable.
◆ is_in_range()
bool Ant::is_in_range |
( |
int |
x, |
|
|
int |
y, |
|
|
int |
range |
|
) |
| const |
|
inline |
Check if the ant stays in a circle with given point as the center.
- Parameters
-
x | The x-coordinate of the center point. |
y | The y-coordinate of the center point. |
range | The radius of the circle. |
- Returns
- Whether the ant stays in the area.
◆ move()
void Ant::move |
( |
int |
direction | ) |
|
|
inline |
Move the ant in a specified direction.
- Parameters
-
direction | Index of the direction. |
The documentation for this struct was generated from the following file: