diff options
author | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-04-29 14:22:37 +0000 |
---|---|---|
committer | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-04-29 14:22:37 +0000 |
commit | 5c11aa826362472888cf1fa2a323f3afcf663f0f (patch) | |
tree | 9b0255e1c353e27ad8edef0dae097a60a9797a67 /crawl-ref/source | |
parent | 5ef634172fcd1009c78e957f6ddae4e99b0eb230 (diff) | |
download | crawl-ref-5c11aa826362472888cf1fa2a323f3afcf663f0f.tar.gz crawl-ref-5c11aa826362472888cf1fa2a323f3afcf663f0f.zip |
Add a parameter to dancing_weapon() to allow not displaying the failure
messages.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4761 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/spells3.cc | 35 | ||||
-rw-r--r-- | crawl-ref/source/spells3.h | 2 |
2 files changed, 21 insertions, 16 deletions
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc index 7d5181195b..75cdb7f605 100644 --- a/crawl-ref/source/spells3.cc +++ b/crawl-ref/source/spells3.cc @@ -471,7 +471,7 @@ void simulacrum(int power) } } -bool dancing_weapon(int pow, bool force_hostile) +bool dancing_weapon(int pow, bool force_hostile, bool silent) { int numsc = std::min(2 + (random2(pow) / 5), 6); @@ -485,8 +485,8 @@ bool dancing_weapon(int pow, bool force_hostile) // See if wielded item is appropriate: if (wpn == -1 || you.inv[wpn].base_type != OBJ_WEAPONS - || is_range_weapon( you.inv[wpn] ) - || is_fixed_artefact( you.inv[wpn] )) + || is_range_weapon(you.inv[wpn]) + || is_fixed_artefact( you.inv[wpn])) { failed = true; } @@ -496,7 +496,7 @@ bool dancing_weapon(int pow, bool force_hostile) if (i == NON_ITEM) failed = true; - if ( !failed ) + if (!failed) { // cursed weapons become hostile @@ -506,21 +506,26 @@ bool dancing_weapon(int pow, bool force_hostile) hitting = MHITYOU; } - summs = create_monster( MONS_DANCING_WEAPON, numsc, beha, - you.x_pos, you.y_pos, hitting, - MONS_PROGRAM_BUG ); - if ( summs == -1 ) + summs = create_monster(MONS_DANCING_WEAPON, numsc, beha, + you.x_pos, you.y_pos, hitting, + MONS_PROGRAM_BUG); + if (summs == -1) failed = true; } - if ( failed ) + if (failed) { destroy_item(i); - if ( wpn != -1 ) - mpr("Your weapon vibrates crazily for a second."); - else - msg::stream << "Your " << your_hand(true) << " twitch." - << std::endl; + + if (!silent) + { + if (wpn != -1) + mpr("Your weapon vibrates crazily for a second."); + else + msg::stream << "Your " << your_hand(true) << " twitch." + << std::endl; + } + return false; } @@ -539,7 +544,7 @@ bool dancing_weapon(int pow, bool force_hostile) mprf("%s dances into the air!", you.inv[wpn].name(DESC_CAP_YOUR).c_str()); - you.inv[ wpn ].quantity = 0; + you.inv[wpn].quantity = 0; menv[summs].inv[MSLOT_WEAPON] = i; menv[summs].colour = mitm[i].colour; diff --git a/crawl-ref/source/spells3.h b/crawl-ref/source/spells3.h index 49d60e2df1..44636eb093 100644 --- a/crawl-ref/source/spells3.h +++ b/crawl-ref/source/spells3.h @@ -82,7 +82,7 @@ bool project_noise(void); /* *********************************************************************** * called from: religion - spell * *********************************************************************** */ -bool dancing_weapon(int pow, bool force_hostile); +bool dancing_weapon(int pow, bool force_hostile, bool silent = false); // updated 24may2000 {dlb} |