diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-04-20 12:12:19 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-04-20 12:12:19 +0000 |
commit | 30a70203bafbec37e9720b511d51d5a4144d9fa9 (patch) | |
tree | 83e30012568ae6de7f0a6da400bfec6fc35ed4ca | |
parent | 1326ea6a6d343513430861c1ef9a04bfd61dd6a4 (diff) | |
download | crawl-ref-30a70203bafbec37e9720b511d51d5a4144d9fa9.tar.gz crawl-ref-30a70203bafbec37e9720b511d51d5a4144d9fa9.zip |
Change recursing to work similarly as was suggested by {bdr} - Brent?
The curses property now may take any range of numbers, rather than
plain 0 or 1. If its value is different from 0, the randart is created
cursed. For positive values, it may additionally recurse itself with
1/value probability. In this case, add a description line ("It may
recurse itself.") and an auto-inscription ("Curse", comes last).
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4406 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r-- | crawl-ref/source/describe.cc | 16 | ||||
-rw-r--r-- | crawl-ref/source/item_use.cc | 13 | ||||
-rw-r--r-- | crawl-ref/source/randart.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/unrand.h | 17 |
4 files changed, 31 insertions, 17 deletions
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc index caa1e8e3cf..6c48fc1cee 100644 --- a/crawl-ref/source/describe.cc +++ b/crawl-ref/source/describe.cc @@ -238,7 +238,8 @@ static std::vector<std::string> _randart_propnames( const item_def& item ) // Qualitative attributes { "MP", RAP_MAGICAL_POWER, 0 }, { "SInv", RAP_EYESIGHT, 2 }, - { "Stlth", RAP_STEALTH, 2 } // handled specially + { "Stlth", RAP_STEALTH, 2 }, // handled specially + { "Curse", RAP_CURSED, 2 }, }; // For randart jewellery, note the base jewellery type if it's not @@ -307,6 +308,9 @@ static std::vector<std::string> _randart_propnames( const item_def& item ) break; } case 2: // e.g. rPois or SInv + if (propanns[i].prop == RAP_CURSED && val < 1) + continue; + work << propanns[i].name; // these need special handling, so we don't give anything away @@ -398,13 +402,21 @@ static std::string _randart_descrip( const item_def &item ) { RAP_CAUSE_TELEPORTATION, "It causes teleportation.", false}, { RAP_PREVENT_TELEPORTATION, "It prevents most forms of teleportation.", false}, - { RAP_ANGRY, "It makes you angry.", false} + { RAP_ANGRY, "It makes you angry.", false}, + { RAP_CURSED, "It may recurse itself.", false} }; for ( unsigned i = 0; i < ARRAYSZ(propdescs); ++i ) { if ( known_proprt(propdescs[i].property)) { + // Only randarts with RAP_CURSED > 0 may recurse themselves. + if (propdescs[i].property == RAP_CURSED + && proprt[propdescs[i].property] < 1) + { + continue; + } + std::string sdesc = propdescs[i].desc; // FIXME Not the nicest hack. diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index dda2346e03..30e78b8467 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -707,11 +707,9 @@ void wield_effects(int item_wield_2, bool showMsgs) you.special_wield = SPWLD_CURSE; if (!item_cursed(item) && one_chance_in(5)) { - if (was_known) - { - mprf("%s glows black for a moment.", - item.name(DESC_CAP_YOUR).c_str()); - } + mprf("%s glows black for a moment.", + item.name(DESC_CAP_YOUR).c_str()); + do_curse_item( item ); } break; @@ -4397,6 +4395,7 @@ void read_scroll( int slot ) item_def& item = you.inv[you.equip[affected]]; mprf("%s glows black for a moment.", item.name(DESC_CAP_YOUR).c_str()); + do_curse_item( item ); } break; @@ -4564,10 +4563,12 @@ void use_randart(item_def &item) randart_wpn_learn_prop(item, RAP_BERSERK); } - if (!item_cursed(item) && proprt[RAP_CURSED] && one_chance_in(3)) + if ( !item_cursed(item) && proprt[RAP_CURSED] > 0 + && one_chance_in(proprt[RAP_CURSED]) ) { mprf("%s glows black for a moment.", item.name(DESC_CAP_YOUR).c_str()); + do_curse_item( item ); randart_wpn_learn_prop(item, RAP_CURSED); } diff --git a/crawl-ref/source/randart.cc b/crawl-ref/source/randart.cc index 615c224321..5a0309c1b0 100644 --- a/crawl-ref/source/randart.cc +++ b/crawl-ref/source/randart.cc @@ -1795,7 +1795,7 @@ bool make_item_unrandart( item_def &item, int unrand_index ) item.flags |= ISFLAG_UNRANDART; item.special = unranddata[ unrand_index ].prpty[ RAP_BRAND ]; - if (unranddata[ unrand_index ].prpty[ RAP_CURSED ]) + if (unranddata[ unrand_index ].prpty[ RAP_CURSED ] != 0) do_curse_item( item ); set_unrandart_exist( unrand_index, true ); diff --git a/crawl-ref/source/unrand.h b/crawl-ref/source/unrand.h index 87154be150..e5d80e92b3 100644 --- a/crawl-ref/source/unrand.h +++ b/crawl-ref/source/unrand.h @@ -98,9 +98,10 @@ +/- to-hit/to-dam: Obvious. Affects both melee and missile. Should be left at 0 for weapons, which get +s normally. - cursed: 0 or 1. Sets the item's initial curse status. Cursed items - will tend to recurse themselves when rewielded. Maybe this should be - made to be a value that determines how often it will recurse? -- bwr + cursed: -1, 0, any positive value. + Setting this to any value other than 0 will set the item's initial curse + status as cursed. If the value is greater than zero, the item will also have + one_chance_in(value) of recursing itself when re-equipped. stealth: -100 to 80. Adds to stealth value. @@ -226,7 +227,7 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0 // cursed + 3, 0 // cursed } , "", @@ -476,7 +477,7 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0 // cursed + -1, 0 // cursed } , "", @@ -623,7 +624,7 @@ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, // prevent spellcasting 0, 0, 0, 0, 0, - 1, 0 // cursed + -1, 0 // cursed } , "", @@ -749,7 +750,7 @@ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, // prevent spellcasting 0, 0, 0, 0, 0, - 1, 0 // cursed + 2, 0 // cursed } , "", @@ -839,7 +840,7 @@ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, // prevent spellcasting, prevent teleport 0, 0, 0, 0, 0, - 1, 0 // cursed + -1, 0 // cursed } , "", |