summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/defines.h1
-rw-r--r--src/dungeon.c9
-rw-r--r--src/externs.h16
-rw-r--r--src/loadsave.c2
-rw-r--r--src/player.pkg1
-rw-r--r--src/spells.pkg14
-rw-r--r--src/spells3.c123
-rw-r--r--src/types.h1
-rw-r--r--src/util.pkg6
-rw-r--r--src/variable.c5
-rw-r--r--src/xtra1.c2
-rw-r--r--src/xtra2.c11
12 files changed, 172 insertions, 19 deletions
diff --git a/src/defines.h b/src/defines.h
index 57c4c674..b4a02a11 100644
--- a/src/defines.h
+++ b/src/defines.h
@@ -4493,7 +4493,6 @@
#define HOOK_LEVEL_REGEN 42
#define HOOK_LEVEL_END_GEN 43
#define HOOK_BUILDING_ACTION 44
-#define HOOK_PROCESS_WORLD 45
#define HOOK_WIELD_SLOT 46
#define HOOK_STORE_STOCK 47
#define HOOK_STORE_BUY 48
diff --git a/src/dungeon.c b/src/dungeon.c
index b23a4829..e60f1ef0 100644
--- a/src/dungeon.c
+++ b/src/dungeon.c
@@ -1325,9 +1325,6 @@ static void process_world(void)
*/
if (dun_level || (!p_ptr->wild_mode))
{
- /* Let the script live! */
- process_hooks(HOOK_PROCESS_WORLD, "()");
-
/* Handle corruptions */
process_world_corruptions();
@@ -2150,6 +2147,12 @@ static void process_world(void)
(void)set_tim_breath(p_ptr->tim_magic_breath - 1, TRUE);
}
+ /* Timed precognition */
+ if (p_ptr->tim_precognition > 0)
+ {
+ set_tim_precognition(p_ptr->tim_precognition - 1);
+ }
+
/* Timed regen */
if (p_ptr->tim_regen)
{
diff --git a/src/externs.h b/src/externs.h
index 06e0ec76..233f7ea3 100644
--- a/src/externs.h
+++ b/src/externs.h
@@ -594,7 +594,6 @@ extern s32b DUNGEON_ASTRAL_WILD_X;
extern s32b DUNGEON_ASTRAL_WILD_Y;
extern deity_type deity_info[MAX_GODS];
extern timer_type *gl_timers;
-extern s16b tim_precognition;
extern const char *get_version_string();
/* plots.c */
@@ -1855,6 +1854,20 @@ char *aule_enchant_armour_info();
bool_ *aule_child_spell();
char *aule_child_info();
+extern s32b MANDOS_TEARS_LUTHIEN;
+extern s32b MANDOS_SPIRIT_FEANTURI;
+extern s32b MANDOS_TALE_DOOM;
+extern s32b MANDOS_CALL_HALLS;
+
+bool_ *mandos_tears_of_luthien_spell();
+char *mandos_tears_of_luthien_info();
+bool_ *mandos_spirit_of_the_feanturi_spell();
+char *mandos_spirit_of_the_feanturi_info();
+bool_ *mandos_tale_of_doom_spell();
+char *mandos_tale_of_doom_info();
+bool_ *mandos_call_to_the_halls_spell();
+char *mandos_call_to_the_halls_info();
+
/* randart.c */
extern int get_activation_power(void);
extern void build_prob(cptr learn);
@@ -2021,6 +2034,7 @@ extern bool_ set_disrupt_shield(int v);
extern bool_ set_prob_travel(int v);
extern bool_ set_absorb_soul(int v);
extern bool_ set_tim_breath(int v, bool_ magical);
+extern bool_ set_tim_precognition(int v);
extern bool_ set_tim_deadly(int v);
extern bool_ set_tim_res_time(int v);
extern bool_ set_tim_reflect(int v);
diff --git a/src/loadsave.c b/src/loadsave.c
index ad982e8d..40718194 100644
--- a/src/loadsave.c
+++ b/src/loadsave.c
@@ -513,7 +513,7 @@ static bool_ do_extra(int flag)
do_s16b(&p_ptr->blessed, flag);
do_s16b(&p_ptr->control, flag);
do_byte(&p_ptr->control_dir, flag);
- do_s16b(&tim_precognition, flag);
+ do_s16b(&p_ptr->tim_precognition, flag);
do_s16b(&p_ptr->tim_thunder, flag);
do_s16b(&p_ptr->tim_thunder_p1, flag);
do_s16b(&p_ptr->tim_thunder_p2, flag);
diff --git a/src/player.pkg b/src/player.pkg
index fdde5229..9115d7cf 100644
--- a/src/player.pkg
+++ b/src/player.pkg
@@ -2633,7 +2633,6 @@ extern void apply_flags(u32b f1, u32b f2, u32b f3, u32b f4, u32b f5, u32b esp, s
/**
* Timered precognition
*/
-extern s16b tim_precognition;
/** @fn set_tim_thunder(int v, int p1, int p2)
diff --git a/src/spells.pkg b/src/spells.pkg
index ac17116b..1b253e12 100644
--- a/src/spells.pkg
+++ b/src/spells.pkg
@@ -2858,3 +2858,17 @@ bool_ *aule_enchant_armour_spell();
char *aule_enchant_armour_info();
bool_ *aule_child_spell();
char *aule_child_info();
+
+extern s32b MANDOS_TEARS_LUTHIEN;
+extern s32b MANDOS_SPIRIT_FEANTURI;
+extern s32b MANDOS_TALE_DOOM;
+extern s32b MANDOS_CALL_HALLS;
+
+bool_ *mandos_tears_of_luthien_spell();
+char *mandos_tears_of_luthien_info();
+bool_ *mandos_spirit_of_the_feanturi_spell();
+char *mandos_spirit_of_the_feanturi_info();
+bool_ *mandos_tale_of_doom_spell();
+char *mandos_tale_of_doom_info();
+bool_ *mandos_call_to_the_halls_spell();
+char *mandos_call_to_the_halls_info();
diff --git a/src/spells3.c b/src/spells3.c
index 15f101de..355d94e4 100644
--- a/src/spells3.c
+++ b/src/spells3.c
@@ -152,6 +152,11 @@ s32b AULE_ENCHANT_WEAPON;
s32b AULE_ENCHANT_ARMOUR;
s32b AULE_CHILD;
+s32b MANDOS_TEARS_LUTHIEN = -1;
+s32b MANDOS_SPIRIT_FEANTURI = -1;
+s32b MANDOS_TALE_DOOM = -1;
+s32b MANDOS_CALL_HALLS = -1;
+
/* FIXME: Hackish workaround while we're still tied to Lua. This lets
us return Lua's "nil" and a non-nil value (which is all the s_aux.lua
@@ -4421,3 +4426,121 @@ char *aule_child_info()
20 + get_level_s(AULE_CHILD, 70));
return buf;
}
+
+static int tears_of_luthien_hp()
+{
+ return 10 * get_level_s(MANDOS_TEARS_LUTHIEN, 30);
+}
+
+bool_ *mandos_tears_of_luthien_spell()
+{
+ hp_player(tears_of_luthien_hp());
+ set_stun(0);
+ set_cut(0);
+ set_afraid(0);
+ return CAST;
+}
+
+char *mandos_tears_of_luthien_info()
+{
+ static char buf[128];
+ sprintf(buf,
+ "heals %d",
+ tears_of_luthien_hp());
+ return buf;
+}
+
+bool_ *mandos_spirit_of_the_feanturi_spell()
+{
+ s32b level = get_level_s(MANDOS_SPIRIT_FEANTURI, 50);
+
+ set_afraid(0);
+ set_confused(0);
+
+ if (level >= 20)
+ {
+ do_res_stat(A_WIS, TRUE);
+ do_res_stat(A_INT, TRUE);
+ }
+
+ if (level >= 30)
+ {
+ set_image(0);
+ heal_insanity(p_ptr->msane * level / 100);
+ }
+
+ return CAST;
+}
+
+char *mandos_spirit_of_the_feanturi_info()
+{
+ static char buf[128];
+ s32b level = get_level_s(MANDOS_SPIRIT_FEANTURI, 50) ;
+ if (level >= 20)
+ {
+ sprintf(buf, "heals " FMTs32b "%%", level);
+ return buf;
+ }
+ else
+ {
+ return "";
+ }
+}
+
+static int tale_of_doom_duration()
+{
+ return 5 + get_level_s(MANDOS_TALE_DOOM,10);
+}
+
+bool_ *mandos_tale_of_doom_spell()
+{
+ set_tim_precognition(tale_of_doom_duration());
+ return CAST;
+}
+
+char *mandos_tale_of_doom_info()
+{
+ static char buf[128];
+ sprintf(buf,
+ "dur %d",
+ tale_of_doom_duration());
+ return buf;
+}
+
+int call_to_the_halls_mlev()
+{
+ return 20 + get_level(MANDOS_CALL_HALLS, 70, 0);
+}
+
+bool_ *mandos_call_to_the_halls_spell()
+{
+#define N_SUMMONS 2
+ int y, x;
+ s16b m_idx, r_idx;
+ s16b summons[N_SUMMONS] = {
+ test_monster_name("Experienced spirit"),
+ test_monster_name("Wise spirit"),
+ };
+
+ r_idx = summons[rand_int(N_SUMMONS)];
+ assert(r_idx >= 0);
+
+ find_position(p_ptr->py, p_ptr->px, &y, &x);
+ m_idx = place_monster_one(y, x, r_idx, 0, FALSE, MSTATUS_FRIEND);
+ if (m_idx)
+ {
+ monster_set_level(m_idx, call_to_the_halls_mlev());
+ return CAST;
+ }
+ return NO_CAST;
+#undef N_SUMMONS
+}
+
+char *mandos_call_to_the_halls_info()
+{
+ static char buf[128];
+ sprintf(buf,
+ "level %d",
+ call_to_the_halls_mlev());
+ return buf;
+}
diff --git a/src/types.h b/src/types.h
index 6066e215..8d12fa68 100644
--- a/src/types.h
+++ b/src/types.h
@@ -1587,6 +1587,7 @@ struct player_type
s16b absorb_soul; /* Timed soul absordtion */
s16b tim_magic_breath; /* Magical breathing -- can breath anywhere */
s16b tim_water_breath; /* Water breathing -- can breath underwater */
+ s16b tim_precognition; /* Timed precognition */
s16b immov_cntr; /* Timed -- Last ``immovable'' command. */
diff --git a/src/util.pkg b/src/util.pkg
index e6f0294f..2ec70acf 100644
--- a/src/util.pkg
+++ b/src/util.pkg
@@ -524,12 +524,6 @@ typedef unsigned int u32b;
*/
#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.
diff --git a/src/variable.c b/src/variable.c
index 11019a22..105bbc7f 100644
--- a/src/variable.c
+++ b/src/variable.c
@@ -1574,11 +1574,6 @@ s32b DUNGEON_ASTRAL_WILD_Y = 19;
*/
timer_type *gl_timers = NULL;
-/*
- * Timered precognition.
- */
-s16b tim_precognition = 0;
-
/**
* Get the version string.
diff --git a/src/xtra1.c b/src/xtra1.c
index c20b9036..f393635f 100644
--- a/src/xtra1.c
+++ b/src/xtra1.c
@@ -3336,7 +3336,7 @@ void calc_bonuses(bool_ silent)
}
/* Temporary precognition */
- if (tim_precognition > 0)
+ if (p_ptr->tim_precognition > 0)
{
apply_flags(0, 0, 0, TR4_PRECOGNITION, 0, 0, 0, 0, 0, 0, 0);
}
diff --git a/src/xtra2.c b/src/xtra2.c
index 7958827b..d78858b3 100644
--- a/src/xtra2.c
+++ b/src/xtra2.c
@@ -241,6 +241,17 @@ bool_ set_tim_breath(int v, bool_ magical)
}
/*
+ * Set timered precognition
+ */
+bool_ set_tim_precognition(int v)
+{
+ return set_simple_field(
+ &p_ptr->tim_precognition, v,
+ TERM_WHITE, "You feel able to predict the future.",
+ TERM_WHITE, "You feel less able to predict the future.");
+}
+
+/*
* Set "p_ptr->absorb_soul"
* notice observable changes
*/