|
LI2 Roguelite
|
#include <stdlib.h>#include <ncurses.h>#include "monster.h"#include "state.h"#include "map.h"#include "cell.h"#include "item.h"#include "combat.h"#include "menu.h"
Functions | |
| 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... | |
| Monster * | initRat (int x, int y, int index) |
| Initialize a new monster: rat. More... | |
| Monster * | initGoblin (int x, int y, int index) |
| Initialize a new monster: goblin. More... | |
| Monster * | initOrc (int x, int y, int index) |
| Initialize a new monster: orc. More... | |
| Monster * | initTroll (int x, int y, int index) |
| Initialize a new monster: troll. More... | |
| Monster * | initDragon (int x, int y, int index) |
| Initialize a new monster: dragon. More... | |
| void | drawMonster (State *st, Monster *monster, int mode) |
| Draw the monster on the map. More... | |
| void | drawMonsters (State *st) |
| Draw all the monsters on the map. More... | |
| void | moveMonster (State *st, Monster *monster, int x, int y) |
| Move the monster to the given coordinates. More... | |
| void | moveMonsterRandom (State *st, Monster *monster) |
| Move the monster randomly. More... | |
| void | monsterPathfinding (State *st, Monster *monster) |
| Pathfinding algorithm to find the shortest path to the player. More... | |
| void | monsterPathfindingAway (State *st, Monster *monster) |
| Pathfinding algorithm to find the furthest path to the player. More... | |
| Monster * | generateMonster (Map *map, int index) |
| Generate one monster randomly. More... | |
| Monster ** | generateMonsters (Map *map) |
| Generate monsters array randomly. More... | |
| void | moveMonsters (State *st, Monster **monsters, int nMonsters) |
| Move all the monsters. More... | |
| void | freeMonster (void *p) |
| Free the monster. More... | |
Draw the monster on the map.
| st | The game state |
| monster | Monster to draw |
| mode | The game mode draw monsters in (VISION_MODE, NORMAL_MODE, DISTANCE_MODE) |
| void drawMonsters | ( | State * | st | ) |
Draw all the monsters on the map.
| st | The game state |
| void freeMonster | ( | void * | p | ) |
Free the monster.
| p | a pointer to the Monster to free |
Generate one monster randomly.
Same probability for each monster type.
| map | The game map |
| index | Monster index relative to the monsters array |
Generate monsters array randomly.
| map | The game map |
| Monster* initDragon | ( | int | x, |
| int | y, | ||
| int | index | ||
| ) |
Initialize a new monster: dragon.
| x | Starting x coordinate |
| y | Starting y coordinate |
| index | Monster index relative to the monsters array |
| Monster* initGoblin | ( | int | x, |
| int | y, | ||
| int | index | ||
| ) |
Initialize a new monster: goblin.
| x | Starting x coordinate |
| y | Starting y coordinate |
| index | Monster index relative to the monsters array |
| 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.
| 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) |
| Monster* initOrc | ( | int | x, |
| int | y, | ||
| int | index | ||
| ) |
Initialize a new monster: orc.
| x | Starting x coordinate |
| y | Starting y coordinate |
| index | Monster index relative to the monsters array |
| Monster* initRat | ( | int | x, |
| int | y, | ||
| int | index | ||
| ) |
Initialize a new monster: rat.
| x | Starting x coordinate |
| y | Starting y coordinate |
| index | Monster index relative to the monsters array |
| Monster* initTroll | ( | int | x, |
| int | y, | ||
| int | index | ||
| ) |
Initialize a new monster: troll.
| x | Starting x coordinate |
| y | Starting y coordinate |
| index | Monster index relative to the monsters array |
Pathfinding algorithm to find the shortest path to the player.
Calculates the path if any else return a message to the menu. Moves the monster to the cell in the path with the lowest distance to the player.
| st | The game state |
| monster | The monster to move |
Pathfinding algorithm to find the furthest path to the player.
Checks the distance field of the cells around the monster and moves to the cell with the highest distance to the player.
| st | The game state |
| monster | The monster to move |
Move the monster to the given coordinates.
Update the monster's coordinates and the cell's monster_index
| 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 |
Move the monster randomly.
Checks the available walkable cells around the monster and moves the monster randomly to one of them.
| st | The game state |
| monster | The monster to move randomly |