From 7f8b6d85697774a182b3f40aca21e2286d5c32a3 Mon Sep 17 00:00:00 2001 From: Adam Borowski Date: Tue, 3 Nov 2009 13:11:56 +0100 Subject: Cosmetic desc of gloves: 50% of them will be "gauntlets", 0% "bracers". --- crawl-ref/source/dat/descript/items.txt | 8 ++++++++ crawl-ref/source/itemname.cc | 13 ++++++++++++- crawl-ref/source/itemprop.cc | 14 ++++++++++++++ crawl-ref/source/itemprop.h | 10 ++++++++++ crawl-ref/source/makeitem.cc | 2 ++ 5 files changed, 46 insertions(+), 1 deletion(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/dat/descript/items.txt b/crawl-ref/source/dat/descript/items.txt index 9df184dafc..b9a8e50d0a 100644 --- a/crawl-ref/source/dat/descript/items.txt +++ b/crawl-ref/source/dat/descript/items.txt @@ -820,6 +820,14 @@ pair of boots A pair of boots. %%%% +pair of bracers + +A pair of bracers. +%%%% +pair of gauntlets + +A pair of gauntlets. +%%%% pair of gloves A pair of gloves. diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc index a0577bad38..307074402f 100644 --- a/crawl-ref/source/itemname.cc +++ b/crawl-ref/source/itemname.cc @@ -1271,7 +1271,18 @@ std::string item_def::name_aux(description_level_type desc, : "buggy "); } - buff << item_base_name(*this); + if (!basename && item_typ == ARM_GLOVES) + { + const short dglov = get_gloves_desc(*this); + + buff << + ((dglov == TGLOV_DESC_GLOVES) ? "gloves" : + (dglov == TGLOV_DESC_GAUNTLETS) ? "gauntlets" : + (dglov == TGLOV_DESC_BRACERS) ? "bracers" : + "bug-ridden gloves"); + } + else + buff << item_base_name(*this); if (know_ego && !is_artefact(*this)) { diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc index eebf239bb2..eed9ac927d 100644 --- a/crawl-ref/source/itemprop.cc +++ b/crawl-ref/source/itemprop.cc @@ -893,6 +893,20 @@ void set_helmet_random_desc( item_def &item ) item.plus2 = random2(THELM_DESC_MAX_SOFT + 1); } +short get_gloves_desc( const item_def &item ) +{ + ASSERT( item.base_type == OBJ_ARMOUR && item.sub_type == ARM_GLOVES ); + + return item.plus2; +} + +void set_gloves_random_desc( item_def &item ) +{ + ASSERT( item.base_type == OBJ_ARMOUR && item.sub_type == ARM_GLOVES ); + + item.plus2 = coinflip() ? TGLOV_DESC_GLOVES : TGLOV_DESC_GAUNTLETS; +} + // // Ego item functions: // diff --git a/crawl-ref/source/itemprop.h b/crawl-ref/source/itemprop.h index 7a08a9c0d8..5fbd26c968 100644 --- a/crawl-ref/source/itemprop.h +++ b/crawl-ref/source/itemprop.h @@ -146,6 +146,13 @@ enum helmet_desc_type THELM_NUM_DESCS }; +enum gloves_desc_type +{ + TGLOV_DESC_GLOVES = 0, + TGLOV_DESC_GAUNTLETS, + TGLOV_DESC_BRACERS +}; + enum jewellery_type { RING_FIRST_RING = 0, @@ -609,6 +616,9 @@ short get_helmet_desc( const item_def &item ); bool is_helmet( const item_def& item ); bool is_hard_helmet( const item_def& item ); +short get_gloves_desc( const item_def &item ); +void set_gloves_random_desc( item_def &item ); + // ego items: bool set_item_ego_type( item_def &item, int item_type, int ego_type ); int get_weapon_brand( const item_def &item ); diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc index 8df359db5c..035113b727 100644 --- a/crawl-ref/source/makeitem.cc +++ b/crawl-ref/source/makeitem.cc @@ -2144,6 +2144,8 @@ static void _generate_armour_item(item_def& item, bool allow_uniques, // If we get here the item is not an artefact. if (is_helmet(item) && one_chance_in(3)) set_helmet_random_desc(item); + else if (item.sub_type == ARM_GLOVES) + set_gloves_random_desc(item); if (item_race == MAKE_ITEM_RANDOM_RACE && item.sub_type == ARM_BOOTS) { -- cgit v1.2.3-54-g00ecf