summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2012-05-15 06:19:37 +0200
committerBardur Arantsson <bardur@scientician.net>2012-05-15 06:34:29 +0200
commit6bd3fd4881765ec278b9c3896cd4cff15fe33265 (patch)
tree30ca5443aca9bc2190c04adf40c2bed201693cb5 /src
parentf2163c387bfb5c8746e832a1f7e72355d19b40f0 (diff)
Lua: Move "Varda" spell functions to C
Diffstat (limited to 'src')
-rw-r--r--src/externs.h14
-rw-r--r--src/spells.pkg14
-rw-r--r--src/spells3.c130
3 files changed, 158 insertions, 0 deletions
diff --git a/src/externs.h b/src/externs.h
index ac9bd360..b6c8ea88 100644
--- a/src/externs.h
+++ b/src/externs.h
@@ -1882,6 +1882,20 @@ char *ulmo_call_of_the_ulumuri_info();
bool_ *ulmo_wrath_of_ulmo_spell();
char *ulmo_wrath_of_ulmo_info();
+extern s32b VARDA_LIGHT_VALINOR;
+extern s32b VARDA_CALL_ALMAREN;
+extern s32b VARDA_EVENSTAR;
+extern s32b VARDA_STARKINDLER;
+
+bool_ *varda_light_of_valinor_spell();
+char *varda_light_of_valinor_info();
+bool_ *varda_call_of_almaren_spell();
+char *varda_call_of_almaren_info();
+bool_ *varda_evenstar_spell();
+char *varda_evenstar_info();
+bool_ *varda_star_kindler_spell();
+char *varda_star_kindler_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 7ec49906..6f284a9d 100644
--- a/src/spells.pkg
+++ b/src/spells.pkg
@@ -2886,3 +2886,17 @@ bool_ *ulmo_call_of_the_ulumuri_spell();
char *ulmo_call_of_the_ulumuri_info();
bool_ *ulmo_wrath_of_ulmo_spell();
char *ulmo_wrath_of_ulmo_info();
+
+extern s32b VARDA_LIGHT_VALINOR;
+extern s32b VARDA_CALL_ALMAREN;
+extern s32b VARDA_EVENSTAR;
+extern s32b VARDA_STARKINDLER;
+
+bool_ *varda_light_of_valinor_spell();
+char *varda_light_of_valinor_info();
+bool_ *varda_call_of_almaren_spell();
+char *varda_call_of_almaren_info();
+bool_ *varda_evenstar_spell();
+char *varda_evenstar_info();
+bool_ *varda_star_kindler_spell();
+char *varda_star_kindler_info();
diff --git a/src/spells3.c b/src/spells3.c
index cf9632b7..119e128f 100644
--- a/src/spells3.c
+++ b/src/spells3.c
@@ -162,6 +162,10 @@ s32b ULMO_DRAUGHT_ULMONAN;
s32b ULMO_CALL_ULUMURI;
s32b ULMO_WRATH;
+s32b VARDA_LIGHT_VALINOR;
+s32b VARDA_CALL_ALMAREN;
+s32b VARDA_EVENSTAR;
+s32b VARDA_STARKINDLER;
/* 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
@@ -4707,3 +4711,129 @@ char *ulmo_wrath_of_ulmo_info()
wrath_of_ulmo_duration());
return buf;
}
+
+static int light_of_valinor_damage()
+{
+ return 10 + get_level_s(VARDA_LIGHT_VALINOR, 100);
+}
+
+static int light_of_valinor_radius()
+{
+ return 5 + get_level_s(VARDA_LIGHT_VALINOR, 6);
+}
+
+bool_ *varda_light_of_valinor_spell()
+{
+ if (get_level_s(VARDA_LIGHT_VALINOR, 50) >= 3)
+ {
+ lite_area(10, 4);
+ }
+ else
+ {
+ lite_room(p_ptr->py, p_ptr->px);
+ }
+
+ if (get_level_s(VARDA_LIGHT_VALINOR, 50) >= 15)
+ {
+ fire_ball(GF_LITE,
+ 0,
+ light_of_valinor_damage(),
+ light_of_valinor_radius());
+ }
+
+ return CAST;
+}
+
+char *varda_light_of_valinor_info()
+{
+ static char buf[128];
+ if (get_level_s(VARDA_LIGHT_VALINOR, 50) >= 15)
+ {
+ sprintf(buf,
+ "dam %d rad " FMTs32b,
+ light_of_valinor_damage(),
+ light_of_valinor_radius());
+ return buf;
+ }
+ else
+ {
+ return "";
+ }
+}
+
+bool_ *varda_call_of_almaren_spell()
+{
+ int power = 5 * p_ptr->lev;
+ if (get_level_s(VARDA_CALL_ALMAREN, 50) >= 20)
+ {
+ dispel_evil(power);
+ }
+ else
+ {
+ banish_evil(power);
+ }
+ return CAST;
+}
+
+char *varda_call_of_almaren_info()
+{
+ return "";
+}
+
+bool_ *varda_evenstar_spell()
+{
+ wiz_lite_extra();
+ if (get_level_s(VARDA_EVENSTAR, 50) >= 40)
+ {
+ identify_pack();
+ self_knowledge(NULL);
+ }
+
+ return CAST;
+}
+
+char *varda_evenstar_info()
+{
+ return "";
+}
+
+static int star_kindler_bursts()
+{
+ return p_ptr->lev / 5;
+}
+
+static int star_kindler_damage()
+{
+ return 20 + get_level_s(VARDA_STARKINDLER, 100);
+}
+
+bool_ *varda_star_kindler_spell()
+{
+ int dir, i, n = star_kindler_bursts();
+
+ if (!get_aim_dir(&dir))
+ {
+ return NO_CAST;
+ }
+
+ for (i = 0; i < n; i++)
+ {
+ fire_ball(GF_LITE,
+ dir,
+ star_kindler_damage(),
+ 10);
+ }
+
+ return CAST;
+}
+
+char *varda_star_kindler_info()
+{
+ static char buf[128];
+ sprintf(buf,
+ "dam %d bursts %d rad 10",
+ star_kindler_damage(),
+ star_kindler_bursts());
+ return buf;
+}
+