summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-11 13:21:31 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-11 13:21:31 +0000
commitc6faa051c8f0f48d5922f9134e611d9ee675162d (patch)
tree9cf7e520bcbac621f7143952450253f1fbeb4d39
parent8af56c9f2d1a3e2ef9dbeae0b47263b47f00be42 (diff)
downloadcrawl-ref-c6faa051c8f0f48d5922f9134e611d9ee675162d.tar.gz
crawl-ref-c6faa051c8f0f48d5922f9134e611d9ee675162d.zip
Add lm_props.lua and appry recent commits.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup-0.4@6494 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/settings/autopickup_exceptions.txt4
-rw-r--r--crawl-ref/source/beam.cc21
-rw-r--r--crawl-ref/source/dat/clua/lm_props.lua32
-rw-r--r--crawl-ref/source/dat/descript/ability.txt16
-rw-r--r--crawl-ref/source/directn.cc14
-rw-r--r--crawl-ref/source/directn.h2
-rw-r--r--crawl-ref/source/output.cc56
-rw-r--r--crawl-ref/source/spl-cast.cc5
-rw-r--r--crawl-ref/source/spl-util.cc4
-rw-r--r--crawl-ref/source/spl-util.h2
10 files changed, 105 insertions, 51 deletions
diff --git a/crawl-ref/settings/autopickup_exceptions.txt b/crawl-ref/settings/autopickup_exceptions.txt
index a9ffc2405e..af54da7878 100644
--- a/crawl-ref/settings/autopickup_exceptions.txt
+++ b/crawl-ref/settings/autopickup_exceptions.txt
@@ -21,8 +21,8 @@ ae = dangerous_item
# Excluding amulets as you only need one of each. (If you know the
# subtype that means you already have one of it.) Also for some rings.
# Some items may already be excluded as bad_item, e.g. inaccuracy.
-ae = amulet of (inaccuracy|gourmand|controlled flight|warding)
-ae = amulet of (resist mutation|resist slow|clarity|rage)
+ae = amulet of (inaccuracy|the gourmand|controlled flight|warding)
+ae = amulet of (resist .*|clarity|rage|conservation)
ae = ring of (see invisible|levitation|poison resistance|hunger)
ae = ring of (fire|ice|sustenance|invisibility)
ae = ring of (magical power|regeneration)
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 4726f60cc7..74fdd24a67 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -711,7 +711,7 @@ bool player_tracer( zap_type ztype, int power, bolt &pbolt, int range)
if (pbolt.beam_cancelled)
{
#if DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "%s", "Beam stopped.");
+ mprf(MSGCH_DIAGNOSTICS, "%s", "Beam cancelled.");
#endif
canned_msg(MSG_OK);
you.turn_is_over = false;
@@ -3630,13 +3630,20 @@ static int _affect_player( bolt &beam, item_def *item )
if (YOU_KILL(beam.thrower))
{
// Don't ask if we're aiming at ourselves.
- if (!beam.aimed_at_feet && !beam.dont_stop_player
- && !yesno("That beam is likely to hit yourself. Continue "
- "anyway?", false, 'n'))
+ if (!beam.aimed_at_feet && !beam.dont_stop_player)
{
- beam.fr_count += 1;
- beam.fr_power += you.experience_level;
- beam.dont_stop_player = true;
+ if (yesno("That beam is likely to hit yourself. Continue "
+ "anyway?", false, 'n'))
+ {
+ beam.fr_count += 1;
+ beam.fr_power += you.experience_level;
+ beam.dont_stop_player = true;
+ }
+ else
+ {
+ beam.beam_cancelled = true;
+ return (BEAM_STOP);
+ }
}
}
else if (beam.can_see_invis || !you.invisible()
diff --git a/crawl-ref/source/dat/clua/lm_props.lua b/crawl-ref/source/dat/clua/lm_props.lua
new file mode 100644
index 0000000000..03c746eb32
--- /dev/null
+++ b/crawl-ref/source/dat/clua/lm_props.lua
@@ -0,0 +1,32 @@
+------------------------------------------------------------------------------
+-- lm_props.lua:
+-- Property markers.
+------------------------------------------------------------------------------
+
+PropertiesDescriptor = { }
+PropertiesDescriptor.__index = PropertiesDescriptor
+
+function PropertiesDescriptor:new(properties)
+ local pd = { }
+ setmetatable(pd, self)
+ pd.props = properties
+ return pd
+end
+
+function PropertiesDescriptor:write(marker, th)
+ lmark.marshall_table(th, self.props)
+end
+
+function PropertiesDescriptor:read(marker, th)
+ self.props = lmark.unmarshall_table(th)
+ setmetatable(self, PropertiesDescriptor)
+ return self
+end
+
+function PropertiesDescriptor:property(marker, pname)
+ return self.props and self.props[pname] or ''
+end
+
+function props_marker(props)
+ return PropertiesDescriptor:new(props)
+end
diff --git a/crawl-ref/source/dat/descript/ability.txt b/crawl-ref/source/dat/descript/ability.txt
index 89c7966cb2..5f5a294044 100644
--- a/crawl-ref/source/dat/descript/ability.txt
+++ b/crawl-ref/source/dat/descript/ability.txt
@@ -253,19 +253,21 @@ your magical contamination and may eventually cause glowing.
# Makhleb
Minor Destruction
-There's currently no description for this ability...
+Shoot a random harmful beam at the targetted monster.
%%%%
Lesser Servant of Makhleb
-There's currently no description for this ability...
+Summon a minor demon, with a chance of being hostile at low Invocations
+skill.
%%%%
Major Destruction
-There's currently no description for this ability...
+Inflict a random harmful beam or explosion on the targetted monster.
%%%%
Greater Servant of Makhleb
-There's currently no description for this ability...
+Summon a major demon, with a chance of being hostile at low Invocations
+skill.
%%%%
# Sif Muna
Channel Energy
@@ -376,9 +378,9 @@ which one to keep. Discard the other two.
%%%%
Mark Four
-Draw four cards from your wielded deck, remember them and shuffle them
-back into the deck. The deck will be inscribed as containing those
-cards, and doing so will identify the deck.
+Draw four cards from your wielded deck, mark and remember them and
+shuffle them back into the deck. The deck will be inscribed as
+containing those cards, and doing so will identify the deck.
%%%%
Stack Five
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index 54150223eb..ba9bf9fe5c 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -472,7 +472,7 @@ static void _fill_monster_list(bool full_info)
void direction(dist& moves, targeting_type restricts,
targ_mode_type mode, int range, bool just_looking,
bool needs_path, bool may_target_monster, const char *prompt,
- targeting_behaviour *beh)
+ targeting_behaviour *beh, bool cancel_at_self)
{
static targeting_behaviour stock_behaviour;
if (!beh)
@@ -1049,12 +1049,16 @@ void direction(dist& moves, targeting_type restricts,
if (moves.isTarget
&& moves.tx == you.x_pos && moves.ty == you.y_pos
&& mode == TARG_ENEMY
- && (Options.allow_self_target == CONFIRM_CANCEL
- || (Options.allow_self_target == CONFIRM_PROMPT
- && !yesno("Really target yourself?", false, 'n'))))
+ && (cancel_at_self
+ || Options.allow_self_target == CONFIRM_CANCEL
+ || Options.allow_self_target == CONFIRM_PROMPT
+ && !yesno("Really target yourself?", false, 'n')))
{
- if (Options.allow_self_target == CONFIRM_CANCEL )
+ if (cancel_at_self)
+ mpr("Sorry, you can't target yourself.");
+ else if (Options.allow_self_target == CONFIRM_CANCEL)
mpr("That would be overly suicidal.", MSGCH_EXAMINE_FILTER);
+
show_prompt = true;
}
else if (moves.isTarget && !see_grid(moves.tx, moves.ty))
diff --git a/crawl-ref/source/directn.h b/crawl-ref/source/directn.h
index d071ab28ec..557962186f 100644
--- a/crawl-ref/source/directn.h
+++ b/crawl-ref/source/directn.h
@@ -151,7 +151,7 @@ void direction( dist &moves, targeting_type restricts = DIR_NONE,
targ_mode_type mode = TARG_ANY, int range = -1,
bool just_looking = false, bool needs_path = true,
bool may_target_monster = true, const char *prompt = NULL,
- targeting_behaviour *mod = NULL );
+ targeting_behaviour *mod = NULL, bool cancel_at_self = false );
bool in_los_bounds(int x, int y);
bool in_viewport_bounds(int x, int y);
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index c0a57cabd7..cc48f273a0 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -1600,20 +1600,26 @@ int equip_name_to_slot(const char *s)
return -1;
}
-static const char* _determine_color_string( int level )
+// Colour the string according to the level of an ability/resistance.
+// Take maximum possible level into account.
+static const char* _determine_colour_string( int level, int max_level )
{
- switch ( level )
+ switch (level)
{
case 3:
case 2:
- return "<lightgreen>";
+ if (max_level > 1)
+ return "<lightgreen>";
+ // else fall-through
case 1:
return "<green>";
- case -1:
- return "<red>";
case -2:
case -3:
- return "<lightred>";
+ if (max_level > 1)
+ return "<lightred>";
+ // else fall-through
+ case -1:
+ return "<red>";
default:
return "<lightgrey>";
}
@@ -1889,14 +1895,14 @@ static std::vector<formatted_string> _get_overview_resistances(
"%sSust.Abil.: %s\n"
"%sRes.Mut. : %s\n"
"%sRes.Slow : %s\n",
- _determine_color_string(rfire), itosym3(rfire),
- _determine_color_string(rcold), itosym3(rcold),
- _determine_color_string(rlife), itosym3(rlife),
- _determine_color_string(rpois), itosym1(rpois),
- _determine_color_string(relec), itosym1(relec),
- _determine_color_string(rsust), itosym1(rsust),
- _determine_color_string(rmuta), itosym1(rmuta),
- _determine_color_string(rslow), itosym1(rslow));
+ _determine_colour_string(rfire, 3), itosym3(rfire),
+ _determine_colour_string(rcold, 3), itosym3(rcold),
+ _determine_colour_string(rlife, 3), itosym3(rlife),
+ _determine_colour_string(rpois, 1), itosym1(rpois),
+ _determine_colour_string(relec, 1), itosym1(relec),
+ _determine_colour_string(rsust, 1), itosym1(rsust),
+ _determine_colour_string(rmuta, 1), itosym1(rmuta),
+ _determine_colour_string(rslow, 1), itosym1(rslow));
cols.add_formatted(0, buf, false);
int saplevel = player_mutation_level(MUT_SAPROVOROUS);
@@ -1914,7 +1920,7 @@ static std::vector<formatted_string> _get_overview_resistances(
postgourmand = itosym3(saplevel);
}
snprintf(buf, sizeof buf, "%s%s%s",
- _determine_color_string(saplevel), pregourmand, postgourmand);
+ _determine_colour_string(saplevel, 3), pregourmand, postgourmand);
cols.add_formatted(0, buf, false);
@@ -1932,23 +1938,23 @@ static std::vector<formatted_string> _get_overview_resistances(
"%sRes.Corr. : %s\n"
"%sClarity : %s\n"
"\n",
- _determine_color_string(rinvi), itosym1(rinvi),
- _determine_color_string(rward), itosym1(rward),
- _determine_color_string(rcons), itosym1(rcons),
- _determine_color_string(rcorr), itosym1(rcorr),
- _determine_color_string(rclar), itosym1(rclar));
+ _determine_colour_string(rinvi, 1), itosym1(rinvi),
+ _determine_colour_string(rward, 1), itosym1(rward),
+ _determine_colour_string(rcons, 1), itosym1(rcons),
+ _determine_colour_string(rcorr, 1), itosym1(rcorr),
+ _determine_colour_string(rclar, 1), itosym1(rclar));
cols.add_formatted(1, buf, false);
if ( scan_randarts(RAP_PREVENT_TELEPORTATION, calc_unid) )
{
snprintf(buf, sizeof buf, "\n%sPrev.Telep.: %s",
- _determine_color_string(-1), itosym1(1));
+ _determine_colour_string(-1, 1), itosym1(1));
}
else
{
const int rrtel = !!player_teleport(calc_unid);
snprintf(buf, sizeof buf, "\n%sRnd.Telep. : %s",
- _determine_color_string(rrtel), itosym1(rrtel));
+ _determine_colour_string(rrtel, 1), itosym1(rrtel));
}
cols.add_formatted(1, buf, false);
@@ -1959,9 +1965,9 @@ static std::vector<formatted_string> _get_overview_resistances(
"%sCtrl.Telep.: %s\n"
"%sLevitation : %s\n"
"%sCtrl.Flight: %s\n",
- _determine_color_string(rctel), itosym1(rctel),
- _determine_color_string(rlevi), itosym1(rlevi),
- _determine_color_string(rcfli), itosym1(rcfli));
+ _determine_colour_string(rctel, 1), itosym1(rctel),
+ _determine_colour_string(rlevi, 1), itosym1(rlevi),
+ _determine_colour_string(rcfli, 1), itosym1(rcfli));
cols.add_formatted(1, buf, false);
_print_overview_screen_equip(cols, equip_chars);
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index 51a3c0ff70..13d9922563 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -1034,8 +1034,11 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail)
const bool needs_path = (!testbits(flags, SPFLAG_GRID)
&& !testbits(flags, SPFLAG_TARGET));
- if (!spell_direction(spd, beam, dir, targ, needs_path, true, prompt))
+ if (!spell_direction(spd, beam, dir, targ, needs_path, true, prompt,
+ testbits(flags, SPFLAG_NOT_SELF)))
+ {
return (SPRET_ABORT);
+ }
if (testbits(flags, SPFLAG_NOT_SELF) && spd.isMe)
{
diff --git a/crawl-ref/source/spl-util.cc b/crawl-ref/source/spl-util.cc
index 6edc0d33a8..e64c2f089f 100644
--- a/crawl-ref/source/spl-util.cc
+++ b/crawl-ref/source/spl-util.cc
@@ -782,13 +782,13 @@ void apply_area_cloud( int (*func) (int, int, int, int, cloud_type,
bool spell_direction( dist &spelld, bolt &pbolt,
targeting_type restrict, targ_mode_type mode,
bool needs_path, bool may_target_monster,
- const char *prompt )
+ const char *prompt, bool cancel_at_self )
{
if (restrict != DIR_DIR)
message_current_target();
direction( spelld, restrict, mode, -1, false, needs_path,
- may_target_monster, prompt );
+ may_target_monster, prompt, NULL, cancel_at_self );
if (!spelld.isValid)
{
diff --git a/crawl-ref/source/spl-util.h b/crawl-ref/source/spl-util.h
index f245210455..b2dd736b7c 100644
--- a/crawl-ref/source/spl-util.h
+++ b/crawl-ref/source/spl-util.h
@@ -132,7 +132,7 @@ bool spell_direction( dist &spelld, bolt &pbolt,
targeting_type restrict = DIR_NONE,
targ_mode_type mode = TARG_ENEMY,
bool needs_path = true, bool may_target_monster = true,
- const char *prompt = NULL );
+ const char *prompt = NULL, bool cancel_at_self = false );
void apply_area_cloud(int (*func) (int, int, int, int, cloud_type,
kill_category),