summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/command.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-04 06:38:17 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-04 06:38:17 +0000
commitcc0f9b2965e5298577253965c8819636985ac2db (patch)
treef586194693a2b6e0ff63411ddd6b136d137e9032 /crawl-ref/source/command.cc
parentfccc5c8dd647216dc3ad7faff107a8ffc77acfb8 (diff)
downloadcrawl-ref-cc0f9b2965e5298577253965c8819636985ac2db.tar.gz
crawl-ref-cc0f9b2965e5298577253965c8819636985ac2db.zip
Savefile compatibility breakage from keeping track of which spells have been
seen. Implemented fixed-level randart spell books, which is all randart spellbooks as of now. All my attempts at sorting the spell list so that spells with the same schools group together have utterly failed. Got rid of the hackish "non-monster origin is stored in item.orig_monnum as (-origin - 2)" logic, replaced with the slightly less hackish "-origin". Added the two enumerations IT_SRC_START and IT_SRC_SHOP to do it. Also, origin_is_god_gift() and origin_is_acquirement() can retrieve the god/source of the item so that you don't have to do the negation and typecasting yourself. Added some new spell flags: * SPFLAG_BATTLE for non-conjuration spells which are still combat/battle related (branding spells and single school attack spells like "Pain"), * SPFLAG_CARD for spells which are card-type effects which don't show up in ordinary spellbooks (Tomb of Doroklohe and (I assume) Disintigrate) * SPFLAG_TESTING for spells which are only used for testing (Debugging Ray) * SPFLAG_DEVEL for spells that are still under development (Crush, Disrupt, and Detect Magic). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7742 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/command.cc')
-rw-r--r--crawl-ref/source/command.cc60
1 files changed, 56 insertions, 4 deletions
diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc
index 00188b7a77..cdc00ca7cf 100644
--- a/crawl-ref/source/command.cc
+++ b/crawl-ref/source/command.cc
@@ -1050,7 +1050,22 @@ static bool _monster_filter(std::string key, std::string body)
static bool _spell_filter(std::string key, std::string body)
{
- return (spell_by_name(key) == SPELL_NO_SPELL);
+ spell_type spell = spell_by_name(key);
+
+ if (spell == SPELL_NO_SPELL)
+ return (true);
+
+ if (get_spell_flags(spell) & (SPFLAG_MONSTER | SPFLAG_TESTING
+ | SPFLAG_DEVEL))
+ {
+#ifdef WIZARD
+ return (!you.wizard);
+#else
+ return (true);
+#endif
+ }
+
+ return (false);
}
static bool _item_filter(std::string key, std::string body)
@@ -1107,6 +1122,44 @@ static void _recap_feat_keys(std::vector<std::string> &keys)
}
}
+// Extra info on this item wasn't found anywhere else.
+static void _append_non_item(std::string &desc, std::string key)
+{
+ spell_type type = spell_by_name(key, true);
+
+ if (type == SPELL_NO_SPELL)
+ return;
+
+ unsigned int flags = get_spell_flags(type);
+
+ if (flags & SPFLAG_DEVEL)
+ desc += "$This spell is still being developped, and is only avaible "
+ "via the &Z wizard command.";
+ else if (flags & SPFLAG_TESTING)
+ desc += "$This is a testing spell, only avaible via the "
+ "&Z wizard command.";
+ else if (flags & SPFLAG_MONSTER)
+ desc += "$This is a monster-only spell, only avaible via the "
+ "&Z wizard command.";
+ else if (flags & SPFLAG_CARD)
+ desc += "$This is a card-effect spell, unavailable in ordinary "
+ "spellbooks.";
+ else
+ desc += "$Odd, this spell can't be found anywhere. Please "
+ "file a bug report.";
+
+#ifdef WIZARD
+ if (!you.wizard)
+#else
+ if (true)
+#endif
+ {
+ if (flags & (SPFLAG_TESTING | SPFLAG_MONSTER | SPFLAG_DEVEL))
+ desc += "$$You aren't in wizard mode, so you shouldn't be "
+ "seeing this entry. Please file a bug report.";
+ }
+}
+
// Adds a list of all books/rods that contain a given spell (by name)
// to a description string.
static bool _append_books(std::string &desc, item_def &item, std::string key)
@@ -1163,9 +1216,6 @@ static bool _append_books(std::string &desc, item_def &item, std::string key)
rods.push_back(item.name(DESC_PLAIN));
}
- if (books.empty() && rods.empty())
- return (false);
-
if (!books.empty())
{
desc += "$$This spell can be found in the following book";
@@ -1359,6 +1409,8 @@ static bool _do_description(std::string key, std::string footer = "")
if (!_append_books(desc, mitm[thing_created], key))
_append_spells(desc, mitm[thing_created]);
}
+ else
+ _append_non_item(desc, key);
// Now we don't need the item anymore.
destroy_item(thing_created);