summaryrefslogtreecommitdiff
path: root/src/spells4.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/spells4.c')
-rw-r--r--src/spells4.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/spells4.c b/src/spells4.c
new file mode 100644
index 00000000..7f59d186
--- /dev/null
+++ b/src/spells4.c
@@ -0,0 +1,62 @@
+#include "angband.h"
+
+#include <assert.h>
+
+static bool_ uses_piety_to_cast(int s)
+{
+ char buf[128];
+ sprintf(buf, "return check_affect(%d, \"piety\", FALSE)", s);
+ return exec_lua(buf);
+}
+
+static bool_ castable_while_blind(int s)
+{
+ char buf[128];
+ sprintf(buf, "return not check_affect(%d, \"blind\")", s);
+ return exec_lua(buf);
+}
+
+static bool_ castable_while_confused(int s)
+{
+ char buf[128];
+ sprintf(buf, "return not check_affect(%d, \"confusion\")", s);
+ return exec_lua(buf);
+}
+
+/* Output the describtion when it is used as a spell */
+void print_spell_desc(int s, int y)
+{
+ int i;
+
+ for (i=0; ; i++)
+ {
+ char buf[128];
+ cptr desc = NULL;
+
+ sprintf(buf, "return __spell_desc[%d][%d]", s, i+1);
+ desc = string_exec_lua(buf);
+ if (!desc)
+ {
+ break;
+ }
+
+ c_prt(TERM_L_BLUE, desc, y, 0);
+ y++;
+ }
+
+ if (uses_piety_to_cast(s))
+ {
+ c_prt(TERM_L_WHITE, "It uses piety to cast.", y, 0);
+ y++;
+ }
+ if (castable_while_blind(s))
+ {
+ c_prt(TERM_ORANGE, "It is castable even while blinded.", y, 0);
+ y++;
+ }
+ if (castable_while_confused(s))
+ {
+ c_prt(TERM_ORANGE, "It is castable even while confused.", y, 0);
+ y++;
+ }
+}