diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-04-25 13:45:25 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-04-25 13:45:25 +0000 |
commit | 6235e6f426a368740967eddc1db37029e665f2c2 (patch) | |
tree | 1748042144158160b7c5ba0d1f1af0319c03742c | |
parent | 580be63530a4f6213d75b50ce15af3d70edb3774 (diff) | |
download | crawl-ref-6235e6f426a368740967eddc1db37029e665f2c2.tar.gz crawl-ref-6235e6f426a368740967eddc1db37029e665f2c2.zip |
Fix props vector not being initialized for unrandarts (BR 1951367
and others). I'm really sorry about that!
Modify pickup.lua to allow Vampires to pick up !berserk rage etc.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4619 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r-- | crawl-ref/source/acr.cc | 8 | ||||
-rw-r--r-- | crawl-ref/source/lua/pickup.lua | 31 | ||||
-rw-r--r-- | crawl-ref/source/randart.cc | 35 |
3 files changed, 49 insertions, 25 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index b405215f71..5587dd31da 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -552,6 +552,14 @@ static void _handle_wizard_command( void ) break; } + if (you.inv[i].base_type != OBJ_WEAPONS + && you.inv[i].base_type != OBJ_ARMOUR + && you.inv[i].base_type != OBJ_JEWELLERY) + { + mpr("That item cannot be turned into an artefact."); + break; + } + // set j == equipment slot of chosen item, remove old randart benefits for (j = 0; j < NUM_EQUIP; j++) { diff --git a/crawl-ref/source/lua/pickup.lua b/crawl-ref/source/lua/pickup.lua index 28d6acf677..feae944ac4 100644 --- a/crawl-ref/source/lua/pickup.lua +++ b/crawl-ref/source/lua/pickup.lua @@ -22,9 +22,9 @@ function make_hash(ls) return h end -function you_undead() +-- don't count Vampires here because of all those exceptions +function you_real_undead() return you.race() == "Mummy" or you.race() == "Ghoul" - or you.race() == "Vampire" end -- not identified @@ -49,7 +49,7 @@ function ch_autopickup(it) local spells = make_hash( you.spells() ) if item.class(it) == "Potions" then - + local type = item.potion_type(it) -- "bad" potions only for Evaporate @@ -58,7 +58,7 @@ function ch_autopickup(it) end -- no potions for Mummies - -- also: no bad potions for anyone else + -- also: no bad potions for anyone else if you.race() == "Mummy" or bad_potion(type) then return false end @@ -71,12 +71,12 @@ function ch_autopickup(it) -- special handling if spec_potion(type) then - -- undead cannot use berserk - -- or anything involving mutations + -- real undead cannot use berserk + -- or anything involving mutations if item.subtype(it) == "berserk" - or item.subtype(it) == "gain ability" - or item.subtype(it) == "cure mutation" then - if you_undead() then + or item.subtype(it) == "gain ability" + or item.subtype(it) == "cure mutation" then + if you_real_undead() then return false else return true @@ -85,7 +85,7 @@ function ch_autopickup(it) -- special cases for blood, water, and porridge if item.subtype(it) == "blood" - or item.subtype(it) == "water" + or item.subtype(it) == "water" or item.subtype(it) == "porridge" then return food.can_eat(it, false) end @@ -109,16 +109,15 @@ function ch_autopickup(it) or item.subtype(it) == "inaccuracy" then return false end - if you_undead() and + if you_real_undead() and (item.subtype(it) == "regeneration" - or item.subtype(it) == "rage" - or item.subtype(it) == "sustenance" - and you.race() == "Mummy") then + or item.subtype(it) == "rage" + or item.subtype(it) == "sustenance" + and you.race() == "Mummy") then return false end end - + -- we only get here if class autopickup ON return true end - diff --git a/crawl-ref/source/randart.cc b/crawl-ref/source/randart.cc index 5f58edab16..8f58f30aa1 100644 --- a/crawl-ref/source/randart.cc +++ b/crawl-ref/source/randart.cc @@ -1147,6 +1147,13 @@ void randart_wpn_properties( const item_def &item, for (vec_size i = 0; i < RA_PROPERTIES; i++) proprt[i] = rap_vec[i].get_short(); } + else if (is_unrandom_artefact( item )) + { + const unrandart_entry *unrand = _seekunrandart( item ); + + for (int i = 0; i < RA_PROPERTIES; i++) + proprt[i] = (short) unrand->prpty[i]; + } else { _get_randart_properties(item, proprt); @@ -1882,18 +1889,28 @@ bool make_item_unrandart( item_def &item, int unrand_index ) known[i] = (bool) false; } - item.base_type = unranddata[unrand_index].ura_cl; - item.sub_type = unranddata[unrand_index].ura_ty; - item.plus = unranddata[unrand_index].ura_pl; - item.plus2 = unranddata[unrand_index].ura_pl2; - item.colour = unranddata[unrand_index].ura_col; + const unrandart_entry *unrand = &unranddata[unrand_index]; + item.base_type = unrand->ura_cl; + item.sub_type = unrand->ura_ty; + item.plus = unrand->ura_pl; + item.plus2 = unrand->ura_pl2; + item.colour = unrand->ura_col; item.flags |= ISFLAG_UNRANDART; - item.special = unranddata[ unrand_index ].prpty[ RAP_BRAND ]; + _init_randart_properties(item); - if (unranddata[ unrand_index ].prpty[ RAP_CURSED ] != 0) + item.special = unrand->prpty[ RAP_BRAND ]; + if (unrand->prpty[ RAP_CURSED ] != 0) do_curse_item( item ); + // get true artefact name + ASSERT(!item.props.exists( RANDART_NAME_KEY )); + item.props[RANDART_NAME_KEY].get_string() = unrand->name; + + // get artefact appearance + ASSERT(!item.props.exists( RANDART_APPEAR_KEY )); + item.props[RANDART_APPEAR_KEY].get_string() = unrand->unid_name; + set_unrandart_exist( unrand_index, true ); return (true); @@ -1901,8 +1918,8 @@ bool make_item_unrandart( item_def &item, int unrand_index ) const char *unrandart_descrip( int which_descrip, const item_def &item ) { -/* Eventually it would be great to have randomly generated descriptions for - randarts. */ +// Eventually it would be great to have randomly generated descriptions +// for randarts. const unrandart_entry *unrand = _seekunrandart( item ); return ((which_descrip == 0) ? unrand->spec_descrip1 : |