summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarshan Shaligram <dshaligram@users.sourceforge.net>2010-01-11 17:12:07 +0530
committerDarshan Shaligram <dshaligram@users.sourceforge.net>2010-01-11 17:12:07 +0530
commit40b5e8b46a50b9f3f23099983f3799534ff7e211 (patch)
tree088420d917e2d3bd1089f16bff71617b03653aca
parent577f5d3f5ae46c69a2064405db110d6988a5c9a4 (diff)
parent00abd7f656ea920f8d69d57de0d5f2ecfd9a8f3a (diff)
downloadcrawl-ref-40b5e8b46a50b9f3f23099983f3799534ff7e211.tar.gz
crawl-ref-40b5e8b46a50b9f3f23099983f3799534ff7e211.zip
Merge branch 'amulet-refactoring'
-rw-r--r--crawl-ref/source/artefact.cc9
-rw-r--r--crawl-ref/source/dat/descript/items.txt22
-rw-r--r--crawl-ref/source/describe.cc3
-rw-r--r--crawl-ref/source/exclude.cc16
-rw-r--r--crawl-ref/source/goditem.cc3
-rw-r--r--crawl-ref/source/invent.cc14
-rw-r--r--crawl-ref/source/it_use2.cc5
-rw-r--r--crawl-ref/source/item_use.cc78
-rw-r--r--crawl-ref/source/item_use.h5
-rw-r--r--crawl-ref/source/itemname.cc6
-rw-r--r--crawl-ref/source/itemprop-enum.h4
-rw-r--r--crawl-ref/source/l_you.cc2
-rw-r--r--crawl-ref/source/main.cc24
-rw-r--r--crawl-ref/source/makeitem.cc4
-rw-r--r--crawl-ref/source/misc.cc11
-rw-r--r--crawl-ref/source/monster.cc4
-rw-r--r--crawl-ref/source/output.cc7
-rw-r--r--crawl-ref/source/player.cc70
-rw-r--r--crawl-ref/source/player.h2
-rw-r--r--crawl-ref/source/religion.cc58
-rw-r--r--crawl-ref/source/religion.h1
-rw-r--r--crawl-ref/source/shopping.cc2
-rw-r--r--crawl-ref/source/spells1.cc5
-rw-r--r--crawl-ref/source/spells3.cc7
-rw-r--r--crawl-ref/source/tags.cc40
-rw-r--r--crawl-ref/source/tags.h7
-rw-r--r--crawl-ref/source/xom.cc8
27 files changed, 267 insertions, 150 deletions
diff --git a/crawl-ref/source/artefact.cc b/crawl-ref/source/artefact.cc
index a8648bf4d2..72288ed158 100644
--- a/crawl-ref/source/artefact.cc
+++ b/crawl-ref/source/artefact.cc
@@ -102,11 +102,8 @@ static bool _god_fits_artefact(const god_type which_god, const item_def &item,
if (item.base_type == OBJ_WEAPONS && item.sub_type == WPN_QUICK_BLADE)
type_bad = true;
- if (item.base_type == OBJ_JEWELLERY && (item.sub_type == AMU_RAGE
- || item.sub_type == AMU_RESIST_SLOW))
- {
+ if (item.base_type == OBJ_JEWELLERY && item.sub_type == AMU_RAGE)
type_bad = true;
- }
break;
default:
@@ -1812,6 +1809,10 @@ static bool _randart_is_redundant( const item_def &item,
case AMU_INACCURACY:
provides = ARTP_ACCURACY;
break;
+
+ case AMU_STASIS:
+ provides = ARTP_PREVENT_TELEPORTATION;
+ break;
}
if (provides == ARTP_NUM_PROPERTIES)
diff --git a/crawl-ref/source/dat/descript/items.txt b/crawl-ref/source/dat/descript/items.txt
index 38c200413b..eda55ca396 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,22 @@ 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.
+%%%%
+amulet of stasis
+
+An amulet meticulously constructed with magical wards to block magical
+and physiological effects that would otherwise teleport, slow, haste,
+or paralyse its wearer.
+
+While the amulet is effective against most translocular magic, plane
+shifts such as banishment are beyond its ability to block.
+%%%%
ankus
What mahouts steer their elephants with. It basically resembles a
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index fc7a2f4d5c..83524b08da 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -144,7 +144,6 @@ const char* jewellery_base_ability_string(int subtype)
case RING_FIRE: return "Fire";
case RING_ICE: return "Ice";
case RING_TELEPORT_CONTROL: return "cTele";
- case AMU_RESIST_SLOW: return "rSlow";
case AMU_CLARITY: return "Clar";
case AMU_WARDING: return "Ward";
case AMU_RESIST_CORROSION: return "rCorr";
@@ -153,6 +152,8 @@ const char* jewellery_base_ability_string(int subtype)
case AMU_CONTROLLED_FLIGHT: return "cFly";
case AMU_RESIST_MUTATION: return "rMut";
case AMU_GUARDIAN_SPIRIT: return "Spirit";
+ case AMU_FAITH: return "Faith";
+ case AMU_STASIS: return "Stasis";
}
return "";
}
diff --git a/crawl-ref/source/exclude.cc b/crawl-ref/source/exclude.cc
index 79f8860f9d..1d16ac3aa1 100644
--- a/crawl-ref/source/exclude.cc
+++ b/crawl-ref/source/exclude.cc
@@ -620,19 +620,9 @@ void unmarshallExcludes(reader& inf, char minorVersion, exclude_set &excludes)
{
coord_def c;
unmarshallCoord(inf, c);
- const int radius = unmarshallShort(inf);
- bool autoexcl = false;
- autoexcl = unmarshallBoolean(inf);
- std::string desc = "";
- if (minorVersion < TAG_MINOR_EXCLUSION_DESC)
- {
- monster_type mon = static_cast<monster_type>(unmarshallShort(inf));
- if (mon != MONS_NO_MONSTER)
- desc = mons_type_name(mon, DESC_PLAIN);
- }
- else
- desc = unmarshallString(inf);
-
+ const int radius = unmarshallShort(inf);
+ const bool autoexcl = unmarshallBoolean(inf);
+ const std::string desc = unmarshallString(inf);
excludes.add_exclude(c, radius, autoexcl, desc);
}
}
diff --git a/crawl-ref/source/goditem.cc b/crawl-ref/source/goditem.cc
index dbcb130e59..83e83a7b70 100644
--- a/crawl-ref/source/goditem.cc
+++ b/crawl-ref/source/goditem.cc
@@ -271,8 +271,7 @@ bool is_hasty_item(const item_def& item)
retval = (item.sub_type == WAND_HASTING);
break;
case OBJ_JEWELLERY:
- retval = (item.sub_type == AMU_RAGE
- || item.sub_type == AMU_RESIST_SLOW);
+ retval = (item.sub_type == AMU_RAGE);
break;
case OBJ_POTIONS:
retval = (item.sub_type == POT_SPEED
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/it_use2.cc b/crawl-ref/source/it_use2.cc
index 49371f2f80..1221daad12 100644
--- a/crawl-ref/source/it_use2.cc
+++ b/crawl-ref/source/it_use2.cc
@@ -61,7 +61,6 @@ bool potion_effect(potion_type pot_eff, int pow, bool drank_it, bool was_known)
switch (pot_eff)
{
case POT_HEALING:
-
inc_hp((5 + random2(7)) / factor, false);
mpr("You feel better.");
@@ -138,8 +137,8 @@ bool potion_effect(potion_type pot_eff, int pow, bool drank_it, bool was_known)
break;
case POT_SPEED:
- haste_player((40 + random2(pow)) / factor);
- did_god_conduct(DID_HASTY, 10, was_known);
+ if (haste_player((40 + random2(pow)) / factor))
+ did_god_conduct(DID_HASTY, 10, was_known);
break;
case POT_MIGHT:
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index fff392ac31..542ed56a20 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);
@@ -5823,6 +5856,49 @@ bool wearing_slot(int inv_slot)
return (false);
}
+bool item_blocks_teleport(bool permit_id)
+{
+ return (scan_artefacts(ARTP_PREVENT_TELEPORTATION)
+ || stasis_blocks_effect(permit_id, NULL));
+}
+
+bool stasis_blocks_effect(bool identify,
+ const char *msg, int noise,
+ const char *silenced_msg)
+{
+ if (wearing_amulet(AMU_STASIS))
+ {
+ item_def *amulet = you.slot_item(EQ_AMULET);
+
+ if (msg)
+ {
+ const std::string name(amulet? amulet->name(DESC_CAP_YOUR) :
+ "Something");
+ const std::string message =
+ make_stringf(msg, name.c_str());
+
+ if (noise)
+ {
+ if (!noisy(noise, you.pos(), message.c_str())
+ && silenced_msg)
+ {
+ mprf(silenced_msg, name.c_str());
+ }
+ }
+ else
+ {
+ mpr(message.c_str());
+ }
+ }
+
+ // In all cases, the amulet auto-ids if requested.
+ if (amulet && identify)
+ set_ident_type(*amulet, ID_KNOWN_TYPE);
+ return (true);
+ }
+ return (false);
+}
+
#ifdef USE_TILE
// Interactive menu for item drop/use.
diff --git a/crawl-ref/source/item_use.h b/crawl-ref/source/item_use.h
index bba83aa3b4..d264d0fdf6 100644
--- a/crawl-ref/source/item_use.h
+++ b/crawl-ref/source/item_use.h
@@ -116,6 +116,11 @@ void warn_shield_penalties();
bool wearing_slot(int inv_slot);
+bool item_blocks_teleport(bool permit_id);
+bool stasis_blocks_effect(bool identify,
+ const char *msg, int noise = 0,
+ const char *silencedmsg = NULL);
+
#ifdef USE_TILE
void tile_item_use_floor(int idx);
void tile_item_pickup(int idx);
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index 7e61efcf32..fa8bbc9332 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -585,7 +585,6 @@ static const char* jewellery_type_name(int jeweltype)
case RING_ICE: return "ring of ice";
case RING_TELEPORT_CONTROL: return "ring of teleport control";
case AMU_RAGE: return "amulet of rage";
- case AMU_RESIST_SLOW: return "amulet of resist slowing";
case AMU_CLARITY: return "amulet of clarity";
case AMU_WARDING: return "amulet of warding";
case AMU_RESIST_CORROSION: return "amulet of resist corrosion";
@@ -595,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";
}
}
@@ -2734,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 cc807371a4..a079cc9368 100644
--- a/crawl-ref/source/itemprop-enum.h
+++ b/crawl-ref/source/itemprop-enum.h
@@ -178,7 +178,6 @@ enum jewellery_type
AMU_FIRST_AMULET = 35,
AMU_RAGE = AMU_FIRST_AMULET, // 35
- AMU_RESIST_SLOW,
AMU_CLARITY,
AMU_WARDING,
AMU_RESIST_CORROSION,
@@ -188,6 +187,8 @@ enum jewellery_type
AMU_INACCURACY,
AMU_RESIST_MUTATION,
AMU_GUARDIAN_SPIRIT,
+ AMU_FAITH,
+ AMU_STASIS,
NUM_JEWELLERY
};
@@ -574,4 +575,3 @@ enum zap_count_type
};
#endif
-
diff --git a/crawl-ref/source/l_you.cc b/crawl-ref/source/l_you.cc
index c43b91f737..9380968be6 100644
--- a/crawl-ref/source/l_you.cc
+++ b/crawl-ref/source/l_you.cc
@@ -89,7 +89,6 @@ LUARET1(you_res_draining, number, player_prot_life(false))
LUARET1(you_res_shock, number, player_res_electricity(false))
LUARET1(you_res_statdrain, number, player_sust_abil(false))
LUARET1(you_res_mutation, number, wearing_amulet(AMU_RESIST_MUTATION, false))
-LUARET1(you_res_slowing, number, wearing_amulet(AMU_RESIST_SLOW, false))
LUARET1(you_gourmand, boolean, wearing_amulet(AMU_THE_GOURMAND, false))
LUARET1(you_saprovorous, number, player_mutation_level(MUT_SAPROVOROUS))
LUARET1(you_levitating, boolean, you.flight_mode() == FL_LEVITATE)
@@ -181,7 +180,6 @@ static const struct luaL_reg you_clib[] =
{ "res_shock" , you_res_shock },
{ "res_statdrain", you_res_statdrain },
{ "res_mutation", you_res_mutation },
- { "res_slowing", you_res_slowing },
{ "saprovorous", you_saprovorous },
{ "gourmand", you_gourmand },
{ "levitating", you_levitating },
diff --git a/crawl-ref/source/main.cc b/crawl-ref/source/main.cc
index 0d327cd180..bd226dc7d8 100644
--- a/crawl-ref/source/main.cc
+++ b/crawl-ref/source/main.cc
@@ -2503,26 +2503,8 @@ static void _decrement_durations()
// slowing, exhaustion still ends haste.
if (you.duration[DUR_HASTE] > 0)
{
- if (wearing_amulet(AMU_RESIST_SLOW))
- {
- if (you.duration[DUR_HASTE] > 3 * BASELINE_DELAY)
- {
- you.set_duration(DUR_HASTE, div_rand_round(2 + coinflip(), 2));
- mpr("Your extra speed is starting to run out.",
- MSGCH_DURATION);
- }
- else
- {
- mpr("You feel yourself slow down.", MSGCH_DURATION);
- you.duration[DUR_HASTE] = 0;
- }
- did_god_conduct(DID_HASTY, 3, true);
- }
- else
- {
- // Silently cancel haste, then slow player.
- you.duration[DUR_HASTE] = 0;
- }
+ // Silently cancel haste, then slow player.
+ you.duration[DUR_HASTE] = 0;
}
slow_player(dur);
}
@@ -2531,7 +2513,7 @@ static void _decrement_durations()
you.hunger = std::max(50, you.hunger);
// 1KB: No berserk healing.
- you.hp = (you.hp + 1) / 2;
+ you.hp = (you.hp + 1) * 2 / 3;
calc_hp();
learned_something_new(TUT_POSTBERSERK);
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/misc.cc b/crawl-ref/source/misc.cc
index 5b07af973f..577221fff8 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -48,6 +48,7 @@
#include "itemname.h"
#include "itemprop.h"
#include "items.h"
+#include "item_use.h"
#include "lev-pand.h"
#include "macro.h"
#include "makeitem.h"
@@ -2698,6 +2699,14 @@ bool go_berserk(bool intentional, bool potion)
if (!you.can_go_berserk(intentional, potion))
return (false);
+ if (stasis_blocks_effect(true,
+ "%s thrums violently and saps your rage.",
+ 3,
+ "%s vibrates violently and saps your rage."))
+ {
+ return (false);
+ }
+
if (Tutorial.tutorial_left)
Tutorial.tut_berserk_counter++;
@@ -2713,7 +2722,7 @@ bool go_berserk(bool intentional, bool potion)
you.increase_duration(DUR_BERSERKER, berserk_duration);
calc_hp();
- you.hp *= 2;
+ you.hp = you.hp * 3 / 2;
deflate_hp(you.hp_max, false);
diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc
index 92e56fec1c..d1d6f659a9 100644
--- a/crawl-ref/source/monster.cc
+++ b/crawl-ref/source/monster.cc
@@ -4138,7 +4138,7 @@ void monsters::add_enchantment_effect(const mon_enchant &ench, bool quiet)
case ENCH_INSANE:
case ENCH_BERSERK:
// Inflate hp.
- scale_hp(2, 1);
+ scale_hp(3, 2);
if (has_ench(ENCH_SUBMERGED))
del_ench(ENCH_SUBMERGED);
@@ -4357,7 +4357,7 @@ void monsters::remove_enchantment_effect(const mon_enchant &me, bool quiet)
// deliberate fall through
case ENCH_BERSERK:
- scale_hp(1, 2);
+ scale_hp(2, 3);
break;
case ENCH_HASTE:
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index 419e9ef3cf..7a55f02527 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -1837,7 +1837,6 @@ static std::vector<formatted_string> _get_overview_resistances(
|| you.religion == GOD_ZIN && you.piety >= 150);
const int rrott = (you.res_rotting()
|| you.religion == GOD_ZIN && you.piety >= 150);
- const int rslow = wearing_amulet(AMU_RESIST_SLOW, calc_unid);
snprintf(buf, sizeof buf,
"%sRes.Fire : %s\n"
@@ -1848,8 +1847,7 @@ static std::vector<formatted_string> _get_overview_resistances(
"%sSpirit.Shd: %s\n"
"%sSust.Abil.: %s\n"
"%sRes.Mut. : %s\n"
- "%sRes.Rott. : %s\n"
- "%sRes.Slow : %s\n",
+ "%sRes.Rott. : %s\n",
_determine_colour_string(rfire, 3), itosym3(rfire),
_determine_colour_string(rcold, 3), itosym3(rcold),
_determine_colour_string(rlife, 3), itosym3(rlife),
@@ -1858,8 +1856,7 @@ static std::vector<formatted_string> _get_overview_resistances(
_determine_colour_string(rspir, 1), itosym1(rspir),
_determine_colour_string(rsust, 1), itosym1(rsust),
_determine_colour_string(rmuta, 1), itosym1(rmuta),
- _determine_colour_string(rrott, 1), itosym1(rrott),
- _determine_colour_string(rslow, 1), itosym1(rslow));
+ _determine_colour_string(rrott, 1), itosym1(rrott));
cols.add_formatted(0, buf, false);
int saplevel = player_mutation_level(MUT_SAPROVOROUS);
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index c2f62c6a35..7163906662 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -35,6 +35,7 @@
#include "itemname.h"
#include "itemprop.h"
#include "items.h"
+#include "item_use.h"
#include "it_use2.h"
#include "kills.h"
#include "macro.h"
@@ -4981,24 +4982,15 @@ bool slow_player(int turns)
if (turns <= 0)
return (false);
+ if (stasis_blocks_effect(true, "%s rumbles.", 20, "%s rumbles."))
+ return (false);
+
// Doubling these values because moving while slowed takes twice the
// usual delay.
turns *= 2;
int threshold = 100 * 2;
- if (wearing_amulet(AMU_RESIST_SLOW))
- {
- mpr("You feel momentarily lethargic.");
-
- // Identify amulet.
- item_def *amulet = you.slot_item(EQ_AMULET);
- did_god_conduct(DID_HASTY, 5, !amulet || item_type_known(*amulet));
- if (amulet && !item_type_known(*amulet))
- set_ident_type(*amulet, ID_KNOWN_TYPE);
-
- return (false);
- }
- else if (you.duration[DUR_SLOW] >= threshold * BASELINE_DELAY)
+ if (you.duration[DUR_SLOW] >= threshold * BASELINE_DELAY)
mpr("You already are as slow as you could be.");
else
{
@@ -5022,10 +5014,7 @@ void dec_slow_player(int delay)
if (you.duration[DUR_SLOW] > BASELINE_DELAY)
{
// BCR - Amulet of resist slow affects slow counter.
- if (wearing_amulet(AMU_RESIST_SLOW))
- you.duration[DUR_SLOW] -= 5 * delay;
- else
- you.duration[DUR_SLOW] -= delay;
+ you.duration[DUR_SLOW] -= delay;
}
if (you.duration[DUR_SLOW] <= BASELINE_DELAY)
{
@@ -5034,27 +5023,23 @@ void dec_slow_player(int delay)
}
}
-void haste_player(int turns)
+bool haste_player(int turns)
{
ASSERT(!crawl_state.arena);
if (turns <= 0)
- return;
-
- bool amu_eff = wearing_amulet(AMU_RESIST_SLOW);
+ return (false);
- if (amu_eff)
+ if (stasis_blocks_effect(true, "%s emits a piercing whistle.", 20,
+ "%s makes your neck tingle."))
{
- mpr("Your amulet glows brightly.");
- item_def *amulet = you.slot_item(EQ_AMULET);
- if (amulet && !item_type_known(*amulet))
- set_ident_type(*amulet, ID_KNOWN_TYPE);
+ return (false);
}
// Cutting the nominal turns in half since hasted actions take half the
// usual delay.
turns /= 2;
- int threshold = (80 + 20 * amu_eff) / 2;
+ const int threshold = 40;
if (you.duration[DUR_HASTE] == 0)
mpr("You feel yourself speed up.");
@@ -5067,8 +5052,9 @@ void haste_player(int turns)
}
you.increase_duration(DUR_HASTE, turns, threshold);
-
did_god_conduct(DID_STIMULANTS, 4 + random2(4));
+
+ return (true);
}
void dec_haste_player(int delay)
@@ -5080,9 +5066,7 @@ void dec_haste_player(int delay)
{
int old_dur = you.duration[DUR_HASTE];
- // BCR - Amulet of resist slow affects haste counter
- if (!wearing_amulet(AMU_RESIST_SLOW) || coinflip())
- you.duration[DUR_HASTE] -= delay;
+ you.duration[DUR_HASTE] -= delay;
int threshold = 6 * BASELINE_DELAY;
// message if we cross the threshold
@@ -6044,6 +6028,21 @@ bool player::can_go_berserk(bool intentional, bool potion) const
return (false);
}
+ // Stasis, but only for identified amulets; unided amulets will
+ // trigger when the player attempts to activate berserk,
+ // auto-iding at that point, but also killing the berserk and
+ // wasting a turn.
+ if (wearing_amulet(AMU_STASIS, false))
+ {
+ if (verbose)
+ {
+ const item_def *amulet = you.slot_item(EQ_AMULET);
+ mprf("You cannot go berserk with %s on.",
+ amulet? amulet->name(DESC_NOCAP_YOUR).c_str() : "your amulet");
+ }
+ return (false);
+ }
+
if (!intentional && !potion && player_mental_clarity(true))
{
if (verbose)
@@ -6618,7 +6617,7 @@ bool player::confusable() const
bool player::slowable() const
{
- return (!wearing_amulet(AMU_RESIST_SLOW));
+ return true;
}
flight_type player::flight_mode() const
@@ -6800,6 +6799,10 @@ void player::paralyse(actor *who, int str)
{
ASSERT(!crawl_state.arena);
+ // The shock is too mild to do damage.
+ if (stasis_blocks_effect(true, "%s gives you a mild electric shock."))
+ return;
+
int &paralysis(duration[DUR_PARALYSIS]);
mprf("You %s the ability to move!",
@@ -6817,6 +6820,9 @@ void player::petrify(actor *who, int str)
{
ASSERT(!crawl_state.arena);
+ if (stasis_blocks_effect(true, "%s gives you a mild electric shock."))
+ return;
+
str *= BASELINE_DELAY;
int &petrif(duration[DUR_PETRIFIED]);
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index ca1bb06bc2..81b0fe44d4 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -771,7 +771,7 @@ void dec_napalm_player(int delay);
bool slow_player(int turns);
void dec_slow_player(int delay);
-void haste_player(int turns);
+bool haste_player(int turns);
void dec_haste_player(int delay);
void dec_disease_player(int delay);
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index aba33ed8b4..0c79623409 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -3603,6 +3603,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)
@@ -3633,15 +3636,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)
{
@@ -3701,7 +3718,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
}
@@ -3927,13 +3945,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)
@@ -4900,6 +4922,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.",
@@ -4982,6 +5019,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
@@ -5162,9 +5201,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 5606ef4428..45b4f90a1f 100644
--- a/crawl-ref/source/shopping.cc
+++ b/crawl-ref/source/shopping.cc
@@ -1793,12 +1793,12 @@ 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:
case AMU_RESIST_CORROSION:
case AMU_RESIST_MUTATION:
- case AMU_RESIST_SLOW:
case AMU_WARDING:
valued += 30;
break;
diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc
index 8ece64285d..8fa30ade07 100644
--- a/crawl-ref/source/spells1.cc
+++ b/crawl-ref/source/spells1.cc
@@ -31,6 +31,7 @@
#include "it_use2.h"
#include "itemname.h"
#include "itemprop.h"
+#include "item_use.h"
#include "los.h"
#include "message.h"
#include "misc.h"
@@ -83,7 +84,7 @@ int blink(int pow, bool high_level_controlled_blink, bool wizard_blink)
}
// yes, there is a logic to this ordering {dlb}:
- if (scan_artefacts(ARTP_PREVENT_TELEPORTATION) && !wizard_blink)
+ if (item_blocks_teleport(true) && !wizard_blink)
mpr("You feel a weird sense of stasis.");
else if (you.level_type == LEVEL_ABYSS
&& _abyss_blocks_teleport(high_level_controlled_blink)
@@ -199,7 +200,7 @@ void random_blink(bool allow_partial_control, bool override_abyss)
bool success = false;
coord_def target;
- if (scan_artefacts(ARTP_PREVENT_TELEPORTATION))
+ if (item_blocks_teleport(true))
mpr("You feel a weird sense of stasis.");
else if (you.level_type == LEVEL_ABYSS
&& !override_abyss && !one_chance_in(3))
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc
index 1a30607199..a885e9eb42 100644
--- a/crawl-ref/source/spells3.cc
+++ b/crawl-ref/source/spells3.cc
@@ -34,6 +34,7 @@
#include "itemname.h"
#include "itemprop.h"
#include "items.h"
+#include "item_use.h"
#include "message.h"
#include "misc.h"
#include "mon-behv.h"
@@ -1383,8 +1384,10 @@ bool allow_control_teleport(bool quiet)
void you_teleport(void)
{
- if (scan_artefacts(ARTP_PREVENT_TELEPORTATION))
+ if (item_blocks_teleport(true))
+ {
mpr("You feel a weird sense of stasis.");
+ }
else if (you.duration[DUR_TELEPORT])
{
mpr("You feel strangely stable.");
@@ -1493,7 +1496,7 @@ static bool _teleport_player(bool allow_control, bool new_abyss_area, bool wizar
if (wizard_tele)
is_controlled = true;
- if (scan_artefacts(ARTP_PREVENT_TELEPORTATION) && !wizard_tele)
+ if (item_blocks_teleport(true) && !wizard_tele)
{
mpr("You feel a strange sense of stasis.");
return (false);
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc
index 5c5190bccd..3f0ee61f5a 100644
--- a/crawl-ref/source/tags.cc
+++ b/crawl-ref/source/tags.cc
@@ -1547,18 +1547,9 @@ static void tag_read_you(reader &th, char minorVersion)
you.water_in_sight = -1;
// List of currently beholding monsters (usually empty).
- if (minorVersion >= TAG_MINOR_BEHELD16)
- {
- count_c = unmarshallShort(th);
- for (i = 0; i < count_c; i++)
- you.beholders.push_back(unmarshallShort(th));
- }
- else
- {
- count_c = unmarshallByte(th);
- for (i = 0; i < count_c; i++)
- you.beholders.push_back(unmarshallByte(th));
- }
+ count_c = unmarshallShort(th);
+ for (i = 0; i < count_c; i++)
+ you.beholders.push_back(unmarshallShort(th));
you.piety_hysteresis = unmarshallByte(th);
@@ -1655,20 +1646,17 @@ static void tag_read_you_items(reader &th, char minorVersion)
for (j = 0; j < count_s; ++j)
you.seen_spell[j] = unmarshallByte(th);
- if (minorVersion >= TAG_MINOR_SEEN_WEAPONS_ARMOUR)
- {
- count_s = unmarshallShort(th);
- if (count_s > NUM_WEAPONS)
- count_s = NUM_WEAPONS;
- for (j = 0; j < count_s; ++j)
- you.seen_weapon[j] = unmarshallLong(th);
-
- count_s = unmarshallShort(th);
- if (count_s > NUM_ARMOURS)
- count_s = NUM_ARMOURS;
- for (j = 0; j < count_s; ++j)
- you.seen_armour[j] = unmarshallLong(th);
- }
+ count_s = unmarshallShort(th);
+ if (count_s > NUM_WEAPONS)
+ count_s = NUM_WEAPONS;
+ for (j = 0; j < count_s; ++j)
+ you.seen_weapon[j] = unmarshallLong(th);
+
+ count_s = unmarshallShort(th);
+ if (count_s > NUM_ARMOURS)
+ count_s = NUM_ARMOURS;
+ for (j = 0; j < count_s; ++j)
+ you.seen_armour[j] = unmarshallLong(th);
}
static PlaceInfo unmarshallPlaceInfo(reader &th)
diff --git a/crawl-ref/source/tags.h b/crawl-ref/source/tags.h
index e2559d33fd..e7e42ea717 100644
--- a/crawl-ref/source/tags.h
+++ b/crawl-ref/source/tags.h
@@ -40,17 +40,14 @@ enum tag_file_type // file types supported by tag system
enum tag_major_version
{
TAG_MAJOR_START = 5,
- TAG_MAJOR_VERSION = 15
+ TAG_MAJOR_VERSION = 16
};
// Minor version will be reset to zero when major version changes.
enum tag_minor_version
{
TAG_MINOR_RESET = 0, // Minor tags were reset
- TAG_MINOR_SEEN_WEAPONS_ARMOUR = 1,
- TAG_MINOR_BEHELD16 = 2, // Use correct type sizes for beholders
- TAG_MINOR_EXCLUSION_DESC = 3, // Mark exclusion reason in annotation.
- TAG_MINOR_VERSION = 3 // Current version. (Keep equal to max.)
+ TAG_MINOR_VERSION = 0 // Current version. (Keep equal to max.)
};
struct enum_info
diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc
index 4a14fac513..1ea7e3c76f 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 :
@@ -469,7 +469,7 @@ static bool _teleportation_check(const spell_type spell = SPELL_TELEPORT_SELF)
{
case SPELL_BLINK:
case SPELL_TELEPORT_SELF:
- return (!scan_artefacts(ARTP_PREVENT_TELEPORTATION));
+ return (!item_blocks_teleport(false));
default:
return (true);
}