Go to the source code of this file.
|
| Monster * | initMonster (int x, int y, int health, int attack, int defense, char symbol, char *name, int color, int pathfinding, int gold, const char *noise, int index) |
| | Initialize a new monster. More...
|
| |
| void | moveMonster (State *st, Monster *monster, int x, int y) |
| | Move the monster to the given coordinates. More...
|
| |
| void | drawMonsters (State *st) |
| | Draw all the monsters on the map. More...
|
| |
| void | freeMonster (void *p) |
| | Free the monster. More...
|
| |
| Monster ** | generateMonsters (Map *map) |
| | Generate monsters array randomly. More...
|
| |
| void | moveMonsters (State *st, Monster **monsters, int nMonsters) |
| | Move all the monsters. More...
|
| |
◆ DRAGON_ATTACK
◆ DRAGON_COLOR
| #define DRAGON_COLOR COLOR_BLUE |
◆ DRAGON_DEFENSE
| #define DRAGON_DEFENSE 50 |
◆ DRAGON_GOLD_MAX
| #define DRAGON_GOLD_MAX 5 |
◆ DRAGON_GOLD_MIN
| #define DRAGON_GOLD_MIN 4 |
◆ DRAGON_HEALTH
◆ DRAGON_NOISE
| #define DRAGON_NOISE "roars and growls" |
◆ DRAGON_SYMBOL
| #define DRAGON_SYMBOL 'd' |
◆ GOBLIN_ATTACK
◆ GOBLIN_COLOR
| #define GOBLIN_COLOR COLOR_MAGENTA |
◆ GOBLIN_DEFENSE
| #define GOBLIN_DEFENSE 10 |
◆ GOBLIN_GOLD_MAX
| #define GOBLIN_GOLD_MAX 3 |
◆ GOBLIN_GOLD_MIN
| #define GOBLIN_GOLD_MIN 1 |
◆ GOBLIN_HEALTH
◆ GOBLIN_NOISE
| #define GOBLIN_NOISE "robbing noises" |
◆ GOBLIN_SYMBOL
| #define GOBLIN_SYMBOL 'g' |
◆ NUMBER_OF_MONSTERS
| #define NUMBER_OF_MONSTERS 5 |
◆ ORC_ATTACK
◆ ORC_COLOR
| #define ORC_COLOR COLOR_RED |
◆ ORC_DEFENSE
◆ ORC_GOLD_MAX
◆ ORC_GOLD_MIN
◆ ORC_HEALTH
◆ ORC_NOISE
| #define ORC_NOISE "grunts and growls" |
◆ ORC_SYMBOL
◆ PATHFINDING_AWAY_FROM_PLAYER
| #define PATHFINDING_AWAY_FROM_PLAYER 3 |
◆ PATHFINDING_RANDOM
| #define PATHFINDING_RANDOM 0 |
◆ PATHFINDING_RECRUITING
| #define PATHFINDING_RECRUITING 4 |
◆ PATHFINDING_SEARCHING
| #define PATHFINDING_SEARCHING 1 |
◆ PATHFINDING_TOWARDS_PLAYER
| #define PATHFINDING_TOWARDS_PLAYER 2 |
◆ RAT_ATTACK
◆ RAT_COLOR
| #define RAT_COLOR COLOR_GREEN |
◆ RAT_DEFENSE
◆ RAT_GOLD_MAX
◆ RAT_GOLD_MIN
◆ RAT_HEALTH
◆ RAT_NOISE
| #define RAT_NOISE "squeaks and sniffles" |
◆ RAT_SYMBOL
◆ TROLL_ATTACK
◆ TROLL_COLOR
| #define TROLL_COLOR COLOR_YELLOW |
◆ TROLL_DEFENSE
◆ TROLL_GOLD_MAX
◆ TROLL_GOLD_MIN
◆ TROLL_HEALTH
◆ TROLL_NOISE
| #define TROLL_NOISE "laughs and grunts" |
◆ TROLL_SYMBOL
◆ Map
◆ Monster
Structure of a monster.
Contains the monster's position, attributes, name, symbol and index.
- Parameters
-
| x | Monster x coordinate |
| y | Monster y coordinate |
| health | Monster current hit points |
| max_health | Monster maximum hit points |
| attack | Monster attack points |
| defense | Monster defense points |
| is_alive | Is the Monster is alive? |
| symbol | Monster symbol |
| name | Monster name |
| color | The current color of the monster is affected by bombs |
| default_color | The default color of the monster |
| pathfinding | pathfinding type of the Monster |
| gold | Monster gold value when killed |
| noise | Monster noise |
| index | Monster index in the monsters array also stored in the cell (used as a pointer) |
◆ State
◆ drawMonsters()
| void drawMonsters |
( |
State * |
st | ) |
|
Draw all the monsters on the map.
- Parameters
-
◆ freeMonster()
| void freeMonster |
( |
void * |
p | ) |
|
Free the monster.
- Parameters
-
| p | a pointer to the Monster to free |
- Returns
- void
◆ generateMonsters()
Generate monsters array randomly.
- Parameters
-
- Returns
- Monster** The monsters array with NUMBER_OF_MONSTERS monsters
◆ initMonster()
| Monster* initMonster |
( |
int |
x, |
|
|
int |
y, |
|
|
int |
health, |
|
|
int |
attack, |
|
|
int |
defense, |
|
|
char |
symbol, |
|
|
char * |
name, |
|
|
int |
color, |
|
|
int |
pathfinding, |
|
|
int |
gold, |
|
|
const char * |
noise, |
|
|
int |
index |
|
) |
| |
Initialize a new monster.
- Parameters
-
| x | Monster x coordinate |
| y | Monster y coordinate |
| health | Monster health points |
| attack | Monster attack points |
| defense | Monster defense points |
| symbol | Monster symbol |
| name | Monster name |
| color | Monster color |
| pathfinding | Monster pathfinding type |
| gold | Monster gold value when killed |
| noise | Monster noise |
| index | Monster index in the monsters array also stored in the cell (used as a pointer) |
- Returns
- Monster*
◆ moveMonster()
| void moveMonster |
( |
State * |
st, |
|
|
Monster * |
monster, |
|
|
int |
x, |
|
|
int |
y |
|
) |
| |
Move the monster to the given coordinates.
Update the monster's coordinates and the cell's monster_index
- Parameters
-
| st | The game state |
| monster | The monster to move |
| x | X coordinates to move the monster to |
| y | Y coordinates to move the monster to |
◆ moveMonsters()
| void moveMonsters |
( |
State * |
st, |
|
|
Monster ** |
monsters, |
|
|
int |
nMonsters |
|
) |
| |
Move all the monsters.
Monster movements vary depending on the monster pathfinding type and the map obstacles.
- Parameters
-
| st | The game state |
| monsters | The monsters array |
| nMonsters | The number of monsters |
- Returns
- void