From f0f421c33bf731481df19d98b4c24c57a007d9f7 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Mon, 18 Aug 2008 18:02:50 +0000 Subject: * Force ?immolation to never burn scrolls, whether in inventory or on the floor. * List new amount of charges when recharging identified wands. * Tweak some checks for travel_path to be on the safe side. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6834 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/beam.cc | 45 ++++++++++++++++++++++----------- crawl-ref/source/beam.h | 6 +++-- crawl-ref/source/dat/descript/items.txt | 2 +- crawl-ref/source/effects.cc | 15 ++++++++--- crawl-ref/source/item_use.cc | 2 +- crawl-ref/source/monstuff.cc | 18 ++++++------- 6 files changed, 57 insertions(+), 31 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index 53eef422ce..e5de18a439 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -99,7 +99,8 @@ static int _range_used_on_hit(bolt &beam); static void _explosion1(bolt &pbolt); static void _explosion_map(bolt &beam, const coord_def& p, int count, int dir, int r); -static void _explosion_cell(bolt &beam, const coord_def& p, bool drawOnly); +static void _explosion_cell(bolt &beam, const coord_def& p, bool drawOnly, + bool affect_items = true); static void _ench_animation(int flavour, const monsters *mon = NULL, bool force = false); @@ -3094,7 +3095,7 @@ static bool _found_player(const bolt &beam, const coord_def& p) return (grid_distance(p, you.pos()) <= dist); } -int affect(bolt &beam, const coord_def& p, item_def *item) +int affect(bolt &beam, const coord_def& p, item_def *item, bool affect_items) { // Extra range used by hitting something. int rangeUsed = 0; @@ -3140,10 +3141,13 @@ int affect(bolt &beam, const coord_def& p, item_def *item) // If not a tracer, affect items and place clouds. if (!beam.is_tracer) { - const int burn_power = (beam.is_explosion) ? 5 : - (beam.is_beam) ? 3 : 2; + if (affect_items) + { + const int burn_power = (beam.is_explosion) ? 5 : + (beam.is_beam) ? 3 : 2; - expose_items_to_element(beam.flavour, p, burn_power); + expose_items_to_element(beam.flavour, p, burn_power); + } rangeUsed += _affect_place_clouds(beam, p); } @@ -5312,7 +5316,7 @@ static void _explosion1(bolt &pbolt) // For each cell affected by the explosion, affect() is called. int explosion( bolt &beam, bool hole_in_the_middle, bool explode_in_wall, bool stop_at_statues, - bool stop_at_walls, bool show_more) + bool stop_at_walls, bool show_more, bool affect_items) { if (in_bounds(beam.source) && beam.source != beam.target && (!explode_in_wall || stop_at_statues || stop_at_walls)) @@ -5453,7 +5457,7 @@ int explosion( bolt &beam, bool hole_in_the_middle, { // do center -- but only if its affected if (!hole_in_the_middle) - _explosion_cell(beam, coord_def(0, 0), drawing); + _explosion_cell(beam, coord_def(0, 0), drawing, affect_items); // do the rest of it for (int rad = 1; rad <= r; rad ++) @@ -5462,20 +5466,30 @@ int explosion( bolt &beam, bool hole_in_the_middle, for (int ay = 1 - rad; ay <= rad - 1; ay += 1) { if (explode_map[-rad+9][ay+9]) - _explosion_cell(beam, coord_def(-rad, ay), drawing); - + { + _explosion_cell(beam, coord_def(-rad, ay), drawing, + affect_items); + } if (explode_map[rad+9][ay+9]) - _explosion_cell(beam, coord_def(rad, ay), drawing); + { + _explosion_cell(beam, coord_def(rad, ay), drawing, + affect_items); + } } // do top & bottom for (int ax = -rad; ax <= rad; ax += 1) { if (explode_map[ax+9][-rad+9]) - _explosion_cell(beam, coord_def(ax, -rad), drawing); - + { + _explosion_cell(beam, coord_def(ax, -rad), drawing, + affect_items); + } if (explode_map[ax+9][rad+9]) - _explosion_cell(beam, coord_def(ax, rad), drawing); + { + _explosion_cell(beam, coord_def(ax, rad), drawing, + affect_items); + } } // new-- delay after every 'ring' {gdl} @@ -5515,7 +5529,8 @@ int explosion( bolt &beam, bool hole_in_the_middle, return (cells_seen); } -static void _explosion_cell(bolt &beam, const coord_def& p, bool drawOnly) +static void _explosion_cell(bolt &beam, const coord_def& p, bool drawOnly, + bool affect_items) { bool random_beam = false; coord_def realpos = beam.target + p; @@ -5530,7 +5545,7 @@ static void _explosion_cell(bolt &beam, const coord_def& p, bool drawOnly) random_range(BEAM_FIRE, BEAM_ACID) ); } - affect(beam, realpos); + affect(beam, realpos, NULL, affect_items); if (random_beam) beam.flavour = BEAM_RANDOM; diff --git a/crawl-ref/source/beam.h b/crawl-ref/source/beam.h index 55ab6c6703..e062a78c5e 100644 --- a/crawl-ref/source/beam.h +++ b/crawl-ref/source/beam.h @@ -188,7 +188,8 @@ int explosion( bolt &pbolt, bool hole_in_the_middle = false, bool explode_in_wall = false, bool stop_at_statues = true, bool stop_at_walls = true, - bool show_more = true); + bool show_more = true, + bool affect_items = true); // last updated 22jan2001 {gdl} /* *********************************************************************** @@ -239,7 +240,8 @@ bool zapping( zap_type ztype, int power, struct bolt &pbolt, bool player_tracer( zap_type ztype, int power, struct bolt &pbolt, int range = 0 ); -int affect(bolt &beam, const coord_def& p, item_def *item = NULL); +int affect(bolt &beam, const coord_def& p, item_def *item = NULL, + bool affect_items = true); void beam_drop_object( bolt &beam, item_def *item, const coord_def& where ); diff --git a/crawl-ref/source/dat/descript/items.txt b/crawl-ref/source/dat/descript/items.txt index eccd268b55..5e63a9feb2 100644 --- a/crawl-ref/source/dat/descript/items.txt +++ b/crawl-ref/source/dat/descript/items.txt @@ -1251,7 +1251,7 @@ object. scroll of immolation Small writing on the back of the scroll reads: "Warning: contents -under pressure. Do not use near flammable objects." +under pressure. May be harmful to the reader." %%%% scroll of magic mapping diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc index 8b3ccc5e31..1b4833d3a3 100644 --- a/crawl-ref/source/effects.cc +++ b/crawl-ref/source/effects.cc @@ -1777,9 +1777,18 @@ bool recharge_wand(int item_slot) 1 + random2avg( ((charge_gain - 1) * 3) + 1, 3 ))); const bool charged = new_charges > wand.plus; - mprf("%s %s for a moment.", + + std::string desc = ""; + if (charged && item_ident(wand, ISFLAG_KNOW_PLUSES)) + { + snprintf(info, INFO_SIZE, " and now has %d charges", new_charges); + desc = info; + } + mprf("%s %s for a moment%s.", wand.name(DESC_CAP_YOUR).c_str(), - charged? "glows" : "flickers"); + charged? "glows" : "flickers", + desc.c_str()); + wand.plus = new_charges; } else // It's a rod. @@ -2086,7 +2095,7 @@ bool vitrify_area(int radius) for ( radius_iterator ri(you.pos(), radius, false, false); ri; ++ri ) { const dungeon_feature_type grid = grd(*ri); - + if (grid == DNGN_ROCK_WALL || grid == DNGN_STONE_WALL || grid == DNGN_PERMAROCK_WALL ) diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index 3affd408d9..a352ac3573 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -4455,7 +4455,7 @@ void read_scroll( int slot ) if (!alreadyknown) beam.effect_known = false; - explosion(beam); + explosion(beam, false, false, true, true, true, false); break; case SCR_CURSE_WEAPON: diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index f164571be0..6117f83ab5 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -2525,7 +2525,6 @@ static void _handle_behaviour(monsters *mon) bool isScared = mon->has_ench(ENCH_FEAR); bool isMobile = !mons_is_stationary(mon); bool isPacified = mons_is_pacified(mon); - bool travelling = mon->is_travelling(); bool patrolling = mon->is_patrolling(); static std::vector e; static int e_index = -1; @@ -2692,7 +2691,7 @@ static void _handle_behaviour(monsters *mon) // Foe gone out of LOS? if (!proxFoe) { - if (mon->foe == MHITYOU && travelling + if (mon->foe == MHITYOU && mon->is_travelling() && mon->travel_target == MTRAV_PLAYER) { // We've got a target, so we'll continue on our way. @@ -2846,7 +2845,7 @@ static void _handle_behaviour(monsters *mon) if (mon->travel_target != MTRAV_PATROL && mon->travel_target != MTRAV_NONE) { - if (travelling) + if (mon->is_travelling()) mon->travel_path.clear(); mon->travel_target = MTRAV_NONE; } @@ -2859,7 +2858,8 @@ static void _handle_behaviour(monsters *mon) mon->name(DESC_PLAIN).c_str()); #endif // If we're already on our way, do nothing. - if (travelling && mon->travel_target == MTRAV_PLAYER) + if (mon->is_travelling() + && mon->travel_target == MTRAV_PLAYER) { int len = mon->travel_path.size(); coord_def targ = mon->travel_path[len - 1]; @@ -3053,8 +3053,7 @@ static void _handle_behaviour(monsters *mon) // If a pacified monster is far enough away from the // player, make it leave the level. - if (grid_distance(mon->pos(), you.pos()) - >= LOS_RADIUS * 4) + if (grid_distance(mon->pos(), you.pos()) >= LOS_RADIUS * 4) { make_mons_leave_level(mon); return; @@ -3084,7 +3083,7 @@ static void _handle_behaviour(monsters *mon) || mons_is_batty(mon) || !isPacified && one_chance_in(20)) { bool need_target = true; - if (travelling) + if (mon->is_travelling()) { #ifdef DEBUG_PATHFIND mprf("Monster %s reached target (%d, %d)", @@ -3137,7 +3136,8 @@ static void _handle_behaviour(monsters *mon) // is rather small. int erase = -1; // Erase how many waypoints? - for (int i = mon->travel_path.size() - 1; i >= 0; --i) + int size = mon->travel_path.size(); + for (int i = size - 1; i >= 0; --i) { if (grid_see_grid(mon->pos(), mon->travel_path[i], can_move)) @@ -3304,7 +3304,7 @@ static void _handle_behaviour(monsters *mon) || isPacified && one_chance_in(isSmart ? 40 : 120)) { new_foe = MHITNOT; - if (travelling && mon->travel_target != MTRAV_PATROL + if (mon->is_travelling() && mon->travel_target != MTRAV_PATROL || isPacified) { #ifdef DEBUG_PATHFIND -- cgit v1.2.3-54-g00ecf