summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/xom.cc
diff options
context:
space:
mode:
authorreaver <address.auto@gmail.com>2014-03-11 16:19:10 -0400
committerShmuale Mark <shm.mark@gmail.com>2014-03-12 13:38:04 -0400
commitb78b54b1c70040f340716dd8dd8e29df2f54f69e (patch)
tree65c89121025f9eb2f3e4aff67a5e8cdcfdd76dee /crawl-ref/source/xom.cc
parent13ef432e70872bc2159f175ba7b173b2f0af6cdb (diff)
downloadcrawl-ref-b78b54b1c70040f340716dd8dd8e29df2f54f69e.tar.gz
crawl-ref-b78b54b1c70040f340716dd8dd8e29df2f54f69e.zip
Use potion_type_name() to note Xom potion effects.
This formerly special cased it, which meant I had to change it when I renamed potions of speed. This means future changes or additions to the potions xom used do not have to modify this function.
Diffstat (limited to 'crawl-ref/source/xom.cc')
-rw-r--r--crawl-ref/source/xom.cc31
1 files changed, 14 insertions, 17 deletions
diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc
index cc52d5bd80..3c0f422c49 100644
--- a/crawl-ref/source/xom.cc
+++ b/crawl-ref/source/xom.cc
@@ -27,6 +27,7 @@
#include "feature.h"
#include "goditem.h"
#include "item_use.h"
+#include "itemname.h"
#include "itemprop.h"
#include "items.h"
#include "libutil.h"
@@ -1056,6 +1057,17 @@ static bool _player_is_dead(bool soon = true)
|| soon && (you.strength() <= 0 || you.dex() <= 0 || you.intel() <= 0);
}
+static void _note_potion_effect(potion_type pot)
+{
+ string potion_name = potion_type_name(static_cast<int>(pot));
+
+ string potion_msg = "potion effect ";
+
+ potion_msg += ("(" + potion_name + ")");
+
+ take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, potion_msg.c_str()), true);
+}
+
static int _xom_do_potion(bool debug = false)
{
if (debug)
@@ -1111,25 +1123,10 @@ static int _xom_do_potion(bool debug = false)
if (pot == POT_INVISIBILITY)
you.attribute[ATTR_INVIS_UNCANCELLABLE] = 1;
- // Take a note.
- string potion_msg = "potion effect ";
- switch (pot)
- {
- case POT_CURING: potion_msg += "(curing)"; break;
- case POT_HEAL_WOUNDS: potion_msg += "(heal wounds)"; break;
- case POT_MAGIC: potion_msg += "(magic)"; break;
- case POT_HASTE: potion_msg += "(haste)"; break;
- case POT_MIGHT: potion_msg += "(might)"; break;
- case POT_AGILITY: potion_msg += "(agility)"; break;
- case POT_BRILLIANCE: potion_msg += "(brilliance)"; break;
- case POT_INVISIBILITY: potion_msg += "(invisibility)"; break;
- case POT_BERSERK_RAGE: potion_msg += "(berserk)"; break;
- case POT_EXPERIENCE: potion_msg += "(experience)"; break;
- default: potion_msg += "(other)"; break;
- }
- take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, potion_msg.c_str()), true);
+ _note_potion_effect(pot);
potion_effect(pot, 150, nullptr, false);
+
level_change(); // potion_effect() doesn't do this anymore
return XOM_GOOD_POTION;