From: <gi...@cr...> - 2012-05-31 12:28:15
|
via 7136bdd76718a5b3806886ab6b67c9c40a8b0185 (commit) via fe6b02f912598db83910419003335582d51cb884 (commit) via 8c7ba4369b19d89ee2ec6acce1df4ba8c995d34b (commit) from 31e1bf3c01c82d2fb42f01f9351972162468f54b (commit) ----------------------------------------------------------------------- commit 7136bdd76718a5b3806886ab6b67c9c40a8b0185 Author: Jon Knapp <th...@li...> Date: Mon May 28 03:57:25 2012 -0700 Count items gained when merging a picked-up stack (Thann). Based on https://crawl.develz.org/mantis/view.php?id=5705 with a few changes. For one, use "(gained N)" rather than "(+N)" for clarity. Also, show the extra information whenever the pickup is merged with an existing inventory slot, even if it was just one item; this way the message distinguishes between adding one item to a stack and picking up an entirely new stack. commit fe6b02f912598db83910419003335582d51cb884 Author: Neil Moore <ne...@s-...> Date: Thu May 31 00:45:43 2012 -0400 Don't place band members across walls. They must now be within LOS_SOLID of the leader; if not, try another position (up to the limit of 1000). Better would be to allow followers to be placed around nearby corners but not across walls. One possibility would be to use (limited-depth) pathfinding. Another would be to require LOS_SOLID to any previous band member, not necessarily the leader. minmay_rotating_lava might need to be looked at, as this change greatly affects the distribution of the hell knight band. commit 8c7ba4369b19d89ee2ec6acce1df4ba8c995d34b Author: Neil Moore <ne...@s-...> Date: Wed May 30 23:38:44 2012 -0400 Allow "any rod" in itemspecs. Such an itemspec calls _generate_staff_item() with a special stave_type value STAFF_RANDOM_ROD (greater than NUM_STAVES). Perhaps it would make sense to have a way to specify "any non-rod magical staff". One possibility would be to interpret "any magical staff" in that way; existing vaults could use something like "any magical staff / any rod w:1" to reproduce the current behaviour. It might make more sense just to split the item types, but that would be a massive change. ----------------------------------------------------------------------- Summary of changes: crawl-ref/source/itemprop-enum.h | 3 ++- crawl-ref/source/items.cc | 6 ++++-- crawl-ref/source/makeitem.cc | 11 +++++++---- crawl-ref/source/mapdef.cc | 7 +++++++ crawl-ref/source/mon-place.cc | 22 +++++++++++++--------- 5 files changed, 33 insertions(+), 16 deletions(-) diff --git a/crawl-ref/source/itemprop-enum.h b/crawl-ref/source/itemprop-enum.h index 461cd97..9759604 100644 --- a/crawl-ref/source/itemprop-enum.h +++ b/crawl-ref/source/itemprop-enum.h @@ -411,7 +411,8 @@ enum stave_type STAFF_DEMONOLOGY, STAFF_STRIKING, STAFF_VENOM, - NUM_STAVES + NUM_STAVES, + STAFF_RANDOM_ROD // Hack for item generation. }; enum weapon_type diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index c1480ea..22163e4 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -1734,8 +1734,10 @@ int move_item_to_player(int obj, int quant_got, bool quiet, if (!quiet) { - mpr_nocap(get_menu_colour_prefix_tags(you.inv[m], - DESC_INVENTORY).c_str()); + mprf_nocap("%s (gained %d)", + get_menu_colour_prefix_tags(you.inv[m], + DESC_INVENTORY).c_str(), + quant_got); } you.turn_is_over = true; diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc index 289b71b..174cf28 100644 --- a/crawl-ref/source/makeitem.cc +++ b/crawl-ref/source/makeitem.cc @@ -2837,9 +2837,7 @@ static void _generate_book_item(item_def& item, bool allow_uniques, static void _generate_staff_item(item_def& item, int force_type, int item_level) { - if (force_type != OBJ_RANDOM) - item.sub_type = force_type; - else + if (force_type == OBJ_RANDOM) { item.sub_type = random2(STAFF_FIRST_ROD); @@ -2856,6 +2854,10 @@ static void _generate_staff_item(item_def& item, int force_type, int item_level) item.sub_type = coinflip() ? STAFF_WIZARDRY : STAFF_POWER; } } + else if (force_type == STAFF_RANDOM_ROD) + item.sub_type = get_random_rod_type(); + else + item.sub_type = force_type; if (item_is_rod(item)) init_rod_mp(item, -1, item_level); @@ -3106,7 +3108,8 @@ int items(bool allow_uniques, } ASSERT(force_type == OBJ_RANDOM - || force_type < get_max_subtype(item.base_type)); + || force_type < get_max_subtype(item.base_type) + || force_class == OBJ_STAVES && force_type == STAFF_RANDOM_ROD); item.quantity = 1; // generally the case diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc index 47fc699..dad2bbb 100644 --- a/crawl-ref/source/mapdef.cc +++ b/crawl-ref/source/mapdef.cc @@ -5145,6 +5145,13 @@ void item_list::parse_random_by_class(std::string c, item_spec &spec) spec.plus = -1; return; } + else if (c == "rod") + { + spec.base_type = OBJ_STAVES; + spec.sub_type = STAFF_RANDOM_ROD; + spec.plus = -1; + return; + } error = make_stringf("Bad item class: '%s'", c.c_str()); } diff --git a/crawl-ref/source/mon-place.cc b/crawl-ref/source/mon-place.cc index d9f9eac..006b48c 100644 --- a/crawl-ref/source/mon-place.cc +++ b/crawl-ref/source/mon-place.cc @@ -83,7 +83,7 @@ static monster_type _band_member(band_type band, int power); static band_type _choose_band(monster_type mon_type, int power, int &band_size, bool& natural_leader); -static monster* _place_monster_aux(const mgen_data &mg, bool first_band_member, +static monster* _place_monster_aux(const mgen_data &mg, const monster *leader, bool force_pos = false, bool dont_place = false); // Returns whether actual_feat is compatible with feat_wanted for monster @@ -1097,7 +1097,7 @@ monster* place_monster(mgen_data mg, bool force_pos, bool dont_place) if (ugly_colour != BLACK) ugly_colour = BLACK; - monster* mon = _place_monster_aux(mg, true, force_pos, dont_place); + monster* mon = _place_monster_aux(mg, 0, force_pos, dont_place); // Bail out now if we failed. if (!mon) @@ -1193,7 +1193,7 @@ monster* place_monster(mgen_data mg, bool force_pos, bool dont_place) continue; } - monster *member = _place_monster_aux(band_template, false); + monster *member = _place_monster_aux(band_template, mon); if (member) { member->flags |= MF_BAND_MEMBER; @@ -1259,9 +1259,8 @@ static void _place_twister_clouds(monster *mon) tornado_damage(mon, -10); } -static monster* _place_monster_aux(const mgen_data &mg, - bool first_band_member, bool force_pos, - bool dont_place) +static monster* _place_monster_aux(const mgen_data &mg, const monster *leader, + bool force_pos, bool dont_place) { coord_def fpos; @@ -1288,7 +1287,7 @@ static monster* _place_monster_aux(const mgen_data &mg, // If the space is occupied, try some neighbouring square instead. if (dont_place) fpos.reset(); - else if (first_band_member && in_bounds(mg.pos) + else if (leader == 0 && in_bounds(mg.pos) && (mg.behaviour == BEH_FRIENDLY || !is_sanctuary(mg.pos) || mons_is_mimic(montype)) && !monster_at(mg.pos) @@ -1306,8 +1305,13 @@ static monster* _place_monster_aux(const mgen_data &mg, fpos = mg.pos + coord_def(random_range(-3, 3), random_range(-3, 3)); - if (_valid_monster_generation_location(mg, fpos)) + // Place members within LOS_SOLID of their leader. + // TODO nfm - allow placing around corners but not across walls. + if ((leader == 0 || cell_see_cell(fpos, leader->pos(), LOS_SOLID)) + && _valid_monster_generation_location(mg, fpos)) + { break; + } } // Did we really try 1000 times? @@ -1318,7 +1322,7 @@ static monster* _place_monster_aux(const mgen_data &mg, ASSERT(!monster_at(fpos)); if (crawl_state.game_is_arena() - && arena_veto_place_monster(mg, first_band_member, fpos)) + && arena_veto_place_monster(mg, leader == 0, fpos)) { return 0; } -- Dungeon Crawl Stone Soup |