From 8c9d762440cdb7e861d5a94e223026d2d26764a7 Mon Sep 17 00:00:00 2001 From: mariari Date: Wed, 12 Jan 2022 22:03:28 -0600 Subject: [PATCH 1/4] Update code to map to RF8 so the make file compiles --- Furyband/w_mnster.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Furyband/w_mnster.c b/Furyband/w_mnster.c index 56ca5b7..2164397 100644 --- a/Furyband/w_mnster.c +++ b/Furyband/w_mnster.c @@ -1,6 +1,6 @@ /* ** Lua binding: monster -** Generated automatically by tolua 4.0a - angband on 08/01/07 21:25:27. +** Generated automatically by tolua 4.0a - angband on Wed Jan 12 22:46:57 2022. */ #include "lua/tolua.h" @@ -2960,8 +2960,8 @@ void tolua_monster_close (lua_State* tolua_S) lua_pushnil(tolua_S); lua_setglobal(tolua_S,"RF2_ATTR_ANY"); lua_pushnil(tolua_S); lua_setglobal(tolua_S,"RF2_POWERFUL"); lua_pushnil(tolua_S); lua_setglobal(tolua_S,"RF2_ELDRITCH_HORROR"); - lua_pushnil(tolua_S); lua_setglobal(tolua_S,"RF_AURA_FIRE"); - lua_pushnil(tolua_S); lua_setglobal(tolua_S,"RF_AURA_ELEC"); + lua_pushnil(tolua_S); lua_setglobal(tolua_S,"RF8_AURA_FIRE"); + lua_pushnil(tolua_S); lua_setglobal(tolua_S,"RF8_AURA_ELEC"); lua_pushnil(tolua_S); lua_setglobal(tolua_S,"RF2_OPEN_DOOR"); lua_pushnil(tolua_S); lua_setglobal(tolua_S,"RF2_BASH_DOOR"); lua_pushnil(tolua_S); lua_setglobal(tolua_S,"RF2_PASS_WALL"); @@ -2988,7 +2988,7 @@ void tolua_monster_close (lua_State* tolua_S) lua_pushnil(tolua_S); lua_setglobal(tolua_S,"RF3_ANIMAL"); lua_pushnil(tolua_S); lua_setglobal(tolua_S,"RF3_THUNDERLORD"); lua_pushnil(tolua_S); lua_setglobal(tolua_S,"RF3_GOOD"); - lua_pushnil(tolua_S); lua_setglobal(tolua_S,"RF_AURA_COLD"); + lua_pushnil(tolua_S); lua_setglobal(tolua_S,"RF8_AURA_COLD"); lua_pushnil(tolua_S); lua_setglobal(tolua_S,"RF3_NONLIVING"); lua_pushnil(tolua_S); lua_setglobal(tolua_S,"RF3_HURT_LITE"); lua_pushnil(tolua_S); lua_setglobal(tolua_S,"RF3_HURT_ROCK"); From 3d2eb5346ff7c7c653906dcf13e1b1669d5e0f08 Mon Sep 17 00:00:00 2001 From: mariari Date: Wed, 12 Jan 2022 22:09:16 -0600 Subject: [PATCH 2/4] Changed keyword restrict to restrictions --- Furyband/birth.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Furyband/birth.c b/Furyband/birth.c index e860180..707f81b 100644 --- a/Furyband/birth.c +++ b/Furyband/birth.c @@ -1336,7 +1336,7 @@ static void gen_random_quests(int n) dungeon_type = old_type; } -int dump_classes(s16b *classes, int sel, u32b *restrict) +int dump_classes(s16b *classes, int sel, u32b *restrictions) { int n = 0; @@ -1377,15 +1377,15 @@ int dump_classes(s16b *classes, int sel, u32b *restrict) cp_ptr->flags1 & PR1_EXPERIMENTAL ? "\nEXPERIMENTAL" : ""); print_desc(desc); - if (!(restrict[classes[n] / 32] & BIT(classes[n])) || - cp_ptr->flags1 & PR1_EXPERIMENTAL) + if (!((restrictions[classes[n] / 32]) & BIT(classes[n])) || + cp_ptr->flags1 & PR1_EXPERIMENTAL) c_put_str(TERM_BLUE, buf, 18 + (n / 4), 1 + 20 * (n % 4)); else c_put_str(TERM_L_BLUE, buf, 18 + (n / 4), 1 + 20 * (n % 4)); } else { - if (!(restrict[classes[n] / 32] & BIT(classes[n])) || + if (!(restrictions[classes[n] / 32] & BIT(classes[n])) || cp_ptr->flags1 & PR1_EXPERIMENTAL) c_put_str(TERM_SLATE, buf, 18 + (n / 4), 1 + 20 * (n % 4)); else @@ -1650,7 +1650,7 @@ static bool player_birth_aux_ask() int racem[100], max_racem = 0; - u32b restrict[2]; + u32b restrictions[2]; cptr str; @@ -2022,7 +2022,7 @@ static bool player_birth_aux_ask() int z; for (z = 0; z < 2; z++) - restrict[z] = (rp_ptr->choice[z] | rmp_ptr->pclass[z]) & (~rmp_ptr->mclass[z]); + restrictions[z] = (rp_ptr->choice[z] | rmp_ptr->pclass[z]) & (~rmp_ptr->mclass[z]); if (max_mc_idx > 1) { @@ -2075,7 +2075,7 @@ static bool player_birth_aux_ask() { /* Dump classes */ sel = 0; - n = dump_classes(class_types, sel, restrict); + n = dump_classes(class_types, sel, restrictions); /* Get a class */ while (1) @@ -2103,7 +2103,7 @@ static bool player_birth_aux_ask() { sel += 4; if (sel >= n) sel %= 4; - dump_classes(class_types, sel, restrict); + dump_classes(class_types, sel, restrictions); } else if (c == '8') { @@ -2111,19 +2111,19 @@ static bool player_birth_aux_ask() if (sel < 0) sel = n - 1 -( ( -sel) % 4); /* C's modulus operator does not have defined results for negative first values. Damn. */ - dump_classes(class_types, sel, restrict); + dump_classes(class_types, sel, restrictions); } else if (c == '6') { sel++; if (sel >= n) sel = 0; - dump_classes(class_types, sel, restrict); + dump_classes(class_types, sel, restrictions); } else if (c == '4') { sel--; if (sel < 0) sel = n - 1; - dump_classes(class_types, sel, restrict); + dump_classes(class_types, sel, restrictions); } else if (c == '\r') { @@ -2135,8 +2135,8 @@ static bool player_birth_aux_ask() } /* Set class */ -#ifdef RESTRICT_COMBINATIONS - if (!(restrict & BIT(k))) +#ifdef RESTRICTIONS_COMBINATIONS + if (!(restrictions & BIT(k))) { noscore |= 0x0020; message_add(MESSAGE_MSG, " ", TERM_VIOLET); From 8823d8240dbf92df967fdbb91cc355c8102c5576 Mon Sep 17 00:00:00 2001 From: mariari Date: Wed, 12 Jan 2022 22:17:07 -0600 Subject: [PATCH 3/4] Added PKG files so the game can build on Linux --- PKGS/dungeon.pkg | 1618 +++++++++++++++++++++ PKGS/monster.pkg | 2324 ++++++++++++++++++++++++++++++ PKGS/object.pkg | 1171 +++++++++++++++ PKGS/player.pkg | 3525 +++++++++++++++++++++++++++++++++++++++++++++ PKGS/player_c.pkg | 1060 ++++++++++++++ PKGS/quest.pkg | 170 +++ PKGS/spells.pkg | 2498 ++++++++++++++++++++++++++++++++ PKGS/util.pkg | 2735 +++++++++++++++++++++++++++++++++++ PKGS/z_pack.pkg | 693 +++++++++ readme.txt | 2 + 10 files changed, 15796 insertions(+) create mode 100644 PKGS/dungeon.pkg create mode 100644 PKGS/monster.pkg create mode 100644 PKGS/object.pkg create mode 100644 PKGS/player.pkg create mode 100644 PKGS/player_c.pkg create mode 100644 PKGS/quest.pkg create mode 100644 PKGS/spells.pkg create mode 100644 PKGS/util.pkg create mode 100644 PKGS/z_pack.pkg diff --git a/PKGS/dungeon.pkg b/PKGS/dungeon.pkg new file mode 100644 index 0000000..3e11338 --- /dev/null +++ b/PKGS/dungeon.pkg @@ -0,0 +1,1618 @@ +/* File: dungeon.pkg */ + +/* + * Purpose: Lua interface defitions for dungeon routines. + * To be processed by tolua to generate C source code. + */ + +$#include "angband.h" + +/** @typedef cptr + * @note String + */ +typedef char* cptr; + +/** @typedef errr + * @note Number + */ +typedef int errr; + +/** @typedef bool + * @note Boolean + */ +typedef unsigned char bool; + +/** @typedef byte + * @note Number + */ +typedef unsigned char byte; + +/** @typedef s16b + * @note Number + */ +typedef signed short s16b; + +/** @typedef u16b + * @note Number + */ +typedef unsigned short u16b; + +/** @typedef s32b + * @note Number + */ +typedef signed int s32b; + +/** @typedef u32b + * @note Number + */ +typedef unsigned int u32b; + +/** @name Cave Grid + * @note Special cave grid flags + * @{ + */ + +/** @def CAVE_MARK + * @note memorized feature + */ +#define CAVE_MARK 0x0001 + +/** @def CAVE_GLOW + * @note self-illuminating + */ +#define CAVE_GLOW 0x0002 + +/** @def CAVE_ICKY + * @note part of a vault + */ +#define CAVE_ICKY 0x0004 + +/** @def CAVE_ROOM + * @note part of a room + */ +#define CAVE_ROOM 0x0008 + +/** @def CAVE_SEEN + * @note seen flag + */ +#define CAVE_SEEN 0x0010 + +/** @def CAVE_VIEW + * @note view flag + */ +#define CAVE_VIEW 0x0020 + +/** @def CAVE_TEMP + * @note temp flag + */ +#define CAVE_TEMP 0x0040 + +/** @def CAVE_WALL + * @note wall flag + */ +#define CAVE_WALL 0x0080 + +/** @def CAVE_TRDT + * @note trap detected + */ +#define CAVE_TRDT 0x0100 + +/** @def CAVE_IDNT + * @note grid identified (fountains) + */ +#define CAVE_IDNT 0x0200 + +/** @def CAVE_SPEC + * @note special mark(quests) + */ +#define CAVE_SPEC 0x0400 + +/** @def CAVE_FREE + * @note no random generation on it + */ +#define CAVE_FREE 0x0800 + +/** @def CAVE_DETECT + * @note Traps detected here + */ +#define CAVE_DETECT 0x1000 + +/** @def CAVE_PLIT + * @note Player lit grid + */ +#define CAVE_PLIT 0x2000 + +/** @def CAVE_MLIT + * @note Monster lit grid + */ +#define CAVE_MLIT 0x4000 +/** @} */ + +/** @name Terrain Feature Indexes + * @note (see "lib/edit/f_info.txt") + * @{ + */ + +/* Nothing */ +/** @def FEAT_NONE */ +#define FEAT_NONE 0x00 + + +/* Basic features */ +/** @def FEAT_FLOOR */ +#define FEAT_FLOOR 0x01 + +/** @def FEAT_FOUNTAIN */ +#define FEAT_FOUNTAIN 0x02 + +/** @def FEAT_GLYPH */ +#define FEAT_GLYPH 0x03 + +/** @def FEAT_OPEN */ +#define FEAT_OPEN 0x04 + +/** @def FEAT_BROKEN */ +#define FEAT_BROKEN 0x05 + +/** @def FEAT_LESS */ +#define FEAT_LESS 0x06 + +/** @def FEAT_MORE */ +#define FEAT_MORE 0x07 + + +/* Quest features -KMW- */ +/** @def FEAT_QUEST_ENTER */ +#define FEAT_QUEST_ENTER 0x08 + +/** @def FEAT_QUEST_EXIT */ +#define FEAT_QUEST_EXIT 0x09 + +/** @def FEAT_QUEST_DOWN */ +#define FEAT_QUEST_DOWN 0x0A + +/** @def FEAT_QUEST_UP */ +#define FEAT_QUEST_UP 0x0B + + +/* Shafts -GSN- */ +/** @def FEAT_SHAFT_DOWN */ +#define FEAT_SHAFT_DOWN 0x0D + +/** @def FEAT_SHAFT_UP */ +#define FEAT_SHAFT_UP 0x0E + + +/* Basic feature */ +/** @def FEAT_EMPTY_FOUNTAIN */ +#define FEAT_EMPTY_FOUNTAIN 0x0F + + +/* Feature 0x10 -- web */ + +/* Traps */ +/** @def FEAT_TRAP */ +#define FEAT_TRAP 0x11 + + +/* Features 0x12 - 0x1F -- unused */ + +/* Doors */ +/** @def FEAT_DOOR_HEAD */ +#define FEAT_DOOR_HEAD 0x20 + +/** @def FEAT_DOOR_TAIL */ +#define FEAT_DOOR_TAIL 0x2F + + +/* Extra */ +/** @def FEAT_SECRET */ +#define FEAT_SECRET 0x30 + +/** @def FEAT_RUBBLE */ +#define FEAT_RUBBLE 0x31 + + +/* Seams */ +/** @def FEAT_MAGMA */ +#define FEAT_MAGMA 0x32 + +/** @def FEAT_QUARTZ */ +#define FEAT_QUARTZ 0x33 + +/** @def FEAT_MAGMA_H */ +#define FEAT_MAGMA_H 0x34 + +/** @def FEAT_QUARTZ_H */ +#define FEAT_QUARTZ_H 0x35 + +/** @def FEAT_MAGMA_K */ +#define FEAT_MAGMA_K 0x36 + +/** @def FEAT_QUARTZ_K */ +#define FEAT_QUARTZ_K 0x37 + + +/* Walls */ +/** @def FEAT_WALL_EXTRA */ +#define FEAT_WALL_EXTRA 0x38 + +/** @def FEAT_WALL_INNER */ +#define FEAT_WALL_INNER 0x39 + +/** @def FEAT_WALL_OUTER */ +#define FEAT_WALL_OUTER 0x3A + +/** @def FEAT_WALL_SOLID */ +#define FEAT_WALL_SOLID 0x3B + +/** @def FEAT_PERM_EXTRA */ +#define FEAT_PERM_EXTRA 0x3C + +/** @def FEAT_PERM_INNER */ +#define FEAT_PERM_INNER 0x3D + +/** @def FEAT_PERM_OUTER */ +#define FEAT_PERM_OUTER 0x3E + +/** @def FEAT_PERM_SOLID */ +#define FEAT_PERM_SOLID 0x3F + + +/* Explosive rune */ +/** @def FEAT_MINOR_GLYPH */ +#define FEAT_MINOR_GLYPH 0x40 + + +/* Pattern */ +/** @def FEAT_PATTERN_START */ +#define FEAT_PATTERN_START 0x41 + +/** @def FEAT_PATTERN_1 */ +#define FEAT_PATTERN_1 0x42 + +/** @def FEAT_PATTERN_2 */ +#define FEAT_PATTERN_2 0x43 + +/** @def FEAT_PATTERN_3 */ +#define FEAT_PATTERN_3 0x44 + +/** @def FEAT_PATTERN_4 */ +#define FEAT_PATTERN_4 0x45 + +/** @def FEAT_PATTERN_END */ +#define FEAT_PATTERN_END 0x46 + +/** @def FEAT_PATTERN_OLD */ +#define FEAT_PATTERN_OLD 0x47 + +/** @def FEAT_PATTERN_XTRA1 */ +#define FEAT_PATTERN_XTRA1 0x48 + +/** @def FEAT_PATTERN_XTRA2 */ +#define FEAT_PATTERN_XTRA2 0x49 + + +/* Shops */ +/** @def FEAT_SHOP */ +#define FEAT_SHOP 0x4A + + +/* Permanent walls for quests */ +/** @def FEAT_QUEST1 */ +#define FEAT_QUEST1 0x4B + +/** @def FEAT_QUEST2 */ +#define FEAT_QUEST2 0x4C + +/** @def FEAT_QUEST3 */ +#define FEAT_QUEST3 0x4D + +/** @def FEAT_QUEST4 */ +#define FEAT_QUEST4 0x4E + + +/* Features 0x4F - 0x53 -- unused */ + +/* Additional terrains */ +/** @def FEAT_SHAL_WATER */ +#define FEAT_SHAL_WATER 0x54 + +/** @def FEAT_DEEP_LAVA */ +#define FEAT_DEEP_LAVA 0x55 + +/** @def FEAT_SHAL_LAVA */ +#define FEAT_SHAL_LAVA 0x56 + +/** @def FEAT_DARK_PIT */ +#define FEAT_DARK_PIT 0x57 + +/** @def FEAT_DIRT */ +#define FEAT_DIRT 0x58 + +/** @def FEAT_GRASS */ +#define FEAT_GRASS 0x59 + +/** @def FEAT_ICE */ +#define FEAT_ICE 0x5A + +/** @def FEAT_SAND */ +#define FEAT_SAND 0x5B + +/** @def FEAT_DEAD_TREE */ +#define FEAT_DEAD_TREE 0x5C + +/** @def FEAT_ASH */ +#define FEAT_ASH 0x5D + +/** @def FEAT_MUD */ +#define FEAT_MUD 0x5E + +/** @def FEAT_ICE_WALL */ +#define FEAT_ICE_WALL 0x5F + +/** @def FEAT_TREES */ +#define FEAT_TREES 0x60 + +/** @def FEAT_MOUNTAIN */ +#define FEAT_MOUNTAIN 0x61 + +/** @def FEAT_SANDWALL */ +#define FEAT_SANDWALL 0x62 + +/** @def FEAT_SANDWALL_H */ +#define FEAT_SANDWALL_H 0x63 + +/** @def FEAT_SANDWALL_K */ +#define FEAT_SANDWALL_K 0x64 + +/* Feature 0x65 -- high mountain chain */ +/* Feature 0x66 -- nether mist */ + +/* Features 0x67 - 0x9F -- unused */ + +/** @def FEAT_BETWEEN + * @note 160 + */ +#define FEAT_BETWEEN 0xA0 + +/* Altars */ +/** @def FEAT_ALTAR_HEAD + * @note 161 + */ +#define FEAT_ALTAR_HEAD 0xA1 + +/** @def FEAT_ALTAR_TAIL + * @note 171 + */ +#define FEAT_ALTAR_TAIL 0xAB + +/** @def FEAT_MARKER + * @note 172 + */ +#define FEAT_MARKER 0xAC + +/* Feature 0xAD -- Underground Tunnel */ +/** @def FEAT_TAINTED_WATER + * @note 174 + */ +#define FEAT_TAINTED_WATER 0xAE + +/** @def FEAT_MON_TRAP + * @note 175 + */ +#define FEAT_MON_TRAP 0xAF + +/** @def FEAT_BETWEEN2 + * @note 176 + */ +#define FEAT_BETWEEN2 0xB0 + +/** @def FEAT_LAVA_WALL + * @note 177 + */ +#define FEAT_LAVA_WALL 0xB1 + +/** @def FEAT_GREAT_FIRE + * @note 178 + */ +#define FEAT_GREAT_FIRE 0xB2 + +/** @def FEAT_WAY_MORE + * @note 179 + */ +#define FEAT_WAY_MORE 0xB3 + +/** @def FEAT_WAY_LESS + * @note 180 + */ +#define FEAT_WAY_LESS 0xB4 + +/* Feature 0xB5 -- field */ + +/** @def FEAT_EKKAIA + * @note 182 + */ +#define FEAT_EKKAIA 0xB6 + +/* Features 0xB7 - 0xBA -- unused */ + +/** @def FEAT_DEEP_WATER + * @note 187 + */ +#define FEAT_DEEP_WATER 0xBB + +/** @def FEAT_GLASS_WALL + * @note 188 + */ +#define FEAT_GLASS_WALL 0xBC + +/** @def FEAT_ILLUS_WALL + * @note 189 + */ +#define FEAT_ILLUS_WALL 0xBD + +/* Feature 0xBE -- grass roof */ +/* Feature 0xBF -- grass roof top */ +/* Feature 0xC0 -- grass roof chimney */ +/* Feature 0xC1 -- brick roof */ +/* Feature 0xC2 -- brick roof top */ +/* Feature 0xC3 -- brick roof chimney */ +/* Feature 0xC4 -- window */ +/* Feature 0xC5 -- small window */ +/* Feature 0xC6 -- rain barrel */ + +/** @def FEAT_FLOWER + * @note 199 + */ +#define FEAT_FLOWER 0xC7 + +/* Feature 0xC8 -- cobblestone road */ +/* Feature 0xC9 -- cobblestone with outlet */ + +/** @def FEAT_SMALL_TREES + * @note 202 + */ +#define FEAT_SMALL_TREES 0xCA + +/** @def FEAT_TOWN + * @note 203 + */ +#define FEAT_TOWN 0xCB + +/* Feature 0xCC -- Underground Tunnel */ + +/** @def FEAT_FIRE + * @note 205 + */ +#define FEAT_FIRE 0xCD + +/* Feature 0xCE -- pile of rubble (permanent) */ +/* Features 0xCF - 0xFF -- unused */ +/** @} */ + +/** @name Dungeon Type Flags (part 1) + * @{ */ + +/** @def DF1_PRINCIPAL + * @note Is a principal dungeon + */ +#define DF1_PRINCIPAL 0x00000001L +/** @def DF1_MAZE + * @note Is a maze-type dungeon + */ +#define DF1_MAZE 0x00000002L +/** @def DF1_SMALLEST + * @note Creates VERY small levels like The Maze + */ +#define DF1_SMALLEST 0x00000004L +/** @def DF1_SMALL + * @note Creates small levels like Dol Goldor + */ +#define DF1_SMALL 0x00000008L +/** @def DF1_BIG + * @note Creates big levels like Moria, and Angband dungeons + */ +#define DF1_BIG 0x00000010L +/** @def DF1_NO_DOORS + * @note No doors on rooms, like Barrowdowns, Old Forest etc) + */ +#define DF1_NO_DOORS 0x00000020L +/** @def DF1_WATER_RIVER + * @note Allow a single water streamer on a level + */ +#define DF1_WATER_RIVER 0x00000040L +/** @def DF1_LAVA_RIVER + * @note Allow a single lava streamer on a level + */ +#define DF1_LAVA_RIVER 0x00000080L +/** @def DF1_WATER_RIVERS + * @note Allow multiple water streamers on a level + */ +#define DF1_WATER_RIVERS 0x00000100L +/** @def DF1_LAVA_RIVERS + * @note Allow multiple lava streamers on a level + */ +#define DF1_LAVA_RIVERS 0x00000200L +/** @def DF1_CAVE + * @note Allow orc-cave like 'fractal' rooms + */ +#define DF1_CAVE 0x00000400L +/** @def DF1_CAVERN + * @note Allow cavern rooms + */ +#define DF1_CAVERN 0x00000800L +/** @def DF1_NO_UP + * @note Disallow up stairs + */ +#define DF1_NO_UP 0x00001000L +/** @def DF1_HOT + * @note Corpses on ground and in pack decay quicker through heat + */ +#define DF1_HOT 0x00002000L +/** @def DF1_COLD + * @note Corpses on ground and in pack decay quicker through cold + */ +#define DF1_COLD 0x00004000L +/** @def DF1_FORCE_DOWN + * @note No up stairs generated + */ +#define DF1_FORCE_DOWN 0x00008000L +/** @def DF1_FORGET + * @note Features are forgotten, like the Maze and Illusory Castle + */ +#define DF1_FORGET 0x00010000L +/** @def DF1_NO_DESTROY + * @note No destroyed levels in dungeon + */ +#define DF1_NO_DESTROY 0x00020000L +/** @def DF1_SAND_VEIN + * @note Like in the sandworm lair + */ +#define DF1_SAND_VEIN 0x00040000L +/** @def DF1_CIRCULAR_ROOMS + * @note Allow circular rooms + */ +#define DF1_CIRCULAR_ROOMS 0x00080000L +/** @def DF1_EMPTY + * @note Allow arena levels + */ +#define DF1_EMPTY 0x00100000L +/** @def DF1_DAMAGE_FEAT + * @note Effect specified in will affect all grids incl. terrain and monsters + */ +#define DF1_DAMAGE_FEAT 0x00200000L +/** @def DF1_FLAT + * @note Creates paths to next areas at edge of level, like Barrowdowns + */ +#define DF1_FLAT 0x00400000L +/** @def DF1_TOWER + * @note You start at bottom and go up rather than the reverse + */ +#define DF1_TOWER 0x00800000L +/** @def DF1_RANDOM_TOWNS + * @note Allow random towns + */ +#define DF1_RANDOM_TOWNS 0x01000000L +/** @def DF1_DOUBLE + * @note Generates everything at double size like Helcaraxe and Erebor + */ +#define DF1_DOUBLE 0x02000000L +/** @def DF1_LIFE_LEVEL + * @note Creates dungeon level on modified 'game of life' algorithm + */ +#define DF1_LIFE_LEVEL 0x04000000L +/** @def DF1_EVOLVE + * @note Evolving, pulsing levels like Heart of the Earth + */ +#define DF1_EVOLVE 0x08000000L +/** @def DF1_ADJUST_LEVEL_1 + * @note Minimum monster level will be equal to dungeon level + */ +#define DF1_ADJUST_LEVEL_1 0x10000000L +/** @def DF1_ADJUST_LEVEL_2 + * @note Minimum monster level will be double the dungeon level + */ +#define DF1_ADJUST_LEVEL_2 0x20000000L +/** @def DF1_NO_RECALL + * @note No recall allowed + */ +#define DF1_NO_RECALL 0x40000000L +/** @def DF1_NO_STREAMERS + * @note No streamers + */ +#define DF1_NO_STREAMERS 0x80000000L +/** @} */ + +/** @name Dungeon Type Flags (part 2) + * @{ */ + +/** @def DF2_ADJUST_LEVEL_1_2 + * @note Minimum monster level will be half the dungeon level + */ +#define DF2_ADJUST_LEVEL_1_2 0x00000001L + +/** @def DF2_NO_SHAFT + * @note No shafts + */ +#define DF2_NO_SHAFT 0x00000002L + +/** @def DF2_ADJUST_LEVEL_PLAYER + * @note Uses player level*2 instead of dungeon level for other ADJUST_LEVEL flags + */ +#define DF2_ADJUST_LEVEL_PLAYER 0x00000004L + +/** @def DF2_NO_TELEPORT */ +#define DF2_NO_TELEPORT 0x00000008L + +/** @def DF2_ASK_LEAVE */ +#define DF2_ASK_LEAVE 0x00000010L + +/** @def DF2_NO_STAIR */ +#define DF2_NO_STAIR 0x00000020L + +/** @def DF2_SPECIAL */ +#define DF2_SPECIAL 0x00000040L + +/** @def DF2_NO_NEW_MONSTER */ +#define DF2_NO_NEW_MONSTER 0x00000080L + +/** @def DF2_DESC */ +#define DF2_DESC 0x00000100L + +/** @def DF2_NO_GENO */ +#define DF2_NO_GENO 0x00000200L + +/** @def DF2_NO_BREATH + * @note Oups, cannot breath here + */ +#define DF2_NO_BREATH 0x00000400L + +/** @def DF2_WATER_BREATH + * @note Oups, cannot breath here, need water breathing + */ +#define DF2_WATER_BREATH 0x00000800L + +/** @def DF2_ELVEN + * @note Try to create elven monster ego + */ +#define DF2_ELVEN 0x00001000L + +/** @def DF2_DWARVEN + * @note Try to create dwarven monster ego + */ +#define DF2_DWARVEN 0x00002000L + +/** @def DF2_NO_EASY_MOVE + * @note Forbid stuff like teleport level, probability travel, ... + */ +#define DF2_NO_EASY_MOVE 0x00004000L + +/** @def DF2_NO_RECALL_OUT + * @note Cannot recall out of the place + */ +#define DF2_NO_RECALL_OUT 0x00008000L + +/** @def DF2_DESC_ALWAYS + * @note Always shows the desc + */ +#define DF2_DESC_ALWAYS 0x00010000L +/** @} */ + +/** @var level_flags1; + * @brief Number + */ +extern u32b dungeon_flags1@level_flags1; + +/** @var level_flags2; + * @brief Number + */ +extern u32b dungeon_flags2@level_flags2; + +/** @def MAX_HGT + * @note Maximum dungeon height in grids, must be a multiple of SCREEN_HGT, + * probably hard-coded to SCREEN_HGT * 3. + */ +#define MAX_HGT 66 + + +/** @def MAX_WID + * @note Maximum dungeon width in grids, must be a multiple of SCREEN_WID, + * probably hard-coded to SCREEN_WID * 3. + */ +#define MAX_WID 198 + + +/** @name Town Defines + * @{ */ + +/** @def TOWN_RANDOM + * @note First random town + */ +#define TOWN_RANDOM 20 + +/** @def TOWN_DUNGEON + * @note Maximun number of towns per dungeon + */ +#define TOWN_DUNGEON 4 + +/** @def TOWN_CHANCE + * @note Chance of 1 town + */ +#define TOWN_CHANCE 50 + +/** @} */ + +/** @name Wilderness Terrains + * @{ + */ + +/** @def TERRAIN_EDGE + * @note Edge of the World + */ +#define TERRAIN_EDGE 0 + +/** @def TERRAIN_TOWN + * @note Town + */ +#define TERRAIN_TOWN 1 + +/** @def TERRAIN_DEEP_WATER + * @note Deep water + */ +#define TERRAIN_DEEP_WATER 2 + +/** @def TERRAIN_SHALLOW_WATER + * @note Shallow water + */ +#define TERRAIN_SHALLOW_WATER 3 + +/** @def TERRAIN_SWAMP + * @note Swamp + */ +#define TERRAIN_SWAMP 4 + +/** @def TERRAIN_DIRT + * @note Dirt + */ +#define TERRAIN_DIRT 5 + +/** @def TERRAIN_GRASS + * @note Grass + */ +#define TERRAIN_GRASS 6 + +/** @def TERRAIN_TREES + * @note Trees + */ +#define TERRAIN_TREES 7 + +/** @def TERRAIN_DESERT + * @note Desert + */ +#define TERRAIN_DESERT 8 + +/** @def TERRAIN_SHALLOW_LAVA + * @note Shallow lava + */ +#define TERRAIN_SHALLOW_LAVA 9 + +/** @def TERRAIN_DEEP_LAVA + * @note Deep lava + */ +#define TERRAIN_DEEP_LAVA 10 + +/** @def TERRAIN_MOUNTAIN + * @note Mountain + */ +#define TERRAIN_MOUNTAIN 11 + +/** @def MAX_WILD_TERRAIN */ +#define MAX_WILD_TERRAIN 18 +/** @} */ + +/** @struct border_type + * @note Border + */ +struct border_type +{ + /** @structvar north[MAX_WID] + * @brief Number + */ + byte north[MAX_WID]; + + /** @structvar south[MAX_WID] + * @brief Number + */ + byte south[MAX_WID]; + + /** @structvar east[MAX_HGT] + * @brief Number + */ + byte east[MAX_HGT]; + + /** @structvar west[MAX_HGT] + * @brief Number + */ + byte west[MAX_HGT]; + + /** @structvar north_west + * @brief Number + */ + byte north_west; + + /** @structvar north_east + * @brief Number + */ + byte north_east; + + /** @structvar south_west + * @brief Number + */ + byte south_west; + + /** @structvar south_east + * @brief Number + */ + byte south_east; +}; + + +/** @struct wilderness_type_info + * @note A structure describing a wilderness area + * with a terrain, a town or a dungeon entrance + */ +struct wilderness_type_info +{ + /** @structvar name + * @brief Number + * @note Name (offset) + */ + u32b name; + + /** @structvar text + * @brief Number + * @note Text (offset) + */ + u32b text; + + /** @structvar entrance + * @brief Number + * @note Which town is there(<1000 i's a town, >=1000 it a dungeon) + */ + u16b entrance; + + /** @structvar road + * @brief Number + * @note Flags of road + */ + byte road; + + /** @structvar level + * @brief Number + * @note Difficulty level + */ + int level; + + /** @structvar flags1 + * @brief Number + * @note Some flags + */ + u32b flags1; + + /** @structvar feat + * @brief Number + * @note The feature of f_info.txt that is used to allow passing, ... and to get a char/color/graph + */ + byte feat; + + /** @structvar terrain_idx + * @brief Number + * @note Terrain index(defined in defines.h) + */ + byte terrain_idx; + + /** @structvar terrain[MAX_WILD_TERRAIN] + * @brief Number + * @note Feature types for the plasma generator + */ + byte terrain[MAX_WILD_TERRAIN]; +}; + +/** @struct wilderness_map + * @note A structure describing a wilderness map + */ +struct wilderness_map +{ + /** @structvar feat + * @brief Number + * @note Wilderness feature + */ + int feat; + + /** @structvar seed + * @brief Number + * @note Seed for the RNG + */ + u32b seed; + + /** @structvar entrance + * @brief Number + * @note Entrance for dungeons + */ + u16b entrance; + + /** @structvar known + * @brief Boolean + * @note Is it seen by the player ? + */ + bool known; +}; + + +/** @struct town_type + * @note A structure describing a town with + * stores and buildings + */ +struct town_type +{ + /** @structvar name + * @brief String + */ + cptr name; + + /** @structvar seed + * @brief Number + * @note Seed for RNG + */ + u32b seed; + + /** @structvar *store + * @brief store_type + * @note The stores [max_st_idx] + */ + store_type store[max_st_idx]; + + /** @structvar numstores + * @brief Number + */ + byte numstores; + + /** @structvar flags + * @brief Number + * @note Town flags + */ + byte flags; + + /** @structvar stocked + * @brief Boolean + * @note Is the town actually stocked ? + * Left this for the sake of compatibility + */ + bool stocked; + + /** @structvar destroyed + * @brief Boolean + * @note Is the town destroyed? + */ + bool destroyed; +}; + +/** @var max_towns + * @brief Number + */ +extern u16b max_towns; + +/** @var town_info[max_towns] + * @brief town_type + */ +extern town_type town_info[max_towns]; + +/** @struct rule_type + * Define monster generation rules + */ +struct rule_type +{ + /** @structvar mode + * @brief Number + * @note Mode of combination of the monster flags + */ + byte mode; + + /** @structvar percent + * @brief Number + * @note Percent of monsters affected by the rule + */ + byte percent; + + /** @structvar mflags1 + * @brief Number + * @note The monster flags that are allowed + */ + u32b mflags1; + + /** @structvar mflags2 + * @brief Number + */ + u32b mflags2; + + /** @structvar mflags3 + * @brief Number + */ + u32b mflags3; + + /** @structvar mflags4 + * @brief Number + */ + u32b mflags4; + + /** @structvar mflags5 + * @brief Number + */ + u32b mflags5; + + /** @structvar mflags6 + * @brief Number + */ + u32b mflags6; + + /** @structvar mflags7 + * @brief Number + */ + u32b mflags7; + + /** @structvar mflags8 + * @brief Number + */ + u32b mflags8; + + /** @structvar mflags9 + * @brief Number + */ + u32b mflags9; + + /** @structvar r_char[5] + * @brief String + * @note Monster race allowed + */ + char r_char[5]; +}; + +/** @struct obj_theme + * @brief "Themed" objects. + * @note Probability in percent for each class of objects to be dropped. + * This could perhaps be an array - but that wouldn't be as clear. + */ +struct obj_theme +{ + /** @structvar treasure + * @brief Number + */ + byte treasure; + + /** @structvar combat + * @brief Number + */ + byte combat; + + /** @structvar magic + * @brief Number + */ + byte magic; + + /** @structvar tools + * @brief Number + */ + byte tools; +}; + +/** @struct dungeon_info_type + * A structure for the != dungeon types + */ +struct dungeon_info_type +{ + /** @structvar name + * @brief Number + * @note Name + */ + u32b name; + + /** @structvar text + * @brief Number + * @note Description + */ + u32b text; + + /** @structvar short_name[3] + * @brief String + * @note Short name + */ + char short_name[3]; + + /** @structvar floor1 + * @brief Number + * @note Floor tile 1 + */ + s16b floor1; + + /** @structvar floor_percent1[2] + * @brief Number + * @note Chance of type 1 + */ + byte floor_percent1[2]; + + /** @structvar floor2 + * @brief Number + * @note Floor tile 2 + */ + s16b floor2; + + /** @structvar floor_percent2[2] + * @brief Number + * @note Chance of type 2 + */ + byte floor_percent2[2]; + + /** @structvar floor3 + * @brief Number + * @note Floor tile 3 + */ + s16b floor3; + + /** @structvar floor_percent3[2] + * @brief Number + * @note Chance of type 3 + */ + byte floor_percent3[2]; + + /** @structvar outer_wall + * @brief Number + * @note Outer wall tile + */ + s16b outer_wall; + + /** @structvar inner_wall + * @brief Number + * @note Inner wall tile + */ + s16b inner_wall; + + /** @structvar fill_type1 + * @brief Number + * @note Cave tile 1 + */ + s16b fill_type1; + + /** @structvar fill_percent1[2] + * @brief Number + * @note Chance of type 1 + */ + byte fill_percent1[2]; + + /** @structvar fill_type2 + * @brief Number + * @note Cave tile 2 + */ + s16b fill_type2; + + /** @structvar fill_percent2[2] + * @brief Number + * @note Chance of type 2 + */ + byte fill_percent2[2]; + + /** @structvar fill_type3 + * @brief Number + * @note Cave tile 3 + */ + s16b fill_type3; + + /** @structvar fill_percent3[2] + * @brief Number + * @note Chance of type 3 + */ + byte fill_percent3[2]; + + /** @structvar fill_method + * @brief Number + * @note Smoothing parameter for the above + */ + byte fill_method; + + /** @structvar mindepth + * @brief Number + * @note Minimal depth + */ + s16b mindepth; + + /** @structvar maxdepth + * @brief Number + * @note Maximal depth + */ + s16b maxdepth; + + /** @structvar principal + * @brief Boolean + * @note If it's a part of the main dungeon + */ + bool principal; + + /** @structvar next + * @brief Number + * @note The next part of the main dungeon + */ + byte next; + + /** @structvar min_plev + * @brief Number + * @note Minimal plev needed to enter -- it's an anti-cheating mesure + */ + byte min_plev; + + /** @structvar min_m_alloc_level + * @brief Number + * @note Minimal number of monsters per level + */ + int min_m_alloc_level; + + /** @structvar max_m_alloc_chance + * @brief Number + * @note There is a 1/max_m_alloc_chance chance per round of creating a new monster + */ + int max_m_alloc_chance; + + /** @structvar flags1 + * @brief Number + * @note Flags 1 + */ + u32b flags1; + + /** @structvar flags2 + * @brief Number + * @note Flags 1 + */ + u32b flags2; + + /** @structvar size_x + * @brief Number + */ + int size_x; + + /** @structvar size_y + * @brief Number + * @note Desired numers of panels + */ + int size_y; + + /** @structvar rule_percents[100] + * @brief Number + * @note Flat rule percents + */ + byte rule_percents[100]; + + /** @structvar rules[5] + * @brief rule_type + * @note Monster generation rules + */ + rule_type rules[5]; + + /** @structvar final_object + * @brief Number + * @note The object you'll find at the bottom + */ + int final_object; + + /** @structvar final_artifact + * @brief Number + * @note The artifact you'll find at the bottom + */ + int final_artifact; + + /** @structvar final_guardian + * @brief Number + * @note The artifact's guardian. If an artifact is specified, then it's NEEDED + */ + int final_guardian; + + /** @structvar ix + * @brief Number + */ + int ix; + + /** @structvar iy + * @brief Number + */ + int iy; + + /** @structvar ox + * @brief Number + */ + int ox; + + /** @structvar oy + * @brief Number + * @note Wilderness coordinates of the entrance/output of the dungeon + */ + int oy; + + /** @structvar objs + * @brief obj_theme + * @note The drops type + */ + obj_theme objs; + + /** @structvar d_dice[4] + * @brief Number + * @note Number of dices + */ + int d_dice[4]; + + /** @structvar d_side[4] + * @brief Number + * @note Number of sides + */ + int d_side[4]; + + /** @structvar d_frequency[4] + * @brief Number + * @note Frequency of damage (1 is the minimum) + */ + int d_frequency[4]; + + /** @structvar d_type[4] + * @brief Number + * @note Type of damage + */ + int d_type[4]; + + /** @structvar t_idx[TOWN_DUNGEON] + * @brief Number + * @note The towns + */ + s16b t_idx[TOWN_DUNGEON]; + + /** @structvar t_level[TOWN_DUNGEON] + * @brief Number + * @note The towns levels + */ + s16b t_level[TOWN_DUNGEON]; + + /** @structvar t_num + * @brief Number + * @note Number of towns + */ + s16b t_num; +}; + +/** @var max_d_idx + * @brief Number + */ +extern u16b max_d_idx; + +/** @var d_info[max_d_idx] + * @brief dungeon_info_type + */ +extern dungeon_info_type d_info[max_d_idx]; + +/** @var *d_name + * @brief String + */ +extern char *d_name; + +/** @var *d_text + * @brief String + */ +extern char *d_text; + +/** @var max_wild_x + * @brief Number + */ +extern u16b max_wild_x; + +/** @var max_wild_y + * @brief Number + */ +extern u16b max_wild_y; + +/** @var max_wf_idx + * @brief Number + */ +extern u16b max_wf_idx; + +/** @var wf_info[max_wf_idx] + * @brief wilderness_type_info + */ +extern wilderness_type_info wf_info[max_wf_idx]; + +/** @var *wf_name + * @brief String + */ +extern char *wf_name; + +/** @var *wf_text + * @brief String + */ +extern char *wf_text; + +/** @var DUNGEON_DEATH + * @brief Number + */ +extern s32b DUNGEON_DEATH; + +/** @var current_dungeon_idx; + * @brief Number + */ +extern byte dungeon_type@current_dungeon_idx; + +/* + * tolua doesnt like wierd arraysn, I'll use accessing functions + * extern wilderness_map wild_map[max_wild_y][max_wild_x]; + */ +$static wilderness_map* lua_get_wild_map(int y, int x) { return &wild_map[y][x]; } + +/** @fn wild_map(int y, int x); + * @brief Return a map of the wilderness at coordinate (y,x).\n + * @param y Number \n y coordinate of wilderness map + * @brief Y-coordinate + * @param x Number \n x coordinate of wilderness map + * @brief X-coordinate + * @return wilderness_map \n map of wilderness at coordinate (y,x) + * @note (see file w_dun.c) + */ +wilderness_map* lua_get_wild_map@wild_map(int y, int x); + +/** @fn place_trap(int y, int x) + * @brief Place a random trap at the given location.\n + * @param y Number \n y coordinate of dungeon + * @brief Y-coordinate + * @param x Number \n x coordinate of dungeon + * @brief X-coordinate + * @note + * Places a random trap at the given location.\n + * The location must be a valid, empty, clean, floor grid. + * @note (see file traps.c) + */ +extern void place_trap(int y, int x); + +/** @fn place_floor(int y, int x) + * @brief Place floor terrain at (y, x).\n + * @param y Number \n y coordinate of dungeon + * @brief Y-coordinate + * @param x Number \n x coordinate of dungeon + * @brief X-coordinate + * @note + * Place floor terrain at (y, x) according to dungeon info. + * @note (see file cave.c) + */ +extern void place_floor(int y, int x); + +/** @fn place_filler(int y, int x) + * @brief Place a cave filler at (y, x).\n + * @param y Number \n y coordinate of dungeon + * @brief Y-coordinate + * @param x Number \n x coordinate of dungeon + * @brief X-coordinate + * @note (see file generate.c) + */ +extern void place_filler(int y, int x); + +/** @fn add_scripted_generator(cptr name, bool stairs, bool monsters, bool objects, bool miscs) + * @dgonly + * @param name String \n Name of generator + * @param stairs Boolean \n TRUE if stairs can be generated, otherwise FALSE + * @param monsters Boolean \n TRUE if monsters can be generated, otherwise FALSE + * @param objects Boolean \n TRUE if objects can be generated, otherwise FALSE + * @param miscs Boolean \n TRUE if other stuff can be generated, otherwise FALSE + * @note (defined in file lua_bind.c) + */ +extern void add_scripted_generator(cptr name, bool stairs, bool monsters, bool objects, bool miscs); + +/** @fn new_player_spot(int branch) + * @brief Places player in a new location.\n + * @param branch Number \n branch is the dungeon branch (if any). + * @brief Dungeon branch + * @return Boolean \n TRUE if player was placed successfully, otherwise FALSE. + * The global values py and px are updated. + * @note + * Up to 5000 attempts are made to place the player in the dungeon. The grid + * must be a naked floor and not an anti-teleport grid. In some circumstances + * stairs or ways in/out may be created under the player. + * @note (see file generate.c) + */ +extern bool new_player_spot(int branch); + +/** @fn get_level_desc(char *buf) + * @brief Return the special level desc.\n + * @param *buf String + * @brief Description + * @return *buf String \n The level description + * @return Boolean \n TRUE if a level description was returned, otherwise FALSE + * @note + * This is the 'D' line in the dngn files. + * @note (see file levels.c) + */ +extern bool get_level_desc(char *buf); + +/** @fn get_level_flags() + * These are the 'F' lines in the dngn files. + * @note (see file levels.c) + */ +extern void get_level_flags(); + +/** @fn get_dungeon_name(char *buf) + * @brief Return the special level name.\n + * @param *buf String + * @brief Name + * @return *buf String \n The level name + * @return Boolean \n TRUE if a level name was returned, otherwise FALSE + * @note + * This is the 'N' line in the dngn files. + * @note (see file levels.c) + */ +extern bool get_dungeon_name(char *buf); + +/** @fn get_dungeon_special(char *buf) + * @brief Return the map filename.\n + * @param *buf String + * @brief Map filename + * @return *buf String \n The map filename + * @return Boolean \n TRUE if a map filename was returned, otherwise FALSE + * @note + * This is the 'S' line in the dngn files. + * @note (see file levels.c) + */ +extern bool get_dungeon_special(char *buf); + +/** @fn get_command(const char *file, char comm, char *param) + * @brief Return the parameter of command "comm" in file "*file".\n + * @param *file String \n name of the dungeon file. + * @brief Dungeon file + * @param comm String \n The command \n + * 'A' = father branch, 'B' = branch, 'D' = desccription, 'L' = father level, + * 'N' = name, 'S' = savefile extension, 'U' = map filename + * @brief Command + * @param *param String + * @brief Parameter + * @return *param String \n The result of the command + * @return Boolean \n TRUE if a result is returned, otherwise FALSE + * @note (see file levels.c) + */ +extern bool get_command(const char *file, char comm, char *param); + +/** @fn get_branch() + * @brief return the dungeon branch starting form the current dungeon/level. + * @return Number \n The branch + * @note + * This is the 'B' line in the dngn files. + * @note (see file levels.c) + */ +extern int get_branch(); + +/** @fn get_fbranch() + * @brief Return the father dungeon branch. + * @return Number \n The father branch + * @note + * This is the 'A' line in the dngn files. + * @note (see file levels.c) + */ +extern int get_fbranch(); + +/** @fn get_flevel() + * @brief Return the father dungeon level. + * @return Number \n The father level + * @note + * This is the 'L' line in the dngn files. + * @note (see file levels.c) + */ +extern int get_flevel(); + +/** @fn get_dungeon_save(char *buf) + * @brief Return the extension of the savefile for the level.\n + * @param *buf String + * @brief Savefile extension + * @return *buf String \n The savefile extension + * @return Boolean \n TRUE if a savefile extension was returned, otherwise FALSE + * This is the 'S' line in the dngn files. + * @note (see file levels.c) + */ +extern bool get_dungeon_save(char *buf); diff --git a/PKGS/monster.pkg b/PKGS/monster.pkg new file mode 100644 index 0000000..a9efd08 --- /dev/null +++ b/PKGS/monster.pkg @@ -0,0 +1,2324 @@ +/* File: monster.pkg */ + +/* + * Purpose: Lua interface defitions for monsters. + * To be processed by tolua to generate C source code. + */ + +$#include "angband.h" + +/** @typedef cptr + * @note String + */ +typedef char* cptr; +/** @typedef errr + * @note Number + */ +typedef int errr; +/** @typedef bool + * @note Boolean + */ +typedef unsigned char bool; +/** @typedef byte + * @note Number + */ +typedef unsigned char byte; +/** @typedef s16b + * @note Number + */ +typedef signed short s16b; +/** @typedef u16b + * @note Number + */ +typedef unsigned short u16b; +/** @typedef s32b + * @note Number + */ +typedef signed int s32b; +/** @typedef u32b + * @note Number + */ +typedef unsigned int u32b; + +/* To make easy object creations */ +$static monster_type lua_monster_forge; +/** @var monster_forge; + * @brief monster_type + */ +static monster_type lua_monster_forge @ monster_forge; + +/** @name Monster status + * @note Player POV + * @{ */ +/** @def MSTATUS_ENEMY */ +#define MSTATUS_ENEMY -2 + +/** @def MSTATUS_NEUTRAL_M */ +#define MSTATUS_NEUTRAL_M -1 + +/** @def MSTATUS_NEUTRAL */ +#define MSTATUS_NEUTRAL 0 + +/** @def MSTATUS_NEUTRAL_P */ +#define MSTATUS_NEUTRAL_P 1 + +/** @def MSTATUS_FRIEND */ +#define MSTATUS_FRIEND 2 + +/** @def MSTATUS_PET */ +#define MSTATUS_PET 3 + +/** @def MSTATUS_COMPANION */ +#define MSTATUS_COMPANION 4 +/** @} */ + +/** @name Race flags #1 + * @{ */ +/** @def RF1_UNIQUE + * @note Unique Monster + */ +#define RF1_UNIQUE 0x00000001 +/** @def RF1_QUESTOR + * @note Quest Monster + */ +#define RF1_QUESTOR 0x00000002 +/** @def RF1_MALE + * @note Male gender + */ +#define RF1_MALE 0x00000004 +/** @def RF1_FEMALE + * @note Female gender + */ +#define RF1_FEMALE 0x00000008 +/** @def RF1_CHAR_CLEAR + * @note Absorbs symbol + */ +#define RF1_CHAR_CLEAR 0x00000010 +/** @def RF1_CHAR_MULTI + * @note Changes symbol + */ +#define RF1_CHAR_MULTI 0x00000020 +/** @def RF1_ATTR_CLEAR + * @note Absorbs color + */ +#define RF1_ATTR_CLEAR 0x00000040 +/** @def RF1_ATTR_MULTI + * @note Changes color + */ +#define RF1_ATTR_MULTI 0x00000080 +/** @def RF1_FORCE_DEPTH + * @note Start at "correct" depth + */ +#define RF1_FORCE_DEPTH 0x00000100 +/** @def RF1_FORCE_MAXHP + * @note Start with max hitpoints + */ +#define RF1_FORCE_MAXHP 0x00000200 +/** @def RF1_FORCE_SLEEP + * @note Start out sleeping + */ +#define RF1_FORCE_SLEEP 0x00000400 +/** @def RF1_FORCE_EXTRA + * @note Start out something + */ +#define RF1_FORCE_EXTRA 0x00000800 +/** @def RF1_FRIEND + * @note Arrive with a friend + */ +#define RF1_FRIEND 0x00001000 +/** @def RF1_FRIENDS + * @note Arrive with some friends + */ +#define RF1_FRIENDS 0x00002000 +/** @def RF1_ESCORT + * @note Arrive with an escort + */ +#define RF1_ESCORT 0x00004000 +/** @def RF1_ESCORTS + * @note Arrive with some escorts + */ +#define RF1_ESCORTS 0x00008000 +/** @def RF1_NEVER_BLOW + * @note Never make physical blow + */ +#define RF1_NEVER_BLOW 0x00010000 +/** @def RF1_NEVER_MOVE + * @note Never make physical move + */ +#define RF1_NEVER_MOVE 0x00020000 +/** @def RF1_RAND_25 + * @note Moves randomly (25%) + */ +#define RF1_RAND_25 0x00040000 +/** @def RF1_RAND_50 + * @note Moves randomly (50%) + */ +#define RF1_RAND_50 0x00080000 +/** @def RF1_ONLY_GOLD + * @note Drop only gold + */ +#define RF1_ONLY_GOLD 0x00100000 +/** @def RF1_ONLY_ITEM + * @note Drop only items + */ +#define RF1_ONLY_ITEM 0x00200000 +/** @def RF1_DROP_60 + * @note Drop an item/gold (60%) + */ +#define RF1_DROP_60 0x00400000 +/** @def RF1_DROP_90 + * @note Drop an item/gold (90%) + */ +#define RF1_DROP_90 0x00800000 +/** @def RF1_DROP_1D2 + * @note Drop 1d2 items/gold + */ +#define RF1_DROP_1D2 0x01000000 +/** @def RF1_DROP_2D2 + * @note Drop 2d2 items/gold + */ +#define RF1_DROP_2D2 0x02000000 +/** @def RF1_DROP_3D2 + * @note Drop 3d2 items/gold + */ +#define RF1_DROP_3D2 0x04000000 +/** @def RF1_DROP_4D2 + * @note Drop 4d2 items/gold + */ +#define RF1_DROP_4D2 0x08000000 +/** @def RF1_DROP_GOOD + * @note Drop good items + */ +#define RF1_DROP_GOOD 0x10000000 +/** @def RF1_DROP_GREAT + * @note Drop great items + */ +#define RF1_DROP_GREAT 0x20000000 +/** @def RF1_DROP_USEFUL + * @note Drop "useful" items + */ +#define RF1_DROP_USEFUL 0x40000000 +/** @def RF1_DROP_CHOSEN + * @note Drop "chosen" items + */ +#define RF1_DROP_CHOSEN 0x80000000 +/** @} */ + +/** @name Race flags #2 + * @note New monster race bit flags + * @{ */ +/** @def RF2_STUPID + * @note Monster is stupid + */ +#define RF2_STUPID 0x00000001 +/** @def RF2_SMART + * @note Monster is smart + */ +#define RF2_SMART 0x00000002 +/** @def RF2_CAN_SPEAK + * @note TY: can speak + */ +#define RF2_CAN_SPEAK 0x00000004 +/** @def RF2_REFLECTING + * @note Reflects bolts + */ +#define RF2_REFLECTING 0x00000008 +/** @def RF2_INVISIBLE + * @note Monster avoids vision + */ +#define RF2_INVISIBLE 0x00000010 +/** @def RF2_COLD_BLOOD + * @note Monster avoids infra + */ +#define RF2_COLD_BLOOD 0x00000020 +/** @def RF2_EMPTY_MIND + * @note Monster avoids telepathy + */ +#define RF2_EMPTY_MIND 0x00000040 +/** @def RF2_WEIRD_MIND + * @note Monster avoids telepathy? + */ +#define RF2_WEIRD_MIND 0x00000080 +/** @def RF2_DEATH_ORB + * @note Death Orb + */ +#define RF2_DEATH_ORB 0x00000100 +/** @def RF2_REGENERATE + * @note Monster regenerates + */ +#define RF2_REGENERATE 0x00000200 +/** @def RF2_SHAPECHANGER + * @note TY: shapechanger + */ +#define RF2_SHAPECHANGER 0x00000400 +/** @def RF2_ATTR_ANY + * @note TY: Attr_any + */ +#define RF2_ATTR_ANY 0x00000800 +/** @def RF2_POWERFUL + * @note Monster has strong breath + */ +#define RF2_POWERFUL 0x00001000 +/** @def RF2_ELDRITCH_HORROR + * @note Sanity-blasting horror + */ +#define RF2_ELDRITCH_HORROR 0x00002000 +/** @def RF2_AURA_FIRE + * @note Burns in melee + */ +#define RF2_AURA_FIRE 0x00004000 +/** @def RF2_AURA_ELEC + * @note Shocks in melee + */ +#define RF2_AURA_ELEC 0x00008000 +/** @def RF2_OPEN_DOOR + * @note Monster can open doors + */ +#define RF2_OPEN_DOOR 0x00010000 +/** @def RF2_BASH_DOOR + * @note Monster can bash doors + */ +#define RF2_BASH_DOOR 0x00020000 +/** @def RF2_PASS_WALL + * @note Monster can pass walls + */ +#define RF2_PASS_WALL 0x00040000 +/** @def RF2_KILL_WALL + * @note Monster can destroy walls + */ +#define RF2_KILL_WALL 0x00080000 +/** @def RF2_MOVE_BODY + * @note Monster can move monsters + */ +#define RF2_MOVE_BODY 0x00100000 +/** @def RF2_KILL_BODY + * @note Monster can kill monsters + */ +#define RF2_KILL_BODY 0x00200000 +/** @def RF2_TAKE_ITEM + * @note Monster can pick up items + */ +#define RF2_TAKE_ITEM 0x00400000 +/** @def RF2_KILL_ITEM + * @note Monster can crush items + */ +#define RF2_KILL_ITEM 0x00800000 +/** @def RF2_BRAIN_1 */ +#define RF2_BRAIN_1 0x01000000 + +/** @def RF2_BRAIN_2 */ +#define RF2_BRAIN_2 0x02000000 + +/** @def RF2_BRAIN_3 */ +#define RF2_BRAIN_3 0x04000000 + +/** @def RF2_BRAIN_4 */ +#define RF2_BRAIN_4 0x08000000 + +/** @def RF2_BRAIN_5 */ +#define RF2_BRAIN_5 0x10000000 + +/** @def RF2_BRAIN_6 */ +#define RF2_BRAIN_6 0x20000000 + +/** @def RF2_BRAIN_7 */ +#define RF2_BRAIN_7 0x40000000 + +/** @def RF2_BRAIN_8 */ +#define RF2_BRAIN_8 0x80000000 +/** @} */ + +/** @name Race flags #3 + * @note New monster race bit flags + * @{ */ +/** @def RF3_ORC + * @note Orc + */ +#define RF3_ORC 0x00000001 +/** @def RF3_TROLL + * @note Troll + */ +#define RF3_TROLL 0x00000002 +/** @def RF3_GIANT + * @note Giant + */ +#define RF3_GIANT 0x00000004 +/** @def RF3_DRAGON + * @note Dragon + */ +#define RF3_DRAGON 0x00000008 +/** @def RF3_DEMON + * @note Demon + */ +#define RF3_DEMON 0x00000010 +/** @def RF3_UNDEAD + * @note Undead + */ +#define RF3_UNDEAD 0x00000020 +/** @def RF3_EVIL + * @note Evil + */ +#define RF3_EVIL 0x00000040 +/** @def RF3_ANIMAL + * @note Animal + */ +#define RF3_ANIMAL 0x00000080 +/** @def RF3_THUNDERLORD + * @note DG: Thunderlord + */ +#define RF3_THUNDERLORD 0x00000100 +/** @def RF3_GOOD + * @note Good + */ +#define RF3_GOOD 0x00000200 +/** @def RF3_AURA_COLD + * @note Freezes in melee + */ +#define RF3_AURA_COLD 0x00000400 +/** @def RF3_NONLIVING + * @note TY: Non-Living (?) + */ +#define RF3_NONLIVING 0x00000800 +/** @def RF3_HURT_LITE + * @note Hurt by lite + */ +#define RF3_HURT_LITE 0x00001000 +/** @def RF3_HURT_ROCK + * @note Hurt by rock remover + */ +#define RF3_HURT_ROCK 0x00002000 +/** @def RF3_SUSCEP_FIRE + * @note Hurt badly by fire + */ +#define RF3_SUSCEP_FIRE 0x00004000 +/** @def RF3_SUSCEP_COLD + * @note Hurt badly by cold + */ +#define RF3_SUSCEP_COLD 0x00008000 +/** @def RF3_IM_ACID + * @note Resist acid a lot + */ +#define RF3_IM_ACID 0x00010000 +/** @def RF3_IM_ELEC + * @note Resist elec a lot + */ +#define RF3_IM_ELEC 0x00020000 +/** @def RF3_IM_FIRE + * @note Resist fire a lot + */ +#define RF3_IM_FIRE 0x00040000 +/** @def RF3_IM_COLD + * @note Resist cold a lot + */ +#define RF3_IM_COLD 0x00080000 +/** @def RF3_IM_POIS + * @note Resist poison a lot + */ +#define RF3_IM_POIS 0x00100000 +/** @def RF3_RES_TELE + * @note Resist teleportation + */ +#define RF3_RES_TELE 0x00200000 +/** @def RF3_RES_NETH + * @note Resist nether a lot + */ +#define RF3_RES_NETH 0x00400000 +/** @def RF3_RES_WATE + * @note Resist water + */ +#define RF3_RES_WATE 0x00800000 +/** @def RF3_RES_PLAS + * @note Resist plasma + */ +#define RF3_RES_PLAS 0x01000000 +/** @def RF3_RES_NEXU + * @note Resist nexus + */ +#define RF3_RES_NEXU 0x02000000 +/** @def RF3_RES_DISE + * @note Resist disenchantment + */ +#define RF3_RES_DISE 0x04000000 +/** @def RF3_UNIQUE_4 + * @note Is a "Nazgul" unique + */ +#define RF3_UNIQUE_4 0x08000000 +/** @def RF3_NO_FEAR + * @note Cannot be scared + */ +#define RF3_NO_FEAR 0x10000000 +/** @def RF3_NO_STUN + * @note Cannot be stunned + */ +#define RF3_NO_STUN 0x20000000 +/** @def RF3_NO_CONF + * @note Cannot be confused + */ +#define RF3_NO_CONF 0x40000000 +/** @def RF3_NO_SLEEP + * @note Cannot be slept + */ +#define RF3_NO_SLEEP 0x80000000 +/** @} */ + +/** @name Race flags #4 + * @note New monster race bit flags + * @{ */ +/** @def RF4_SHRIEK + * @note Shriek for help + */ +#define RF4_SHRIEK 0x00000001 +/** @def RF4_MULTIPLY + * @note Monster reproduces + */ +#define RF4_MULTIPLY 0x00000002 +/** @def RF4_S_ANIMAL + * @note Summon animals + */ +#define RF4_S_ANIMAL 0x00000004 +/** @def RF4_ROCKET + * @note TY: Rocket + */ +#define RF4_ROCKET 0x00000008 +/** @def RF4_ARROW_1 + * @note Fire an arrow (light) + */ +#define RF4_ARROW_1 0x00000010 +/** @def RF4_ARROW_2 + * @note Fire an arrow (heavy) + */ +#define RF4_ARROW_2 0x00000020 +/** @def RF4_ARROW_3 + * @note Fire missiles (light) + */ +#define RF4_ARROW_3 0x00000040 +/** @def RF4_ARROW_4 + * @note Fire missiles (heavy) + */ +#define RF4_ARROW_4 0x00000080 +/** @def RF4_BR_ACID + * @note Breathe Acid + */ +#define RF4_BR_ACID 0x00000100 +/** @def RF4_BR_ELEC + * @note Breathe Elec + */ +#define RF4_BR_ELEC 0x00000200 +/** @def RF4_BR_FIRE + * @note Breathe Fire + */ +#define RF4_BR_FIRE 0x00000400 +/** @def RF4_BR_COLD + * @note Breathe Cold + */ +#define RF4_BR_COLD 0x00000800 +/** @def RF4_BR_POIS + * @note Breathe Poison + */ +#define RF4_BR_POIS 0x00001000 +/** @def RF4_BR_NETH + * @note Breathe Nether + */ +#define RF4_BR_NETH 0x00002000 +/** @def RF4_BR_LITE + * @note Breathe Lite + */ +#define RF4_BR_LITE 0x00004000 +/** @def RF4_BR_DARK + * @note Breathe Dark + */ +#define RF4_BR_DARK 0x00008000 +/** @def RF4_BR_CONF + * @note Breathe Confusion + */ +#define RF4_BR_CONF 0x00010000 +/** @def RF4_BR_SOUN + * @note Breathe Sound + */ +#define RF4_BR_SOUN 0x00020000 +/** @def RF4_BR_CHAO + * @note Breathe Chaos + */ +#define RF4_BR_CHAO 0x00040000 +/** @def RF4_BR_DISE + * @note Breathe Disenchant + */ +#define RF4_BR_DISE 0x00080000 +/** @def RF4_BR_NEXU + * @note Breathe Nexus + */ +#define RF4_BR_NEXU 0x00100000 +/** @def RF4_BR_TIME + * @note Breathe Time + */ +#define RF4_BR_TIME 0x00200000 +/** @def RF4_BR_INER + * @note Breathe Inertia + */ +#define RF4_BR_INER 0x00400000 +/** @def RF4_BR_GRAV + * @note Breathe Gravity + */ +#define RF4_BR_GRAV 0x00800000 +/** @def RF4_BR_SHAR + * @note Breathe Shards + */ +#define RF4_BR_SHAR 0x01000000 +/** @def RF4_BR_PLAS + * @note Breathe Plasma + */ +#define RF4_BR_PLAS 0x02000000 +/** @def RF4_BR_WALL + * @note Breathe Force + */ +#define RF4_BR_WALL 0x04000000 +/** @def RF4_BR_MANA + * @note Breathe Mana + */ +#define RF4_BR_MANA 0x08000000 +/** @def RF4_BA_NUKE + * @note TY: Nuke Ball + */ +#define RF4_BA_NUKE 0x10000000 +/** @def RF4_BR_NUKE + * @note TY: Toxic Breath + */ +#define RF4_BR_NUKE 0x20000000 +/** @def RF4_BA_CHAO + * @note Chaos Ball + */ +#define RF4_BA_CHAO 0x40000000 +/** @def RF4_BR_DISI + * @note Breathe Disintegration + */ +#define RF4_BR_DISI 0x80000000 +/** @} */ + +/** @name Race flags #5 + * @note New monster race bit flags + * @{ */ +/** @def RF5_BA_ACID + * @note Acid Ball + */ +#define RF5_BA_ACID 0x00000001 +/** @def RF5_BA_ELEC + * @note Elec Ball + */ +#define RF5_BA_ELEC 0x00000002 +/** @def RF5_BA_FIRE + * @note Fire Ball + */ +#define RF5_BA_FIRE 0x00000004 +/** @def RF5_BA_COLD + * @note Cold Ball + */ +#define RF5_BA_COLD 0x00000008 +/** @def RF5_BA_POIS + * @note Poison Ball + */ +#define RF5_BA_POIS 0x00000010 +/** @def RF5_BA_NETH + * @note Nether Ball + */ +#define RF5_BA_NETH 0x00000020 +/** @def RF5_BA_WATE + * @note Water Ball + */ +#define RF5_BA_WATE 0x00000040 +/** @def RF5_BA_MANA + * @note Mana Storm + */ +#define RF5_BA_MANA 0x00000080 +/** @def RF5_BA_DARK + * @note Darkness Storm + */ +#define RF5_BA_DARK 0x00000100 +/** @def RF5_DRAIN_MANA + * @note Drain Mana + */ +#define RF5_DRAIN_MANA 0x00000200 +/** @def RF5_MIND_BLAST + * @note Blast Mind + */ +#define RF5_MIND_BLAST 0x00000400 +/** @def RF5_BRAIN_SMASH + * @note Smash Brain + */ +#define RF5_BRAIN_SMASH 0x00000800 +/** @def RF5_CAUSE_1 + * @note Cause Light Wound + */ +#define RF5_CAUSE_1 0x00001000 +/** @def RF5_CAUSE_2 + * @note Cause Serious Wound + */ +#define RF5_CAUSE_2 0x00002000 +/** @def RF5_CAUSE_3 + * @note Cause Critical Wound + */ +#define RF5_CAUSE_3 0x00004000 +/** @def RF5_CAUSE_4 + * @note Cause Mortal Wound + */ +#define RF5_CAUSE_4 0x00008000 +/** @def RF5_BO_ACID + * @note Acid Bolt + */ +#define RF5_BO_ACID 0x00010000 +/** @def RF5_BO_ELEC + * @note Elec Bolt (unused) + */ +#define RF5_BO_ELEC 0x00020000 +/** @def RF5_BO_FIRE + * @note Fire Bolt + */ +#define RF5_BO_FIRE 0x00040000 +/** @def RF5_BO_COLD + * @note Cold Bolt + */ +#define RF5_BO_COLD 0x00080000 +/** @def RF5_BO_POIS + * @note Poison Bolt (unused) + */ +#define RF5_BO_POIS 0x00100000 +/** @def RF5_BO_NETH + * @note Nether Bolt + */ +#define RF5_BO_NETH 0x00200000 +/** @def RF5_BO_WATE + * @note Water Bolt + */ +#define RF5_BO_WATE 0x00400000 +/** @def RF5_BO_MANA + * @note Mana Bolt + */ +#define RF5_BO_MANA 0x00800000 +/** @def RF5_BO_PLAS + * @note Plasma Bolt + */ +#define RF5_BO_PLAS 0x01000000 +/** @def RF5_BO_ICEE + * @note Ice Bolt + */ +#define RF5_BO_ICEE 0x02000000 +/** @def RF5_MISSILE + * @note Magic Missile + */ +#define RF5_MISSILE 0x04000000 +/** @def RF5_SCARE + * @note Frighten Player + */ +#define RF5_SCARE 0x08000000 +/** @def RF5_BLIND + * @note Blind Player + */ +#define RF5_BLIND 0x10000000 +/** @def RF5_CONF + * @note Confuse Player + */ +#define RF5_CONF 0x20000000 +/** @def RF5_SLOW + * @note Slow Player + */ +#define RF5_SLOW 0x40000000 +/** @def RF5_HOLD + * @note Paralyze Player + */ +#define RF5_HOLD 0x80000000 +/** @} */ + +/** @name Race flags #6 + * @note New monster race bit flags + * @{ */ +/** @def RF6_HASTE + * @note Speed self + */ +#define RF6_HASTE 0x00000001 +/** @def RF6_HAND_DOOM + * @note Hand of Doom + */ +#define RF6_HAND_DOOM 0x00000002 +/** @def RF6_HEAL + * @note Heal self + */ +#define RF6_HEAL 0x00000004 +/** @def RF6_S_ANIMALS + * @note Summon animals + */ +#define RF6_S_ANIMALS 0x00000008 +/** @def RF6_BLINK + * @note Teleport Short + */ +#define RF6_BLINK 0x00000010 +/** @def RF6_TPORT + * @note Teleport Long + */ +#define RF6_TPORT 0x00000020 +/** @def RF6_TELE_TO + * @note Move player to monster + */ +#define RF6_TELE_TO 0x00000040 +/** @def RF6_TELE_AWAY + * @note Move player far away + */ +#define RF6_TELE_AWAY 0x00000080 +/** @def RF6_TELE_LEVEL + * @note Move player vertically + */ +#define RF6_TELE_LEVEL 0x00000100 +/** @def RF6_DARKNESS + * @note Create Darkness + */ +#define RF6_DARKNESS 0x00000200 +/** @def RF6_TRAPS + * @note Create Traps + */ +#define RF6_TRAPS 0x00000400 +/** @def RF6_FORGET + * @note Cause amnesia + */ +#define RF6_FORGET 0x00000800 +/** @def RF6_RAISE_DEAD + * @note Raise Dead + */ +#define RF6_RAISE_DEAD 0x00001000 +/** @def RF6_S_BUG + * @note Summon Software bug + */ +#define RF6_S_BUG 0x00002000 +/** @def RF6_S_RNG + * @note Summon RNG + */ +#define RF6_S_RNG 0x00004000 +/** @def RF6_S_THUNDERLORD + * @note Summon Thunderlords + */ +#define RF6_S_THUNDERLORD 0x00008000 +/** @def RF6_S_KIN + * @note Summon "kin" + */ +#define RF6_S_KIN 0x00010000 +/** @def RF6_S_HI_DEMON + * @note Summon greater demons! + */ +#define RF6_S_HI_DEMON 0x00020000 +/** @def RF6_S_MONSTER + * @note Summon Monster + */ +#define RF6_S_MONSTER 0x00040000 +/** @def RF6_S_MONSTERS + * @note Summon Monsters + */ +#define RF6_S_MONSTERS 0x00080000 +/** @def RF6_S_ANT + * @note Summon Ants + */ +#define RF6_S_ANT 0x00100000 +/** @def RF6_S_SPIDER + * @note Summon Spiders + */ +#define RF6_S_SPIDER 0x00200000 +/** @def RF6_S_HOUND + * @note Summon Hounds + */ +#define RF6_S_HOUND 0x00400000 +/** @def RF6_S_HYDRA + * @note Summon Hydras + */ +#define RF6_S_HYDRA 0x00800000 +/** @def RF6_S_ANGEL + * @note Summon Angel + */ +#define RF6_S_ANGEL 0x01000000 +/** @def RF6_S_DEMON + * @note Summon Demon + */ +#define RF6_S_DEMON 0x02000000 +/** @def RF6_S_UNDEAD + * @note Summon Undead + */ +#define RF6_S_UNDEAD 0x04000000 +/** @def RF6_S_DRAGON + * @note Summon Dragon + */ +#define RF6_S_DRAGON 0x08000000 +/** @def RF6_S_HI_UNDEAD + * @note Summon Greater Undead + */ +#define RF6_S_HI_UNDEAD 0x10000000 +/** @def RF6_S_HI_DRAGON + * @note Summon Ancient Dragon + */ +#define RF6_S_HI_DRAGON 0x20000000 +/** @def RF6_S_WRAITH + * @note Summon Unique Wraith + */ +#define RF6_S_WRAITH 0x40000000 +/** @def RF6_S_UNIQUE + * @note Summon Unique Monster + */ +#define RF6_S_UNIQUE 0x80000000 +/** @} */ + +/** @name Race flags #7 + * @note New monster race bit flags + * @{ */ +/** @def RF7_AQUATIC + * @note Aquatic monster + */ +#define RF7_AQUATIC 0x00000001 +/** @def RF7_CAN_SWIM + * @note Monster can swim + */ +#define RF7_CAN_SWIM 0x00000002 +/** @def RF7_CAN_FLY + * @note Monster can fly + */ +#define RF7_CAN_FLY 0x00000004 +/** @def RF7_FRIENDLY + * @note Monster is friendly + */ +#define RF7_FRIENDLY 0x00000008 +/** @def RF7_PET + * @note Monster is a pet + */ +#define RF7_PET 0x00000010 +/** @def RF7_MORTAL + * @note Monster is a mortal being + */ +#define RF7_MORTAL 0x00000020 +/** @def RF7_SPIDER + * @note Monster is a spider (can pass webs) + */ +#define RF7_SPIDER 0x00000040 +/** @def RF7_NAZGUL + * @note Monster is a Nazgul + */ +#define RF7_NAZGUL 0x00000080 +/** @def RF7_DG_CURSE + * @note If killed the monster grant a DG Curse to the player + */ +#define RF7_DG_CURSE 0x00000100 +/** @def RF7_POSSESSOR + * @note Is it a dreaded possessor monster ? + */ +#define RF7_POSSESSOR 0x00000200 +/** @def RF7_NO_DEATH + * @note Cannot be killed + */ +#define RF7_NO_DEATH 0x00000400 +/** @def RF7_NO_TARGET + * @note Cannot be targeted + */ +#define RF7_NO_TARGET 0x00000800 +/** @def RF7_AI_ANNOY + * @note Try to tease the player + */ +#define RF7_AI_ANNOY 0x00001000 +/** @def RF7_AI_SPECIAL + * @note For quests + */ +#define RF7_AI_SPECIAL 0x00002000 +/** @def RF7_NO_THEFT + * @note Monster is immune to theft + */ +#define RF7_NO_THEFT 0x00040000 +/** @def RF7_SPIRIT + * @note This is a Spirit, coming from the Void + */ +#define RF7_SPIRIT 0x00080000 +/** @def RF7_IM_MELEE + * @note IM melee + */ +#define RF7_IM_MELEE 0x00100000 +/** @} */ + +/** @name Race flags #8 + * @note New monster race bit flags + * @{ */ +/** @def RF8_DUNGEON */ +#define RF8_DUNGEON 0x00000001 + +/** @def RF8_WILD_TOWN */ +#define RF8_WILD_TOWN 0x00000002 + +/** @def RF8_XXX8X02 */ +#define RF8_XXX8X02 0x00000004 + +/** @def RF8_WILD_SHORE */ +#define RF8_WILD_SHORE 0x00000008 + +/** @def RF8_WILD_OCEAN */ +#define RF8_WILD_OCEAN 0x00000010 + +/** @def RF8_WILD_WASTE */ +#define RF8_WILD_WASTE 0x00000020 + +/** @def RF8_WILD_WOOD */ +#define RF8_WILD_WOOD 0x00000040 + +/** @def RF8_WILD_VOLCANO */ +#define RF8_WILD_VOLCANO 0x00000080 + +/** @def RF8_XXX8X08 */ +#define RF8_XXX8X08 0x00000100 + +/** @def RF8_WILD_MOUNTAIN */ +#define RF8_WILD_MOUNTAIN 0x00000200 + +/** @def RF8_WILD_GRASS */ +#define RF8_WILD_GRASS 0x00000400 + +/********* FREE *********/ +/** @def RF8_CTHANGBAND */ +#define RF8_CTHANGBAND 0x00001000 + +/********* FREE *********/ +/** @def RF8_ZANGBAND */ +#define RF8_ZANGBAND 0x00004000 + +/** @def RF8_JOKEANGBAND */ +#define RF8_JOKEANGBAND 0x00008000 + +/** @def RF8_ANGBAND */ +#define RF8_ANGBAND 0x00010000 + + +/** @def RF8_WILD_TOO */ +#define RF8_WILD_TOO 0x80000000 +/** @} */ + +/** @name Race flags #9 + * @note New monster race bit flags + * @{ */ +/** @def RF9_DROP_CORPSE */ +#define RF9_DROP_CORPSE 0x00000001 + +/** @def RF9_DROP_SKELETON */ +#define RF9_DROP_SKELETON 0x00000002 + +/** @def RF9_HAS_LITE + * @note Carries a lite + */ +#define RF9_HAS_LITE 0x00000004 +/** @def RF9_MIMIC + * @note *REALLY* looks like an object ... only nastier + */ +#define RF9_MIMIC 0x00000008 +/** @def RF9_HAS_EGG + * @note Can be monster's eggs + */ +#define RF9_HAS_EGG 0x00000010 +/** @def RF9_IMPRESED + * @note The monster can follow you on each level until he dies + */ +#define RF9_IMPRESED 0x00000020 +/** @def RF9_SUSCEP_ACID + * @note Susceptible to acid + */ +#define RF9_SUSCEP_ACID 0x00000040 +/** @def RF9_SUSCEP_ELEC + * @note Susceptible to lightning + */ +#define RF9_SUSCEP_ELEC 0x00000080 +/** @def RF9_SUSCEP_POIS + * @note Susceptible to poison + */ +#define RF9_SUSCEP_POIS 0x00000100 +/** @def RF9_KILL_TREES + * @note Monster can eat trees + */ +#define RF9_KILL_TREES 0x00000200 +/** @def RF9_WYRM_PROTECT + * @note The monster is protected by great wyrms of power: They'll be summoned if it's killed + */ +#define RF9_WYRM_PROTECT 0x00000400 +/** @def RF9_DOPPLEGANGER + * @note The monster looks like you + */ +#define RF9_DOPPLEGANGER 0x00000800 +/** @def RF9_ONLY_DEPTH + * @note The monster can only be generated at the GIVEN depth + */ +#define RF9_ONLY_DEPTH 0x00001000 +/** @def RF9_SPECIAL_GENE + * @note The monster can only be generated in special conditions like quests, special dungeons, ... + */ +#define RF9_SPECIAL_GENE 0x00002000 +/** @def RF9_NEVER_GENE + * @note The monster cannot be normaly generated + */ +#define RF9_NEVER_GENE 0x00004000 +/** @} */ + +/** @name Monster flags + * @{ */ +/** @def MFLAG_VIEW + * @note Monster is in line of sight + */ +#define MFLAG_VIEW 0x00000001 +/** @def MFLAG_QUEST + * @note Monster is subject to a quest + */ +#define MFLAG_QUEST 0x00000002 +/** @def MFLAG_PARTIAL + * @note Monster is a partial summon + */ +#define MFLAG_PARTIAL 0x00000004 +/** @def MFLAG_CONTROL + * @note Monster is controlled + */ +#define MFLAG_CONTROL 0x00000008 +/** @def MFLAG_BORN + * @note Monster is still being born + */ +#define MFLAG_BORN 0x00000010 +/** @def MFLAG_NICE + * @note Monster is still being nice + */ +#define MFLAG_NICE 0x00000020 +/** @def MFLAG_SHOW + * @note Monster is recently memorized + */ +#define MFLAG_SHOW 0x00000040 +/** @def MFLAG_MARK + * @note Monster is currently memorized + */ +#define MFLAG_MARK 0x00000080 +/** @def MFLAG_NO_DROP + * @note Monster wont drop obj/corpse + */ +#define MFLAG_NO_DROP 0x00000100 +/** @def MFLAG_QUEST2 + * @note Monster is subject to a quest + */ +#define MFLAG_QUEST2 0x00000200 +/** @} */ + +/** @struct monster_blow + * @brief Monster blows (attacks) + */ +struct monster_blow +{ + /** @structvar method + * @brief Number + */ + byte method; + /** @structvar effect + * @brief Number + */ + byte effect; + /** @structvar d_dice + * @brief Number + */ + byte d_dice; + /** @structvar d_side + * @brief Number + */ + byte d_side; +}; + +/** @struct monster_race + * @brief Monster race + */ +struct monster_race +{ + /** @structvar name + * @brief Number + * @note Name (offset) + */ + u32b name; + /** @structvar text + * @brief Number + * @note Text (offset) + */ + u32b text; + + /** @structvar hdice + * @brief Number + * @note Creatures hit dice count + */ + byte hdice; + /** @structvar hside + * @brief Number + * @note Creatures hit dice sides + */ + byte hside; + + /** @structvar ac + * @brief Number + * @note Armour Class + */ + s16b ac; + + /** @structvar sleep + * @brief Number + * @note Inactive counter (base) + */ + s16b sleep; + /** @structvar aaf + * @brief Number + * @note Area affect radius (1-100) + */ + byte aaf; + /** @structvar speed + * @brief Number + * @note Speed (normally 110) + */ + byte speed; + + /** @structvar mexp + * @brief Number + * @note Exp value for kill + */ + s32b mexp; + + /** @structvar weight + * @brief Number + * @note Weight of the monster + */ + s32b weight; + + /** @structvar freq_inate + * @brief Number + * @note Inate spell frequency + */ + byte freq_inate; + /** @structvar freq_spell + * @brief Number + * @note Other spell frequency + */ + byte freq_spell; + + /** @structvar flags1 + * @brief Number + * @note Flags 1 (general) + */ + u32b flags1; + /** @structvar flags2 + * @brief Number + * @note Flags 2 (abilities) + */ + u32b flags2; + /** @structvar flags3 + * @brief Number + * @note Flags 3 (race/resist) + */ + u32b flags3; + /** @structvar flags4 + * @brief Number + * @note Flags 4 (inate/breath) + */ + u32b flags4; + /** @structvar flags5 + * @brief Number + * @note Flags 5 (normal spells) + */ + u32b flags5; + /** @structvar flags6 + * @brief Number + * @note Flags 6 (special spells) + */ + u32b flags6; + /** @structvar flags7 + * @brief Number + * @note Flags 7 (movement related abilities) + */ + u32b flags7; + /** @structvar flags8 + * @brief Number + * @note Flags 8 (wilderness info) + */ + u32b flags8; + /** @structvar flags9 + * @brief Number + * @note Flags 9 (drops info) + */ + u32b flags9; + + /** @structvar blow[4] + * @brief magic_power + * @note Up to four blows per round + */ + monster_blow blow[4]; + + /** @structvar body_parts[BODY_MAX] + * @brief Number + * @note To help to decide what to use when body changing + */ + byte body_parts[BODY_MAX]; + + /** @structvar level + * @brief Number + * @note Level of creature + */ + byte level; + /** @structvar rarity + * @brief Number + * @note Rarity of creature + */ + byte rarity; + + + /** @structvar d_attr + * @brief Number + * @note Default monster attribute + */ + byte d_attr; + /** @structvar d_char + * @brief String + * @note Default monster character + */ + char d_char; + + + /** @structvar x_attr + * @brief Number + * @note Desired monster attribute + */ + byte x_attr; + /** @structvar x_char + * @brief String + * @note Desired monster character + */ + char x_char; + + + /** @structvar max_num + * @brief Number + * @note Maximum population allowed per level + */ + s16b max_num; + + /** @structvar cur_num + * @brief Number + * @note Monster population on current level + */ + byte cur_num; + + + /** @structvar r_sights + * @brief Number + * @note Count sightings of this monster + */ + s16b r_sights; + /** @structvar r_deaths + * @brief Number + * @note Count deaths from this monster + */ + s16b r_deaths; + + /** @structvar r_pkills + * @brief Number + * @note Count monsters killed in this life + */ + s16b r_pkills; + /** @structvar r_tkills + * @brief Number + * @note Count monsters killed in all lives + */ + s16b r_tkills; + + /** @structvar r_wake + * @brief Number + * @note Number of times woken up (?) + */ + byte r_wake; + /** @structvar r_ignore + * @brief Number + * @note Number of times ignored (?) + */ + byte r_ignore; + + /** @structvar r_xtra1 + * @brief Number + * @note Something (unused) + */ + byte r_xtra1; + /** @structvar r_xtra2 + * @brief Number + * @note Something (unused) + */ + byte r_xtra2; + + /** @structvar r_drop_gold + * @brief Number + * @note Max number of gold dropped at once + */ + byte r_drop_gold; + /** @structvar r_drop_item + * @brief Number + * @note Max number of item dropped at once + */ + byte r_drop_item; + + /** @structvar r_cast_inate + * @brief Number + * @note Max number of inate spells seen + */ + byte r_cast_inate; + /** @structvar r_cast_spell + * @brief Number + * @note Max number of other spells seen + */ + byte r_cast_spell; + + /** @structvar r_blows[4] + * @brief Number + * @note Number of times each blow type was seen + */ + byte r_blows[4]; + + /** @structvar r_flags1 + * @brief Number + * @note Observed racial flags + */ + u32b r_flags1; + /** @structvar r_flags2 + * @brief Number + * @note Observed racial flags + */ + u32b r_flags2; + /** @structvar r_flags3 + * @brief Number + * @note Observed racial flags + */ + u32b r_flags3; + /** @structvar r_flags4 + * @brief Number + * @note Observed racial flags + */ + u32b r_flags4; + /** @structvar r_flags5 + * @brief Number + * @note Observed racial flags + */ + u32b r_flags5; + /** @structvar r_flags6 + * @brief Number + * @note Observed racial flags + */ + u32b r_flags6; + /** @structvar r_flags7 + * @brief Number + * @note Observed racial flags + */ + u32b r_flags7; + /** @structvar r_flags8 + * @brief Number + * @note Observed racial flags + */ + u32b r_flags8; + /** @structvar r_flags9 + * @brief Number + * @note Observed racial flags + */ + u32b r_flags9; + + /** @structvar on_saved + * @brief Boolean + * @note Is the (unique) on a saved level ? + */ + bool on_saved; + + /** @structvar total_visible + * @brief Number + * @note Amount of this race that are visible + */ + byte total_visible; + + /** @structvar drops + * @brief obj_theme + * @note The drops type + */ + obj_theme drops; +}; + +/** @struct monster_type + * @brief Monster type + */ +struct monster_type +{ + /** @structvar r_idx + * @brief Number + * @note Monster race index + */ + s16b r_idx; + + /** @structvar ego + * @brief Number + * @note Ego monster type + */ + u16b ego; + + /** @structvar fy + * @brief Number + * @note Y location on map + */ + byte fy; + /** @structvar fx + * @brief Number + * @note X location on map + */ + byte fx; + + /** @structvar hp + * @brief Number + * @note Current Hit points + */ + s16b hp; + /** @structvar maxhp + * @brief Number + * @note Max Hit points + */ + s16b maxhp; + + /** @structvar blow[4] + * @brief magic_power + * @note Up to four blows per round + */ + monster_blow blow[4]; + + /** @structvar speed + * @brief Number + * @note Speed (normally 110) + */ + byte speed; + /** @structvar level + * @brief Number + * @note Level of creature + */ + byte level; + /** @structvar ac + * @brief Number + * @note Armour Class + */ + s16b ac; + /** @structvar exp + * @brief Number + * @note Experience + */ + u32b exp; + + /** @structvar csleep + * @brief Number + * @note Inactive counter + */ + s16b csleep; + + /** @structvar mspeed + * @brief Number + * @note Monster "speed" + */ + byte mspeed; + /** @structvar energy + * @brief Number + * @note Monster "energy" + */ + byte energy; + + /** @structvar stunned + * @brief Number + * @note Monster is stunned + */ + byte stunned; + /** @structvar confused + * @brief Number + * @note Monster is confused + */ + byte confused; + /** @structvar monfear + * @brief Number + * @note Monster is afraid + */ + byte monfear; + + /** @structvar bleeding + * @brief Number + * @note Monster is bleeding + */ + s16b bleeding; + /** @structvar poisoned + * @brief Number + * @note Monster is poisoned + */ + s16b poisoned; + + /** @structvar cdis + * @brief Number + * @note Current dis from player + */ + byte cdis; + + /** @structvar mflag + * @brief Number + * @note Extra monster flags + */ + s32b mflag; + + /** @structvar ml + * @brief Boolean + * @note Monster is "visible" + */ + bool ml; + + /** @structvar hold_o_idx + * @brief Number + * @note Object being held (if any) + */ + s16b hold_o_idx; + + /** @structvar smart + * @brief Number + * @note Field for "smart_learn" + */ + u32b smart; + + /** @structvar status + * @brief Number + * @note Status(friendly, pet, companion, ..) + */ + s16b status; + + /** @structvar target + * @brief Number + * @note Monster target + */ + s16b target; + + /** @structvar possessor + * @brief Number + * @note Is it under the control of a possessor ? + */ + s16b possessor; +}; + +$static monster_type *lua_get_monster(int m_idx){return (&m_list[m_idx]);} +/** @fn monster(int m_idx); + * @brief Return the monster with index "m_idx" in the monster list.\n + * @param m_idx Number \n the index of the monster in the monster list + * @brief Monster index + * @return monster_type \n The monster. + * @note (see file w_mnster.c) + */ +static monster_type *lua_get_monster @ monster(int m_idx); + +/** @var m_list[max_m_idx] + * @brief monster_type + * @note List of monsters + */ +extern monster_type m_list[max_m_idx]; + +/** @fn race_info_idx(int r_idx, int ego) + * @brief Get monster info and ego info for monster with monster index "r_idx" + * and monster ego "ego".\n + * @param r_idx Number \n the index of the race in the monster race array + * @brief Race index + * @param ego Number \n the index of the ego in the monster ego array + * @brief Ego index + * @return monster_race \n The monster race. + * @note + * If "ego" > 0, the ego information is applied to the monster information and + * the new monster information is returned. + * @note + * For example, race_info_idx(141,7) will create a brown yeek (monster) + * shaman (ego). + * @note (see file monster2.c) + */ +extern monster_race* race_info_idx(int r_idx, int ego); + +/** @fn delete_monster_idx(int i) + * @brief Delete monster "i" from the monster array.\n + * @param i Number \n the index of the monster in the monster list + * @brief Monster index + * @note (see file monster2.c) + */ +extern void delete_monster_idx(int i); + +/** @fn m_pop(void) + * @brief Get an empty slot in the monster list. + * @return Number \n The index of an empty slot the monster list. + * @note + * If there are no empty slots, a slot will be reclaimed from a "dead" + * monster. If all slots are full, 0 is returned, which means the function + * has failed ("Too many monsters!"). + * @note (see file monster2.c) + */ +extern s16b m_pop(void); + +/** @fn get_mon_num_prep(void) + * @brief Apply a "monster restriction function" to the "monster allocation + * table". + * @return Number \n 0 (success) always. + * @note + * There are no parameters, but there are some other variables which will + * need to be set. They are get_mon_num_hook and get_mon_num2_hook. They + * are pointers to functions. + * @note + * For example, get_mon_num_hook = monster_volcano means when + * get_mon_num_hook is called (*get_mon_num_hook)(index), the actual + * function called is monster_volcano(index). This particular function + * returns TRUE if the monster indicated by "index" has the + * RF8_WILD_VOLCANO flag set. + * @note + * It is a good idea to store the old value of get_mon_num_hook before + * setting a new one, and restoring it when your function is finished. + * @note + * Following is a list of functions which can be assigned to + * get_mon_num_hook:\n + * create_molds_hook\n + * create_townpeople_hook\n + * mon_hook_bounty\n + * monster_dungeon\n + * monster_grass\n + * monster_mountain\n + * monster_ocean\n + * monster_quest\n + * monster_shore\n + * monster_town\n + * monster_volcano\n + * monster_waste\n + * monster_wood\n + * mutate_monster_okay\n + * place_monster_okay\n + * summon_specific_okay\n + * vault_aux_animal\n + * vault_aux_chapel\n + * vault_aux_clone\n + * vault_aux_demon\n + * vault_aux_dragon\n + * vault_aux_giant\n + * vault_aux_jelly\n + * vault_aux_kennel\n + * vault_aux_orc\n + * vault_aux_symbol\n + * vault_aux_treasure\n + * vault_aux_troll\n + * vault_aux_undead + * @note + * Or you can write your own. The function must take an integer (index) + * as a parameter and return boolean (TRUE if the monster is selected, + * or FALSE if it is not). + * @note (see file monster2.c) + */ +extern errr get_mon_num_prep(void); + +/** @fn get_mon_num(int level) + * @brief For the given level "level", return the index of an appropriate + * monster race.\n + * @param level Number \n a dungeon level (which is adjusted before + * it is used). + * @brief Dungeon level + * @return Number \n The index of a monster race in the monster race array. + * @note + * This function uses the "prob2" field of the "monster allocation table", + * and various local information, to calculate the "prob3" field of the + * same table, which is then used to choose an "appropriate" monster, in + * a relatively efficient manner. + * @note + * Note that "town" monsters will *only* be created in the town, and + * "normal" monsters will *never* be created in the town, unless the + * "level" is "modified", for example, by polymorph or summoning. + * @note + * There is a small chance (1/50) of "boosting" the given depth by + * a small amount (up to four levels), except in the town. + * @note + * It is (slightly) more likely to acquire a monster of the given level + * than one of a lower level. This is done by choosing several monsters + * appropriate to the given level and keeping the "hardest" one. + * @note + * Note that if no monsters are "appropriate", then this function will + * fail, and return zero, but this should *almost* never happen. + * @note (see file monster2.c) + */ +extern s16b get_mon_num(int level); + +$static char *lua_monster_desc(monster_type *m_ptr, int mode){static char buf[200]; monster_desc(buf, m_ptr, mode); return buf;} +/** @fn monster_desc(monster_type *m_ptr, int mode); + * @brief Return a monster description for monster "monster_type" using flag + * "mode".\n + * @param *m_ptr monster_type \n the monster + * @brief Monster + * @param mode Number \n description mode (see below) + * @brief Description mode + * @return String \n The description of the monster. + * @note + * We can correctly describe monsters based on their visibility.\n + * We can force all monsters to be treated as visible or invisible.\n + * We can build nominatives, objectives, possessives, or reflexives.\n + * We can selectively pronominalize hidden, visible, or all monsters.\n + * We can use definite or indefinite descriptions for hidden monsters.\n + * We can use definite or indefinite descriptions for visible monsters. + * @note + * Pronominalization involves the gender whenever possible and allowed, + * so that by cleverly requesting pronominalization / visibility, you + * can get messages like "You hit someone. She screams in agony!". + * @note + * Reflexives are acquired by requesting Objective plus Possessive. + * @note + * If no m_ptr arg is given (?), the monster is assumed to be hidden, + * unless the "Assume Visible" mode is requested. + * @note + * If no r_ptr arg is given, it is extracted from m_ptr and r_info + * If neither m_ptr nor r_ptr is given, the monster is assumed to + * be neuter, singular, and hidden (unless "Assume Visible" is set), + * in which case you may be in trouble... :-) + * @note + * I am assuming that no monster name is more than 70 characters long, + * so that "char desc[80];" is sufficiently large for any result. + * @note + * Mode Flags:\n + * 0x01 --> Objective (or Reflexive)\n + * 0x02 --> Possessive (or Reflexive)\n + * 0x04 --> Use indefinites for hidden monsters ("something")\n + * 0x08 --> Use indefinites for visible monsters ("a kobold")\n + * 0x10 --> Pronominalize hidden monsters\n + * 0x20 --> Pronominalize visible monsters\n + * 0x40 --> Assume the monster is hidden\n + * 0x80 --> Assume the monster is visible + * @note + * Useful Modes:\n + * 0x00 --> Full nominative name ("the kobold") or "it"\n + * 0x04 --> Full nominative name ("the kobold") or "something"\n + * 0x80 --> Genocide resistance name ("the kobold")\n + * 0x88 --> Killing name ("a kobold")\n + * 0x22 --> Possessive, genderized if visible ("his") or "its"\n + * 0x23 --> Reflexive, genderized if visible ("himself") or "itself" + * @note (see file monster2.c) + */ +static char *lua_monster_desc @ monster_desc(monster_type *m_ptr, int mode); + +$static char *lua_monster_race_desc(int r_idx, int ego){static char buf[200]; monster_race_desc(buf, r_idx, ego); return buf;} +/** @fn monster_race_desc(int r_idx, int ego); + * @brief Return the monster description for monster with monster index + * "r_idx" and monster ego "ego".\n + * @param r_idx Number \n the index of the race in the monster race array + * @brief Race index + * @param ego Number \n the index of the ego in the monster ego array + * @brief Ego index + * @return String \n The description of the monster race. + * @note + * The monster description is made up of the ego name (if any) and monster + * name, or the unique name. + * @note (see file w_mnster.c) + */ +static char *lua_monster_race_desc @ monster_race_desc(int r_idx, int ego); + +/** @fn monster_race_desc(char *desc, int r_idx, int ego) + * @brief Return the monster description "desc" for monster with monster index + * "r_idx" and monster ego "ego".\n + * @param *desc String + * @brief Description + * @param r_idx Number \n the index of the race in the monster race array + * @brief Race index + * @param ego Number \n the index of the ego in the monster ego array + * @brief Ego index + * @return *desc String \n The description of the monster race. + * @note + * The monster description is made up of the ego name (if any) and monster + * name, or the unique name. + * @note (see file monster2.c) + */ +extern void monster_race_desc(char *desc, int r_idx, int ego); + +/** @fn monster_carry(monster_type *m_ptr, int m_idx, object_type *q_ptr) + * @brief Allow monster "m_ptr" with monster index "m_idx" to carry object + * "q_ptr".\n + * @param *m_ptr monster_type \n the monster + * @brief Monster + * @param m_idx Number \n the index of the monster in the monster list + * @brief Monster index + * @param *q_ptr object_type \n the object + * @brief Object + * @note + * The monster can only carry the object if there is room for the object in the + * object list. + * @note (see file monster2.c) + */ +extern void monster_carry(monster_type *m_ptr, int m_idx, object_type *q_ptr); + +/** @fn place_monster_aux(int y, int x, int r_idx, bool slp, bool grp, int status) + * @brief Attempt to place a monster with monster race index "r_idx" and status + * "status" at grid "y", "x". The monster may be asleep ("slp") or surrounded + * by a group of identical monsters ("grp").\n + * @param y Number \n the y coordinate of the target grid + * @brief Y-coordinate + * @param x Number \n the x coordinate of the target grid + * @brief X-coordinate + * @param r_idx Number \n the index of the race in the monster race array + * @brief Race index + * @param slp Boolean \n TRUE if monster is asleep, otherwise FALSE + * @brief Asleep? + * @param grp Boolean \n TRUE if monster appears in a group, otherwise FALSE + * @brief Group? + * @param status Number \n the status of the monster from the player's point + * of view (see MSTATUS_foo flags) + * @brief Monster status + * @return Boolean \n TRUE if the monster is placed successfully, otherwise + * FALSE. + * @note + * Note that certain monsters are now marked as requiring "friends". + * These monsters, if successfully placed, and if the "grp" parameter + * is TRUE, will be surrounded by a "group" of identical monsters. + * @note + * Note that certain monsters are now marked as requiring an "escort", + * which is a collection of monsters with similar "race" but lower + * level. + * @note + * Some monsters induce a fake "group" flag on their escorts. + * @note + * Note the "bizarre" use of non-recursion to prevent annoying output + * when running a code profiler. + * @note + * Note the use of the new "monster allocation table" code to restrict + * the "get_mon_num()" function to "legal" escort types. + * @note (see file monster2.c) + */ +extern bool place_monster_aux(int y, int x, int r_idx, bool slp, bool grp, int status); + +/** @fn place_monster(int y, int x, bool slp, bool grp) + * @brief Attempt to place a monster at grid "y", "x". The monster may be + * asleep ("slp") or surrounded by a group of identical monsters ("grp").\n + * @param y Number \n the y coordinate of the target grid + * @brief Y-coordinate + * @param x Number \n the x coordinate of the target grid + * @brief X-coordinate + * @param slp Boolean \n TRUE if monster is asleep, otherwise FALSE + * @brief Asleep? + * @param grp Boolean \n TRUE if monster appears in a group, otherwise FALSE + * @brief Group? + * @return Boolean \n TRUE if the monster is placed successfully, otherwise + * FALSE. + * @note + * Attempt to find a monster appropriate to the "monster_level" + * @note (see file monster2.c) + */ +extern bool place_monster(int y, int x, bool slp, bool grp); + +/** @fn place_monster_one(int y, int x, int r_idx, int ego, bool slp, int status) + * @brief Attempt to place a monster with monster race index "r_idx", monster + * ego "ego" and status "status" at grid "y", "x". The monster may be asleep + * ("slp").\n + * @param y Number \n the y coordinate of the target grid + * @brief Y-coordinate + * @param x Number \n the x coordinate of the target grid + * @brief X-coordinate + * @param r_idx Number \n the index of the race in the monster race array + * @brief Race index + * @param ego Number \n the index of the ego in the monster ego array + * @brief Ego index + * @param slp Boolean \n TRUE if monster is asleep, otherwise FALSE + * @brief Asleep? + * @param status Number \n the status of the monster from the player's point + * of view (see MSTATUS_foo flags) + * @brief Monster status + * @return Number \n The index of the placed monster in the monster list. + * @note + * To give the player a sporting chance, any monster that appears in + * line-of-sight and is extremely dangerous can be marked as + * "FORCE_SLEEP", which will cause them to be placed with low energy, + * which often (but not always) lets the player move before they do. + * @note + * This routine refuses to place out-of-depth "FORCE_DEPTH" monsters. + * @note + * XXX XXX XXX Use special "here" and "dead" flags for unique monsters, + * remove old "cur_num" and "max_num" fields. + * @note + * XXX XXX XXX Actually, do something similar for artifacts, to simplify + * the "preserve" mode, and to make the "what artifacts" flag more useful. + * @note + * This is the only function which may place a monster in the dungeon, + * except for the savefile loading code. + * @note (see file monster2.c) + */ +extern s16b place_monster_one(int y, int x, int r_idx, int ego, bool slp, int status); + +/** @fn is_friend(monster_type *m_ptr) + * @brief Return a value to indicate the status of monster "m_ptr".\n + * @param *m_ptr monster_type \n the monster + * @brief Monster + * @return Number \n -1 if monster is an enemy, 0 if it is neutral, and 1 if + * it is friendly. + * @note (see file monster3.c) + */ +extern int is_friend(monster_type *m_ptr); + +/** @fn is_enemy(monster_type *m_ptr, monster_type *t_ptr) + * @brief Determine if monster "m_ptr" should attack monster "t_ptr".\n + * @param *m_ptr monster_type \n the monster + * @brief Monster + * @param *t_ptr monster_type \n the target monster + * @brief Target monster + * @return Boolean \n TRUE if monster "m_ptr" should attack monster "t_ptr", + * otherwise FALSE. + * @note + * If "m_ptr" is stupid and "r_ptr" is a different type of monster then the + * function will return TRUE.\n + * If "m_ptr" is not neutral and "r_ptr" is a breeder, and "r_ptr" is a + * different type of monster then the function will return TRUE (and vice + * versa).\n + * If both monsters are not neutral and one is friendly and the other isn't + * then the function will return TRUE. + * @note (see file monster3.c) + */ +extern bool is_enemy(monster_type *m_ptr, monster_type *t_ptr); + +/** @fn change_side(monster_type *m_ptr) + * @brief Change the status of monster "m_ptr" from friendly to unfriendly and + * vice versa. + * @param *m_ptr monster_type \n the monster + * @brief Monster + * @return Boolean \n TRUE if the status changed, otherwise FALSE. + * @note + * Friends and pets become enemies.\n + * Neutral monsters become neutral pets and vice versa.\n + * Companions are unaffected. + * @note (see file monster3.c) + */ +extern bool change_side(monster_type *m_ptr); + +/** @fn find_position(int y, int x, int *yy = 0, int *xx = 0) + * @brief Find a new grid "yy", "xx" within 6 grids of target grid "y", "x".\n + * @param y Number \n the y coordinate of the origin grid + * @brief Origin y-coordinate + * @param x Number \n the x coordinate of the origin grid + * @brief Origin x-coordinate + * @param yy Number \n the y coordinate of the target grid + * @brief Target y-coordinate + * @param xx Number \n the x coordinate of the target grid + * @brief Target x-coordinate + * @note + * The new grid must be within line-of-sight of the target grid. A + * maximum of 5000 attempts is made. + * @note (see file lua_bind.c) + */ +extern void find_position(int y, int x, int *yy = 0, int *xx = 0); + +/** @var summon_specific_level + * @brief Number + * @note + * Force summoned monsters to be at this level. + */ +extern int summon_specific_level; + +/** @var summon_kin_type + * @brief String + * @note + * The monster character for those monsters who can summon kin. + */ +extern char summon_kin_type; + +/** @fn summon_specific(int y1, int x1, int lev, int type) + * @brief Place a monster of type "type" near grid "y","x".\n + * @param y1 Number \n the y coordinate of the target grid + * @brief Y-coordinate + * @param x1 Number \n the x coordinate of the target grid + * @brief X-coordinate + * @param lev Number \n the monster level of the summoning monster + * @brief Summoner level + * @param type Number \n the type of summoned monster + * @brief Monster type + * @return Boolean \n TRUE if a monster was summoned, otherwise FALSE. + * @note + * We will attempt to place the monster up to 20 times before giving up. + * @note + * Note: SUMMON_UNIQUE and SUMMON_WRAITH (XXX) will summon Unique's\n + * Note: SUMMON_HI_UNDEAD and SUMMON_HI_DRAGON may summon Unique's\n + * Note: None of the other summon codes will ever summon Unique's. + * @note + * This function has been changed. We now take the "monster level" + * of the summoning monster as a parameter, and use that, along with + * the current dungeon level, to help determine the level of the + * desired monster. Note that this is an upper bound, and also + * tends to "prefer" monsters of that level. Currently, we use + * the average of the dungeon and monster levels, and then add + * five to allow slight increases in monster power. + * @note + * Note that we use the new "monster allocation table" creation code + * to restrict the "get_mon_num()" function to the set of "legal" + * monsters, making this function much faster and more reliable. + * @note + * Note that this function may not succeed, though this is very rare. + * @note (see file monster2.c) + */ +extern bool summon_specific(int y1, int x1, int lev, int type); + +/** @fn summon_specific_friendly(int y1, int x1, int lev, int type, bool Group_ok) + * @brief Place a friendly monster of type "type" near grid "y","x". The + * monster may be surrounded by a group of identical monsters ("Group_ok").\n + * @param y1 Number \n the y coordinate of the target grid + * @brief Y-coordinate + * @param x1 Number \n the x coordinate of the target grid + * @brief X-coordinate + * @param lev Number \n the monster level of the summoning monster + * @brief Summoner level + * @param type Number \n the type of summoned monster + * @brief Monster type + * @param Group_ok Boolean \n TRUE if monster appears in a group, otherwise + * FALSE + * @brief Group? + * @return Boolean \n TRUE if a monster was summoned, otherwise FALSE. + * @note (see file monster2.c) + */ +extern bool summon_specific_friendly(int y1, int x1, int lev, int type, bool Group_ok); + +/** @fn summon_monster_aux(int y, int x, int lev, bool friend, char *fct); + * @brief Place a monster near grid "y","x".\n + * @param y Number \n the y coordinate of the target grid + * @brief Y-coordinate + * @param x Number \n the x coordinate of the target grid + * @brief X-coordinate + * @param lev Number \n the monster level of the summoning monster + * @brief Summoner level + * @param friend Boolean \n TRUE if friendly monsters are to be summoned, + * otherwise FALSE + * @brief Friendly? + * @param *fct String \n the function which determines which type of monster + * will be summoned + * @brief Monster type function + * @return Boolean \n TRUE if a monster was summoned, otherwise FALSE. + * @note (see file w_mnster.c) + */ +extern bool lua_summon_monster @ summon_monster_aux(int y, int x, int lev, bool friend, char *fct); + +/** @fn can_create_companion() + * @brief Determine if a companion can be created. + * @return Boolean \n TRUE if a companion can be created, otherwise FALSE. + * @note + * The companions are counted. If this is less than the number allowed by + * the player monster lore skill, the function returns TRUE, otherwise the + * function returns FALSE. + * @note (see file monster3.c) + */ +extern bool can_create_companion(); + +/** @fn monster_set_level(int m_idx, int level) + * @brief Set a new level for monster with monster index "m_idx".\n + * @param m_idx Number \n the index of the monster in the monster list + * @brief Monster index + * @param level Number \n the new level of the monster + * @brief Monster level + * @note + * The new level can not exceed 150. If the new level is higher than the + * monster level, the monster experience value is recalculated. + * @note (see file monster2.c) + */ +extern void monster_set_level(int m_idx, int level); + +/** @name Summon types + * @note Legal restrictions for "summon_specific()" + */ +/** @def SUMMON_ANT + * @note Summon giant ant (a) excluding uniques. + */ +#define SUMMON_ANT 11 + +/** @def SUMMON_SPIDER + * @note Summon spider/scorpion/tick (S) excluding uniques. + */ +#define SUMMON_SPIDER 12 + +/** @def SUMMON_HOUND + * @note Summon canine (C) or zephyr hound (Z) excluding uniques. + */ +#define SUMMON_HOUND 13 + +/** @def SUMMON_HYDRA + * @note Summon multi-headed hydra (M) excluding uniques. + */ +#define SUMMON_HYDRA 14 + +/** @def SUMMON_ANGEL + * @note Summon angelic being (A) excluding uniques. + */ +#define SUMMON_ANGEL 15 + +/** @def SUMMON_DEMON + * @note Summon demon (RF3_DEMON) excluding uniques. + */ +#define SUMMON_DEMON 16 + +/** @def SUMMON_UNDEAD + * @note Summon undead (RF3_UNDEAD) excluding uniques. + */ +#define SUMMON_UNDEAD 17 + +/** @def SUMMON_DRAGON + * @note Summon dragon (RF3_DRAGON) excluding uniques. + */ +#define SUMMON_DRAGON 18 + +/** @def SUMMON_HI_UNDEAD + * @note Summon lich (L) or vampire (V) or wight/wraith (W) including uniques. + */ +#define SUMMON_HI_UNDEAD 21 + +/** @def SUMMON_HI_DRAGON + * @note Summon ancient dragon (D) including uniques. + */ +#define SUMMON_HI_DRAGON 22 + +/** @def SUMMON_WRAITH + * @note Summon wight/wraith (W) including uniques. + */ +#define SUMMON_WRAITH 31 + +/** @def SUMMON_UNIQUE + * @note Summon unique (RF1_UNIQUE). + */ +#define SUMMON_UNIQUE 32 + +/** @def SUMMON_BIZARRE1 + * @note Summon mold (m) excluding uniques. + */ +#define SUMMON_BIZARRE1 33 + +/** @def SUMMON_BIZARRE2 + * @note Summon giant bat (b) excluding uniques. + */ +#define SUMMON_BIZARRE2 34 + +/** @def SUMMON_BIZARRE3 + * @note Summon quylthulg (Q) excluding uniques. + */ +#define SUMMON_BIZARRE3 35 + +/** @def SUMMON_BIZARRE4 + * @note Summon vortex (v) excluding uniques. + */ +#define SUMMON_BIZARRE4 36 + +/** @def SUMMON_BIZARRE5 + * @note Summon creeping coins ($) excluding uniques. + */ +#define SUMMON_BIZARRE5 37 + +/** @def SUMMON_BIZARRE6 + * @note Summon mimic (!?=$|) excluding uniques. + */ +#define SUMMON_BIZARRE6 38 + +/** @def SUMMON_HI_DEMON + * @note Summon demon (RF3_DEMON) and major demon (U) excluding uniques. + */ +#define SUMMON_HI_DEMON 39 + +/** @def SUMMON_KIN + * @note Summon monster of the same character type excluding uniques. + */ +#define SUMMON_KIN 40 + +/** @def SUMMON_DAWN + * @note Summon monster with "the Dawn" in the name excluding uniques. + */ +#define SUMMON_DAWN 41 + +/** @def SUMMON_ANIMAL + * @note Summon animal (RF3_ANIMAL) excluding uniques. + */ +#define SUMMON_ANIMAL 42 + +/** @def SUMMON_ANIMAL_RANGER + * @note Summon animal (RF3_ANIMAL) and giant ant, giant bat, centipede, + * feline,giant louse, quadruped, rodent, worm or worm mass, bird, canine, + * insect, snake, killer beetle, multi-headed hydra, reptile/amphibian, + * spider/scorpion/tick (abcflqrwBCIJKMRS) and not dragon (RF3_DRAGON) and not + * evil (RF3_EVIL) and not undead (RF3_UNDEAD) and not demon (RF3_DEMON) and + * not inate/breath and not normal spells and not special spells excluding + * uniques. + */ +#define SUMMON_ANIMAL_RANGER 43 + +/** @def SUMMON_HI_UNDEAD_NO_UNIQUES + * @note Summon lich (L) or vampire (V) or wight/wraith (W) excluding uniques. + */ +#define SUMMON_HI_UNDEAD_NO_UNIQUES 44 + +/** @def SUMMON_HI_DRAGON_NO_UNIQUES + * @note Summon ancient dragon (D) excluding uniques. + */ +#define SUMMON_HI_DRAGON_NO_UNIQUES 45 + +/** @def SUMMON_NO_UNIQUES + * @note Summon non-uniques (not RF1_UNIQUE). + */ +#define SUMMON_NO_UNIQUES 46 + +/** @def SUMMON_PHANTOM + * @note Summon monster with "Phantom" in the name excluding uniques. + */ +#define SUMMON_PHANTOM 47 + +/** @def SUMMON_ELEMENTAL + * @note Summon monster with "lemental" in the name excluding uniques. + */ +#define SUMMON_ELEMENTAL 48 + +/** @def SUMMON_THUNDERLORD + * @note Summon thunderlords (RF3_THUNDERLORD) including uniques. + */ +#define SUMMON_THUNDERLORD 49 + +/** @def SUMMON_BLUE_HORROR + * @note Summon monster with "lue horror" in the name excluding uniques. + */ +#define SUMMON_BLUE_HORROR 50 + +/** @def SUMMON_BUG + * @note Summon monster with "Software bug" in the name excluding uniques. + */ +#define SUMMON_BUG 51 + +/** @def SUMMON_RNG + * @note Summon monster with "Random Number Generator" in the name excluding + * uniques. + */ +#define SUMMON_RNG 52 + +/** @def SUMMON_MINE + * @note Summon mines (RF1_NEVER_MOVE) including uniques. + */ +#define SUMMON_MINE 53 + +/** @def SUMMON_HUMAN + * @note Summon (p) excluding uniques. + */ +#define SUMMON_HUMAN 54 + +/** @def SUMMON_SHADOWS + * @note Summon ghost (G) excluding uniques. + */ +#define SUMMON_SHADOWS 55 + +/** @def SUMMON_GHOST + * @note Summon ghost (G) including uniques. + */ +#define SUMMON_GHOST 56 + +/** @def SUMMON_QUYLTHULG + * @note Summon (Q) excluding uniques. + */ +#define SUMMON_QUYLTHULG 57 + +/** @def SUMMON_LUA + * @note Summon monsters according to a Lua script. + */ +#define SUMMON_LUA 58 +/** @} */ + +/** @fn do_control_reconnect() + * @brief Find the controlled monster and reconnect to it. + * @return Boolean \n TRUE if there is a controlled monster, otherwise FALSE. + * @note + * The monster list is scanned for a monster with MFLAG_CONTROL. If it is + * found, the function returns TRUE. + * @note (see file monster3.c) + */ +extern bool do_control_reconnect(); + +/* monster thing */ +/** @var m_max + * @brief Number + * @note The number of monsters currently in the monster list. + */ +extern s16b m_max; diff --git a/PKGS/object.pkg b/PKGS/object.pkg new file mode 100644 index 0000000..0141b5f --- /dev/null +++ b/PKGS/object.pkg @@ -0,0 +1,1171 @@ +/* File: object.pkg */ + +/* + * Purpose: Lua interface defitions for objects. + * To be processed by tolua to generate C source code. + */ + +$#include "angband.h" + +typedef char* cptr; +typedef int errr; +typedef unsigned char bool; +typedef unsigned char byte; +typedef signed short s16b; +typedef unsigned short u16b; +typedef signed int s32b; +typedef unsigned int u32b; + +/* To make easy object creations */ +$static object_type lua_obj_forge; +static object_type lua_obj_forge @ obj_forge; +$static obj_theme lua_obj_theme; +static obj_theme lua_obj_theme @ theme_forge; + +#define TR1_STR 0x00000001L /* STR += "pval" */ +#define TR1_INT 0x00000002L /* INT += "pval" */ +#define TR1_WIS 0x00000004L /* WIS += "pval" */ +#define TR1_DEX 0x00000008L /* DEX += "pval" */ +#define TR1_CON 0x00000010L /* CON += "pval" */ +#define TR1_CHR 0x00000020L /* CHR += "pval" */ +#define TR1_MANA 0x00000040L /* Mana multipler */ +#define TR1_SPELL 0x00000080L /* Spell power increase */ +#define TR1_STEALTH 0x00000100L /* Stealth += "pval" */ +#define TR1_SEARCH 0x00000200L /* Search += "pval" */ +#define TR1_INFRA 0x00000400L /* Infra += "pval" */ +#define TR1_TUNNEL 0x00000800L /* Tunnel += "pval" */ +#define TR1_SPEED 0x00001000L /* Speed += "pval" */ +#define TR1_BLOWS 0x00002000L /* Blows += "pval" */ +#define TR1_CHAOTIC 0x00004000L +#define TR1_VAMPIRIC 0x00008000L +#define TR1_SLAY_ANIMAL 0x00010000L +#define TR1_SLAY_EVIL 0x00020000L +#define TR1_SLAY_UNDEAD 0x00040000L +#define TR1_SLAY_DEMON 0x00080000L +#define TR1_SLAY_ORC 0x00100000L +#define TR1_SLAY_TROLL 0x00200000L +#define TR1_SLAY_GIANT 0x00400000L +#define TR1_SLAY_DRAGON 0x00800000L +#define TR1_KILL_DRAGON 0x01000000L /* Execute Dragon */ +#define TR1_VORPAL 0x02000000L /* Later */ +#define TR1_IMPACT 0x04000000L /* Cause Earthquakes */ +#define TR1_BRAND_POIS 0x08000000L +#define TR1_BRAND_ACID 0x10000000L +#define TR1_BRAND_ELEC 0x20000000L +#define TR1_BRAND_FIRE 0x40000000L +#define TR1_BRAND_COLD 0x80000000L +#define TR1_NULL_MASK 0x00000000L + +#define TR2_SUST_STR 0x00000001L +#define TR2_SUST_INT 0x00000002L +#define TR2_SUST_WIS 0x00000004L +#define TR2_SUST_DEX 0x00000008L +#define TR2_SUST_CON 0x00000010L +#define TR2_SUST_CHR 0x00000020L +#define TR2_INVIS 0x00000040L /* Invisibility */ +#define TR2_LIFE 0x00000080L /* Life multiplier */ +#define TR2_IM_ACID 0x00000100L +#define TR2_IM_ELEC 0x00000200L +#define TR2_IM_FIRE 0x00000400L +#define TR2_IM_COLD 0x00000800L +#define TR2_SENS_FIRE 0x00001000L /* Sensibility to fire */ +#define TR2_REFLECT 0x00002000L /* Reflect 'bolts' */ +#define TR2_FREE_ACT 0x00004000L /* Free Action */ +#define TR2_HOLD_LIFE 0x00008000L /* Hold Life */ +#define TR2_RES_ACID 0x00010000L +#define TR2_RES_ELEC 0x00020000L +#define TR2_RES_FIRE 0x00040000L +#define TR2_RES_COLD 0x00080000L +#define TR2_RES_POIS 0x00100000L +#define TR2_RES_FEAR 0x00200000L +#define TR2_RES_LITE 0x00400000L +#define TR2_RES_DARK 0x00800000L +#define TR2_RES_BLIND 0x01000000L +#define TR2_RES_CONF 0x02000000L +#define TR2_RES_SOUND 0x04000000L +#define TR2_RES_SHARDS 0x08000000L +#define TR2_RES_NETHER 0x10000000L +#define TR2_RES_NEXUS 0x20000000L +#define TR2_RES_CHAOS 0x40000000L +#define TR2_RES_DISEN 0x80000000L +#define TR2_NULL_MASK 0x00000000L + +#define TR3_SH_FIRE 0x00000001L /* Immolation (Fire) */ +#define TR3_SH_ELEC 0x00000002L /* Electric Sheath */ +#define TR3_AUTO_CURSE 0x00000004L /* The obj will recurse itself */ +#define TR3_DECAY 0x00000008L /* Decay */ +#define TR3_NO_TELE 0x00000010L /* Anti-teleportation */ +#define TR3_NO_MAGIC 0x00000020L /* Anti-magic */ +#define TR3_WRAITH 0x00000040L /* Wraithform */ +#define TR3_TY_CURSE 0x00000080L /* The Ancient Curse */ +#define TR3_EASY_KNOW 0x00000100L /* Aware -> Known */ +#define TR3_HIDE_TYPE 0x00000200L /* Hide "pval" description */ +#define TR3_SHOW_MODS 0x00000400L /* Always show Tohit/Todam */ +#define TR3_INSTA_ART 0x00000800L /* Item must be an artifact */ +#define TR3_FEATHER 0x00001000L /* Feather Falling */ +#define TR3_LITE1 0x00002000L /* lite radius 1 */ +#define TR3_SEE_INVIS 0x00004000L /* See Invisible */ +#define TR3_NORM_ART 0x00008000L /* Artifact in k_info */ +#define TR3_SLOW_DIGEST 0x00010000L /* Item slows down digestion */ +#define TR3_REGEN 0x00020000L /* Item induces regeneration */ +#define TR3_XTRA_MIGHT 0x00040000L /* Bows get extra multiplier */ +#define TR3_XTRA_SHOTS 0x00080000L /* Bows get extra shots */ +#define TR3_IGNORE_ACID 0x00100000L /* Item ignores Acid Damage */ +#define TR3_IGNORE_ELEC 0x00200000L /* Item ignores Elec Damage */ +#define TR3_IGNORE_FIRE 0x00400000L /* Item ignores Fire Damage */ +#define TR3_IGNORE_COLD 0x00800000L /* Item ignores Cold Damage */ +#define TR3_ACTIVATE 0x01000000L /* Item can be activated */ +#define TR3_DRAIN_EXP 0x02000000L /* Item drains Experience */ +#define TR3_TELEPORT 0x04000000L /* Item teleports player */ +#define TR3_AGGRAVATE 0x08000000L /* Item aggravates monsters */ +#define TR3_BLESSED 0x10000000L /* Item is Blessed */ +#define TR3_CURSED 0x20000000L /* Item is Cursed */ +#define TR3_HEAVY_CURSE 0x40000000L /* Item is Heavily Cursed */ +#define TR3_PERMA_CURSE 0x80000000L /* Item is Perma Cursed */ +#define TR3_NULL_MASK 0x00000000L + +#define TR4_NEVER_BLOW 0x00000001L /* Weapon can't attack */ +#define TR4_PRECOGNITION 0x00000002L /* Like activating the cheat mode */ +#define TR4_BLACK_BREATH 0x00000004L /* Tolkien's Black Breath */ +#define TR4_RECHARGE 0x00000008L /* For artifact Wands and Staffs */ +#define TR4_FLY 0x00000010L /* This one and ONLY this one allow you to fly over trees */ +#define TR4_DG_CURSE 0x00000020L /* The Ancient Morgothian Curse */ +#define TR4_COULD2H 0x00000040L /* Can wield it 2 Handed */ +#define TR4_MUST2H 0x00000080L /* Must wield it 2 Handed */ +#define TR4_LEVELS 0x00000100L /* Can gain exp/exp levels !! */ +#define TR4_CLONE 0x00000200L /* Can clone monsters */ +#define TR4_SPECIAL_GENE 0x00000400L /* The object can only be generated in special conditions like quests, special dungeons, ... */ +#define TR4_CLIMB 0x00000800L /* Allow climbing mountains */ +#define TR4_FAST_CAST 0x00001000L /* Rod is x2 time faster to use */ +#define TR4_CAPACITY 0x00002000L /* Rod can take x2 mana */ +#define TR4_CHARGING 0x00004000L /* Rod recharge faster */ +#define TR4_CHEAPNESS 0x00008000L /* Rod spells are cheaper(in mana cost) to cast */ +#define TR4_FOUNTAIN 0x00010000L /* Available as fountain (for potions) */ +#define TR4_ANTIMAGIC_50 0x00020000L /* Forbid magic */ +#define TR4_ANTIMAGIC_30 0x00040000L /* Forbid magic */ +#define TR4_ANTIMAGIC_20 0x00080000L /* Forbid magic */ +#define TR4_ANTIMAGIC_10 0x00100000L /* Forbid magic */ +#define TR4_EASY_USE 0x00200000L /* Easily activable */ +#define TR4_IM_NETHER 0x00400000L /* Immunity to nether */ +#define TR4_RECHARGED 0x00800000L /* Object has been recharged once */ +#define TR4_ULTIMATE 0x01000000L /* ULTIMATE artifact */ +#define TR4_AUTO_ID 0x02000000L /* Id stuff on floor */ +#define TR4_LITE2 0x04000000L /* lite radius 2 */ +#define TR4_LITE3 0x08000000L /* lite radius 3 */ +#define TR4_FUEL_LITE 0x10000000L /* fuelable lite */ +#define TR4_ART_EXP 0x20000000L /* Will accumulate xp */ +#define TR4_CURSE_NO_DROP 0x40000000L /* The obj wont be dropped */ +#define TR4_NO_RECHARGE 0x80000000L /* Object Cannot be recharged */ +#define TR4_NULL_MASK 0xFFFFFFFCL + +#define TR5_TEMPORARY 0x00000001L /* In timeout turns it is destroyed */ +#define TR5_DRAIN_MANA 0x00000002L /* Drains mana */ +#define TR5_DRAIN_HP 0x00000004L /* Drains hp */ +#define TR5_KILL_DEMON 0x00000008L /* Execute Demon */ +#define TR5_KILL_UNDEAD 0x00000010L /* Execute Undead */ +#define TR5_CRIT 0x00000020L /* More critical hits */ +#define TR5_ATTR_MULTI 0x00000040L /* Object shimmer -- only allowed in k_info */ +#define TR5_WOUNDING 0x00000080L /* Wounds monsters */ +#define TR5_FULL_NAME 0x00000100L /* Uses direct name from k_info */ +#define TR5_LUCK 0x00000200L /* Luck += pval */ +#define TR5_IMMOVABLE 0x00000400L /* Cannot move */ +#define TR5_SPELL_CONTAIN 0x00000800L /* Can contain a spell */ +#define TR5_RES_MORGUL 0x00001000L /* Is not shattered by morgul fiends(nazguls) */ +#define TR5_ACTIVATE_NO_WIELD 0x00002000L /* Can be 'A'ctivated without being wielded */ +#define TR5_MAGIC_BREATH 0x00004000L /* Can breath anywere */ +#define TR5_WATER_BREATH 0x00008000L /* Can breath underwater */ +#define TR5_WIELD_CAST 0x00010000L /* Need to be wielded to cast spelsl fomr it(if it can be wiekded) */ + +#define ESP_ORC 0x00000001L +#define ESP_TROLL 0x00000002L +#define ESP_DRAGON 0x00000004L +#define ESP_GIANT 0x00000008L +#define ESP_DEMON 0x00000010L +#define ESP_UNDEAD 0x00000020L +#define ESP_EVIL 0x00000040L +#define ESP_ANIMAL 0x00000080L +#define ESP_THUNDERLORD 0x00000100L +#define ESP_GOOD 0x00000200L +#define ESP_NONLIVING 0x00000400L +#define ESP_UNIQUE 0x00000800L +#define ESP_SPIDER 0x00001000L +#define ESP_ALL 0x80000000L + +/* + * Bit flags for the "get_item" function + */ +#define USE_EQUIP 0x01 /* Allow equip items */ +#define USE_INVEN 0x02 /* Allow inven items */ +#define USE_FLOOR 0x04 /* Allow floor items */ +#define USE_EXTRA 0x08 /* Allow extra items */ + +#define INVEN_WIELD 24 /* 3 weapons -- WEAPONS */ +#define INVEN_BOW 27 /* 1 bow -- WEAPON */ +#define INVEN_RING 28 /* 6 rings -- FINGER */ +#define INVEN_NECK 34 /* 2 amulets -- HEAD */ +#define INVEN_LITE 36 /* 1 lite -- TORSO */ +#define INVEN_BODY 37 /* 1 body -- TORSO */ +#define INVEN_OUTER 38 /* 1 cloak -- TORSO */ +#define INVEN_ARM 39 /* 3 arms -- ARMS */ +#define INVEN_HEAD 42 /* 2 heads -- HEAD */ +#define INVEN_HANDS 44 /* 3 hands -- ARMS */ +#define INVEN_FEET 47 /* 2 feets -- LEGS */ +#define INVEN_CARRY 49 /* 1 carried monster -- TORSO */ +#define INVEN_AMMO 50 /* 1 quiver -- TORSO */ +#define INVEN_TOOL 51 /* 1 tool -- ARMS */ +#define INVEN_TOTAL 52 +#define INVEN_EQ (INVEN_TOTAL - INVEN_WIELD) + +#define TV_SKELETON 1 /* Skeletons ('s') */ +#define TV_BOTTLE 2 /* Empty bottles ('!') */ +#define TV_BATERIE 4 /* For the Alchemists */ +#define TV_SPIKE 5 /* Spikes ('~') */ +#define TV_MSTAFF 6 /* Mage Staffs */ +#define TV_CHEST 7 /* Chests ('~') */ +#define TV_PARCHMENT 8 /* Parchments from Kamband */ +#define TV_PARCHEMENT 8 /* compatibility define */ +#define TV_CORPSE 9 /* Monster corpses */ +#define TV_EGG 10 /* Monster Eggs */ +#define TV_JUNK 11 /* Sticks, Pottery, etc ('~') */ +#define TV_TOOL 12 /* Tools */ +#define TV_INSTRUMENT 14 /* Musical instruments */ +#define TV_BOOMERANG 15 /* Boomerangs */ +#define TV_SHOT 16 /* Ammo for slings */ +#define TV_ARROW 17 /* Ammo for bows */ +#define TV_BOLT 18 /* Ammo for x-bows */ +#define TV_BOW 19 /* Slings/Bows/Xbows */ +#define TV_DIGGING 20 /* Shovels/Picks */ +#define TV_HAFTED 21 /* Priest Weapons */ +#define TV_POLEARM 22 /* Pikes/Glaives/Spears/etc. */ +#define TV_SWORD 23 /* Edged Weapons */ +#define TV_AXE 24 /* Axes/Cleavers */ +#define TV_BOOTS 30 /* Boots */ +#define TV_GLOVES 31 /* Gloves */ +#define TV_HELM 32 /* Helms */ +#define TV_CROWN 33 /* Crowns */ +#define TV_SHIELD 34 /* Shields */ +#define TV_CLOAK 35 /* Cloaks */ +#define TV_SOFT_ARMOR 36 /* Soft Armor */ +#define TV_HARD_ARMOR 37 /* Hard Armor */ +#define TV_DRAG_ARMOR 38 /* Dragon Scale Mail */ +#define TV_LITE 39 /* Lites (including Specials) */ +#define TV_AMULET 40 /* Amulets (including Specials) */ +#define TV_RING 45 /* Rings (including Specials) */ +#define TV_TRAPKIT 46 /* Trapkits */ +#define TV_TOTEM 54 /* Summoner totems */ +#define TV_STAFF 55 +#define TV_WAND 65 +#define TV_ROD 66 +#define TV_ROD_MAIN 67 +#define TV_SCROLL 70 +#define TV_POTION 71 +#define TV_POTION2 72 /* Second set of potion */ +#define TV_FLASK 77 +#define TV_FOOD 80 +#define TV_HYPNOS 99 /* To wield monsters !:) */ +#define TV_GOLD 100 /* Gold can only be picked up by players */ +#define TV_RANDART 102 /* Random Artifacts */ +#define TV_RUNE1 104 /* Base runes */ +#define TV_RUNE2 105 /* Modifier runes */ + +#define TV_BOOK 111 +#define TV_SYMBIOTIC_BOOK 112 +#define TV_MUSIC_BOOK 113 +#define TV_DRUID_BOOK 114 +#define TV_DAEMON_BOOK 115 + +/* The "sval" codes for TV_TOOL */ +#define SV_TOOL_CLIMB 0 +#define SV_PORTABLE_HOLE 1 + +/* The "sval" codes for TV_MSTAFF */ +#define SV_MSTAFF 1 + +/* The "sval" codes for TV_SHOT/TV_ARROW/TV_BOLT */ +#define SV_AMMO_LIGHT 0 /* pebbles */ +#define SV_AMMO_NORMAL 1 /* shots, arrows, bolts */ +#define SV_AMMO_HEAVY 2 /* seeker arrows and bolts, mithril shots */ + +/* The "sval" codes for TV_INSTRUMENT */ +#define SV_DRUM 58 +#define SV_HARP 59 +#define SV_HORN 60 + +/* The "sval" codes for TV_TRAPKIT */ +#define SV_TRAPKIT_SLING 1 +#define SV_TRAPKIT_BOW 2 +#define SV_TRAPKIT_XBOW 3 +#define SV_TRAPKIT_POTION 4 +#define SV_TRAPKIT_SCROLL 5 +#define SV_TRAPKIT_DEVICE 6 + +/* The "sval" codes for TV_BOOMERANG */ +#define SV_BOOM_S_WOOD 1 /* 1d4 */ +#define SV_BOOM_WOOD 2 /* 1d9 */ +#define SV_BOOM_S_METAL 3 /* 1d8 */ +#define SV_BOOM_METAL 4 /* 2d4 */ + +/* The "sval" codes for TV_BOW (note information in "sval") */ +#define SV_SLING 2 /* (x2) */ +#define SV_SHORT_BOW 12 /* (x2) */ +#define SV_LONG_BOW 13 /* (x3) */ +#define SV_LIGHT_XBOW 23 /* (x3) */ +#define SV_HEAVY_XBOW 24 /* (x4) */ + +/* The "sval" codes for TV_DIGGING */ +#define SV_SHOVEL 1 +#define SV_GNOMISH_SHOVEL 2 +#define SV_DWARVEN_SHOVEL 3 +#define SV_PICK 4 +#define SV_ORCISH_PICK 5 +#define SV_DWARVEN_PICK 6 +#define SV_MATTOCK 7 + +/* The "sval" values for TV_HAFTED */ +#define SV_CLUB 1 /* 1d4 */ +#define SV_WHIP 2 /* 1d6 */ +#define SV_QUARTERSTAFF 3 /* 1d9 */ +#define SV_NUNCHAKU 4 /* 2d3 */ +#define SV_MACE 5 /* 2d4 */ +#define SV_BALL_AND_CHAIN 6 /* 2d4 */ +#define SV_WAR_HAMMER 8 /* 3d3 */ +#define SV_LUCERN_HAMMER 10 /* 2d5 */ +#define SV_THREE_PIECE_ROD 11 /* 3d3 */ +#define SV_MORNING_STAR 12 /* 2d6 */ +#define SV_FLAIL 13 /* 2d6 */ +#define SV_LEAD_FILLED_MACE 15 /* 3d4 */ +#define SV_TWO_HANDED_FLAIL 18 /* 3d6 */ +#define SV_GREAT_HAMMER 19 /* 4d6 */ +#define SV_MACE_OF_DISRUPTION 20 /* 5d8 */ +#define SV_GROND 50 /* 3d4 */ + +/* The "sval" values for TV_AXE */ +#define SV_HATCHET 1 /* 1d5 */ +#define SV_CLEAVER 2 /* 2d4 */ +#define SV_LIGHT_WAR_AXE 8 /* 2d5 */ +#define SV_BEAKED_AXE 10 /* 2d6 */ +#define SV_BROAD_AXE 11 /* 2d6 */ +#define SV_BATTLE_AXE 22 /* 2d8 */ +#define SV_GREAT_AXE 25 /* 4d4 */ +#define SV_LOCHABER_AXE 28 /* 3d8 */ +#define SV_SLAUGHTER_AXE 30 /* 5d7 */ + +/* The "sval" values for TV_POLEARM */ +#define SV_SPEAR 2 /* 1d6 */ +#define SV_SICKLE 3 /* 2d3 */ +#define SV_AWL_PIKE 4 /* 1d8 */ +#define SV_TRIDENT 5 /* 1d9 */ +#define SV_FAUCHARD 6 /* 1d10 */ +#define SV_BROAD_SPEAR 7 /* 1d9 */ +#define SV_PIKE 8 /* 2d5 */ +#define SV_GLAIVE 13 /* 2d6 */ +#define SV_HALBERD 15 /* 3d4 */ +#define SV_GUISARME 16 /* 2d5 */ +#define SV_SCYTHE 17 /* 5d3 */ +#define SV_LANCE 20 /* 2d8 */ +#define SV_TRIFURCATE_SPEAR 26 /* 2d9 */ +#define SV_HEAVY_LANCE 29 /* 4d8 */ +#define SV_SCYTHE_OF_SLICING 30 /* 8d4 */ + +/* The "sval" codes for TV_SWORD */ +#define SV_BROKEN_DAGGER 1 /* 1d1 */ +#define SV_BROKEN_SWORD 2 /* 1d2 */ +#define SV_DAGGER 4 /* 1d4 */ +#define SV_MAIN_GAUCHE 5 /* 1d5 */ +#define SV_RAPIER 7 /* 1d6 */ +#define SV_SMALL_SWORD 8 /* 1d6 */ +#define SV_BASILLARD 9 /* 1d8 */ +#define SV_SHORT_SWORD 10 /* 1d7 */ +#define SV_SABRE 11 /* 1d7 */ +#define SV_CUTLASS 12 /* 1d7 */ +#define SV_KHOPESH 14 /* 2d4 */ +#define SV_TULWAR 15 /* 2d4 */ +#define SV_BROAD_SWORD 16 /* 2d5 */ +#define SV_LONG_SWORD 17 /* 2d5 */ +#define SV_SCIMITAR 18 /* 2d5 */ +#define SV_KATANA 20 /* 3d4 */ +#define SV_BASTARD_SWORD 21 /* 3d4 */ +#define SV_GREAT_SCIMITAR 22 /* 4d5 */ +#define SV_CLAYMORE 23 /* 2d8 */ +#define SV_ESPADON 24 /* 2d9 */ +#define SV_TWO_HANDED_SWORD 25 /* 3d6 */ +#define SV_FLAMBERGE 26 /* 3d7 */ +#define SV_EXECUTIONERS_SWORD 28 /* 4d5 */ +#define SV_ZWEIHANDER 29 /* 4d6 */ +#define SV_BLADE_OF_CHAOS 30 /* 6d5 */ +#define SV_BLUESTEEL_BLADE 31 /* 3d9 */ +#define SV_SHADOW_BLADE 32 /* 4d4 */ +#define SV_DARK_SWORD 33 /* 3d7 */ + +/* The "sval" codes for TV_SHIELD */ +#define SV_SMALL_LEATHER_SHIELD 2 +#define SV_SMALL_METAL_SHIELD 3 +#define SV_LARGE_LEATHER_SHIELD 4 +#define SV_LARGE_METAL_SHIELD 5 +#define SV_DRAGON_SHIELD 6 +#define SV_SHIELD_OF_DEFLECTION 10 + +/* The "sval" codes for TV_HELM */ +#define SV_HARD_LEATHER_CAP 2 +#define SV_METAL_CAP 3 +#define SV_IRON_HELM 5 +#define SV_STEEL_HELM 6 +#define SV_DRAGON_HELM 7 +#define SV_IRON_CROWN 10 +#define SV_GOLDEN_CROWN 11 +#define SV_JEWELED_CROWN 12 +#define SV_MORGOTH 50 + +/* The "sval" codes for TV_BOOTS */ +#define SV_PAIR_OF_SOFT_LEATHER_BOOTS 2 +#define SV_PAIR_OF_HARD_LEATHER_BOOTS 3 +#define SV_PAIR_OF_METAL_SHOD_BOOTS 6 + +/* The "sval" codes for TV_CLOAK */ +#define SV_CLOAK 1 +#define SV_ELVEN_CLOAK 2 +#define SV_FUR_CLOAK 3 +#define SV_SHADOW_CLOAK 6 + +/* The "sval" codes for TV_GLOVES */ +#define SV_SET_OF_LEATHER_GLOVES 1 +#define SV_SET_OF_GAUNTLETS 2 +#define SV_SET_OF_CESTI 5 + +/* The "sval" codes for TV_SOFT_ARMOR */ +#define SV_FILTHY_RAG 1 +#define SV_ROBE 2 +#define SV_PAPER_ARMOR 3 /* 4 */ +#define SV_SOFT_LEATHER_ARMOR 4 +#define SV_SOFT_STUDDED_LEATHER 5 +#define SV_HARD_LEATHER_ARMOR 6 +#define SV_HARD_STUDDED_LEATHER 7 +#define SV_RHINO_HIDE_ARMOR 8 +#define SV_CORD_ARMOR 9 /* 6 */ +#define SV_PADDED_ARMOR 10 /* 4 */ +#define SV_LEATHER_SCALE_MAIL 11 +#define SV_LEATHER_JACK 12 +#define SV_STONE_AND_HIDE_ARMOR 15 /* 15 */ +#define SV_THUNDERLORD_SUIT 16 + +/* The "sval" codes for TV_HARD_ARMOR */ +#define SV_RUSTY_CHAIN_MAIL 1 /* 14- */ +#define SV_RING_MAIL 2 /* 12 */ +#define SV_METAL_SCALE_MAIL 3 /* 13 */ +#define SV_CHAIN_MAIL 4 /* 14 */ +#define SV_DOUBLE_RING_MAIL 5 /* 15 */ +#define SV_AUGMENTED_CHAIN_MAIL 6 /* 16 */ +#define SV_DOUBLE_CHAIN_MAIL 7 /* 16 */ +#define SV_BAR_CHAIN_MAIL 8 /* 18 */ +#define SV_METAL_BRIGANDINE_ARMOUR 9 /* 19 */ +#define SV_SPLINT_MAIL 10 /* 19 */ +#define SV_PARTIAL_PLATE_ARMOUR 12 /* 22 */ +#define SV_METAL_LAMELLAR_ARMOUR 13 /* 23 */ +#define SV_FULL_PLATE_ARMOUR 15 /* 25 */ +#define SV_RIBBED_PLATE_ARMOUR 18 /* 28 */ +#define SV_MITHRIL_CHAIN_MAIL 20 /* 28+ */ +#define SV_MITHRIL_PLATE_MAIL 25 /* 35+ */ +#define SV_ADAMANTITE_PLATE_MAIL 30 /* 40+ */ + +/* The "sval" codes for TV_DRAG_ARMOR */ +#define SV_DRAGON_BLACK 1 +#define SV_DRAGON_BLUE 2 +#define SV_DRAGON_WHITE 3 +#define SV_DRAGON_RED 4 +#define SV_DRAGON_GREEN 5 +#define SV_DRAGON_MULTIHUED 6 +#define SV_DRAGON_SHINING 10 +#define SV_DRAGON_LAW 12 +#define SV_DRAGON_BRONZE 14 +#define SV_DRAGON_GOLD 16 +#define SV_DRAGON_CHAOS 18 +#define SV_DRAGON_BALANCE 20 +#define SV_DRAGON_POWER 30 + +/* The sval codes for TV_LITE */ +#define SV_LITE_TORCH 0 +#define SV_LITE_LANTERN 1 +#define SV_LITE_TORCH_EVER 2 +#define SV_LITE_DWARVEN 3 +#define SV_LITE_FEANORIAN 4 +#define SV_LITE_GALADRIEL 100 +#define SV_LITE_ELENDIL 101 +#define SV_LITE_THRAIN 102 +#define SV_LITE_UNDEATH 103 +#define SV_LITE_PALANTIR 104 +#define SV_ANCHOR_SPACETIME 105 +#define SV_STONE_LORE 106 + + +/* The "sval" codes for TV_AMULET */ +#define SV_AMULET_DOOM 0 +#define SV_AMULET_TELEPORT 1 +#define SV_AMULET_ADORNMENT 2 +#define SV_AMULET_SLOW_DIGEST 3 +#define SV_AMULET_RESIST_ACID 4 +#define SV_AMULET_SEARCHING 5 +#define SV_AMULET_BRILLANCE 6 +#define SV_AMULET_CHARISMA 7 +#define SV_AMULET_THE_MAGI 8 +#define SV_AMULET_REFLECTION 9 +#define SV_AMULET_CARLAMMAS 10 +#define SV_AMULET_INGWE 11 +#define SV_AMULET_DWARVES 12 +#define SV_AMULET_NO_MAGIC 13 +#define SV_AMULET_NO_TELE 14 +#define SV_AMULET_RESISTANCE 15 +#define SV_AMULET_NOTHING 16 +#define SV_AMULET_SERPENT 17 +#define SV_AMULET_TORIS_MEJISTOS 18 +#define SV_AMULET_TRICKERY 23 +#define SV_AMULET_DEVOTION 25 +#define SV_AMULET_WEAPONMASTERY 24 +#define SV_AMULET_WISDOM 28 +#define SV_AMULET_INFRA 26 +#define SV_AMULET_SPELL 27 + +/* The sval codes for TV_RING */ +#define SV_RING_WOE 0 +#define SV_RING_AGGRAVATION 1 +#define SV_RING_WEAKNESS 2 +#define SV_RING_STUPIDITY 3 +#define SV_RING_TELEPORTATION 4 +#define SV_RING_SPECIAL 5 +#define SV_RING_SLOW_DIGESTION 6 +#define SV_RING_FEATHER_FALL 7 +#define SV_RING_RESIST_FIRE 8 +#define SV_RING_RESIST_COLD 9 +#define SV_RING_SUSTAIN_STR 10 +#define SV_RING_SUSTAIN_INT 11 +#define SV_RING_SUSTAIN_WIS 12 +#define SV_RING_SUSTAIN_DEX 13 +#define SV_RING_SUSTAIN_CON 14 +#define SV_RING_SUSTAIN_CHR 15 +#define SV_RING_PROTECTION 16 +#define SV_RING_ACID 17 +#define SV_RING_FLAMES 18 +#define SV_RING_ICE 19 +#define SV_RING_RESIST_POIS 20 +#define SV_RING_FREE_ACTION 21 +#define SV_RING_SEE_INVIS 22 +#define SV_RING_SEARCHING 23 +#define SV_RING_STR 24 +#define SV_RING_INT 25 +#define SV_RING_DEX 26 +#define SV_RING_CON 27 +#define SV_RING_ACCURACY 28 +#define SV_RING_DAMAGE 29 +#define SV_RING_SLAYING 30 +#define SV_RING_SPEED 31 +#define SV_RING_BARAHIR 32 +#define SV_RING_TULKAS 33 +#define SV_RING_NARYA 34 +#define SV_RING_NENYA 35 +#define SV_RING_VILYA 36 +#define SV_RING_POWER 37 +#define SV_RING_RES_FEAR 38 +#define SV_RING_RES_LD 39 +#define SV_RING_RES_NETHER 40 +#define SV_RING_RES_NEXUS 41 +#define SV_RING_RES_SOUND 42 +#define SV_RING_RES_CONFUSION 43 +#define SV_RING_RES_SHARDS 44 +#define SV_RING_RES_DISENCHANT 45 +#define SV_RING_RES_CHAOS 46 +#define SV_RING_RES_BLINDNESS 47 +#define SV_RING_LORDLY 48 +#define SV_RING_ATTACKS 49 +#define SV_RING_NOTHING 50 +#define SV_RING_PRECONITION 51 +#define SV_RING_FLAR 52 +#define SV_RING_INVIS 53 +#define SV_RING_FLYING 54 +#define SV_RING_WRAITH 55 +#define SV_RING_ELEC 56 +#define SV_RING_CRIT 57 +#define SV_RING_SPELL 58 + +/* The "sval" codes for TV_STAFF */ +#define SV_STAFF_SCHOOL 1 +#define SV_STAFF_NOTHING 2 + +/* The "sval" codes for TV_WAND */ +#define SV_WAND_SCHOOL 1 +#define SV_WAND_NOTHING 2 + +/* The "sval" codes for TV_ROD(Rod Tips) */ +#define SV_ROD_NOTHING 0 +#define SV_ROD_DETECT_DOOR 1 +#define SV_ROD_IDENTIFY 2 +#define SV_ROD_RECALL 3 +#define SV_ROD_ILLUMINATION 4 +#define SV_ROD_MAPPING 5 +#define SV_ROD_DETECTION 6 +#define SV_ROD_PROBING 7 +#define SV_ROD_CURING 8 +#define SV_ROD_HEALING 9 +#define SV_ROD_RESTORATION 10 +#define SV_ROD_SPEED 11 +/* xxx (aimed) */ +#define SV_ROD_TELEPORT_AWAY 13 +#define SV_ROD_DISARMING 14 +#define SV_ROD_LITE 15 +#define SV_ROD_SLEEP_MONSTER 16 +#define SV_ROD_SLOW_MONSTER 17 +#define SV_ROD_DRAIN_LIFE 18 +#define SV_ROD_POLYMORPH 19 +#define SV_ROD_ACID_BOLT 20 +#define SV_ROD_ELEC_BOLT 21 +#define SV_ROD_FIRE_BOLT 22 +#define SV_ROD_COLD_BOLT 23 +#define SV_ROD_ACID_BALL 24 +#define SV_ROD_ELEC_BALL 25 +#define SV_ROD_FIRE_BALL 26 +#define SV_ROD_COLD_BALL 27 +#define SV_ROD_HAVOC 28 +#define SV_ROD_DETECT_TRAP 29 +#define SV_ROD_HOME 30 + + +/* The "sval" codes for TV_ROD_MAIN(Rods) */ +/* Note that the sval is the max mana capacity of the rod */ + +#define SV_ROD_WOODEN 10 +#define SV_ROD_COPPER 20 +#define SV_ROD_IRON 50 +#define SV_ROD_ALUMINIUM 75 +#define SV_ROD_SILVER 100 +#define SV_ROD_GOLDEN 125 +#define SV_ROD_MITHRIL 160 +#define SV_ROD_ADMANTITE 200 + + +/* The "sval" codes for TV_SCROLL */ + +#define SV_SCROLL_DARKNESS 0 +#define SV_SCROLL_AGGRAVATE_MONSTER 1 +#define SV_SCROLL_CURSE_ARMOR 2 +#define SV_SCROLL_CURSE_WEAPON 3 +#define SV_SCROLL_SUMMON_MONSTER 4 +#define SV_SCROLL_SUMMON_UNDEAD 5 +#define SV_SCROLL_SUMMON_MINE 6 +#define SV_SCROLL_TRAP_CREATION 7 +#define SV_SCROLL_PHASE_DOOR 8 +#define SV_SCROLL_TELEPORT 9 +#define SV_SCROLL_TELEPORT_LEVEL 10 +#define SV_SCROLL_WORD_OF_RECALL 11 +#define SV_SCROLL_IDENTIFY 12 +#define SV_SCROLL_STAR_IDENTIFY 13 +#define SV_SCROLL_REMOVE_CURSE 14 +#define SV_SCROLL_STAR_REMOVE_CURSE 15 +#define SV_SCROLL_ENCHANT_ARMOR 16 +#define SV_SCROLL_ENCHANT_WEAPON_TO_HIT 17 +#define SV_SCROLL_ENCHANT_WEAPON_TO_DAM 18 +#define SV_SCROLL_ENCHANT_WEAPON_PVAL 19 +#define SV_SCROLL_STAR_ENCHANT_ARMOR 20 +#define SV_SCROLL_STAR_ENCHANT_WEAPON 21 +#define SV_SCROLL_RECHARGING 22 +#define SV_SCROLL_RESET_RECALL 23 +#define SV_SCROLL_LIGHT 24 +#define SV_SCROLL_MAPPING 25 +#define SV_SCROLL_DETECT_GOLD 26 +#define SV_SCROLL_DETECT_ITEM 27 +#define SV_SCROLL_DETECT_TRAP 28 +#define SV_SCROLL_DETECT_DOOR 29 +#define SV_SCROLL_DETECT_INVIS 30 +#define SV_SCROLL_DIVINATION 31 +#define SV_SCROLL_SATISFY_HUNGER 32 +#define SV_SCROLL_BLESSING 33 +#define SV_SCROLL_HOLY_CHANT 34 +#define SV_SCROLL_HOLY_PRAYER 35 +#define SV_SCROLL_MONSTER_CONFUSION 36 +#define SV_SCROLL_PROTECTION_FROM_EVIL 37 +#define SV_SCROLL_RUNE_OF_PROTECTION 38 +#define SV_SCROLL_TRAP_DOOR_DESTRUCTION 39 +#define SV_SCROLL_DEINCARNATION 40 +#define SV_SCROLL_STAR_DESTRUCTION 41 +#define SV_SCROLL_DISPEL_UNDEAD 42 +#define SV_SCROLL_MASS_RESURECTION 43 +#define SV_SCROLL_GENOCIDE 44 +#define SV_SCROLL_MASS_GENOCIDE 45 +#define SV_SCROLL_ACQUIREMENT 46 +#define SV_SCROLL_STAR_ACQUIREMENT 47 +#define SV_SCROLL_FIRE 48 +#define SV_SCROLL_ICE 49 +#define SV_SCROLL_CHAOS 50 +#define SV_SCROLL_RUMOR 51 +#define SV_SCROLL_ARTIFACT 52 +#define SV_SCROLL_NOTHING 53 + +/* The "sval" codes for TV_POTION */ +#define SV_POTION_WATER 0 +#define SV_POTION_APPLE_JUICE 1 +#define SV_POTION_SLIME_MOLD 2 +#define SV_POTION_BLOOD 3 +#define SV_POTION_SLOWNESS 4 +#define SV_POTION_SALT_WATER 5 +#define SV_POTION_POISON 6 +#define SV_POTION_BLINDNESS 7 +#define SV_POTION_INVIS 8 +#define SV_POTION_CONFUSION 9 +#define SV_POTION_MUTATION 10 +#define SV_POTION_SLEEP 11 +#define SV_POTION_LEARNING 12 +#define SV_POTION_LOSE_MEMORIES 13 +/* xxx */ +#define SV_POTION_RUINATION 15 +#define SV_POTION_DEC_STR 16 +#define SV_POTION_DEC_INT 17 +#define SV_POTION_DEC_WIS 18 +#define SV_POTION_DEC_DEX 19 +#define SV_POTION_DEC_CON 20 +#define SV_POTION_DEC_CHR 21 +#define SV_POTION_DETONATIONS 22 +#define SV_POTION_DEATH 23 +#define SV_POTION_INFRAVISION 24 +#define SV_POTION_DETECT_INVIS 25 +#define SV_POTION_SLOW_POISON 26 +#define SV_POTION_CURE_POISON 27 +#define SV_POTION_BOLDNESS 28 +#define SV_POTION_SPEED 29 +#define SV_POTION_RESIST_HEAT 30 +#define SV_POTION_RESIST_COLD 31 +#define SV_POTION_HEROISM 32 +#define SV_POTION_BESERK_STRENGTH 33 +#define SV_POTION_CURE_LIGHT 34 +#define SV_POTION_CURE_SERIOUS 35 +#define SV_POTION_CURE_CRITICAL 36 +#define SV_POTION_HEALING 37 +#define SV_POTION_STAR_HEALING 38 +#define SV_POTION_LIFE 39 +#define SV_POTION_RESTORE_MANA 40 +#define SV_POTION_RESTORE_EXP 41 +#define SV_POTION_RES_STR 42 +#define SV_POTION_RES_INT 43 +#define SV_POTION_RES_WIS 44 +#define SV_POTION_RES_DEX 45 +#define SV_POTION_RES_CON 46 +#define SV_POTION_RES_CHR 47 +#define SV_POTION_INC_STR 48 +#define SV_POTION_INC_INT 49 +#define SV_POTION_INC_WIS 50 +#define SV_POTION_INC_DEX 51 +#define SV_POTION_INC_CON 52 +#define SV_POTION_INC_CHR 53 +/* xxx */ +#define SV_POTION_AUGMENTATION 55 +#define SV_POTION_ENLIGHTENMENT 56 +#define SV_POTION_STAR_ENLIGHTENMENT 57 +#define SV_POTION_SELF_KNOWLEDGE 58 +#define SV_POTION_EXPERIENCE 59 +#define SV_POTION_RESISTANCE 60 +#define SV_POTION_CURING 61 +#define SV_POTION_INVULNERABILITY 62 +#define SV_POTION_NEW_LIFE 63 + +#define SV_POTION_LAST 63 + +/* The "sval" codes for TV_POTION2 */ +#define SV_POTION2_MIMIC 1 +#define SV_POTION2_CURE_LIGHT_SANITY 14 +#define SV_POTION2_CURE_SERIOUS_SANITY 15 +#define SV_POTION2_CURE_CRITICAL_SANITY 16 +#define SV_POTION2_CURE_SANITY 17 +#define SV_POTION2_CURE_WATER 18 + +#define SV_POTION2_LAST 18 + +/* The "sval" codes for TV_FOOD */ +#define SV_FOOD_POISON 0 +#define SV_FOOD_BLINDNESS 1 +#define SV_FOOD_PARANOIA 2 +#define SV_FOOD_CONFUSION 3 +#define SV_FOOD_HALLUCINATION 4 +#define SV_FOOD_PARALYSIS 5 +#define SV_FOOD_WEAKNESS 6 +#define SV_FOOD_SICKNESS 7 +#define SV_FOOD_STUPIDITY 8 +#define SV_FOOD_NAIVETY 9 +#define SV_FOOD_UNHEALTH 10 +#define SV_FOOD_DISEASE 11 +#define SV_FOOD_CURE_POISON 12 +#define SV_FOOD_CURE_BLINDNESS 13 +#define SV_FOOD_CURE_PARANOIA 14 +#define SV_FOOD_CURE_CONFUSION 15 +#define SV_FOOD_CURE_SERIOUS 16 +#define SV_FOOD_RESTORE_STR 17 +#define SV_FOOD_RESTORE_CON 18 +#define SV_FOOD_RESTORING 19 +/* many missing mushrooms */ +#define SV_FOOD_BISCUIT 32 +#define SV_FOOD_JERKY 33 +#define SV_FOOD_RATION 35 +#define SV_FOOD_SLIME_MOLD 36 +#define SV_FOOD_WAYBREAD 37 +#define SV_FOOD_PINT_OF_ALE 38 +#define SV_FOOD_PINT_OF_WINE 39 +#define SV_FOOD_ATHELAS 40 +#define SV_FOOD_GREAT_HEALTH 41 +#define SV_FOOD_FORTUNE_COOKIE 42 + +/* The "sval" codes for TV_BATERIE */ +#define SV_BATERIE_POISON 1 +#define SV_BATERIE_EXPLOSION 2 +#define SV_BATERIE_TELEPORT 3 +#define SV_BATERIE_COLD 4 +#define SV_BATERIE_FIRE 5 +#define SV_BATERIE_ACID 6 +#define SV_BATERIE_LIFE 7 +#define SV_BATERIE_CONFUSION 8 +#define SV_BATERIE_LITE 9 +#define SV_BATERIE_CHAOS 10 +#define SV_BATERIE_TIME 11 +#define SV_BATERIE_MAGIC 12 +#define SV_BATERIE_XTRA_LIFE 13 +#define SV_BATERIE_DARKNESS 14 +#define SV_BATERIE_KNOWLEDGE 15 +#define SV_BATERIE_FORCE 16 +#define SV_BATERIE_LIGHTNING 17 +#define SV_BATERIE_MANA 18 + +/* The "sval" codes for TV_CORPSE */ +#define SV_CORPSE_CORPSE 1 +#define SV_CORPSE_SKELETON 2 +#define SV_CORPSE_HEAD 3 +#define SV_CORPSE_SKULL 4 +#define SV_CORPSE_MEAT 5 + +/* The "sval" codes for TV_DAEMON_BOOK */ +#define SV_DEMONBLADE 55 +#define SV_DEMONSHIELD 56 +#define SV_DEMONHORN 57 + +/* + * Special Object Flags + */ +#define IDENT_SENSE 0x01 /* Item has been "sensed" */ +#define IDENT_FIXED 0x02 /* Item has been "haggled" */ +#define IDENT_EMPTY 0x04 /* Item charges are known */ +#define IDENT_KNOWN 0x08 /* Item abilities are known */ +#define IDENT_STOREB 0x10 /* Item is storebought !!!! */ +#define IDENT_MENTAL 0x20 /* Item information is known */ +#define IDENT_CURSED 0x40 /* Item is temporarily cursed */ + +/* + * Location of objects when they were found + */ +#define OBJ_FOUND_MONSTER 1 +#define OBJ_FOUND_FLOOR 2 +#define OBJ_FOUND_VAULT 3 +#define OBJ_FOUND_SPECIAL 4 +#define OBJ_FOUND_RUBBLE 5 +#define OBJ_FOUND_REWARD 6 +#define OBJ_FOUND_STORE 7 +#define OBJ_FOUND_STOLEN 8 +#define OBJ_FOUND_SELFMADE 9 + +struct obj_theme +{ + byte treasure; + byte combat; + byte magic; + byte tools; +}; + +struct object_kind +{ + u32b name; /* Name (offset) */ + u32b text; /* Text (offset) */ + + byte tval; /* Object type */ + byte sval; /* Object sub type */ + + s32b pval; /* Object extra info */ + s32b pval2; /* Object extra info */ + + s16b to_h; /* Bonus to hit */ + s16b to_d; /* Bonus to damage */ + s16b to_a; /* Bonus to armor */ + + s16b ac; /* Base armor */ + + byte dd; + byte ds; /* Damage dice/sides */ + + s32b weight; /* Weight */ + + s32b cost; /* Object "base cost" */ + + u32b flags1; /* Flags, set 1 */ + u32b flags2; /* Flags, set 2 */ + u32b flags3; /* Flags, set 3 */ + u32b flags4; /* Flags, set 4 */ + u32b flags5; /* Flags, set 5 */ + + byte locale[4]; /* Allocation level(s) */ + byte chance[4]; /* Allocation chance(s) */ + + byte level; /* Level */ + byte extra; /* Something */ + + + byte d_attr; /* Default object attribute */ + char d_char; /* Default object character */ + + + byte x_attr; /* Desired object attribute */ + char x_char; /* Desired object character */ + + + byte flavor; /* Special object flavor (or zero) */ + + bool easy_know; /* This object is always known (if aware) */ + + + bool aware; /* The player is "aware" of the item's effects */ + + bool tried; /* The player has "tried" one of the items */ + + bool know; /* extractable flag for the alchemist */ + + u32b esp; /* ESP flags */ + + byte btval; /* Become Object type */ + byte bsval; /* Become Object sub type */ + bool artifact; /* Is it a normal artifact(already generated) */ + + s16b power; /* Power granted(if any) */ +}; + +struct artifact_type +{ + u32b name; /* Name (offset) */ + u32b text; /* Text (offset) */ + + byte tval; /* Artifact type */ + byte sval; /* Artifact sub type */ + + s16b pval; /* Artifact extra info */ + + s16b to_h; /* Bonus to hit */ + s16b to_d; /* Bonus to damage */ + s16b to_a; /* Bonus to armor */ + + s16b ac; /* Base armor */ + + byte dd; + byte ds; /* Damage when hits */ + + s16b weight; /* Weight */ + + s32b cost; /* Artifact "cost" */ + + u32b flags1; /* Artifact Flags, set 1 */ + u32b flags2; /* Artifact Flags, set 2 */ + u32b flags3; /* Artifact Flags, set 3 */ + u32b flags4; /* Artifact Flags, set 4 */ + u32b flags5; /* Artifact Flags, set 5 */ + + byte level; /* Artifact level */ + byte rarity; /* Artifact rarity */ + + byte cur_num; /* Number created (0 or 1) */ + byte max_num; /* Unused (should be "1") */ + + u32b esp; /* ESP flags */ + + s16b power; /* Power granted(if any) */ +}; + +struct ego_item_type +{ + u32b name; /* Name (offset) */ + u32b text; /* Text (offset) */ + + bool before; /* Before or after the object name ? */ + + byte tval[6]; + byte min_sval[6]; + byte max_sval[6]; + + byte rating; /* Rating boost */ + + byte level; /* Minimum level */ + byte rarity; /* Object rarity */ + byte mrarity; /* Object rarity */ + + s16b max_to_h; /* Maximum to-hit bonus */ + s16b max_to_d; /* Maximum to-dam bonus */ + s16b max_to_a; /* Maximum to-ac bonus */ + + s32b max_pval; /* Maximum pval */ + + s32b cost; /* Ego-item "cost" */ + + byte rar[5]; + u32b flags1[5]; /* Ego-Item Flags, set 1 */ + u32b flags2[5]; /* Ego-Item Flags, set 2 */ + u32b flags3[5]; /* Ego-Item Flags, set 3 */ + u32b flags4[5]; /* Ego-Item Flags, set 4 */ + u32b flags5[5]; /* Ego-Item Flags, set 5 */ + u32b esp[5]; /* ESP flags */ + u32b fego[5]; /* ego flags */ + + s16b power; /* Power granted(if any) */ +}; + +struct object_type +{ + s16b k_idx; /* Kind index (zero if "dead") */ + + byte iy; /* Y-position on map, or zero */ + byte ix; /* X-position on map, or zero */ + + byte tval; /* Item type (from kind) */ + byte sval; /* Item sub-type (from kind) */ + + s32b pval; /* Item extra-parameter */ + s16b pval2; /* Item extra-parameter for some special + items*/ + s32b pval3; /* Item extra-parameter for some special + items*/ + + byte discount; /* Discount (if any) */ + + byte number; /* Number of items */ + + s32b weight; /* Item weight */ + + byte elevel; /* Item exp level */ + s32b exp; /* Item exp */ + + byte name1; /* Artifact type, if any */ + s16b name2; /* Ego-Item type, if any */ + s16b name2b; /* Second Ego-Item type, if any */ + + byte xtra1; /* Extra info type */ + s16b xtra2; /* Extra info index */ + + s16b to_h; /* Plusses to hit */ + s16b to_d; /* Plusses to damage */ + s16b to_a; /* Plusses to AC */ + + s16b ac; /* Normal AC */ + + byte dd; + byte ds; /* Damage dice/sides */ + + s16b timeout; /* Timeout Counter */ + + byte ident; /* Special flags */ + + byte marked; /* Object is marked */ + + u16b note; /* Inscription index */ + u16b art_name; /* Artifact name (random artifacts) */ + + u32b art_flags1; /* Flags, set 1 Alas, these were necessary */ + u32b art_flags2; /* Flags, set 2 for the random artifacts of*/ + u32b art_flags3; /* Flags, set 3 Zangband */ + u32b art_flags4; /* Flags, set 4 PernAngband */ + u32b art_flags5; /* Flags, set 5 PernAngband */ + u32b art_esp; /* Flags, set esp PernAngband */ + + s16b next_o_idx; /* Next object in stack (if any) */ + + s16b held_m_idx; /* Monster holding us (if any) */ + + byte sense; /* Pseudo-id status */ + + byte found; /* How did we find it */ + s16b found_aux1; /* Stores info for found */ + s16b found_aux2; /* Stores info for found */ +}; + +/* Pseudo-id defines */ +#define SENSE_NONE 0 +#define SENSE_CURSED 1 +#define SENSE_AVERAGE 2 +#define SENSE_GOOD_LIGHT 3 +#define SENSE_GOOD_HEAVY 4 +#define SENSE_EXCELLENT 5 +#define SENSE_WORTHLESS 6 +#define SENSE_TERRIBLE 7 +#define SENSE_SPECIAL 8 +#define SENSE_BROKEN 9 +#define SENSE_UNCURSED 10 + +extern object_type o_list[max_o_idx]; +extern object_kind k_info[max_k_idx]; +extern char *k_name; +extern char *k_text; +extern artifact_type a_info[max_a_idx]; +extern char *a_name; +extern char *a_text; +extern header *e_head; +extern ego_item_type e_info[max_e_idx]; +extern char *e_name; +extern char *e_text; + +extern s16b m_bonus(int max, int level); +extern s16b wield_slot_ideal(object_type *o_ptr, bool ideal); +extern s16b wield_slot(object_type *o_ptr); +extern void object_flags(object_type *o_ptr, u32b *f1 = 0, u32b *f2 = 0, u32b *f3 = 0, u32b *f4 = 0, u32b *f5 = 0, u32b *esp = 0); +extern char *lua_object_desc @ object_desc(object_type *o_ptr, int pref, int mode); +extern bool object_out_desc(object_type *o_ptr, FILE *fff, bool trim_down, bool wait_for_it); +extern void inven_item_describe(int item); +extern void inven_item_increase(int item, int num); +extern bool inven_item_optimize(int item); +extern void floor_item_describe(int item); +extern void floor_item_increase(int item, int num); +extern void floor_item_optimize(int item); +extern void delete_object_idx(int o_idx); +extern s16b o_pop(void); +extern errr get_obj_num_prep(void); +extern bool ident_all(void); +extern s16b get_obj_num(int level); +extern s16b lookup_kind(int tval, int sval); +extern void object_wipe(object_type *o_ptr); +extern void object_prep(object_type *o_ptr, int k_idx); +extern void object_copy(object_type *o_ptr, object_type *j_ptr); +extern bool inven_carry_okay(object_type *o_ptr); +extern void apply_magic(object_type *o_ptr, int lev, bool okay, bool good, bool great); +extern bool make_object(object_type *j_ptr, bool good, bool great, obj_theme theme); +extern s16b drop_near(object_type *o_ptr, int chance, int y, int x); +extern object_type *get_object(int item); +extern object_type *new_object(); +extern void end_object(object_type *o_ptr); +extern bool get_item @ get_item_aux(int *cp, cptr pmt, cptr str, int mode); +extern void lua_set_item_tester(int tval, char *fct); +extern bool is_magestaff(); +extern void identify_pack_fully(void); +extern s16b inven_carry(object_type *o_ptr, bool final); +extern s32b calc_total_weight(void); +extern int get_slot(int slot); +extern bool is_blessed(object_type *o_ptr); +extern cptr sense_desc[1000]; /* 1000 is just a hack for tolua */ +extern void object_pickup(int this_o_idx); + +$static bool lua_is_artifact(object_type *o_ptr) { return artifact_p(o_ptr); } +static bool lua_is_artifact@is_artifact(object_type *o_ptr); + +$static bool lua_is_aware(object_type *o_ptr) { return object_aware_p(o_ptr); } +static bool lua_is_aware@is_aware(object_type *o_ptr); + +$static bool lua_is_known(object_type *o_ptr) { return object_known_p(o_ptr); } +static bool lua_is_known@is_known(object_type *o_ptr); + +$static void lua_set_aware(object_type *o_ptr) { object_aware(o_ptr); } +static void lua_set_aware@set_aware(object_type *o_ptr); + +$static void lua_set_known(object_type *o_ptr) { object_known(o_ptr); } +static void lua_set_known@set_known(object_type *o_ptr); + +extern byte value_check_aux1(object_type *o_ptr); +extern byte value_check_aux1_magic(object_type *o_ptr); +extern byte value_check_aux2(object_type *o_ptr); +extern byte value_check_aux2_magic(object_type *o_ptr); +extern byte select_sense(object_type *o_ptr, bool ok_combat, bool ok_magic); +extern bool psychometry(void); + +extern bool remove_curse_object(object_type *o_ptr, bool all); diff --git a/PKGS/player.pkg b/PKGS/player.pkg new file mode 100644 index 0000000..f671747 --- /dev/null +++ b/PKGS/player.pkg @@ -0,0 +1,3525 @@ +/* File: player.pkg */ + +/* + * Purpose: Lua interface defitions for the player. + * To be processed by tolua to generate C source code. + */ + +$#include "angband.h" + +/** @typedef cptr + * @note String + */ +typedef char* cptr; +/** @typedef errr + * @note Number + */ +typedef int errr; +/** @typedef bool + * @note Boolean + */ +typedef unsigned char bool; +/** @typedef byte + * @note Number + */ +typedef unsigned char byte; +/** @typedef s16b + * @note Number + */ +typedef signed short s16b; +/** @typedef u16b + * @note Number + */ +typedef unsigned short u16b; +/** @typedef s32b + * @note Number + */ +typedef signed int s32b; +/** @typedef u32b + * @note Number + */ +typedef unsigned int u32b; + +/** @def PY_MAX_LEVEL + * @note Maximum level + */ +#define PY_MAX_LEVEL 50 + +/** @var player_exp[PY_MAX_LEVEL] + * @brief Number + * @note Array of experience points per level. + */ +extern s32b player_exp[PY_MAX_LEVEL]; + +/** @name Attributes + * @brief Indexes of the various "stats" (hard-coded by savefiles, etc). + * @{ */ +/** @def A_STR + * @note Strength */ +#define A_STR 0 + +/** @def A_INT + * @note Intelligence */ +#define A_INT 1 + +/** @def A_WIS + * @note Wisdom */ +#define A_WIS 2 + +/** @def A_DEX + * @note Dexterity */ +#define A_DEX 3 + +/** @def A_CON + * @note Constitution */ +#define A_CON 4 + +/** @def A_CHR + * @note Charisma */ +#define A_CHR 5 +/** @} */ + +/* Ugly hack, should be in foo-info, the subrace saved to the savefile */ +/** @def SUBRACE_SAVE */ +#define SUBRACE_SAVE 9 + + +/** @name Sex + * @brief Player sex constants (hard-coded by save-files, arrays, etc) + * @{ */ +/** @def SEX_FEMALE */ +#define SEX_FEMALE 0 + +/** @def SEX_MALE */ +#define SEX_MALE 1 + +/** @def SEX_NEUTER */ +#define SEX_NEUTER 2 + + +/** @def MAX_SEXES */ +#define MAX_SEXES 3 +/** @} */ + +/** @name Race flags + * @{ */ +/** @def PR1_EXPERIMENTAL + * @note Is still under developemnt + */ +#define PR1_EXPERIMENTAL 0x00000001L +/* XXX */ +/** @def PR1_RESIST_BLACK_BREATH + * @note Resist black breath + */ +#define PR1_RESIST_BLACK_BREATH 0x00000004L +/** @def PR1_NO_STUN + * @note Never stunned + */ +#define PR1_NO_STUN 0x00000008L +/** @def PR1_XTRA_MIGHT_BOW + * @note Xtra might with bows + */ +#define PR1_XTRA_MIGHT_BOW 0x00000010L +/** @def PR1_XTRA_MIGHT_XBOW + * @note Xtra might with xbows + */ +#define PR1_XTRA_MIGHT_XBOW 0x00000020L +/** @def PR1_XTRA_MIGHT_SLING + * @note Xtra might with slings + */ +#define PR1_XTRA_MIGHT_SLING 0x00000040L +/** @def PR1_AC_LEVEL + * @note More AC with levels + */ +#define PR1_AC_LEVEL 0x00000080L +/** @def PR1_HURT_LITE + * @note Hurt by light + */ +#define PR1_HURT_LITE 0x00000100L +/** @def PR1_VAMPIRE + * @note Vampire + */ +#define PR1_VAMPIRE 0x00000200L +/** @def PR1_UNDEAD + * @note Undead + */ +#define PR1_UNDEAD 0x00000400L +/** @def PR1_NO_CUT + * @note no cuts + */ +#define PR1_NO_CUT 0x00000800L +/** @def PR1_CORRUPT + * @note hack-- corrupted + */ +#define PR1_CORRUPT 0x00001000L +/** @def PR1_NO_FOOD + * @note little gain from food + */ +#define PR1_NO_FOOD 0x00002000L +/** @def PR1_NO_GOD + * @note cannot worship + */ +#define PR1_NO_GOD 0x00004000L +/* XXX */ +/** @def PR1_ELF + * @note Is an elf + */ +#define PR1_ELF 0x00010000L +/** @def PR1_SEMI_WRAITH + * @note Takes damage when going in walls + */ +#define PR1_SEMI_WRAITH 0x00020000L +/** @def PR1_NO_SUBRACE_CHANGE + * @note Impossible to change subrace + */ +#define PR1_NO_SUBRACE_CHANGE 0x00040000L +/* XXX */ +/** @def PR1_ANTIMAGIC + * @note antimagic ... hack + */ +#define PR1_ANTIMAGIC 0x00100000L +/** @def PR1_MOLD_FRIEND + * @note Not attacked by molds wielded + */ +#define PR1_MOLD_FRIEND 0x00200000L +/** @def PR1_GOD_FRIEND + * @note Better grace + */ +#define PR1_GOD_FRIEND 0x00400000L +/* XXX */ +/** @def PR1_INNATE_SPELLS + * @note KNown all spells, only need books + */ +#define PR1_INNATE_SPELLS 0x01000000L +/* XXX */ +/* XXX */ +/** @def PR1_EASE_STEAL + * @note Gain xp by stealing + */ +#define PR1_EASE_STEAL 0x08000000L +/* XXX */ +/* XXX */ +/* XXX */ +/* XXX */ + +/* XXX */ +/** @def PR2_ASTRAL + * @note Is it an astral being coming from th halls of mandos ? + */ +#define PR2_ASTRAL 0x00000002L +/* XXX */ +/** @} */ + +/** @name Notice flags + * @brief Bit flags for the "p_ptr->notice" variable + * @{ */ +/** @def PN_COMBINE + * @note Combine the pack + */ +#define PN_COMBINE 0x00000001L +/** @def PN_REORDER + * @note Reorder the pack + */ +#define PN_REORDER 0x00000002L +/* xxx (many) */ +/** @} */ + + +/** @name Update flags + * @brief Bit flags for the "p_ptr->update" variable + * @{ */ +/** @def PU_BONUS + * @note Calculate bonuses + */ +#define PU_BONUS 0x00000001L +/** @def PU_TORCH + * @note Calculate torch radius + */ +#define PU_TORCH 0x00000002L +/** @def PU_BODY + * @note Calculate body parts + */ +#define PU_BODY 0x00000004L +/** @def PU_SANITY + * @note Calculate csan and msan + */ +#define PU_SANITY 0x00000008L +/** @def PU_HP + * @note Calculate chp and mhp + */ +#define PU_HP 0x00000010L +/** @def PU_MANA + * @note Calculate csp and msp + */ +#define PU_MANA 0x00000020L +/** @def PU_SPELLS + * @note Calculate spells + */ +#define PU_SPELLS 0x00000040L +/** @def PU_POWERS + * @note Calculate powers + */ +#define PU_POWERS 0x00000080L +/* xxx (many) */ +/** @def PU_UN_VIEW + * @note Forget view + */ +#define PU_UN_VIEW 0x00010000L +/* xxx (many) */ +/** @def PU_VIEW + * @note Update view + */ +#define PU_VIEW 0x00100000L +/** @def PU_MON_LITE + * @note Update monster light + */ +#define PU_MON_LITE 0x00200000L +/* xxx */ +/** @def PU_MONSTERS + * @note Update monsters + */ +#define PU_MONSTERS 0x01000000L +/** @def PU_DISTANCE + * @note Update distances + */ +#define PU_DISTANCE 0x02000000L +/* xxx */ +/** @def PU_FLOW + * @note Update flow + */ +#define PU_FLOW 0x10000000L +/* xxx (many) */ +/** @} */ + + +/** @name Redraw flags + * @brief Bit flags for the "p_ptr->redraw" variable + * @{ */ +/** @def PR_MISC + * @note Display Race/Class + */ +#define PR_MISC 0x00000001L +/** @def PR_TITLE + * @note Display Title + */ +#define PR_TITLE 0x00000002L +/** @def PR_LEV + * @note Display Level + */ +#define PR_LEV 0x00000004L +/** @def PR_EXP + * @note Display Experience + */ +#define PR_EXP 0x00000008L +/** @def PR_STATS + * @note Display Stats + */ +#define PR_STATS 0x00000010L +/** @def PR_ARMOR + * @note Display Armor + */ +#define PR_ARMOR 0x00000020L +/** @def PR_HP + * @note Display Hitpoints + */ +#define PR_HP 0x00000040L +/** @def PR_MANA + * @note Display Mana + */ +#define PR_MANA 0x00000080L +/** @def PR_GOLD + * @note Display Gold + */ +#define PR_GOLD 0x00000100L +/** @def PR_DEPTH + * @note Display Depth + */ +#define PR_DEPTH 0x00000200L +/****/ +/** @def PR_HEALTH + * @note Display Health Bar + */ +#define PR_HEALTH 0x00000800L +/** @def PR_CUT + * @note Display Extra (Cut) + */ +#define PR_CUT 0x00001000L +/** @def PR_STUN + * @note Display Extra (Stun) + */ +#define PR_STUN 0x00002000L +/** @def PR_HUNGER + * @note Display Extra (Hunger) + */ +#define PR_HUNGER 0x00004000L +/** @def PR_PIETY + * @note Display Piety + */ +#define PR_PIETY 0x00008000L +/** @def PR_BLIND + * @note Display Extra (Blind) + */ +#define PR_BLIND 0x00010000L +/** @def PR_CONFUSED + * @note Display Extra (Confused) + */ +#define PR_CONFUSED 0x00020000L +/** @def PR_AFRAID + * @note Display Extra (Afraid) + */ +#define PR_AFRAID 0x00040000L +/** @def PR_POISONED + * @note Display Extra (Poisoned) + */ +#define PR_POISONED 0x00080000L +/** @def PR_STATE + * @note Display Extra (State) + */ +#define PR_STATE 0x00100000L +/** @def PR_SPEED + * @note Display Extra (Speed) + */ +#define PR_SPEED 0x00200000L +/** @def PR_STUDY + * @note Display Extra (Study) + */ +#define PR_STUDY 0x00400000L +/** @def PR_SANITY + * @note Display Sanity + */ +#define PR_SANITY 0x00800000L +/** @def PR_EXTRA + * @note Display Extra Info + */ +#define PR_EXTRA 0x01000000L +/** @def PR_BASIC + * @note Display Basic Info + */ +#define PR_BASIC 0x02000000L +/** @def PR_MAP + * @note Display Map + */ +#define PR_MAP 0x04000000L +/** @def PR_WIPE + * @note Hack -- Total Redraw + */ +#define PR_WIPE 0x08000000L +/** @def PR_MH + * @note Display Monster hitpoints + */ +#define PR_MH 0x10000000L +/** @def PR_MH + * @note Display Monster hitpoints + */ +#define PR_MH 0x10000000L +/** @def PR_DTRAP + * @note Display Extra (DTrap) + */ +#define PR_DTRAP 0x20000000L +/* xxx */ +/* xxx */ +/** @} */ + + +/** @name Window flags + * @brief Bit flags for the "p_ptr->window" variable (etc) + * @{ */ +/** @def PW_INVEN + * @note Display inven/equip + */ +#define PW_INVEN 0x00000001L +/** @def PW_EQUIP + * @note Display equip/inven + */ +#define PW_EQUIP 0x00000002L +/* xxx */ +/** @def PW_PLAYER + * @note Display character + */ +#define PW_PLAYER 0x00000008L +/** @def PW_M_LIST + * @note Show monster list + */ +#define PW_M_LIST 0x00000010L +/* xxx */ +/** @def PW_MESSAGE + * @note Display messages + */ +#define PW_MESSAGE 0x00000040L +/** @def PW_OVERHEAD + * @note Display overhead view + */ +#define PW_OVERHEAD 0x00000080L +/** @def PW_MONSTER + * @note Display monster recall + */ +#define PW_MONSTER 0x00000100L +/** @def PW_OBJECT + * @note Display object recall + */ +#define PW_OBJECT 0x00000200L +/* xxx */ +/** @def PW_SNAPSHOT + * @note Display snap-shot + */ +#define PW_SNAPSHOT 0x00000800L +/* xxx */ +/* xxx */ +/** @def PW_BORG_1 + * @note Display borg messages + */ +#define PW_BORG_1 0x00004000L +/** @def PW_BORG_2 + * @note Display borg status + */ +#define PW_BORG_2 0x00008000L +/** @} */ + +/** @struct deity_type + */ +struct deity_type +{ + /** @structvar name + * @brief String + */ + cptr name; +}; +/** @var deity_info[max_gods] + * @brief deity_type + * @note Array of gods. + */ +extern deity_type deity_info[max_gods]; + +/** @name Body parts + * @{ */ +/** @def BODY_WEAPON */ +#define BODY_WEAPON 0 + +/** @def BODY_TORSO */ +#define BODY_TORSO 1 + +/** @def BODY_ARMS */ +#define BODY_ARMS 2 + +/** @def BODY_FINGER */ +#define BODY_FINGER 3 + +/** @def BODY_HEAD */ +#define BODY_HEAD 4 + +/** @def BODY_LEGS */ +#define BODY_LEGS 5 + +/** @def BODY_MAX */ +#define BODY_MAX 6 +/** @} */ + + +/** @struct player_type + */ +struct player_type +{ + /** @structvar lives + * @brief Number + * @note How many times we resurected + */ + s32b lives; + + /** @structvar oldpy + * @brief Number + * @note Previous player location -KMW- + */ + s16b oldpy; + /** @structvar oldpx + * @brief Number + * @note Previous player location -KMW- + */ + s16b oldpx; + + /** @structvar py + * @brief Number + * @note Player location + */ + s16b py; + /** @structvar px + * @brief Number + * @note Player location + */ + s16b px; + + /** @structvar psex + * @brief Number + * @note Sex index + */ + byte psex; + /** @structvar prace + * @brief Number + * @note Race index + */ + byte prace; + /** @structvar pracem + * @brief Number + * @note Race Mod index + */ + byte pracem; + /** @structvar pclass + * @brief Number + * @note Class index + */ + byte pclass; + /** @structvar mimic_form + * @brief Number + * @note Actualy transformation + */ + byte mimic_form; + /** @structvar mimic_level + * @brief Number + * @note Level of the mimic effect + */ + s16b mimic_level; + /** @structvar oops + * @brief Number + * @note Unused + */ + byte oops; + + object_type inventory[INVEN_TOTAL] @inventory_real; + + /** @structvar hitdie + * @brief Number + * @note Hit dice (sides) + */ + byte hitdie; + /** @structvar expfact + * @brief Number + * @note Experience factor + */ + u16b expfact; + + /** @structvar allow_one_death + * @brief Number + * @note Blood of life + */ + byte allow_one_death; + + /** @structvar age + * @brief Number + * @note Characters age + */ + s16b age; + /** @structvar ht + * @brief Number + * @note Height + */ + s16b ht; + /** @structvar wt + * @brief Number + * @note Weight + */ + s16b wt; + /** @structvar sc + * @brief Number + * @note Social Class + */ + s16b sc; + + + /** @structvar au + * @brief Number + * @note Current Gold + */ + s32b au; + + /** @structvar max_exp + * @brief Number + * @note Max experience + */ + s32b max_exp; + /** @structvar exp + * @brief Number + * @note Cur experience + */ + s32b exp; + /** @structvar exp_frac + * @brief Number + * @note Cur exp frac (times 2^16) + */ + u16b exp_frac; + + /** @structvar lev + * @brief Number + * @note Level + */ + s16b lev; + + /** @structvar town_num + * @brief Number + * @note Current town number + */ + s16b town_num; + /** @structvar inside_quest + * @brief Number + * @note Inside quest level + */ + s16b inside_quest; + /** @structvar exit_bldg + * @brief Boolean + * @note Goal obtained in arena? -KMW- + */ + bool exit_bldg; + + /** @structvar wilderness_x + * @brief Number + * @note Coordinates in the wilderness + */ + s32b wilderness_x; + /** @structvar wilderness_y + * @brief Number + */ + s32b wilderness_y; + /** @structvar wild_mode + * @brief Boolean + * @note TRUE = Small map, FLASE = Big map + */ + bool wild_mode; + /** @structvar old_wild_mode + * @brief Boolean + * @note TRUE = Small map, FLASE = Big map + */ + bool old_wild_mode; + + /** @structvar mhp + * @brief Number + * @note Max hit pts + */ + s16b mhp; + /** @structvar chp + * @brief Number + * @note Cur hit pts + */ + s16b chp; + /** @structvar chp_frac + * @brief Number + * @note Cur hit frac (times 2^16) + */ + u16b chp_frac; + /** @structvar hp_mod + * @brief Number + * @note A modificator(permanent) + */ + s16b hp_mod; + + /** @structvar msp + * @brief Number + * @note Max mana pts + */ + s16b msp; + /** @structvar csp + * @brief Number + * @note Cur mana pts + */ + s16b csp; + /** @structvar csp_frac + * @brief Number + * @note Cur mana frac (times 2^16) + */ + u16b csp_frac; + + /** @structvar msane + * @brief Number + * @note Max sanity + */ + s16b msane; + /** @structvar csane + * @brief Number + * @note Cur sanity + */ + s16b csane; + /** @structvar csane_frac + * @brief Number + * @note Cur sanity frac + */ + u16b csane_frac; + + /** @structvar grace + * @brief Number + * @note Your God's appreciation factor. + */ + s32b grace; + /** @structvar pgod + * @brief Number + * @note Your God. + */ + byte pgod; + /** @structvar praying + * @brief Boolean + * @note Praying to your god. + */ + bool praying; + + /** @structvar max_plv + * @brief Number + * @note Max Player Level + */ + s16b max_plv; + + /** @structvar stat_max[6] + * @brief Number + * @note Current "maximal" stat values + */ + s16b stat_max[6]; + /** @structvar stat_cur[6] + * @brief Number + * @note Current "natural" stat values + */ + s16b stat_cur[6]; + + /** @structvar luck_cur + * @brief Number + * @note Current "natural" luck value (range -30 <> 30) + */ + s16b luck_cur; + /** @structvar luck_max + * @brief Number + * @note Current "maximal base" luck value (range -30 <> 30) + */ + s16b luck_max; + /** @structvar luck_base + * @brief Number + * @note Current "base" luck value (range -30 <> 30) + */ + s16b luck_base; + + /** @structvar fast + * @brief Number + * @note Timed -- Fast + */ + s16b fast; + /** @structvar lightspeed + * @brief Number + * @note Timed -- Light Speed + */ + s16b lightspeed; + /** @structvar slow + * @brief Number + * @note Timed -- Slow + */ + s16b slow; + /** @structvar blind + * @brief Number + * @note Timed -- Blindness + */ + s16b blind; + /** @structvar paralyzed + * @brief Number + * @note Timed -- Paralysis + */ + s16b paralyzed; + /** @structvar confused + * @brief Number + * @note Timed -- Confusion + */ + s16b confused; + /** @structvar afraid + * @brief Number + * @note Timed -- Fear + */ + s16b afraid; + /** @structvar image + * @brief Number + * @note Timed -- Hallucination + */ + s16b image; + /** @structvar poisoned + * @brief Number + * @note Timed -- Poisoned + */ + s16b poisoned; + /** @structvar cut + * @brief Number + * @note Timed -- Cut + */ + s16b cut; + /** @structvar stun + * @brief Number + * @note Timed -- Stun + */ + s16b stun; + + /** @structvar protevil + * @brief Number + * @note Timed -- Protection from Evil + */ + s16b protevil; + /** @structvar protgood + * @brief Number + * @note Timed -- Protection from Good + */ + s16b protgood; + /** @structvar protundead + * @brief Number + * @note Timed -- Protection from Undead + */ + s16b protundead; + /** @structvar invuln + * @brief Number + * @note Timed -- Invulnerable + */ + s16b invuln; + /** @structvar hero + * @brief Number + * @note Timed -- Heroism + */ + s16b hero; + /** @structvar shero + * @brief Number + * @note Timed -- Super Heroism + */ + s16b shero; + /** @structvar shield + * @brief Number + * @note Timed -- Shield Spell + */ + s16b shield; + /** @structvar shield_power + * @brief Number + * @note Timed -- Shield Spell Power + */ + s16b shield_power; + /** @structvar shield_opt + * @brief Number + * @note Timed -- Shield Spell options + */ + s16b shield_opt; + /** @structvar blessed + * @brief Number + * @note Timed -- Blessed + */ + s16b blessed; + /** @structvar tim_invis + * @brief Number + * @note Timed -- See Invisible + */ + s16b tim_invis; + /** @structvar tim_infra + * @brief Number + * @note Timed -- Infra Vision + */ + s16b tim_infra; + + /** @structvar oppose_acid + * @brief Number + * @note Timed -- oppose acid + */ + s16b oppose_acid; + /** @structvar oppose_elec + * @brief Number + * @note Timed -- oppose lightning + */ + s16b oppose_elec; + /** @structvar oppose_fire + * @brief Number + * @note Timed -- oppose heat + */ + s16b oppose_fire; + /** @structvar oppose_cold + * @brief Number + * @note Timed -- oppose cold + */ + s16b oppose_cold; + /** @structvar oppose_pois + * @brief Number + * @note Timed -- oppose poison + */ + s16b oppose_pois; + /** @structvar oppose_ld + * @brief Number + * @note Timed -- oppose light & dark + */ + s16b oppose_ld; + /** @structvar oppose_cc + * @brief Number + * @note Timed -- oppose chaos & confusion + */ + s16b oppose_cc; + /** @structvar oppose_ss + * @brief Number + * @note Timed -- oppose sound & shards + */ + s16b oppose_ss; + /** @structvar oppose_nex + * @brief Number + * @note Timed -- oppose nexus + */ + s16b oppose_nex; + + + /** @structvar tim_esp + * @brief Number + * @note Timed ESP + */ + s16b tim_esp; + /** @structvar tim_wraith + * @brief Number + * @note Timed wraithform + */ + s16b tim_wraith; + /** @structvar tim_ffall + * @brief Number + * @note Timed Levitation + */ + s16b tim_ffall; + /** @structvar tim_fly + * @brief Number + * @note Timed Levitation + */ + s16b tim_fly; + /** @structvar tim_fire_aura + * @brief Number + * @note Timed Fire Aura + */ + s16b tim_fire_aura; + /** @structvar tim_regen + * @brief Number + * @note Timed regen + */ + s16b tim_regen; + /** @structvar tim_regen_pow + * @brief Number + * @note Timed regen + */ + s16b tim_regen_pow; + /** @structvar tim_poison + * @brief Number + * @note Timed poison hands + */ + s16b tim_poison; + /** @structvar tim_thunder + * @brief Number + * @note Timed thunderstorm + */ + s16b tim_thunder; + /** @structvar tim_thunder_p1 + * @brief Number + * @note Timed thunderstorm + */ + s16b tim_thunder_p1; + /** @structvar tim_thunder_p2 + * @brief Number + * @note Timed thunderstorm + */ + s16b tim_thunder_p2; + + /** @structvar resist_magic + * @brief Number + * @note Timed Resist Magic (later) + */ + s16b resist_magic; + /** @structvar tim_invisible + * @brief Number + * @note Timed Invisibility + */ + s16b tim_invisible; + /** @structvar tim_inv_pow + * @brief Number + * @note Power of timed invisibility + */ + s16b tim_inv_pow; + /** @structvar tim_mimic + * @brief Number + * @note Timed Mimic + */ + s16b tim_mimic; + /** @structvar tim_lite + * @brief Number + * @note Timed Lite + */ + s16b tim_lite; + /** @structvar holy + * @brief Number + * @note Holy Aura + */ + s16b holy; + /** @structvar walk_water + * @brief Number + * @note Walk over water as a god + */ + s16b walk_water; + /** @structvar tim_mental_barrier + * @brief Number + * @note Sustain Int&Wis + */ + s16b tim_mental_barrier; + /** @structvar strike + * @brief Number + * @note True Strike(+25 hit) + */ + s16b strike; + /** @structvar meditation + * @brief Number + * @note Meditation(+50 mana -25 to hit/to dam) + */ + s16b meditation; + /** @structvar tim_reflect + * @brief Number + * @note Timed Reflection + */ + s16b tim_reflect; + /** @structvar tim_res_time + * @brief Number + * @note Timed Resistance to Time + */ + s16b tim_res_time; + /** @structvar tim_deadly + * @brief Number + * @note Timed deadly blow + */ + s16b tim_deadly; + /** @structvar prob_travel + * @brief Number + * @note Timed probability travel + */ + s16b prob_travel; + /** @structvar disrupt_shield + * @brief Number + * @note Timed disruption shield + */ + s16b disrupt_shield; + /** @structvar parasite + * @brief Number + * @note Timed parasite + */ + s16b parasite; + /** @structvar parasite_r_idx + * @brief Number + * @note Timed parasite monster + */ + s16b parasite_r_idx; + /** @structvar loan + * @brief Number + */ + u32b loan; + /** @structvar loan_time + * @brief Number + * @note Timer -- loan + */ + u32b loan_time; + /** @structvar tim_magic_breath + * @brief Number + * @note Magical breathing -- can breath anywhere + */ + s16b tim_magic_breath; + /** @structvar tim_water_breath + * @brief Number + * @note Water breathing -- can breath underwater + */ + s16b tim_water_breath; + + /** @structvar immov_cntr + * @brief Number + * @note Timed -- Last ``immovable'' command. + */ + s16b immov_cntr; + + /** @structvar music_extra + * @brief Number + * @note Music songs + */ + u32b music_extra; + /** @structvar music_extra2 + * @brief Number + * @note Music songs + */ + u32b music_extra2; + + /** @structvar chaos_patron + * @brief Number + */ + s16b chaos_patron; + + /** @structvar recall_dungeon + * @brief Number + * @note Recall in which dungeon + */ + s16b recall_dungeon; + /** @structvar word_recall + * @brief Number + * @note Word of recall counter + */ + s16b word_recall; + + /** @structvar energy + * @brief Number + * @note Current energy + */ + s32b energy; + + /** @structvar food + * @brief Number + * @note Current nutrition + */ + s16b food; + + /** @structvar confusing + * @brief Number + * @note Glowing hands + */ + byte confusing; + /** @structvar searching + * @brief Number + * @note Currently searching + */ + byte searching; + + /** @structvar new_spells + * @brief Number + * @note Number of spells available + */ + s16b new_spells; + + /** @structvar old_spells + * @brief Number + */ + s16b old_spells; + + /** @structvar xtra_spells + * @brief Number + * @note Number of xtra spell learned(via potion) + */ + s16b xtra_spells; + + /** @structvar cur_lite + * @brief Number + * @note Radius of lite (if any) + */ + s16b cur_lite; + + /*** Extra flags -- used for lua and easying stuff ***/ + /** @structvar xtra_f1 + * @brief Number + */ + u32b xtra_f1; + /** @structvar xtra_f2 + * @brief Number + */ + u32b xtra_f2; + /** @structvar xtra_f3 + * @brief Number + */ + u32b xtra_f3; + /** @structvar xtra_f4 + * @brief Number + */ + u32b xtra_f4; + /** @structvar xtra_f5 + * @brief Number + */ + u32b xtra_f5; + /** @structvar xtra_esp + * @brief Number + */ + u32b xtra_esp; + + /** @structvar pspeed + * @brief Number + * @note Current speed + */ + s16b pspeed; + + /** @structvar notice + * @brief Number + * @note Special Updates (bit flags) + */ + u32b notice; + /** @structvar update + * @brief Number + * @note Pending Updates (bit flags) + */ + u32b update; + /** @structvar redraw + * @brief Number + * @note Normal Redraws (bit flags) + */ + u32b redraw; + /** @structvar window + * @brief Number + * @note Window Redraws (bit flags) + */ + u32b window; + + /** @structvar stat_use[6] + * @brief Number + * @note Current modified stats + */ + s16b stat_use[6]; + /** @structvar stat_top[6] + * @brief Number + * @note Maximal modified stats + */ + s16b stat_top[6]; + + /** @structvar stat_add[6] + * @brief Number + * @note Modifiers to stat values + */ + s16b stat_add[6]; + /** @structvar stat_ind[6] + * @brief Number + * @note Indexes into stat tables + */ + s16b stat_ind[6]; + /** @structvar stat_cnt[6] + * @brief Number + * @note Counter for temporary drains + */ + s16b stat_cnt[6]; + /** @structvar stat_los[6] + * @brief Number + * @note Amount of temporary drains + */ + s16b stat_los[6]; + + /** @structvar immune_acid + * @brief Boolean + * @note Immunity to acid + */ + bool immune_acid; + /** @structvar immune_elec + * @brief Boolean + * @note Immunity to lightning + */ + bool immune_elec; + /** @structvar immune_fire + * @brief Boolean + * @note Immunity to fire + */ + bool immune_fire; + /** @structvar immune_cold + * @brief Boolean + * @note Immunity to cold + */ + bool immune_cold; + /** @structvar immune_neth + * @brief Boolean + * @note Immunity to nether + */ + bool immune_neth; + + /** @structvar resist_acid + * @brief Boolean + * @note Resist acid + */ + bool resist_acid; + /** @structvar resist_elec + * @brief Boolean + * @note Resist lightning + */ + bool resist_elec; + /** @structvar resist_fire + * @brief Boolean + * @note Resist fire + */ + bool resist_fire; + /** @structvar resist_cold + * @brief Boolean + * @note Resist cold + */ + bool resist_cold; + /** @structvar resist_pois + * @brief Boolean + * @note Resist poison + */ + bool resist_pois; + + /** @structvar resist_conf + * @brief Boolean + * @note Resist confusion + */ + bool resist_conf; + /** @structvar resist_sound + * @brief Boolean + * @note Resist sound + */ + bool resist_sound; + /** @structvar resist_lite + * @brief Boolean + * @note Resist light + */ + bool resist_lite; + /** @structvar resist_dark + * @brief Boolean + * @note Resist darkness + */ + bool resist_dark; + /** @structvar resist_chaos + * @brief Boolean + * @note Resist chaos + */ + bool resist_chaos; + /** @structvar resist_disen + * @brief Boolean + * @note Resist disenchant + */ + bool resist_disen; + /** @structvar resist_shard + * @brief Boolean + * @note Resist shards + */ + bool resist_shard; + /** @structvar resist_nexus + * @brief Boolean + * @note Resist nexus + */ + bool resist_nexus; + /** @structvar resist_blind + * @brief Boolean + * @note Resist blindness + */ + bool resist_blind; + /** @structvar resist_neth + * @brief Boolean + * @note Resist nether + */ + bool resist_neth; + /** @structvar resist_fear + * @brief Boolean + * @note Resist fear + */ + bool resist_fear; + /** @structvar resist_continuum + * @brief Boolean + * @note Resist space-time continuum disruption + */ + bool resist_continuum; + + /** @structvar sensible_fire + * @brief Boolean + * @note Fire does more damage on the player + */ + bool sensible_fire; + /** @structvar sensible_lite + * @brief Boolean + * @note Lite does more damage on the player and blinds her/him + */ + bool sensible_lite; + + /** @structvar reflect + * @brief Boolean + * @note Reflect 'bolt' attacks + */ + bool reflect; + /** @structvar sh_fire + * @brief Boolean + * @note Fiery 'immolation' effect + */ + bool sh_fire; + /** @structvar sh_elec + * @brief Boolean + * @note Electric 'immolation' effect + */ + bool sh_elec; + /** @structvar wraith_form + * @brief Boolean + * @note wraithform + */ + bool wraith_form; + + /** @structvar anti_magic + * @brief Boolean + * @note Anti-magic + */ + bool anti_magic; + /** @structvar anti_tele + * @brief Boolean + * @note Prevent teleportation + */ + bool anti_tele; + + /** @structvar sustain_str + * @brief Boolean + * @note Keep strength + */ + bool sustain_str; + /** @structvar sustain_int + * @brief Boolean + * @note Keep intelligence + */ + bool sustain_int; + /** @structvar sustain_wis + * @brief Boolean + * @note Keep wisdom + */ + bool sustain_wis; + /** @structvar sustain_dex + * @brief Boolean + * @note Keep dexterity + */ + bool sustain_dex; + /** @structvar sustain_con + * @brief Boolean + * @note Keep constitution + */ + bool sustain_con; + /** @structvar sustain_chr + * @brief Boolean + * @note Keep charisma + */ + bool sustain_chr; + + /** @structvar aggravate + * @brief Boolean + * @note Aggravate monsters + */ + bool aggravate; + /** @structvar teleport + * @brief Boolean + * @note Random teleporting + */ + bool teleport; + + /** @structvar exp_drain + * @brief Boolean + * @note Experience draining + */ + bool exp_drain; + /** @structvar drain_mana + * @brief Number + * @note mana draining + */ + byte drain_mana; + /** @structvar drain_life + * @brief Number + * @note hp draining + */ + byte drain_life; + + /** @structvar magical_breath + * @brief Boolean + * @note Magical breathing -- can breath anywhere + */ + bool magical_breath; + /** @structvar water_breath + * @brief Boolean + * @note Water breathing -- can breath underwater + */ + bool water_breath; + /** @structvar climb + * @brief Boolean + * @note Can climb mountains + */ + bool climb; + /** @structvar fly + * @brief Boolean + * @note Can fly over some features + */ + bool fly; + /** @structvar ffall + * @brief Boolean + * @note No damage falling + */ + bool ffall; + /** @structvar lite + * @brief Boolean + * @note Permanent light + */ + bool lite; + /** @structvar free_act + * @brief Boolean + * @note Never paralyzed + */ + bool free_act; + /** @structvar see_inv + * @brief Boolean + * @note Can see invisible + */ + bool see_inv; + /** @structvar regenerate + * @brief Boolean + * @note Regenerate hit pts + */ + bool regenerate; + /** @structvar hold_life + * @brief Boolean + * @note Resist life draining + */ + bool hold_life; + /** @structvar telepathy + * @brief Number + * @note Telepathy + */ + u32b telepathy; + /** @structvar slow_digest + * @brief Boolean + * @note Slower digestion + */ + bool slow_digest; + /** @structvar bless_blade + * @brief Boolean + * @note Blessed blade + */ + bool bless_blade; + /** @structvar xtra_might + * @brief Number + * @note Extra might bow + */ + byte xtra_might; + /** @structvar impact + * @brief Boolean + * @note Earthquake blows + */ + bool impact; + /** @structvar auto_id + * @brief Boolean + * @note Auto id items + */ + bool auto_id; + + /** @structvar dis_to_h + * @brief Number + * @note Known bonus to hit + */ + s16b dis_to_h; + /** @structvar dis_to_d + * @brief Number + * @note Known bonus to dam + */ + s16b dis_to_d; + /** @structvar dis_to_a + * @brief Number + * @note Known bonus to ac + */ + s16b dis_to_a; + + /** @structvar dis_ac + * @brief Number + * @note Known base ac + */ + s16b dis_ac; + + /** @structvar to_m + * @brief Number + * @note Bonus to mana + */ + s16b to_m; + /** @structvar to_s + * @brief Number + * @note Bonus to spell + */ + s16b to_s; + /** @structvar to_h + * @brief Number + * @note Bonus to hit + */ + s16b to_h; + /** @structvar to_d + * @brief Number + * @note Bonus to dam + */ + s16b to_d; + /** @structvar to_a + * @brief Number + * @note Bonus to ac + */ + s16b to_a; + + /** @structvar to_h_melee + * @brief Number + * @note Bonus to hit + */ + s16b to_h_melee; + /** @structvar to_d_melee + * @brief Number + * @note Bonus to dam + */ + s16b to_d_melee; + + /** @structvar to_h_ranged + * @brief Number + * @note Bonus to hit + */ + s16b to_h_ranged; + /** @structvar to_d_ranged + * @brief Number + * @note Bonus to dam + */ + s16b to_d_ranged; + + /** @structvar num_blow + * @brief Number + * @note Number of blows + */ + s16b num_blow; + /** @structvar num_fire + * @brief Number + * @note Number of shots + */ + s16b num_fire; + + /** @structvar ac + * @brief Number + * @note Base ac + */ + s16b ac; + + /** @structvar antimagic + * @brief Number + * @note Power of the anti magic field + */ + byte antimagic; + /** @structvar antimagic_dis + * @brief Number + * @note Radius of the anti magic field + */ + byte antimagic_dis; + + /** @structvar see_infra + * @brief Number + * @note Infravision range + */ + s16b see_infra; + + /** @structvar skill_dis + * @brief Number + * @note Skill: Disarming + */ + s16b skill_dis; + /** @structvar skill_dev + * @brief Number + * @note Skill: Magic Devices + */ + s16b skill_dev; + /** @structvar skill_sav + * @brief Number + * @note Skill: Saving throw + */ + s16b skill_sav; + /** @structvar skill_stl + * @brief Number + * @note Skill: Stealth factor + */ + s16b skill_stl; + /** @structvar skill_srh + * @brief Number + * @note Skill: Searching ability + */ + s16b skill_srh; + /** @structvar skill_fos + * @brief Number + * @note Skill: Searching frequency + */ + s16b skill_fos; + /** @structvar skill_thn + * @brief Number + * @note Skill: To hit (normal) + */ + s16b skill_thn; + /** @structvar skill_thb + * @brief Number + * @note Skill: To hit (shooting) + */ + s16b skill_thb; + /** @structvar skill_tht + * @brief Number + * @note Skill: To hit (throwing) + */ + s16b skill_tht; + /** @structvar skill_dig + * @brief Number + * @note Skill: Digging + */ + s16b skill_dig; + + /** @structvar skill_points + * @brief Number + */ + s16b skill_points; + + /** @structvar control + * @brief Number + * @note Controlled monster + */ + s16b control; + /** @structvar control_dir + * @brief Number + * @note Controlled monster + */ + byte control_dir; + /** @structvar companion_killed + * @brief Number + * @note Number of companion death + */ + s16b companion_killed; + /** @structvar black_breath + * @brief Boolean + * @note The Tolkien's Black Breath + */ + bool black_breath; + /** @structvar body_monster + * @brief Number + * @note In which body is the player + */ + u16b body_monster; + + /** @structvar body_parts[28] + * @brief Number + * @note Various body modifiers + */ + byte body_parts[28]; + + /** @structvar extra_body_parts[BODY_MAX] + * @brief Number + * @note Various body modifiers + */ + s16b extra_body_parts[BODY_MAX]; + + /** @structvar powers_mod[POWER_MAX_INIT] + * @brief Boolean + * @note Intrinsinc powers + */ + bool powers_mod[POWER_MAX_INIT]; + /** @structvar powers[power_max] + * @brief Boolean + */ + bool powers[power_max]; + + /** @structvar spellbinder_num + * @brief Number + * @note Number of spells bound + */ + byte spellbinder_num; + /** @structvar spellbinder[4] + * @brief Number + * @note Spell bounds + */ + u32b spellbinder[4]; + /** @structvar spellbinder_trigger + * @brief Number + * @note Spellbinder trigger condition + */ + byte spellbinder_trigger; + + /* Corruptions */ + /** @structvar corruptions_aux; + * @brief Boolean + */ + bool corruptions[max_corruptions] @ corruptions_aux; + + /* Astral */ + /** @structvar astral + * @brief Boolean + * @note We started at the bottom ? + */ + bool astral; + + /*** Temporary fields ***/ + + /** @structvar leaving + * @brief Boolean + * @note True if player is leaving + */ + bool leaving; +}; + +/** @name Spellbinder triggers + * @{ */ +/** @def SPELLBINDER_HP75 + * @note Trigger spellbinder at 75% maximum hit points */ +#define SPELLBINDER_HP75 1 + +/** @def SPELLBINDER_HP50 + * @note Trigger spellbinder at 50% maximum hit points */ +#define SPELLBINDER_HP50 2 + +/** @def SPELLBINDER_HP25 + * @note Trigger spellbinder at 25% maximum hit points */ +#define SPELLBINDER_HP25 3 +/** @} */ + + +/** @struct player_race + */ +struct player_race +{ + /** @structvar title + * @brief Number + * @note Type of race + */ + s32b title; + /** @structvar desc + * @brief Number + */ + s32b desc; + + /** @structvar infra + * @brief Number + * @note Infra-vision range + */ + byte infra; +}; + +/** @struct player_race_mod + */ +struct player_race_mod +{ + /** @structvar title + * @brief Number + * @note Type of race mod + */ + s32b title; + /** @structvar desc + * @brief Number + * @note Desc + */ + s32b desc; + /** @structvar place + * @brief Boolean + * @note TRUE = race race modifier, FALSE = Race modifier race + */ + bool place; + + /** @structvar r_adj[6] + * @brief Number + * @note (+) Racial stat bonuses + */ + s16b r_adj[6]; + + /** @structvar luck + * @brief String + * @note Luck + */ + char luck; + /** @structvar mana + * @brief Number + * @note Mana % + */ + s16b mana; + + /** @structvar r_dis + * @brief Number + * @note (+) disarming + */ + s16b r_dis; + /** @structvar r_dev + * @brief Number + * @note (+) magic devices + */ + s16b r_dev; + /** @structvar r_sav + * @brief Number + * @note (+) saving throw + */ + s16b r_sav; + /** @structvar r_stl + * @brief Number + * @note (+) stealth + */ + s16b r_stl; + /** @structvar r_srh + * @brief Number + * @note (+) search ability + */ + s16b r_srh; + /** @structvar r_fos + * @brief Number + * @note (+) search frequency + */ + s16b r_fos; + /** @structvar r_thn + * @brief Number + * @note (+) combat (normal) + */ + s16b r_thn; + /** @structvar r_thb + * @brief Number + * @note (+) combat (shooting) + */ + s16b r_thb; + + /** @structvar r_mhp + * @brief String + * @note (+) Race mod hit-dice modifier + */ + char r_mhp; + /** @structvar r_exp + * @brief Number + * @note (+) Race mod experience factor + */ + s16b r_exp; + + /** @structvar b_age + * @brief String + * @note (+) base age + */ + char b_age; + /** @structvar m_age + * @brief String + * @note (+) mod age + */ + char m_age; + + /** @structvar m_b_ht + * @brief String + * @note (+) base height (males) + */ + char m_b_ht; + /** @structvar m_m_ht + * @brief String + * @note (+) mod height (males) + */ + char m_m_ht; + /** @structvar m_b_wt + * @brief String + * @note (+) base weight (males) + */ + char m_b_wt; + /** @structvar m_m_wt + * @brief String + * @note (+) mod weight (males) + */ + char m_m_wt; + + /** @structvar f_b_ht + * @brief String + * @note (+) base height (females) + */ + char f_b_ht; + /** @structvar f_m_ht + * @brief String + * @note (+) mod height (females) + */ + char f_m_ht; + /** @structvar f_b_wt + * @brief String + * @note (+) base weight (females) + */ + char f_b_wt; + /** @structvar f_m_wt + * @brief String + * @note (+) mod weight (females) + */ + char f_m_wt; + + /** @structvar infra + * @brief String + * @note (+) Infra-vision range + */ + char infra; + + /** @structvar choice[2] + * @brief Number + * @note Legal race choices + */ + u32b choice[2]; + + /** @structvar pclass[2] + * @brief Number + * @note Classes allowed + */ + u32b pclass[2]; + /** @structvar mclass[2] + * @brief Number + * @note Classes restricted + */ + u32b mclass[2]; + + /** @structvar powers[4] + * @brief Number + * @note Powers of the subrace + */ + s16b powers[4]; + + /** @structvar body_parts[BODY_MAX] + * @brief String + * @note To help to decide what to use when body changing + */ + char body_parts[BODY_MAX]; + + /** @structvar flags1 + * @brief Number + */ + u32b flags1; + /** @structvar flags2 + * @brief Number + * @note flags + */ + u32b flags2; + + /** @structvar oflags1[51] + * @brief Number + */ + u32b oflags1[51]; + /** @structvar oflags2[51] + * @brief Number + */ + u32b oflags2[51]; + /** @structvar oflags3[51] + * @brief Number + */ + u32b oflags3[51]; + /** @structvar oflags4[51] + * @brief Number + */ + u32b oflags4[51]; + /** @structvar oflags5[51] + * @brief Number + */ + u32b oflags5[51]; + /** @structvar oesp[51] + * @brief Number + */ + u32b oesp[51]; + /** @structvar opval[51] + * @brief Number + */ + s16b opval[51]; + + /** @structvar g_attr + * @brief Number + * @note Overlay graphic attribute + */ + byte g_attr; + /** @structvar g_char + * @brief String + * @note Overlay graphic character + */ + char g_char; + + /** @structvar skill_basem[MAX_SKILLS] + * @brief String + */ + char skill_basem[MAX_SKILLS]; + /** @structvar skill_base[MAX_SKILLS] + * @brief Number + */ + u32b skill_base[MAX_SKILLS]; + /** @structvar skill_modm[MAX_SKILLS] + * @brief String + */ + char skill_modm[MAX_SKILLS]; + /** @structvar skill_mod[MAX_SKILLS] + * @brief Number + */ + s16b skill_mod[MAX_SKILLS]; +}; + +/** @var energy_use + * @brief Number + * @note Energy use for an action (0 if action does not take a turn). + */ +extern s32b energy_use; + +/** @var player; + * @brief player_type + * @note The player. + */ +extern player_type *p_ptr @ player; + +/** @var max_rp_idx + * @brief Number + * @note Maximum number of entries in player race array. + */ +extern u16b max_rp_idx; + +/** @var race_info[max_rp_idx] + * @brief player_race + * @note Array of player races. + */ +extern player_race race_info[max_rp_idx]; + +/** @var *rp_name + * @brief String + * @note Name of player race. + */ +extern char *rp_name; + +/** @var *rp_text + * @brief String + */ +extern char *rp_text; + +/** @var max_rmp_idx + * @brief Number + * @note Maximum number of player subraces. + */ +extern u16b max_rmp_idx; + +/** @var _mod race_mod_info[max_rmp_idx] + * @brief player_race + * @note Array of player subraces. + */ +extern player_race_mod race_mod_info[max_rmp_idx]; + +/** @var *rmp_name + * @brief String + * @note Name of player subrace. + */ +extern char *rmp_name; + +/** @var *rmp_text + * @brief String + */ +extern char *rmp_text; + +/** @var class_info[max_c_idx] + * @brief player_class + * @note Array of classes. + */ +extern player_class class_info[max_c_idx]; + +/** @var *c_name + * @brief String + * @note Name of player class. + */ +extern char *c_name; + +/** @var *c_text + * @brief String + */ +extern char *c_text; + +/** @var flush_failure + * @brief Boolean + * @note TRUE if flush input on any failure, otherwise FALSE. + */ +extern bool flush_failure; + +/** @fn set_roots(int v, s16b ac, s16b dam) + * @brief Player has timed roots.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @param ac Number \n bonus to AC + * @brief AC bonus + * @param dam Number \n bonus to melee to-damage + * @brief To-damage bonus + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_roots(int v, s16b ac, s16b dam); + +/** @fn set_shadow(int v) + * @brief Player has wraith form.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_shadow(int v); + +/** @fn set_parasite(int v, int r) + * @brief Player has timed parasite.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @param r Number \n index of race in monster race array + * @brief Parasite race index + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note + * When the time remaining reaches 0, there is an 80% chance the parasite will + * be born, otherwise it will die away. + * @note (see file xtra2.c) + */ +extern bool set_parasite(int v, int r); + +/** @fn set_disrupt_shield(int v) + * @brief Player has timed disrupt shield (feels invulnerable).\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_disrupt_shield(int v); + +/** @fn set_prob_travel(int v) + * @brief Player has timed probability travel.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_prob_travel(int v); + +/** @fn set_project(int v, s16b gf, s16b dam, s16b rad, s16b flag) + * @brief Player's weapon has a spell effect.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @param gf Number \n spell effect + * @brief Spell effect + * @param dam Number \n damage caused by spell effect + * @brief Spell damage + * @param rad Number \n radius of spell effect + * @brief Spell radius + * @param flag Number \n spell projection effect + * @brief Spell properties + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_project(int v, s16b gf, s16b dam, s16b rad, s16b flag); + +/** @fn set_tim_deadly(int v) + * @brief Player has deadly accuracy.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_tim_deadly(int v); + +/** @fn set_tim_res_time(int v) + * @brief Player has timed time resistance.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_tim_res_time(int v); + +/** @fn set_tim_reflect(int v) + * @brief Player has timed reflection.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_tim_reflect(int v); + +/** @fn set_meditation(int v) + * @brief Player can meditate (forcibly pseudo-id).\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_meditation(int v); + +/** @fn set_strike(int v) + * @brief Player has true strike.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_strike(int v); + +/** @fn set_walk_water(int v) + * @brief Player can walk on water.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_walk_water(int v); + +/** @fn set_tim_ffall(int v) + * @brief Player has timed levitation (feather-fall).\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_tim_ffall(int v); + +/** @fn set_tim_fire_aura(int v) + * @brief Player has a timed fiery aura.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_tim_fire_aura(int v); + +/** @fn set_tim_regen(int v, int p) + * @brief Player has timed regeneration.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @param p Number \n power of regeneration + * @brief Regeneration power + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_tim_regen(int v, int p); + +/** @fn set_holy(int v) + * @brief Player has a timed holy aura.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_holy(int v); + +/** @fn set_grace(s32b v) + * @brief Set the amount of grace a player has with a god.\n + * @param v Number \n time remaining until effect expires + * (must be in the range -30,000 to 30,000) + * @brief Grace + * @note (see file xtra2.c) + */ +extern void set_grace(s32b v); + +/** @fn set_mimic(int v, int p, int level) + * @brief Player has mimic form.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @param p Number \n the mimic form + * @brief Mimic form + * @param level Number \n the level of the mimic form + * @brief Mimic level + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_mimic(int v, int p, int level); + +/** @fn set_no_breeders(int v) + * @brief Player has timed breeder prevention.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_no_breeders(int v); + +/** @fn set_tim_esp(int v) + * @brief Player has timed ESP.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_tim_esp(int v); + +/** @fn set_invis(int v, int p) + * @brief Player has timed invisibility.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @param p Number \n power of invisibility + * @brief Invisibility power + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_invis(int v, int p); + +/** @fn set_lite(int v) + * @brief Player has timed light.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note + * Note the use of "PU_VIEW", which is needed to + * memorize any terrain features which suddenly become "visible". + * @note + * Note that blindness is currently the only thing which can affect + * "player_can_see_bold()". + * @note (see file xtra2.c) + */ +extern bool set_lite(int v); + +/** @fn set_blind(int v) + * @brief Player has timed blindness.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note + * Note the use of "PU_UN_VIEW", which is needed to memorize any terrain + * features which suddenly become "visible". + * @note + * Note that blindness is currently the only thing which can affect + * "player_can_see_bold()". + * @note (see file xtra2.c) + */ +extern bool set_blind(int v); + +/** @fn set_confused(int v) + * @brief Player has timed confusion.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_confused(int v); + +/** @fn set_poisoned(int v) + * @brief Player has timed poisoning.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_poisoned(int v); + +/** @fn set_afraid(int v) + * @brief Player has timed fear.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_afraid(int v); + +/** @fn set_paralyzed(int v) + * @brief Player has timed paralysis.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_paralyzed(int v); + +/** @fn set_image(int v) + * @brief Player has timed hallucination.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note + * Note that we must redraw the map when hallucination changes. + * @note (see file xtra2.c) + */ +extern bool set_image(int v); + +/** @fn set_fast(int v, int p) + * @brief Player has timed speed boost.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @param p Number \n speed factor + * @brief Speed factor + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_fast(int v, int p); + +/** @fn set_light_speed(int v) + * @brief Player has timed light speed.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_light_speed(int v); + +/** @fn set_slow(int v) + * @brief Player has timed slowness.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_slow(int v); + +/** @fn set_shield(int v, int p, s16b o, s16b d1, s16b d2) + * @brief Player has timed mystic shield.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @param p Number \n bonus to AC + * @brief AC bonus + * @param o Number \n type of shield (see SHIELD_foo fields) + * @brief Shield type + * @param d1 Number \n number of dice for damage roll + * @brief Damage dice + * @param d2 Number \n number of sides per die for damage roll + * @brief Damage sides + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_shield(int v, int p, s16b o, s16b d1, s16b d2); + +/* For calc_bonus hooks */ +/** @fn apply_flags(u32b f1, u32b f2, u32b f3, u32b f4, u32b f5, u32b esp, s16b pval = 0, s16b tval = 0, s16b to_h = 0, s16b to_d = 0, s16b to_a = 0) + * @brief Apply flags and values to the player.\n + * @param f1 Number \n flags to be applied to the player + * @brief Flag1 + * @param f2 Number \n flags to be applied to the player + * @brief Flag2 + * @param f3 Number \n flags to be applied to the player + * @brief Flag3 + * @param f4 Number \n flags to be applied to the player + * @brief Flag4 + * @param f5 Number \n flags to be applied to the player + * @brief Flag5 + * @param esp Number \n ESP flag + * @brief Esp flag + * @param pval Number \n PVal to be applied to the player + * @brief Pval + * @param tval Number \n TVal to be applied to the player + * @brief Tval + * @param to_h Number \n to-hit bonus to be applied to the player + * @brief To-hit + * @param to_d Number \n to-damage bonus to be applied to the player + * @brief To-damage + * @param to_a Number \n AC bonus to be applied to the player + * @brief AC + * @note + * f1 can apply to attribuets, spell power, mana capacity, stealth, searching + * ability and frequency, infravision, digging, speed, extra blows, and + * earthquakes. + * @note + * f2 can apply to life capacity, sensible fire, invisibility, free action, + * hold life, immunities (except neither), resistances, reflection, and + * sustains. + * @note + * f3 can apply to extra shots, aggravate, teleport, drain XP, blessed, extra + * might, slow digestion, regeneration, lite, see invisible, wraith form, + * feather fall, fire sheath, electricity sheath, anti magic, and anti + * teleport. + * @note + * f4 can apply to lite, flying, climbing, nether immunity, precognition, and + * anti-magic power and radius. + * @note + * f5 can apply to luck, critical hits, drain mana, drain life, immovable, + * water breath, and magic breath. + * @note + * esp can apply to, well, just telepathy. + * @note + * pval can apply to attributes, luck, spell power, mana capacity, life + * capacity, stealth, search ability and frequency (x 5), infravision, digging + * (x 20), speed, extra blows, critical blows, invisibility (x 10), extra + * might, anti-magic power and radius. + * @note + * tval can apply to lite + * @note + * to_h, to_d, and to_ac can apply to anti-magic power and radius. + * @note (see file xtra1.c) + */ +extern void apply_flags(u32b f1, u32b f2, u32b f3, u32b f4, u32b f5, u32b esp, s16b pval = 0, s16b tval = 0, s16b to_h = 0, s16b to_d = 0, s16b to_a = 0); + +/** @name Shield effect options + * @{ */ +/** @def SHIELD_NONE */ +#define SHIELD_NONE 0x0000 + +/** @def SHIELD_COUNTER */ +#define SHIELD_COUNTER 0x0001 + +/** @def SHIELD_FIRE */ +#define SHIELD_FIRE 0x0002 + +/** @def SHIELD_GREAT_FIRE */ +#define SHIELD_GREAT_FIRE 0x0004 + +/** @def SHIELD_FEAR */ +#define SHIELD_FEAR 0x0008 +/** @} */ + + +/** @fn set_tim_thunder(int v, int p1, int p2) + * @brief Player has timed thunderstorm.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @param p1 Number \n number of dice for damage roll + * @brief Damage dice + * @param p2 Number \n number of sides per die for damage roll + * @brief Damage sides + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_tim_thunder(int v, int p1, int p2); + +/** @fn set_tim_breath(int v, bool magical) + * @brief Player has timed magic/water breath.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @param magical Boolean \n TRUE if player has magic breath, or FALSE if the + * player has water breath + * @brief Magic breath? + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_tim_breath(int v, bool magical); + +/** @fn set_tim_fly(int v) + * @brief Player has timed flight.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_tim_fly(int v); + +/** @fn set_blessed(int v) + * @brief Player has timed blessing.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note + * Blessing gives +5 bonus AC and +10 bonus to-hit. + * @note (see file xtra2.c) + */ +extern bool set_blessed(int v); + +/** @fn set_hero(int v) + * @brief Player has timed heroism.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note + * Heroism gives +10 bonus max HP, +12 bonus to-hit, and resist fear. + * @note (see file xtra2.c) + */ +extern bool set_hero(int v); + +/** @fn set_shero(int v) + * @brief Player has timed berserk strength.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note + * Berserk strength gives +30 bonus max HP, +24 bonus to-hit, -10 penalty AC, + * and resist fear. + * @note (see file xtra2.c) + */ +extern bool set_shero(int v); + +/** @fn set_protevil(int v) + * @brief Player has timed protection from evil.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note + * Protection from evil gives the player a chance to repel evil monsters. + * @note (see file xtra2.c) + */ +extern bool set_protevil(int v); + +/** @fn set_protgood(int v) + * @brief Player has timed protection from good.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note + * Protection from good gives the player a chance to repel good monsters. + * @note (see file xtra2.c) + */ +extern bool set_protgood(int v); + +/** @fn set_protundead(int v) + * @brief Player has timed protection from undead.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note + * Protection from undead protects against getting the Black Breath in a melee + * attack. + * @note (see file xtra2.c) + */ +extern bool set_protundead(int v); + +/** @fn set_invuln(int v) + * @brief Player has timed invulnerability.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note + * Invulnerability prevents damage from walking on lava, walking the Straight + * Road, poison, cuts, and starvation. It gives +100 bonus to AC. + * @note + * It can be ended by the player attacking a monster, firing a missile, + * throwing an object, or activating a power. + * @note (see file xtra2.c) + */ +extern bool set_invuln(int v); + +/** @fn set_tim_invis(int v) + * @brief Player has timed "see invisibile".\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_tim_invis(int v); + +/** @fn set_tim_infra(int v) + * @brief Player has timed infravision.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_tim_infra(int v); + +/** @fn set_mental_barrier(int v) + * @brief Player has timed mental barrier.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note + * Mental barrier sustains intelligence and wisdom. + * @note (see file xtra2.c) + */ +extern bool set_mental_barrier(int v); + +/** @fn set_poison(int v) + * @brief Player has timed poison hands.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_poison(int v); + +/** @fn set_oppose_acid(int v) + * @brief Player has timed acid resistance.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_oppose_acid(int v); + +/** @fn set_oppose_elec(int v) + * @brief Player has timed electricity resistance.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_oppose_elec(int v); + +/** @fn set_oppose_fire(int v) + * @brief Player has timed fire resistance.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_oppose_fire(int v); + +/** @fn set_oppose_cold(int v) + * @brief Player has timed cold resistance.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_oppose_cold(int v); + +/** @fn set_oppose_pois(int v) + * @brief Player has timed poison resistance.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_oppose_pois(int v); + +/** @fn set_oppose_ld(int v) + * @brief Player has timed light and dark resistance.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_oppose_ld(int v); + +/** @fn set_oppose_cc(int v) + * @brief Player has timed chaos and confusion resistance.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_oppose_cc(int v); + +/** @fn set_oppose_ss(int v) + * @brief Player has timed sound and shard resistance.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_oppose_ss(int v); + +/** @fn set_oppose_nex(int v) + * @brief Player has timed nexus resistance.\n + * @param v Number \n time remaining until effect expires + * (must be in the range 0 to 10,000) + * @brief Time remaining + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note (see file xtra2.c) + */ +extern bool set_oppose_nex(int v); + +/** @fn set_stun(int v) + * @brief Player stun level changes.\n + * @param v Number \n the level of stun (must be in the range 0 to 10,000) + * @brief Stun level + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note + * Note the special code to only notice "range" changes. + * @note + * Some races resist stunning. + * @note + * There is a v chance in 1000 or 1 in 16 that a stun will be the result of + * a vicious blow to the head. If so, the player will lose a point of + * intelligence, or wisdom, or both unless the stat is sustained. + * @note (see file xtra2.c) + */ +extern bool set_stun(int v); + +/** @fn set_cut(int v) + * @brief Player cut level changes.\n + * @param v Number \n the level of cut (must be in the range 0 to 10,000) + * @brief Cut level + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note + * Note the special code to only notice "range" changes. + * @note + * Some races resist cutting. + * @note + * There is a v chance in 1000 or 1 in 16 that a cut will result in scarrring. + * If so, the player will lose a point of charisma unless it is sustained. + * @note (see file xtra2.c) + */ +extern bool set_cut(int v); + +/** @fn set_food(int v) + * @brief Player hunger level changes.\n + * @param v Number \n the level of cut (must be in the range 0 to 10,000) + * @brief Cut level + * @return Boolean \n TRUE if player notices the effect, otherwise FALSE. + * @note + * The "p_ptr->food" variable can get as large as 20000, allowing the + * addition of the most "filling" item, Elvish Waybread, which adds + * 7500 food units, without overflowing the 32767 maximum limit. + * @note + * Perhaps we should disturb the player with various messages, + * especially messages about hunger status changes. XXX XXX XXX + * @note + * Digestion of food is handled in "dungeon.c", in which, normally, + * the player digests about 20 food units per 100 game turns, more + * when "fast", more when "regenerating", less with "slow digestion", + * but when the player is "gorged", he digests 100 food units per 10 + * game turns, or a full 1000 food units per 100 game turns. + * @note + * Note that the player's speed is reduced by 10 units while gorged, + * so if the player eats a single food ration (5000 food units) when + * full (15000 food units), he will be gorged for (5000/100)*10 = 500 + * game turns, or 500/(100/5) = 25 player turns (if nothing else is + * affecting the player speed). + * @note (see file xtra2.c) + */ +extern bool set_food(int v); + +/** @name Hunger flags + * @brief Player "food" crucial values + * @{ */ +/** @def PY_FOOD_MAX + * @note Food value (Bloated) + */ +#define PY_FOOD_MAX 15000 +/** @def PY_FOOD_FULL + * @note Food value (Normal) + */ +#define PY_FOOD_FULL 10000 +/** @def PY_FOOD_ALERT + * @note Food value (Hungry) + */ +#define PY_FOOD_ALERT 2000 +/** @def PY_FOOD_WEAK + * @note Food value (Weak) + */ +#define PY_FOOD_WEAK 1000 +/** @def PY_FOOD_FAINT + * @note Food value (Fainting) + */ +#define PY_FOOD_FAINT 500 +/** @def PY_FOOD_STARVE + * @note Food value (Starving) + */ +#define PY_FOOD_STARVE 100 +/** @} */ + +/** @fn check_experience(void) + * @brief Check if player experience level has changed.\n + * @note + * If a player has achieved a level for the first time, give a corruption + * (1 chance in 3) if it applies, increase skill points, check ability levels, + * and add a note if notes are taken. + * @note (see file xtra2.c) + */ +extern void check_experience(void); + +/** @fn check_experience_obj(object_type *o_ptr) + * @brief Check if object "o_ptr" experience level has changed.\n + * @param *o_ptr object_type \n the object + * @brief Object + * @note + * If an object has achieved a level for the first time, apply gains. + * @note (see file xtra2.c) + */ +extern void check_experience_obj(object_type *o_ptr); + +/** @fn gain_exp(s32b amount) + * @brief Gain "amount" of experience.\n + * @param amount Number \n the experience points to gain. + * @brief Experience + * @note + * Count the number of objects which will gain experience. The objects share + * equally 2/3 of "amount". Give corruption if it applies. Gain experience. + * If experience is less than maximum, then increase maximum experience by 20% + * of "amount". Check for level change and print experience (check_experience). + * @note (see file xtra2.c) + */ +extern void gain_exp(s32b amount); + +/** @fn lose_exp(s32b amount) + * @brief Decrease experience by "amount".\n + * @param amount Number \n the experience points to lose. + * @brief Experience + * @note + * Experience can not fall below zero. Check for level change and print + * experience (check_experience). + * @note (see file xtra2.c) + */ +extern void lose_exp(s32b amount); + +/** @fn no_lite(void) + * @brief Return true if the player's grid is dark. + * @return Boolean \n TRUE if the player's grid is dark, otherwise FALSE. + * @note (see file cave.c) + */ +extern bool no_lite(void); + +/** @var dun_level + * @brief Number + * @note Current dungeon level + */ +extern s16b dun_level; + + +/** @name Gods + * @{ */ +/** @def GOD_ALL */ +#define GOD_ALL -1 + +/** @def GOD_NONE */ +#define GOD_NONE 0 + +/** @def GOD_ERU */ +#define GOD_ERU 1 + +/** @def GOD_MANWE */ +#define GOD_MANWE 2 + +/** @def GOD_TULKAS */ +#define GOD_TULKAS 3 + +/** @def GOD_MELKOR */ +#define GOD_MELKOR 4 + +/** @def GOD_YAVANNA */ +#define GOD_YAVANNA 5 +/** @} */ + + +/** @fn inc_piety(int god, s32b amt) + * @brief Increase piety for god "god" by amount "amt".\n + * @param god Number \n the god + * @brief God + * @param amt Number \n the amount of piety + * @brief Piety + * @note + * If the player worships all gods, or "god", the piety (grace) will increase. + * @note (see file gods.c) + */ +extern void inc_piety(int god, s32b amt); + +/** @fn abandon_god(int god) + * @brief Player renounces their religion.\n + * @param god Number \n the god + * @brief God + * @note + * If the player worships all gods or "god", the player worships no god and + * the piety score is set to 0. + * @note (see file gods.c) + */ +extern void abandon_god(int god); + +/** @fn wisdom_scale(int max) + * @brief Rescale the wisdom value to a 0 <-> max range.\n + * @param max Number \n the new maximum value of the rescaled wisdom + * @brief New maximum wisdom + * @return Number \n The rescaled value of player wisdom. + * @note (see file gods.c) + */ +extern int wisdom_scale(int max); + +/** @fn follow_god(int god, bool silent) + * @brief Player starts to follow god "god".\n + * @param god Number \n the god + * @brief God + * @param silent Boolean \n TRUE if Melkor message is displayed, otherwise + * FALSE. + * @brief Show message? + * @note + * Unbelievers can not follow a god. + * @note + * If the player does not worship a god, they start worshipping "god". If the + * god is Melkor, the player gains the Udun skill (show a message if silent is + * FALSE). + * @note (see file gods.c) + */ +extern void follow_god(int god, bool silent); + +/** @fn add_new_gods(char *name) + * @brief Add a new god to the deity array.\n + * @param *name String \n the name of the god + * @brief God name + * @return Number \n The index of the new god inthe deity array. + * @note (see file lua_bind.c) + */ +extern s16b add_new_gods(char *name); + +/** @fn desc_god(int g_idx, int d, char *desc) + * @brief Return line "d" of the description of god with god index "g_idx".\n + * @param g_idx Number \n the index of god in the deity array. + * @brief God index + * @param d Number \n the line of the description + * (must be in the range 0 to 9). + * @brief Line of description + * @param *desc String + * @brief Description + * @return *desc String \n Line "d" of the god description. + * @note (see file lua_bind.c) + */ +extern void desc_god(int g_idx, int d, char *desc); + +/** @name Powers + * @{ */ +/** @def PWR_SPIT_ACID + * @note Spit acid (GF_ACID) */ +#define PWR_SPIT_ACID 0 + +/** @def PWR_BR_FIRE + * @note Breathe fire (GF_FIRE) */ +#define PWR_BR_FIRE 1 + +/** @def PWR_HYPN_GAZE + * @note Hypnotic gaze */ +#define PWR_HYPN_GAZE 2 + +/** @def PWR_TELEKINES + * @note Telekinesis (fetch an object) */ +#define PWR_TELEKINES 3 + +/** @def PWR_VTELEPORT + * @note Teleport */ +#define PWR_VTELEPORT 4 + +/** @def PWR_MIND_BLST + * @note Mind blast (GF_PSI) */ +#define PWR_MIND_BLST 5 + +/** @def PWR_RADIATION + * @note Emit radiation (GF_NUKE) */ +#define PWR_RADIATION 6 + +/** @def PWR_VAMPIRISM + * @note Vampire bite */ +#define PWR_VAMPIRISM 7 + +/** @def PWR_SMELL_MET + * @note Detect treasure */ +#define PWR_SMELL_MET 8 + +/** @def PWR_SMELL_MON + * @note Detect normal monsters */ +#define PWR_SMELL_MON 9 + +/** @def PWR_BLINK + * @note Short teleport (up to 10 grids) */ +#define PWR_BLINK 10 + +/** @def PWR_EAT_ROCK + * @note Eat rock for food (wall to mud) */ +#define PWR_EAT_ROCK 11 + +/** @def PWR_SWAP_POS + * @note Swap position with a monster */ +#define PWR_SWAP_POS 12 + +/** @def PWR_SHRIEK + * @note Shriek (GF_SOUND and aggravate) */ +#define PWR_SHRIEK 13 + +/** @def PWR_ILLUMINE + * @note Lite area */ +#define PWR_ILLUMINE 14 + +/** @def PWR_DET_CURSE + * @note Detect cursed items in inventory */ +#define PWR_DET_CURSE 15 + +/** @def PWR_BERSERK + * @note Berserk rage */ +#define PWR_BERSERK 16 + +/** @def PWR_POLYMORPH + * @note Polymorph self */ +#define PWR_POLYMORPH 17 + +/** @def PWR_MIDAS_TCH + * @note Midas touch - turn an item into gold */ +#define PWR_MIDAS_TCH 18 + +/** @def PWR_GROW_MOLD + * @note Summon mold */ +#define PWR_GROW_MOLD 19 + +/** @def PWR_RESIST + * @note Temporary elemental resist */ +#define PWR_RESIST 20 + +/** @def PWR_EARTHQUAKE + * @note Cause an earthquake (destruction) */ +#define PWR_EARTHQUAKE 21 + +/** @def PWR_EAT_MAGIC + * @note Absorb energy from magic items */ +#define PWR_EAT_MAGIC 22 + +/** @def PWR_WEIGH_MAG + * @note Report magic affecting player */ +#define PWR_WEIGH_MAG 23 + +/** @def PWR_STERILITY + * @note Player experiences forced abstinence */ +#define PWR_STERILITY 24 + +/** @def PWR_PANIC_HIT + * @note Hit a monster and run away */ +#define PWR_PANIC_HIT 25 + +/** @def PWR_DAZZLE + * @note Stun, confuse, and turn monsters */ +#define PWR_DAZZLE 26 + +/** @def PWR_DARKRAY + * @note Fire a beam of light (GF_LITE) */ +#define PWR_DARKRAY 27 + +/** @def PWR_RECALL + * @note Recall to dungeon/town */ +#define PWR_RECALL 28 + +/** @def PWR_BANISH + * @note Banish evil creatures */ +#define PWR_BANISH 29 + +/** @def PWR_COLD_TOUCH + * @note Bolt of cold (GF_COLD) */ +#define PWR_COLD_TOUCH 30 + +/** @def PWR_LAUNCHER + * @note Increase the multiplier for a thrown object */ +#define PWR_LAUNCHER 31 + +/** @def PWR_PASSWALL + * @note Walk through a wall */ +#define PWR_PASSWALL 32 + +/** @def PWR_DETECT_TD + * @note Detect traps, doors, and stairs */ +#define PWR_DETECT_TD 33 + +/** @def PWR_COOK_FOOD + * @note Create some food */ +#define PWR_COOK_FOOD 34 + +/** @def PWR_UNFEAR + * @note Remove fear */ +#define PWR_UNFEAR 35 + +/** @def PWR_EXPL_RUNE + * @note Set an explosive rune */ +#define PWR_EXPL_RUNE 36 + +/** @def PWR_STM + * @note Bash a wall (stone to mud) */ +#define PWR_STM 37 + +/** @def PWR_POIS_DART + * @note Throw a poison dart (GF_POIS) */ +#define PWR_POIS_DART 38 + +/** @def PWR_MAGIC_MISSILE + * @note Fire a magic missile (GF_MISSILE) */ +#define PWR_MAGIC_MISSILE 39 + +/** @def PWR_GROW_TREE + * @note Grow trees around the player */ +#define PWR_GROW_TREE 40 + +/** @def PWR_BR_COLD + * @note Breathe cold (GF_COLD) */ +#define PWR_BR_COLD 41 + +/** @def PWR_BR_CHAOS + * @note Breathe chaos (GF_CHAOS) */ +#define PWR_BR_CHAOS 42 + +/** @def PWR_BR_ELEM + * @note Breath elements (GF_MISSILE) */ +#define PWR_BR_ELEM 43 + +/** @def PWR_WRECK_WORLD + * @note Change the world (new level) */ +#define PWR_WRECK_WORLD 44 + +/** @def PWR_SCARE + * @note Howl to scare monsters */ +#define PWR_SCARE 45 + +/** @def PWR_REST_LIFE + * @note Restore life levels */ +#define PWR_REST_LIFE 46 + +/** @def PWR_SUMMON_MONSTER + * @note Beastmaster powers (summon pets) */ +#define PWR_SUMMON_MONSTER 47 + +/** @def PWR_NECRO + * @note Cast a necromancy spell */ +#define PWR_NECRO 48 + +/** @def PWR_ROHAN + * @note Use flash aura or light speed jump */ +#define PWR_ROHAN 49 + +/** @def PWR_THUNDER + * @note Use thunder strike, ride the straight road, or go back in town */ +#define PWR_THUNDER 50 + +/** @def PWR_DEATHMOLD + * @note Use deathmold powers:\n + * (a) Teleport to a specific place\n + * (b) Fetch an item\n + * (c) Go up 50'\n + * (d) Go down 50' + */ +#define PWR_DEATHMOLD 51 + +/** @def PWR_HYPNO + * @note Hypnotise a pet */ +#define PWR_HYPNO 52 + +/** @def PWR_UNHYPNO + * @note Unhypnotise a pet */ +#define PWR_UNHYPNO 53 + +/** @def PWR_INCARNATE + * @note Incarnate into a body */ +#define PWR_INCARNATE 54 + +/** @def PWR_MAGIC_MAP + * @note Magic mapping */ +#define PWR_MAGIC_MAP 55 + +/** @def PWR_LAY_TRAP + * @note Set a trap */ +#define PWR_LAY_TRAP 56 + +/** @def PWR_MERCHANT + * @note Appraise item, warp item, or identify item */ +#define PWR_MERCHANT 57 + +/** @def PWR_COMPANION + * @note Create a companion */ +#define PWR_COMPANION 58 + +/** @def PWR_BEAR + * @note Mimic a bear */ +#define PWR_BEAR 59 + +/** @def PWR_DODGE + * @note Report chance of dodging a monster */ +#define PWR_DODGE 60 + +/** @def PWR_BALROG + * @note Mimic a balrog */ +#define PWR_BALROG 61 +/** @} */ + +/* Misc */ +/** @fn do_cmd_throw(void) + * @brief Throw an object from the pack or floor. + * @note + * Note: "unseen" monsters are very hard to hit. + * @note + * Should throwing a weapon do full damage? Should it allow the magic + * to hit bonus of the weapon to have an effect? Should it ever cause + * the item to be destroyed? Should it do any damage at all? + * @note (see file cmd2.c) + */ +extern void do_cmd_throw(void); + +/** @fn change_wild_mode() + * @brief Toggle between big map and little map. + * @note + * If the player is immovable, and the map is big, the player receives a + * warning and is allowed to proceed. + * @note + * If the player is about to be recalled, and the map is big, the map is + * not changed. + * @note + * The map is changed. The game is saved if autosave is set to "levels". + * @note (see file spells2.c) + */ +extern void change_wild_mode(); + +/** @fn switch_class(int sclass) + * @brief Change to an other class.\n + * @param sclass Number \n the inex of the new class in the class array + * @brief Class index + * @note (see file xtra2.c) + */ +extern void switch_class(int sclass); + +/** @fn switch_subclass(int sclass) + * @brief Change to an other subclass.\n + * @param sclass Number \n the new subclass + * @brief Subclass + * @note (see file xtra2.c) + */ +extern void switch_subclass(int sclass); + +/** @fn switch_subrace(int racem, bool copy_old) + * @brief Change to an other subrace.\n + * @param racem Number \n index of subrace in subrace array + * @brief Subrace index + * @param copy_old Boolean \n TRUE if the new subrace is to be saved, + * otherwise FALSE. + * @brief Copy old subrace? + * @note (see file xtra2.c) + */ +extern void switch_subrace(int racem, bool copy_old); + +/** @fn get_subrace_title(int racem) + * @brief Return the subrace title.\n + * @param racem Number \n index of subrace in subrace array + * @brief Subrace index + * @return String \n Title of subrace. + * @note (see file xtra2.c) + */ +extern cptr get_subrace_title(int racem); + +/** @fn set_subrace_title(int racem, cptr name) + * @brief Set the subrace title.\n + * @param racem Number \n index of subrace in subrace array + * @brief Subrace index + * @param name String \n new title of subrace + * @brief New title + * @note (see file xtra2.c) + */ +extern void set_subrace_title(int racem, cptr name); + +/** @fn do_rebirth() + * @brief The player is reborn after a class, race, or subrace change. + * @note + * The experience factor is recalculated. The hit dice are reset and new HP + * are calculated. There may be a level change involved. + * @note (see file xtra2.c) + */ +extern void do_rebirth(); + +/* Player race flags */ +$static bool lua_test_race_flags(int slot, u32b flags) { if (slot == 1) return (PRACE_FLAG(flags)) ? TRUE : FALSE; else return (PRACE_FLAG2(flags)) ? TRUE : FALSE; } +/** @fn test_race_flags(int slot, u32b flags); + * @brief Test flag "flags" against race flags, race modifier flags, class + * flags, and specialist flags.\n + * @param slot Number \n 1 if testing against first set of flags (PRACE_FLAG), + * 2 if testing against second set of flags (PRACE_FLAG2) + * @brief Flag selecter. + * @param flags Number \n the flags to be tested + * @brief Test flags + * @return Boolean \n TRUE if test flags match any of the corresponding race, + * race modifier, class, and specialist flags. + * @note (see file w_player.c) + */ +static bool lua_test_race_flags@test_race_flags(int slot, u32b flags); + +/** @name Winner states + * @{ */ +/** @def WINNER_NORMAL + * @note Player has killed Morgoth */ +#define WINNER_NORMAL 1 + +/** @def WINNER_ULTRA + * @note Player has killed Melkor */ +#define WINNER_ULTRA 2 +/** @} */ + +/** @var wizard + * @brief Boolean + * @note TRUE if player currently in Wizard mode, otherwise FALSE. + */ +extern bool wizard; + +/** @var total_winner + * @brief Number + * @note Game has been won (see WINNER_foo fields). + */ +extern u16b total_winner; + +/** @var has_won + * @brief Number + * @note Game has been won (see WINNER_foo fields). + */ +extern u16b has_won; + +/** @var joke_monsters + * @brief Boolean + * @note TRUE if allowing joke monsters, otherwise FALSE. + */ +extern bool joke_monsters; + +extern s16b max_dlv[999999]; diff --git a/PKGS/player_c.pkg b/PKGS/player_c.pkg new file mode 100644 index 0000000..f55f932 --- /dev/null +++ b/PKGS/player_c.pkg @@ -0,0 +1,1060 @@ +/* File: player_c.pkg */ + +/* + * Purpose: Lua interface defitions for player classes. + * To be processed by tolua to generate C source code. + */ + +$#include "angband.h" + +/** @typedef cptr + * @note String + */ +typedef char* cptr; +/** @typedef errr + * @note Number + */ +typedef int errr; +/** @typedef bool + * @note Boolean + */ +typedef unsigned char bool; +/** @typedef byte + * @note Number + */ +typedef unsigned char byte; +/** @typedef s16b + * @note Number + */ +typedef signed short s16b; +/** @typedef u16b + * @note Number + */ +typedef unsigned short u16b; +/** @typedef s32b + * @note Number + */ +typedef signed int s32b; +/** @typedef u32b + * @note Number + */ +typedef unsigned int u32b; + +/** @struct player_class + * @brief Player class + */ +struct player_class +{ + /** @structvar title + * @brief Number + * @note Type of class + */ + s32b title; + /** @structvar desc + * @brief Number + * @note Small desc of the class + */ + s32b desc; + /** @structvar titles[10] + * @brief Number + */ + s32b titles[10]; + + /** @structvar c_adj[6] + * @brief Number + * @note Class stat modifier + */ + s16b c_adj[6]; + + /** @structvar c_dis + * @brief Number + * @note class disarming + */ + s16b c_dis; + /** @structvar c_dev + * @brief Number + * @note class magic devices + */ + s16b c_dev; + /** @structvar c_sav + * @brief Number + * @note class saving throws + */ + s16b c_sav; + /** @structvar c_stl + * @brief Number + * @note class stealth + */ + s16b c_stl; + /** @structvar c_srh + * @brief Number + * @note class searching ability + */ + s16b c_srh; + /** @structvar c_fos + * @brief Number + * @note class searching frequency + */ + s16b c_fos; + /** @structvar c_thn + * @brief Number + * @note class to hit (normal) + */ + s16b c_thn; + /** @structvar c_thb + * @brief Number + * @note class to hit (bows) + */ + s16b c_thb; + + /** @structvar x_dis + * @brief Number + * @note extra disarming + */ + s16b x_dis; + /** @structvar x_dev + * @brief Number + * @note extra magic devices + */ + s16b x_dev; + /** @structvar x_sav + * @brief Number + * @note extra saving throws + */ + s16b x_sav; + /** @structvar x_stl + * @brief Number + * @note extra stealth + */ + s16b x_stl; + /** @structvar x_srh + * @brief Number + * @note extra searching ability + */ + s16b x_srh; + /** @structvar x_fos + * @brief Number + * @note extra searching frequency + */ + s16b x_fos; + /** @structvar x_thn + * @brief Number + * @note extra to hit (normal) + */ + s16b x_thn; + /** @structvar x_thb + * @brief Number + * @note extra to hit (bows) + */ + s16b x_thb; + + /** @structvar c_mhp + * @brief Number + * @note Class hit-dice adjustment + */ + s16b c_mhp; + /** @structvar c_exp + * @brief Number + * @note Class experience factor + */ + s16b c_exp; + + /** @structvar powers[4] + * @brief Number + * @note Powers of the class + */ + s16b powers[4]; + + /** @structvar spell_book + * @brief Number + * @note Tval of spell books (if any) + */ + s16b spell_book; + /** @structvar spell_stat + * @brief Number + * @note Stat for spells (if any) + */ + s16b spell_stat; + /** @structvar spell_lev + * @brief Number + * @note The higher it is the higher the spells level are + */ + s16b spell_lev; + /** @structvar spell_fail + * @brief Number + * @note The higher it is the higher the spells failure are + */ + s16b spell_fail; + /** @structvar spell_mana + * @brief Number + * @note The higher it is the higher the spells mana are + */ + s16b spell_mana; + /** @structvar spell_first + * @brief Number + * @note Level of first spell + */ + s16b spell_first; + /** @structvar spell_weight + * @brief Number + * @note Weight that hurts spells + */ + s16b spell_weight; + /** @structvar max_spell_level + * @brief Number + * @note Maximun spell level + */ + byte max_spell_level; + /** @structvar magic_max_spell + * @brief Number + * @note Maximun numbner of spells one can learn by natural means + */ + byte magic_max_spell; + + /** @structvar flags1 + * @brief Number + * @note flags + */ + s32b flags1; + + /** @structvar mana + * @brief Number + */ + s16b mana; + /** @structvar blow_num + * @brief Number + */ + s16b blow_num; + /** @structvar blow_wgt + * @brief Number + */ + s16b blow_wgt; + /** @structvar blow_mul + * @brief Number + */ + s16b blow_mul; + /** @structvar extra_blows + * @brief Number + */ + s16b extra_blows; + + /** @structvar sense_base + * @brief Number + */ + s32b sense_base; + /** @structvar sense_pl + * @brief Number + */ + s32b sense_pl; + /** @structvar sense_plus + * @brief Number + */ + s32b sense_plus; + /** @structvar sense_heavy + * @brief Number + */ + byte sense_heavy; + /** @structvar sense_heavy_magic + * @brief Number + */ + byte sense_heavy_magic; +}; + +/** @var *cp_ptr + * @brief player_class + * @note Player class information + */ +extern player_class *cp_ptr; + + + +/** @struct skill_type + * @brief Skills + */ +struct skill_type +{ + /** @structvar name + * @brief Number + * @note Name + */ + u32b name; + /** @structvar desc + * @brief Number + * @note Description + */ + u32b desc; + /** @structvar action_desc + * @brief Number + * @note Action Description + */ + u32b action_desc; + + /** @structvar action_mkey + * @brief Number + * @note Action do to + */ + s16b action_mkey; + + /** @structvar i_value + * @brief Number + * @note Actual value + */ + u32b i_value; + /** @structvar i_mod + * @brief Number + * @note Modifier(1 skill point = modifier skill) + */ + u16b i_mod; + + /** @structvar value + * @brief Number + * @note Actual value + */ + u32b value; + /** @structvar mod + * @brief Number + * @note Modifier(1 skill point = modifier skill) + */ + u16b mod; + /** @structvar rate + * @brief Number + * @note Modifier decreasing rate + */ + s16b rate; + + /** @structvar uses + * @brief Number + * @note Number of times used + */ + u32b uses; + + /** @structvar action[9999] + * @brief Number + * @note List of actions against other skills + */ + s16b action[9999]; + + /** @structvar father + * @brief Number + * @note Father in the skill tree + */ + s16b father; + /** @structvar dev + * @brief Boolean + * @note Is the branch developped ? + */ + bool dev; + /** @structvar order + * @brief Number + * @note Order in the tree + */ + s16b order; + /** @structvar hidden + * @brief Boolean + * @note Innactive + */ + bool hidden; +}; + +/** @def MAX_SKILLS + * @brief Maximum number of skills + */ +#define MAX_SKILLS 100 + + +$static cptr get_skill_name(int i) { return s_name + s_info[i].name; } +/** @fn get_skill_name(int i) + * @brief Return name of skill with index "i" in skill array.\n + * @param i Number \n the index of skill in skill array. + * @brief Skill index + * @return String \n The name of the skill with index "i" in the skill array. + * @note (see file w_play_c.c) + */ +static cptr get_skill_name(int i); + +/** @var old_max_s_idx + * @brief Number + * @note Previous maximum skill index + */ +extern u16b old_max_s_idx; +/** @var max_s_idx + * @brief Number + * @note Current maximum skill index + */ +extern u16b max_s_idx; +/** @var s_info[MAX_SKILLS] + * @brief skill_type + * @note Array of player skills + */ +skill_type s_info[MAX_SKILLS]; + +/** @name Skills + * @{ */ +/** @def SKILL_CONVEYANCE + * @brief Conveyance + * @note + * Ability to learn and use spells from the Conveyance school + */ +#define SKILL_CONVEYANCE 1 + +/** @def SKILL_MANA + * @brief Mana + * @note + * Ability to learn and use spells from the Mana school + */ +#define SKILL_MANA 2 + +/** @def SKILL_FIRE + * @brief Fire + * @note + * Ability to learn and use spells from the Fire school + */ +#define SKILL_FIRE 3 + +/** @def SKILL_AIR + * @brief Air + * @note + * Ability to learn and use spells from the Air school + */ +#define SKILL_AIR 4 + +/** @def SKILL_WATER + * @brief Water + * @note + * Ability to learn and use spells from the Water school + */ +#define SKILL_WATER 5 + +/** @def SKILL_NATURE + * @brief Nature + * @note + * Ability to learn and use spells from the Nature school + */ +#define SKILL_NATURE 6 + +/** @def SKILL_EARTH + * @brief Earth + * @note + * Ability to learn and use spells from the Earth school + */ +#define SKILL_EARTH 7 + +/** @def SKILL_SYMBIOTIC + * @brief Symbiosis + * @note + * Ability to enter in symbiosis with monsters unable to move by themselves + */ +#define SKILL_SYMBIOTIC 8 + +/** @def SKILL_MUSIC + * @brief Music + * @note + * Ability to learn and sing songs + */ +#define SKILL_MUSIC 9 + +/** @def SKILL_DIVINATION + * @brief Divination + * @note + * Ability to learn and use spells from the Divination school + */ +#define SKILL_DIVINATION 10 + +/** @def SKILL_TEMPORAL + * @brief Temporal + * @note + * Ability to learn and use spells from the Temporal school + */ +#define SKILL_TEMPORAL 11 + +/** @def SKILL_DRUID + * @brief Druidistic + * @note + * Ability to learn and use prayers from the Druidistic realm + */ +#define SKILL_DRUID 12 + +/** @def SKILL_DAEMON + * @brief Demonology + * @note + * Ability to use incantations from the Demonblades + */ +#define SKILL_DAEMON 13 + +/** @def SKILL_META + * @brief Meta + * @note + * Ability to learn and use spells from the Meta school + */ +#define SKILL_META 14 + +/** @def SKILL_MAGIC + * @brief Magic + * @note + * General ability to do magic, also affect mana reserves and + * magic device ability. Helps pseudo-id of magic objects + */ +#define SKILL_MAGIC 15 + +/** @def SKILL_COMBAT + * @brief Combat + * @note + * General ability to fight and to pseudo-id armours and weapons. + * It also allows to use heavier armours without penalties + */ +#define SKILL_COMBAT 16 + +/** @def SKILL_MASTERY + * @brief Weaponmastery + * @note + * General ability to use melee weapons + */ +#define SKILL_MASTERY 17 + +/** @def SKILL_SWORD + * @brief Sword-mastery + * @note + * Ability to use swords + */ +#define SKILL_SWORD 18 + +/** @def SKILL_AXE + * @brief Axe-mastery + * @note + * Ability to use axes + */ +#define SKILL_AXE 19 + +/** @def SKILL_POLEARM + * @brief Polearm-mastery + * @note + * Ability to use polearms + */ +#define SKILL_POLEARM 20 + +/** @def SKILL_HAFTED + * @brief Hafted-mastery + * @note + * Ability to use hafted weapons + */ +#define SKILL_HAFTED 21 + +/** @def SKILL_BACKSTAB + * @brief Backstab + * @note + * Ability to backstab fleeing and sleeping monsters to increase damage + */ +#define SKILL_BACKSTAB 22 + +/** @def SKILL_ARCHERY + * @brief Archery + * @note + * General ability to use ranged weapons + */ +#define SKILL_ARCHERY 23 + +/** @def SKILL_SLING + * @brief Sling-mastery + * @note + * Ability to use slings + */ +#define SKILL_SLING 24 + +/** @def SKILL_BOW + * @brief Bow-mastery + * @note + * Ability to use bows + */ +#define SKILL_BOW 25 + +/** @def SKILL_XBOW + * @brief Crossbow-mastery + * @note + * Ability to use crossbows + */ +#define SKILL_XBOW 26 + +/** @def SKILL_BOOMERANG + * @brief Boomerang-mastery + * @note + * Ability to use boomerangs + */ +#define SKILL_BOOMERANG 27 + +/** @def SKILL_SPIRITUALITY + * @brief Spirituality + * @note + * General ability to use spiritual skills and also influence Saving Throw + */ +#define SKILL_SPIRITUALITY 28 + +/** @def SKILL_MINDCRAFT + * @brief Mindcraft + * @note + * Ability to focus the powers of the mind + */ +#define SKILL_MINDCRAFT 29 + +/** @def SKILL_MISC + * @brief Misc + * @note + * Not a real skill, it is only used to regroup some skills + */ +#define SKILL_MISC 30 + +/** @def SKILL_NECROMANCY + * @brief Necromancy + * @note + * Ability to harness the powers of the dead + */ +#define SKILL_NECROMANCY 31 + +/** @def SKILL_MIMICRY + * @brief Mimicry + * @note + * Ability to use cloaks of mimicry to change form + */ +#define SKILL_MIMICRY 32 + +/** @def SKILL_ANTIMAGIC + * @brief Antimagic + * @note + * Ability to generates an antimagic field + */ +#define SKILL_ANTIMAGIC 33 + +/** @def SKILL_RUNECRAFT + * @brief Runecraft + * @note + * Ability to combine magic runes to create your own spells + */ +#define SKILL_RUNECRAFT 34 + +/** @def SKILL_SNEAK + * @brief Sneakiness + * @note + * General ability at the sneakiness skills + */ +#define SKILL_SNEAK 35 + +/** @def SKILL_STEALTH + * @brief Stealth + * @note + * Ability to move unnoticed, silently + */ +#define SKILL_STEALTH 36 + +/** @def SKILL_DISARMING + * @brief Disarming + * @note + * Ability to disarm the various traps + */ +#define SKILL_DISARMING 37 + +/* XXX */ + +/** @def SKILL_ALCHEMY + * @brief Alchemy + * @note + * Ability to use essences to modify/create magic items + */ +#define SKILL_ALCHEMY 39 + +/** @def SKILL_STEALING + * @brief Stealing + * @note + * Ability to steal objects + */ +#define SKILL_STEALING 40 + +/** @def SKILL_SORCERY + * @brief Sorcery + * @note + * Ability to use all the magic schools as if their skill was sorcery + */ +#define SKILL_SORCERY 41 + +/** @def SKILL_HAND + * @brief Barehand-combat + * @note + * Ability to fight barehanded + */ +#define SKILL_HAND 42 + +/** @def SKILL_THAUMATURGY + * @brief Thaumaturgy + * @note + * Ability to gain and cast innate spells + */ +#define SKILL_THAUMATURGY 43 + +/** @def SKILL_SUMMON + * @brief Summoning + * @note + * Ability to create totems from monsters and use them to summon monsters + */ +#define SKILL_SUMMON 44 + +/** @def SKILL_SPELL + * @brief Spell-power + * @note + * Ability to increase the power of spells + */ +#define SKILL_SPELL 45 + +/** @def SKILL_DODGE + * @brief Dodging + * @note + * Ability to dodge blows and bolts + */ +#define SKILL_DODGE 46 + +/** @def SKILL_BEAR + * @brief Bearform-combat + * @note + * Ability to fight in bear form + */ +#define SKILL_BEAR 47 + +/** @def SKILL_LORE + * @brief Monster-lore + * @note + * General ability at the monster related skills, ability to gain experience + * from friendly kills. It also affects the number of companions the player + * can have + */ +#define SKILL_LORE 48 + +/** @def SKILL_PRESERVATION + * @brief Corpse-preservation + * @note + * Ability to not destroy the monster corpse when killing them + */ +#define SKILL_PRESERVATION 49 + +/** @def SKILL_POSSESSION + * @brief Possession + * @note + * Ability to incarnate into monsters + */ +#define SKILL_POSSESSION 50 + +/** @def SKILL_MIND + * @brief Mind + * @note + * Ability to learn and use spells from the Mind school + */ +#define SKILL_MIND 51 + +/** @def SKILL_CRITS + * @brief Critical-hits + * @note + * Ability to deal critical hits with swords < 5lb + */ +#define SKILL_CRITS 52 + +/** @def SKILL_PRAY + * @brief Prayer + * @note + * Ability to learn and use spells from the gods schools + */ +#define SKILL_PRAY 53 + +/** @def SKILL_LEARN + * @brief Spell-learning + * @note + * You should not see that ! that is a BUG! + */ +#define SKILL_LEARN 54 + +/** @def SKILL_UDUN + * @brief Udun + * @note + * Ability to learn and use spells from the Udun school + */ +#define SKILL_UDUN 55 + +/** @def SKILL_DEVICE + * @brief Magic-Device + * @note + * Ease the use of magical devices, such as wands, staves and rods. + * It also helps pseudo-id of magic objects + */ +#define SKILL_DEVICE 56 + +/** @def SKILL_STUN + * @brief Stunning-blows + * @note + * Ability to stun opponents when doing critical hits with hafted weapons > 5lb + */ +#define SKILL_STUN 57 + +/** @def SKILL_BOULDER + * @brief Boulder-throwing + * @note + * Ability to make and throw boulders + */ +#define SKILL_BOULDER 58 + +/** @def SKILL_GEOMANCY + * @brief Geomancy + * @note + * Ability to understand the raw elemental forces of nature and use + * them to advantage. Most spells need Fire/Water/Earth/Air skills + */ +#define SKILL_GEOMANCY 59 + + +/** @def SKILL_MAX + * @note Maximun skill value + */ +#define SKILL_MAX 50000 +/** @def SKILL_STEP + * @note 1 skill point + */ +#define SKILL_STEP 1000 + +/** @} */ + +/** @fn get_skill(int skill) + * @brief Return the value of skill with index "skill" in skill array.\n + * @param skill Number \n the index of skill in skill array. + * @brief Skill index + * @return Number \n The value of the skill with index "skill" in the skill + * array. + * @note (see file skills.c) + */ +extern s16b get_skill(int skill); + +/** @fn get_skill_scale(int skill, u32b scale) + * @brief Return the value of skill with index "skill" in skill array rescaled + * to a maximum of "scale".\n + * @param skill Number \n the index of skill in skill array. + * @brief Skill index + * @param scale Number \n the maximum rescaled skill value. + * @brief Scaled maximum + * @return Number \n The rescaled value of the skill with index "skill" in the + * skill array. + * @note (see file skills.c) + */ +extern s16b get_skill_scale(int skill, u32b scale); + +/** @fn do_get_new_skill() + * @brief Player select one of four new skills. + * @note (see file skills.c) + */ +extern void do_get_new_skill(); + +/** @fn get_melee_skills() + * @brief Return the number of melee skills the player has. + * @return Number \n The number of melee skills. + * @note + * A skill is counted if the value > 0 and the skill is not hidden. + * @note (see file skills.c) + */ +extern s16b get_melee_skills(); + +/** @fn find_skill(cptr name) + * @brief Return the index of skill with name "name".\n + * @param name String \n the name of the skill. + * @brief Skill name + * @return Number \n The index of the skill with name "name" in the skill + * array. + * @note + * The search is case sensitive.\n + * If no skills match the name, -1 is returned. + * @note (see file skills.c) + */ +extern s16b find_skill(cptr name); + +/** @fn find_skill_i(cptr name) + * @brief Return the index of skill with name "name".\n + * @param name String \n the name of the skill. + * @brief Skill name + * @return Number \n The index of the skill with name "name" in the skill + * array. + * @note + * The search ignores case.\n + * If no skills match the name, -1 is returned. + * @note (see file skills.c) + */ +extern s16b find_skill_i(cptr name); + +$static char *get_class_name() {return spp_ptr->title + c_name;} +/** @fn *get_class_name() + * @brief Return the player's class. + * @return String \n The player's type of class + class name + * @note (see file w_play_c.c) + */ +char *get_class_name(); + +$static char *get_race_name() {return rp_ptr->title + rp_name;} +/** @fn *get_race_name() + * @brief Return the player's race. + * @return String \n The player's type of race + race name + * @note (see file w_play_c.c) + */ +char *get_race_name(); + +$static char *get_subrace_name() {return rmp_ptr->title + rmp_name;} +/** @fn *get_subrace_name() + * @brief Return the player's subrace. + * @return String \n The player's type of subrace + subrace name + * @note (see file w_play_c.c) + */ +char *get_subrace_name(); + +/** @struct ability_type + * @brief Abilities + */ +struct ability_type +{ + /** @structvar action_mkey + * @brief Number + * @note Action do to + */ + s16b action_mkey; + + /** @structvar cost + * @brief Number + * @note Skill points cost + */ + s16b cost; + + /** @structvar acquired + * @brief Boolean + * @note Do the player actualylg ot it ? + */ + bool acquired; +}; + +/** @fn find_ability(cptr name) + * @brief Return the index of ability with name "name".\n + * @param name String \n the name of the ability. + * @brief Ability name + * @return Number \n The index of the ability with name "name" in the ability + * array. + * @note + * The search is case sensitive.\n + * If no abilities match the name, -1 is returned. + * @note (see file skills.c) + */ +extern s16b find_ability(cptr name); + +/** @fn do_cmd_ability() + * @brief Allow the user to interact with abilities. + * @note + * This screen is typically used to view abilities, and increase them. + * @note (see file skills.c) + */ +extern void do_cmd_ability(); + +/** @fn has_ability(int ab) + * @brief Does the player have ability "ab"? + * @param ab Number \n the index of ability in ability array. + * @brief Ability index + * @return Boolean \n TRUE if player has the ability, otherwise FALSE. + * @note (see file skills.c) + */ +extern bool has_ability(int ab); + +/** @var max_ab_idx + * @brief Number + * @note Maximum ability index + */ +extern s16b max_ab_idx; +/** @var ab_info[max_ab_idx] + * @brief ability_type + * @note Array of player abilities + */ +extern ability_type ab_info[max_ab_idx]; + +/** @name Abilities + * @{ */ +/** @def AB_SPREAD_BLOWS + * @brief Spread blows + * @note + * If a monster dies to an attack but the player still has blows left + * they won't lose the full turn, allowing them to attack some other + * monster in the same turn. + */ +#define AB_SPREAD_BLOWS 0 + +/** @def AB_TREE_WALK + * @brief Tree walking + * @note + * Allows player to walk in dense forest. + */ +#define AB_TREE_WALK 1 + +/** @def AB_PERFECT_CASTING + * @brief Perfect casting + * @note + * Allows player to reach 0% failure rate on spells. + */ +#define AB_PERFECT_CASTING 2 + +/** @def AB_MAX_BLOW1 + * @brief Extra Max Blow(1) + * @note + * Increases player "maximum possible blows" number by 1. + */ +#define AB_MAX_BLOW1 3 + +/** @def AB_MAX_BLOW2 + * @brief Extra Max Blow(2) + * @note + * Increases player "maximum possible blows" number by 1 + * (Cumulative with Extra Max Blow(1)). + */ +#define AB_MAX_BLOW2 4 + +/** @def AB_AMMO_CREATION + * @brief Ammo creation + * @note + * Allows player to create shots, arrows and bolts from various materials. + */ +#define AB_AMMO_CREATION 5 + +/** @def AB_DEATH_TOUCH + * @brief Touch of death + * @note + * Player melee blows can insta-kill, but they only receive 1/3 of the + * experience for that kill. + */ +#define AB_DEATH_TOUCH 6 + +/** @def AB_CREATE_ART + * @brief Artifact creation + * @note + * In combination with a high alchemy skill this ability will let the player + * design their very own artifacts. + */ +#define AB_CREATE_ART 7 + +/** @def AB_FAR_REACHING + * @brief Far reaching attack + * @note + * The player can attack an enemy one square far using a polearm. + * At high levels of polearm skill, they can even hit two enemies at once. + */ +#define AB_FAR_REACHING 8 + +/** @def AB_TRAPPING + * @brief Trapping + * @note + * Enables player to set traps which harm monsters. + */ +#define AB_TRAPPING 9 + +/** @def AB_UNDEAD_FORM + * @brief Undead form + * @note + * Ability to turn into a weak undead being when you "die". + * You must then kill enough monsters to absorb enough life energy + * to come back to life. + */ +#define AB_UNDEAD_FORM 10 + +/** @} */ + diff --git a/PKGS/quest.pkg b/PKGS/quest.pkg new file mode 100644 index 0000000..4ba93b7 --- /dev/null +++ b/PKGS/quest.pkg @@ -0,0 +1,170 @@ +/* File: quest.pkg */ + +/* + * Purpose: Lua interface definitions for quests. + * To be processed by tolua to generate C source code. + */ + +$#include "angband.h" + +/** @typedef cptr + * @note String + */ +typedef char* cptr; + +/** @typedef errr + * @note Number + */ +typedef int errr; + +/** @typedef bool + * @note Boolean + */ +typedef unsigned char bool; + +/** @typedef byte + * @note Number + */ +typedef unsigned char byte; + +/** @typedef s16b + * @note Number + */ +typedef signed short s16b; + +/** @typedef u16b + * @note Number + */ +typedef unsigned short u16b; + +/** @typedef s32b + * @note Number + */ +typedef signed int s32b; + +/** @typedef u32b + * @note Number + */ +typedef unsigned int u32b; + +/** @name Quest Status Flags + * @brief Quest status + * @{ */ + +/** @def QUEST_STATUS_IGNORED */ +#define QUEST_STATUS_IGNORED -1 + +/** @def QUEST_STATUS_UNTAKEN */ +#define QUEST_STATUS_UNTAKEN 0 + +/** @def QUEST_STATUS_TAKEN */ +#define QUEST_STATUS_TAKEN 1 + +/** @def QUEST_STATUS_COMPLETED */ +#define QUEST_STATUS_COMPLETED 2 + +/** @def QUEST_STATUS_REWARDED */ +#define QUEST_STATUS_REWARDED 3 + +/** @def QUEST_STATUS_FAILED */ +#define QUEST_STATUS_FAILED 4 + +/** @def QUEST_STATUS_FINISHED */ +#define QUEST_STATUS_FINISHED 5 + +/** @def QUEST_STATUS_FAILED_DONE */ +#define QUEST_STATUS_FAILED_DONE 6 +/** @} */ + +/** @struct quest_type + * @brief Quest + */ +struct quest_type +{ + /** @structvar silent + * @brief Boolean + * @note Does quest appear on quest list? + */ + bool silent; + + /** @structvar dynamic_desc + * @brief Boolean + * @note Do we need to ask a function to get the description ? + */ + bool dynamic_desc; + + /** @structvar status + * @brief Number + * @note Is the quest taken, completed, finished? + */ + s16b status; + + /** @structvar level + * @brief Number + * @note Dungeon level + */ + s16b level; + + /** @structvar type + * @brief Number + * @note Lua or C ? + */ + byte type; +}; + +/** @var max_q_idx + * @brief Number + * @note Maximum number of quests in quest list + */ +extern s16b max_q_idx; + +/** @var quest_aux; + * @brief quest_type + * @note Array of quests + */ +extern quest_type quest[max_q_idx] @ quest_aux; + +$static quest_type *lua_get_quest(int q_idx){return &quest[q_idx];} + +/** @fn quest(int q_idx); + * @brief Return quest with index "q_idx" from quest array.\n + * @param q_idx Number \n the index of a quest in the quest array. + * @brief Quest index + * @return quest_type \n The quest at index "q_idx". + * @note (see file w_quest.c) + */ +static quest_type *lua_get_quest @ quest(int q_idx); + +/** @fn new_quest(char *name); + * @dgonly + * @brief Add a new quest to the end of the quest array.\n + * @param *name String \n the name of the new quest. + * @brief Quest name + * @return Number \n The index of the new quest in the quest array. + * @note (see file lua_bind.c) + */ +extern s16b add_new_quest @ new_quest(char *name); + +/** @fn quest_desc(int q_idx, int d, char *desc); + * @dgonly + * @brief Return the description of a quest.\n + * @param q_idx Number \n the index of a quest in the quest array. + * @brief Quest index + * @param d Number \n the index of a line in the quest description. + * @brief Description line + * @param *desc String + * @brief Description + * @return *desc String \n Line "d" of the description of quest with index + * "q_idx" in the quest array. + * @note (see file lua_bind.c) + */ +extern void desc_quest @ quest_desc(int q_idx, int d, char *desc); + +/** @fn get_new_bounty_monster(int lev); + * @brief Find a good random bounty monster.\n + * @param lev Number \n the level of the bounty monster. + * @brief Monster level + * @return Number \n The index of the monster in the r_info array. + * @note (see file lua_bind.c) + */ +extern int lua_get_new_bounty_monster@get_new_bounty_monster(int lev); diff --git a/PKGS/spells.pkg b/PKGS/spells.pkg new file mode 100644 index 0000000..65081af --- /dev/null +++ b/PKGS/spells.pkg @@ -0,0 +1,2498 @@ +/* File: spells.pkg */ + +/* + * Purpose: Lua interface defitions for spells. + * To be processed by tolua to generate C source code. + */ + +$#include "angband.h" +$#include "lua.h" + +/** @typedef *mcptr + * @note String + */ +typedef char *mcptr; + +/** @typedef cptr + * @note String + */ +typedef const char* cptr; + +/** @typedef errr + * @note Number + */ +typedef int errr; + +/** @typedef bool + * @note Boolean + */ +typedef unsigned char bool; + +/** @typedef byte + * @note Number + */ +typedef unsigned char byte; + +/** @typedef s16b + * @note Number + */ +typedef signed short s16b; + +/** @typedef u16b + * @note Number + */ +typedef unsigned short u16b; + +/** @typedef s32b + * @note Number + */ +typedef signed int s32b; + +/** @typedef u32b + * @note Number + */ +typedef unsigned int u32b; + +/** @def DEFAULT_RADIUS */ +#define DEFAULT_RADIUS 25 + +/** @name Spell Damage Types + * @brief Type of damage caused by spell + * @{ */ +/** @def GF_ELEC */ +#define GF_ELEC 1 + +/** @def GF_POIS */ +#define GF_POIS 2 + +/** @def GF_ACID */ +#define GF_ACID 3 + +/** @def GF_COLD */ +#define GF_COLD 4 + +/** @def GF_FIRE */ +#define GF_FIRE 5 + +/** @def GF_UNBREATH */ +#define GF_UNBREATH 6 + +/** @def GF_CORPSE_EXPL */ +#define GF_CORPSE_EXPL 7 + +/** @def GF_MISSILE */ +#define GF_MISSILE 10 + +/** @def GF_ARROW */ +#define GF_ARROW 11 + +/** @def GF_PLASMA */ +#define GF_PLASMA 12 + +/** @def GF_WAVE */ +#define GF_WAVE 13 + +/** @def GF_WATER */ +#define GF_WATER 14 + +/** @def GF_LITE */ +#define GF_LITE 15 + +/** @def GF_DARK */ +#define GF_DARK 16 + +/** @def GF_LITE_WEAK */ +#define GF_LITE_WEAK 17 + +/** @def GF_DARK_WEAK */ +#define GF_DARK_WEAK 18 + +/** @def GF_SHARDS */ +#define GF_SHARDS 20 + +/** @def GF_SOUND */ +#define GF_SOUND 21 + +/** @def GF_CONFUSION */ +#define GF_CONFUSION 22 + +/** @def GF_FORCE */ +#define GF_FORCE 23 + +/** @def GF_INERTIA */ +#define GF_INERTIA 24 + +/** @def GF_MANA */ +#define GF_MANA 26 + +/** @def GF_METEOR */ +#define GF_METEOR 27 + +/** @def GF_ICE */ +#define GF_ICE 28 + +/** @def GF_CHAOS */ +#define GF_CHAOS 30 + +/** @def GF_NETHER */ +#define GF_NETHER 31 + +/** @def GF_DISENCHANT */ +#define GF_DISENCHANT 32 + +/** @def GF_NEXUS */ +#define GF_NEXUS 33 + +/** @def GF_TIME */ +#define GF_TIME 34 + +/** @def GF_GRAVITY */ +#define GF_GRAVITY 35 + +/** @def GF_KILL_WALL */ +#define GF_KILL_WALL 40 + +/** @def GF_KILL_DOOR */ +#define GF_KILL_DOOR 41 + +/** @def GF_KILL_TRAP */ +#define GF_KILL_TRAP 42 + +/** @def GF_MAKE_WALL */ +#define GF_MAKE_WALL 45 + +/** @def GF_MAKE_DOOR */ +#define GF_MAKE_DOOR 46 + +/** @def GF_MAKE_TRAP */ +#define GF_MAKE_TRAP 47 + +/** @def GF_OLD_CLONE */ +#define GF_OLD_CLONE 51 + +/** @def GF_OLD_POLY */ +#define GF_OLD_POLY 52 + +/** @def GF_OLD_HEAL */ +#define GF_OLD_HEAL 53 + +/** @def GF_OLD_SPEED */ +#define GF_OLD_SPEED 54 + +/** @def GF_OLD_SLOW */ +#define GF_OLD_SLOW 55 + +/** @def GF_OLD_CONF */ +#define GF_OLD_CONF 56 + +/** @def GF_OLD_SLEEP */ +#define GF_OLD_SLEEP 57 + +/** @def GF_OLD_DRAIN */ +#define GF_OLD_DRAIN 58 + +/** @def GF_AWAY_UNDEAD */ +#define GF_AWAY_UNDEAD 61 + +/** @def GF_AWAY_EVIL */ +#define GF_AWAY_EVIL 62 + +/** @def GF_AWAY_ALL */ +#define GF_AWAY_ALL 63 + +/** @def GF_TURN_UNDEAD */ +#define GF_TURN_UNDEAD 64 + +/** @def GF_TURN_EVIL */ +#define GF_TURN_EVIL 65 + +/** @def GF_TURN_ALL */ +#define GF_TURN_ALL 66 + +/** @def GF_DISP_UNDEAD */ +#define GF_DISP_UNDEAD 67 + +/** @def GF_DISP_EVIL */ +#define GF_DISP_EVIL 68 + +/** @def GF_DISP_ALL */ +#define GF_DISP_ALL 69 + +/* New types for Zangband begin here... */ + +/** @def GF_DISP_DEMON */ +#define GF_DISP_DEMON 70 + +/** @def GF_DISP_LIVING */ +#define GF_DISP_LIVING 71 + +/** @def GF_ROCKET */ +#define GF_ROCKET 72 + +/** @def GF_NUKE */ +#define GF_NUKE 73 + +/** @def GF_MAKE_GLYPH */ +#define GF_MAKE_GLYPH 74 + +/** @def GF_STASIS */ +#define GF_STASIS 75 + +/** @def GF_STONE_WALL */ +#define GF_STONE_WALL 76 + +/** @def GF_DEATH_RAY */ +#define GF_DEATH_RAY 77 + +/** @def GF_STUN */ +#define GF_STUN 78 + +/** @def GF_HOLY_FIRE */ +#define GF_HOLY_FIRE 79 + +/** @def GF_HELL_FIRE */ +#define GF_HELL_FIRE 80 + +/** @def GF_DISINTEGRATE */ +#define GF_DISINTEGRATE 81 + +/** @def GF_CHARM */ +#define GF_CHARM 82 + +/** @def GF_CONTROL_UNDEAD */ +#define GF_CONTROL_UNDEAD 83 + +/** @def GF_CONTROL_ANIMAL */ +#define GF_CONTROL_ANIMAL 84 + +/** @def GF_PSI */ +#define GF_PSI 85 + +/** @def GF_PSI_DRAIN */ +#define GF_PSI_DRAIN 86 + +/** @def GF_TELEKINESIS */ +#define GF_TELEKINESIS 87 + +/** @def GF_JAM_DOOR */ +#define GF_JAM_DOOR 88 + +/** @def GF_DOMINATION */ +#define GF_DOMINATION 89 + +/** @def GF_DISP_GOOD */ +#define GF_DISP_GOOD 90 + +/** @def GF_IDENTIFY */ +#define GF_IDENTIFY 91 + +/** @def GF_RAISE */ +#define GF_RAISE 92 + +/** @def GF_STAR_IDENTIFY */ +#define GF_STAR_IDENTIFY 93 + +/** @def GF_DESTRUCTION */ +#define GF_DESTRUCTION 94 + +/** @def GF_STUN_CONF */ +#define GF_STUN_CONF 95 + +/** @def GF_STUN_DAM */ +#define GF_STUN_DAM 96 + +/** @def GF_CONF_DAM */ +#define GF_CONF_DAM 98 + +/** @def GF_STAR_CHARM */ +#define GF_STAR_CHARM 99 + +/** @def GF_IMPLOSION */ +#define GF_IMPLOSION 100 + +/** @def GF_LAVA_FLOW */ +#define GF_LAVA_FLOW 101 + +/** @def GF_FEAR */ +#define GF_FEAR 102 + +/** @def GF_BETWEEN_GATE */ +#define GF_BETWEEN_GATE 103 + +/** @def GF_WINDS_MANA */ +#define GF_WINDS_MANA 104 + +/** @def GF_DEATH */ +#define GF_DEATH 105 + +/** @def GF_CONTROL_DEMON */ +#define GF_CONTROL_DEMON 106 + +/** @def GF_RAISE_DEMON */ +#define GF_RAISE_DEMON 107 + +/** @def GF_TRAP_DEMONSOUL */ +#define GF_TRAP_DEMONSOUL 108 + +/** @def GF_ATTACK */ +#define GF_ATTACK 109 + +/** @def GF_CHARM_UNMOVING */ +#define GF_CHARM_UNMOVING 110 + +/** @def MAX_GF */ +#define MAX_GF 111 +/** @} */ + +/** @name Spell Projection Flags + * @brief Area affected by spell + * @{ */ +/** @def PROJECT_JUMP + * @note Jump directly to the target location (this is a hack) + */ +#define PROJECT_JUMP 0x00000001 + +/** @def PROJECT_BEAM + * @note Work as a beam weapon (affect every grid passed through) + */ +#define PROJECT_BEAM 0x00000002 + +/** @def PROJECT_THRU + * @note Continue "through" the target (used for "bolts"/"beams") + */ +#define PROJECT_THRU 0x00000004 + +/** @def PROJECT_STOP + * @note Stop as soon as we hit a monster (used for "bolts") + */ +#define PROJECT_STOP 0x00000008 + +/** @def PROJECT_GRID + * @note Affect each grid in the "blast area" in some way + */ +#define PROJECT_GRID 0x00000010 + +/** @def PROJECT_ITEM + * @note Affect each object in the "blast area" in some way + */ +#define PROJECT_ITEM 0x00000020 + +/** @def PROJECT_KILL + * @note Affect each monster in the "blast area" in some way + */ +#define PROJECT_KILL 0x00000040 + +/** @def PROJECT_HIDE + * @note Hack -- disable "visual" feedback from projection + */ +#define PROJECT_HIDE 0x00000080 + +/** @def PROJECT_VIEWABLE + * @note Affect monsters in LOS + */ +#define PROJECT_VIEWABLE 0x00000100 + +/** @def PROJECT_METEOR_SHOWER + * @note Affect random grids + */ +#define PROJECT_METEOR_SHOWER 0x00000200 + +/** @def PROJECT_BLAST + * @note Like Mega_blast, but will only affect viewable grids + */ +#define PROJECT_BLAST 0x00000400 + +/** @def PROJECT_PANEL + * @note Affect everything in the panel. + */ +#define PROJECT_PANEL 0x00000800 + +/** @def PROJECT_ALL + * @note Affect every single grid. + */ +#define PROJECT_ALL 0x00001000 + +/** @def PROJECT_WALL + * @note Continue "through" the walls + */ +#define PROJECT_WALL 0x00002000 + +/** @def PROJECT_MANA_PATH + * @note Follow a mana path. + */ +#define PROJECT_MANA_PATH 0x00004000 + +/** @def PROJECT_ABSORB_MANA + * @note The spell increase in power as it absord grid's mana. + */ +#define PROJECT_ABSORB_MANA 0x00008000 + +/** @def PROJECT_STAY */ +#define PROJECT_STAY 0x00010000 +/** @} */ + +/** @var project_time + * @brief Number + * @note The length of time a spell effect exists. + */ +extern int project_time; + +/** @fn teleport_player_directed(int rad, int dir) + * @brief Teleport a player up to "rad" grids away roughly in "dir" + * direction.\n + * @param rad Number \n rad must not exceed 200. The distance teleported is + * at least a quarter of rad. + * @brief Distance + * @param dir Number \n dir must be a value from 0 to 9. + * @brief Direction + * @note + * Teleport player, using a distance and a direction as a rough guide.\n\n + * This function is not at all obsessive about correctness.\n + * This function allows teleporting into vaults (!) + * @note (see file spells1.c) + */ +extern void teleport_player_directed(int rad, int dir); + +/** @fn teleport_away(int m_idx, int dis) + * @brief Teleport monster indicated by "m_idx" up to "dis" grids away.\n + * @param m_idx Number \n m_idx is the index of the monster in m_list[]. + * @brief Monster index + * @param dis Number \n dis must not exceed 200. The distance teleported + * is a minimum of a quarter of "dis". + * @brief Distance + * @note + * Teleport a monster, normally up to "dis" grids away.\n\n + * Attempt to move the monster at least "dis/2" grids away.\n\n + * But allow variation to prevent infinite loops. + * @note (see file spells1.c) + */ +extern void teleport_away(int m_idx, int dis); + +/** @fn teleport_player(int dis) + * @brief Teleport player up to "dis" grids away.\n + * @param dis Number \n dis must not exceed 200. The distance teleported + * is a minimum of a quarter of dis. + * @brief Distance + * @note + * Teleport the player to a location up to "dis" grids away.\n\n + * If no such spaces are readily available, the distance may increase.\n + * Try very hard to move the player at least a quarter that distance. + * @note (see file spells1.c) + */ +extern void teleport_player(int dis); + +/** @fn teleport_player_to(int ny, int nx) + * @brief Teleport player to a grid near coordinate ("ny", "nx").\n + * @param ny Number \n ny is the y co-ordinate of the location. + * @brief Y coordinate + * @param nx Number \n nx is the x co-ordinate of the location. + * @brief X coordinate + * @note + * Teleport player to a grid near the given location\n\n + * This function is slightly obsessive about correctness.\n + * This function allows teleporting into vaults (!)\n\n + * If the location is empty, the player goes there, otherwise they go to + * a grid as close as possible to the location. + * @note (see file spells1.c) + */ +extern void teleport_player_to(int ny, int nx); + +/** @fn teleport_monster_to(int m_idx, int ny, int nx) + * @brief Teleport monster indicated by "m_idx" to a grid near coordinate + * ("ny", "nx").\n + * @param m_idx Number \n m_idx is the index of the monster in m_list[]. + * @brief Monster index + * @param ny Number \n ny is the y co-ordinate of the location. + * @brief Y coordinate + * @param nx Number \n nx is the x co-ordinate of the location. + * @brief X coordinate + * @note + * Teleport a monster to a grid near the given location\n\n + * This function is slightly obsessive about correctness.\n\n + * If the location is empty, the monster goes there, otherwise they go to + * a grid as close as possible to the location. + * @note (see file spells1.c) + */ +extern void teleport_monster_to(int m_idx, int ny, int nx); + +/** @fn teleport_monster(int dir) + * @brief Teleport away all monsters in direction "dir".\n + * @param dir Number \n dir must be a value from 0 to 9. + * @brief Direction + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * @note + * All monsters in direction "dir" are teleported away and sustain + * MAX_SIGHT (20) x 5 damage.\n\n + * If direction is 5 and a target has been selected, then the target is used. + * Otherwise, a target is calculated based on a distance of 999 grids away + * from the player in direction "dir". + * @note (see file spells2.c) + */ +extern bool teleport_monster(int dir); + +/** @fn teleport_player_level(void) + * @brief Teleport the player one level up or down at random. + * @note + * Teleport the player one level up or down (random when legal) + * @note (see file spells1.c) + */ +extern void teleport_player_level(void); + +/** @fn fetch(int dir, int wgt, bool require_los) + * @brief Fetch an item in direction "dir" with weight "wgt" possibly not in + * line of sight.\n + * @param dir Number \n dir must be a value from 0 to 9. + * @brief Direction + * @param wgt Number \n maximum weight of object. + * @brief Weight + * @param require_los Boolean \n TRUE if line of sight is required, otherwise + * FALSE. + * @brief Require-line-of-sight flag + * @note + * Fetch an item (teleport it right underneath the caster)\n\n + * If direction is 5 and a target has been selected, then the target is used. + * Otherwise, a target is calculated based on a distance of 999 grids away + * from the player in direction "dir". + * Fetch will fail if player is standing on something, or if the object is + * too far away, or if require_los is TRUE and player does not have line + * of sight to the object, or the object is too heavy. Otherwise the + * object appears at the player's feet (same grid as player). + * @note (see file cmd5.c) + */ +extern void fetch(int dir, int wgt, bool require_los); + +/** @fn recall_player(int d, int f) + * @brief Recall the player to town (if in dungeon) or dungeon (if in town).\n + * @param d Number \n Random time interval + * @brief Dice + * @param f Number \n Fixed time interval + * @brief Fixed + * @note (see file spells1.c) + */ +extern void recall_player(int d, int f); + +/** @fn take_hit(int damage, cptr kb_str) + * @brief Reduce player hit points by "damage" inflicted by "kb_str".\n + * @param damage Number \n damage is the number of hit points of damage. + * @brief Damage + * @param kb_str String \n kb_str describes what killed the player + * (in the event the player dies) + * @brief Killed by + * @note + * Decreases players hit points and sets death flag if necessary\n\n + * XXX XXX XXX Invulnerability needs to be changed into a "shield"\n\n + * XXX XXX XXX Hack -- this function allows the user to save (or quit) + * the game when he dies, since the "You die." message is shown before + * setting the player to "dead". + * @note (see file spells1.c) + */ +extern void take_hit(int damage, cptr kb_str); + +/** @fn take_sanity_hit(int damage, cptr hit_from) + * @brief Reduce player sanity points by "damage" inflicted by "hit_from".\n + * @param damage Number \n damage is the number of sanity points of damage. + * @brief Damage + * @param hit_from String \n hit_from describes what caused the damage. + * @brief Hit from + * @note + * Decrease player's sanity. This is a copy of the function above.\n\n + * Reduce the player's current sanity points by "damage" points. If the + * player dies, "hit_from" is used to record what the player was killed + * by (see high-score table). + * @note (see file spells1.c) + */ +extern void take_sanity_hit(int damage, cptr hit_from); + +/** @fn project(int who, int rad, int y, int x, int dam, int typ, int flg) + * @brief Generate a beam/bolt/ball with properties "flg" starting from "who" + * with a radius of "rad" at target grid "y,x" for "dam" points of "typ" + * damage.\n + * @param who Number \n who is > 0 (index of monster in m_list[]), < 0 and + * not -100 or -101 (player), -100 or -101 (trap). + * @brief Source + * @param rad Number \n rad is 0 for a beam/bolt and 1-9 for a ball. + * @brief Radius + * @param y Number \n y is the y coordinate of the target grid. + * @brief Y-coordinate + * @param x Number \n x is the x co-ordinate of the target grid. + * @brief X-coordinate + * @param dam Number \n dam is the number of hit points of damage. + * @brief Damage + * @param typ Number \n typ is the type of damage (GF field). + * @brief Type + * @param flg Number \n flg is the projection effect (PROJECT field). + * @brief Properties flag + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * @note + * Generic "beam"/"bolt"/"ball" projection routine.\n\n + * Input:\n + * who: Index of "source" monster (negative for "player")\n + * jk -- -2 for traps, only used with project_jump\n + * rad: Radius of explosion (0 = beam/bolt, 1 to 9 = ball)\n + * y,x: Target location (or location to travel "towards")\n + * dam: Base damage roll to apply to affected monsters (or player)\n + * typ: Type of damage to apply to monsters (and objects)\n + * flg: Extra bit flags (see PROJECT_xxxx in "defines.h")\n\n + * Return:\n + * TRUE if any "effects" of the projection were observed, else FALSE\n\n + * Allows a monster (or player) to project a beam/bolt/ball of a given kind + * towards a given location (optionally passing over the heads of interposing + * monsters), and have it do a given amount of damage to the monsters (and + * optionally objects) within the given radius of the final location.\n\n + * A "bolt" travels from source to target and affects only the target grid.\n + * A "beam" travels from source to target, affecting all grids passed through.\n + * A "ball" travels from source to the target, exploding at the target, and + * affecting everything within the given radius of the target location.\n\n + * Traditionally, a "bolt" does not affect anything on the ground, and does + * not pass over the heads of interposing monsters, much like a traditional + * missile, and will "stop" abruptly at the "target" even if no monster is + * positioned there, while a "ball", on the other hand, passes over the heads + * of monsters between the source and target, and affects everything except + * the source monster which lies within the final radius, while a "beam" + * affects every monster between the source and target, except for the casting + * monster (or player), and rarely affects things on the ground.\n\n + * Two special flags allow us to use this function in special ways, the + * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while + * the "PROJECT_JUMP" flag allows us to affect a specific grid, without + * actually projecting from the source monster (or player).\n\n + * The player will only get "experience" for monsters killed by himself + * Unique monsters can only be destroyed by attacks from the player\n\n + * Only 256 grids can be affected per projection, limiting the effective + * "radius" of standard ball attacks to nine units (diameter nineteen).\n\n + * One can project in a given "direction" by combining PROJECT_THRU with small + * offsets to the initial location (see "line_spell()"), or by calculating + * "virtual targets" far away from the player.\n\n + * One can also use PROJECT_THRU to send a beam/bolt along an angled path, + * continuing until it actually hits something (useful for "stone to mud").\n\n + * Bolts and Beams explode INSIDE walls, so that they can destroy doors.\n\n + * Balls must explode BEFORE hitting walls, or they would affect monsters + * on both sides of a wall. Some bug reports indicate that this is still + * happening in 2.7.8 for Windows, though it appears to be impossible.\n\n + * We "pre-calculate" the blast area only in part for efficiency. + * More importantly, this lets us do "explosions" from the "inside" out. + * This results in a more logical distribution of "blast" treasure. + * It also produces a better (in my opinion) animation of the explosion. + * It could be (but is not) used to have the treasure dropped by monsters + * in the middle of the explosion fall "outwards", and then be damaged by + * the blast as it spreads outwards towards the treasure drop location.\n\n + * Walls and doors are included in the blast area, so that they can be + * "burned" or "melted" in later versions.\n\n + * This algorithm is intended to maximise simplicity, not necessarily + * efficiency, since this function is not a bottleneck in the code.\n\n + * We apply the blast effect from ground zero outwards, in several passes, + * first affecting features, then objects, then monsters, then the player. + * This allows walls to be removed before checking the object or monster + * in the wall, and protects objects which are dropped by monsters killed + * in the blast, and allows the player to see all affects before he is + * killed or teleported away. The semantics of this method are open to + * various interpretations, but they seem to work well in practice.\n\n + * We process the blast area from ground-zero outwards to allow for better + * distribution of treasure dropped by monsters, and because it provides a + * pleasing visual effect at low cost.\n\n + * Note that the damage done by "ball" explosions decreases with distance. + * This decrease is rapid, grids at radius "dist" take "1/dist" damage.\n\n + * Notice the "napalm" effect of "beam" weapons. First they "project" to + * the target, and then the damage "flows" along this beam of destruction. + * The damage at every grid is the same as at the "centre" of a "ball" + * explosion, since the "beam" grids are treated as if they ARE at the + * centre of a "ball" explosion.\n\n + * Currently, specifying "beam" plus "ball" means that locations which are + * covered by the initial "beam", and also covered by the final "ball", except + * for the final grid (the epicentre of the ball), will be "hit twice", once + * by the initial beam, and once by the exploding ball. For the grid right + * next to the epicentre, this results in 150% damage being done. The centre + * does not have this problem, for the same reason the final grid in a "beam" + * plus "bolt" does not -- it is explicitly removed. Simply removing "beam" + * grids which are covered by the "ball" will NOT work, as then they will + * receive LESS damage than they should. Do not combine "beam" with "ball".\n\n + * The array "gy[],gx[]" with current size "grids" is used to hold the + * collected locations of all grids in the "blast area" plus "beam path".\n\n + * Note the rather complex usage of the "gm[]" array. First, gm[0] is always + * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the + * first blast grid (see above) with radius "N" from the blast centre. Note + * that only the first gm[1] grids in the blast area thus take full damage. + * Also, note that gm[rad+1] is always equal to "grids", which is the total + * number of blast grids.\n\n + * Note that once the projection is complete, (y2,x2) holds the final location + * of bolts/beams, and the "epicentre" of balls.\n\n + * Note also that "rad" specifies the "inclusive" radius of projection blast, + * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the + * implementation of the "distance" function. Also, a bolt can be properly + * viewed as a "ball" with a "rad" of "zero".\n\n + * Note that if no "target" is reached before the beam/bolt/ball travels the + * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This + * may be relevant even for bolts, since they have a "1x1" mini-blast.\n\n + * Note that for consistency, we "pretend" that the bolt actually takes "time" + * to move from point A to point B, even if the player cannot see part of the + * projection path. Note that in general, the player will *always* see part + * of the path, since it either starts at the player or ends on the player.\n\n + * Hack -- we assume that every "projection" is "self-illuminating".\n\n + * Hack -- when only a single monster is affected, we automatically track + * (and recall) that monster, unless "PROJECT_JUMP" is used.\n\n + * Note that all projections now "explode" at their final destination, even + * if they were being projected at a more distant destination. This means + * that "ball" spells will *always* explode.\n\n + * Note that we must call "handle_stuff()" after affecting terrain features + * in the blast radius, in case the "illumination" of the grid was changed, + * and "update_view()" and "update_monsters()" need to be called. + * @note (see file spells1.c) + */ +extern bool project(int who, int rad, int y, int x, int dam, int typ, int flg); + +/** @fn corrupt_player(void) + * @brief Swap two of the player's stats at random. + * @note (see file spells1.c) + */ +extern void corrupt_player(void); + +/** @fn grow_things(s16b type, int rad) + * @brief Grow "type" things within "rad" distance of the player.\n + * @param type Number \n type of thing to grow (FEAT field). + * @brief Type + * @param rad Number \n rad is the radius of the area where things may grow. + * @brief Radius + * @note + * Grow things\n\n + * Up to (rad * (rad + 11)) things can be grown around the player. The + * grids must support growth. + * @note (see file spells2.c) + */ +extern void grow_things(s16b type, int rad); + +/** @fn grow_grass(int rad) + * @brief Grow grass within "rad" distance of the player.\n + * @param rad Number \n rad is the radius of the area where grass may grow. + * @brief Radius + * @note + * Grow grass\n\n + * Up to (rad * (rad + 11)) grass can be grown around the player. The + * grids must support growth. + * @note (see file spells2.c) + */ +extern void grow_grass(int rad); + +/** @fn grow_trees(int rad) + * @brief Grow trees within "rad" distance of the player.\n + * @param rad Number \n rad is the radius of the area where trees may grow. + * @brief Radius + * @note + * Grow trees\n\n + * Up to (rad * (rad + 11)) trees can be grown around the player. The + * grids must support growth. + * @note (see file spells2.c) + */ +extern void grow_trees(int rad); + +/** @fn hp_player(int num) + * @brief Add "num" points to the player's current hit points.\n + * @param num Number \n num is the number of points to add. + * @brief Number + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * @note + * Increase players hit points, notice effects\n\n + * The total can not exceed the maximum. + * @note (see file spells2.c) + */ +extern bool hp_player(int num); + +/** @fn heal_insanity(int val) + * @brief Add "val" points to the player's current sanity points.\n + * @param val Number \n val is the number of points to add. + * @brief Value + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * @note + * Heal insanity.\n\n + * The total can not exceed the maximum. + * @note (see file spells2.c) + */ +extern bool heal_insanity(int val); + +/** @fn warding_glyph(void) + * @brief Place a glyph at the player's location. + * @note + * Leave a "glyph of warding" which prevents monster movement\n\n + * The location must be bare. + * @note (see file spells2.c) + */ +extern void warding_glyph(void); + +/** @fn explosive_rune(void) + * @brief Place a minor glyph (explosive rune) at the player's location. + * @note + * The location must be bare. + * @note (see file spells2.c) + */ +extern void explosive_rune(void); + +/** @fn do_dec_stat(int stat, int mode) + * @brief Attempt to reduce the player's "stat" statistic by a point.\n + * @param stat Number \n stat is the statistic + * @brief Statistic + * @param mode Number \n mode is the type of decrease: temporary, normal, + * or permanent + * @brief Mode + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * @note + * Lose a "point" + * @note (see file spells2.c) + */ +extern bool do_dec_stat(int stat, int mode); + +/** @fn do_res_stat(int stat, bool full) + * @brief Restore the player's "stat" statistic.\n + * @param stat Number \n stat is the statistic. + * @brief Statistic + * @param full Boolean \n TRUE if full restore is required, otherwise FALSE. + * @brief Full restore flag + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * @note + * Restore lost "points" in a stat + * @note (see file spells2.c) + */ +extern bool do_res_stat(int stat, bool full); + +/** @fn do_inc_stat(int stat) + * @brief Increase the player's "stat" statistic by a point.\n + * @param stat Number \n stat is the statistic. + * @brief Statistic + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * @note + * Gain a "point" in a stat + * @note (see file spells2.c) + */ +extern bool do_inc_stat(int stat); + +/** @fn identify_pack(void) + * @brief Identify all items in the inventory. + * @note + * Identify everything being carried.\n + * Done by a potion of "self knowledge". + * @note (see file spells2.c) + */ +extern void identify_pack(void); + +/** @fn remove_curse(void) + * @brief Remove all curses except for heavy curses. + * @return Boolean \n TRUE if at least one item was uncursed, otherwise FALSE. + * @note + * Remove most curses\n\n + * There is a 1 in (55 - level) chance of reversing the curse effects for + * items which are not artifacts. For example, a Ring of Damage (-15) will + * become a Ring of Damage (+15). + * @note (see file spells2.c) + */ +extern bool remove_curse(void); + +/** @fn remove_all_curse(void) + * @brief Remove all curses including heavy curses. + * @return Boolean \n TRUE if at least one item was uncursed, otherwise FALSE. + * @note + * Remove all curses\n\n + * There is a 1 in (55 - level) chance of reversing the curse effects for + * items which are not artifacts. For example, a Ring of Damage (-15) will + * become a Ring of Damage (+15). + * @note (see file spells2.c) + */ +extern bool remove_all_curse(void); + +/** @fn restore_level(void) + * @brief Restore all drained experience points (if any). + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * @note + * Restores any drained experience + * @note (see file spells2.c) + */ +extern bool restore_level(void); + +/** @fn self_knowledge(FILE *fff=NULL) + * @brief Show all attributes including racial powers, mutations, and + * equipment effects.\n + * @param *fff FILE \n write info to screen if fff is NULL, + * otherwise write info to file fff. + * @brief Output file + * @note + * self-knowledge... idea from nethack. Useful for determining powers and + * resistances of items. It saves the screen, clears it, then starts listing + * attributes, a screenful at a time. (There are a LOT of attributes to + * list. It will probably take 2 or 3 screens for a powerful character whose + * using several artifacts...) -CFT\n\n + * It is now a lot more efficient. -BEN-\n\n + * See also "identify_fully()".\n\n + * XXX XXX XXX Use the "show_file()" method, perhaps. + * @note (see file spells2.c) + */ +extern void self_knowledge(FILE *fff=NULL); + +/** @fn lose_all_info(void) + * @brief Forget about objects and the map. + * @return Boolean \n TRUE (always). + * @note + * Forget everything + * @note (see file spells2.c) + */ +extern bool lose_all_info(void); + +/** @fn detect_traps(int rad) + * @brief Detect all traps within radius "rad" of the player.\n + * @param rad Number \n rad is the radius of circle of detection. + * @brief Radius + * @return Boolean \n TRUE (always). + * @note + * All grids within the radius are searched.\n + * A message is displayed if traps are detected. + * @note (see file spells2.c) + */ +extern bool detect_traps(int rad); + +/** @fn detect_doors(int rad) + * @brief Detect all doors within radius "rad" of the player.\n + * @param rad Number \n rad is the radius of circle of detection. + * @brief Radius + * @return Boolean \n TRUE if doors were detected, otherwise FALSE. + * @note + * All grids within the radius are searched.\n + * A message is displayed if doors are detected. + * @note (see file spells2.c) + */ +extern bool detect_doors(int rad); + +/** @fn detect_stairs(int rad) + * @brief Detect all exits within radius "rad" of the player.\n + * @param rad Number \n rad is the radius of circle of detection. + * @brief Radius + * @return Boolean \n TRUE if exits were detected, otherwise FALSE. + * @note + * All grids within the radius are searched.\n + * A message is displayed if exits are detected. Exits can be stairs, + * shafts, and ways out. + * @note (see file spells2.c) + */ +extern bool detect_stairs(int rad); + +/** @fn detect_treasure(int rad) + * @brief Detect all buried treasure within radius "rad" of the player.\n + * @param rad Number \n rad is the radius of circle of detection. + * @brief Radius + * @return Boolean \n TRUE if buried treasure was detected, otherwise FALSE. + * @note + * All grids within the radius are searched.\n + * A message is displayed if buried treasure is detected. Treasure can be + * buried in magma, quartz, or sandwall. + * @note (see file spells2.c) + */ +extern bool detect_treasure(int rad); + +/** @var hack_no_detect_message + * @brief Boolean + * @note Suppress messages generated by "detect" spells? + */ +extern bool hack_no_detect_message; + +/** @fn detect_objects_gold(int rad) + * @brief Detect all gold within radius "rad" of the player.\n + * @param rad Number \n rad is the radius of circle of detection. + * @brief Radius + * @return Boolean \n TRUE if gold was detected, otherwise FALSE. + * @note + * All grids within the radius are searched.\n + * A message is displayed if gold is detected. Gold can be coins or mimics. + * Monsters of type "$" are detected but not shown or reported. + * @note (see file spells2.c) + */ +extern bool detect_objects_gold(int rad); + +/** @fn detect_objects_normal(int rad) + * @brief Detect all normal (not gold) items within radius "rad" of the player.\n + * @param rad Number \n rad is the radius of circle of detection. + * @brief Radius + * @return Boolean \n TRUE if normal items were detected, otherwise FALSE. + * @note + * All grids within the radius are searched.\n + * A message is displayed if normal items are detected. Items include mimics. + * Monsters of type "!=?|" are detected but not shown or reported. + * @note (see file spells2.c) + */ +extern bool detect_objects_normal(int rad); + +/** @fn detect_objects_magic(int rad) + * @brief Detect all magic (not gold) items within radius "rad" of the player.\n + * @param rad Number \n rad is the radius of circle of detection. + * @brief Radius + * @return Boolean \n TRUE if magic items were detected, otherwise FALSE. + * @note + * This will light up all spaces with "magic" items, including artifacts, + * ego-items, potions, scrolls, books, rods, wands, staves, amulets, rings, + * and "enchanted" items of the "good" variety.\n\n + * It can probably be argued that this function is now too powerful.\n\n + * All grids within the radius are searched.\n + * A message is displayed if magic items are detected. Items include mimics. + * @note (see file spells2.c) + */ +extern bool detect_objects_magic(int rad); + +/** @fn detect_monsters_normal(int rad) + * @brief Detect all non-invisible monsters within radius "rad" of the player.\n + * @param rad Number \n rad is the radius of circle of detection. + * @brief Radius + * @return Boolean \n TRUE if non-invisible monsters were detected, + * otherwise FALSE. + * @note + * A non-invisible monster is one which is visible, or one which is invisible + * but the player can see invisible monsters. + * @note (see file spells2.c) + */ +extern bool detect_monsters_normal(int rad); + +/** @fn detect_monsters_invis(int rad) + * @brief Detect all invisible monsters within radius "rad" of the player.\n + * @param rad Number \n rad is the radius of circle of detection. + * @brief Radius + * @return Boolean \n TRUE if invisible monsters were detected, + * otherwise FALSE. + * @note (see file spells2.c) + */ +extern bool detect_monsters_invis(int rad); + +/** @fn detect_monsters_evil(int rad) + * @brief Detect all evil monsters within radius "rad" of the player.\n + * @param rad Number \n rad is the radius of circle of detection. + * @brief Radius + * @return Boolean \n TRUE if evil monsters were detected, otherwise FALSE. + * @note (see file spells2.c) + */ +extern bool detect_monsters_evil(int rad); + +/** @fn detect_monsters_good(int rad) + * @brief Detect all good monsters within radius "rad" of the player.\n + * @param rad Number \n rad is the radius of circle of detection. + * @brief Radius + * @return Boolean \n TRUE if good monsters were detected, otherwise FALSE. + * @note (see file spells2.c) + */ +extern bool detect_monsters_good(int rad); + +/** @fn detect_monsters_xxx(u32b match_flag, int rad) + * @brief Detect all monsters with flag "match_flag" within radius "rad" of the + * player.\n + * @param match_flag Number \n match_flag is the type of monster. It must be + * a RF3_ flag (see defines.h). + * @brief Match flag + * @param rad Number \n rad is the radius of circle of detection. + * @brief Radius + * @return Boolean \n TRUE if monsters were detected, otherwise FALSE. + * @note + * A "generic" detect monsters routine, tagged to flags3\n\n + * This routine will work with ANY RF3 flag, but messages will only be + * printed if the following monsters are detected: demon, undead, good. + * @note (see file spells2.c) + */ +extern bool detect_monsters_xxx(u32b match_flag, int rad); + +/** @fn detect_monsters_string(cptr chars, int rad) + * @brief Detect all monsters whose monster symbol is in "chars" within + * radius "rad" of the player.\n + * @param chars String \n chars is the string of monster types. For + * available characters, see the "symbol" field of the graphics (G) + * line of r_info.txt. + * @brief Symbols + * @param rad Number \n rad is the radius of circle of detection. + * @brief Radius + * @return Boolean \n TRUE if monsters were detected, otherwise FALSE. + * @note (see file spells2.c) + */ +extern bool detect_monsters_string(cptr chars, int rad); + +/** @fn detect_monsters_nonliving(int rad) + * @brief Detect all nonliving monsters within radius "rad" of the player.\n + * @param rad Number \n rad is the radius of circle of detection. + * @brief Radius + * @return Boolean \n TRUE if nonliving monsters were detected, + * otherwise FALSE. + * @note + * Detect all "nonliving", "undead" or "demonic" monsters on current panel\n\n + * Nonliving monsters are either RF3_NONLIVING, RF3_UNDEAD, or RF3_DEMON. + * @note (see file spells2.c) + */ +extern bool detect_monsters_nonliving(int rad); + +/** @fn detect_all(int rad) + * @brief Detect everything within radius "rad" of the player.\n + * @param rad Number \n rad is the radius of circle of detection. + * @brief Radius + * @return Boolean \n TRUE if something was detected, otherwise FALSE. + * @note + * Detect everything\n\n + * Detects traps, doors, stairs, treasure, gold objects, normal objects, + * invisible monsters, non-invisible monsters. + */ +extern bool detect_all(int rad); + +/** @fn stair_creation(void) + * @brief Create stairs at the player location + * @note + * This is not allowed if the grid is not empty, the player is not in a + * dungeon, the player is on a special level, the player is in an arena + * or quest. If the player is in the town or wilderness the stairs will + * go down. If the player is on a quest level or at the bottom of a + * dungeon, the stairs will go up. Otherwise there is an even chance the + * stairs will go up or down. + */ +extern void stair_creation(void); + +/** @fn tgt_pt (int *x=0, int *y=0) + * @brief Set a target point\n + * @param *x Number + * @brief X-coordinate + * @param *y Number + * @brief Y-coordinate + * @return *x Number \n X-coordinate of target. + * @return *y Number \n Y-coordinate of target. + * @return Boolean \n True if a target was selected, otherwise FALSE. + * @note + * Allow the user to move the cursor around the screen to select a target. + * The user must press the space key to set the target. + * @note (see file xtra2.c) + */ +extern bool tgt_pt (int *x=0, int *y=0); + +/** @fn wall_stone(int y, int x) + * @brief Create a stone wall at dungeon grid ("y", "x").\n + * @param y Number \n Y-coordinate of dungeon grid. + * @brief Y-coordinate + * @param x Number \n X-coordinate of dungeon grid. + * @brief X-coordinate + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * @note (see file spells2.c) + */ +extern bool wall_stone(int y, int x); + +/** @fn create_artifact(object_type *o_ptr, bool a_scroll, bool get_name) + * @brief Create an artifact from object "o_ptr".\n + * @param *o_ptr object_type \n object to become an artifact + * @brief Object + * @param a_scroll Boolean \n Is a scroll used to create the artifact?\n + * TRUE if the artifact is created by reading a scroll. + * @brief Use scroll? + * @param get_name Boolean \n Get a name for the artifact?\n + * TRUE if the artifact is to be named by the player (if a_scroll is true) or + * created randomly (a_scroll is false), or FALSE if an inscription is used. + * @brief Get name? + * @return *o_ptr object_type \n The artifact. + * @return Boolean \n TRUE (always). + * @note (see file randart.c) + */ +extern bool create_artifact(object_type *o_ptr, bool a_scroll, bool get_name); + +/** @fn wall_to_mud(int dir) + * @brief Cast a wall-to-mud spell in direction "dir".\n + * @param dir Number \n dir must be a value from 0 to 9. + * @brief Direction + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * If direction is 5 and a target has been selected, then the target is used. + * Otherwise, a target is calculated based on a distance of 999 grids away + * from the player in direction "dir". + * @note (see file spells2.c) + */ +extern bool wall_to_mud(int dir); + +/** @fn ident_spell(void) + * @brief Identify an object in the inventory (or on the floor). + * @return Boolean \n TRUE if object is identified, otherwise FALSE. + * @note + * Identify an object in the inventory (or on the floor). + * This routine does *not* automatically combine objects. + * @note (see file spells2.c) + */ +extern bool ident_spell(void); + +/** @fn identify_fully(void) + * @brief Fully "identify" an object in the inventory (or on the floor). + * @return Boolean \n TRUE if object is identified, otherwise FALSE. + * @note + * Fully "identify" an object in the inventory -BEN- + * @note (see file spells2.c) + */ +extern bool identify_fully(void); + +/** @fn recharge(int num) + * @brief Recharge an object in the inventory (or on the floor) with "num" + * power.\n + * @param num Number \n num is the power used in recharging. It is compared + * to the object's level to determine whether the item is recharged + * successfully or destroyed. If it is recharged, it also determines + * how many charges are added, or how much recharge time is reduced. + * @brief Power + * @return Boolean \n TRUE if something was recharged, otherwise FALSE. + * @note + * Recharge a wand/staff/rod from the pack or on the floor.\n + * This function has been rewritten in Oangband. -LM-\n\n + * Mage -- Recharge I --> recharge(90)\n + * Mage -- Recharge II --> recharge(150)\n + * Mage -- Recharge III --> recharge(220)\n\n + * Priest or Necromancer -- Recharge --> recharge(140)\n + * Scroll of recharging --> recharge(130)\n + * Scroll of *recharging* --> recharge(200)\n\n + * It is harder to recharge high level, and highly charged wands, + * staffs, and rods. The more wands in a stack, the more easily and + * strongly they recharge. Staffs, however, each get fewer charges if + * stacked.\n\n + * XXX XXX XXX Beware of "sliding index errors". + * @note (see file spells2.c) + */ +extern bool recharge(int num); + +/** @fn aggravate_monsters(int who) + * @brief Aggravate monsters, originating from "who".\n + * @param who Number \n who is the index of monster in m_list[] + * (1 if it is the player) which triggers the aggravation. + * @brief Source + * @note + * Wake up all monsters, and speed up "los" monsters. + * @note (see file spells2.c) + */ +extern void aggravate_monsters(int who); + +/** @fn genocide_aux(bool player_cast, char typ) + * @brief Genocide a monster race.\n + * @param player_cast Boolean \n player_cast is true if the player cast the + * spell so the player can take damage. + * @param typ Char \n typ is the letetr of the genocided monsters + * @return Boolean \n TRUE if genocide was cast, otherwise FALSE. + * @note + * Genocide will not work on DF2_NO_GENO dungeon levels, or on "fated to + * die" levels. + * The player gets 4 points of damage per monster genocided. + * @note (see file spells2.c) + */ +extern bool genocide_aux(bool player_cast, char typ); + +/** @fn genocide(bool player_cast) + * @brief Genocide a monster race.\n + * @param player_cast Boolean \n player_cast is true if the player cast the + * spell so the player can take damage. + * @brief Player cast spell? + * @return Boolean \n TRUE if genocide was cast, otherwise FALSE. + * @note + * Genocide will not work on DF2_NO_GENO dungeon levels, or on "fated to + * die" levels. + * The player gets 4 points of damage per monster genocided. + * @note (see file spells2.c) + */ +extern bool genocide(bool player_cast); + +/** @fn mass_genocide(bool player_cast) + * @brief Delete all nearby (non-unique) monsters.\n + * @param player_cast Boolean \n player_cast is true if the player cast the + * spell so the player can take damage. + * @brief Player cast spell? + * @return Boolean \n TRUE (always). + * @note + * Genocide will not work on DF2_NO_GENO dungeon levels, or on "fated to + * die" levels.\n + * The player gets 3 points of damage per monster genocided. + * @note (see file spells2.c) + */ +extern bool mass_genocide(bool player_cast); + +/** @fn probing(void) + * @brief Probe all nearby monsters. + * @return Boolean \n TRUE if probe was successful, otherwise FALSE. + * @note (see file spells2.c) + */ +extern bool probing(void); + +/** @fn banish_evil(int dist) + * @brief Banish nearby evil monsters doing "dist" points of GF_AWAY_EVIL + * damage.\n + * @param dist Number \n dist is the number of hit points of damage. + * @brief Damage + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * @note (see file spells2.c) + */ +extern bool banish_evil(int dist); + +/** @fn dispel_evil(int dam) + * @brief Dispel nearby evil monsters doing "dam" points of GF_DISP_EVIL + * damage.\n + * @param dam Number \n dam is the number of hit points of damage. + * @brief Damage + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * @note (see file spells2.c) + */ +extern bool dispel_evil(int dam); + +/** @fn dispel_good(int dam) + * @brief Dispel nearby good monsters doing "dam" points of GF_DISP_GOOD + * damage.\n + * @param dam Number \n dam is the number of hit points of damage. + * @brief Damage + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * @note (see file spells2.c) + */ +extern bool dispel_good(int dam); + +/** @fn dispel_undead(int dam) + * @brief Dispel nearby undead monsters doing "dam" points of GF_DISP_UNDEAD + * damage.\n + * @param dam Number \n dam is the number of hit points of damage. + * @brief Damage + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * @note (see file spells2.c) + */ +extern bool dispel_undead(int dam); + +/** @fn dispel_monsters(int dam) + * @brief Dispel all nearby monsters doing "dam" points of GF_DISP_ALL + * damage.\n + * @param dam Number \n dam is the number of hit points of damage. + * @brief Damage + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * @note (see file spells2.c) + */ +extern bool dispel_monsters(int dam); + +/** @fn dispel_living(int dam) + * @brief Dispel nearby living monsters doing "dam" points of GF_DISP_LIVING + * damage.\n + * @param dam Number \n dam is the number of hit points of damage. + * @brief Damage + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * @note (see file spells2.c) + */ +extern bool dispel_living(int dam); + +/** @fn dispel_demons(int dam) + * @brief Dispel nearby demon monsters doing "dam" points of GF_DISP_DEMON + * damage.\n + * @param dam Number \n dam is the number of hit points of damage. + * @brief Damage + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * @note (see file spells2.c) + */ +extern bool dispel_demons(int dam); + +/** @fn turn_undead(void) + * @brief Turn nearby undead monsters doing a point of GF_TURN_UNDEAD damage + * for each player level. + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * @note (see file spells2.c) + */ +extern bool turn_undead(void); + +/** @fn door_creation(void) + * @brief Create doors in all grids adjacent to the player. + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * @note (see file spells2.c) + */ +extern bool door_creation(void); + +/** @fn trap_creation(void) + * @brief Create traps in all grids adjacent to the player. + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * @note (see file spells2.c) + */ +extern bool trap_creation(void); + +/** @fn glyph_creation(void) + * @brief Create glyphs in all grids adjacent to the player. + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * @note (see file spells2.c) + */ +extern bool glyph_creation(void); + +/** @fn wipe(int y1, int x1, int r) + * @brief Delete monsters and objects from an area of the dungeon centred at + * grid "y1,x1" for a radius "r".\n + * @param y1 Number \n Y-coordinate of dungeon grid. + * @brief Y-coordinate + * @param x1 Number \n X-coordinate of dungeon grid. + * @brief X-coordinate + * @param r Number \n rad is the radius of circle of detection. + * @brief Radius + * @note + * Wipe -- Empties a part of the dungeon\n\n + * This does not work on special levels or quests. The player may become + * blinded. The player forgets the affected area and it becomes dark. + * All grids become floor. + * @note (see file spells2.c) + */ +extern void wipe(int y1, int x1, int r); + +/** @fn destroy_area(int y1, int x1, int r, bool full, bool bypass) + * @brief Delete monsters and objects from an area of the dungeon centred at + * grid "y1,x1" for a radius "r".\n + * @param y1 Number \n Y-coordinate of dungeon grid. + * @brief Y-coordinate + * @param x1 Number \n X-coordinate of dungeon grid. + * @brief X-coordinate + * @param r Number \n rad is the radius of circle of detection. + * @brief Radius + * @param full Boolean \n unused + * @brief *Unused* + * @param bypass Boolean \n TRUE if quest levels are not destroyed, otherwise + * FALSE. + * @brief Exempt quest levels? + * @note + * The spell of destruction\n\n + * This spell "deletes" monsters (instead of "killing" them).\n\n + * Later we may use one function for both "destruction" and + * "earthquake" by using the "full" to select "destruction".\n\n + * This does not work on special levels. This does not work on quests if the + * bypass flag is set. The epicentre is NOT affected. The player may become + * blinded. The player forgets the affected area and it becomes dark. The + * grids can become granite, quartz, magma, or floor. + * @note (see file spells2.c) + */ +extern void destroy_area(int y1, int x1, int r, bool full, bool bypass); + +/** @fn earthquake(int cy, int cx, int r) + * @brief Create an earthquake centred on grid "cy,cx" with a radius of "r".\n + * @param cy Number \n Y-coordinate of dungeon grid. + * @brief Y-coordinate + * @param cx Number \n X-coordinate of dungeon grid. + * @brief X-coordinate + * @param r Number \n rad is the radius of circle of detection. + * @brief Radius + * @note + * Induce an "earthquake" of the given radius at the given location.\n\n + * This will turn some walls into floors and some floors into walls.\n\n + * The player will take damage and "jump" into a safe grid if possible, + * otherwise, he will "tunnel" through the rubble instantaneously.\n\n + * Monsters will take damage, and "jump" into a safe grid if possible, + * otherwise they will be "buried" in the rubble, disappearing from + * the level in the same way that they do when genocided.\n\n + * Note that thus the player and monsters (except eaters of walls and + * passers through walls) will never occupy the same grid as a wall. + * Note that as of now (2.7.8) no monster may occupy a "wall" grid, even + * for a single turn, unless that monster can pass_walls or kill_walls. + * This has allowed massive simplification of the "monster" code.\n\n + * This does not work on quest levels. The epicentre is NOT affected. + * Only about 15% of the grids are affected. The player takes 300 points + * of damage if they can't be moved to a safe grid, otherwise damage is + * from 10 to 40 points. The player forgets the affected area and it + * becomes dark. The grids can become granite, quartz, magma, or floor. + * @note (see file spells2.c) + */ +extern void earthquake(int cy, int cx, int r); + +/** @fn lite_room(int y1, int x1) + * @brief Lite room containing grid "y1,x1".\n + * @param y1 Number \n Y-coordinate of dungeon grid. + * @brief Y-coordinate + * @param x1 Number \n X-coordinate of dungeon grid. + * @brief X-coordinate + * @note + * Illuminate any room containing the given location. + * @note (see file spells2.c) + */ +extern void lite_room(int y1, int x1); + +/** @fn unlite_room(int y1, int x1) + * @brief Unlite room containing grid "y1,x1".\n + * @param y1 Number \n Y-coordinate of dungeon grid. + * @brief Y-coordinate + * @param x1 Number \n X-coordinate of dungeon grid. + * @brief X-coordinate + * @note + * Darken all rooms containing the given location. + * @note (see file spells2.c) + */ +extern void unlite_room(int y1, int x1); + +/** @fn lite_area(int dam, int rad) + * @brief Lite area around player of radius "rad" causing "dam" points of + * damage to monsters. + * @param dam Number \n dam is the number of hit points of damage. + * @brief Damage + * @param rad Number \n rad is the radius of circle of lite. + * @brief Radius + * @return Boolean \n TRUE (always). + * @note + * Hack -- call light around the player\n + * Affect all monsters in the projection radius\n\n + * Generate a ball of spell type GF_LITE_WEAK.\n + * @note (see file spells2.c) + */ +extern bool lite_area(int dam, int rad); + +/** @fn unlite_area(int dam, int rad) + * @brief Unlite area around player of radius "rad" causing "dam" points of + * damage to monsters. + * @param dam Number \n dam is the number of hit points of damage. + * @brief Damage + * @param rad Number \n rad is the radius of circle of lite. + * @brief Radius + * @return Boolean \n TRUE (always). + * @note + * Hack -- call darkness around the player\n + * Affect all monsters in the projection radius\n\n + * Generate a ball of spell type GF_DARK_WEAK.\n + * @note (see file spells2.c) + */ +extern bool unlite_area(int dam, int rad); + +/** @fn fire_ball_beam(int typ, int dir, int dam, int rad) + * @brief Generate a ball spell of type "typ" with radius "rad" aimed in + * direction "dir" for "dam" damage.\n + * @param typ Number \n typ is the type of damage (GF field). + * @brief Type + * @param dir Number \n dir must be a value from 0 to 9. + * @brief Direction + * @param dam Number \n dam is the number of hit points of damage. + * @brief Damage + * @param rad Number \n rad is 0 for a beam/bolt and 1-16 for a ball. + * @brief Radius + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * @note + * Cast a ball-beamed spell\n + * Stop if we hit a monster, act as a "ball"\n + * Allow "target" mode to pass over monsters\n + * Affect grids, objects, and monsters\n\n + * If direction is 5 and a target has been selected, then the target is used. + * Otherwise, a target is calculated based on a distance of 999 grids away + * from the player in direction "dir".\n\n + * Any radius >16 is treated as 16. + * @note (see file spells2.c) + */ +extern bool fire_ball_beam(int typ, int dir, int dam, int rad); + +/** @fn make_wish(void) + * @brief Allow the player to make a wish. + * @note (see file xtra2.c) + */ +extern void make_wish(void); + +/** @fn fire_wave(int typ, int dir, int dam, int rad, int time, s32b eff) + * @brief Generate a ball spell of type "typ" with radius "rad" and effect + * "eff" lasting "time" turns aimed in direction "dir" for "dam" damage.\n + * @param typ Number \n typ is the type of damage (GF field). + * @brief Type + * @param dir Number \n dir must be a value from 0 to 9. + * @brief Direction + * @param dam Number \n dam is the number of hit points of damage. + * @brief Damage + * @param rad Number \n rad is 0 for a beam/bolt and 1-16 for a ball. + * @brief Radius + * @param time Number \n time is the number of turns the spell lasts. + * @brief Duration + * @param eff Number \n eff is the spell effect (EFF field) + * @brief Effect + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * @note + * Cast a wave spell\n + * Stop if we hit a monster, act as a "ball"\n + * Allow "target" mode to pass over monsters\n + * Affect grids, objects, and monsters\n\n + * If direction is 5 and a target has been selected, then the target is used. + * Otherwise, a target is calculated based on a distance of 999 grids away + * from the player in direction "dir".\n\n + * Any radius >16 is treated as 16. + * @note (see file spells2.c) + */ +extern bool fire_wave(int typ, int dir, int dam, int rad, int time, s32b eff); + +/** @name Spell Effect Flags + * @brief Effect of spell + * @{ */ +/** @def EFF_WAVE + * @note A circle whose radius increase + */ +#define EFF_WAVE 0x00000001 + +/** @def EFF_LAST + * @note The wave lasts + */ +#define EFF_LAST 0x00000002 + +/** @def EFF_STORM + * @note the effect follows the player + */ +#define EFF_STORM 0x00000004 + +/** @name Spell Effect Direction Flags + * @brief Direction of the spell + * @{ */ +#define EFF_DIR1 0x00000008 /* Directed effect */ +#define EFF_DIR2 0x00000010 /* Directed effect */ +#define EFF_DIR3 0x00000020 /* Directed effect */ +#define EFF_DIR4 0x00000040 /* Directed effect */ +#define EFF_DIR6 0x00000080 /* Directed effect */ +#define EFF_DIR7 0x00000100 /* Directed effect */ +#define EFF_DIR8 0x00000200 /* Directed effect */ +#define EFF_DIR9 0x00000400 /* Directed effect */ +/** @} */ +/** @} */ + +/** @fn fire_cloud(int typ, int dir, int dam, int rad, int time) + * @brief Generate a ball spell of type "typ" with radius "rad" lasting + * "time" turns aimed in direction "dir" for "dam" damage.\n + * @param typ Number \n typ is the type of damage (GF field). + * @brief Type + * @param dir Number \n dir must be a value from 0 to 9. + * @brief Direction + * @param dam Number \n dam is the number of hit points of damage. + * @brief Damage + * @param rad Number \n rad is 0 for a beam/bolt and 1-16 for a ball. + * @brief Radius + * @param time Number \n time is the number of turns the spell lasts. + * @brief Duration + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * @note + * Cast a cloud spell\n + * Stop if we hit a monster, act as a "ball"\n + * Allow "target" mode to pass over monsters\n + * Affect grids, objects, and monsters\n\n + * If direction is 5 and a target has been selected, then the target is used. + * Otherwise, a target is calculated based on a distance of 999 grids away + * from the player in direction "dir".\n\n + * Any radius >16 is treated as 16. + * @note (see file spells2.c) + */ +extern bool fire_cloud(int typ, int dir, int dam, int rad, int time); + +/** @fn fire_wall(int typ, int dir, int dam, int time) + * @brief Generate a beam spell of type "typ" lasting "time" turns aimed in + * direction "dir" for "dam" damage.\n + * @param typ Number \n typ is the type of damage (GF field). + * @brief Type + * @param dir Number \n dir must be a value from 0 to 9. + * @brief Direction + * @param dam Number \n dam is the number of hit points of damage. + * @brief Damage + * @param time Number \n time is the number of turns the spell lasts. + * @brief Duration + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * @note + * Cast a persistant beam spell\n + * Pass through monsters, as a "beam"\n + * Affect monsters (not grids or objects)\n\n + * If direction is 5 and a target has been selected, then the target is used. + * Otherwise, a target is calculated based on a distance of 999 grids away + * from the player in direction "dir". + * @note (see file spells2.c) + */ +extern bool fire_wall(int typ, int dir, int dam, int time); + +/** @fn fire_ball(int typ, int dir, int dam, int rad) + * @brief Generate a ball spell of type "typ" with radius "rad" aimed in + * direction "dir" for "dam" damage.\n + * @param typ Number \n typ is the type of damage (GF field). + * @brief Type + * @param dir Number \n dir must be a value from 0 to 9. + * @brief Direction + * @param dam Number \n dam is the number of hit points of damage. + * @brief Damage + * @param rad Number \n rad is 0 for a beam/bolt and 1-16 for a ball. + * @brief Radius + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * @note + * Cast a ball spell\n + * Stop if we hit a monster, act as a "ball"\n + * Allow "target" mode to pass over monsters\n + * Affect grids, objects, and monsters\n\n + * If direction is 5 and a target has been selected, then the target is used. + * Otherwise, a target is calculated based on a distance of 999 grids away + * from the player in direction "dir". + * @note (see file spells2.c) + */ +extern bool fire_ball(int typ, int dir, int dam, int rad); + +/** @fn fire_bolt(int typ, int dir, int dam) + * @brief Generate a bolt spell of type "typ" aimed in direction "dir" + * for "dam" damage.\n + * @param typ Number \n typ is the type of damage (GF field). + * @brief Type + * @param dir Number \n dir must be a value from 0 to 9. + * @brief Direction + * @param dam Number \n dam is the number of hit points of damage. + * @brief Damage + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * @note + * Cast a bolt spell\n + * Stop if we hit a monster, as a "bolt"\n + * Affect monsters (not grids or objects)\n\n + * If direction is 5 and a target has been selected, then the target is used. + * Otherwise, a target is calculated based on a distance of 999 grids away + * from the player in direction "dir". + * @note (see file spells2.c) + */ +extern bool fire_bolt(int typ, int dir, int dam); + +/** @fn fire_beam(int typ, int dir, int dam) + * @brief Generate a beam spell of type "typ" aimed in direction "dir" + * for "dam" damage.\n + * @param typ Number \n typ is the type of damage (GF field). + * @brief Type + * @param dir Number \n dir must be a value from 0 to 9. + * @brief Direction + * @param dam Number \n dam is the number of hit points of damage. + * @brief Damage + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * @note + * Cast a beam spell\n + * Pass through monsters, as a "beam"\n + * Affect monsters (not grids or objects)\n\n + * If direction is 5 and a target has been selected, then the target is used. + * Otherwise, a target is calculated based on a distance of 999 grids away + * from the player in direction "dir". + * @note (see file spells2.c) + */ +extern bool fire_beam(int typ, int dir, int dam); + +/** @fn fire_druid_ball(int typ, int dir, int dam, int rad) + * @brief Generate a druid ball spell of type "typ" with radius "rad" aimed in + * direction "dir" for "dam" damage.\n + * @param typ Number \n typ is the type of damage (GF field). + * @brief Type + * @param dir Number \n dir must be a value from 0 to 9. + * @brief Direction + * @param dam Number \n dam is the number of hit points of damage. + * @brief Damage + * @param rad Number \n rad is 0 for a beam/bolt and 1-16 for a ball. + * @brief Radius + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * @note + * Cast a druidistic ball spell\n + * Stop if we hit a monster, act as a "ball"\n + * Allow "target" mode to pass over monsters\n + * Affect grids, objects, and monsters\n\n + * If direction is 5 and a target has been selected, then the target is used. + * Otherwise, a target is calculated based on a distance of 999 grids away + * from the player in direction "dir".\n\n + * The spells follows a mana path\n\n + * WARNING: This routine has been deprecated. + * @note (see file spells2.c) + */ +extern bool fire_druid_ball(int typ, int dir, int dam, int rad); + +/** @fn fire_druid_bolt(int typ, int dir, int dam) + * @brief Generate a druid bolt spell of type "typ" aimed in direction "dir" + * for "dam" damage.\n + * @param typ Number \n typ is the type of damage (GF field). + * @brief Type + * @param dir Number \n dir must be a value from 0 to 9. + * @brief Direction + * @param dam Number \n dam is the number of hit points of damage. + * @brief Damage + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * @note + * Cast a druidistic bolt spell\n + * Stop if we hit a monster, as a "bolt"\n + * Affect monsters (not grids or objects)\n\n + * If direction is 5 and a target has been selected, then the target is used. + * Otherwise, a target is calculated based on a distance of 999 grids away + * from the player in direction "dir".\n\n + * The spells follows a mana path\n\n + * WARNING: This routine has been deprecated. + * @note (see file spells2.c) + */ +extern bool fire_druid_bolt(int typ, int dir, int dam); + +/** @fn fire_druid_beam(int typ, int dir, int dam) + * @brief Generate a druid beam spell of type "typ" aimed in direction "dir" + * for "dam" damage.\n + * @param typ Number \n typ is the type of damage (GF field). + * @brief Type + * @param dir Number \n dir must be a value from 0 to 9. + * @brief Direction + * @param dam Number \n dam is the number of hit points of damage. + * @brief Damage + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * @note + * Cast a druidistic beam spell\n + * Pass through monsters, as a "beam"\n + * Affect monsters (not grids or objects)\n\n + * If direction is 5 and a target has been selected, then the target is used. + * Otherwise, a target is calculated based on a distance of 999 grids away + * from the player in direction "dir".\n\n + * The spells follows a mana path\n\n + * WARNING: This routine has been deprecated. + * @note (see file spells2.c) + */ +extern bool fire_druid_beam(int typ, int dir, int dam); + +/** @fn fire_bolt_or_beam(int prob, int typ, int dir, int dam) + * @brief Generate a bolt spell of type "typ" aimed in direction "dir" + * for "dam" damage with "prob" percent chance of a beam.\n + * @param prob Number \n prob is the percentage chance the spell will be a + * beam instead of a bolt. + * @brief Beam probability percentage + * @param typ Number \n typ is the type of damage (GF field). + * @brief Type + * @param dir Number \n dir must be a value from 0 to 9. + * @brief Direction + * @param dam Number \n dam is the number of hit points of damage. + * @brief Damage + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * @note + * Cast a bolt spell, or rarely, a beam spell\n\n + * If direction is 5 and a target has been selected, then the target is used. + * Otherwise, a target is calculated based on a distance of 999 grids away + * from the player in direction "dir".\n\n + * @note (see file spells2.c) + */ +extern bool fire_bolt_or_beam(int prob, int typ, int dir, int dam); + +/** @fn alchemy(void) + * @brief Turns an object into gold, gain some of its value in a shop + * @return Boolean \n TRUE if object turns to gold, otherwise FALSE. + * @note + * The player selects an object (and quantity if it applies) from the + * inventory or the floor and attempts to turn it into gold. If the + * price of the item is < 0 then the player gains nothing (fool's gold), + * otherwise the player gets a third of the price in gold. Artifacts are + * not affected. + * @note (see file spells2.c) + */ +extern bool alchemy(void); + +/** @fn alter_reality(void) + * @brief The player leaves the level immediately. + * @note (see file spells2.c) + */ +extern void alter_reality(void); + +/** @fn swap_position(int lty, int ltx) + * @brief Swap the position of the player with whatever is in grid "lty,ltx".\n + * @param lty Number \n Y-coordinate of target location. + * @brief Y-coordinate + * @param ltx Number \n X-coordinate of target location. + * @brief X-coordinate + * @note + * Player moves to target location. If there is a monster at the target + * location, it is moved to the player location. This is not allowed if + * the space-time continuum can not be disrupted. + * @note (see file spells2.c) + */ +extern void swap_position(int lty, int ltx); + +/** @fn teleport_swap(int dir) + * @brief Player swaps places with target in direction "dir".\n + * @param dir Number \n dir must be a value from 0 to 9. + * @brief Direction + * @note + * If direction is 5 and a target has been selected, then the target is used. + * Otherwise, the target is the grid adjacent to the player in direction + * "dir".\n\n + * The target must be a monster. It will not work if the space-time continuum + * can not be disrupted or if the monster resists teleportation. + * @note (see file spells2.c) + */ +extern void teleport_swap(int dir); + +/** @fn project_meteor(int radius, int typ, int dam, u32b flg) + * @brief Generate from "radius" to ("radius" x2) ball spells with properties + * "flg" of type "typ" for "dam" damage.\n + * @param radius Number \n rad is the minimum number of balls created. + * rad + randint("rad") balls are created. + * @brief Balls + * @param typ Number \n typ is the type of damage (GF field). + * @brief Type + * @param dam Number \n dam is the number of hit points of damage. + * @brief Damage + * @param flg Number \n flg is the projection effect (PROJECT field). + * @brief Properties flag + * @note + * Apply a "project()" a la meteor shower\n\n + * Each ball has a radius of 2 grids. Each target grid is within 5 grids of + * the player. + * @note (see file spells2.c) + */ +extern void project_meteor(int radius, int typ, int dam, u32b flg); + +/** @fn passwall(int dir, bool safe) + * @brief Move the player through walls in direction "dir", to a "safe" + * location.\n + * @param dir Number \n dir must be a value from 0 to 9. It can not be 5. + * @brief Direction + * @param safe Boolean \n TRUE if location must be a safe one, otherwise FALSE. + * @brief Safe location? + * @return Boolean \n TRUE if move was successful, otherwise FALSE. + * @note + * Send the player shooting through walls in the given direction until + * they reach a non-wall space, or a monster, or a permanent wall.\n\n + * If the player ends up in a wall, they take 10d8 damage and the wall is + * replaced by a floor.\n\n + * This does not work in the wilderness, on quest levels, or if teleport is + * not allowed. Stopping on monsters or inside vaults is not allowed. + * @note (see file spells2.c) + */ +extern bool passwall(int dir, bool safe); + +/** @fn project_hook(int typ, int dir, int dam, int flg) + * @brief Generate a bolt/beam with properties "flg" in direction "dir" for + * "dam" points of "typ" damage.\n + * @param typ Number \n typ is the type of damage (GF field). + * @brief Type + * @param dir Number \n dir must be a value from 0 to 9. + * @brief Direction + * @param dam Number \n dam is the number of hit points of damage. + * @brief Damage + * @param flg Number \n flg is the projection effect (PROJECT field). + * @brief Properties flag + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * @note + * Hack -- apply a "projection()" in a direction (or at the target)\n\n + * If direction is 5 and a target has been selected, then the target is used. + * Otherwise, a target is calculated based on a distance of 999 grids away + * from the player in direction "dir". + * @note (see file spells2.c) + */ +extern bool project_hook(int typ, int dir, int dam, int flg); + +/** @fn wizard_lock(int dir) + * @brief Cast a wizard_lock spell in direction "dir".\n + * @param dir Number \n dir must be a value from 0 to 9. + * @brief Direction + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * If direction is 5 and a target has been selected, then the target is used. + * Otherwise, a target is calculated based on a distance of 999 grids away + * from the player in direction "dir". + * @note (see file spells2.c) + */ +extern bool wizard_lock(int dir); + +/** @fn reset_recall(bool no_trepas_max_depth) + * @brief Ask the user to set a recall level in a dungeon, possibly no + * deeper than maximum dungeon depth.\n + * @param no_trepas_max_depth Boolean \n TRUE if user can select maximum + * dungeon depth, FALSE if user can select up to player's maximum depth + * in the dungeon so far. + * @brief Allow maximum dungeon depth? + * @return Boolean \n TRUE of recall level was reset, otherwise FALSE. + * @note + * Ask the user for a dungeon and appropriate level within the dungeon.\n + * The user can not specify a dungeon the player has not gone to yet.\n + * If the depth is <1, reset fails. If depth is 99 or 100, the level is set + * to 98. + * @note (see file spells2.c) + */ +extern bool reset_recall(bool no_trepas_max_depth); + +/** @fn get_aim_dir(int *dp=0) + * @brief Get an aiming direction from the user and store it in "dp".\n + * @param *dp Number + * @brief Direction + * @return *dp Number \n Aiming direction. + * @return Boolean \n TRUE if a valid direction was returned, otherwise FALSE. + * @note + * Get an "aiming direction" from the user.\n\n + * The "dir" is loaded with 1,2,3,4,6,7,8,9 for "actual direction", and + * "0" for "current target", and "-1" for "entry aborted".\n\n + * Note that "Force Target", if set, will pre-empt user interaction, + * if there is a usable target already set.\n\n + * Note that confusion over-rides any (explicit?) user choice. + * @note (see file xtra2.c) + */ +extern bool get_aim_dir(int *dp=0); + +/** @fn get_rep_dir(int *dp=0) + * @brief Get a movement direction from the user and store it in "dp".\n + * @param *dp Number + * @brief Direction + * @return *dp Number \n Movement direction. + * @return Boolean \n TRUE if a valid direction was returned, otherwise FALSE. + * @note + * Request a "movement" direction (1,2,3,4,6,7,8,9) from the user, + * and place it into "command_dir", unless we already have one.\n\n + * This function should be used for all "repeatable" commands, such as + * run, walk, open, close, bash, disarm, spike, tunnel, etc, as well + * as all commands which must reference a grid adjacent to the player, + * and which may not reference the grid under the player. Note that, + * for example, it is no longer possible to "disarm" or "open" chests + * in the same grid as the player.\n\n + * Direction "5" is illegal and will (cleanly) abort the command.\n\n + * This function tracks and uses the "global direction", and uses + * that as the "desired direction", to which "confusion" is applied. + * @note (see file xtra2.c) + */ +extern bool get_rep_dir(int *dp=0); + +/** @fn project_los(int typ, int dam); + * @brief Generate a bolt/beam for "dam" points of "typ" damage to all + * viewable monsters in line of sight.\n + * @param typ Number \n typ is the type of damage (GF field). + * @brief Type + * @param dam Number \n dam is the number of hit points of damage. + * @brief Damage + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * @note + * Apply a "project()" directly to all viewable monsters\n\n + * Note that affected monsters are NOT auto-tracked by this usage. + * @note (see file spells2.c) + */ +extern bool project_hack @ project_los(int typ, int dam); + +/** @fn map_area(void) + * @brief Map current area. + * @note + * Hack -- map the current panel (plus some) ala "magic mapping"\n\n + * Up to 10 grids above and below, and up to 20 grids either side of the + * panel are mapped. + * @note (see file cave.c) + */ +extern void map_area(void); + +/** @fn wiz_lite(void) + * @brief Lite level using "clairvoyance". + * @note + * This function "illuminates" every grid in the dungeon, memorizes all + * "objects", memorizes all grids as with magic mapping, and, under the + * standard option settings (view_perma_grids but not view_torch_grids) + * memorizes all floor grids too.\n\n + * Note that if "view_perma_grids" is not set, we do not memorize floor + * grids, since this would defeat the purpose of "view_perma_grids", not + * that anyone seems to play without this option.\n\n + * Note that if "view_torch_grids" is set, we do not memorize floor grids, + * since this would prevent the use of "view_torch_grids" as a method to + * keep track of what grids have been observed directly. + * @note (see file cave.c) + */ +extern void wiz_lite(void); + +/** @fn wiz_lite_extra(void) + * @brief Lite and memorize level. + * @note (see file cave.c) + */ +extern void wiz_lite_extra(void); + +/** @fn wiz_dark(void) + * @brief Forget all grids and objects. + * @note + * Forget the dungeon map (ala "Thinking of Maud..."). + * @note (see file cave.c) + */ +extern void wiz_dark(void); + +/** @fn create_between_gate(int dist, int y, int x) + * @brief Create a between gate at grid "y,x" or at a target grid within + * distance "dist" of the player.\n + * @param dist Number \n dist is the maximum distance from the player of the + * between gate. + * @brief Distance + * @param y Number \n Y-coordinate of dungeon grid. + * @brief Y-coordinate + * @param x Number \n X-coordinate of dungeon grid. + * @brief X-coordinate + * @note + * Creates a between gate\n\n + * This will fail if teleporting is not allowed on the level.\n\n + * If the coordinates are given, a between gate is created under the player + * and at the given coordinate.\n\n + * If there are no coordinates, a target is selected. The gate will not be + * created if the grid is not empty, or the grid is in a vault, or the grid + * is too far away. There is always a chance (1 in (Conveyance Skill * + * Conveyance Skill / 2)) the gate will not be created. + * @note (see file spells2.c) + */ +extern void create_between_gate(int dist, int y, int x); + +/** @fn destroy_doors_touch(void) + * @brief Destroy all doors adjacent to the player. + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * @note (see file spells2.c) + */ +extern bool destroy_doors_touch(void); + +/** @fn destroy_traps_touch(void) + * @brief Destroy all traps adjacent to the player. + * @return Boolean \n TRUE if player notices, otherwise FALSE. + * @note (see file spells2.c) + */ +extern bool destroy_traps_touch(void); + +/** @struct magic_power + * @brief Innate powers + */ +struct magic_power +{ + /** @structvar min_lev + * @brief Number + */ + int min_lev; + + /** @structvar mana_cost + * @brief Number + */ + int mana_cost; + + /** @structvar fail + * @brief Number + */ + int fail; + + /** @structvar name + * @brief String + */ + cptr name; + + /** @structvar desc + * @brief String + */ + cptr desc; +}; + +/** @fn *new_magic_power(int num) + * @dgonly + * @brief Create a wiped array of "num" magic powers.\n + * @param num Number \n num is the number of magic powers. + * @brief Number + * @return magic_power \n Array of magic powers. + * @note + * Get a new magic type\n\n + * Note: do not call this function directly.\n + * Please use add_magic() in powers.lua instead.\n + * By order of DG. + * @note (see file lua_bind.c) + */ +extern magic_power *new_magic_power(int num); + +/** @fn get_magic_power(magic_power *m_ptr, int num); + * @dgonly + * @brief Get magic power number "num" from array "m_ptr" of magic powers.\n + * @param *m_ptr magic_power \n m_ptr is the array of magic powers. + * @brief Powers + * @param num Number \n num is the index to the array. + * @brief Index + * @return magic_power \n A magic power. + * @note + * Note: do not call this function.\n + * By order of DG. + * @note (see file lua_bind.c) + */ +extern magic_power *grab_magic_power @ get_magic_power(magic_power *m_ptr, int num); + +/** @fn select_magic_power(int *sn, magic_power *powers, int max_powers, char *info_fct, int plev, int cast_stat); + * @dgonly + * @brief Select a magic power from array of powers.\n + * @param *sn Number + * @brief Power (spell) number + * @param *powers magic_power \n powers is the array of magic powers. + * @brief Powers + * @param max_powers Number \n max_powers is the maximum number of magic + * powers. + * @brief Maximum powers + * @param *info_fct String \n info_fct is the name of a function which will + * return power info. + * @brief Name of power info function + * @param plev Number \n plev is the player's level of magic skill. + * @brief Player magic level + * @param cast_stat Number \n cast_stat is the required casting statistic + * (INT or WIS). + * @brief Casting statistic + * @return *sn Number \n sn is the index of the power in the array of magic + * powers. + * @return Boolean \n TRUE if power was selected, otherwise FALSE. + * @note + * Allow user to choose a magic power.\n\n + * If a valid spell is chosen, saves it in '*sn' and returns TRUE\n + * If the user hits escape, returns FALSE, and set '*sn' to -1\n + * If there are no legal choices, returns FALSE, and sets '*sn' to -2\n\n + * The "prompt" should be "cast", "recite", or "study". + * The "known" should be TRUE for cast/pray, FALSE for study\n\n + * Note: do not call this function directly.\n + * Please use execute_magic() in powers.lua instead.\n + * By order of DG. + * @note (see files lua_bind.c, cmd7.c) + */ +extern bool get_magic_power_lua @ select_magic_power(int *sn, magic_power *powers, int max_powers, char *info_fct, int plev, int cast_stat); + +/** @fn magic_power_sucess(magic_power *spell, int stat, char *oups_fct=NULL); + * @dgonly + * @brief Determine if using a magic power succeeds.\n + * @param *spell magic_power \n Spell is the magic power the player is using. + * @brief Power (spell) + * @param stat Number \n stat is the required casting statistic (INT or WIS). + * @brief Casting statistic + * @param *oups_fct String \n oups_fct is the message displayed when the power + * fails. + * @brief Fail message + * @return Boolean \n TRUE if spell succeeds, otherwise FALSE. + * @note + * The chance of using a power is adjusted for player magic skill, casting + * statistic, player mana points, and stunning. There is always at least a + * 5% chance the power works.\n\n + * Note: do not call this function.\n + * By order of DG. + * @note (see file lua_bind.c) + */ +extern bool lua_spell_success @ magic_power_sucess(magic_power *spell, int stat, char *oups_fct=NULL); + +/** @fn add_new_power(cptr name, cptr desc, cptr gain, cptr lose, byte level, byte cost, byte stat, byte diff) + * @dgonly + * @brief Add a new power to the array of magic powers.\n + * @param name String \n name is the name of the power. + * @brief Name + * @param desc String \n desc is the description of the power. + * @brief Description + * @param gain String \n gain describes the effect when the power starts + * working. + * @brief Gain message + * @param lose String \n loss describes the effect when the power stops + * working. + * @brief Lose message + * @param level Number \n level is the magic skill level a player needs to + * use the power. + * @brief Level + * @param cost Number \n cost is the number of mana points required to use the + * power. + * @brief Mana cost + * @param stat Number \n stat is the required casting statistic (INT or WIS). + * @brief Casting statistic + * @param diff Number \n diff is the difficulty. + * @brief Difficulty + * @return Number \n The index of the new power in the magic power array. + * @note + * Note: do not call this function.\n + * By order of DG. + * @note (see file lua_bind.c) + */ +s16b add_new_power(cptr name, cptr desc, cptr gain, cptr lose, byte level, byte cost, byte stat, byte diff); + +/** @var power_max + * @brief Number + * @note Maximum number of innate powers. + */ +extern s16b power_max; + +/* Schools */ + +/** @struct school_spell_type + * @brief Spell + * @note The spell function must provide the desc + */ +struct spell_type@school_spell_type +{ + /** @structvar name + * @brief String + */ + cptr name; + + /** @structvar skill_level + * @brief Number + * @note Required level (to learn) + */ + byte skill_level; + + /** @structvar mana + * @brief Number + * @note Required mana at lvl 1 + */ + byte mana; + + /** @structvar mana_max + * @brief Number + * @note Required mana at max lvl + */ + byte mana_max; + + /** @structvar fail + * @brief Number + * @note Minimum chance of failure + */ + s16b fail; + + /** @structvar level + * @brief Number + * @note Spell level(0 = not learnt) + */ + s16b level; +}; + +/** @struct school_type + * @brief Spell school + */ +struct school_type +{ + /** @structvar name + * @brief String + * @note Name + */ + cptr name; + /** @structvar skill + * @brief Number + * @note Skil used for that school + */ + s16b skill; +}; + +/** @fn new_school(int i, cptr name, s16b skill) + * @dgonly + * @brief Add school to array of schools.\n + * @param i Number \n i is index of school array where school is added. + * There is no range checking. + * @brief Index + * @param name String \n name is the name of the school. + * @brief Name + * @param skill Number \n skill is the skill of the school. + * @brief Skill + * @return Number \ The index parameter. + * @note + * Note: do not call this function directly.\n + * Please use add_school() in s_aux.lua instead.\n + * By order of DG. + * @note (see file lua_bind.c) + */ +extern s16b new_school(int i, cptr name, s16b skill); + +/** @fn new_spell(int i, cptr name) + * @dgonly + * @brief Add spell to array of spells for a school.\n + * @param i Number \n i is index of school spell array where spell is added. + * There is no range checking. + * @brief Index + * @param name String \n name is the name of the spell. + * @brief Name + * @return Number \ The index parameter. + * @note + * Spell level is set to zero.\n\n + * Note: do not call this function directly.\n + * By order of DG. + * @note (see file lua_bind.c) + */ +extern s16b new_spell(int i, cptr name); + +/** @fn spell(s16b num); + * @dgonly + * @brief Get spell "num" from array of spells for a school.\n + * @param num Number \n num is the index of the spell. + * There is no range checking. + * @brief Index + * @return spell_type \n The spell. + * @note + * Note: do not call this function directly.\n + * By order of DG. + * @note (see file lua_bind.c) + */ +extern spell_type *grab_spell_type @ spell(s16b num); + +/** @fn school(s16b num); + * @dgonly + * @brief Get school "num" from array of schools.\n + * @param num Number \n num is the index of the school. + * There is no range checking. + * @brief Index + * @return school_type \n The school. + * @note + * Note: do not call this function directly.\n + * By order of DG. + * @note (see file lua_bind.c) + */ +extern school_type *grab_school_type @ school(s16b num); + +/** @fn lua_get_level(s32b s, s32b lvl, s32b max, s32b min, s32b bonus) + * @dgonly + * @brief Get the casting level of school spell "s".\n + * @param s Number \n s is the index of the spell in array of school spells. + * There is no range checking. + * @brief Spell index + * @param lvl Number \n lvl represents the level of player skill. + * @brief Player skill level + * @param max Number \n max is the maximum level for the spell. + * @brief Maximum spell level + * @param min Number \n min is the minimum level for the spell. + * @brief Minimum spell level + * @param bonus Number \n bonus is any bonus to final level. + * @brief Bonus + * @return Number \n Casting level. + * @note + * Note: do not call this function directly.\n + * By order of DG. + * @note (see file lua_bind.c) + */ +extern s32b lua_get_level(s32b s, s32b lvl, s32b max, s32b min, s32b bonus); + +/** @fn lua_spell_chance(s32b chance, int level, int skill_level, int mana, int cur_mana, int stat) + * @dgonly + * @brief Get the chance a spell will fail.\n + * @param chance Number \n chance is the inital chance a spell will work. + * @brief Initial chance + * @param level Number \n level represents the level of player skill. + * @brief Player skill level + * @param skill_level Number \n *unused*. + * @brief *Unused* + * @param mana Number \n mana is the mana required by the spell. + * @brief Spell mana + * @param cur_mana Number \n cur_mana is the player's current mana. + * @brief Player mana + * @param stat Number \n stat is the required casting statistic (INT or WIS). + * @brief Casting statistic + * @return Number \n Chance of failure. + * @note + * Note: do not call this function directly.\n + * By order of DG. + * @note (see file lua_bind.c) + */ +extern s32b lua_spell_chance(s32b chance, int level, int skill_level, int mana, int cur_mana, int stat); + +/** @fn lua_spell_device_chance(s32b chance, int level, int base_level) + * @dgonly + * @brief Get the chance a device will fail.\n + * @param chance Number \n chance is the inital chance a spell will work. + * @brief Initial chance + * @param level Number \n level represents the level of player skill. + * @brief Player skill level + * @param base_level Number \n *unused* + * @brief *Unused* + * @return Number \n Chance of failure. + * @note + * Note: do not call this function directly.\n + * By order of DG. + * @note (see file lua_bind.c) + */ +extern s32b lua_spell_device_chance(s32b chance, int level, int base_level); + +/** @fn get_school_spell(cptr do_what, cptr check_fct, s16b force_book) + * @brief Get a spell from a book.\n + * @param do_what String \n what the player wants to do with the spell, + * for example "cast" or "copy". + * @brief Action + * @param check_fct String \n check_fct is the name of a function which checks + * if the player has access to the spell. + * @brief Check function + * @param force_book Number \n If it is different from 0 it for'ces the use of + * a spellbook, bypassing spellbook selection + * @brief Bypass book selection + * @return Number \n Spell number. + * @note + * Get a spell from a book\n\n + * The player must have a book to select a spell. When a book is chosen, the + * player is given a choice of spells to select. The player must be able to + * access the spell.\n\n + * If no spell is chosen, -1 is returned. + * @note (see file cmd5.c) + */ +extern u32b get_school_spell(cptr do_what, cptr check_fct, s16b force_book); + +/** @name Last Teleportation + * @brief Coordinates of last successful teleportation + * @{ */ +/** @var last_teleportation_y + * @brief Number + * @note y-coordinate of last successful teleportation + */ +extern s16b last_teleportation_y; + +/** @var last_teleportation_x + * @brief Number + * @note x-coordinate of last successful teleportation + */ +extern s16b last_teleportation_x; +/** @} */ + +/** @fn get_pos_player(int dis, int *ny=0, int *nx=0) + * @brief Get a grid near the player.\n + * @param dis Number \n is the maximum distance away from the player. + * This is limited to 200. + * @brief Distance from player + * @return y Number \n Y-coordinate of grid. + * @return x Number \n X-coordinate of grid. + * @note + * This function is slightly obsessive about correctness.\n\n + * Minimum distance is half the maximum distance. The function attempts to + * find a valid grid up to 500 times. If no valid grid is found, the maximum + * distance is doubled (though no more than 200) and the minimum distance is + * halved. The function does this 100 times. + * @note (see file spells1.c) + */ +extern void get_pos_player(int dis, int *ny=0, int *nx=0); diff --git a/PKGS/util.pkg b/PKGS/util.pkg new file mode 100644 index 0000000..bb1de5b --- /dev/null +++ b/PKGS/util.pkg @@ -0,0 +1,2735 @@ +/* File: util.pkg */ + +/* + * Purpose: Lua interface defitions for miscellaneous routines. + * To be processed by tolua to generate C source code. + */ + +$#include "angband.h" +$#include "plots.h" + +/** @typedef cptr + * @note String + */ +typedef char* cptr; +/** @typedef errr + * @note Number + */ +typedef int errr; +/** @typedef bool + * @note Boolean + */ +typedef unsigned char bool; +/** @typedef byte + * @note Number + */ +typedef unsigned char byte; +/** @typedef s16b + * @note Number + */ +typedef signed short s16b; +/** @typedef u16b + * @note Number + */ +typedef unsigned short u16b; +/** @typedef s32b + * @note Number + */ +typedef signed int s32b; +/** @typedef u32b + * @note Number + */ +typedef unsigned int u32b; + +/** @def TRUE */ +#define TRUE + +/** @def FALSE */ +#define FALSE + + +/** @def ESCAPE */ +#define ESCAPE '\033' + +/** @name Terminal Colours + * @{ + */ +/** @def TERM_DARK + * @note 'd' (0,0,0) + */ +#define TERM_DARK 0 /* 'd' */ +/** @def TERM_WHITE + * @note 'w' (4,4,4) + */ +#define TERM_WHITE 1 /* 'w' */ +/** @def TERM_SLATE + * @note 's' (2,2,2) + */ +#define TERM_SLATE 2 /* 's' */ +/** @def TERM_ORANGE + * @note 'o' (4,2,0) + */ +#define TERM_ORANGE 3 /* 'o' */ +/** @def TERM_RED + * @note 'r' (3,0,0) + */ +#define TERM_RED 4 /* 'r' */ +/** @def TERM_GREEN + * @note 'g' (0,2,1) + */ +#define TERM_GREEN 5 /* 'g' */ +/** @def TERM_BLUE + * @note 'b' (0,0,4) + */ +#define TERM_BLUE 6 /* 'b' */ +/** @def TERM_UMBER + * @note 'u' (2,1,0) + */ +#define TERM_UMBER 7 /* 'u' */ +/** @def TERM_L_DARK + * @note 'D' (1,1,1) + */ +#define TERM_L_DARK 8 /* 'D' */ +/** @def TERM_L_WHITE + * @note 'W' (3,3,3) + */ +#define TERM_L_WHITE 9 /* 'W' */ +/** @def TERM_VIOLET + * @note 'v' (4,0,4) + */ +#define TERM_VIOLET 10 /* 'v' */ +/** @def TERM_YELLOW + * @note 'y' (4,4,0) + */ +#define TERM_YELLOW 11 /* 'y' */ +/** @def TERM_L_RED + * @note 'R' (4,0,0) + */ +#define TERM_L_RED 12 /* 'R' */ +/** @def TERM_L_GREEN + * @note 'G' (0,4,0) + */ +#define TERM_L_GREEN 13 /* 'G' */ +/** @def TERM_L_BLUE + * @note 'B' (0,4,4) + */ +#define TERM_L_BLUE 14 /* 'B' */ +/** @def TERM_L_UMBER + * @note 'U' (3,2,1) + */ +#define TERM_L_UMBER 15 /* 'U' */ +/** @} */ + +/** @name Event Hooks + * @{ + */ +/** @def HOOK_MONSTER_DEATH + * @brief Monster dies.\n + * @param Number m_idx \n index of monster in monster (m_list) array. + * @brief Monster index + * @note (see file xtra2.c) + */ +#define HOOK_MONSTER_DEATH 0 + +/** @def HOOK_OPEN + * @brief Open door or chest.\n + * @param Number quest \n if 0, then player is not on a quest level, + * otherwise the player is on a quest. + * @brief On quest? + * @note (see file cmd2.c) + */ +#define HOOK_OPEN 1 + +/** @def HOOK_GEN_QUEST + * @brief Generate quest level.\n + * @param Number quest \n if 0, then player is not on a quest level, + * otherwise the player is on a quest. + * @brief On quest? + * @note (see file generate.c) + */ +#define HOOK_GEN_QUEST 2 + +/** @def HOOK_END_TURN + * @brief Turn ends.\n + * @param Number quest \n if 0, then player is not on a quest level, + * otherwise the player is on a quest. + * @brief On quest? + * @note (see file dungeon.c) + */ +#define HOOK_END_TURN 3 + +/** @def HOOK_FEELING + * @brief Display level feeling.\n + * @param Number quest \n if 0, then player is not on a quest level, + * otherwise the player is on a quest. + * @brief On quest? + * @return Boolean \n TRUE if a level feeling was displayed, otherwise FALSE. + * @note + * If the hook returns TRUE, then no other feelings are displayed and + * do_cmd_feeling() returns. + * @note (see file cmd4.c) + */ +#define HOOK_FEELING 4 + +/** @def HOOK_NEW_MONSTER + * @brief Generate monster.\n + * @param Number r_idx \n index of monster in monster race (r_info) array. + * @brief Monster index + * @return Boolean \n TRUE if monster is not allowed to be created, + * otherwise FALSE. + * @note + * If the hook returns TRUE, then the monster is "killed". + * @note (see file monster2.c) + */ +#define HOOK_NEW_MONSTER 5 + +/** @def HOOK_GEN_LEVEL + * @brief Generate dungeon level.\n + * @param Number quest \n if 0, then player is not on a quest level, + * otherwise the player is on a quest. + * @brief On quest? + * @note (see file generate.c) + */ +#define HOOK_GEN_LEVEL 6 + +/** @def HOOK_BUILD_ROOM1 + * @brief Generate room (type 1 - normal rectangular room).\n + * @param Number by0 \n y-coordinate of dungeon block where room is built. + * @brief Block y-coordinate + * @param Number bx0 \n x-coordinate of dungeon block where room is built. + * @brief Block x-coordinate + * @return Boolean \n TRUE if room was created, otherwise FALSE. + * @note + * If the hook returns TRUE, then the room has been built and build_type1() + * returns. + * @note (see file generate.c) + */ +#define HOOK_BUILD_ROOM1 7 + +/** @def HOOK_NEW_LEVEL + * @brief Start dungeon level.\n + * @param Number quest \n if 0, then player is not on a quest level, + * otherwise the player is on a quest. + * @brief On quest? + * @note (see file dungeon.c) + */ +#define HOOK_NEW_LEVEL 8 + +/** @def HOOK_QUEST_FINISH + * @brief Quest finished.\n + * @param Number plot \n a plot from the plots array. + * @brief Plot + * @note (see file bldg.c) + */ +#define HOOK_QUEST_FINISH 9 + +/** @def HOOK_QUEST_FAIL + * @brief Quest failed.\n + * @param Number plot \n a plot from the plots array. + * @brief Plot + * @note (see file bldg.c) + */ +#define HOOK_QUEST_FAIL 10 + +/** @def HOOK_GIVE + * @brief Give item to monster.\n + * @param Number m_idx \n index of monster in monster (m_list) array. + * @brief Monster index + * @param Number item \n the item to be given. + * @brief Item number + * @return Boolean \n TRUE if item was given to monster, otherwise FALSE. + * @note + * If the hook returns FALSE, then the message "The monster does not want + * your item." is displayed. + * @note (see file cmd2.c) + */ +#define HOOK_GIVE 11 + +/** @def HOOK_CHAR_DUMP + * @brief Add a line to the character sheet. + * @note (see files.c) + */ +#define HOOK_CHAR_DUMP 12 + +/** @def HOOK_INIT_QUEST + * @brief Quest initialised.\n + * @param Number plot \n a plot from the plots array. + * @brief Plot + * @return Boolean \n TRUE if quest was not initialised, otherwise FALSE. + * @note + * If the hook returns TRUE, castle_quest() returns FALSE. + * @note (see file bldg.c) + */ +#define HOOK_INIT_QUEST 13 + +/** @def HOOK_WILD_GEN + * @brief Generate wilderness.\n + * @param Number wilderness \n if TRUE, then this is overhead wilderness + * processing, otherwise it is regular wilderness processing. + * @brief Overhead? + * @note (see file wild.c) + */ +#define HOOK_WILD_GEN 14 + +/** @def HOOK_DROP + * @brief Drop an item.\n + * @param Number item \n the item to drop. + * @brief Item number + * @return Boolean \n TRUE if item was dropped, otherwise FALSE. + * @note + * If the hook returns TRUE, do_cmd_drop() returns, otherwise the function + * continues. + * @note (see file cmd3.c) + */ +#define HOOK_DROP 15 + +/** @def HOOK_IDENTIFY + * @brief Identfy an item.\n + * @param Number item \n the item to identify. + * @brief Item number + * @param String type \n "normal" to identify the item, or "full" to fully + * identify an item. + * @brief Type + * @note (see files spells1.c, spells2.c) + */ +#define HOOK_IDENTIFY 16 + +/** @def HOOK_MOVE + * @brief Player moves.\n + * @param Number y \n the y-coordinate of the new location. + * @brief Y-coordinate + * @param Number x \n the x-coordinate of the new location. + * @brief X-coordinate + * @return Boolean \n TRUE if player is not allowed to move, otherwise FALSE. + * @note + * If the hook returns TRUE, move_player_aux() returns, otherwise the function + * continues. + * @note (see file cmd1.c) + */ +#define HOOK_MOVE 17 + +/** @def HOOK_STAIR + * @brief Player uses stairs.\n + * @param String direction \n "up" if the player is going up stairs, or + * "down" if the player is going down stairs. + * @brief Direction + * @return Boolean \n TRUE if player is not allowed to use stairs, otherwise + * FALSE. + * @note + * If the hook returns TRUE, do_cmd_go_up() or do_cmd_go_down() returns, + * otherwise the function continues. + * @note (see file cmd2.c) + */ +#define HOOK_STAIR 18 + +/** @def HOOK_MONSTER_AI + * @brief Monster moves.\n + * @param Number m_idx \n index of monster in monster (m_list) array. + * @brief Monster index + * @return Boolean \n TRUE if monster AI was applied, otherwise FALSE. + * @return Number y2 \n New y-coordinate of monster target. + * @return Number x2 \n New x-coordinate of monster target. + * @note + * If the hook returns TRUE, the monster moves toward the hook position. + * @note (see file melee2.c) + */ +#define HOOK_MONSTER_AI 19 + +/** @def HOOK_PLAYER_LEVEL + * @brief Player gains (or loses) a level.\n + * @param Number gained \n the number of levels gained (or lost). + * @brief Levels gained + * @note (see file xtra2.c) + */ +#define HOOK_PLAYER_LEVEL 20 + +/** @def HOOK_WIELD + * @brief Player wields an item.\n + * @param Number item \n the item to wield. + * @brief Item number + * @return Boolean \n TRUE if item was not wielded, otherwise FALSE. + * @note + * If the hook returns TRUE, do_cmd_wield() returns, otherwise the function + * continues. + * @note (see file cmd3.c) + */ +#define HOOK_WIELD 21 + +/** @def HOOK_INIT + * @brief Game initialised. + * @note (see file dungeon.c) + */ +#define HOOK_INIT 22 + +/** @def HOOK_QUAFF + * @brief Player quaffs a potion.\n + * @param Object o_ptr \n the potion to quaff. + * @brief Potion + * @return Boolean \n TRUE if potion was quaffed, otherwise FALSE. + * @return Number ident \n TRUE if the potion was identifed, otherwise FALSE. + * @note + * If the hook returns TRUE, the hook sets the "potion identified" flag. + * @note (see file cmd6.c) + */ +#define HOOK_QUAFF 23 + +/** @def HOOK_AIM */ +#define HOOK_AIM 24 + +/** @def HOOK_USE */ +#define HOOK_USE 25 + +/** @def HOOK_ACTIVATE + * @brief Player activates an item.\n + * @param Number item \n the item to activate. + * @brief Item number + * @return Boolean \n TRUE if item was activated, otherwise FALSE. + * @note + * If the hook returns TRUE, do_cmd_activate() returns, otherwise the function + * continues. + * @note (see file cmd6.c) + */ +#define HOOK_ACTIVATE 26 + +/** @def HOOK_ZAP + * @brief Player zaps a rod.\n + * @param Number tval \n type of rod to zap. + * @brief Type + * @param Number sval \n sub-type of rod to zap. + * @brief Sub-type + * @note (see file cmd6.c) + */ +#define HOOK_ZAP 27 + +/** @def HOOK_READ + * @brief Player reads a scroll.\n + * @param Object o_ptr \n the scroll to read. + * @brief Scroll + * @return Boolean \n TRUE if scroll was read, otherwise FALSE. + * @return Number used_up \n TRUE if the scroll was used up, otherwise FALSE. + * @return Number ident \n TRUE if the scroll was identifed, otherwise FALSE. + * @note + * If the hook returns TRUE, the hook sets the "scroll used up" and + * "scroll identified" flags. + * @note (see file cmd6.c) + */ +#define HOOK_READ 28 + +/** @def HOOK_CALC_BONUS + * @brief Calculate player "state" bonuses. + * @note (see xtra1.c) + */ +#define HOOK_CALC_BONUS 29 + +/** @def HOOK_CALC_BONUS + * @brief Calculate player "state" bonuses, after all calcs are done. + * @note (see xtra1.c) + */ +#define HOOK_CALC_BONUS_END 77 + +/** @def HOOK_CALC_POWERS + * @brief Calculate player powers. + * @note (see xtra1.c) + */ +#define HOOK_CALC_POWERS 30 + +/** @def HOOK_KEYPRESS + * @brief User enters a command.\n + * @param Number command \n the pressed key (command_cmd). + * @brief Command + * @return Boolean \n TRUE if special processing was done, otherwise FALSE. + * @note + * If the hook returns TRUE, process_command() returns, otherwise the function + * continues. + * @note (see file dungeon.c) + */ +#define HOOK_KEYPRESS 31 + +/** @def HOOK_CHAT + * @brief Player chats to monster.\n + * @param Number m_idx \n index of monster in monster (m_list) array. + * @brief Monster index + * @return Boolean \n TRUE if monster chats, otherwise FALSE. + * @note + * If the hook returns FALSE, the message "There is no monster there." is + * printed. + * @note (see file cmd2.c) + */ +#define HOOK_CHAT 32 + +/** @def HOOK_MON_SPEAK + * @brief Monster speaks.\n + * @param Number m_idx \n index of monster in monster (m_list) array. + * @brief Monster index + * @param String m_name \n name of the monster. + * @brief Monster name + * @return Boolean \n TRUE if monster speaks, otherwise FALSE. + * @note + * If the hook returns FALSE, the monster may say something else. + * @note (see file melee2.c) + */ +#define HOOK_MON_SPEAK 33 + +/** @def HOOK_MKEY + * @brief Player uses skill.\n + * @param Number x_idx \n the skill to execute. + * @brief Skill index + * @note (see file skills.c) + */ +#define HOOK_MKEY 34 + +/** @def HOOK_BIRTH_OBJECTS + * @brief Player receives objects at birth. + * @note (see file birth.c) + */ +#define HOOK_BIRTH_OBJECTS 35 + +/** @def HOOK_ACTIVATE_DESC + * @brief Display activation description.\n + * @param Object o_ptr \n the item to activate. + * @brief Object + * @return Boolean \n TRUE if item has an activation, otherwise FALSE. + * @return String desc \n the activation description. + * @note + * If the hook returns TRUE, item_activation() returns the hook's activation + * description. + * @note (see file object1.c) + */ +#define HOOK_ACTIVATE_DESC 36 + +/** @def HOOK_INIT_GAME + * @brief Game initialised.\n + * @param String when \n "begin" if done at the start of game initialisation, + * or "end" if done at end of game initialisation. + * @brief When? + * @note (see file init2.c) + */ +#define HOOK_INIT_GAME 37 + +/** @def HOOK_ACTIVATE_POWER + * @brief Player activates a power.\n + * @param Number power \n the power to activate. + * @brief Power + * @return Boolean \n TRUE if power was activated, otherwise FALSE. + * @note + * If the hook returns FALSE, power_activate() displays the message + * "Warning power_activate() called with invalid power(xx)." where + * xx = power. + * @note (see file powers.c) + */ +#define HOOK_ACTIVATE_POWER 38 + +/** @def HOOK_ITEM_NAME + * @brief Get an item name.\n + * @param Object o_ptr \n the item whose name is required. + * @brief Object + * @return Boolean \n TRUE if name was found, otherwise FALSE. + * @return String basenm \n The item name. + * @return String modstr \n The item modifier string. + * @note (see file object1.c) + */ +#define HOOK_ITEM_NAME 39 + +/** @def HOOK_SAVE_GAME + * @brief Save the game. + * @note (see file loadsave.c) + */ +#define HOOK_SAVE_GAME 40 + +/** @def HOOK_LOAD_GAME + * @brief Load the game. + * @note (see file loadsave.c) + */ +#define HOOK_LOAD_GAME 41 + +/** @def HOOK_LEVEL_REGEN + * @brief Start generation of a special level. + * @note (see file generate.c) + */ +#define HOOK_LEVEL_REGEN 42 + +/** @def HOOK_LEVEL_END_GEN + * @brief End generation of a special level. + * @note (see file generate.c) + */ +#define HOOK_LEVEL_END_GEN 43 + +/** @def HOOK_BUILDING_ACTION + * @brief Player performs an action in a building.\n + * @param Number action \n the action performed in the building + * @brief Action flag + * @return Boolean \n TRUE if player performed the action, otherwise FALSE. + * @return Number paid \n TRUE if player paid to perform the action, otherwise + * FALSE. + * @return Number recreate \n TRUE if something is recreated, otherwise FALSE. + * @note + * If the hook returns TRUE, the hook sets the "paid" and "recreate" flags. + * @note (see file bldg.c) + */ +#define HOOK_BUILDING_ACTION 44 + +/** @def HOOK_PROCESS_WORLD + * @brief Update world every ten turns. + * @note (see file dungeon.c) + */ +#define HOOK_PROCESS_WORLD 45 + +/** @def HOOK_WIELD_SLOT + * @brief Find equipment slot for object.\n + * @param Object o_ptr \n the object to wield. + * @brief Object + * @param Number ideal \n TRUE if current body and stuff is ignore, otherwise + * FALSE. + * @return Boolean \n TRUE if hook processed the object, otherwise FALSE. + * @return Number slot \n The equipent slot where the object will go (-1 if + * there are no available slots). + * @note + * If the hook returns TRUE, wield_slot_ideal() returns the slot from the hook. + * @note (see file objects1.c) + */ +#define HOOK_WIELD_SLOT 46 + +/** @def HOOK_STORE_STOCK + * @brief Stock a store.\n + * @param Number st_idx \n the index of the store in st_info array. + * @brief Store index + * @param String name \n the name of the store. + * @brief Store name + * @param Number level \n the "dungeon level" of the store. + * @brief Store level + * @return Boolean \n TRUE if hook has selected an object, otherwise FALSE. + * @return Object q_ptr \n The item to be stocked in the store. + * @note + * If the hook returns TRUE, store_create() will create the hook's object and + * put it in the store. + * @note (see file store.c) + */ +#define HOOK_STORE_STOCK 47 + +/** @def HOOK_STORE_BUY + * @brief Store buys an item.\n + * @param Number st_idx \n the index of the store in st_info array. + * @brief Store index + * @param String name \n the name of the store. + * @brief Store name + * @param Object o_ptr \n the object to buy. + * @brief Object + * @return Boolean \n TRUE if the hook has processed the object, otherwise + * FALSE. + * @return Number buy \n TRUE if the store will buy the object, otherwise + * FALSE. + * @note + * If the hook returns TRUE, store_will_buy() will return "buy". + * @note (see file store.c) + */ +#define HOOK_STORE_BUY 48 + +/** @def HOOK_GEN_LEVEL_BEGIN + * @brief Generate a random dungeon level. + * @note (see file generate.c) + */ +#define HOOK_GEN_LEVEL_BEGIN 49 + +/** @def HOOK_GET + * @brief Player gets an object.\n + * @param Object o_ptr \n the object to get. + * @brief Object + * @param Number o_idx \n the index of the object in o_list array. + * @brief Object index + * @return Boolean \n TRUE if hooks processes the object, otherwise FALSE. + * @note + * If the hook returns TRUE, object_pickup() returns, otherwise the function + * continues. + * @note (see object1.c) + */ +#define HOOK_GET 50 + +/** @def HOOK_REDRAW + * @brief Redraw the screen. + * @note (see file xtra1.c) + */ +#define HOOK_REDRAW 51 + +/** @def HOOK_RECALC_SKILLS + * @brief Recalculate player skills. + * @note (see skills.c) + */ +#define HOOK_RECALC_SKILLS 52 + +/** @def HOOK_ENTER_DUNGEON + * @brief Player goes down one dungeon level.\n + * @param Number special \n special information for player's dungeon grid. + * @brief Special info + * @return Boolean \n TRUE if the hook prevents the player going down, + * otherwise FALSE. + * @note + * If the hook returns TRUE, the player remains on the current dungeon level + * and do_cmd_go_down() returns. + * @note (see file cmd2.c) + */ +#define HOOK_ENTER_DUNGEON 53 + +/** @def HOOK_FIRE + * @brief Player fires an object (bow slot of inventory).\n + * @param Object \n the object to fire. + * @brief Object + * @return Boolean \n TRUE if the hook has fired the object, otherwise FALSE. + * @note + * If the hook returns TRUE, process_command() returns. + * @note (see file dungeon.c) + */ +#define HOOK_FIRE 54 + +/** @def HOOK_EAT + * @brief Player eats.\n + * @param Object o_ptr \n the object the player eats. + * @brief Object + * @return Boolean \n TRUE if hook processes the object, otherwise FALSE. + * @return Number ident \n TRUE if the object was identified, otherwise FALSE. + * @note + * If the hook returns TRUE, the hook sets the "food identified" flag. + * @note (see file cmd6.c) + */ +#define HOOK_EAT 55 + +/** @def HOOK_DIE + * @brief Player dies. + * @return Boolean \n TRUE if player does not die, otherwise FALSE. + * @note + * If the hook returns TRUE, the player cheats death. + * @note (see file dungeon.c) + */ +#define HOOK_DIE 56 + +/** @def HOOK_CALC_HP + * @brief Recalculate player HP (hit points).\n + * @param Number mhp \n the player's new maximum hit points. + * @brief Maximum hit points. + * @return Boolean \n TRUE if hook has processed player hit points, otherwise + * FALSE. + * @note + * If the hook returns TRUE, the player's maximum hit points are updated. + * @note (see file xtra1.c) + */ +#define HOOK_CALC_HP 57 + +/** @def HOOK_GF_COLOR + * @brief Set color for spell. + * @param Number type \n type of spell. + * @brief Type + * @param Number file \n if this is 0 use ANGBAND_GRAF, otherwise use "new". + * @brief File + * @return Boolean \n TRUE if hook sets a color, otherwise FALSE. + * @return Number color \n The color for the spell. + * @note + * If the hook returns TRUE, spell_color() returns the hook's color, otherwise + * the function continues. + * @note (see file spells1.c) + */ +#define HOOK_GF_COLOR 58 + +/** @def HOOK_GF_EXEC + * @brief A spell to damage terrain features.\n + * @param String target \n "grid" to indicate spell damages terrain. + * @brief Target + * @param Number who \n the source of the spell. + * @brief Source + * @param Number type \n the type of spell. + * @brief Type + * @param Number dam \n the number of hit points of damage. + * @brief Damage + * @param Number r \n the radius of the spell. + * @brief Radius + * @param Number y \n the y-coordinate of the target. + * @brief Y-coordinate + * @param Number x \n the x-coordinate of the target. + * @brief X-coordinate + * @return Boolean \n TRUE if spell was cast, otherwise FALSE. + * @return Number obvious \n TRUE if the player notices the spell, otherwise + * FALSE. + * @return Number flag \n TRUE if the player is affected, otherwise FALSE. + * @note + * If the hook returns TRUE, the hook sets the "obvious" and "flag" fields. + * @note (see file spells1.c) + */ +/** @def HOOK_GF_EXEC + * @brief A spell to damage objects.\n + * @param String target \n "object" to indicate spell damages objects. + * @brief Target + * @param Number who \n the source of the spell. + * @brief Source + * @param Number type \n the type of spell. + * @brief Type + * @param Number dam \n the number of hit points of damage. + * @brief Damage + * @param Number r \n the radius of the spell. + * @brief Radius + * @param Number y \n the y-coordinate of the target. + * @brief Y-coordinate + * @param Number x \n the x-coordinate of the target. + * @brief X-coordinate + * @param Object o_ptr \n the object which is the target of the spell. + * @brief Object + * @return Boolean \n TRUE if spell was cast, otherwise FALSE. + * @return Number obvious \n TRUE if the player notices the spell, otherwise + * FALSE. + * @return Number flag \n TRUE if the player is affected, otherwise FALSE. + * @note + * If the hook returns TRUE, the hook sets the "obvious" and "do_kill" fields. + * @note (see file spells1.c) + */ +/** @def HOOK_GF_EXEC + * @brief A spell to damage monsters.\n + * @param String target \n "angry" to indicate spell angers a friend. + * @brief Target + * @param Number who \n the source of the spell. + * @brief Source + * @param Number type \n the type of spell. + * @brief Type + * @param Number dam \n the number of hit points of damage. + * @brief Damage + * @param Number r \n the radius of the spell. + * @brief Radius + * @param Number y \n the y-coordinate of the target. + * @brief Y-coordinate + * @param Number x \n the x-coordinate of the target. + * @brief X-coordinate + * @param Monster m_ptr \n the monster which is the target of the spell. + * @brief Monster + * @return Boolean \n TRUE if spell was cast, otherwise FALSE. + * @return Number get_angry \n TRUE if the monster gets angry, otherwise FALSE. + * @note + * If the hook returns TRUE, the hook sets the "get_angry" field. + * @note (see file spells1.c) + */ +/** @def HOOK_GF_EXEC + * @brief A spell to damage monsters.\n + * @param String target \n "monster" to indicate spell damages monsters. + * @brief Target + * @param Number who \n the source of the spell. + * @brief Source + * @param Number type \n the type of spell. + * @brief Type + * @param Number dam \n the number of hit points of damage. + * @brief Damage + * @param Number r \n the radius of the spell. + * @brief Radius + * @param Number y \n the y-coordinate of the target. + * @brief Y-coordinate + * @param Number x \n the x-coordinate of the target. + * @brief X-coordinate + * @param Monster m_ptr \n the monster which is the target of the spell. + * @brief Monster + * @return Boolean \n TRUE if spell was cast, otherwise FALSE. + * @return Number obvious \n TRUE if the player notices the spell, otherwise + * FALSE. + * @return Number dam \n The damage the monster takes. + * @return Number do_stun \n TRUE if the monster is stunned, otherwise FALSE. + * @return Number do_fear \n TRUE if the monster is frightened, otherwise + * FALSE. + * @return Number do_conf \n TRUE if the monster is confused, otherwise FALSE. + * @return Number do_dist \n TRUE if the monster is disturbed, otherwise FALSE. + * @return Number do_pois \n TRUE if the monster is poisoned, otherwise FALSE. + * @return Number do_cut \n TRUE if the monster is wounded, otherwise FALSE. + * @return Number do_poly \n TRUE if the monster is polymorphed, otherwise + * FALSE. + * @return String note \n The message displayed if the monster if affected. + * @return String note_dies \n The message displayed if the monster dies. + * @note + * If the hook returns TRUE, the hook sets the "obvious", "dam", "do_stun", + * "do_fear", "do_conf", "do_dist", "do_pois", "do_cut", "do_poly", "note", + * and "note dies" fields, otherwise the spell has no effect and does no + * damage. + * @note (see file spells1.c) + */ +/** @def HOOK_GF_EXEC + * @brief A spell to damage the player.\n + * @param String target \n "player" to indicate spell damages the player. + * @brief Target + * @param Number who \n the source of the spell. + * @brief Source + * @param Number type \n the type of spell. + * @brief Type + * @param Number dam \n the number of hit points of damage. + * @brief Damage + * @param Number r \n the radius of the spell. + * @brief Radius + * @param Number y \n the y-coordinate of the target. + * @brief Y-coordinate + * @param Number x \n the x-coordinate of the target. + * @brief X-coordinate + * @return Boolean \n TRUE if spell was cast, otherwise FALSE. + * @return Number obvious \n TRUE if the player notices the spell, otherwise + * FALSE. + * @return Number dam \n The damage the player takes. + * @note + * If the hook returns TRUE, the hook sets the "obvious" and "dam" fields, + * otherwise there is no damage. + * @note (see file spells1.c) + */ +#define HOOK_GF_EXEC 59 + +/** @def HOOK_CALC_MANA + * @brief Recalculate player SP (spell points).\n + * @param Number msp \n the player's new maximum spell points. + * @brief Maximum spell points. + * @return Boolean \n TRUE if hook has processed player spell points, otherwise + * FALSE. + * @note + * If the hook returns TRUE, the player's maximum spell points are updated. + * @note (see file xtra1.c) + */ +#define HOOK_CALC_MANA 60 + +/** @def HOOK_LOAD_END + * @brief Load a savefile.\n + * @param Number death \n TRUE if the character is dead, otherwise FALSE. + * @brief Dead character? + * @return Boolean \n TRUE if hook has processed savefile, otherwise FALSE. + * @return Number death \n + * @note + * If the hook returns TRUE, then "character_loaded" (real living player) is + * set to TRUE. The player has been revived. + * @note (see file loadsave.c) + */ +#define HOOK_LOAD_END 61 + +/** @def HOOK_RECALL + * @brief Player recalls from/to dungeon/town. + * @return Boolean \n TRUE if player is not allowed to recall, otherwise + * FALSE. + * @note (see file dungeon.c) + */ +#define HOOK_RECALL 62 + +/** @def HOOK_FOLLOW_GOD + * @brief Player follows a god (gets religion).\n + * @param Number god \n the god to follow. + * @brief God + * @param String action \n "ask" to check if player can follow the god, or + * "done" to do something with the god. + * @brief Action + * @return Boolean \n For "ask": TRUE if player can not follow the god, + * otherwise FALSE. + * @note + * If the action is "ask" and the hook returns TRUE, follow_god() returns. + * If the action is "done" the return code is ignored. + * @note (see file gods.c) + */ +#define HOOK_FOLLOW_GOD 63 + +/** @def HOOK_SACRIFICE_GOD + * @brief Player sacrifices to a god. + * @note (see file cmd2.c) + */ +#define HOOK_SACRIFICE_GOD 64 + +/** @def HOOK_BODY_PARTS + * @brief Calculate which body parts the player has. + * @note (see file xtra1.c) + */ +#define HOOK_BODY_PARTS 65 + +/** @def HOOK_APPLY_MAGIC + * @brief Apply magic to an item.\n + * @param Object o_ptr \n the item to which magic is applied + * @brief Object + * @param Number level \n the level of the object + * @brief Object level + * @param Number power \n the power of the object (0 = normal, 1 = good, + * 2 = great, -1 = cursed, -2 = broken) + * @brief Power + * @return Boolean \n TRUE if hook has applied magic, otherwise FALSE. + * @note + * If the hook returns TRUE, a_m_aux_n() (where n=1 to 4) returns. + * @note (see file object2.c) + */ +#define HOOK_APPLY_MAGIC 66 + +/** @def HOOK_PLAYER_EXP + * @brief Player gains/loses experience points (XP).\n + * @param Number amount \n the number of experience points to gain/lose + * @brief Points + * @note (see file xtra2.c) + */ +#define HOOK_PLAYER_EXP 67 + +/** @def HOOK_BIRTH + * @brief Player is born. + * @note (see file birth.c) + */ +#define HOOK_BIRTH 68 + +/** @def HOOK_CALC_LITE + * @brief Calculate the lite radius. + * @note (see file xtra1.c) + */ +#define HOOK_CALC_LITE 69 + +/** @def HOOK_LEARN_ABILITY + * @brief Player learns an ability.\n + * @param Number ab \n index of ability in ability (ab_info) array. + * @brief Ability index + * @return Boolean \n TRUE if player is not to gain the ability, otherwise + * FALSE. + * @note If the hook returns TRUE, can_learn_ability() returns FALSE. + * @note (see file skills.c) + */ +#define HOOK_LEARN_ABILITY 70 + +/** @def HOOK_MOVED + * @brief Player finishes moving. + * @note (see file cmd1.c) + */ +#define HOOK_MOVED 71 + +/** @def HOOK_GAME_START + * @brief Game begins. + * @note (see file dungeon.c) + */ +#define HOOK_GAME_START 72 + +/** @def HOOK_TAKEOFF + * @brief Player takes off an item.\n + * @param Number item \n the item to take off. + * @brief Item + * @return Booelan \n TRUE if item can not be taken off, otherwise FALSE. + * @note + * If the hook returns TRUE, do_cmd_takeoff() returns. + * @note (see file cmd3.c) + */ +#define HOOK_TAKEOFF 73 + +/** @def HOOK_CALC_WEIGHT + * @brief Calculate player weight limit.\n + * @param Number weight \n the current weight limit. + * @brief Weight + * @return Boolean \n TRUE if weight was processed, otherwise FALSE. + * @return Number weight \n The new maximum weight. + * @note + * If the hook returns TRUE, weight_limit() returns the hook's weight. + * @note (see file xtra1.c) + */ +#define HOOK_CALC_WEIGHT 74 + +/** @def HOOK_FORBID_TRAVEL + * @brief Check if the player may press < and travel.\n + * @return Boolean \n TRUE if travel is forbidden, otherwise FALSE. + */ +#define HOOK_FORBID_TRAVEL 75 + +/** @def HOOK_DEBUG_COMMAND + * @brief User enters a debug command.\n + * @param Number command \n the pressed key (cmd). + * @brief Command + * @return Boolean \n TRUE if special processing was done, otherwise FALSE. + */ +#define HOOK_DEBUG_COMMAND 76 + + +/** @} */ + + +/** @var turn + * @brief Number + * @note Current game turn + */ +extern s32b turn; +/** @var old_turn + * @brief Number + * @note Turn when level began (feelings) + */ +extern s32b old_turn; +/** @var cur_wid + * @brief Number + * @note Current dungeon width + */ +extern s16b cur_wid; +/** @var cur_hgt + * @brief Number + * @note Current dungeon height + */ +extern s16b cur_hgt; + +/** @fn disturb(int stop_search, int flush_output) + * @brief Disturb the player.\n + * @param stop_search Number \n if 0, this will not disturb searching, + * otherwise searching is stopped. + * @brief Stop search? + * @param flush_output Number \n *unused* + * @brief *Unused* + * @note + * Something has happened to disturb the player.\n\n + * The first arg indicates a major disturbance, which affects search.\n + * The second arg is currently unused, but could induce output flush.\n\n + * All disturbance cancels repeated commands, resting, and running. + * @note (see file cave.c) + */ +extern void disturb(int stop_search, int flush_output); + +/** @fn bst(s32b what, s32b t) + * @brief Break scalar time.\n + * @param what Number \n the unit time "t" is to be broken into. The following + * values can be used: MINUTE, HOUR, DAY, YEAR + * @brief Unit of time + * @param t Number \n the time to be broken. + * @brief Time + * @return Number \n The number of unit in time "t". + * @note (see file util.c) + */ +extern s32b bst(s32b what, s32b t); + +$static char *path_build_lua(cptr path, cptr file){static char buf[1025]; path_build(buf, 1024, path, file); return buf;} + +/** @fn path_build(cptr path, cptr file); + * @brief Create a new path by appending a file (or directory) to a path.\n + * @param path String \n the original path. + * @brief Path + * @param file String \n the file or directory to append to the path. + * @brief File or directory + * @return String \n The new path. + * @note + * This requires no special processing on simple machines, except + * for verifying the size of the filename, but note the ability to + * bypass the given "path" with certain special file-names.\n\n + * Note that the "file" may actually be a "sub-path", including + * a path and a file.\n\n + * @note (see file util.c) + */ +static char *path_build_lua@path_build(cptr path, cptr file); + +/** @fn move_cursor(int row, int col) + * @brief Move the cursor of a terminal to row "row" and column "col".\n + * @param row Number \n the target row on the screen. + * @brief Row + * @param col Number \n the target column on the screen. + * @brief Column + * @note (see file util.c) + */ +extern void move_cursor(int row, int col); + +/** @fn flush(void) + * @brief Flush all input chars. + * @note + * Actually, remember the flush, and do a "special flush" before the next + * "inkey()". + * This is not only more efficient, but also necessary to make sure + * that various "inkey()" codes are not "lost" along the way. + * @note (see file util.c) + */ +extern void flush(void); + +/** @var inkey_scan + * @brief Boolean + * @note + * If "inkey_scan" is TRUE, then we will immediately return "zero" if no + * keypress is available, instead of waiting for a keypress. + */ +extern bool inkey_scan; + +/** @fn inkey(void) + * @brief Get a keypress from the user. + * @return String \n the key pressed by the user. + * @note + * This function recognizes a few "global parameters". These are variables + * which, if set to TRUE before calling this function, will have an effect + * on this function, and which are always reset to FALSE by this function + * before this function returns. Thus they function just like normal + * parameters, except that most calls to this function can ignore + * them.\n\n + * If "inkey_xtra" is TRUE, then all pending keypresses will be flushed, + * and any macro processing in progress will be aborted. This flag is + * set by the "flush()" function, which does not actually flush anything + * itself, but rather, triggers delayed input flushing via + * "inkey_xtra".\n\n + * If "inkey_scan" is TRUE, then we will immediately return "zero" if no + * keypress is available, instead of waiting for a + * keypress.\n\n + * If "inkey_base" is TRUE, then all macro processing will be bypassed. + * If "inkey_base" and "inkey_scan" are both TRUE, then this function will + * not return immediately, but will wait for a keypress for as long as the + * normal macro matching code would, allowing the direct entry of macro + * triggers. The "inkey_base" flag is extremely + * dangerous!\n\n + * If "inkey_flag" is TRUE, then we will assume that we are waiting for a + * normal command, and we will only show the cursor if "hilite_player" is + * TRUE (or if the player is in a store), instead of always showing the + * cursor. The various "main-xxx.c" files should avoid saving the game + * in response to a "menu item" request unless "inkey_flag" is TRUE, to + * prevent savefile + * corruption.\n\n + * If we are waiting for a keypress, and no keypress is ready, then we will + * refresh (once) the window which was active when this function was + * called.\n\n + * Note that "back-quote" is automatically converted into "escape" for + * convenience on machines with no "escape" key. This is done after the + * macro matching, so the user can still make a macro for + * "backquote".\n\n + * Note the special handling of "ascii 30" (ctrl-caret, aka ctrl-shift-six) + * and "ascii 31" (ctrl-underscore, aka ctrl-shift-minus), which are used to + * provide support for simple keyboard "macros". These keys are so strange + * that their loss as normal keys will probably be noticed by nobody. The + * "ascii 30" key is used to indicate the "end" of a macro action, which + * allows recursive macros to be avoided. The "ascii 31" key is used by + * some of the "main-xxx.c" files to introduce macro trigger + * sequences.\n\n + * Hack -- we use "ascii 29" (ctrl-right-bracket) as a special "magic" key, + * which can be used to give a variety of "sub-commands" which can be used + * any time. These sub-commands could include commands to take a picture of + * the current screen, to start/stop recording a macro action, + * etc.\n\n + * If "angband_term[0]" is not active, we will make it active during this + * function, so that the various "main-xxx.c" files can assume that input + * is only requested (via "Term_inkey()") when "angband_term[0]" is + * active.\n\n + * Mega-Hack -- This function is used as the entry point for clearing the + * "signal_count" variable, and of the "character_saved" + * variable.\n\n + * Hack -- Note the use of "inkey_next" to allow "keymaps" to be + * processed.\n\n + * Mega-Hack -- Note the use of "inkey_hack" to allow the "Borg" to steal + * control of the keyboard from the user. + * @note (see file util.c) + */ +extern char inkey(void); + +/** @fn cmsg_print(byte color, cptr msg) + * @brief Output message "msg" in colour "color" to the top line of the + * screen.\n + * @param color Number \n the colour of the message (see TERM_ fields). + * @brief Colour + * @param msg String \n the message. + * @brief Message + * @note + * Break long messages into multiple pieces (40-72 chars).\n\n + * Allow multiple short messages to "share" the top line.\n\n + * Prompt the user to make sure he has a chance to read them.\n\n + * These messages are memorized for later reference (see above).\n\n + * We could do "Term_fresh()" to provide "flicker" if needed.\n\n + * The global "msg_flag" variable can be cleared to tell us to + * "erase" any "pending" messages still on the + * screen.\n\n + * XXX XXX XXX Note that we must be very careful about using the + * "msg_print()" functions without explicitly calling the special + * "msg_print(NULL)" function, since this may result in the loss + * of information if the screen is cleared, or if anything is + * displayed on the top + * line.\n\n + * XXX XXX XXX Note that "msg_print(NULL)" will clear the top line + * even if no messages are pending. This is probably a hack. + * @note (see file util.c) + */ +extern void cmsg_print(byte color, cptr msg); + +/** @fn msg_print(cptr msg) + * @brief Output message "msg" in white to the top line of the screen.\n + * @param msg String \n the message. + * @brief Message + * @note (see file util.c) + */ +extern void msg_print(cptr msg); + +/** @fn screen_save(void) + * @brief Save the screen. + * @note + * Increase the "icky" depth.\n\n + * This function must match exactly one call to "screen_load()". + * @note (see file util.c) + */ +extern void screen_save(void); + +/** @fn screen_load(void) + * @brief Load the screen. + * @note + * Decrease the "icky" depth.\n\n + * This function must match exactly one call to "screen_save()". + * @note (see file util.c) + */ +extern void screen_load(void); + +/** @fn Term_save(void) + * @brief Save the "requested" screen into the "memorized" screen. + * @return Number \n 0 (always). + * @note + * Every "Term_save()" should match exactly one "Term_load()" + * @note (see file z-term.c) + */ +extern errr Term_save(void); + +/** @fn Term_load(void) + * @brief Restore the "requested" contents from the "memorized" screen. + * @return Number \n 0 (always). + * @note + * Every "Term_save()" should match exactly one "Term_load()" + * @note (see file z-term.c) + */ +extern errr Term_load(void); + +/** @fn c_put_str(byte attr, cptr str, int row, int col) + * @brief Add string "str" with attributes "attr" to screen at row "row" + * and column "col".\n + * @param attr Number \n the attribute of the string + * @brief Attribute + * @param str String \n the string + * @brief String + * @param row Number \n the target row on the screen. + * @brief Row + * @param col Number \n the target column on the screen. + * @brief Column + * @note + * Display a string on the screen using an attribute.\n\n + * At the given location, using the given attribute, if allowed, + * add the given string. Do not clear the line. + * @note (see file util.c) + */ +extern void c_put_str(byte attr, cptr str, int row, int col); + +/** @fn c_prt(byte attr, cptr str, int row, int col) + * @brief Add string "str" with attributes "attr" to screen at row "row" + * and column "col", clearing to the end of the row.\n + * @param attr Number \n the attribute of the string + * @brief Attribute + * @param str String \n the string + * @brief String + * @param row Number \n the target row on the screen. + * @brief Row + * @param col Number \n the target column on the screen. + * @brief Column + * @note (see file util.c) + */ +extern void c_prt(byte attr, cptr str, int row, int col); + +/** @fn prt(cptr str, int row, int col) + * @brief Add white string "str" to screen at row "row" and column "col", + * clearing to the end of the row.\n + * @param str String \n the string + * @brief String + * @param row Number \n the target row on the screen. + * @brief Row + * @param col Number \n the target column on the screen. + * @brief Column + * @note (see file util.c) + */ +extern void prt(cptr str, int row, int col); + +/** @fn message_add(byte type, cptr msg, byte color) + * @brief Add a message "msg" of type "type" and colour "color" to the + * message array.\n + * @param type Number \n the type of message. MESSAGE_MSG for regular + * messages, MESSAGE_IRC for IRC messages. + * @brief Type + * @param msg String \n the message. + * @brief Message + * @param color Number \n the colour of the message (see TERM_ fields). + * @brief Colour + * @note + * Use "msg_print() instead. If you insist on using this function, be + * careful. + * @note (see file util.c) + */ +extern void message_add(byte type, cptr msg, byte color); + +/** @fn display_message(int x, int y, int split, byte color, cptr t) + * @brief Display a message.\n + * @param x Number \n the x-coordinate of the screen where the message starts. + * @brief X-coordinate + * @param y Number \n the y-coordinate of the screen where the message starts. + * @brief Y-coordinate + * @param split Number \n the position in the message where it is split. The + * rest of the message will not appear. + * @brief Split position + * @param color Number \n the colour of the message (see TERM_ fields). + * @brief Colour + * @param t String \n the message. + * @brief Message + * @note + * @note (see file util.c) + */ +extern void display_message(int x, int y, int split, byte color, cptr t); + +/** @fn clear_from(int row) + * @brief Clear part of the screen.\n + * @param row Number \n the target row on the screen. + * @brief Row + * @note + * Clear all rows from the starting row to the end of the screen. + * @note (see file util.c) + */ +extern void clear_from(int row); + +/** @fn askfor_aux(char *buf, int len) + * @brief Get some input at the cursor location.\n + * @param *buf String \n Default string (optional). + * @brief String + * @param len Number \n the maximum length of the string. + * @brief Length of string + * @return Boolean \n TRUE if string was entered, otherwise FALSE. + * @return *buf \n The entered string. + * @note + * Assume the buffer is initialized to a default string.\n + * Note that this string is often "empty" (see below).\n + * The default buffer is displayed in yellow until cleared.\n + * Pressing RETURN right away accepts the default entry.\n + * Normal chars clear the default and append the char.\n + * Backspace clears the default or deletes the final char.\n + * ESCAPE clears the buffer and the window and returns FALSE.\n + * RETURN accepts the current buffer contents and returns TRUE. + * @note (see file util.c) + */ +extern bool askfor_aux(char *buf, int len); + +/** @fn get_string(cptr prompt, char *buf, int len) + * @brief Get a string from the user.\n + * @param prompt String \n the prompt, which should take the form "Prompt: " + * @brief Prompt + * @param *buf String + * @brief String + * @param len Number \n the maximum length of the string. + * @brief Length of string + * @return Boolean \n TRUE if string was entered, otherwise FALSE. + * @return *buf \n The entered string. + * @note + * Note that the initial contents of the string is used as + * the default response, so be sure to "clear" it if needed.\n\n + * We clear the input, and return FALSE, on "ESCAPE". + * @note (see file util.c) + */ +extern bool get_string(cptr prompt, char *buf, int len); + +/** @fn get_check(cptr prompt) + * @brief Verify something with the user.\n + * @param prompt String \n the prompt, which should take the form "Query? " + * @brief Prompt + * @return Boolean \n TRUE if "y" or "Y" is entered, otherwise FALSE. + * @note + * Note that "[y/n]" is appended to the prompt. + * @note (see file util.c) + */ +extern bool get_check(cptr prompt); + +/** @fn get_com(cptr promtp, int *com = 0); + * @brief Prompts for a keypress.\n + * @param promtp String \n the prompt, which should take the form "Command: " + * @brief Prompt + * @param *com Number + * @brief Command + * @return Boolean \n FALSE if "Escape" was pressed, otherwise TRUE. + * @return *com \n The entered command. + * @note (see file util.c) + */ +extern bool get_com_lua @ get_com(cptr promtp, int *com = 0); + +/** @fn get_quantity(cptr prompt, s32b max) + * @brief Request a "quantity" from the user.\n + * @param prompt String \n the prompt + * @brief Prompt + * @param max Number \n the maximum quantity + * @brief Maximum quantity + * @return Number \n the returned quantity. + * @note + * Hack -- allow "command_arg" to specify a quantity\n\n + * The quantity is in the range 0 to "max" inclusive. The default is 1. A + * letter means the maximum. + * @note (see file util.c) + */ +extern s32b get_quantity(cptr prompt, s32b max); + +/** @fn test_monster_name(cptr name) + * @brief Given monster name as string, return the index in r_info array.\n + * @param name String \n the monster name. + * @brief Monster name + * @return Number \n The index of the monster in r_info[], or 0 if the name + * does not match a monster. + * @note + * Name must exactly match (look out for commas and the like!), or else 0 is + * returned. Case doesn't matter. + * @note (see file util.c) + */ +extern int test_monster_name(cptr name); + +/** @fn test_item_name(cptr name) + * @brief Given item name as string, return the index in k_info array.\n + * @param name String \n the item name. + * @brief Item name + * @return Number \n The index of the item in k_info[], or 0 if the name + * does not match an item. + * @note + * Name must exactly match (look out for commas and the like!), or else 0 is + * returned. Case doesn't matter. + * @note (see file util.c) + */ +extern int test_item_name(cptr name); + +/** @fn luck(int min, int max) + * @brief Return a luck number between a certain range.\n + * @param min Number \n the minimum luck value returned. + * @brief Mimimum + * @param max Number \n the maximum luck value returned. + * @brief Maximum + * @return Number \n The scaled value of player's luck. + * @note + * Player lucked is cap at a minimum of -30 and maximum of +30 before it is + * scaled to the range defined by "min" and "max". + * @note (see file xtra1.c) + */ +extern int luck(int min, int max); + +/** @fn get_player_race_name(int pr, int ps) + * @brief Return the player's race (and sub-race) name.\n + * @param pr Number \n the player's race. It is an index to race_info[]. + * @brief Player race + * @param ps Number \n the player's subrace, if any. It is an index to + * race_mod_info[]. + * @brief Player subrace + * @return String \n The player's full race name. + * @note (see file util.c) + */ +extern cptr get_player_race_name(int pr, int ps); + +/** @fn quit(cptr str) + * @brief Quit the game. + * @param str String \n an error code or a message which is logged. + * @brief String + * @note + * Exit (ala "exit()"). If 'str' is NULL, do "exit(0)".\n + * If 'str' begins with "+" or "-", do "exit(atoi(str))".\n + * Otherwise, plog() 'str' and exit with an error code of -1.\n + * But always use 'quit_aux', if set, before anything else. + * @note (see file z-util.c) + */ +extern void quit(cptr str); + +/** @fn value_scale(int value, int vmax, int max, int min) + * @brief Rescale a value + * @param value Number \n the original value + * @brief Original value + * @param vmax Number \n the maximum the original value can be + * @brief Original maximum + * @param max Number \n the maximum new value + * @brief New maximum + * @param min Number \n the minimum new value + * @brief New minimum + * @return Number \n The rescaled value + * @note (see file util.c) + */ +extern s32b value_scale(int value, int vmax, int max, int min); + +/** @fn text_out_c(byte a, cptr str) + * @brief Output text to the screen (in color) or to a file depending on the + * selected hook.\n + * @param a Number \n the attribute of the string + * @brief Attribute + * @param str String \n the string + * @brief String + * @note (see file util.c) + */ +extern void text_out_c(byte a, cptr str); + +/** @fn text_out(cptr str) + * @brief Output text to the screen (in white) or to a file depending on the + * selected hook.\n + * @param str String \n the string + * @brief String + * @note (see file util.c) + */ +extern void text_out(cptr str); + +/** @fn change_option(cptr name, bool value) + * @brief Switch an option by only knowing its name.\n + * @param name String \n the name of the option. + * @brief Option name + * @param value Boolean \n the new value of the option. + * @brief Option value + * @return Boolean \n the old value of the option, or FALSE if "name" is not + * an option. + * @note (see file cmd4.c) + */ +extern bool change_option(cptr name, bool value); + +/** @var process_hooks_restart + * @brief Number + * @note + * Set this to TRUE after deleting a C-hook (from a quest) to clean up hook + * processing. This is not required for Lua hooks as they are not deleted. + */ +extern int process_hooks_restart; + +/** @fn dump_hooks(int h_idx) + * @brief Print the name and type (language) of all hooks in a hook chain.\n + * @param h_idx Number \n the index of the hook chain in the hook_chain array. + * If this is -1, then all hook chains will be printed. + * @brief Hook chain index + * @note (see file plots.c) + */ +extern void dump_hooks(int h_idx); + +/** @fn add_hook_script(int h_idx, char *script, cptr name) + * @brief Add Lua script "name" in file "script" to hook_chain.\n + * @param h_idx Number \n the index of the hook chain in the hook_chain array. + * @brief Hook chain index + * @param *script String \n the name of the Lua script file. + * @brief Script filename + * @param name String \n the name of the script. + * @brief Script name + * @note (see file plots.c) + */ +extern void add_hook_script(int h_idx, char *script, cptr name); + +/** @fn del_hook_name(int h_idx, cptr name) + * @brief Delete hook with name "name" from a hook chain.\n + * @param h_idx Number \n the index of the hook chain in the hook_chain array. + * @brief Hook chain index + * @param name String \n the name of the hook to delete + * @brief Hook name + * @note (see file plots.c) + */ +extern void del_hook_name(int h_idx, cptr name); + +/** @fn tome_dofile(char *file) + * @brief Load a Lua file from lib/scpts.\n + * @param *file String \n the name of a Lua file to load. + * @brief Filename + * @return Boolean \n TRUE if file was loaded, otherwise FALSE. + * @note (see file script.c) + */ +extern bool tome_dofile(char *file); + +/** @fn tome_dofile_anywhere(cptr dir, char *file, bool test_exist = TRUE) + * @brief Load a Lua file from any directory.\n + * @param dir String \n the name of a Lua file directory + * @brief Directory + * @param *file String \n the name of a Lua file to load. + * @brief Filename + * @param test_exist Boolean \n TRUE if a message is printed if the file does + * not exist, otherwise FALSE. + * @brief Message if file does not exist? + * @return Boolean \n TRUE if file was loaded, otherwise FALSE. + * @note (see file script.c) + */ +extern bool tome_dofile_anywhere(cptr dir, char *file, bool test_exist = TRUE); + +/** @fn exec_lua(char *file) + * @brief Execute Lua command "file" and return the integer result.\n + * @param *file String \n the Lua command to execute. + * @brief Command + * @return Number \n the result of the Lua command. + * @note (see file script.c) + */ +extern int exec_lua(char *file); + +/** @fn dump_lua_stack(int min, int max) + * @brief Display part of the Lua stack.\n + * @param min Number \n the starting item of the stack dump. + * @brief Start item + * @param max Number \n the ending item of the stack dump. + * @brief End item + * @note (see file script.c) + */ +extern void dump_lua_stack(int min, int max); + +/** @fn string_exec_lua(char *file) + * @brief Execute Lua command "file" and return the string result.\n + * @param *file String \n the Lua command to execute. + * @brief Command + * @return String \n the result of the Lua command. + * @note (see file script.c) + */ +extern cptr string_exec_lua(char *file); + +/** @fn print_hook(cptr str); + * @brief Print string "string" to the hook file.\n + * @param str String \ the string. + * @brief String + * @note (see file lua_bind.c) + */ +extern void lua_print_hook@print_hook(cptr str); + +/* Savefile stuff */ +/** @fn register_savefile(int num) + * @brief Add "num" slots to the savefile.\n + * @param num Number \n the number of slots to add. + * @brief Slots + * @note (see file loadsave.c) + */ +extern void register_savefile(int num); + +/** @fn save_number_key(char *key, s32b val) + * @brief Save a key-value combination in the save file.\n + * @param *key String \n the key to save. + * @brief Key + * @param val Number \n the value of the key. + * @brief Value + * @note + * The length of the key is stored first, then the key, then the value. + * @note (see file loadsave.c) + */ +extern void save_number_key(char *key, s32b val); + + +/* Tables */ +/** @var adj_mag_study[100] + * @brief Number + * @note Stat Table (INT/WIS) -- Number of half-spells per level + */ +extern byte adj_mag_study[100]; + +/** @var adj_mag_mana[100] + * @brief Number + * @note Stat Table (INT/WIS) -- extra half-mana-points per level + */ +extern byte adj_mag_mana[100]; + +/** @var adj_mag_fail[100] + * @brief Number + * @note Stat Table (INT/WIS) -- Minimum failure rate (percentage) + */ +extern byte adj_mag_fail[100]; + +/** @var adj_mag_stat[100] + * @brief Number + * @note Stat Table (INT/WIS) -- Various things + */ +extern byte adj_mag_stat[100]; + +/** @var adj_chr_gold[100] + * @brief Number + * @note Stat Table (CHR) -- payment percentages + */ +extern byte adj_chr_gold[100]; + +/** @var adj_int_dev[100] + * @brief Number + * @note Stat Table (INT) -- Magic devices + */ +extern byte adj_int_dev[100]; + +/** @var adj_wis_sav[100] + * @brief Number + * @note Stat Table (WIS) -- Saving throw + */ +extern byte adj_wis_sav[100]; + +/** @var adj_dex_dis[100] + * @brief Number + * @note Stat Table (DEX) -- disarming + */ +extern byte adj_dex_dis[100]; + +/** @var adj_int_dis[100] + * @brief Number + * @note Stat Table (INT) -- disarming + */ +extern byte adj_int_dis[100]; + +/** @var adj_dex_ta[100] + * @brief Number + * @note Stat Table (DEX) -- bonus to ac (plus 128) + */ +extern byte adj_dex_ta[100]; + +/** @var adj_str_td[100] + * @brief Number + * @note Stat Table (STR) -- bonus to dam (plus 128) + */ +extern byte adj_str_td[100]; + +/** @var adj_dex_th[100] + * @brief Number + * @note Stat Table (DEX) -- bonus to hit (plus 128) + */ +extern byte adj_dex_th[100]; + +/** @var adj_str_th[100] + * @brief Number + * @note Stat Table (STR) -- bonus to hit (plus 128) + */ +extern byte adj_str_th[100]; + +/** @var adj_str_wgt[100] + * @brief Number + * @note Stat Table (STR) -- weight limit in deca-pounds + */ +extern byte adj_str_wgt[100]; + +/** @var adj_str_hold[100] + * @brief Number + * @note Stat Table (STR) -- weapon weight limit in pounds + */ +extern byte adj_str_hold[100]; + +/** @var adj_str_dig[100] + * @brief Number + * @note Stat Table (STR) -- digging value + */ +extern byte adj_str_dig[100]; + +/** @var adj_str_blow[100] + * @brief Number + * @note Stat Table (STR) -- help index into the "blow" table + */ +extern byte adj_str_blow[100]; + +/** @var adj_dex_blow[100] + * @brief Number + * @note Stat Table (DEX) -- index into the "blow" table + */ +extern byte adj_dex_blow[100]; + +/** @var adj_dex_safe[100] + * @brief Number + * @note Stat Table (DEX) -- chance of avoiding "theft" and "falling" + */ +extern byte adj_dex_safe[100]; + +/** @var adj_con_fix[100] + * @brief Number + * @note Stat Table (CON) -- base regeneration rate + */ +extern byte adj_con_fix[100]; + +/** @var adj_con_mhp[100] + * @brief Number + * @note Stat Table (CON) -- extra half-hitpoints per level (plus 128) + */ +extern byte adj_con_mhp[100]; + +/* Repeat stuff */ +/** @fn repeat_push(int what) + * @brief Push key "what" onto the end of the repeat_key array.\n + * @param what Number \n the key to be repeated. + * @brief Key + * @note (see file util.c) + */ +extern void repeat_push(int what); + +/** @fn repeat_pull(int *what = 0) + * @brief Pull key from the repeat__key array.\n + * @param *what Number + * @brief Key + * @return Boolean \n TRUE if key was pulled, otherwise FALSE. + * @return *what Number \n the key pulled. + * @note + * This functions starts from an index, which may not be at the start of the + * array. + * @note (see file util.c) + */ +extern bool repeat_pull(int *what = 0); + +/** @fn repeat_check(void) + * @brief Check if the last command is repeated. + * @note + * Ignore certain commands: ESC, space, newline.\n + * 'n' repeats the last command (index is set to 0).\n + * Other commands reset the repeat array (index and count are set to 0). + * @note (see file util.c) + */ +extern void repeat_check(void); + +/** @fn get_count(int number, int max) + * @brief Allow the user to select multiple items without pressing '0'.\n + * @param number Number \n the default number. + * @brief Default + * @param max Number \n the maximum value allowed. + * @brief Maximum + * The user is prompted with "How many?" + * @note (see file util.c) + */ +extern void get_count(int number, int max); + +/** @name Feature Flags + * @{ + */ +/** @def FF1_NO_WALK */ +#define FF1_NO_WALK 0x00000001L + +/** @def FF1_NO_VISION */ +#define FF1_NO_VISION 0x00000002L + +/** @def FF1_CAN_LEVITATE */ +#define FF1_CAN_LEVITATE 0x00000004L + +/** @def FF1_CAN_PASS */ +#define FF1_CAN_PASS 0x00000008L + +/** @def FF1_FLOOR */ +#define FF1_FLOOR 0x00000010L + +/** @def FF1_WALL */ +#define FF1_WALL 0x00000020L + +/** @def FF1_PERMANENT */ +#define FF1_PERMANENT 0x00000040L + +/** @def FF1_CAN_FLY */ +#define FF1_CAN_FLY 0x00000080L + +/** @def FF1_REMEMBER */ +#define FF1_REMEMBER 0x00000100L + +/** @def FF1_NOTICE */ +#define FF1_NOTICE 0x00000200L + +/** @def FF1_DONT_NOTICE_RUNNING */ +#define FF1_DONT_NOTICE_RUNNING 0x00000400L + +/** @def FF1_CAN_RUN */ +#define FF1_CAN_RUN 0x00000800L + +/** @def FF1_DOOR */ +#define FF1_DOOR 0x00001000L + +/** @def FF1_SUPPORT_LIGHT */ +#define FF1_SUPPORT_LIGHT 0x00002000L + +/** @def FF1_CAN_CLIMB */ +#define FF1_CAN_CLIMB 0x00004000L + +/** @def FF1_TUNNELABLE */ +#define FF1_TUNNELABLE 0x00008000L + +/** @def FF1_WEB */ +#define FF1_WEB 0x00010000L + +/** @def FF1_ATTR_MULTI */ +#define FF1_ATTR_MULTI 0x00020000L + +/** @def FF1_SUPPORT_GROWTH */ +#define FF1_SUPPORT_GROWTH 0x00040000L +/** @} */ + + +/* Cave stuff */ +/** @struct cave_type + */ +struct cave_type +{ + /** @structvar info + * @brief Number + * @note Hack -- cave flags + */ + u16b info; + + /** @structvar feat + * @brief Number + * @note Hack -- feature type + */ + byte feat; + + /** @structvar o_idx + * @brief Number + * @note Object in this grid + */ + s16b o_idx; + + /** @structvar m_idx + * @brief Number + * @note Monster in this grid + */ + s16b m_idx; + + /** @structvar t_idx + * @brief Number + * @note trap index (in t_list) or zero + */ + s16b t_idx; + + /** @structvar special + * @brief Number + */ + s16b special; + /** @structvar special2 + * @brief Number + * @note Special cave info + */ + s16b special2; + + /** @structvar inscription + * @brief Number + * @note Inscription of the grid + */ + s16b inscription; + + /** @structvar mana + * @brief Number + * @note Magical energy of the grid + */ + byte mana; + + /** @structvar mimic + * @brief Number + * @note Feature to mimic + */ + byte mimic; + + /** @structvar effect + * @brief Number + * @note The lasting effects + */ + s16b effect; +}; + +/** @var ANGBAND_SYS + * @brief String + * @note + * Hack -- The special Angband "System Suffix"\n + * This variable is used to choose an appropriate "pref-xxx" file + */ +extern cptr ANGBAND_SYS; + +/** @var ANGBAND_KEYBOARD + * @brief String + * @note + * Hack -- The special Angband "Keyboard Suffix"\n + * This variable is used to choose an appropriate macro-trigger definition + */ +extern cptr ANGBAND_KEYBOARD; + +/** @var ANGBAND_GRAF + * @brief String + * @note + * Hack -- The special Angband "Graphics Suffix"\n + * This variable is used to choose an appropriate "graf-xxx" file + */ +extern cptr ANGBAND_GRAF; + +/** @var ANGBAND_DIR + * @brief String + * @note + * Path name: The main "lib" directory\n + * This variable is not actually used anywhere in the code + */ +extern cptr ANGBAND_DIR; + +/** @var ANGBAND_DIR_APEX + * @brief String + * @note + * High score files (binary)\n + * These files may be portable between platforms + */ +extern cptr ANGBAND_DIR_APEX; + +/** @var ANGBAND_DIR_BONE + * @brief String + * @note + * Bone files for player ghosts (ascii)\n + * These files are portable between platforms + */ +extern cptr ANGBAND_DIR_BONE; + +/** @var ANGBAND_DIR_CORE + * @brief String + * @note + * Core lua system\n + * These files are portable between platforms + */ +extern cptr ANGBAND_DIR_CORE; + +/** @var ANGBAND_DIR_DNGN + * @brief String + * @note + * Textual dungeon level definition files\n + * These files are portable between platforms + */ +extern cptr ANGBAND_DIR_DNGN; + +/** @var ANGBAND_DIR_DATA + * @brief String + * @note + * Binary image files for the "*_info" arrays (binary)\n + * These files are not portable between platforms + */ +extern cptr ANGBAND_DIR_DATA; + +/** @var ANGBAND_DIR_EDIT + * @brief String + * @note + * Textual template files for the "*_info" arrays (ascii)\n + * These files are portable between platforms + */ +extern cptr ANGBAND_DIR_EDIT; + +/** @var ANGBAND_DIR_FILE + * @brief String + * @note + * Various extra files (ascii)\n + * These files may be portable between platforms + */ +extern cptr ANGBAND_DIR_FILE; + +/** @var ANGBAND_DIR_HELP + * @brief String + * @note + * Help files (normal) for the online help (ascii)\n + * These files are portable between platforms + */ +extern cptr ANGBAND_DIR_HELP; + +/** @var ANGBAND_DIR_INFO + * @brief String + * @note + * Help files (spoilers) for the online help (ascii)\n + * These files are portable between platforms + */ +extern cptr ANGBAND_DIR_INFO; + +/** @var ANGBAND_DIR_MODULES + * @brief String + * @note + * Modules, those subdirectories are half-mirrors of lib/ + */ +extern cptr ANGBAND_DIR_MODULES; + +/** @var ANGBAND_DIR_NOTE + * @brief String + * @note + * Textual template files for the plot files (ascii)\n + * These files are portable between platforms + */ +extern cptr ANGBAND_DIR_NOTE; + +/** @var ANGBAND_DIR_SAVE + * @brief String + * @note + * Savefiles for current characters (binary)\n + * These files are portable between platforms + */ +extern cptr ANGBAND_DIR_SAVE; + +/** @var ANGBAND_DIR_SCPT + * @brief String + * @note + * Scripts.\n + * These files are portable between platforms + */ +extern cptr ANGBAND_DIR_SCPT; + +/** @var ANGBAND_DIR_PREF + * @brief String + * @note + * Default "preference" files (ascii)\n + * These files are rarely portable between platforms + */ +extern cptr ANGBAND_DIR_PREF; + +/** @var ANGBAND_DIR_PATCH + * @brief String + * @note + * Patches, contains one subdir per patch with a patch.lua file + * in it and a patch_init() function in it + */ +extern cptr ANGBAND_DIR_PATCH; + +/** @var ANGBAND_DIR_USER + * @brief String + * @note + * User "preference" files (ascii)\n + * These files are rarely portable between platforms + */ +extern cptr ANGBAND_DIR_USER; + +/** @var ANGBAND_DIR_XTRA + * @brief String + * @note + * Various extra files (binary)\n + * These files are rarely portable between platforms + */ +extern cptr ANGBAND_DIR_XTRA; + +/** @var ANGBAND_DIR_CMOV + * @brief String + * @note + * Cmovie files of entire games (ascii)\n + * Apart from possible newline things, likely portable btw platforms + */ +extern cptr ANGBAND_DIR_CMOV; + + +/** @fn los(int y1, int x1, int y2, int x2) + * @brief Determine if a line of sight can be traced from (x1,y1) to (x2,y2).\n + * @param y1 Number \n y-coordinate of the origin. + * @brief Origin y-coordinate + * @param x1 Number \n x-coordinate of the origin. + * @brief Origin x-coordinate + * @param y2 Number \n y-coordinate of the target. + * @brief Target y-coordinate + * @param x2 Number \n x-coordinate of the target. + * @brief Target x-coordinate + * @return Boolean \n TRUE if origin has line of sight to target, otherwise + * FALSE. + * @note + * A simple, fast, integer-based line-of-sight algorithm. By Joseph Hall, + * 4116 Brewster Drive, Raleigh NC 27606. Email to jnh@ecemwl.ncsu.edu.\n\n + * Returns TRUE if a line of sight can be traced from (x1,y1) to (x2,y2).\n\n + * The LOS begins at the center of the tile (x1,y1) and ends at the center of + * the tile (x2,y2). If los() is to return TRUE, all of the tiles this line + * passes through must be floor tiles, except for (x1,y1) and (x2,y2).\n\n + * We assume that the "mathematical corner" of a non-floor tile does not + * block line of sight.\n\n + * Because this function uses (short) ints for all calculations, overflow may + * occur if dx and dy exceed 90.\n\n + * Once all the degenerate cases are eliminated, the values "qx", "qy", and + * "m" are multiplied by a scale factor "f1 = abs(dx * dy * 2)", so that + * we can use integer arithmetic.\n\n + * We travel from start to finish along the longer axis, starting at the border + * between the first and second tiles, where the y offset = .5 * slope, taking + * into account the scale factor. See below.\n\n + * Also note that this function and the "move towards target" code do NOT + * share the same properties. Thus, you can see someone, target them, and + * then fire a bolt at them, but the bolt may hit a wall, not them. However, + * by clever choice of target locations, you can sometimes throw a "curve".\n\n + * Note that "line of sight" is not "reflexive" in all cases.\n\n + * Use the "projectable()" routine to test "spell/missile line of sight".\n\n* + * Use the "update_view()" function to determine player line-of-sight.\n\n + * @note (see file cave.c) + */ +extern bool los(int y1, int x1, int y2, int x2); +$static bool lua_cave_is(cave_type *c_ptr, s32b flag) { return (f_info[c_ptr->feat].flags1 & flag) ? TRUE : FALSE; } + +/** @fn cave_is(cave_type *c_ptr, s32b flag); + * @brief Determine if cave "c_ptr" has feature "flag".\n + * @param *c_ptr cave_type \n the cave. + * @brief Cave + * @param flag Number \n the required feature flag. + * @brief Feature + * @return Boolean \n TRUE if the cave features include "flag", otherwise + * FALSE. + * @note (see file w_util.c) + */ +static bool lua_cave_is @ cave_is(cave_type *c_ptr, s32b flag); + +/** @fn cave(int y, int x); + * @brief Return the type of cave at grid coordinate (x,y).\n + * @param y Number \n y-coordinate of grid. + * @brief Y-coordinate + * @param x Number \n x-coordinate of grid. + * @brief X-coordinate + * @return cave_type \n The type of cave at grid coordinate (x,y). + * @note (see file lua_bind.c) + */ +extern cave_type *lua_get_cave @ cave(int y, int x); + +/** @fn set_target(int y, int x) + * @brief Set grid coordinate (x,y) as the target grid.\n + * @param y Number \n y-coordinate of grid. + * @brief Y-coordinate + * @param x Number \n x-coordinate of grid. + * @brief X-coordinate + * @note (see file lua_bind.c) + */ +extern void set_target(int y, int x); + +/** @fn get_target(int dir, int *y = 0, int *x = 0) + * @brief Get a target based on direction "dir" from the player.\n + * @param dir Number \n dir must be a value from 0 to 9. + * @brief Direction + * @param *y Number + * @brief Target y-coordinate + * @param *x Number + * @brief Target x-coordinate + * @return *y Number \n The y-coordinate of the target. + * @return *x Number \n The x-coordinate of the target. + * @note + * The target is actually 100 grids away in direction "dir". If "dir" is 5, + * the actual target, if one is set, is returned. + * @note (see file lua_bind.c) + */ +extern void get_target(int dir, int *y = 0, int *x = 0); + +/** @var m_allow_special[max_r_idx] + * @brief Boolean + * @note "Special gene" flags for monsters + */ +extern bool m_allow_special[max_r_idx]; + +/** @var k_allow_special[max_k_idx] + * @brief Boolean + * @note "Special gene" flags for objects + */ +extern bool k_allow_special[max_k_idx]; + +/** @var a_allow_special[max_a_idx] + * @brief Boolean + * @note "Special gene" flags for artifacts + */ +extern bool a_allow_special[max_a_idx]; + +/** @fn cave_set_feat(int y, int x, int feat) + * @brief Change the "feat" flag for a grid, and notice/redraw the grid + * @param y Number \n y-coordinate of grid. + * @brief Y-coordinate + * @param x Number \n x-coordinate of grid. + * @brief X-coordinate + * @param feat Number \n new set of feature flags. + * @brief Features + * @note (see file cave.c) + */ +extern void cave_set_feat(int y, int x, int feat); + +/** @fn show_file(cptr name, cptr what, int line, int mode) + * @brief Show a help file.\n + * @param name String \n name of the help file. + * @brief Filename + * @param what String \n hyperlink caption. + * @brief Caption + * @param line Number \n the line number from where to start the display of + * the file. + * @brief Starting line + * @param mode Number \n *unused* + * @brief *Unused* + * @return Boolean \n TRUE if file was shown successfully, otherwise FALSE.\n + * @note + * If the file is not found, the function will search the help, info, and file + * directories for the file. If it is still not found, a message is displayed + * and the function returns FALSE.\n\n + * The file is parsed once to extract colour, tag, and hyperlink + * information.\n\n + * The file is parse again to show it on the screen. + * @note (see file files.c) + */ +extern bool show_file(cptr name, cptr what, int line, int mode); + +/** @var target_who + * @brief Number + * @note + * If this is -1, the target is the player.\n + * If this is 0, there is no target.\n + * If this is >0, the target is the monster m_idx[target_who]. + */ +extern s16b target_who; + +/** @var target_col + * @brief Number + * @note The column of the target grid + */ +extern s16b target_col; + +/** @var target_row + * @brief Number + * @note The row of the target grid + */ +extern s16b target_row; + +/** @var max_bact + * @brief Number + * @note Maximum building actions + */ +extern int max_bact; + +/** @var ddd[9] + * @brief Number + * @note Global array for looping through the "keypad directions" + */ +extern s16b ddd[9]; + +/** @var ddx[10] + * @brief Number + * @note Global array for converting "keypad direction" into x offsets + */ +extern s16b ddx[10]; + +/** @var ddy[10] + * @brief Number + * @note Global array for converting "keypad direction" into y offsets + */ +extern s16b ddy[10]; + +/** @var ddx_ddd[9] + * @brief Number + * @note Global array for optimizing "ddx[ddd[i]]" + */ +extern s16b ddx_ddd[9]; + +/** @var ddy_ddd[9] + * @brief Number + * @note Global array for optimizing "ddy[ddd[i]]" + */ +extern s16b ddy_ddd[9]; + + +/* Gen stuff */ +/** @fn get_map_size(bool full_text, char *name, int *ysize = 0, int *xsize = 0) + * @brief Return the size of the map in file "name".\n + * @param full_text Boolean \n if TRUE, "name" contains the map itself, + * otherwise "name" is the name of the map file. + * @brief Name is a map? + * @param *name String \n the map itself, or the name of the map file. + * @brief Map + * @param *ysize Number + * @brief Maximum y-coordinate + * @param *xsize Number + * @brief Maximum x-coordinate + * @return *ysize Number \n The maximum y-coordinate of the map. + * @return *xsize Number \n The maximum x-coordinate of the map. + * @note (see file lua_bind.c, init1.c) + */ +extern void get_map_size(bool full_text, char *name, int *ysize = 0, int *xsize = 0); + +/** @fn load_map(bool full_text, char *name, int *y = 2, int *x = 2) + * @brief Load the map in file "name".\n + * @param full_text Boolean \n if TRUE, "name" contains the map itself, + * otherwise "name" is the name of the map file. + * @brief Name is a map? + * @param *name String \n the map itself, or the name of the map file. + * @brief Map + * @param *y Number + * @brief Maximum y-coordinate + * @param *x Number + * @brief Maximum x-coordinate + * @return *y Number \n The maximum y-coordinate of the map. + * @return *x Number \n The maximum x-coordinate of the map. + * @note + * The map is loaded and the player is placed at the starting position. + * @note (see file lua_bind.c) + */ +extern void load_map(bool full_text, char *name, int *y = 2, int *x = 2); + +/** @fn alloc_room(int by0, int bx0, int ysize, int xsize, int *y1 = 0, int *x1 = 0, int *y2 = 0, int *x2 = 0) + * @brief Allocate the space needed by a room in the room_map array.\n + * @param by0 Number \n the y-coordinate of the block to contain the room. + * @brief Block y-coordinate + * @param bx0 Number \n the x-coordinate of the block to contain the room. + * @brief Block x-coordinate + * @param ysize Number \n the vertical size (height) of the room. + * @brief Room height + * @param xsize Number \n the horizontal size (width) of the room. + * @brief Room width + * @param *y1 Number + * @brief Top-right y-coordinate + * @param *x1 Number + * @brief Top-right x-coordinate + * @param *y2 Number + * @brief Bottom-left y-coordinate + * @param *x2 Number + * @brief Bottom-right x-coordinate + * @return Boolean \n TRUE if the room was allocated successfully, otherwise + * FALSE. + * @return *y1 Number \n The y-coordinate of the top left corner. + * @return *x1 Number \n The x-coordinate of the top left corner. + * @return *y2 Number \n The y-coordinate of the bottom right corner. + * @return *x2 Number \n The x-coordinate of the bottom right corner. + * @note + * Dungeon generation is not something to be messed around with unless you + * really, really, really know what you are doing (or you are DarkGod). + * @note (see file lua_bind.c, generate.c) + */ +extern bool alloc_room(int by0, int bx0, int ysize, int xsize, int *y1 = 0, int *x1 = 0, int *y2 = 0, int *x2 = 0); + +/** @var option_ingame_help + * @brief Boolean + * @note Ingame contextual help flag + */ +extern bool option_ingame_help; + +/* Misc stuff */ +/** @fn input_box(cptr title, int max); + * @brief Create an input box and ask the user a question.\n + * @param title String \n the title of the box, which should take the form of + * a question. For example, "New name?". + * @brief Title + * @param max Number \n the maximum length of the response. + * @brief Maximum response length + * @return String \n The answer to the question. + * @note + * The input box is placed in the middle of the screen. The default reponse is + * blank, and can be up to 79 characters long. + * @note (see file lua_bind.c, util.c) + */ +extern char *lua_input_box@input_box(cptr title, int max); + +/** @fn msg_box(cptr title); + * @brief Create a msg box and ask a question.\n + * @param title String \n the question. + * @brief Question + * @return String \n The answer. + * @note + * The message box is placed in the middle of the screen. The answer is a + * single character / key press. + * @note (see file lua_bind.c, util.c) + */ +extern char lua_msg_box@msg_box(cptr title); + +/** @fn rescale(s32b x, s32b max, s32b new_max) + * @brief Rescale value "x".\n + * @param x Number \n the original value. + * @brief Value + * @param max Number \n the original maximum that value could have. + * @brief Original maximum + * @param new_max Number \n the new maximum that value can have. + * @brief New maximum + * @return Number \n The rescaled value of "x". + * @note + * There is no error checking here. Please don't set "max" to zero. + * @note (see file util.c) + */ +extern s32b rescale(s32b x, s32b max, s32b new_max); +$static const char *player_name_lua(void){return (const char *)player_name;} + +/** @fn player_name() + * @brief Return the player's name. + * @return String \n The player's name. + * @note (see file w_util.c) + */ +const char *player_name_lua@player_name(); + +/* Temp files */ +/** @fn make_temp_file(); + * @brief Create a temporary file. + * @note + * If a temp file already exists, or one can't be generated, the function + * will fail. Otherwise a file is created and the temp_file flag is set to + * TRUE. + * @note (see file lua_bind.c, util.c) + */ +extern void lua_make_temp_file@make_temp_file(); + +/** @fn close_temp_file(); + * @brief Close a temporary file. + * @note + * The file is closed but not released. + * @note (see file lua_bind.c, util.c) + */ +extern void lua_close_temp_file@close_temp_file(); + +/** @fn end_temp_file(); + * @brief End a temporary file. + * @note + * The file is released and the temp_file flag is set to FALSE. + * @note (see file lua_bind.c, util.c) + */ +extern void lua_end_temp_file@end_temp_file(); + +/** @fn get_temp_name(); + * @brief Return the name of the temporary file. + * @return String \n The name of the temporary file. + * @note (see file lua_bind.c) + */ +extern cptr lua_get_temp_name@get_temp_name(); + +/* Quarks */ +/** @fn quark_str(s16b num) + * @brief Return a quark (inscription) from the quark array.\n + * @param num Number \n the index to the quark string array. If this is less + * than zero or more than the maximum number of quarks, it is treated as zero. + * @brief Quark index + * @return String \n The quark. + * @note + * We use a global array for all inscriptions to reduce the memory + * spent maintaining inscriptions. Of course, it is still possible + * to run out of inscription memory, especially if too many different + * inscriptions are used, but hopefully this will be rare.\n\n + * We use dynamic string allocation because otherwise it is necessary + * to pre-guess the amount of quark activity. We limit the total + * number of quarks, but this is much easier to "expand" as needed.\n\n + * Any two items with the same inscription will have the same "quark" + * index, which should greatly reduce the need for inscription space.\n\n + * Note that "quark zero" is NULL and should not be "dereferenced". + * @note (see file util.c) + */ +extern cptr quark_str(s16b num); + +/** @fn quark_add(cptr str) + * @brief Add a quark (inscription) to the quark array.\n + * @param str String \n the quark to add to the array. + * @brief Quark + * @return Number \n The index to the quark array for this quark + * @note + * The array is searched to see if the quark already exists. If so, the index + * to the existing quark is returned.\n + * If there is no room, 0 (NULL reference) is returned. + * @note (see file util.c) + */ +extern s16b quark_add(cptr str); + +/* Modules */ +/** @fn module_reset_dir(cptr dir, cptr new_path) + * @brief Redirect one of the ToME directories.\n + * @param dir String \n the name of the directory (not the full path). + * @brief Directory + * @param new_path String \n the new path of "dir" under ANGBAND_DIR_MODULES.\n + * @brief New path + * @note (see file modules.c) + */ +extern void module_reset_dir(cptr dir, cptr new_path); + +/** @fn scansubdir(cptr dir) + * @brief Scan sub-directory "dir".\n + * @param dir String \n the sub-directory to scan. + * @brief Directory + * @note + * Nicer wrapper around TERM_XTRA_SCANSUBDIR\n\n + * This function sets scansubdir_dir and calls the SCANSUBDIR terminal hook. + * @note (see file util.c) + */ +extern void scansubdir(cptr dir); + +/** @fn file_exist(char *buf) + * @brief Check if file "buf" exists.\n + * @param *buf String \n the file to be tested. + * @brief Filename + * @return Boolean \n TRUE if the file exists, otherwise FALSE. + * @note (see file loadsave.c) + */ +extern bool file_exist(char *buf); + +/** @var game_module + * @brief String + * @note The name of the current game module + */ +extern cptr game_module; + +/* Input */ +/** @fn get_keymap_dir(char ch) + * @brief Get a direction from the keyboard according to the keymap.\n + * @param ch String \n the character representing a direction. + * @brief Direction + * @return Number \n The direction represented by "ch". It will be in the + * range 0 to 9. + * @note + * If "ch" is a number, the number is used. Otherwise the direction is + * chosen from the Original or Rogue keymaps.\n + * If the direction is 5, it is set to 0. + * @note (see file util.c) + */ +extern int get_keymap_dir(char ch); + +/* + * Timers + */ +/** @struct timer_type + */ +struct timer_type +{ + /** @structvar *next + * @brief timer_type + * @note The next timer in the list + */ + timer_type *next; + + /** @structvar enabled + * @brief Boolean + * @note Is it currently counting? + */ + bool enabled; + + /** @structvar delay + * @brief Number + * @note Delay between activations + */ + s32b delay; + /** @structvar countdown + * @brief Number + * @note The current number of turns passed, when it reaches delay it fires + */ + s32b countdown; + + /** @structvar callback + * @brief String + * @note The lua function to call upon firing(no C callback yet .. maybe) + */ + cptr callback; +}; + +/** @fn *new_timer(cptr callback, s32b delay) + * @brief Create a timer with callback "callback" and delay "delay".\n + * @param callback String \n the callback associated with the timer. + * @brief Callback + * @param delay Number \n the delay associated with the timer. + * @brief Delay + * @return timer_type \n The new timer. + * @note + * The timer's countdown is also set to "delay". The timer is disabled. + * @note (see file util.c) + */ +extern timer_type *new_timer(cptr callback, s32b delay); + +/** @fn del_timer(timer_type *t_ptr) + * @brief Delete timer "t_ptr".\n + * @param *t_ptr timer_type \n the timer to be deleted. + * @brief Timer + * @note (see file util.c) + */ +extern void del_timer(timer_type *t_ptr); + +/* + * Lists + */ +/** @struct list_type + */ +struct list_type +{ +}; + +/** @fn create_list(int size); + * @dgonly + * @brief Create an empty list big enough to store "size" strings.\n + * @param size Number \n the number of strings the list will hold. + * @brief List size + * @return list_type \n The empty list. + * @note (see file lua_bind.c) + */ +extern list_type *lua_create_list@create_list(int size); + +/** @fn delete_list(list_type *, int size); + * @dgonly + * @brief Delete the list of strings.\n + * @param * list_type \n the list of strings. + * @brief List + * @param size Number \n the number of strings the list holds. + * @brief List size + * @note + * All the strings in the list are deleted first, then the list is deleted. + * @note (see file lua_bind.c) + */ +extern void lua_delete_list@delete_list(list_type *, int size); + +/** @fn add_to_list(list_type *, int idx, cptr str); + * @dgonly + * @brief Add string "str" to list in position "idx".\n + * @param * list_type \n the list of strings. + * @brief List + * @param idx Number \n the index of the list where the string will be added. + * @brief Index + * @param str String \n the string to be added. + * @brief String + * @note + * Too bad if there was something in that position already. + * You have been warned. + * @note (see file lua_bind.c) + */ +extern void lua_add_to_list@add_to_list(list_type *, int idx, cptr str); + +/** @fn display_list(int y, int x, int h, int w, cptr title, list_type *list, int max, int begin, int sel, byte sel_color); + * @dgonly + * @brief Display a scrollable boxed list with a selected item.\n + * @param y Number \n the y-coordinate of the top-left corner of the box. + * @brief Top-left y-coordinate + * @param x Number \n the x-coordinate of the top-left corner of the box. + * @brief Top-left x-coordinate + * @param h Number \n the height of the box. + * @brief Height + * @param w Number \n the width of the box. + * @brief Width + * @param title String \n the title for the list box. + * @brief Title + * @param *list list_type \n the list of strings to be displayed. + * @brief List + * @param max Number \n the maximum number of strings to display. + * @brief Maximum displayed strings + * @param begin Number \n the index of the first string to display. + * @brief Start index + * @param sel Number \n the index of the selected string. + * @brief Selected index + * @param sel_color Number \n the colour of the selected string. + * @brief Selected colour + * @note + * The title of the list is displayed in TERM_L_BLUE and the unselected strings + * are displayed in TERM_WHITE. + * @note (see file util.c) + */ +extern void lua_display_list@display_list(int y, int x, int h, int w, cptr title, list_type *list, int max, int begin, int sel, byte sel_color); + +extern errr file_character(cptr name, bool full); +extern void calc_bonuses(bool silent); + +extern void note_spot(int y, int x); +extern void lite_spot(int y, int x); diff --git a/PKGS/z_pack.pkg b/PKGS/z_pack.pkg new file mode 100644 index 0000000..c2582e4 --- /dev/null +++ b/PKGS/z_pack.pkg @@ -0,0 +1,693 @@ +/* File: z_pack.pkg */ + +/* + * Purpose: Lua interface defitions for z-*.c + * To be processed by tolua to generate C source code. + */ + +$#include "angband.h" + +/** @typedef cptr + * @note String + */ +typedef char* cptr; +/** @typedef errr + * @note Number + */ +typedef int errr; +/** @typedef bool + * @note Boolean + */ +typedef unsigned char bool; +/** @typedef byte + * @note Number + */ +typedef unsigned char byte; +/** @typedef s16b + * @note Number + */ +typedef signed short s16b; +/** @typedef u16b + * @note Number + */ +typedef unsigned short u16b; +/** @typedef s32b + * @note Number + */ +typedef signed int s32b; +/** @typedef u32b + * @note Number + */ +typedef unsigned int u32b; + +/** @name Terminal actions + * @{ */ +/** @def TERM_XTRA_EVENT + * @note Process some pending events + */ +#define TERM_XTRA_EVENT 1 +/** @def TERM_XTRA_FLUSH + * @note Flush all pending events + */ +#define TERM_XTRA_FLUSH 2 +/** @def TERM_XTRA_CLEAR + * @note Clear the entire window + */ +#define TERM_XTRA_CLEAR 3 +/** @def TERM_XTRA_SHAPE + * @note Set cursor shape (optional) + */ +#define TERM_XTRA_SHAPE 4 +/** @def TERM_XTRA_FROSH + * @note Flush one row (optional) + */ +#define TERM_XTRA_FROSH 5 +/** @def TERM_XTRA_FRESH + * @note Flush all rows (optional) + */ +#define TERM_XTRA_FRESH 6 +/** @def TERM_XTRA_NOISE + * @note Make a noise (optional) + */ +#define TERM_XTRA_NOISE 7 +/** @def TERM_XTRA_SOUND + * @note Make a sound (optional) + */ +#define TERM_XTRA_SOUND 8 +/** @def TERM_XTRA_BORED + * @note Handle stuff when bored (optional) + */ +#define TERM_XTRA_BORED 9 +/** @def TERM_XTRA_REACT + * @note React to global changes (optional) + */ +#define TERM_XTRA_REACT 10 +/** @def TERM_XTRA_ALIVE + * @note Change the "hard" level (optional) + */ +#define TERM_XTRA_ALIVE 11 +/** @def TERM_XTRA_LEVEL + * @note Change the "soft" level (optional) + */ +#define TERM_XTRA_LEVEL 12 +/** @def TERM_XTRA_DELAY + * @note Delay some milliseconds (optional) + */ +#define TERM_XTRA_DELAY 13 +/** @def TERM_XTRA_GET_DELAY + * @note Get the cuyrrent time in milliseconds (optional) + */ +#define TERM_XTRA_GET_DELAY 14 +/** @def TERM_XTRA_SCANSUBDIR + * @note Scan for subdir in a dir + */ +#define TERM_XTRA_SCANSUBDIR 15 +/** @} */ + +/** @var Term_xtra_long + * @brief Number + */ +extern long Term_xtra_long; + +/** @var scansubdir_dir[1024] + * @brief String + * @note The directory which is scanned for sub-directories. + */ +char scansubdir_dir[1024]; + +/** @var scansubdir_max + * @brief Number + * @note The number of entries in the scansubdir_result array. + */ +int scansubdir_max; + +/** @var scansubdir_result[scansubdir_max] + * @brief String + * @note The sub-directories of scansubdir_dir directory. + */ +cptr scansubdir_result[scansubdir_max]; + +/** @fn Term_xtra(int n, int v) + * @brief Generic function to perform system dependant terminal actions.\n + * @param n Number \n a terminal action (see TERM_XTRA fields). + * @brief Terminal action + * @param v Number \n variable depending on the terminal action. + * @brief Variable + * @return Number \n Result of the terminal action. + * @note + * The "Term->xtra_hook" hook provides a variety of different functions, + * based on the first parameter (which should be taken from the various + * TERM_XTRA_* defines) and the second parameter (which may make sense + * only for some first parameters). It is available to the program via + * the "Term_xtra()" function, though some first parameters are only + * "legal" when called from inside this package. + * @note (see file z-term.c) + */ +extern errr Term_xtra(int n, int v); + +/** @fn Term_set_cursor(int v) + * @brief Set the cursor visibility.\n + * @param v Number \n v is the visibility. + * @brief Visibility + * @return Number \n 1 if visibility was unchanged, otherwise 0. + * @note + * Cursor visibility (field "cv") is defined as a boolean, so take care what + * value is assigned to "v". + * @note (see file z-term.c) + */ +extern errr Term_set_cursor(int v); + +/** @fn Term_gotoxy(int x, int y) + * @brief Place the cursor at a given location.\n + * @param x Number \n x-coordinate of target location. + * @brief X-coordinate + * @param y Number \n y-coordinate of target location. + * @brief Y-coordinate + * @return Number \n -1 if cursor could not be placed at given location, + * otherwise 0. + * @note + * Note -- "illegal" requests do not move the cursor.\n\n + * The cursor is flagged as useful if it placed okay. + * @note (see file z-term.c) + */ +extern errr Term_gotoxy(int x, int y); + +/** @fn Term_putch(int x, int y, byte a, char c) + * @brief Move to a location and, using an attr, add a char.\n + * @param x Number \n x-coordinate of target location. + * @brief X-coordinate + * @param y Number \n y-coordinate of target location. + * @brief Y-coordinate + * @param a Number \n attribute of character. + * @brief Attribute + * @param c String \n the character. + * @brief Character + * @return Number \n <0 if error, 0 if success, 1 if success but cursor is + * useless. + * @note + * We return "-2" if the character is "illegal". XXX XXX\n\n + * We return "-1" if the cursor is currently unusable.\n\n + * We queue the given attr/char for display at the current + * cursor location, and advance the cursor to the right, + * marking it as unuable and returning "1" if it leaves + * the screen, and otherwise returning "0".\n\n + * So when this function returns a positive value, future calls to this + * function will return negative ones. + * @note (see file z-term.c) + */ +extern errr Term_putch(int x, int y, byte a, char c); + +/** @fn Term_putstr(int x, int y, int n, byte a, cptr s) + * @brief Move to a location and, using an attr, add a string.\n + * @param x Number \n x-coordinate of target location. + * @brief X-coordinate + * @param y Number \n y-coordinate of target location. + * @brief Y-coordinate + * @param n Number \n length of string. + * @brief Length + * @param a Number \n attribute of string. + * @brief Attribute + * @param s String \n the string. + * @brief String + * @return Number \n <0 if error, 0 if success, 1 if success but cursor is + * useless. + * @note + * For length "n", using negative values to imply the largest possible value, + * and then we use the minimum of this length and the "actual" length of the + * string as the actual number of characters to attempt to display, never + * displaying more characters than will actually fit, since we do NOT attempt + * to "wrap" the cursor at the screen edge.\n\n + * We return "-1" if the cursor is currently unusable.\n + * We return "N" if we were "only" able to write "N" chars, even if all of the + * given characters fit on the screen, and mark the cursor as unusable for + * future attempts.\n\n + * So when this function, returns a positive value, future calls to this + * function will return negative ones. + * @note (see file z-term.c) + */ +extern errr Term_putstr(int x, int y, int n, byte a, cptr s); + +/** @fn Term_clear(void) + * @brief Clear the entire window, and move to the top left corner. + * @return Number \n 0 (always). + * @note + * Note the use of the special "total_erase" code + * @note (see file z-term.c) + */ +extern errr Term_clear(void); + +/** @fn Term_redraw(void) + * @brief Redraw (and refresh) the whole window. + * @return Number \n 0 (always). + * @note (see file z-term.c) + */ +extern errr Term_redraw(void); + +/** @fn Term_redraw_section(int x1, int y1, int x2, int y2) + * @brief Redraw part of a window.\n + * @param x1 Number \n x-coordinate of top-left location. + * @brief X-coordinate (top left) + * @param y1 Number \n y-coordinate of top-left location. + * @brief Y-coordinate (top left) + * @param x2 Number \n x-coordinate of bottom-right location. + * @brief X-coordinate (bottom right) + * @param y2 Number \n y-coordinate of bottom-right location. + * @brief Y-coordinate (bottom right) + * @return Number \n 0 (always). + * @note (see file z-term.c) + */ +extern errr Term_redraw_section(int x1, int y1, int x2, int y2); + +/** @fn Term_get_size(int *w, int *h) + * @brief Extract the current window size.\n + * @param *w Number + * @brief Screen width + * @param *h Number + * @brief Screen height + * @return Number \n 0 (always). + * @return *w Number \n The width of the screen (in characters). + * @return *h Number \n The height of the screen (in characters). + * @note (see file z-term.c) + */ +extern errr Term_get_size(int *w, int *h); + +/* + * random numbers + */ +$static s32b lua_rand_int(s32b m) {return rand_int(m);} + +/** @fn rand_int(s32b m); + * @brief Generate a random integer between 0 and (m - 1).\n + * @param m Number \n maximum value of random integer. The random integer + * will be less than "m". + * @brief Maximum + * @return Number \n The random number. + * @note (see file w_z_pack.c) + */ +static s32b lua_rand_int @ rand_int(s32b m); + +/* + * Generates a random long integer X where A<=X<=B + * The integer X falls along a uniform distribution. + * Note: rand_range(0,N-1) == rand_int(N) + */ +$static s32b lua_rand_range(s32b A, s32b B) {return ((A) + (rand_int(1+(B)-(A))));} + +/** @fn rand_range(s32b A, s32b B); + * @brief Generate a random integer between A and B inclusive.\n + * @param A Number \n minimum number. + * @brief Minimum + * @param B Number \n maximum number. + * @brief Maximum + * @return Number \n The random number. + * @note (see file w_z_pack.c) + */ +static s32b lua_rand_range @ rand_range(s32b A, s32b B); + +/* + * Generate a random long integer X where A-D<=X<=A+D + * The integer X falls along a uniform distribution. + * Note: rand_spread(A,D) == rand_range(A-D,A+D) + */ +$static s32b lua_rand_spread(s32b A, s32b D) {return ((A) + (rand_int(1+(D)+(D))) - (D));} + +/** @fn rand_spread(s32b A, s32b D); + * @brief Generate a radom integer between A-D and A+D inclusive.\n + * @param A Number \n average number. + * @brief Average + * @param D Number \n deviation from average. + * @brief Deviation + * @return Number \n The random number. + * @note (see file w_z_pack.c) + */ +static s32b lua_rand_spread @ rand_spread(s32b A, s32b D); + + +/* + * Generate a random long integer X where 1<=X<=M + * Also, "correctly" handle the case of M<=1 + */ +$static s32b lua_randint(s32b m) {return rand_int(m) + 1;} + +/** @fn randint(s32b m); + * @brief Generate a random integer between 1 and M inclusive.\n + * @param m Number \n maximum value of random integer. + * @brief Maximum + * @return Number \n The random number. + * @note (see file w_z_pack.c) + */ +static s32b lua_randint @ randint(s32b m); + + +/* + * Evaluate to TRUE "P" percent of the time + */ +$static bool lua_magik(s32b P) {return (rand_int(100) < (P));} + +/** @fn magik(s32b P); + * @brief Return TRUE "P" % of the time. + * @param P Number \n percent chance the function returns TRUE. + * @brief Percent true + * @return Boolean \n TRUE if a random number from 0 to 99 is less than P, + * otherwise FALSE. + * @note (see file w_z_pack.c) + */ +static bool lua_magik @ magik(s32b P); + + +/**** Available Variables ****/ +/** @var Rand_quick + * @brief Boolean + * @note + * If this is TRUE, then use the "simple" Random Number Generator.\n + * If this is FALSE, then use the "complex" Random Number Generator. + */ +extern bool Rand_quick; + +/** @var Rand_value + * @brief Number + * @note + * The current value (seed) of the simple Random Number Generator. + */ +extern u32b Rand_value; + +/**** Available Functions ****/ +/** @fn damroll(int num, int sides) + * @brief Generates damage for "2d6" style dice rolls.\n + * @param num Number \n the number of "dice" used. + * @brief Number + * @param sides Number \n the number of sides on each "die". + * @brief Sides + * @return Number \n The random number. + * @note + * The function simulates the rolling of "num" "sides"-sided dice. Each die + * will result in a random number from 1 to "sides". + * @note (see file z-rand.c) + */ +extern s16b damroll(int num, int sides); + +/** @fn maxroll(int num, int sides) + * @brief Generate the maximum damage for "num" dice with "sides" sides each. + * @param num Number \n The number of "dice" used. + * @brief Number + * @param sides Number \n The number of sides on each "die". + * @brief Sides + * @return Number \n "num" * "sides". + * @note (see file z-rand.c) + */ +extern s16b maxroll(int num, int sides); + + + + + +/* + ****************** ZSOCKS *************** + */ + +/** @struct ip_connection + * This represents an IP connection + */ +struct ip_connection +{ + /** @var setup + * @brief Boolean + * @note Has it been setted up yet? + */ + bool setup; + + /** @var conn_ip + * @brief Number + * @note The IP where to connect to + */ + long conn_ip; + + /** @var conn_port + * @brief Number + * @note The port where to connect to + */ + int conn_port; + + /** @var conn_type + * @brief Number + * @note Type of connection + */ + byte conn_type; + + /** @var connected + * @brief Boolean + * @note The connection status + */ + bool connected; + + /** @var *socket + * @brief void + * @note The socket for the connection + */ + void *socket; + + /** @var server + * @brief Boolean + * @note Is it a server socket ? + */ + bool server; +}; + +/* + * Possible connection types + */ +/** @def ZSOCK_TYPE_TCP */ +#define ZSOCK_TYPE_TCP 1 + +/* #define ZSOCK_TYPE_UDP 2 */ + + +/** @def ZSOCK_TIMER_DELAY + * @note The time in milliseconds when to call the sockets callbacks for the + * timer + */ +#define ZSOCK_TIMER_DELAY 100 + + +/** @struct zsock_hooks + * @note Hooks needed for a main-foo.c to be sock-able + */ +struct zsock_hooks +{ + /** @fn *new_connection() + * @brief Creates an IP connection. + * @return ip_connection \n An IP connection. + * @note (see file z-sock.c) + */ + ip_connection *new_connection(); + + /** @fn free_connection(ip_connection *c) + * @brief Free IP connection "c".\n + * @param *c ip_connection \n an IP connection. + * @brief Ip connection + * @note (see file z-sock.c) + */ + void free_connection(ip_connection *c); + + /** @fn setup(ip_connection *conn, cptr conn_ip, int port, byte conn_type, bool server) + * @brief Setup a connection, but do NOT connect.\n + * @param *conn ip_connection \n an IP connection. + * @brief Ip connection + * @param conn_ip String \n IP address of host machine. + * @brief Host ip address + * @param port Number \n port of host machine. + * @brief Host port + * @param conn_type Number \n type of connection. + * @brief Connection type + * @param server Boolean \n TRUE if this is a server socket, + * otherwise FALSE. + * @brief Server socket? + * @return Boolean \n TRUE if socket setup successfully, otherwise FALSE. + * @note + * You can not setup a connection if it is setup. + * @note (see file z-sock.c) + */ + bool setup(ip_connection *conn, cptr conn_ip, int port, byte conn_type, bool server); + + /** @fn unsetup(ip_connection *conn) + * @brief Unsetup a connection, but and DO close before if needed.\n + * @param *conn ip_connection \n an IP connection. + * @brief Ip connection + * @return Boolean \n TRUE if socket was setup, otherwise FALSE. + * @note + * You can not unset a connection if it is not setup. + * @note (see file z-sock.c) + */ + bool unsetup(ip_connection *conn); + + /** @fn open(ip_connection *conn) + * @brief Open(connect) a well setup-ed connection.\n + * @param *conn ip_connection \n an IP connection. + * @brief Ip connection + * @return Boolean \n TRUE if connection was opened, otherwise FALSE. + * @note + * You can not open a connection if it is open. + * @note (see file z-sock.c) + */ + bool open(ip_connection *conn); + + /** @fn close(ip_connection *conn) + * @brief Close a connected connection.\n + * @param *conn ip_connection \n an IP connection. + * @brief Ip connection + * @return Boolean \n TRUE if connection was closed, otherwise FALSE. + * @note + * You can not close a connection if it is closed. + * @note (see file z-sock.c) + */ + bool close(ip_connection *conn); + + /** @fn write(ip_connection *conn, cptr str, int *size) + * @brief Send data on the connection.\n + * @param *conn ip_connection \n an IP connection. + * @brief Ip connection + * @param str String \n the string to send along the connection. + * @brief String + * @param *size Number + * @brief Bytes sent + * @return Boolean \n TRUE if string was sent successfully, + * otherwise FALSE. + * @return *size \n the number of bytes sent. + * @note + * This function will return FALSE if you write to a connection which + * is not connected, or if the connection has died. + * @note (see file z-sock.c) + */ + bool write(ip_connection *conn, cptr str, int *size); + + /* Read data on the connection */ + /** @fn read(ip_connection *conn, char *str, int *len, bool raw) + * @brief Read data on connection.\n + * @param *conn ip_connection \n an IP connection. + * @brief Ip connection + * @param *str String + * @brief String + * @param *len Number \n the number of bytes to read. + * @brief Bytes to read + * @param raw Boolean \n TRUE if all data is to be read at once, + * otherwise FALSE. + * @brief Read raw data? + * @return Boolean \n TRUE if a string was returned, otherwise FALSE. + * @return *str String \n The string read. + * @return *len Number \n The number of bytes read. + * @note + * @note (see file z-sock.c) + */ + /* -- DG -- This is done in script.c since it needs a specific wrapper :( + bool read(ip_connection *conn, char *str, int *len, bool raw); + */ + + /** @fn write_simple(ip_connection *conn, cptr str) + * @brief Send data on the connection.\n + * @param *conn ip_connection \n an IP connection. + * @brief Ip connection + * @param str String \n the string to send along the connection. + * @brief String + * @return Boolean \n TRUE if string was sent successfully, + * otherwise FALSE. + * @note + * This is easy to use. + * @note (see file z-sock.c) + */ + bool write_simple(ip_connection *conn, cptr str); + + /* Read data on the connection -- easy to use */ + /** @fn read_simple(ip_connection *conn, char *str, int len) + * @brief Read data on the connection.\n + * @param *conn ip_connection \n an IP connection. + * @brief Ip connection + * @param *str String + * @brief String + * @param len Number \n the number of bytes to read. + * @brief Bytes to read + * @return Boolean \n TRUE if a string was returned, otherwise FALSE. + * @return *str String \n The string read. + * @note + * This function will return FALSE if you read from a connection which + * is not connected, or if the connection has died. + * @note (see file z-sock.c) + */ + bool read_simple(ip_connection *conn, char *str, int len); + + /* Accept a connection */ + /** @fn accept(ip_connection *conn, ip_connection *child) + * @brief Allow "conn" to accept a connection from "child".\n + * @param *conn ip_connection \n an IP connection. + * @brief Parent ip connection + * @param *child ip_connection \n another IP connection. + * @brief Child ip connection + * @return Boolean \n TRUE if child socket was accepted, otherwise + * FALSE. + * @note + * "conn" must be a server and must be connected. + * @note (see file z-sock.c) + */ + bool accept(ip_connection *conn, ip_connection *child); + + /** @fn can_read(ip_connection *conn) + * @brief Check if there is any data to be read and return instantly + * in any case.\n + * @param *conn ip_connection \n an IP connection. + * @brief Ip connection + * @return Boolean \n TRUE if there is something to read, otherwise + * FALSE. + * @note + * This function will return FALSE if you read from a connection which + * is not connected. + * @note (see file z-sock.c) + */ + bool can_read(ip_connection *conn); + + /** @fn wait(ip_connection *conn, int seconds) + * @brief Wait for up to "seconds" seconds for data to read from + * "conn".\n + * @param *conn ip_connection \n an IP connection. + * @brief Ip connection + * @param seconds Number \n number of seconds to wait for something to + * read. + * @brief Seconds to wait + * @return Boolean TRUE if there is something to read, otherwise + * FALSE. + * @note + * This function will return FALSE if you wait for a connection which + * is not connected. + * @note (see file z-sock.c) + */ + bool wait(ip_connection *conn, int seconds); + + + /* + * Timer stuff, I hope I can make that look better + */ + /** @fn add_timer(timer_callback callback) + * @brief Add "callback" to the list.\n + * @param callback timer_callback \n a callback timer. + * @brief Callback + * @return Boolean \n TRUE (always). + * @note + * If this is the first callback, the timer will be created. + * @note (see file z-sock.c) + */ + bool add_timer(timer_callback callback); + + /** @fn remove_timer(timer_callback callback) + * @brief Remove "callback" from the list.\n + * @param callback timer_callback \n a callback timer. + * @brief Callback + * @return Boolean \n TRUE (always). + * @note + * If this is the last callback, the timer will be deleted. + * @note (see file z-sock.c) + */ + bool remove_timer(timer_callback callback); +}; + +/** @var zsock + * @brief zsock_hooks + */ +extern zsock_hooks zsock; diff --git a/readme.txt b/readme.txt index 532335e..3763712 100644 --- a/readme.txt +++ b/readme.txt @@ -24,4 +24,6 @@ Extract OldSourceFiles.zip The files in this are not up to date, so replace them with current files from the project, then compile with the appropriate makefile. +Also copy the .pkg files in the PKGS directory to said folder before running the make file. + After compiling, extract files and folders from FurybandData.zip such that furyband.ini is on the same directory level as your compiled binary. From e7939bccb7fa2ed749179902b18475dc408f58c9 Mon Sep 17 00:00:00 2001 From: mariari Date: Wed, 12 Jan 2022 22:52:42 -0600 Subject: [PATCH 4/4] Update monster.pkg to conform to defines.h and use RF8 and not RF3 --- PKGS/monster.pkg | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PKGS/monster.pkg b/PKGS/monster.pkg index a9efd08..627db04 100644 --- a/PKGS/monster.pkg +++ b/PKGS/monster.pkg @@ -266,11 +266,11 @@ static monster_type lua_monster_forge @ monster_forge; /** @def RF2_AURA_FIRE * @note Burns in melee */ -#define RF2_AURA_FIRE 0x00004000 +#define RF8_AURA_FIRE 0x00040000 /** @def RF2_AURA_ELEC * @note Shocks in melee */ -#define RF2_AURA_ELEC 0x00008000 +#define RF8_AURA_ELEC 0x00080000 /** @def RF2_OPEN_DOOR * @note Monster can open doors */ @@ -374,7 +374,7 @@ static monster_type lua_monster_forge @ monster_forge; /** @def RF3_AURA_COLD * @note Freezes in melee */ -#define RF3_AURA_COLD 0x00000400 +#define RF8_AURA_COLD 0x00100000 /** @def RF3_NONLIVING * @note TY: Non-Living (?) */