From 5cdc214dfd97a588ff443dae8ff1fc513693dae9 Mon Sep 17 00:00:00 2001 From: dshaligram Date: Sun, 30 Dec 2007 09:35:41 +0000 Subject: Summoned monsters will now take back only items they were summoned with - subsequently acquired items will be left behind when they disappear. MF_HARD_RESET should now be used only for dancing weapons - other summons are generated with items marked appropriately. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3148 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/monstuff.cc | 52 ++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'crawl-ref/source/monstuff.cc') diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 867253ed37..2ab5148d34 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -258,28 +258,26 @@ bool curse_an_item( bool decay_potions ) static void monster_drop_ething(monsters *monster, bool mark_item_origins = false) { - /* drop weapons & missiles last (ie on top) so others pick up */ - int i; // loop variable {dlb} - bool destroyed = false; - bool hostile_grid = false; - - if ( grid_destroys_items(grd[monster->x][monster->y]) ) { - hostile_grid = true; - } + const bool hostile_grid = grid_destroys_items(grd(monster->pos())); + const int midx = (int) monster_index(monster); - int midx = (int) monster_index(monster); + bool destroyed = false; - for (i = MSLOT_GOLD; i >= MSLOT_WEAPON; i--) + /* drop weapons & missiles last (ie on top) so others pick up */ + for (int i = NUM_MONSTER_SLOTS - 1; i >= 0; i--) { int item = monster->inv[i]; if (item != NON_ITEM) { - if (hostile_grid) + const bool summoned_item = + testbits(mitm[item].flags, ISFLAG_SUMMONED); + if (hostile_grid || summoned_item) { item_was_destroyed(mitm[item], midx); - destroyed = true; destroy_item( item ); + if (!summoned_item) + destroyed = true; } else { @@ -294,11 +292,10 @@ static void monster_drop_ething(monsters *monster, } } - if (destroyed) { + if (destroyed) mprf(MSGCH_SOUND, - grid_item_destruction_message(grd[monster->x][monster->y])); - } -} // end monster_drop_ething() + grid_item_destruction_message(grd(monster->pos()))); +} static void place_monster_corpse(const monsters *monster) { @@ -494,7 +491,7 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent) !silent && mons_near(monster) && player_monster_visible(monster); bool in_transit = false; const bool hard_reset = testbits(monster->flags, MF_HARD_RESET); - bool drop_items = !monster->has_ench(ENCH_ABJ) && !hard_reset; + const bool drop_items = !hard_reset; #ifdef DGL_MILESTONES check_kill_milestone(monster, killer, i); @@ -605,8 +602,6 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent) place_cloud( random_smoke_type(), monster->x, monster->y, 1 + random2(3), monster->kill_alignment() ); - else - drop_items = true; } else { @@ -823,16 +818,21 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent) monster->x, monster->y, 1 + random2(3), monster->kill_alignment() ); - if (monster->needs_transit()) - { - monster->flags |= MF_BANISHED; - monster->set_transit( level_id(LEVEL_ABYSS) ); - in_transit = true; - } + // KILL_RESET monsters no longer lose their whole inventory, only + // items they were generated with. + if (!monster->needs_transit()) + break; - // fall-through + // Monster goes to the Abyss. + monster->flags |= MF_BANISHED; + monster->set_transit( level_id(LEVEL_ABYSS) ); + in_transit = true; + monster->destroy_inventory(); + break; case KILL_DISMISSED: + break; + default: monster->destroy_inventory(); break; -- cgit v1.2.3-54-g00ecf