summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/effects.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-29 00:16:40 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-29 00:16:40 +0000
commitc604ee1a6f3d1fed4b67aefa38f7785f333d2269 (patch)
treed9e70ac8669db48c42a071cb7f4a528b7b08cbda /crawl-ref/source/effects.cc
parent7fbcd22e430fcc3db5bf8e09a6dc02b80adeda77 (diff)
downloadcrawl-ref-c604ee1a6f3d1fed4b67aefa38f7785f333d2269.tar.gz
crawl-ref-c604ee1a6f3d1fed4b67aefa38f7785f333d2269.zip
Split the routine to use holy word on only the player into its own
function, too, just in case. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4758 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/effects.cc')
-rw-r--r--crawl-ref/source/effects.cc75
1 files changed, 39 insertions, 36 deletions
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index 3ab643cf8b..faf62d166c 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -64,56 +64,59 @@
#include "view.h"
#include "xom.h"
-bool holy_word(int pow, int caster, bool silent)
+bool holy_word_player(int pow, int caster)
{
- bool holy_influenced = false;
- monsters *monster;
+ if (!you.is_undead && you.species != SP_DEMONSPAWN)
+ return false;
- if (!silent)
- mpr("You speak a Word of immense power!");
+ int hploss = you.hp / 2 - 1;
- // doubt this will ever happen, but it's here as a safety -- bwr
- if (pow > 300)
- pow = 300;
+ if (hploss >= you.hp)
+ hploss = you.hp - 1;
+ if (hploss < 0)
+ hploss = 0;
- if (you.is_undead || you.species == SP_DEMONSPAWN)
- {
- int hploss = you.hp / 2 - 1;
- if (hploss >= you.hp)
- hploss = you.hp - 1;
- if (hploss < 0)
- hploss = 0;
+ if (!hploss)
+ return false;
+
+ mpr("You are blasted by holy energy!");
+
+ const char *aux = "holy word";
- if (hploss)
+ if (caster < 0)
+ {
+ switch (caster)
{
- holy_influenced = true;
+ case HOLY_WORD_SCROLL:
+ aux = "scroll of holy word";
+ break;
+ }
- mpr("You are blasted by holy energy!");
+ caster = HOLY_WORD_GENERIC;
+ }
- const char *aux = "holy word";
+ ouch(hploss, caster,
+ (caster != HOLY_WORD_GENERIC) ? KILLED_BY_MONSTER
+ : KILLED_BY_SOMETHING,
+ aux);
- if (caster < 0)
- {
- switch (caster)
- {
- case HOLY_WORD_SCROLL:
- aux = "scroll of holy word";
- break;
- }
+ return true;
+}
- caster = HOLY_WORD_GENERIC;
- }
+bool holy_word(int pow, int caster, bool silent)
+{
+ if (!silent)
+ mpr("You speak a Word of immense power!");
- ouch(hploss, caster,
- (caster != HOLY_WORD_GENERIC) ? KILLED_BY_MONSTER
- : KILLED_BY_SOMETHING,
- aux);
- }
- }
+ // doubt this will ever happen, but it's here as a safety -- bwr
+ if (pow > 300)
+ pow = 300;
+
+ bool holy_influenced = holy_word_player(pow, caster);
for (int tu = 0; tu < MAX_MONSTERS; tu++)
{
- monster = &menv[tu];
+ monsters *monster = &menv[tu];
if (monster->type == -1 || !mons_near(monster))
continue;