summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/beam.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2007-12-08 18:28:38 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2007-12-08 18:28:38 +0000
commit60bdc5258f24366aa9031738183841edafc8572b (patch)
treecffdcbe6cef4efd9d18e3f203e21cb67d075d8ad /crawl-ref/source/beam.cc
parente9c382cd386ff8f33a2927af3a7c6690abc9fdae (diff)
downloadcrawl-ref-60bdc5258f24366aa9031738183841edafc8572b.tar.gz
crawl-ref-60bdc5258f24366aa9031738183841edafc8572b.zip
Implement the returning brand for ammunition. This mostly uses the same
code as weapons of returning, but such ammunition has the same chance of being randomly destroyed when thrown as non-returning ammunition. Note that the brand is not actually generated anywhere yet. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3024 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/beam.cc')
-rw-r--r--crawl-ref/source/beam.cc68
1 files changed, 16 insertions, 52 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 4e91ca5dfa..9ea7595ec6 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -39,6 +39,7 @@
#include "delay.h"
#include "effects.h"
#include "enum.h"
+#include "item_use.h"
#include "it_use2.h"
#include "items.h"
#include "itemname.h"
@@ -2433,62 +2434,25 @@ void beam_drop_object( bolt &beam, item_def *item, int x, int y )
if (beam.is_tracer || beam.flavour != BEAM_MISSILE)
return;
- if ( grid_destroys_items(grd[x][y]) )
+ if ((YOU_KILL(beam.thrower) &&
+ !thrown_object_destroyed(item, x, y, false)) ||
+ (MON_KILL(beam.thrower) &&
+ !mons_thrown_object_destroyed(item, x, y, false,
+ beam.beam_source)))
{
- // Too much message spam otherwise
- if ( YOU_KILL(beam.thrower) && player_can_hear(x, y) )
- mprf(MSGCH_SOUND, grid_item_destruction_message(grd[x][y]));
-
- item_was_destroyed(*item, beam.beam_source);
- return;
- }
-
- // doesn't get destroyed by throwing
- if (item->sub_type == MI_THROWING_NET)
- {
- // player or monster on position is caught in net
- if (you.x_pos == x && you.y_pos == y && you.attribute[ATTR_HELD]
- || mgrd[x][y] != NON_MONSTER && mons_is_caught(&menv[mgrd[x][y]]))
+ if (item->sub_type == MI_THROWING_NET)
{
- // if no trapping net found mark this one
- if (get_trapping_net(x,y, true) == NON_ITEM)
- set_item_stationary(*item);
- }
-
- copy_item_to_grid( *item, x, y, 1 );
- return;
- }
-
- if (YOU_KILL(beam.thrower)) // you threw it
- {
- int chance;
-
- // [dshaligram] Removed influence of Throwing on ammo preservation.
- // The effect is nigh impossible to perceive.
- switch (item->sub_type)
- {
- case MI_NEEDLE:
- chance = (get_ammo_brand(*item) == SPMSL_CURARE? 3 : 6);
- break;
- case MI_SLING_BULLET:
- case MI_STONE: chance = 4; break;
- case MI_DART: chance = 3; break;
- case MI_ARROW: chance = 4; break;
- case MI_BOLT: chance = 4; break;
- case MI_JAVELIN: chance = 10; break;
-
- case MI_LARGE_ROCK:
- default:
- chance = 25;
- break;
+ // player or monster on position is caught in net
+ if (you.x_pos == x && you.y_pos == y && you.attribute[ATTR_HELD]
+ || mgrd[x][y] != NON_MONSTER &&
+ mons_is_caught(&menv[mgrd[x][y]]))
+ {
+ // if no trapping net found mark this one
+ if (get_trapping_net(x,y, true) == NON_ITEM)
+ set_item_stationary(*item);
+ }
}
- if (item->base_type != OBJ_MISSILES || !one_chance_in(chance))
- copy_item_to_grid( *item, x, y, 1 );
- }
- else if (MON_KILL(beam.thrower)
- && (item->base_type != OBJ_MISSILES || coinflip()))
- {
copy_item_to_grid( *item, x, y, 1 );
}
}