Ludum Dare 29
HackSoc's entry for the Ludum Dare Jam 29
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
mob.h
Go to the documentation of this file.
1 #ifndef MOB_H
2 #define MOB_H
3 
4 struct Item;
5 struct Level;
6 
7 #include "item.h"
8 #include "level.h"
9 #include "utils.h"
10 #include "list.h"
11 
18 typedef struct Mob {
21  struct Level * level;
22  unsigned int xpos;
23  unsigned int ypos;
25  char symbol;
26  int colour;
27  bool is_bold;
30  struct Item * weapon;
31  struct Item * offhand;
32  struct Item * armour;
34  void (*turn_action)(struct Mob *);
35  void (*death_action)(struct Mob *);
38  void (*effect_action)(struct Mob *);
40  bool hostile;
42  char* name;
43  char* race;
44  char* profession;
45  int score;
47  unsigned int attack;
49  int health;
50  unsigned int max_health;
52  bool darksight;
53  unsigned int luminosity;
55  void * data;
56 } Mob;
57 
58 bool move_mob(struct Mob * mob, unsigned int x, unsigned int y);
59 bool move_mob_relative(struct Mob * mob, int xdiff, int ydiff);
60 bool move_mob_level(Mob * mob, bool toprev);
61 bool damage_mob(struct Mob * mob, unsigned int amount);
62 void attack_mob(Mob * attacker, Mob * defender);
63 struct Mob * kill_mob(struct Mob * mob);
64 bool can_see_point(struct Level * level,
65  unsigned int x0, unsigned int y0,
66  unsigned int x, unsigned int y);
67 bool can_see(struct Mob * mob, unsigned int x, unsigned int y);
68 bool can_see_other(struct Mob * moba, struct Mob * mobb);
69 void simple_enemy_turn(Mob * enemy);
70 
71 #endif /*MOB_H*/
bool can_see(struct Mob *mob, unsigned int x, unsigned int y)
Definition: mob.c:184
Definition: mob.h:18
void(* turn_action)(struct Mob *)
Definition: mob.h:34
bool can_see_point(struct Level *level, unsigned int x0, unsigned int y0, unsigned int x, unsigned int y)
Definition: mob.c:138
int health
Definition: mob.h:49
List * inventory
Definition: mob.h:29
char * race
Definition: mob.h:43
Definition: level.h:38
bool damage_mob(struct Mob *mob, unsigned int amount)
Definition: mob.c:88
char * name
Definition: mob.h:42
void(* death_action)(struct Mob *)
Definition: mob.h:35
struct Item * weapon
Definition: mob.h:30
bool hostile
Definition: mob.h:40
unsigned int ypos
Definition: mob.h:23
char * profession
Definition: mob.h:44
void(* effect_action)(struct Mob *)
Definition: mob.h:38
int score
Definition: mob.h:45
void * data
Definition: mob.h:55
Definition: item.h:21
void attack_mob(Mob *attacker, Mob *defender)
Definition: mob.c:62
List moblist
Definition: mob.h:19
struct Level * level
Definition: mob.h:21
unsigned int luminosity
Definition: mob.h:53
unsigned int attack
Definition: mob.h:47
bool move_mob_relative(struct Mob *mob, int xdiff, int ydiff)
Definition: mob.c:52
int effect_duration
Definition: mob.h:37
struct Mob Mob
struct Item * armour
Definition: mob.h:32
unsigned int max_health
Definition: mob.h:50
bool can_see_other(struct Mob *moba, struct Mob *mobb)
Definition: mob.c:211
bool is_bold
Definition: mob.h:27
struct Item * offhand
Definition: mob.h:31
bool darksight
Definition: mob.h:52
unsigned int xpos
Definition: mob.h:22
bool move_mob(struct Mob *mob, unsigned int x, unsigned int y)
Definition: mob.c:19
int colour
Definition: mob.h:26
struct Mob * kill_mob(struct Mob *mob)
Definition: mob.c:99
void simple_enemy_turn(Mob *enemy)
Definition: mob.c:219
char symbol
Definition: mob.h:25
Definition: list.h:7
bool move_mob_level(Mob *mob, bool toprev)
Definition: mob.c:264