summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/docs/crawl_options.txt13
-rw-r--r--crawl-ref/init.txt1
-rw-r--r--crawl-ref/source/enum.h1
-rw-r--r--crawl-ref/source/externs.h1
-rw-r--r--crawl-ref/source/initfile.cc14
-rw-r--r--crawl-ref/source/message.cc4
-rw-r--r--crawl-ref/source/player.cc6
7 files changed, 35 insertions, 5 deletions
diff --git a/crawl-ref/docs/crawl_options.txt b/crawl-ref/docs/crawl_options.txt
index 08009464ad..52645d50bc 100644
--- a/crawl-ref/docs/crawl_options.txt
+++ b/crawl-ref/docs/crawl_options.txt
@@ -45,9 +45,9 @@ The contents of this text are:
easy_unequip, easy_confirm, easy_quit_item_prompts,
easy_exit_menu, default_autoprayer, sort_menus
4-i Message and Display Improvements.
- hp_warning, hp_colour, mp_colour, always_greet, terse_hand,
- delay_message_clear, menu_colour, increasing_skill_progress,
- show_turns
+ hp_warning, magic_point_warninghp_colour, mp_colour, always_greet,
+ terse_hand, delay_message_clear, menu_colour,
+ increasing_skill_progress, show_turns
4-j Missiles.
fire_items_start, fire_order
4-k Message Channels.
@@ -642,9 +642,14 @@ sort_menus = (true | false | auto:X)
hp_warning = 10
hp_warning gives "* * * LOW HITPOINT WARNING * * *" on the danger
- channel when the player takens damage and their hitpoints are less than
+ channel when the player takes damage and their hitpoints are less than
this percentage of their maximum (use 0 to turn off these messages).
+mp_warning = 10
+ mp_warning gives "* * * LOW MAGIC WARNING * * *" on the danger
+ channel when the player's magic points drop below this percentage of
+ their maximum (use 0 to turn off these messages).
+
hp_colour = lightgrey, 50:yellow, 25:red
hp_colour colours your HP appropriately in the display. In the default
setting, your HP will appear in red if at less then 25%, yellow if at
diff --git a/crawl-ref/init.txt b/crawl-ref/init.txt
index 4e118c41e5..f1a0457750 100644
--- a/crawl-ref/init.txt
+++ b/crawl-ref/init.txt
@@ -154,6 +154,7 @@ stab_brand = hi:blue
##### 4-i Messages and Display Enhancements #####
#
# hp_warning = 10
+# mp_warning = 10
# hp_colour = lightgrey, 50:yellow, 25:red
# mp_colour = lightgrey, 50:yellow, 25:red
# terse_hand = false
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 16d0e95be6..9e49de664e 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -1751,6 +1751,7 @@ enum msg_channel_type
MSGCH_MULTITURN_ACTION, // delayed action messages
MSGCH_DIAGNOSTICS, // various diagnostic messages
MSGCH_TUTORIAL, // messages for tutorial
+ MSGCH_DANGER_MAGIC, // low magic warning
NUM_MESSAGE_CHANNELS // always last
};
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index a80061df10..1a96da890f 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -1130,6 +1130,7 @@ public:
int priest; // choice of god for priests (Zin/Yred)
bool random_pick; // randomly generate character
int hp_warning; // percentage hp for danger warning
+ int magic_point_warning; // percentage mp for danger warning
char race; // preselected race
char cls; // preselected class
bool terse_hand; // use terse description for wielded item
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc
index 19296c5644..790bfbfcd5 100644
--- a/crawl-ref/source/initfile.cc
+++ b/crawl-ref/source/initfile.cc
@@ -148,7 +148,8 @@ static const std::string message_channel_names[ NUM_MESSAGE_CHANNELS ] =
"plain", "prompt", "god", "pray", "duration", "danger", "warning", "food",
"recovery", "sound", "talk", "intrinsic_gain", "mutation", "monster_spell",
"monster_enchant", "monster_damage", "monster_target",
- "rotten_meat", "equipment", "floor", "multiturn", "diagnostic",
+ "rotten_meat", "equipment", "floor", "multiturn", "diagnostic","tutorial",
+ "magic_warning",
};
// returns -1 if unmatched else returns 0--(NUM_MESSAGE_CHANNELS-1)
@@ -591,6 +592,7 @@ void game_options::reset_options()
easy_confirm = CONFIRM_SAFE_EASY;
easy_quit_item_prompts = true;
hp_warning = 10;
+ magic_point_warning = 10;
confirm_self_target = true;
default_target = false;
safe_autopickup = true;
@@ -1672,6 +1674,16 @@ void game_options::read_option_line(const std::string &str, bool runscript)
field.c_str() );
}
}
+ else if (key == "mp_warning")
+ {
+ magic_point_warning = atoi( field.c_str() );
+ if (magic_point_warning < 0 || magic_point_warning > 100)
+ {
+ magic_point_warning = 0;
+ fprintf( stderr, "Bad MP warning percentage -- %s\n",
+ field.c_str() );
+ }
+ }
else if (key == "ood_interesting")
{
ood_interesting = atoi( field.c_str() );
diff --git a/crawl-ref/source/message.cc b/crawl-ref/source/message.cc
index 6e2f1aa12a..62fa88ea1c 100644
--- a/crawl-ref/source/message.cc
+++ b/crawl-ref/source/message.cc
@@ -190,6 +190,10 @@ int channel_to_colour( int channel, int param )
ret = CYAN;
break;
+ case MSGCH_DANGER_MAGIC:
+ ret = LIGHTCYAN;
+ break;
+
case MSGCH_DIAGNOSTICS:
case MSGCH_MULTITURN_ACTION:
ret = DARKGREY; // makes it easier to ignore at times -- bwr
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 08a4d1cd98..1cf91f9dd8 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -3790,6 +3790,12 @@ void dec_mp(int mp_loss)
if (you.magic_points < 0)
you.magic_points = 0;
+ if (you.magic_points > 0 && Options.magic_point_warning
+ && you.magic_points <= (you.max_magic_points * Options.magic_point_warning) / 100)
+ {
+ mpr( "* * * LOW MAGIC WARNING * * *", MSGCH_DANGER_MAGIC );
+ }
+
take_note(Note(NOTE_MP_CHANGE, you.magic_points, you.max_magic_points));
you.redraw_magic_points = 1;