From 4ba581107a1d56ce5706593f4a3917f457afb929 Mon Sep 17 00:00:00 2001 From: zelgadis Date: Tue, 2 Oct 2007 22:40:40 +0000 Subject: Made Xom be smarter about being amused at losing/missing runes, and made Xom also be amused at runes being destroyed. Related changes: * Keep track of which items have ever been held by the player with ISFLAG_BEEN_IN_INV. * item_was_destroyed() is called when an item is destroyed (as in dropped in lava, not destroy_item() being called), and item_was_lost() is called if the item was lost (i.e., being left behind in the Abyss). * Keeps track of the number of runes that the character has collected, and how many have been left in the Halls of Zot. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2300 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/monstuff.cc | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'crawl-ref/source/monstuff.cc') diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 2f71c94086..bcf04efba4 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -268,6 +268,8 @@ static void monster_drop_ething(monsters *monster, hostile_grid = true; } + int midx = (int) monster_index(monster); + for (i = MSLOT_GOLD; i >= MSLOT_WEAPON; i--) { int item = monster->inv[i]; @@ -276,6 +278,7 @@ static void monster_drop_ething(monsters *monster, { if (hostile_grid) { + item_was_destroyed(mitm[item], midx); destroyed = true; destroy_item( item ); } @@ -301,7 +304,6 @@ static void monster_drop_ething(monsters *monster, static void place_monster_corpse(const monsters *monster) { int corpse_class = mons_species(monster->type); - if (corpse_class == MONS_DRACONIAN) corpse_class = draco_subspecies(monster); @@ -310,12 +312,8 @@ static void place_monster_corpse(const monsters *monster) else if (monster->has_ench(ENCH_GLOWING_SHAPESHIFTER)) corpse_class = MONS_GLOWING_SHAPESHIFTER; - if (mons_weight(corpse_class) == 0 - || grid_destroys_items(grd[monster->x][monster->y]) - || coinflip()) - { + if (mons_weight(corpse_class) == 0 || coinflip()) return; - } int o = get_item_slot(); if (o == NON_ITEM) @@ -333,6 +331,13 @@ static void place_monster_corpse(const monsters *monster) if (mitm[o].colour == BLACK) mitm[o].colour = monster->colour; + if (grid_destroys_items(grd[monster->x][monster->y])) + { + item_was_destroyed(mitm[o]); + mitm[o].base_type = OBJ_UNASSIGNED; + return; + } + // Don't care if 'o' is changed, and it shouldn't be (corpses don't stack) move_item_to_grid( &o, monster->x, monster->y ); if (see_grid(monster->x, monster->y)) @@ -4242,10 +4247,11 @@ static bool handle_pickup(monsters *monster) if (mons_itemuse(monster->type) == MONUSE_EATS_ITEMS) { - int hps_gained = 0; - int max_eat = roll_dice( 1, 10 ); - int eaten = 0; - bool eaten_net = false; + int midx = monster_index(monster); + int hps_gained = 0; + int max_eat = roll_dice( 1, 10 ); + int eaten = 0; + bool eaten_net = false; for (item = igrd[monster->x][monster->y]; item != NON_ITEM && eaten < max_eat && hps_gained < 50; @@ -4282,6 +4288,9 @@ static bool handle_pickup(monsters *monster) eaten++; } + if (quant >= mitm[item].quantity) + item_was_destroyed(mitm[item], midx); + dec_mitm_item_quantity( item, quant ); } -- cgit v1.2.3-54-g00ecf