summaryrefslogtreecommitdiffstats
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
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.
-rw-r--r--crawl-ref/source/dat/descript/items.txt13
-rw-r--r--crawl-ref/source/invent.cc14
-rw-r--r--crawl-ref/source/item_use.cc35
-rw-r--r--crawl-ref/source/itemname.cc5
-rw-r--r--crawl-ref/source/itemprop-enum.h2
-rw-r--r--crawl-ref/source/makeitem.cc4
-rw-r--r--crawl-ref/source/religion.cc58
-rw-r--r--crawl-ref/source/religion.h1
-rw-r--r--crawl-ref/source/shopping.cc1
-rw-r--r--crawl-ref/source/xom.cc6
10 files changed, 116 insertions, 23 deletions
diff --git a/crawl-ref/source/dat/descript/items.txt b/crawl-ref/source/dat/descript/items.txt
index 38c200413b..b0211fad30 100644
--- a/crawl-ref/source/dat/descript/items.txt
+++ b/crawl-ref/source/dat/descript/items.txt
@@ -52,12 +52,6 @@ amulet of resist mutation
This amulet protects its wearer from mutations, although not
infallibly so.
%%%%
-amulet of resist slowing
-
-This amulet protects its wearer from some magically induced forms of
-slowness, and increases the duration of enchantments which speed his
-or her actions.
-%%%%
amulet of the gourmand
This amulet protects its wearer from sickness due to eating fresh raw
@@ -70,6 +64,13 @@ This amulet repels some of the attacks of creatures which have been
magically summoned, and also makes the wearer more resistant to
draining attacks.
%%%%
+amulet of faith
+
+This is a talisman crafted to call the attention of the gods to its
+wearer. This divine attention makes it easier to please your god, but
+your god is also less likely to forgive your transgressions, and the
+amulet will drain some of your divine favour when removed.
+%%%%
ankus
What mahouts steer their elephants with. It basically resembles a
diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc
index 26b882755c..66026f63c0 100644
--- a/crawl-ref/source/invent.cc
+++ b/crawl-ref/source/invent.cc
@@ -279,7 +279,7 @@ void InvEntry::add_class_hotkeys(const item_def &i)
const int type = i.base_type;
if (type == OBJ_JEWELLERY)
{
- add_hotkey(i.sub_type >= AMU_RAGE ? '"' : '=');
+ add_hotkey(i.sub_type >= AMU_FIRST_AMULET ? '"' : '=');
return;
}
@@ -1490,11 +1490,21 @@ static std::string _operation_verb(operation_types oper)
}
}
+bool _removing_amulet_of_faith(const item_def &item, operation_types oper)
+{
+ return (oper == OPER_REMOVE
+ && item.base_type == OBJ_JEWELLERY
+ && item.sub_type == AMU_FAITH);
+}
+
// Returns true if user OK'd it (or no warning), false otherwise.
bool check_warning_inscriptions( const item_def& item,
operation_types oper )
{
- if (item.is_valid() && has_warning_inscription(item, oper) )
+ if (item.is_valid()
+ && (has_warning_inscription(item, oper)
+ || (_removing_amulet_of_faith(item, oper)
+ && you.religion != GOD_NO_GOD)))
{
// When it's about destroying an item, don't even ask.
// If the player really wants to do that, they'll have
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);
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index de7df19748..fa8bbc9332 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -594,6 +594,8 @@ static const char* jewellery_type_name(int jeweltype)
case AMU_INACCURACY: return "amulet of inaccuracy";
case AMU_RESIST_MUTATION: return "amulet of resist mutation";
case AMU_GUARDIAN_SPIRIT: return "amulet of guardian spirit";
+ case AMU_FAITH: return "amulet of faith";
+ case AMU_STASIS: return "amulet of stasis";
default: return "buggy jewellery";
}
}
@@ -2733,6 +2735,9 @@ bool is_useless_item(const item_def &item, bool temp)
|| (player_mutation_level(MUT_HERBIVOROUS) == 3)
|| you.species == SP_MUMMY);
+ case AMU_FAITH:
+ return (you.species == SP_DEMIGOD);
+
case RING_LIFE_PROTECTION:
return (player_prot_life(false, temp, false) == 3);
diff --git a/crawl-ref/source/itemprop-enum.h b/crawl-ref/source/itemprop-enum.h
index d139422610..a079cc9368 100644
--- a/crawl-ref/source/itemprop-enum.h
+++ b/crawl-ref/source/itemprop-enum.h
@@ -187,6 +187,8 @@ enum jewellery_type
AMU_INACCURACY,
AMU_RESIST_MUTATION,
AMU_GUARDIAN_SPIRIT,
+ AMU_FAITH,
+ AMU_STASIS,
NUM_JEWELLERY
};
diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc
index 7d3182f29f..748b6973a8 100644
--- a/crawl-ref/source/makeitem.cc
+++ b/crawl-ref/source/makeitem.cc
@@ -599,7 +599,7 @@ void item_colour(item_def &item)
break;
}
- if (item.sub_type >= AMU_RAGE)
+ if (item.sub_type >= AMU_FIRST_AMULET)
{
switch (switchnum)
{
@@ -1851,7 +1851,7 @@ static special_missile_type _determine_missile_brand(const item_def& item,
case MI_ARROW:
rc = static_cast<special_missile_type>(
random_choose_weighted(30, SPMSL_FLAME, 30, SPMSL_FROST,
- 20, SPMSL_POISONED, 15, SPMSL_REAPING,
+ 20, SPMSL_POISONED, 15, SPMSL_REAPING,
15, SPMSL_DISPERSAL,
nw, SPMSL_NORMAL,
0));
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index ae6c6c1f4b..3d5fe9d31e 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -3599,6 +3599,9 @@ static void _dock_piety(int piety_loss, int penance)
if (piety_loss <= 0 && penance <= 0)
return;
+ piety_loss = piety_scale(piety_loss);
+ penance = piety_scale(penance);
+
if (piety_loss)
{
if (last_piety_lecture != you.num_turns)
@@ -3629,15 +3632,29 @@ static void _dock_piety(int piety_loss, int penance)
}
}
-void gain_piety(int pgn)
+// Scales a piety number, applying boosters (amulet of faith).
+int piety_scale(int piety)
{
- if (pgn <= 0)
+ if (piety < 0)
+ return (-piety_scale(-piety));
+
+ if (wearing_amulet(AMU_FAITH))
+ return (piety + div_rand_round(piety, 3));
+
+ return (piety);
+}
+
+void gain_piety(int original_gain)
+{
+ if (original_gain <= 0)
return;
// Xom uses piety differently...
if (you.religion == GOD_NO_GOD || you.religion == GOD_XOM)
return;
+ int pgn = piety_scale(original_gain);
+
// check to see if we owe anything first
if (you.penance[you.religion] > 0)
{
@@ -3697,7 +3714,8 @@ void gain_piety(int pgn)
#if DEBUG_PIETY
mprf(MSGCH_DIAGNOSTICS, "Piety increasing by %d (and %d taken from "
- "hysteresis)", pgn, pgn_borrowed);
+ "hysteresis, %d original)",
+ pgn, pgn_borrowed, original_gain);
#endif
}
@@ -3923,13 +3941,17 @@ void lose_piety(int pgn)
redraw_skill(you.your_name, player_title());
if (you.religion == GOD_ZIN)
- simple_god_message(" is no longer ready to cure all your mutations.");
+ simple_god_message(
+ " is no longer ready to cure all your mutations.");
else if (you.religion == GOD_SHINING_ONE)
- simple_god_message(" is no longer ready to bless your weapon.");
+ simple_god_message(
+ " is no longer ready to bless your weapon.");
else if (you.religion == GOD_KIKUBAAQUDGHA)
- simple_god_message(" is no longer ready to enhance your necromancy.");
+ simple_god_message(
+ " is no longer ready to enhance your necromancy.");
else if (you.religion == GOD_LUGONU)
- simple_god_message(" is no longer ready to corrupt your weapon.");
+ simple_god_message(
+ " is no longer ready to corrupt your weapon.");
}
for (int i = 0; i < MAX_GOD_ABILITIES; ++i)
@@ -4896,6 +4918,21 @@ bool player_can_join_god(god_type which_god)
return (true);
}
+// Identify any interesting equipment when the player signs up with a
+// new Service Pro^W^Wdeity.
+void god_welcome_identify_gear()
+{
+ // Check for amulets of faith.
+ item_def *amulet = you.slot_item(EQ_AMULET);
+ if (amulet && amulet->sub_type == AMU_FAITH)
+ {
+ // The flash happens independent of item id.
+ mpr("Your amulet flashes!", MSGCH_GOD);
+ flash_view_delay(god_colour(you.religion), 300);
+ set_ident_type(*amulet, ID_KNOWN_TYPE);
+ }
+}
+
void god_pitch(god_type which_god)
{
mprf("You %s the altar of %s.",
@@ -4978,6 +5015,8 @@ void god_pitch(god_type which_god)
you.worshipped[which_god] ? " back" : "").c_str());
more();
+ god_welcome_identify_gear();
+
// When you start worshipping a good god, you make all non-hostile
// unholy and evil beings hostile; when you start worshipping Zin,
// you make all non-hostile unclean and chaotic beings hostile; and
@@ -5158,9 +5197,10 @@ harm_protection_type god_protects_from_harm(god_type god, bool actual)
{
const int min_piety = piety_breakpoint(0);
bool praying = (you.duration[DUR_PRAYER]
- && random2(you.piety) >= min_piety);
+ && random2(piety_scale(you.piety)) >= min_piety);
bool reliable = (you.piety > 130);
- bool anytime = (one_chance_in(10) || x_chance_in_y(you.piety, 1000));
+ bool anytime = (one_chance_in(10) ||
+ x_chance_in_y(piety_scale(you.piety), 1000));
bool penance = (you.penance[god] > 0);
// If actual is true, return HPT_NONE if the given god can protect
diff --git a/crawl-ref/source/religion.h b/crawl-ref/source/religion.h
index 82f112b548..36b09e4f5c 100644
--- a/crawl-ref/source/religion.h
+++ b/crawl-ref/source/religion.h
@@ -87,6 +87,7 @@ int god_colour(god_type god);
bool player_can_join_god(god_type which_god);
void god_pitch(god_type which_god);
int piety_rank(int piety = -1);
+int piety_scale(int piety_change);
void offer_items();
bool god_hates_your_god(god_type god,
god_type your_god = you.religion);
diff --git a/crawl-ref/source/shopping.cc b/crawl-ref/source/shopping.cc
index 94cd11e25e..45b4f90a1f 100644
--- a/crawl-ref/source/shopping.cc
+++ b/crawl-ref/source/shopping.cc
@@ -1793,6 +1793,7 @@ unsigned int item_value( item_def item, bool ident )
break;
case AMU_THE_GOURMAND:
case AMU_GUARDIAN_SPIRIT:
+ case AMU_FAITH:
valued += 35;
break;
case AMU_CLARITY:
diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc
index 4a14fac513..323cb9c13e 100644
--- a/crawl-ref/source/xom.cc
+++ b/crawl-ref/source/xom.cc
@@ -233,7 +233,7 @@ static void _xom_is_stimulated(int maxinterestingness,
if (crawl_state.which_god_acting() == GOD_XOM)
return;
- int interestingness = random2(maxinterestingness);
+ int interestingness = random2(piety_scale(maxinterestingness));
interestingness = std::min(255, interestingness);
@@ -292,7 +292,7 @@ void xom_tick()
int size = abs(you.piety - HALF_MAX_PIETY);
// Piety slowly drifts towards the extremes.
- int delta = (x_chance_in_y(511, 1000) ? 1 : -1);
+ const int delta = piety_scale(x_chance_in_y(511, 1000) ? 1 : -1);
size += delta;
if (size > HALF_MAX_PIETY)
size = HALF_MAX_PIETY;
@@ -333,7 +333,7 @@ void xom_tick()
if (you.gift_timeout == 1)
simple_god_message(" is getting BORED.");
- if (one_chance_in(3))
+ if (wearing_amulet(AMU_FAITH)? coinflip() : one_chance_in(3))
{
const int tension = get_tension(GOD_XOM);
const int chance = (tension == 0 ? 1 :