summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-02-07 06:27:02 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-02-07 06:27:02 +0000
commit4f955d1dd5e8fda4fb45b09fbbfcab138e26a75b (patch)
tree68ecdd47679725b34b009e250930f66991166c3d /crawl-ref
parent80219219bee1231f7833c47a394c8f5c3b04d283 (diff)
downloadcrawl-ref-4f955d1dd5e8fda4fb45b09fbbfcab138e26a75b.tar.gz
crawl-ref-4f955d1dd5e8fda4fb45b09fbbfcab138e26a75b.zip
Fix [2575361]: Properly differentiate between spells a god hates in
general and spells a god dislikes for the purpose of artefact spellbooks, in order to avoid e.g. Elyvilon's hating a book of conjurations. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8950 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/describe.cc4
-rw-r--r--crawl-ref/source/itemname.cc5
-rw-r--r--crawl-ref/source/religion.cc56
-rw-r--r--crawl-ref/source/religion.h9
-rw-r--r--crawl-ref/source/spl-book.cc4
5 files changed, 45 insertions, 33 deletions
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index 80744767a5..8b99c28409 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -2168,12 +2168,12 @@ std::string get_item_description( const item_def &item, bool verbose,
}
}
- if (good_god_dislikes_item_handling(item))
+ if (good_god_hates_item_handling(item))
{
description << "$$" << god_name(you.religion) << " opposes the use of "
<< "such an evil item.";
}
- else if (god_dislikes_item_handling(item))
+ else if (god_hates_item_handling(item))
{
description << "$$" << god_name(you.religion) << " disapproves of the "
<< "use of such an item.";
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index f9bf2de229..77c585f890 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -2670,11 +2670,8 @@ static const std::string _item_prefix(const item_def &item, bool temp,
prefixes.push_back("unidentified");
}
- if (good_god_dislikes_item_handling(item)
- || god_dislikes_item_handling(item))
- {
+ if (good_god_hates_item_handling(item) || god_hates_item_handling(item))
prefixes.push_back("evil_item");
- }
if (is_emergency_item(item))
prefixes.push_back("emergency_item");
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 842d295f59..56dacdeec5 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -3597,9 +3597,9 @@ bool is_chaotic_spellbook(const item_def& item)
return (is_spellbook_type(item, false, is_chaotic_spell));
}
-bool god_dislikes_spellbook(const item_def& item)
+bool god_hates_spellbook(const item_def& item)
{
- return (is_spellbook_type(item, false, god_dislikes_spell_type));
+ return (is_spellbook_type(item, false, god_hates_spell_type));
}
bool is_holy_rod(const item_def& item)
@@ -3617,22 +3617,19 @@ bool is_chaotic_rod(const item_def& item)
return (is_spellbook_type(item, true, is_chaotic_spell));
}
-bool god_dislikes_rod(const item_def& item)
+bool god_hates_rod(const item_def& item)
{
- return (is_spellbook_type(item, true, god_dislikes_spell_type));
+ return (is_spellbook_type(item, true, god_hates_spell_type));
}
-bool good_god_dislikes_item_handling(const item_def &item)
+bool good_god_hates_item_handling(const item_def &item)
{
return (is_good_god(you.religion) && is_evil_item(item)
&& (is_demonic(item) || item_type_known(item)));
}
-bool god_dislikes_item_handling(const item_def &item)
+bool god_hates_item_handling(const item_def &item)
{
- if (you.religion == GOD_XOM)
- return (false);
-
switch (you.religion)
{
case GOD_ZIN:
@@ -3692,18 +3689,17 @@ bool god_dislikes_item_handling(const item_def &item)
break;
}
- if (god_dislikes_spellbook(item) || god_dislikes_rod(item))
+ if (god_hates_spellbook(item) || god_hates_rod(item))
return (true);
return (false);
}
-bool god_dislikes_spell_type(spell_type spell, god_type god)
+bool god_hates_spell_type(spell_type spell, god_type god)
{
if (is_good_god(god) && is_evil_spell(spell))
return (true);
- unsigned int flags = get_spell_flags(spell);
unsigned int disciplines = get_spell_disciplines(spell);
switch (god)
@@ -3714,16 +3710,39 @@ bool god_dislikes_spell_type(spell_type spell, god_type god)
break;
case GOD_SHINING_ONE:
- // TSO dislikes using poison, but is fine with curing it, resisting
- // it or destroying it.
- if ((disciplines & SPTYP_POISON) && spell != SPELL_CURE_POISON_I
+ // TSO hates using poison, but is fine with curing it, resisting
+ // it, or destroying it.
+ if ((disciplines & SPTYP_POISON) && spell != SPELL_CURE_POISON_I
&& spell != SPELL_CURE_POISON_II && spell != SPELL_RESIST_POISON
&& spell != SPELL_IGNITE_POISON)
{
return (true);
}
- // He probably also wouldn't like spells which would put enemies
+ case GOD_YREDELEMNUL:
+ if (is_holy_spell(spell))
+ return (true);
+ break;
+
+ default:
+ break;
+ }
+
+ return (false);
+}
+
+bool god_dislikes_spell_type(spell_type spell, god_type god)
+{
+ if (god_hates_spell_type(spell, god))
+ return (true);
+
+ unsigned int flags = get_spell_flags(spell);
+ unsigned int disciplines = get_spell_disciplines(spell);
+
+ switch (god)
+ {
+ case GOD_SHINING_ONE:
+ // TSO probably wouldn't like spells which would put enemies
// into a state where attacking them would be unchivalrous.
if (spell == SPELL_CAUSE_FEAR || spell == SPELL_PARALYSE
|| spell == SPELL_CONFUSE || spell == SPELL_MASS_CONFUSION
@@ -3733,11 +3752,6 @@ bool god_dislikes_spell_type(spell_type spell, god_type god)
}
break;
- case GOD_YREDELEMNUL:
- if (is_holy_spell(spell))
- return (true);
- break;
-
case GOD_XOM:
// Ideally, Xom would only like spells which have a random effect,
// are risky to use, or would otherwise amuse him, but that would
diff --git a/crawl-ref/source/religion.h b/crawl-ref/source/religion.h
index dbefc0aa0b..7a922030be 100644
--- a/crawl-ref/source/religion.h
+++ b/crawl-ref/source/religion.h
@@ -121,13 +121,14 @@ bool is_spellbook_type(const item_def& item, bool book_or_rod,
bool is_holy_spellbook(const item_def& item);
bool is_evil_spellbook(const item_def& item);
bool is_chaotic_spellbook(const item_def& item);
-bool god_dislikes_spellbook(const item_def& item);
+bool god_hates_spellbook(const item_def& item);
bool is_holy_rod(const item_def& item);
bool is_evil_rod(const item_def& item);
bool is_chaotic_rod(const item_def& item);
-bool god_dislikes_rod(const item_def& item);
-bool good_god_dislikes_item_handling(const item_def &item);
-bool god_dislikes_item_handling(const item_def &item);
+bool god_hates_rod(const item_def& item);
+bool good_god_hates_item_handling(const item_def &item);
+bool god_hates_item_handling(const item_def &item);
+bool god_hates_spell_type(spell_type spell, god_type god = you.religion);
// NOTE: As of now, these two functions only say if a god won't give a
// spell/school when giving a gift.
diff --git a/crawl-ref/source/spl-book.cc b/crawl-ref/source/spl-book.cc
index 5d97c6d4d8..89905a420a 100644
--- a/crawl-ref/source/spl-book.cc
+++ b/crawl-ref/source/spl-book.cc
@@ -2037,8 +2037,8 @@ bool make_book_level_randart(item_def &book, int level, int num_spells,
static bool _get_weighted_discs(bool completely_random, god_type god,
int &disc1, int &disc2)
{
- // Eliminate disciplines that the god disapproves of or from which
- // all spells are discarded.
+ // Eliminate disciplines that the god dislikes or from which all
+ // spells are discarded.
std::vector<int> ok_discs;
std::vector<int> skills;
for (int i = 0; i < SPTYP_LAST_EXPONENT; i++)