Debian Codegraph @

src/borg/borg3.h

raw symbols SCIP
1 /* File: borg3.h */
2 /* Purpose: Header file for "borg3.c" -BEN- */
3
4 #ifndef INCLUDED_BORG3_H
5 #define INCLUDED_BORG3_H
6
7 #include "angband.h"
8 #include "obj-tval.h"
9 #include "cave.h"
10 #include "store.h"
11
12 #ifdef ALLOW_BORG
13
14 /*
15 * This file provides support for "borg3.c".
16 */
17
18 #include "borg1.h"
19
20
21 extern void apw(void); /* special function used in testing */
22
23 /*
24 * Hack -- location of the "Lv Mana Fail" prompt
25 */
26 #define ROW_SPELL 1
27 #define COL_SPELL 20+35
28
29
30
31
32 /*
33 * Forward declare
34 */
35 typedef struct borg_item borg_item;
36 typedef struct borg_shop borg_shop;
37
38 enum {
39 BORG_CURSE_UNKNOWN = 0,
40 BORG_CURSE_VULNERABILITY = 1,
41 BORG_CURSE_TELEPORTATION = 2,
42 BORG_CURSE_DULLNESS = 3,
43 BORG_CURSE_SICKLINESS = 4,
44 BORG_CURSE_ENVELOPING = 5,
45 BORG_CURSE_IRRITATION = 6,
46 BORG_CURSE_WEAKNESS = 7,
47 BORG_CURSE_CLUMSINESS = 8,
48 BORG_CURSE_SLOWNESS = 9,
49 BORG_CURSE_ANNOYANCE = 10,
50 BORG_CURSE_POISON = 11,
51 BORG_CURSE_SIREN = 12,
52 BORG_CURSE_HALLUCINATION = 13,
53 BORG_CURSE_PARALYSIS = 14,
54 BORG_CURSE_DRAGON_SUMMON = 15,
55 BORG_CURSE_DEMON_SUMMON = 16,
56 BORG_CURSE_UNDEAD_SUMMON = 17,
57 BORG_CURSE_IMPAIR_MANA_RECOVERY = 18,
58 BORG_CURSE_IMPAIR_HITPOINT_RECOVERY = 19,
59 BORG_CURSE_COWARDICE = 20,
60 BORG_CURSE_STONE = 21,
61 BORG_CURSE_ANTI_TELEPORTATION = 22,
62 BORG_CURSE_TREACHEROUS_WEAPON = 23,
63 BORG_CURSE_BURNING_UP = 24,
64 BORG_CURSE_CHILLED_TO_THE_BONE = 25,
65 BORG_CURSE_STEELSKIN = 26,
66 BORG_CURSE_AIR_SWING = 27,
67 BORG_CURSE_MAX = 28,
68 };
69
70 /*
71 * A structure holding information about an object. 120 bytes.
72 *
73 * The "iqty" is zero if the object is "missing"
74 * The "kind" is zero if the object is "unaware" (or missing)
75 * The "able" is zero if the object is "unknown" (or unaware or missing)
76 *
77 * Note that unaware items will have a "tval" but an invalid "sval".
78 */
79 struct borg_item
80 {
81 char desc[80]; /* Actual Description */
82
83 char* note; /* Pointer to tail of 'desc' */
84
85 uint32_t kind; /* Kind index */
86
87 bool ident; /* True if item is identified */
88 bool needs_ident; /* True if item needs to be identified (not all items have runes that can be identified) */
89 bool aware; /* Player is aware of the effects */
90
91 bool xxxx; /* Unused */
92
93 uint8_t tval; /* Item type */
94 uint8_t sval; /* Item sub-type */
95 int16_t pval; /* Item extra-info */
96
97 uint8_t iqty; /* Number of items */
98
99 int16_t weight; /* Probable weight */
100
101 uint8_t art_idx; /* Artifact index (if any) */
102 uint8_t ego_idx; /* Ego-item index (if any) */
103 int activ_idx; /* Activation index (if any) */
104 bool one_ring; /* is this the one ring */
105
106 int16_t timeout; /* Timeout counter */
107
108 int16_t to_h; /* Bonus to hit */
109 int16_t to_d; /* Bonus to dam */
110 int16_t to_a; /* Bonus to ac */
111 int16_t ac; /* Armor class */
112 uint8_t dd; /* Damage dice */
113 uint8_t ds; /* Damage sides */
114
115 uint8_t level; /* Level */
116
117 int32_t cost; /* Cost (in stores) */
118
119 int32_t value; /* Value (estimated) */
120
121 bool cursed; /* Item is cursed */
122 bool uncursable; /* Item can be uncursed */
123 bool curses[BORG_CURSE_MAX];
124
125 bitflag flags[OF_SIZE]; /**< Object flags */
126 int16_t modifiers[OBJ_MOD_MAX]; /**< Object modifiers*/
127 struct element_info el_info[ELEM_MAX]; /**< Object element info */
128 bool brands[254]; /**< Flag absence/presence of each brand */
129 /* HACK this should be dynamic but we don't know when borg_item's go away */
130 int slays[RF_MAX]; /**< power of slays based on race flag */
131 };
132
133
134 /*
135 * A store
136 */
137 struct borg_shop
138 {
139 /* int16_t when; */ /* Time stamp */
140
141 int16_t xtra; /* Something unused */
142
143 int16_t page; /* Current page */
144 int16_t more; /* Number of pages */
145
146 borg_item ware[24]; /* Store contents */
147 };
148
149
150
151 /*
152 * Spell method values
153 */
154
155 #define BORG_MAGIC_ICK 0 /* Spell is illegible */
156 #define BORG_MAGIC_NOP 1 /* Spell takes no arguments */
157 #define BORG_MAGIC_EXT 2 /* Spell has DETECTION effects */
158 #define BORG_MAGIC_AIM 3 /* Spell requires a direction */
159 #define BORG_MAGIC_OBJ 4 /* Spell requires a pack object */
160 #define BORG_MAGIC_WHO 5 /* Spell requires a monster symbol */
161
162
163 /*
164 * Spell status values
165 */
166
167 #define BORG_MAGIC_ICKY 0 /* Spell is illegible */
168 #define BORG_MAGIC_LOST 1 /* Spell is forgotten */
169 #define BORG_MAGIC_HIGH 2 /* Spell is high level */
170 #define BORG_MAGIC_OKAY 3 /* Spell is learnable */
171 #define BORG_MAGIC_TEST 4 /* Spell is untried */
172 #define BORG_MAGIC_KNOW 5 /* Spell is known */
173
174 enum borg_spells
175 {
176 MAGIC_MISSILE,
177 LIGHT_ROOM,
178 FIND_TRAPS_DOORS_STAIRS,
179 PHASE_DOOR,
180 ELECTRIC_ARC,
181 DETECT_MONSTERS,
182 FIRE_BALL,
183 RECHARGING,
184 IDENTIFY_RUNE,
185 TREASURE_DETECTION,
186 FROST_BOLT,
187 REVEAL_MONSTERS,
188 ACID_SPRAY,
189 DISABLE_TRAPS_DESTROY_DOORS,
190 TELEPORT_SELF,
191 TELEPORT_OTHER,
192 RESISTANCE,
193 TAP_MAGICAL_ENERGY,
194 MANA_CHANNEL,
195 DOOR_CREATION,
196 MANA_BOLT,
197 TELEPORT_LEVEL,
198 DETECTION,
199 DIMENSION_DOOR,
200 THRUST_AWAY,
201 SHOCK_WAVE,
202 EXPLOSION,
203 BANISHMENT,
204 MASS_BANISHMENT,
205 MANA_STORM,
206 DETECT_LIFE,
207 FOX_FORM,
208 REMOVE_HUNGER,
209 STINKING_CLOUD,
210 CONFUSE_MONSTER,
211 SLOW_MONSTER,
212 CURE_POISON,
213 RESIST_POISON,
214 TURN_STONE_TO_MUD,
215 SENSE_SURROUNDINGS,
216 LIGHTNING_STRIKE,
217 EARTH_RISING,
218 TRANCE,
219 MASS_SLEEP,
220 BECOME_PUKEL_MAN,
221 EAGLES_FLIGHT,
222 BEAR_FORM,
223 TREMOR,
224 HASTE_SELF,
225 REVITALIZE,
226 RAPID_REGENERATION,
227 HERBAL_CURING,
228 METEOR_SWARM,
229 RIFT,
230 ICE_STORM,
231 VOLCANIC_ERUPTION,
232 RIVER_OF_LIGHTNING,
233 CALL_LIGHT,
234 DETECT_EVIL,
235 MINOR_HEALING,
236 BLESS,
237 SENSE_INVISIBLE,
238 HEROISM,
239 ORB_OF_DRAINING,
240 SPEAR_OF_LIGHT,
241 DISPEL_UNDEAD,
242 DISPEL_EVIL,
243 PROTECTION_FROM_EVIL,
244 REMOVE_CURSE,
245 PORTAL,
246 REMEMBRANCE,
247 WORD_OF_RECALL,
248 HEALING,
249 RESTORATION,
250 CLAIRVOYANCE,
251 ENCHANT_WEAPON,
252 ENCHANT_ARMOUR,
253 SMITE_EVIL,
254 GLYPH_OF_WARDING,
255 DEMON_BANE,
256 BANISH_EVIL,
257 WORD_OF_DESTRUCTION,
258 HOLY_WORD,
259 SPEAR_OF_OROME,
260 LIGHT_OF_MANWE,
261 NETHER_BOLT,
262 CREATE_DARKNESS,
263 BAT_FORM,
264 READ_MINDS,
265 TAP_UNLIFE,
266 CRUSH,
267 SLEEP_EVIL,
268 SHADOW_SHIFT,
269 DISENCHANT,
270 FRIGHTEN,
271 VAMPIRE_STRIKE,
272 DISPEL_LIFE,
273 DARK_SPEAR,
274 WARG_FORM,
275 BANISH_SPIRITS,
276 ANNIHILATE,
277 GRONDS_BLOW,
278 UNLEASH_CHAOS,
279 FUME_OF_MORDOR,
280 STORM_OF_DARKNESS,
281 POWER_SACRIFICE,
282 ZONE_OF_UNMAGIC,
283 VAMPIRE_FORM,
284 CURSE,
285 COMMAND,
286 SINGLE_COMBAT,
287 OBJECT_DETECTION,
288 DETECT_STAIRS,
289 HIT_AND_RUN,
290 COVER_TRACKS,
291 CREATE_ARROWS,
292 DECOY,
293 BRAND_AMMUNITION,
294 SEEK_BATTLE,
295 BERSERK_STRENGTH,
296 WHIRLWIND_ATTACK,
297 SHATTER_STONE,
298 LEAP_INTO_BATTLE,
299 GRIM_PURPOSE,
300 MAIM_FOE,
301 HOWL_OF_THE_DAMNED,
302 RELENTLESS_TAUNTING,
303 VENOM,
304 WEREWOLF_FORM,
305 BLOODLUST,
306 UNHOLY_REPRIEVE,
307 FORCEFUL_BLOW,
308 QUAKE
309 };
310
311 /*
312 * The borgs "usefulness" rating of each spell.
313 */
314 typedef struct borg_spell_rating borg_spell_rating;
315 struct borg_spell_rating
316 {
317 const char* name; /* Textual name */
318 uint8_t rating; /* Usefulness */
319 enum borg_spells spell_enum; /* an enum for quick lookup */
320 };
321
322 /*
323 * Forward declare
324 */
325 typedef struct borg_magic borg_magic;
326
327
328 /*
329 * A spell/prayer in a book
330 */
331 struct borg_magic
332 {
333 const char* name; /* Textual name */
334 uint8_t status; /* Status (see above) */
335 uint16_t effect_index; /* effect index */
336 uint8_t rating; /* Usefulness */
337 uint8_t level; /* Required level */
338 uint8_t power; /* Required power */
339 uint8_t sfail; /* Minimum chance of failure */
340 int book_offset; /* offset of this spell in the book it is in */
341 int book; /* book index */
342 int32_t times; /* Times this spell was cast */
343 enum borg_spells spell_enum;
344 };
345
346
347
348 /*
349 * Some variables
350 */
351
352 extern borg_item* borg_items; /* Current "inventory" */
353 extern borg_shop* borg_shops; /* Current "shops" */
354
355
356 /*
357 * Safety arrays for simulating possible worlds
358 */
359
360 extern borg_item* safe_items; /* Safety "inventory" */
361 extern borg_item* safe_home; /* Safety "home" */
362
363 extern borg_shop* safe_shops; /* Safety "shops" */
364
365
366 /*
367 * Spell casting information
368 */
369
370 extern borg_magic* borg_magics; /* Spell info */
371
372
373
374
375 /*
376 * Determine which slot an item could be wielded into
377 */
378 extern int borg_wield_slot(const borg_item* item);
379
380 /*
381 * Analyze an item, given a textual description
382 */
383 extern void borg_item_analyze(borg_item* item, const struct object* real_item, char* desc, bool in_store);
384
385
386 /* look for a *id*'d item */
387 extern bool borg_object_fully_id(void);
388
389 /* look for a *id*'d item */
390 extern bool borg_object_fully_id_aux(borg_item* borg_item, struct object* real_item);
391
392 /*
393 * Inscribe an object
394 */
395 extern void borg_send_inscribe(int i, char* str);
396 extern void borg_send_deinscribe(int i);
397
398 /*
399 * Find an item with a given tval/sval
400 */
401 extern int borg_slot(int tval, int sval);
402
403 /*
404 * Item usage functions
405 */
406 enum borg_need {
407 BORG_NO_NEED,
408 BORG_MET_NEED,
409 BORG_UNMET_NEED,
410 };
411 extern enum borg_need borg_maintain_light(void);
412 extern bool borg_refuel_lantern(void);
413
414 /*
415 * Item usage functions
416 */
417 extern bool borg_obj_has_effect(uint32_t kind, int index, int subtype);
418 extern bool borg_eat_food(int tval, int sval);
419 extern bool borg_quaff_crit(bool no_check);
420 extern bool borg_quaff_potion(int sval);
421 extern bool borg_eat_unknown(void);
422 extern bool borg_use_unknown(void);
423 extern bool borg_quaff_unknown(void);
424 extern bool borg_read_unknown(void);
425 extern bool borg_read_scroll(int sval);
426 extern bool borg_equips_rod(int sval);
427 extern bool borg_zap_rod(int sval);
428 extern bool borg_aim_wand(int sval);
429 extern bool borg_use_staff(int sval);
430 extern bool borg_use_staff_fail(int sval);
431 extern bool borg_equips_staff_fail(int sval);
432 extern bool borg_inscribe_food(void);
433
434 extern int borg_activate_failure(int tval, int sval);
435
436 /*
437 * Artifact usage function (by index)
438 */
439 extern bool borg_activate_item(int activation); /* */
440 extern bool borg_equips_item(int activation, bool check_charge); /* */
441 extern bool borg_activate_dragon(int drag_sval); /* */
442 extern bool borg_equips_dragon(int drag_sval); /* */
443 extern bool borg_activate_ring(int ring_sval); /* */
444 extern bool borg_equips_ring(int ring_sval); /* */
445
446
447 /*
448 * Spell functions
449 */
450 extern int borg_spell_stat(void);
451 extern bool borg_spell_legal(const enum borg_spells spell);
452 extern bool borg_spell_okay(const enum borg_spells spell);
453 extern int borg_get_spell_power(const enum borg_spells spell);
454 extern int borg_get_book_num(int sval);
455 extern borg_magic* borg_get_spell_entry(int book, int what);
456 extern bool borg_spell(const enum borg_spells spell);
457 extern bool borg_spell_fail(const enum borg_spells spell, int allow_fail);
458 extern bool borg_spell_okay_fail(const enum borg_spells spell, int allow_fail);
459 extern bool borg_spell_legal_fail(const enum borg_spells spell, int allow_fail);
460 extern int borg_spell_fail_rate(const enum borg_spells spell);
461
462
463 /*
464 * Cheat/Parse the "equip" and "inven" screens.
465 */
466 extern void borg_cheat_equip(void);
467 extern void borg_cheat_inven(void);
468 extern void borg_cheat_store(void);
469
470 /*
471 * Cheat/Parse the "spell" screen
472 */
473 extern void borg_cheat_spell(int book);
474
475 /*
476 * Hack -- prepare stuff based on the race/class
477 */
478 extern void borg_prepare_race_class_info(void);
479
480 /*
481 * check special note for item needs id
482 */
483 extern const char* borg_get_note(const borg_item* item);
484 extern bool borg_item_note_needs_id(const borg_item* item);
485
486 /*
487 * helper to find the first empty slot
488 */
489 extern int borg_first_empty_inventory_slot(void);
490
491 /*
492 * Initialize this file
493 */
494 extern void borg_init_3(void);
495
496
497 #endif
498
499 #endif
500