1 /**
2  * \file project.h
3  * \brief projection and helpers
4  */
5 
6 #ifndef PROJECT_H
7 #define PROJECT_H
8 
9 #include "source.h"
10 
11 /**
12  * Spell types used by project(), and related functions.
13  */
14 enum
15 {
16 	#define ELEM(a) PROJ_##a,
17 	#include "list-elements.h"
18 	#undef ELEM
19 	#define PROJ(a) PROJ_##a,
20 	#include "list-projections.h"
21 	#undef PROJ
22 	PROJ_MAX
23 };
24 
25 /**
26  * Element struct
27  */
28 struct projection {
29 	int index;
30 	char *name;
31 	char *type;
32 	char *desc;
33 	char *player_desc;
34 	char *blind_desc;
35 	char *lash_desc;
36 	int numerator;
37 	random_value denominator;
38 	int divisor;
39 	int damage_cap;
40 	int msgt;
41 	bool obvious;
42 	bool wake;
43 	int color;
44 	struct projection *next;
45 };
46 
47 extern struct projection *projections;
48 
49 /**
50  * Bolt motion (used in prefs.c, project.c)
51  */
52 enum
53 {
54     BOLT_NO_MOTION,
55     BOLT_0,
56     BOLT_45,
57     BOLT_90,
58     BOLT_135,
59     BOLT_MAX
60 };
61 
62 
63 /**
64  *   NONE: No flags
65  *   JUMP: Jump directly to the target location without following a path
66  *   BEAM: Work as a beam weapon (affect every grid passed through)
67  *   THRU: May continue through the target (used for bolts and beams)
68  *   STOP: Stop as soon as we hit a monster (used for bolts)
69  *   GRID: May affect terrain in the blast area in some way
70  *   ITEM: May affect objects in the blast area in some way
71  *   KILL: May affect monsters in the blast area in some way
72  *   HIDE: Disable visual feedback from projection
73  *   AWARE: Effects are already obvious to the player
74  *   SAFE: Doesn't affect monsters of the same race as the caster
75  *   ARC: Projection is a sector of circle radiating from the caster
76  *   PLAY: May affect the player
77  *   INFO: Use believed map rather than truth for player ui
78  *   SHORT: Use one quarter of max_range
79  *   SELF: May affect the player, even when cast by the player
80  */
81 enum
82 {
83 	PROJECT_NONE  = 0x0000,
84 	PROJECT_JUMP  = 0x0001,
85 	PROJECT_BEAM  = 0x0002,
86 	PROJECT_THRU  = 0x0004,
87 	PROJECT_STOP  = 0x0008,
88 	PROJECT_GRID  = 0x0010,
89 	PROJECT_ITEM  = 0x0020,
90 	PROJECT_KILL  = 0x0040,
91 	PROJECT_HIDE  = 0x0080,
92 	PROJECT_AWARE = 0x0100,
93 	PROJECT_SAFE  = 0x0200,
94 	PROJECT_ARC   = 0x0400,
95 	PROJECT_PLAY  = 0x0800,
96 	PROJECT_INFO  = 0x1000,
97 	PROJECT_SHORT = 0x2000,
98 	PROJECT_SELF  = 0x4000,
99 	PROJECT_ROCK  = 0x8000,
100 };
101 
102 /* Display attrs and chars */
103 extern byte proj_to_attr[PROJ_MAX][BOLT_MAX];
104 extern wchar_t proj_to_char[PROJ_MAX][BOLT_MAX];
105 
106 void thrust_away(struct loc centre, struct loc target, int grids_away);
107 int inven_damage(struct player *p, int type, int cperc);
108 int adjust_dam(struct player *p, int type, int dam, aspect dam_aspect,
109 			   int resist, bool actual);
110 
111 bool project_f(struct source, int r, struct loc grid, int dam, int typ);
112 bool project_o(struct source, int r, struct loc grid, int dam, int typ,
113 			   const struct object *protected_obj);
114 void project_m(struct source, int r, struct loc grid, int dam, int typ, int flg,
115                bool *did_hit, bool *was_obvious);
116 bool project_p(struct source, int r, struct loc grid, int dam, int typ,
117 			   int power, bool self);
118 
119 int project_path(struct loc *gp, int range, struct loc grid1, struct loc grid2,
120 				 int flg);
121 bool projectable(struct chunk *c, struct loc grid1, struct loc grid2, int flg);
122 int proj_name_to_idx(const char *name);
123 const char *proj_idx_to_name(int type);
124 
125 struct loc origin_get_loc(struct source origin);
126 
127 bool project(struct source origin, int rad, struct loc finish, int dam, int typ,
128 			 int flg, int degrees_of_arc, byte diameter_of_source,
129 			 const struct object *obj);
130 
131 #endif /* !PROJECT_H */
132