summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-09-25 22:42:41 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-09-25 22:42:41 +0000
commitb67ca8220470dc19f83db1b199fec11c8f311da4 (patch)
treeea0e2924f4205a57f40bf4ac6e3e501b96d632c3 /crawl-ref/source
parentfe66a480da9ae461070c73f7690922b240ff3ace (diff)
downloadcrawl-ref-b67ca8220470dc19f83db1b199fec11c8f311da4.tar.gz
crawl-ref-b67ca8220470dc19f83db1b199fec11c8f311da4.zip
Yred flavor, part 3: forbid the use of holy items (weapons of holy wrath
and scrolls of holy word) or spells. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6994 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/enum.h1
-rw-r--r--crawl-ref/source/fight.cc9
-rw-r--r--crawl-ref/source/item_use.cc11
-rw-r--r--crawl-ref/source/religion.cc52
-rw-r--r--crawl-ref/source/religion.h1
-rw-r--r--crawl-ref/source/spl-cast.cc5
6 files changed, 72 insertions, 7 deletions
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 992ee7fcee..756b79f129 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -633,6 +633,7 @@ enum command_type
enum conduct_type
{
DID_NECROMANCY = 1, // vamp/drain/pain wpns, Zong/Curses
+ DID_HOLY, // holy wrath wpns, holy word scrolls
DID_UNHOLY, // demon wpns, demon spells
DID_ATTACK_HOLY,
DID_ATTACK_NEUTRAL,
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index a824eb64c5..afb3e9dd43 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -1752,10 +1752,13 @@ void melee_attack::player_check_weapon_effects()
if (weapon)
{
- if (weapon->base_type == OBJ_WEAPONS
- && is_demonic( *weapon ))
+ if (weapon->base_type == OBJ_WEAPONS)
{
- did_god_conduct(DID_UNHOLY, 1);
+ if (is_holy_item(*weapon))
+ did_god_conduct(DID_HOLY, 1);
+
+ if (is_demonic(*weapon))
+ did_god_conduct(DID_UNHOLY, 1);
}
if (is_fixed_artefact(*weapon))
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 46c97586b4..a08ccee3ba 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -4583,8 +4583,10 @@ void read_scroll( int slot )
you.piety / 2;
}
- if (!holy_word(pow, HOLY_WORD_SCROLL, you.pos(),
- !item_type_known(scroll)))
+ const bool success = holy_word(pow, HOLY_WORD_SCROLL, you.pos(),
+ !item_type_known(scroll));
+
+ if (!success)
{
canned_msg(MSG_NOTHING_HAPPENS);
id_the_scroll = false;
@@ -4597,6 +4599,11 @@ void read_scroll( int slot )
if (you.duration[DUR_PIETY_POOL] > 500)
you.duration[DUR_PIETY_POOL] = 500;
}
+
+ // This is only naughty if you know you're doing it, or if it's
+ // succeeded, in which case you'll know for next time.
+ if (item_type_known(scroll) || success)
+ did_god_conduct(DID_HOLY, 10, item_type_known(scroll));
break;
}
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 0530683596..9917ced1ab 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -664,6 +664,10 @@ std::string get_god_dislikes(god_type which_god, bool /*verbose*/)
dislikes.push_back("kill a living thing while praying");
break;
+ case GOD_YREDELEMNUL:
+ dislikes.push_back("use holy magic or items");
+ break;
+
case GOD_TROG:
dislikes.push_back("memorise spells");
dislikes.push_back("cast spells");
@@ -2215,6 +2219,20 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known,
}
break;
+ case DID_HOLY:
+ if (you.religion == GOD_YREDELEMNUL)
+ {
+ if (!known)
+ {
+ simple_god_message(" did not appreciate that!");
+ break;
+ }
+ ret = true;
+ piety_change = -level;
+ penance = level * 2;
+ }
+ break;
+
case DID_UNCHIVALRIC_ATTACK:
case DID_POISON:
if (you.religion == GOD_SHINING_ONE)
@@ -2711,7 +2729,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known,
static const char *conducts[] =
{
"",
- "Necromancy", "Unholy", "Attack Holy", "Attack Neutral",
+ "Necromancy", "Holy", "Unholy", "Attack Holy", "Attack Neutral",
"Attack Friend", "Friend Died", "Stab", "Unchivalric Attack",
"Poison", "Field Sacrifice", "Kill Living", "Kill Undead",
"Kill Demon", "Kill Natural Evil", "Kill Chaotic",
@@ -2977,6 +2995,29 @@ void gain_piety(int pgn)
_do_god_gift(false);
}
+bool is_holy_item(const item_def& item)
+{
+ bool retval = false;
+
+ switch (item.base_type)
+ {
+ case OBJ_WEAPONS:
+ {
+ const int item_brand = get_weapon_brand(item);
+
+ retval = (item_brand == SPWPN_HOLY_WRATH);
+ break;
+ }
+ case OBJ_SCROLLS:
+ retval = (item.sub_type == SCR_HOLY_WORD);
+ break;
+ default:
+ break;
+ }
+
+ return (retval);
+}
+
bool is_evil_item(const item_def& item)
{
bool retval = false;
@@ -3091,6 +3132,15 @@ bool god_dislikes_item_handling(const item_def &item)
}
}
+ if (you.religion == GOD_YREDELEMNUL)
+ {
+ if (!item_type_known(item))
+ return (false);
+
+ if (is_holy_item(item))
+ return (true);
+ }
+
return (false);
}
diff --git a/crawl-ref/source/religion.h b/crawl-ref/source/religion.h
index bab2a8cfef..246455a659 100644
--- a/crawl-ref/source/religion.h
+++ b/crawl-ref/source/religion.h
@@ -100,6 +100,7 @@ void beogh_idol_revenge();
void good_god_holy_attitude_change(monsters *holy);
void beogh_convert_orc(monsters *orc, bool emergency,
bool converted_by_follower = false);
+bool is_holy_item(const item_def& item);
bool is_evil_item(const item_def& item);
bool good_god_dislikes_item_handling(const item_def &item);
bool god_dislikes_item_handling(const item_def &item);
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index f5865ae038..a2b4fbf49b 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -788,7 +788,10 @@ static void _spellcasting_side_effects(spell_type spell, bool idonly = false)
return;
if (!_spell_is_utility_spell(spell))
- did_god_conduct( DID_SPELL_NONUTILITY, 10 + spell_difficulty(spell) );
+ did_god_conduct(DID_SPELL_NONUTILITY, 10 + spell_difficulty(spell));
+
+ if (spell_typematch(spell, SPTYP_HOLY))
+ did_god_conduct(DID_HOLY, 10 + spell_difficulty(spell));
// Self-banishment gets a special exemption - you're there to spread light
if (_spell_is_unholy(spell) && !you.banished)