diff options
author | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-04-16 23:44:59 +0000 |
---|---|---|
committer | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-04-16 23:44:59 +0000 |
commit | 2b77a49fb98420b4ba7c36a7f2f5a0df2a2b64b8 (patch) | |
tree | 2f40d4c6877eaa57427b2dfc12573f1d8e38faf1 /crawl-ref/source | |
parent | e87a77a5d9204245499d0e75aa34b627410d52a0 (diff) | |
download | crawl-ref-2b77a49fb98420b4ba7c36a7f2f5a0df2a2b64b8.tar.gz crawl-ref-2b77a49fb98420b4ba7c36a7f2f5a0df2a2b64b8.zip |
Make sure that when TSO makes your wielded weapon an artefact, any stat
drains it gets don't kill you. This is somewhat of a hack, but there
doesn't seem to be a better way right now.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4278 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/item_use.cc | 9 | ||||
-rw-r--r-- | crawl-ref/source/item_use.h | 3 | ||||
-rw-r--r-- | crawl-ref/source/itemprop.h | 2 | ||||
-rw-r--r-- | crawl-ref/source/randart.cc | 8 |
4 files changed, 16 insertions, 6 deletions
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index ce4071cfca..af1c6906c5 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -2771,8 +2771,9 @@ static int prompt_ring_to_remove(int new_ring) // Checks whether a to-be-worn or to-be-removed item affects // character stats and whether wearing/removing it could be fatal. -// If so, warns the player. -bool safe_to_remove_or_wear(const item_def &item, bool remove) +// If so, warns the player, or just returns false if quiet is true. +bool safe_to_remove_or_wear(const item_def &item, bool remove, + bool quiet) { int prop_str = 0; int prop_dex = 0; @@ -2818,7 +2819,7 @@ bool safe_to_remove_or_wear(const item_def &item, bool remove) if ((prop_str >= you.strength || prop_int >= you.intel || prop_dex >= you.dex) - && !yesno(prompt.c_str(), false, 'n')) + && (quiet || !yesno(prompt.c_str(), false, 'n'))) { return (false); } @@ -2833,7 +2834,7 @@ bool safe_to_remove_or_wear(const item_def &item, bool remove) if ((-prop_str >= you.strength || -prop_int >= you.intel || -prop_dex >= you.dex) - && !yesno(prompt.c_str(), false, 'n')) + && (quiet || !yesno(prompt.c_str(), false, 'n'))) { return (false); } diff --git a/crawl-ref/source/item_use.h b/crawl-ref/source/item_use.h index 1ef1bad677..f59a384931 100644 --- a/crawl-ref/source/item_use.h +++ b/crawl-ref/source/item_use.h @@ -69,7 +69,8 @@ void drink(int slot = -1); bool elemental_missile_beam(int launcher_brand, int ammo_brand); -bool safe_to_remove_or_wear(const item_def &item, bool remove); +bool safe_to_remove_or_wear(const item_def &item, bool remove, + bool quiet = false); // last updated 12may2000 {dlb} /* *********************************************************************** diff --git a/crawl-ref/source/itemprop.h b/crawl-ref/source/itemprop.h index 33d4f2efb9..863b75bad2 100644 --- a/crawl-ref/source/itemprop.h +++ b/crawl-ref/source/itemprop.h @@ -99,7 +99,7 @@ enum brand_type // equivalent to (you.inv[].special or mitm[].special) % 30 SPWPN_REACHING, // 17 MAX_PAN_LORD_BRANDS, // 18 - + SPWPN_RETURNING = MAX_PAN_LORD_BRANDS, SPWPN_CONFUSE, SPWPN_RANDART_I = 25, // 25 diff --git a/crawl-ref/source/randart.cc b/crawl-ref/source/randart.cc index 6747b60797..f8533b0146 100644 --- a/crawl-ref/source/randart.cc +++ b/crawl-ref/source/randart.cc @@ -27,6 +27,7 @@ #include "database.h" #include "itemname.h" #include "itemprop.h" +#include "item_use.h" #include "place.h" #include "player.h" #include "religion.h" @@ -103,6 +104,13 @@ static bool god_fits_artefact(const god_type which_god, const item_def &item) { return (false); } + + // Hack: Since TSO gifts change the wielded weapon, make sure + // that any drains to strength, intelligence, or dexterity + // don't kill the player. + if (!safe_to_remove_or_wear(item, false, true)) + return (false); + break; case GOD_SIF_MUNA: |