summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-04-24 15:45:20 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-04-24 15:45:20 +0000
commita4cf0d15ce8bae7dbefe95b5709a403ab2f1ccaa (patch)
tree9d20ab89329eb4ef9c86d8292a9b39ea9dba1256 /crawl-ref/source
parent1c46649f35b7423825ea143b614661bc502c9cc5 (diff)
downloadcrawl-ref-a4cf0d15ce8bae7dbefe95b5709a403ab2f1ccaa.tar.gz
crawl-ref-a4cf0d15ce8bae7dbefe95b5709a403ab2f1ccaa.zip
Change Options.autopickup_on from boolean to 3-state: 1 (autopick up), 0
(autopickup off), -1 (autopickup turned off automatically). Only in the latter case does killing an invisible monster turn autopickup (back) on. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9691 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/acr.cc6
-rw-r--r--crawl-ref/source/beam.cc13
-rw-r--r--crawl-ref/source/delay.cc8
-rw-r--r--crawl-ref/source/externs.h2
-rw-r--r--crawl-ref/source/initfile.cc10
-rw-r--r--crawl-ref/source/items.cc2
-rw-r--r--crawl-ref/source/xom.cc55
7 files changed, 45 insertions, 51 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index 6309cefbb2..a7988f0bf9 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -1441,7 +1441,11 @@ void process_command( command_type cmd )
break;
case CMD_TOGGLE_AUTOPICKUP:
- _toggle_flag( &Options.autopickup_on, "Autopickup");
+ if (Options.autopickup_on < 1)
+ Options.autopickup_on = 1;
+ else
+ Options.autopickup_on = 0;
+ mprf("Autopickup is now %s.", Options.autopickup_on > 0 ? "on" : "off");
break;
case CMD_TOGGLE_FRIENDLY_PICKUP:
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 2110903319..c2e2a810e9 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -4948,18 +4948,7 @@ mon_resist_type bolt::apply_enchantment_to_monster(monsters* mon)
: "and vanishes!" );
if (!player_monster_visible(mon))
- {
- // Also turn off autopickup.
- Options.autopickup_on = false;
- mpr("Deactivating autopickup; reactivate with Ctrl-A.",
- MSGCH_WARN);
-
- if (Options.tutorial_left)
- {
- learned_something_new(TUT_INVISIBLE_DANGER);
- Options.tut_seen_invisible = you.num_turns;
- }
- }
+ autotoggle_autopickup(true);
}
obvious_effect = true;
diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc
index 0b80374a45..5ab64b9cf7 100644
--- a/crawl-ref/source/delay.cc
+++ b/crawl-ref/source/delay.cc
@@ -1917,9 +1917,9 @@ void autotoggle_autopickup(bool off)
{
if (off)
{
- if (Options.autopickup_on)
+ if (Options.autopickup_on > 0)
{
- Options.autopickup_on = false;
+ Options.autopickup_on = -1;
mprf(MSGCH_WARN,
"Deactivating autopickup; reactivate with <w>Ctrl+A</w>.");
}
@@ -1929,9 +1929,9 @@ void autotoggle_autopickup(bool off)
Options.tut_seen_invisible = you.num_turns;
}
}
- else if (!Options.autopickup_on)
+ else if (Options.autopickup_on < 0) // was turned off automatically
{
- Options.autopickup_on = true;
+ Options.autopickup_on = 1;
mprf(MSGCH_WARN, "Reactivating autopickup.");
}
}
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index b2b4b83152..28f0337792 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -1952,7 +1952,7 @@ public:
bool verbose_monster_pane;
- bool autopickup_on;
+ int autopickup_on;
int default_friendly_pickup;
bool show_more_prompt;
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc
index 1f48e6a6d2..9083bf85ab 100644
--- a/crawl-ref/source/initfile.cc
+++ b/crawl-ref/source/initfile.cc
@@ -684,7 +684,7 @@ void game_options::reset_options()
verbose_monster_pane = true;
- autopickup_on = true;
+ autopickup_on = 1;
default_friendly_pickup = FRIENDLY_PICKUP_FRIEND;
show_more_prompt = true;
@@ -2108,7 +2108,13 @@ void game_options::read_option_line(const std::string &str, bool runscript)
}
#endif
else BOOL_OPTION(use_old_selection_order);
- else BOOL_OPTION_NAMED("default_autopickup", autopickup_on);
+ else if (key == "default_autopickup")
+ {
+ if (_read_bool(field, true))
+ autopickup_on = 1;
+ else
+ autopickup_on = 0;
+ }
else if (key == "default_friendly_pickup")
{
if (field == "none")
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index 997453a9a5..d9b919c2eb 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -2350,7 +2350,7 @@ bool can_autopickup()
// [ds] Checking for autopickups == 0 is a bad idea because
// autopickup is still possible with inscriptions and
// pickup_thrown.
- if (!Options.autopickup_on)
+ if (Options.autopickup_on <= 0)
return (false);
if (you.flight_mode() == FL_LEVITATE)
diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc
index ed8c9f2371..46798f35e5 100644
--- a/crawl-ref/source/xom.cc
+++ b/crawl-ref/source/xom.cc
@@ -1010,7 +1010,6 @@ static bool _player_is_dead()
static bool _xom_do_potion()
{
- bool rc = false;
potion_type pot = POT_HEALING;
while (true)
{
@@ -1019,6 +1018,9 @@ static bool _xom_do_potion()
POT_SPEED, POT_MIGHT, POT_INVISIBILITY,
POT_BERSERK_RAGE, POT_EXPERIENCE, -1));
+ if (pot == POT_EXPERIENCE && !one_chance_in(6))
+ pot = POT_BERSERK_RAGE;
+
bool has_effect = true;
// Don't pick something that won't have an effect.
// Extending an existing effect is okay, though.
@@ -1054,38 +1056,30 @@ static bool _xom_do_potion()
break;
}
- if (pot == POT_EXPERIENCE && !one_chance_in(6))
- pot = POT_BERSERK_RAGE;
-
- if (pot != POT_BERSERK_RAGE || you.can_go_berserk(false))
- {
- god_speaks(GOD_XOM, _get_xom_speech("potion effect").c_str());
-
- if (pot == POT_BERSERK_RAGE)
- you.berserk_penalty = NO_BERSERK_PENALTY;
-
- // Take a note.
- std::string potion_msg = "potion effect ";
- switch (pot)
- {
- case POT_HEALING: potion_msg += "(healing)"; break;
- case POT_HEAL_WOUNDS: potion_msg += "(heal wounds)"; break;
- case POT_SPEED: potion_msg += "(speed)"; break;
- case POT_MIGHT: potion_msg += "(might)"; break;
- case POT_INVISIBILITY: potion_msg += "(invisibility)"; break;
- case POT_BERSERK_RAGE: potion_msg += "(berserk)"; break;
- case POT_EXPERIENCE: potion_msg += "(experience)"; break;
- default: potion_msg += "(other)"; break;
- }
- take_note(Note(NOTE_XOM_EFFECT, you.piety, -1,
- potion_msg.c_str()), true);
+ god_speaks(GOD_XOM, _get_xom_speech("potion effect").c_str());
- potion_effect(pot, 150);
+ if (pot == POT_BERSERK_RAGE)
+ you.berserk_penalty = NO_BERSERK_PENALTY;
- rc = true;
+ // Take a note.
+ std::string potion_msg = "potion effect ";
+ switch (pot)
+ {
+ case POT_HEALING: potion_msg += "(healing)"; break;
+ case POT_HEAL_WOUNDS: potion_msg += "(heal wounds)"; break;
+ case POT_MAGIC: potion_msg += "(magic)"; break;
+ case POT_SPEED: potion_msg += "(speed)"; break;
+ case POT_MIGHT: potion_msg += "(might)"; break;
+ case POT_INVISIBILITY: potion_msg += "(invisibility)"; break;
+ case POT_BERSERK_RAGE: potion_msg += "(berserk)"; break;
+ case POT_EXPERIENCE: potion_msg += "(experience)"; break;
+ default: potion_msg += "(other)"; break;
}
+ take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, potion_msg.c_str()), true);
- return (rc);
+ potion_effect(pot, 150);
+
+ return (true);
}
static bool _xom_confuse_monsters(int sever)
@@ -1638,7 +1632,7 @@ static bool _xom_is_good(int sever, int tension)
// This series of random calls produces a poisson-looking
// distribution: initial hump, plus a long-ish tail.
- // Don't make the player go berserk if there's no danger.
+ // Don't make the player go berserk etc. if there's no danger.
if (tension > random2(3) && x_chance_in_y(2, sever))
done = _xom_do_potion();
else if (x_chance_in_y(3, sever))
@@ -2167,6 +2161,7 @@ static void _xom_miscast(const int max_level, const bool nasty)
god_speaks(GOD_XOM, _get_xom_speech(speech_str).c_str());
+ bool flavour_only = false;
MiscastEffect(&you, -GOD_XOM, SPTYP_RANDOM, level, cause_str, NH_DEFAULT,
lethality_margin, hand_str, can_plural);
}