summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/effects.cc
diff options
context:
space:
mode:
authormtitus_613 <mtitus_613@c06c8d41-db1a-0410-9941-cceddc491573>2007-03-05 20:37:09 +0000
committermtitus_613 <mtitus_613@c06c8d41-db1a-0410-9941-cceddc491573>2007-03-05 20:37:09 +0000
commit7cd64c37c6b36806e99e92e59581447c9b91560a (patch)
tree5ecba94b845e49e445d4d64594a99e5b49ff9afa /crawl-ref/source/effects.cc
parentd03308a14c8e0cf47a3495a7c3d48cb3d430ee6d (diff)
downloadcrawl-ref-7cd64c37c6b36806e99e92e59581447c9b91560a.tar.gz
crawl-ref-7cd64c37c6b36806e99e92e59581447c9b91560a.zip
Trog and Okie shouldn't give gifts that can kill the player by stat drain. Xom is unchanged.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@986 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/effects.cc')
-rw-r--r--crawl-ref/source/effects.cc33
1 files changed, 30 insertions, 3 deletions
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index 53884f1e41..2767cc0036 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -1153,9 +1153,36 @@ bool acquirement(unsigned char force_class, int agent)
}
else
{
- // BCR - unique is now used for food quantity.
- thing_created = items( unique, class_wanted, type_wanted, true,
- MAKE_GOOD_ITEM, 250 );
+ int item_tries = 0;
+ randart_properties_t proprt;
+
+ for(item_tries = 0; item_tries < 50; item_tries++)
+ {
+ // BCR - unique is now used for food quantity.
+ thing_created = items( unique, class_wanted, type_wanted, true,
+ MAKE_GOOD_ITEM, 250 );
+
+ // MT - Check: god-gifted weapons and armor shouldn't kill you. Except Xom.
+ if(agent != GOD_TROG && agent != GOD_OKAWARU)
+ break;
+ else
+ {
+ randart_wpn_properties( mitm[thing_created], proprt );
+
+ //check vs stats. positive stats will automatically fall through.
+ //As will negative stats that won't kill you.
+ if((proprt[RAP_STRENGTH] * -1 >= you.strength ||
+ proprt[RAP_INTELLIGENCE] * -1 >= you.intel ||
+ proprt[RAP_DEXTERITY] * -1 >= you.dex) && item_tries < 50)
+ {
+ //try again
+ destroy_item(thing_created);
+ thing_created = NON_ITEM;
+ }
+ else
+ break;
+ }
+ }
if (thing_created == NON_ITEM)
{