summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/goditem.cc
diff options
context:
space:
mode:
authorDavid Lawrence Ramsey <dolorous@users.sourceforge.net>2009-11-19 05:55:49 -0600
committerDavid Lawrence Ramsey <dolorous@users.sourceforge.net>2009-11-19 06:31:39 -0600
commitad599ad1c85be1ffba72f5aacacf869fa85010ca (patch)
tree40ee99cb940687ed21de444be1bbf78003b3316f /crawl-ref/source/goditem.cc
parentb1aaf507f2ecb50a7792037b1f9894e06591ce3d (diff)
downloadcrawl-ref-ad599ad1c85be1ffba72f5aacacf869fa85010ca.tar.gz
crawl-ref-ad599ad1c85be1ffba72f5aacacf869fa85010ca.zip
Split chaotic things into unclean and chaotic things.
Chaotic things are now shapeshifters, mutators, etc., while unclean things are diseasing things, rotting things, etc. Zin still hates both. As good gods treat both unholy and evil monsters as evil, he'll treat both unclean and chaotic monsters as chaotic. Note that silver will only do extra damage to chaotics, as before.
Diffstat (limited to 'crawl-ref/source/goditem.cc')
-rw-r--r--crawl-ref/source/goditem.cc55
1 files changed, 53 insertions, 2 deletions
diff --git a/crawl-ref/source/goditem.cc b/crawl-ref/source/goditem.cc
index 41d2d275c5..849cd63ede 100644
--- a/crawl-ref/source/goditem.cc
+++ b/crawl-ref/source/goditem.cc
@@ -174,6 +174,32 @@ bool is_evil_item(const item_def& item)
return (retval);
}
+bool is_unclean_item(const item_def& item)
+{
+ bool retval = false;
+
+ if (is_unrandom_artefact(item))
+ {
+ unrandart_entry* entry = get_unrand_entry(item.special);
+
+ if (entry->flags & UNRAND_FLAG_UNCLEAN)
+ return (true);
+ }
+
+ switch (item.base_type)
+ {
+ case OBJ_BOOKS:
+ retval = is_unclean_spellbook(item);
+ case OBJ_STAVES:
+ retval = is_unclean_rod(item);
+ break;
+ default:
+ break;
+ }
+
+ return (retval);
+}
+
bool is_chaotic_item(const item_def& item)
{
bool retval = false;
@@ -309,6 +335,15 @@ bool is_evil_spell(spell_type spell, god_type god)
return (is_evil_discipline(disciplines));
}
+bool is_unclean_spell(spell_type spell, god_type god)
+{
+ UNUSED(god);
+
+ unsigned int flags = get_spell_flags(spell);
+
+ return (flags & SPFLAG_UNCLEAN);
+}
+
bool is_chaotic_spell(spell_type spell, god_type god)
{
UNUSED(god);
@@ -386,6 +421,11 @@ bool is_evil_spellbook(const item_def& item)
return (is_spellbook_type(item, false, is_evil_spell));
}
+bool is_unclean_spellbook(const item_def& item)
+{
+ return (is_spellbook_type(item, false, is_unclean_spell));
+}
+
bool is_chaotic_spellbook(const item_def& item)
{
return (is_spellbook_type(item, false, is_chaotic_spell));
@@ -416,6 +456,11 @@ bool is_evil_rod(const item_def& item)
return (is_spellbook_type(item, true, is_evil_spell));
}
+bool is_unclean_rod(const item_def& item)
+{
+ return (is_spellbook_type(item, true, is_unclean_spell));
+}
+
bool is_chaotic_rod(const item_def& item)
{
return (is_spellbook_type(item, true, is_chaotic_spell));
@@ -458,7 +503,13 @@ conduct_type god_hates_item_handling(const item_def &item)
switch (you.religion)
{
case GOD_ZIN:
- if (item_type_known(item) && is_chaotic_item(item))
+ if (!item_type_known(item))
+ return (DID_NOTHING);
+
+ if (is_unclean_item(item))
+ return (DID_UNCLEAN);
+
+ if (is_chaotic_item(item))
return (DID_CHAOS);
break;
@@ -552,7 +603,7 @@ bool god_hates_spell_type(spell_type spell, god_type god)
switch (god)
{
case GOD_ZIN:
- if (is_chaotic_spell(spell))
+ if (is_unclean_spell(spell) || is_chaotic_spell(spell))
return (true);
break;