summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/item_use.cc
diff options
context:
space:
mode:
authorDarshan Shaligram <dshaligram@users.sourceforge.net>2010-01-10 23:13:55 +0530
committerDarshan Shaligram <dshaligram@users.sourceforge.net>2010-01-10 23:19:31 +0530
commit5871154a2e85ccd38874e88dea22083ced372141 (patch)
treeb402b490bc7a7cacf46791a90dd036173418af3a /crawl-ref/source/item_use.cc
parent8a78afdcea14016d0471fe74cc66a943c8fd616a (diff)
downloadcrawl-ref-5871154a2e85ccd38874e88dea22083ced372141.tar.gz
crawl-ref-5871154a2e85ccd38874e88dea22083ced372141.zip
Amulet of Faith, mark I.
Amulets of faith have these effects: - Piety gain is 1/3 faster. - Gods that protect from harm are more likely to do so (your piety is 1/3rd higher for such checks). - Xom piety walk is 1/3 faster. - Xom is more likely to act. - Removing the amulet leaches away some piety, but will never cause excommunication, or drop piety too close to excommunication. Amulets auto-id if the player already has a religion, or when the player acquires a religion while wearing the amulet.
Diffstat (limited to 'crawl-ref/source/item_use.cc')
-rw-r--r--crawl-ref/source/item_use.cc35
1 files changed, 34 insertions, 1 deletions
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index fff392ac31..ea2dd24dc7 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -3512,6 +3512,14 @@ void jewellery_wear_effects(item_def &item)
}
break;
+ case AMU_FAITH:
+ if (you.religion != GOD_NO_GOD)
+ {
+ mpr("You feel a surge of divine interest.", MSGCH_GOD);
+ ident = ID_KNOWN_TYPE;
+ }
+ break;
+
case AMU_THE_GOURMAND:
// What's this supposed to achieve? (jpeg)
you.duration[DUR_GOURMAND] = 0;
@@ -4006,6 +4014,27 @@ bool puton_ring(int slot)
return puton_item(item_slot);
}
+void remove_amulet_of_faith(item_def &item)
+{
+ if (you.religion != GOD_NO_GOD
+ && you.religion != GOD_XOM)
+ {
+ simple_god_message(" seems less interested in you.");
+
+ const int piety_loss = div_rand_round(you.piety, 3);
+ // Piety penalty for removing the Amulet of Faith.
+ if (you.piety - piety_loss > 10)
+ {
+ mprf(MSGCH_GOD,
+ "%s leaches power out of you as you remove it.",
+ item.name(DESC_CAP_YOUR).c_str());
+ dprf("%s: piety leach: %d",
+ item.name(DESC_PLAIN).c_str(), piety_loss);
+ lose_piety(piety_loss);
+ }
+ }
+}
+
void jewellery_remove_effects(item_def &item, bool mesg)
{
// The ring/amulet must already be removed from you.equip at this point.
@@ -4079,6 +4108,10 @@ void jewellery_remove_effects(item_def &item, bool mesg)
you.duration[DUR_GOURMAND] = 0;
break;
+ case AMU_FAITH:
+ remove_amulet_of_faith(item);
+ break;
+
case AMU_GUARDIAN_SPIRIT:
if (you.species == SP_DEEP_DWARF)
mpr("Your magic begins regenerating once more.");
@@ -4173,7 +4206,7 @@ bool remove_ring(int slot, bool announce)
}
if (!check_warning_inscriptions(you.inv[you.equip[hand_used]],
- OPER_REMOVE))
+ OPER_REMOVE))
{
canned_msg(MSG_OK);
return (false);