From 52c7e79cd76a5205f72c43da92d9aa1297b1d3d4 Mon Sep 17 00:00:00 2001 From: dolorous Date: Mon, 2 Mar 2009 18:35:22 +0000 Subject: Make artificers' rods of striking start with a constant number of charges, as their wands do. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9312 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/makeitem.cc | 23 ++++++++++++++--------- crawl-ref/source/makeitem.h | 4 ++-- crawl-ref/source/newgame.cc | 13 +++++++------ 3 files changed, 23 insertions(+), 17 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc index 35a3af0bab..f6ca660c82 100644 --- a/crawl-ref/source/makeitem.cc +++ b/crawl-ref/source/makeitem.cc @@ -341,7 +341,7 @@ static int _armour_colour(const item_def &item) : _newwave_armour_colour(item)); } -void item_colour( item_def &item ) +void item_colour(item_def &item) { int switchnum = 0; int temp_value; @@ -2559,8 +2559,8 @@ static void _generate_staff_item(item_def& item, int force_type) } } - if (item_is_rod( item )) - init_rod_mp( item ); + if (item_is_rod(item)) + init_rod_mp(item); } static bool _try_make_jewellery_unrandart(item_def& item, int force_type, @@ -2906,19 +2906,24 @@ int items( int allow_uniques, // not just true-false, } // Note that item might be invalidated now, since p could have changed. - ASSERT( is_valid_item(mitm[p]) ); - return p; + ASSERT(is_valid_item(mitm[p])); + return (p); } -void init_rod_mp(item_def &item) +void init_rod_mp(item_def &item, int ncharges) { if (!item_is_rod(item)) return; - if (item.sub_type == STAFF_STRIKING) - item.plus2 = random_range(6, 9) * ROD_CHARGE_MULT; + if (ncharges != -1) + item.plus2 = ncharges * ROD_CHARGE_MULT; else - item.plus2 = random_range(9, 14) * ROD_CHARGE_MULT; + { + if (item.sub_type == STAFF_STRIKING) + item.plus2 = random_range(6, 9) * ROD_CHARGE_MULT; + else + item.plus2 = random_range(9, 14) * ROD_CHARGE_MULT; + } item.plus = item.plus2; } diff --git a/crawl-ref/source/makeitem.h b/crawl-ref/source/makeitem.h index 08478e6258..2a8aef084a 100644 --- a/crawl-ref/source/makeitem.h +++ b/crawl-ref/source/makeitem.h @@ -25,8 +25,8 @@ int items( int allow_uniques, object_class_type force_class, int force_type, bool dont_place, int item_level, int item_race, unsigned mapmask = 0, int force_ego = 0, int agent = -1 ); -void item_colour( item_def &item ); -void init_rod_mp(item_def &item); +void item_colour(item_def &item); +void init_rod_mp(item_def &item, int ncharges = -1); void give_item(int mid, int level_number, bool mons_summoned); jewellery_type get_random_ring_type(); diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc index 1fbeb6a888..2e63a2e2ff 100644 --- a/crawl-ref/source/newgame.cc +++ b/crawl-ref/source/newgame.cc @@ -3466,7 +3466,7 @@ static bool _give_wanderer_weapon( int slot, int wpn_skill ) return (ret); } -static void _make_rod(item_def &item, stave_type rod_type) +static void _make_rod(item_def &item, stave_type rod_type, int ncharges) { item.base_type = OBJ_STAVES; item.sub_type = rod_type; @@ -3474,7 +3474,7 @@ static void _make_rod(item_def &item, stave_type rod_type) item.special = you.item_description[IDESC_STAVES][rod_type]; item.colour = BROWN; - init_rod_mp(item); + init_rod_mp(item, ncharges); } // Creates an item of a given base and sub type. @@ -4381,7 +4381,7 @@ static bool _choose_wand() const wand_type startwand[5] = { WAND_ENSLAVEMENT, WAND_CONFUSION, WAND_MAGIC_DARTS, WAND_FROST, WAND_FLAME }; - _make_rod(you.inv[2], STAFF_STRIKING); + _make_rod(you.inv[2], STAFF_STRIKING, 8); const int num_choices = 6; int keyin = 0; @@ -4530,6 +4530,7 @@ static bool _choose_wand() ng_wand = keyin - 'a' + 1; wand_done: + if (keyin - 'a' == num_choices - 1) { // Choose the rod; we're all done. @@ -4538,10 +4539,10 @@ wand_done: // 1 wand of random effects and one chosen lesser wand const wand_type choice = startwand[keyin - 'a']; - int nCharges = 15; + int ncharges = 15; _newgame_make_item(2, EQ_NONE, OBJ_WANDS, WAND_RANDOM_EFFECTS, -1, 1, - nCharges, 0); - _newgame_make_item(3, EQ_NONE, OBJ_WANDS, choice, -1, 1, nCharges, 0); + ncharges, 0); + _newgame_make_item(3, EQ_NONE, OBJ_WANDS, choice, -1, 1, ncharges, 0); return (true); } -- cgit v1.2.3-54-g00ecf