summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2012-04-12 20:57:46 +0200
committerBardur Arantsson <bardur@scientician.net>2012-04-13 07:12:25 +0200
commit976ca14dbe8d44b0653927a656d352a1c7de4897 (patch)
tree0c0d90e26a048f6dd88961972f43882e59effe92 /src
parenta8c1bacade298c3166014a287cb5abc61244212b (diff)
Lua: Move "Divination" spell functions to C
Diffstat (limited to 'src')
-rw-r--r--src/externs.h20
-rw-r--r--src/spells.pkg23
-rw-r--r--src/spells3.c163
3 files changed, 206 insertions, 0 deletions
diff --git a/src/externs.h b/src/externs.h
index a7fd0c42..168fd2ab 100644
--- a/src/externs.h
+++ b/src/externs.h
@@ -1470,6 +1470,26 @@ char *demonology_discharge_minion_info();
bool_ *demonology_control_demon();
char *demonology_control_demon_info();
+extern s32b STARIDENTIFY;
+extern s32b IDENTIFY;
+extern s32b VISION;
+extern s32b SENSEHIDDEN;
+extern s32b REVEALWAYS;
+extern s32b SENSEMONSTERS;
+
+bool_ *divination_greater_identify();
+char *divination_greater_identify_info();
+bool_ *divination_identify();
+char *divination_identify_info();
+bool_ *divination_vision();
+char *divination_vision_info();
+bool_ *divination_sense_hidden();
+char *divination_sense_hidden_info();
+bool_ *divination_reveal_ways();
+char *divination_reveal_ways_info();
+bool_ *divination_sense_monsters();
+char *divination_sense_monsters_info();
+
/* randart.c */
extern int get_activation_power(void);
extern void build_prob(cptr learn);
diff --git a/src/spells.pkg b/src/spells.pkg
index 040001ff..5cf18354 100644
--- a/src/spells.pkg
+++ b/src/spells.pkg
@@ -2499,3 +2499,26 @@ bool_ *demonology_discharge_minion();
char *demonology_discharge_minion_info();
bool_ *demonology_control_demon();
char *demonology_control_demon_info();
+
+/*
+ * Divination
+ */
+extern s32b STARIDENTIFY;
+extern s32b IDENTIFY;
+extern s32b VISION;
+extern s32b SENSEHIDDEN;
+extern s32b REVEALWAYS;
+extern s32b SENSEMONSTERS;
+
+bool_ *divination_greater_identify();
+char *divination_greater_identify_info();
+bool_ *divination_identify();
+char *divination_identify_info();
+bool_ *divination_vision();
+char *divination_vision_info();
+bool_ *divination_sense_hidden();
+char *divination_sense_hidden_info();
+bool_ *divination_reveal_ways();
+char *divination_reveal_ways_info();
+bool_ *divination_sense_monsters();
+char *divination_sense_monsters_info();
diff --git a/src/spells3.c b/src/spells3.c
index 3e95c92d..086c6940 100644
--- a/src/spells3.c
+++ b/src/spells3.c
@@ -24,6 +24,13 @@ s32b DEMON_SUMMON;
s32b DISCHARGE_MINION;
s32b CONTROL_DEMON;
+s32b STARIDENTIFY;
+s32b IDENTIFY;
+s32b VISION;
+s32b SENSEHIDDEN;
+s32b REVEALWAYS;
+s32b SENSEMONSTERS;
+
/* 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
cares about). */
@@ -686,3 +693,159 @@ char *demonology_control_demon_info()
(50 + get_level_s(CONTROL_DEMON, 250)));
return buf;
}
+
+bool_ *divination_greater_identify()
+{
+ if (get_check("Cast on yourself?"))
+ {
+ self_knowledge(NULL);
+ }
+ else
+ {
+ identify_fully();
+ }
+ return CAST;
+}
+
+char *divination_greater_identify_info()
+{
+ return "";
+}
+
+bool_ *divination_identify()
+{
+ if (get_level_s(IDENTIFY, 50) >= 27)
+ {
+ identify_pack();
+ fire_ball(GF_IDENTIFY, 0, 1, get_level_s(IDENTIFY, 3));
+ p_ptr->notice |= (PN_COMBINE | PN_REORDER);
+ return CAST;
+ }
+ else if (get_level_s(IDENTIFY, 50) >= 17)
+ {
+ identify_pack();
+ fire_ball(GF_IDENTIFY, 0, 1, 0);
+ p_ptr->notice |= (PN_COMBINE | PN_REORDER);
+ return CAST;
+ }
+ else if (ident_spell() == TRUE)
+ {
+ return CAST;
+ }
+ else
+ {
+ return NO_CAST;
+ }
+}
+
+char *divination_identify_info()
+{
+ static char buf[128];
+
+ if (get_level_s(IDENTIFY, 50) >= 27)
+ {
+ sprintf(buf, "rad %d", get_level_s(IDENTIFY, 3));
+ return buf;
+ }
+ else
+ {
+ return "";
+ }
+}
+
+bool_ *divination_vision()
+{
+ if (get_level_s(VISION, 50) >= 25)
+ {
+ wiz_lite_extra();
+ }
+ else
+ {
+ map_area();
+ }
+ return CAST;
+
+}
+
+char *divination_vision_info()
+{
+ return "";
+}
+
+bool_ *divination_sense_hidden()
+{
+ detect_traps(15 + get_level(SENSEHIDDEN, 40, 0));
+ if (get_level_s(SENSEHIDDEN, 50) >= 15)
+ {
+ set_tim_invis(10 + randint(20) + get_level_s(SENSEHIDDEN, 40));
+ }
+ return CAST;
+}
+
+char *divination_sense_hidden_info()
+{
+ static char buf[128];
+
+ if (get_level_s(SENSEHIDDEN, 50) >= 15)
+ {
+ sprintf(buf,
+ "rad %d dur %d+d20",
+ (15 + get_level_s(SENSEHIDDEN, 40)),
+ (10 + get_level_s(SENSEHIDDEN, 40)));
+ }
+ else
+ {
+ sprintf(buf,
+ "rad %d",
+ (15 + get_level_s(SENSEHIDDEN, 40)));
+ }
+
+ return buf;
+}
+
+bool_ *divination_reveal_ways()
+{
+ detect_doors(10 + get_level(REVEALWAYS, 40, 0));
+ detect_stairs(10 + get_level(REVEALWAYS, 40, 0));
+ return CAST;
+}
+
+char *divination_reveal_ways_info()
+{
+ static char buf[128];
+ sprintf(buf,
+ "rad %d",
+ (10 + get_level_s(REVEALWAYS, 40)));
+ return buf;
+}
+
+bool_ *divination_sense_monsters()
+{
+ detect_monsters_normal(10 + get_level(SENSEMONSTERS, 40, 0));
+ if (get_level_s(SENSEMONSTERS, 50) >= 30)
+ {
+ set_tim_esp(10 + randint(10) + get_level_s(SENSEMONSTERS, 20));
+ }
+ return CAST;
+}
+
+char *divination_sense_monsters_info()
+{
+ static char buf[128];
+
+ if (get_level_s(SENSEMONSTERS, 50) >= 30)
+ {
+ sprintf(buf,
+ "rad %d dur %d+d10",
+ (10 + get_level_s(SENSEMONSTERS, 40)),
+ (10 + get_level_s(SENSEMONSTERS, 20)));
+ }
+ else
+ {
+ sprintf(buf,
+ "rad %d",
+ (10 + get_level_s(SENSEMONSTERS, 40)));
+ }
+
+ return buf;
+}