From 3f69a6bffb46e58209cd7f9d6b4227eb5199ee9a Mon Sep 17 00:00:00 2001 From: haranp Date: Tue, 6 Nov 2007 23:46:55 +0000 Subject: Massive rewrite of makeitem.cc. Might be buggy. Fixed some old bugs, e.g. double reroll of =oCT. items() now respects force_type more often. As a side effect, acquirement is less likely to give randart jewellery or armour. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2777 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/randart.cc | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'crawl-ref/source/randart.cc') diff --git a/crawl-ref/source/randart.cc b/crawl-ref/source/randart.cc index 9e99180199..8caccf25d9 100644 --- a/crawl-ref/source/randart.cc +++ b/crawl-ref/source/randart.cc @@ -955,7 +955,7 @@ void randart_wpn_properties( const item_def &item, if (is_unrandom_artefact( item )) { - struct unrandart_entry *unrand = seekunrandart( item ); + const unrandart_entry *unrand = seekunrandart( item ); for (int i = 0; i < RA_PROPERTIES; i++) proprt[i] = unrand->prpty[i]; @@ -1701,19 +1701,23 @@ int find_okay_unrandart(unsigned char aclass, unsigned char atype) // Returns true if successful. bool make_item_fixed_artefact( item_def &item, bool in_abyss, int which ) { - bool force = true; // we force any one asked for specifically + bool force = true; // we force any one asked for specifically if (!which) { // using old behaviour... try only once. -- bwr force = false; - which = SPWPN_SINGING_SWORD + random2(12); - if (which >= SPWPN_SWORD_OF_CEREBOV) - which += 3; // skip over Cerebov's, Dispater's, and Asmodeus' weapons + do { + which = SPWPN_SINGING_SWORD + + random2(SPWPN_STAFF_OF_WUCAD_MU - SPWPN_SINGING_SWORD + 1); + } while ( which == SPWPN_SWORD_OF_CEREBOV || + which == SPWPN_STAFF_OF_DISPATER || + which == SPWPN_SCEPTRE_OF_ASMODEUS ); } - int status = get_unique_item_status( OBJ_WEAPONS, which ); + const unique_item_status_type status = + get_unique_item_status( OBJ_WEAPONS, which ); if ((status == UNIQ_EXISTS || (in_abyss && status == UNIQ_NOT_EXISTS) @@ -2044,7 +2048,6 @@ bool make_item_randart( item_def &item ) return (true); } -// void make_item_unrandart( int x, int ura_item ) bool make_item_unrandart( item_def &item, int unrand_index ) { if (!item.props.exists( KNOWN_PROPS_KEY )) @@ -2077,10 +2080,9 @@ const char *unrandart_descrip( char which_descrip, const item_def &item ) { /* Eventually it would be great to have randomly generated descriptions for randarts. */ - struct unrandart_entry *unrand = seekunrandart( item ); + const unrandart_entry *unrand = seekunrandart( item ); return ((which_descrip == 0) ? unrand->spec_descrip1 : (which_descrip == 1) ? unrand->spec_descrip2 : (which_descrip == 2) ? unrand->spec_descrip3 : "Unknown."); - -} // end unrandart_descrip() +} -- cgit v1.2.3-54-g00ecf