diff options
author | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-09 06:38:49 +0000 |
---|---|---|
committer | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-09 06:38:49 +0000 |
commit | b9005fdff781a76600ceff611d01dd9d649f748d (patch) | |
tree | b807902b51a577b4adc6cf118ebd478d04a34102 /crawl-ref/source/it_use3.cc | |
parent | b24097a123b06b3a8f9808f0dc7fffaa3527f606 (diff) | |
download | crawl-ref-b9005fdff781a76600ceff611d01dd9d649f748d.tar.gz crawl-ref-b9005fdff781a76600ceff611d01dd9d649f748d.zip |
Clean up bottled efreet handling some more.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5644 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/it_use3.cc')
-rw-r--r-- | crawl-ref/source/it_use3.cc | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/crawl-ref/source/it_use3.cc b/crawl-ref/source/it_use3.cc index 4b813afd81..d4e6af6b0c 100644 --- a/crawl-ref/source/it_use3.cc +++ b/crawl-ref/source/it_use3.cc @@ -698,35 +698,32 @@ bool evoke_wielded() static bool efreet_flask(void) { - beh_type beha = BEH_HOSTILE; - unsigned short hitting = MHITYOU; + monster_type mon = MONS_EFREET; - if (you.skills[SK_EVOCATIONS] / 3 + 10 > random2(20)) - { - beha = BEH_FRIENDLY; - hitting = you.pet_target; - } + const bool friendly = + (!player_will_anger_monster(mon) + && you.skills[SK_EVOCATIONS] / 3 + 10 > random2(20)); mpr("You open the flask..."); const int efreet = create_monster( - mgen_data( MONS_EFREET, beha, 0, you.pos(), hitting ) ); + mgen_data(mon, + friendly ? BEH_FRIENDLY : BEH_HOSTILE, + 0, you.pos(), + friendly ? you.pet_target : MHITYOU)); if (efreet != -1) { - monsters *mon = &menv[efreet]; - - mpr( "...and a huge efreet comes out." ); + mpr("...and a huge efreet comes out."); - mpr( (mon->attitude == ATT_FRIENDLY) ? - "\"Thank you for releasing me!\"" - : "It howls insanely!" ); + mpr(friendly ? "\"Thank you for releasing me!\"" + : "It howls insanely!"); } else canned_msg(MSG_NOTHING_HAPPENS); - dec_inv_item_quantity( you.equip[EQ_WEAPON], 1 ); + dec_inv_item_quantity(you.equip[EQ_WEAPON], 1); return (true); } // end efreet_flask() |