From e9017206fd30a9cb7981d42ee6f8f1809f2f2933 Mon Sep 17 00:00:00 2001 From: Darshan Shaligram Date: Tue, 29 Dec 2009 00:01:37 +0530 Subject: Experimental kraken adjustments. Boost kraken and tentacle damage. Force the tentacles to stay close to the body of the kraken to make the creature look more like a unit. Tentacles are now amphibious and can reach out onto land, although they cannot stray too far from the main body. --- crawl-ref/source/mon-act.cc | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'crawl-ref/source/mon-act.cc') diff --git a/crawl-ref/source/mon-act.cc b/crawl-ref/source/mon-act.cc index 16c025e217..3fc1cea5a0 100644 --- a/crawl-ref/source/mon-act.cc +++ b/crawl-ref/source/mon-act.cc @@ -332,6 +332,24 @@ static void _maybe_set_patrol_route(monsters *monster) } } +// Keep kraken tentacles from wandering too far away from the boss monster. +static void _kraken_tentacle_movement_clamp(monsters *tentacle) +{ + if (tentacle->type != MONS_KRAKEN_TENTACLE) + return; + + const int kraken_idx = tentacle->number; + ASSERT(!invalid_monster_index(kraken_idx)); + + monsters *kraken = &menv[kraken_idx]; + const int distance_to_head = + grid_distance(tentacle->pos(), kraken->pos()); + // Beyond max distance, the only move the tentacle can make is + // back towards the head. + if (distance_to_head >= KRAKEN_TENTACLE_RANGE) + mmov = (kraken->pos() - tentacle->pos()).sgn(); +} + //--------------------------------------------------------------- // // handle_movement @@ -378,8 +396,7 @@ static void _handle_movement(monsters *monster) delta = monster->target - monster->pos(); // Move the monster. - mmov.x = (delta.x > 0) ? 1 : ((delta.x < 0) ? -1 : 0); - mmov.y = (delta.y > 0) ? 1 : ((delta.y < 0) ? -1 : 0); + mmov = delta.sgn(); if (mons_is_fleeing(monster) && monster->travel_target != MTRAV_WALL && (!monster->friendly() @@ -1849,6 +1866,7 @@ static void _handle_monster_move(monsters *monster) { // Calculates mmov based on monster target. _handle_movement(monster); + _kraken_tentacle_movement_clamp(monster); if (mons_is_confused(monster) || monster->type == MONS_AIR_ELEMENTAL -- cgit v1.2.3-54-g00ecf From cfdb6e14f51f38e104444acf22e17706fcda104d Mon Sep 17 00:00:00 2001 From: Darshan Shaligram Date: Tue, 29 Dec 2009 17:56:26 +0530 Subject: Add merfolk javelineers to the Shoals, add descriptions for the three new merfolk types. --- crawl-ref/source/dat/descript/monsters.txt | 14 ++++++++- crawl-ref/source/enum.h | 1 + crawl-ref/source/mon-act.cc | 7 ++++- crawl-ref/source/mon-data.h | 24 +++++++++++---- crawl-ref/source/mon-gear.cc | 49 ++++++++++++++++++------------ crawl-ref/source/mon-pick.cc | 4 ++- 6 files changed, 71 insertions(+), 28 deletions(-) (limited to 'crawl-ref/source/mon-act.cc') diff --git a/crawl-ref/source/dat/descript/monsters.txt b/crawl-ref/source/dat/descript/monsters.txt index da05efc32f..579bbeb6a3 100644 --- a/crawl-ref/source/dat/descript/monsters.txt +++ b/crawl-ref/source/dat/descript/monsters.txt @@ -1048,7 +1048,19 @@ This tall and powerful demon is Mara, Lord of Illusions, mighty among dreamers. %%%% merfolk -Half fish, half man, the merfolk are citizens of both water and land, and they'll fiercely protect their chosen territory. +Half fish, half man, the merfolk are citizens of both water and land, and fierce protectors of their chosen territory. +%%%% +merfolk impaler + +A powerfully muscled merfolk warrior, bearing a great trident. +%%%% +merfolk aquamancer + +A slender merfolk mystic with unusually webby hands. Its form shifts and glistens as if seen through ocean spray. +%%%% +merfolk javelineer + +A sinewy merfolk fighter with a piercing gaze and a large bundle of javelins. %%%% mermaid diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h index 4a37b027b6..08ae63c36e 100644 --- a/crawl-ref/source/enum.h +++ b/crawl-ref/source/enum.h @@ -1823,6 +1823,7 @@ enum monster_type // (int) menv[].type // Shoals guardians MONS_MERFOLK_IMPALER, MONS_MERFOLK_AQUAMANCER, + MONS_MERFOLK_JAVELINEER, //jmf: end new monsters MONS_WHITE_IMP = 220, // 220 diff --git a/crawl-ref/source/mon-act.cc b/crawl-ref/source/mon-act.cc index 3fc1cea5a0..31d1c990a7 100644 --- a/crawl-ref/source/mon-act.cc +++ b/crawl-ref/source/mon-act.cc @@ -1139,7 +1139,12 @@ static bool _mons_throw(struct monsters *monster, struct bolt &pbolt, { const mon_attack_def attk = mons_attack_spec(monster, 0); if (attk.type == AT_SHOOT) - ammoDamBonus += random2avg(attk.damage, 2); + { + if (projected == LRET_THROWN && wepClass == OBJ_MISSILES) + ammoHitBonus += random2avg(attk.damage, 2); + else + ammoDamBonus += random2avg(attk.damage, 2); + } } if (projected == LRET_THROWN) diff --git a/crawl-ref/source/mon-data.h b/crawl-ref/source/mon-data.h index 5f8822a84b..e5e5fb7b98 100644 --- a/crawl-ref/source/mon-data.h +++ b/crawl-ref/source/mon-data.h @@ -1123,12 +1123,24 @@ static monsterentry mondata[] = { M_WARM_BLOOD, MR_NO_FLAGS, 500, 10, MONS_MERFOLK, MONS_MERFOLK, MH_NATURAL, -3, - { {AT_HIT, AF_PLAIN, 35}, AT_NO_ATK, AT_NO_ATK, AT_NO_ATK }, - { 14, 6, 3, 0 }, - // Gladiators prefer light armour, and are dodging experts. - 0, 17, MST_NO_SPELLS, CE_CONTAMINATED, Z_SMALL, S_SHOUT, + { {AT_HIT, AF_PLAIN, 40}, AT_NO_ATK, AT_NO_ATK, AT_NO_ATK }, + { 16, 5, 3, 0 }, + // Impalers prefer light armour, and are dodging experts. + 0, 23, MST_NO_SPELLS, CE_CONTAMINATED, Z_SMALL, S_SHOUT, I_NORMAL, HT_AMPHIBIOUS_WATER, FL_NONE, 10, ATTACK_ENERGY(6), - MONUSE_WEAPONS_ARMOUR, MONEAT_NOTHING, SIZE_MEDIUM + MONUSE_MAGIC_ITEMS, MONEAT_NOTHING, SIZE_MEDIUM +}, + +{ + MONS_MERFOLK_JAVELINEER, 'm', LIGHTGREY, "merfolk javelineer", + M_WARM_BLOOD | M_ARCHER, + MR_NO_FLAGS, + 500, 10, MONS_MERFOLK, MONS_MERFOLK, MH_NATURAL, -4, + { {AT_SHOOT, AF_PLAIN, 18}, {AT_HIT, AF_PLAIN, 20}, AT_NO_ATK, AT_NO_ATK }, + { 16, 4, 2, 0 }, + 0, 15, MST_NO_SPELLS, CE_CONTAMINATED, Z_SMALL, S_SHOUT, + I_NORMAL, HT_AMPHIBIOUS_WATER, FL_NONE, 10, MISSILE_ENERGY(8), + MONUSE_MAGIC_ITEMS, MONEAT_NOTHING, SIZE_MEDIUM }, { @@ -1140,7 +1152,7 @@ static monsterentry mondata[] = { { 15, 3, 3, 0 }, 0, 12, MST_MERFOLK_AQUAMANCER, CE_CONTAMINATED, Z_SMALL, S_SHOUT, I_NORMAL, HT_AMPHIBIOUS_WATER, FL_NONE, 10, DEFAULT_ENERGY, - MONUSE_WEAPONS_ARMOUR, MONEAT_NOTHING, SIZE_MEDIUM + MONUSE_MAGIC_ITEMS, MONEAT_NOTHING, SIZE_MEDIUM }, { diff --git a/crawl-ref/source/mon-gear.cc b/crawl-ref/source/mon-gear.cc index a012972cc3..393d4680b7 100644 --- a/crawl-ref/source/mon-gear.cc +++ b/crawl-ref/source/mon-gear.cc @@ -412,14 +412,6 @@ static item_make_species_type _give_weapon(monsters *mon, int level, item.sub_type = WPN_LONGBOW; break; - case MONS_MERFOLK_AQUAMANCER: - item_race = MAKE_ITEM_NO_RACE; - item.base_type = OBJ_WEAPONS; - item.sub_type = WPN_SABRE; - if (coinflip()) - level = MAKE_GOOD_ITEM; - break; - case MONS_DEEP_ELF_ANNIHILATOR: case MONS_DEEP_ELF_CONJURER: case MONS_DEEP_ELF_DEATH_MAGE: @@ -593,11 +585,8 @@ static item_make_species_type _give_weapon(monsters *mon, int level, case MONS_MERFOLK_IMPALER: item_race = MAKE_ITEM_NO_RACE; item.base_type = OBJ_WEAPONS; - // Weapon types are not strictly sorted by quality. This is intentional. item.sub_type = random_choose_weighted(100, WPN_TRIDENT, - 45, WPN_BARDICHE, 15, WPN_DEMON_TRIDENT, - 15, WPN_HALBERD, 0); if (coinflip()) level = MAKE_GOOD_ITEM; @@ -611,6 +600,23 @@ static item_make_species_type _give_weapon(monsters *mon, int level, } break; + + case MONS_MERFOLK_AQUAMANCER: + item_race = MAKE_ITEM_NO_RACE; + item.base_type = OBJ_WEAPONS; + item.sub_type = WPN_SABRE; + if (coinflip()) + level = MAKE_GOOD_ITEM; + break; + + case MONS_MERFOLK_JAVELINEER: + item_race = MAKE_ITEM_NO_RACE; + item.base_type = OBJ_WEAPONS; + item.sub_type = WPN_SPEAR; + if (!one_chance_in(3)) + level = MAKE_GOOD_ITEM; + break; + case MONS_MERFOLK: if (one_chance_in(3)) { @@ -1057,14 +1063,13 @@ static void _give_ammo(monsters *mon, int level, qty = random_range(4, 7); break; - case MONS_MERFOLK_IMPALER: - // Gladiators rarely get javelins. - if (one_chance_in(4)) - { - weap_class = OBJ_MISSILES; - weap_type = MI_JAVELIN; - qty = random_range(3, 8, 2); - } + case MONS_MERFOLK_JAVELINEER: + weap_class = OBJ_MISSILES; + weap_type = MI_JAVELIN; + item_race = MAKE_ITEM_NO_RACE; + qty = random_range(9, 23, 2); + if (one_chance_in(3)) + level = MAKE_GOOD_ITEM; break; case MONS_MERFOLK: @@ -1391,6 +1396,12 @@ void give_armour(monsters *mon, int level) 0); break; + case MONS_MERFOLK_JAVELINEER: + item_race = MAKE_ITEM_NO_RACE; + item.base_type = OBJ_ARMOUR; + item.sub_type = ARM_LEATHER_ARMOUR; + break; + case MONS_ANGEL: case MONS_SIGMUND: case MONS_WIGHT: diff --git a/crawl-ref/source/mon-pick.cc b/crawl-ref/source/mon-pick.cc index 01df392e72..edcb9a5ec7 100644 --- a/crawl-ref/source/mon-pick.cc +++ b/crawl-ref/source/mon-pick.cc @@ -1723,6 +1723,7 @@ int mons_shoals_level(int mcls) case MONS_HARPY: case MONS_MERFOLK_IMPALER: case MONS_MERFOLK_AQUAMANCER: + case MONS_MERFOLK_JAVELINEER: mlev += 3; break; @@ -1756,13 +1757,14 @@ int mons_shoals_rare(int mcls) return 50; case MONS_MERMAID: - case MONS_MERFOLK_IMPALER: return 40; case MONS_HIPPOGRIFF: case MONS_GIANT_BAT: case MONS_BUTTERFLY: case MONS_CENTAUR: + case MONS_MERFOLK_IMPALER: + case MONS_MERFOLK_JAVELINEER: return 35; case MONS_SIREN: -- cgit v1.2.3-54-g00ecf From 8a504d20b9992fea2daac06faa6ca5559ca63ae0 Mon Sep 17 00:00:00 2001 From: Stefan O'Rear Date: Tue, 29 Dec 2009 22:43:19 -0800 Subject: Give move/copy_item_to_grid responsibility for hazardous terrain We now have much less duplication of logic, yay. --- crawl-ref/source/beam.cc | 10 +++++++--- crawl-ref/source/effects.cc | 23 +++++----------------- crawl-ref/source/item_use.cc | 21 ++------------------- crawl-ref/source/item_use.h | 3 +-- crawl-ref/source/items.cc | 38 +++++++++++++++++++++++++++++-------- crawl-ref/source/items.h | 6 ++++-- crawl-ref/source/misc.cc | 29 ++++++++++++---------------- crawl-ref/source/mon-act.cc | 2 +- crawl-ref/source/mon-stuff.cc | 39 ++++++++------------------------------ crawl-ref/source/mon-transit.cc | 2 +- crawl-ref/source/monster.cc | 42 +++++++++++++++-------------------------- crawl-ref/source/wiz-item.cc | 3 +++ crawl-ref/source/xom.cc | 2 +- 13 files changed, 90 insertions(+), 130 deletions(-) (limited to 'crawl-ref/source/mon-act.cc') diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index abe97ceb66..451cadd81d 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -3140,7 +3140,7 @@ void bolt::drop_object() return; } - if (!thrown_object_destroyed(item, pos(), false)) + if (!thrown_object_destroyed(item, pos())) { if (item->sub_type == MI_THROWING_NET) { @@ -3154,10 +3154,10 @@ void bolt::drop_object() set_item_stationary(*item); } } + copy_item_to_grid(*item, pos(), 1); } - else if (item->sub_type == MI_LARGE_ROCK - && !feat_destroys_items(grd(pos()))) + else if (item->sub_type == MI_LARGE_ROCK) { // Large rocks mulch to stone. std::string sound_msg = "You hear a cracking sound!"; @@ -3176,6 +3176,10 @@ void bolt::drop_object() copy_item_to_grid(*item, pos(), item->quantity); } + else + { + item_was_destroyed(*item, NON_MONSTER); + } } // Returns true if the beam hits the player, fuzzing the beam if necessary diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc index bede6d46c2..dcec8a0373 100644 --- a/crawl-ref/source/effects.cc +++ b/crawl-ref/source/effects.cc @@ -2315,14 +2315,12 @@ int acquirement_create_item(object_class_type class_wanted, if (agent > GOD_NO_GOD && agent < NUM_GODS && agent == you.religion) thing.inscription = "god gift"; - move_item_to_grid( &thing_created, pos ); - - // This should never actually be NON_ITEM because of the way - // move_item_to_grid works (doesn't create a new item ever), - // but we're checking it anyways. -- bwr + // Moving this above the move since it might not exist after falling. if (thing_created != NON_ITEM && !quiet) canned_msg(MSG_SOMETHING_APPEARS); + move_item_to_grid( &thing_created, pos ); + return (thing_created); } @@ -2382,10 +2380,6 @@ bool acquirement(object_class_type class_wanted, int agent, if (feat_destroys_items(grd(you.pos()))) { - // How sad (and stupid). - if (!silenced(you.pos()) && !quiet) - mprf(MSGCH_SOUND, feat_item_destruction_message(grd(you.pos()))); - if (agent > GOD_NO_GOD && agent < NUM_GODS) { if (agent == GOD_XOM) @@ -2399,18 +2393,11 @@ bool acquirement(object_class_type class_wanted, int agent, god_name((god_type) agent).c_str()); } } - - *item_index = NON_ITEM; - - // Well, the item may have fallen in the drink, but the intent is - // that acquirement happened. -- bwr - return (true); } - *item_index = - acquirement_create_item(class_wanted, agent, quiet, you.pos(), debug); + acquirement_create_item(class_wanted, agent, quiet, you.pos(), debug); - return (*item_index != NON_ITEM); + return (true); } bool recharge_wand(int item_slot) diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index fd01008e25..07aa928eb4 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -3113,7 +3113,7 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, pbolt.fire(); // The item can be destroyed before returning. - if (did_return && thrown_object_destroyed(&item, pbolt.target, true)) + if (did_return && thrown_object_destroyed(&item, pbolt.target)) did_return = false; } @@ -3178,8 +3178,7 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, return (hit); } -bool thrown_object_destroyed(item_def *item, const coord_def& where, - bool returning) +bool thrown_object_destroyed(item_def *item, const coord_def& where) { ASSERT(item != NULL); @@ -3244,22 +3243,6 @@ bool thrown_object_destroyed(item_def *item, const coord_def& where, // destruction: plus / (1 + plus) chance of survival. bool destroyed = (chance == 0) ? false : (one_chance_in(chance) && one_chance_in(item->plus + 1)); - bool hostile_grid = feat_destroys_items(grd(where)); - - // Non-returning items thrown into item-destroying grids are always - // destroyed. Returning items are only destroyed if they would have - // been randomly destroyed anyway. - if (returning && !destroyed) - hostile_grid = false; - - if (hostile_grid) - { - if (player_can_hear(where)) - mprf(MSGCH_SOUND, feat_item_destruction_message(grd(where))); - - item_was_destroyed(*item, NON_MONSTER); - destroyed = true; - } return destroyed; } diff --git a/crawl-ref/source/item_use.h b/crawl-ref/source/item_use.h index a76dc3843c..bba83aa3b4 100644 --- a/crawl-ref/source/item_use.h +++ b/crawl-ref/source/item_use.h @@ -104,8 +104,7 @@ void throw_noise(actor* act, const bolt &pbolt, const item_def &ammo); bool throw_it(bolt &pbolt, int throw_2, bool teleport = false, int acc_bonus = 0, dist *target = NULL); -bool thrown_object_destroyed(item_def *item, const coord_def& where, - bool returning); +bool thrown_object_destroyed(item_def *item, const coord_def& where); void prompt_inscribe_item(); int launcher_shield_slowdown(const item_def &launcher, diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index 29b25a021b..81adf191dd 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -1719,7 +1719,10 @@ void mark_items_non_pickup_at(const coord_def &pos) // // Done this way in the hopes that it will be obvious from // calling code that "obj" is possibly modified. -bool move_item_to_grid( int *const obj, const coord_def& p ) +// +// Returns false on error or level full - cases where you +// keep the item. +bool move_item_to_grid( int *const obj, const coord_def& p, bool silent ) { ASSERT(in_bounds(p)); @@ -1730,6 +1733,18 @@ bool move_item_to_grid( int *const obj, const coord_def& p ) item_def& item(mitm[ob]); + if (feat_destroys_items(grd(p))) + { + if (!silenced(p) && !silent) + mprf(MSGCH_SOUND, feat_item_destruction_message(grd(p))); + + item_was_destroyed(item, NON_MONSTER); + destroy_item(ob); + ob = NON_ITEM; + + return (true); + } + // If it's a stackable type... if (is_stackable_item( item )) { @@ -1809,15 +1824,25 @@ void move_item_stack_to_grid( const coord_def& from, const coord_def& to ) } -// Returns quantity dropped. +// Returns false iff no items could be dropped. bool copy_item_to_grid( const item_def &item, const coord_def& p, - int quant_drop, bool mark_dropped ) + int quant_drop, bool mark_dropped, bool silent ) { ASSERT(in_bounds(p)); if (quant_drop == 0) return (false); + if (feat_destroys_items(grd(p))) + { + if (!silenced(p)) + mprf(MSGCH_SOUND, feat_item_destruction_message(grd(p))); + + item_was_destroyed(item, NON_MONSTER); + + return (true); + } + // default quant_drop == -1 => drop all if (quant_drop < 0) quant_drop = item.quantity; @@ -1966,9 +1991,8 @@ bool drop_item( int item_dropped, int quant_drop, bool try_offer ) const dungeon_feature_type my_grid = grd(you.pos()); - if (!feat_destroys_items(my_grid) - && !copy_item_to_grid( you.inv[item_dropped], - you.pos(), quant_drop, true )) + if (!copy_item_to_grid( you.inv[item_dropped], + you.pos(), quant_drop, true, true )) { mpr("Too many items on this level, not dropping the item."); return (false); @@ -1981,8 +2005,6 @@ bool drop_item( int item_dropped, int quant_drop, bool try_offer ) { if (!silenced(you.pos())) mprf(MSGCH_SOUND, feat_item_destruction_message(my_grid)); - - item_was_destroyed(you.inv[item_dropped], NON_MONSTER); } else if (strstr(you.inv[item_dropped].inscription.c_str(), "=s") != 0) StashTrack.add_stash(); diff --git a/crawl-ref/source/items.h b/crawl-ref/source/items.h index 4ffa1c9c30..8d82197764 100644 --- a/crawl-ref/source/items.h +++ b/crawl-ref/source/items.h @@ -34,7 +34,8 @@ bool dec_mitm_item_quantity(int obj, int amount); void inc_inv_item_quantity(int obj, int amount, bool suppress_burden = false); void inc_mitm_item_quantity(int obj, int amount); -bool move_item_to_grid( int *const obj, const coord_def& p ); +bool move_item_to_grid( int *const obj, const coord_def& p, + bool silent = false ); void move_item_stack_to_grid( const coord_def& from, const coord_def& to ); void note_inscribe_item(item_def &item); int move_item_to_player(int obj, int quant_got, bool quiet = false, @@ -77,7 +78,8 @@ void item_list_on_square( std::vector& items, bool copy_item_to_grid( const item_def &item, const coord_def& p, int quant_drop = -1, // item.quantity by default - bool mark_dropped = false); + bool mark_dropped = false, + bool silent = false ); bool move_top_item( const coord_def &src, const coord_def &dest ); diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index 4bac2e7ff0..b9d9fdabb3 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -1041,23 +1041,18 @@ void split_potions_into_decay( int obj, int amount, bool need_msg ) } } - // Only bother creating a distinct stack of potions - // if it won't get destroyed right away. - if (!feat_destroys_items(grd(you.pos()))) - { - item_def potion2; - potion2.base_type = OBJ_POTIONS; - potion2.sub_type = POT_DECAY; - // Keep description as it was. - potion2.plus = potion.plus; - potion2.quantity = amount; - potion2.colour = potion.colour; - potion2.plus2 = 0; - potion2.flags = 0; - potion2.special = 0; - - copy_item_to_grid(potion2, you.pos()); - } + item_def potion2; + potion2.base_type = OBJ_POTIONS; + potion2.sub_type = POT_DECAY; + // Keep description as it was. + potion2.plus = potion.plus; + potion2.quantity = amount; + potion2.colour = potion.colour; + potion2.plus2 = 0; + potion2.flags = 0; + potion2.special = 0; + + copy_item_to_grid(potion2, you.pos()); // Is decreased even if the decay stack goes splat. dec_inv_item_quantity(obj, amount); diff --git a/crawl-ref/source/mon-act.cc b/crawl-ref/source/mon-act.cc index 31d1c990a7..18ad9a1b01 100644 --- a/crawl-ref/source/mon-act.cc +++ b/crawl-ref/source/mon-act.cc @@ -1413,7 +1413,7 @@ static bool _mons_throw(struct monsters *monster, struct bolt &pbolt, pbolt.fire(); // The item can be destroyed before returning. - if (really_returns && thrown_object_destroyed(&item, pbolt.target, true)) + if (really_returns && thrown_object_destroyed(&item, pbolt.target)) { really_returns = false; } diff --git a/crawl-ref/source/mon-stuff.cc b/crawl-ref/source/mon-stuff.cc index ca7b9cf12c..bcaeecc95a 100644 --- a/crawl-ref/source/mon-stuff.cc +++ b/crawl-ref/source/mon-stuff.cc @@ -255,10 +255,6 @@ bool curse_an_item( bool decay_potions, bool quiet ) void monster_drop_ething(monsters *monster, bool mark_item_origins, int owner_id) { - const bool hostile_grid = feat_destroys_items(grd(monster->pos())); - - bool destroyed = false; - // Drop weapons & missiles last (ie on top) so others pick up. for (int i = NUM_MONSTER_SLOTS - 1; i >= 0; i--) { @@ -268,30 +264,25 @@ void monster_drop_ething(monsters *monster, bool mark_item_origins, { const bool summoned_item = testbits(mitm[item].flags, ISFLAG_SUMMONED); - if (hostile_grid || summoned_item) + if (summoned_item) { item_was_destroyed(mitm[item], monster->mindex()); destroy_item( item ); - if (!summoned_item) - destroyed = true; } else { if (monster->friendly() && mitm[item].is_valid()) mitm[item].flags |= ISFLAG_DROPPED_BY_ALLY; - move_item_to_grid(&item, monster->pos()); - if (mark_item_origins && mitm[item].is_valid()) origin_set_monster(mitm[item], monster); + + move_item_to_grid(&item, monster->pos()); } monster->inv[i] = NON_ITEM; } } - - if (destroyed) - mprf(MSGCH_SOUND, feat_item_destruction_message(grd(monster->pos()))); } monster_type fill_out_corpse(const monsters* monster, item_def& corpse, @@ -421,14 +412,6 @@ bool explode_corpse(item_def& corpse, const coord_def& where) --nchunks; - if (feat_destroys_items(grd(cp))) - { - if (!silenced(cp)) - mprf(MSGCH_SOUND, feat_item_destruction_message(grd(cp))); - - continue; - } - dprf("Success"); copy_item_to_grid(corpse, cp); @@ -483,16 +466,8 @@ int place_monster_corpse(const monsters *monster, bool silent, return (-1); } - if (feat_destroys_items(grd(monster->pos()))) - { - item_was_destroyed(corpse); - destroy_item(o); - return (-1); - } - - // Don't care if 'o' is changed, and it shouldn't be (corpses don't - // stack). move_item_to_grid(&o, monster->pos()); + if (you.see_cell(monster->pos())) { if (force && !silent) @@ -507,10 +482,12 @@ int place_monster_corpse(const monsters *monster, bool silent, } const bool poison = (mons_corpse_effect(corpse_class) == CE_POISONOUS && player_res_poison() <= 0); - tutorial_dissection_reminder(!poison); + + if (o != NON_ITEM) + tutorial_dissection_reminder(!poison); } - return (o); + return (o == NON_ITEM ? -1 : o); } static void _tutorial_inspect_kill() diff --git a/crawl-ref/source/mon-transit.cc b/crawl-ref/source/mon-transit.cc index 49a1e37ba0..6db3c417ca 100644 --- a/crawl-ref/source/mon-transit.cc +++ b/crawl-ref/source/mon-transit.cc @@ -214,7 +214,7 @@ void place_transiting_items() pos, true); // List of items we couldn't place. - if (!copy_item_to_grid(*item, where_to_go)) + if (!copy_item_to_grid(*item, where_to_go, 1, false, true)) keep.push_back(*item); } diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc index 2f83c01d6f..de3af6b0a9 100644 --- a/crawl-ref/source/monster.cc +++ b/crawl-ref/source/monster.cc @@ -1154,12 +1154,8 @@ bool monsters::drop_item(int eslot, int near) was_unequipped = true; } - bool on_floor = true; - if (pitem->flags & ISFLAG_SUMMONED) { - on_floor = false; - if (need_message(near)) mprf("%s %s as %s drops %s!", pitem->name(DESC_CAP_THE).c_str(), @@ -1170,38 +1166,30 @@ bool monsters::drop_item(int eslot, int near) item_was_destroyed(*pitem, mindex()); destroy_item(item_index); } - else if (!move_item_to_grid(&item_index, pos())) - { - // Re-equip item if we somehow failed to drop it. - if (was_unequipped) - equip(*pitem, eslot, near); - - return (false); - } - - // move_item_to_grid could change item_index, so - // update pitem. - pitem = &mitm[item_index]; - - if (on_floor) + else { - if (friendly()) - pitem->flags |= ISFLAG_DROPPED_BY_ALLY; - if (need_message(near)) { mprf("%s drops %s.", name(DESC_CAP_THE).c_str(), pitem->name(DESC_NOCAP_A).c_str()); } - dungeon_feature_type feat = grd(pos()); - if (feat_destroys_items(feat)) + if (!move_item_to_grid(&item_index, pos())) { - if ( player_can_hear(pos()) ) - mprf(MSGCH_SOUND, feat_item_destruction_message(feat)); + // Re-equip item if we somehow failed to drop it. + if (was_unequipped) + equip(*pitem, eslot, near); - item_was_destroyed(*pitem, mindex()); - unlink_item(item_index); + return (false); + } + + if (friendly() && item_index != NON_ITEM) + { + // move_item_to_grid could change item_index, so + // update pitem. + pitem = &mitm[item_index]; + + pitem->flags |= ISFLAG_DROPPED_BY_ALLY; } } diff --git a/crawl-ref/source/wiz-item.cc b/crawl-ref/source/wiz-item.cc index 6fa4b411b0..1bdce290dd 100644 --- a/crawl-ref/source/wiz-item.cc +++ b/crawl-ref/source/wiz-item.cc @@ -50,6 +50,9 @@ static void _make_all_books() move_item_to_grid(&thing, you.pos()); + if (thing == NON_ITEM) + continue; + item_def book(mitm[thing]); mark_had_book(book); diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc index 4f01f1145a..4fdb333dd4 100644 --- a/crawl-ref/source/xom.cc +++ b/crawl-ref/source/xom.cc @@ -682,9 +682,9 @@ static void _xom_make_item(object_class_type base, int subtype, int power) mitm[thing_created].name(DESC_PLAIN).c_str()); take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, gift_buf), true); - move_item_to_grid(&thing_created, you.pos()); mitm[thing_created].inscription = "god gift"; canned_msg(MSG_SOMETHING_APPEARS); + move_item_to_grid(&thing_created, you.pos()); stop_running(); } -- cgit v1.2.3-54-g00ecf From 74c535b701b7642b74b45934e78cadd7ab67a0e4 Mon Sep 17 00:00:00 2001 From: Stefan O'Rear Date: Wed, 30 Dec 2009 03:27:21 -0800 Subject: Ignore obscured items in the UI I probably missed a few spots. --- crawl-ref/source/directn.cc | 14 +++++++------- crawl-ref/source/food.cc | 12 ++++++------ crawl-ref/source/items.cc | 4 ++-- crawl-ref/source/l_item.cc | 2 +- crawl-ref/source/mon-act.cc | 9 +++++++++ crawl-ref/source/ouch.cc | 4 ++++ crawl-ref/source/player.cc | 11 +++++++++++ crawl-ref/source/player.h | 1 + crawl-ref/source/religion.cc | 7 ++++--- crawl-ref/source/show.cc | 12 ++++-------- crawl-ref/source/showsymb.cc | 2 +- crawl-ref/source/spells4.cc | 4 ++-- crawl-ref/source/stash.cc | 8 ++++---- crawl-ref/source/stuff.cc | 4 ++-- crawl-ref/source/stuff.h | 2 +- crawl-ref/source/tilepick.cc | 4 ++-- crawl-ref/source/tilereg.cc | 2 +- crawl-ref/source/tilesdl.cc | 4 ++-- crawl-ref/source/travel.cc | 4 ++-- crawl-ref/source/tutorial.cc | 4 ++-- 20 files changed, 68 insertions(+), 46 deletions(-) (limited to 'crawl-ref/source/mon-act.cc') diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc index 047dcd3974..58aac3b22a 100644 --- a/crawl-ref/source/directn.cc +++ b/crawl-ref/source/directn.cc @@ -523,7 +523,7 @@ void full_describe_view() if (unknown_mimic) // It'll be on top. list_items.push_back(get_mimic_item(mon)); - const int oid = igrd(*ri); + const int oid = you.visible_igrd(*ri); if (oid == NON_ITEM) continue; @@ -1764,10 +1764,10 @@ std::string get_terse_square_desc(const coord_def &gc) else desc = mons.full_name(DESC_PLAIN, true); } - else if (igrd(gc) != NON_ITEM) + else if (you.visible_igrd(gc) != NON_ITEM) { - if (mitm[igrd(gc)].is_valid()) - desc = mitm[igrd(gc)].name(DESC_PLAIN); + if (mitm[you.visible_igrd(gc)].is_valid()) + desc = mitm[you.visible_igrd(gc)].name(DESC_PLAIN); } else desc = feature_description(gc, false, DESC_PLAIN, false); @@ -1793,7 +1793,7 @@ void get_square_desc(const coord_def &c, describe_info &inf, return; const monsters* mons = monster_at(c); - const int oid = igrd(c); + const int oid = you.visible_igrd(c); if (mons && mons->visible_to(&you)) { @@ -1836,7 +1836,7 @@ void full_describe_square(const coord_def &c) return; const monsters* mons = monster_at(c); - const int oid = igrd(c); + const int oid = you.visible_igrd(c); if (mons && mons->visible_to(&you)) { @@ -3425,7 +3425,7 @@ static void _describe_cell(const coord_def& where, bool in_range) cloud_described = true; } - int targ_item = igrd(where); + int targ_item = you.visible_igrd(where); if (targ_item != NON_ITEM) { diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc index bd2db8d728..d17a4a5371 100644 --- a/crawl-ref/source/food.cc +++ b/crawl-ref/source/food.cc @@ -452,7 +452,7 @@ static bool _have_corpses_in_pack(bool remind) bool butchery(int which_corpse) { - if (igrd(you.pos()) == NON_ITEM) + if (you.visible_igrd(you.pos()) == NON_ITEM) { if (!_have_corpses_in_pack(false)) mpr("There isn't anything here!"); @@ -503,7 +503,7 @@ bool butchery(int which_corpse) int num_corpses = 0; int corpse_id = -1; bool prechosen = (which_corpse != -1); - for (stack_iterator si(you.pos()); si; ++si) + for (stack_iterator si(you.pos(), true); si; ++si) { if (si->base_type == OBJ_CORPSES && si->sub_type == CORPSE_BODY) { @@ -577,7 +577,7 @@ bool butchery(int which_corpse) bool did_weap_swap = false; bool first_corpse = true; int keyin; - for (stack_iterator si(you.pos()); si; ++si) + for (stack_iterator si(you.pos(), true); si; ++si) { if (si->base_type != OBJ_CORPSES || si->sub_type != CORPSE_BODY) continue; @@ -790,7 +790,7 @@ bool eat_food(int slot) if (result != -2) // else skip ahead to inventory { - if (igrd(you.pos()) != NON_ITEM) + if (you.visible_igrd(you.pos()) != NON_ITEM) { result = eat_from_floor(true); if (result == 1) @@ -1186,7 +1186,7 @@ int eat_from_floor(bool skip_chunks) bool found_valid = false; std::vector food_items; - for (stack_iterator si(you.pos()); si; ++si ) + for (stack_iterator si(you.pos(), true); si; ++si ) { if (you.species == SP_VAMPIRE) { @@ -1483,7 +1483,7 @@ int prompt_eat_chunks() // First search the stash on the floor, unless levitating. if (you.flight_mode() != FL_LEVITATE) { - for (stack_iterator si(you.pos()); si; ++si) + for (stack_iterator si(you.pos(), true); si; ++si) { if (you.species == SP_VAMPIRE) { diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index 1aaeda2dec..fe96b86d1b 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -1171,7 +1171,7 @@ void pickup() return; } - int o = igrd(you.pos()); + int o = you.visible_igrd(you.pos()); const int num_nonsquelched = _count_nonsquelched_items(o); if (o == NON_ITEM) @@ -2578,7 +2578,7 @@ static void _do_autopickup() return; } - int o = igrd(you.pos()); + int o = you.visible_igrd(you.pos()); std::string pickup_warning; while (o != NON_ITEM) diff --git a/crawl-ref/source/l_item.cc b/crawl-ref/source/l_item.cc index e8dc23a2b1..ecd343be2a 100644 --- a/crawl-ref/source/l_item.cc +++ b/crawl-ref/source/l_item.cc @@ -48,7 +48,7 @@ void lua_set_exclusive_item(const item_def *item) void lua_push_floor_items(lua_State *ls) { - lua_push_items(ls, igrd(you.pos())); + lua_push_items(ls, you.visible_igrd(you.pos())); } void lua_push_inv_items(lua_State *ls = NULL) diff --git a/crawl-ref/source/mon-act.cc b/crawl-ref/source/mon-act.cc index 18ad9a1b01..6aca56ffa8 100644 --- a/crawl-ref/source/mon-act.cc +++ b/crawl-ref/source/mon-act.cc @@ -2183,6 +2183,7 @@ static bool _monster_eat_item(monsters *monster, bool nearby) bool death_ooze_ate_good = false; bool death_ooze_ate_corpse = false; + // Jellies can swim, so don't check water for (stack_iterator si(monster->pos()); si && eaten < max_eat && hps_changed < 50; ++si) { @@ -2466,6 +2467,14 @@ static bool _handle_pickup(monsters *monster) if (monster->asleep() || monster->submerged()) return (false); + // Hack - Harpies fly over water, but we don't have a general + // system for monster igrd yet. Flying intelligent monsters + // (kenku!) would also count here. + dungeon_feature_type feat = grd(monster->pos()); + + if ((feat == DNGN_LAVA || feat == DNGN_DEEP_WATER) && !monster->flight_mode()) + return (false); + const bool nearby = mons_near(monster); int count_pickup = 0; diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc index 34f8bc736c..2813101bbe 100644 --- a/crawl-ref/source/ouch.cc +++ b/crawl-ref/source/ouch.cc @@ -551,6 +551,10 @@ bool expose_items_to_element(beam_type flavour, const coord_def& where, if (target_class == OBJ_UNASSIGNED) return (false); + // Beams fly *over* water and lava. + if (grd(where) == DNGN_LAVA || grd(where) == DNGN_DEEP_WATER) + return (false); + for (stack_iterator si(where); si; ++si) { if (!si->is_valid()) diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index e490908d1b..564bf18de1 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -5549,6 +5549,17 @@ bool player::can_swim() const return (species == SP_MERFOLK && merfolk_change_is_safe(true)); } +int player::visible_igrd(const coord_def &where) const +{ + if (grd(where) == DNGN_LAVA + || (grd(where) == DNGN_DEEP_WATER && species != SP_MERFOLK)) + { + return (NON_ITEM); + } + + return igrd(where); +} + bool player::swimming() const { return in_water() && can_swim(); diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h index 1e5c58d47a..9c64409023 100644 --- a/crawl-ref/source/player.h +++ b/crawl-ref/source/player.h @@ -323,6 +323,7 @@ public: bool in_water() const; bool can_swim() const; + int visible_igrd(const coord_def&) const; bool is_levitating() const; bool cannot_speak() const; bool invisible() const; diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 3845be27d2..80b277bc67 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -2266,7 +2266,7 @@ static bool _confirm_pray_sacrifice(god_type god) return (false); } - for (stack_iterator si(you.pos()); si; ++si) + for (stack_iterator si(you.pos(), true); si; ++si) { if (_god_likes_item(god, *si) && (_is_risky_sacrifice(*si) @@ -3811,7 +3811,7 @@ bool ely_destroy_weapons() god_acting gdact; bool success = false; - for (stack_iterator si(you.pos()); si; ++si) + for (stack_iterator si(you.pos(), true); si; ++si) { item_def& item(*si); if (item.base_type != OBJ_WEAPONS @@ -4692,7 +4692,8 @@ void offer_items() int i = igrd(you.pos()); - if (!god_likes_items(you.religion) && i != NON_ITEM) + if (!god_likes_items(you.religion) && i != NON_ITEM + && you.visible_igrd(you.pos()) != NON_ITEM) { simple_god_message(" doesn't care about such mundane gifts.", you.religion); diff --git a/crawl-ref/source/show.cc b/crawl-ref/source/show.cc index 103d00b09d..0148d92438 100644 --- a/crawl-ref/source/show.cc +++ b/crawl-ref/source/show.cc @@ -224,8 +224,8 @@ void show_def::_update_item_at(const coord_def &gp, const coord_def &ep) const monsters* m = monster_at(gp); if (m && mons_is_unknown_mimic(m)) eitem = &get_mimic_item(m); - else if (igrd(gp) != NON_ITEM) - eitem = &mitm[igrd(gp)]; + else if (you.visible_igrd(gp) != NON_ITEM) + eitem = &mitm[you.visible_igrd(gp)]; else return; @@ -235,10 +235,6 @@ void show_def::_update_item_at(const coord_def &gp, const coord_def &ep) const dungeon_feature_type feat = grd(gp); - if ((feat == DNGN_DEEP_WATER && you.species != SP_MERFOLK) - || feat == DNGN_LAVA) - return; - if (Options.feature_item_brand && is_critical_feature(feat)) ecol |= COLFLAG_FEATURE_ITEM; else if (Options.trap_item_brand && feat_is_trap(feat)) @@ -251,7 +247,7 @@ void show_def::_update_item_at(const coord_def &gp, const coord_def &ep) ecol = _feat_colour(gp, feat); // monster(mimic)-owned items have link = NON_ITEM+1+midx - if (eitem->link > NON_ITEM && igrd(gp) != NON_ITEM) + if (eitem->link > NON_ITEM && you.visible_igrd(gp) != NON_ITEM) ecol |= COLFLAG_ITEM_HEAP; else if (eitem->link < NON_ITEM && !crawl_state.arena) ecol |= COLFLAG_ITEM_HEAP; @@ -260,7 +256,7 @@ void show_def::_update_item_at(const coord_def &gp, const coord_def &ep) } #ifdef USE_TILE - int idx = igrd(gp); + int idx = you.visible_igrd(gp); if (idx != NON_ITEM) { if (feat_is_stair(feat)) diff --git a/crawl-ref/source/showsymb.cc b/crawl-ref/source/showsymb.cc index 6f3c77fea6..6019065d7e 100644 --- a/crawl-ref/source/showsymb.cc +++ b/crawl-ref/source/showsymb.cc @@ -100,7 +100,7 @@ static int _get_mons_colour(const monsters *mons) col |= COLFLAG_FEATURE_ITEM; } else if (Options.heap_brand != CHATTR_NORMAL - && igrd(mons->pos()) != NON_ITEM + && you.visible_igrd(mons->pos()) != NON_ITEM && !crawl_state.arena) { col |= COLFLAG_ITEM_HEAP; diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc index 03dbf76e72..d4c78afc48 100644 --- a/crawl-ref/source/spells4.cc +++ b/crawl-ref/source/spells4.cc @@ -1182,7 +1182,7 @@ void cast_fulsome_distillation(int /*pow*/) int corpse = -1; // Search items at the player's location for corpses. - for (stack_iterator si(you.pos()); si; ++si) + for (stack_iterator si(you.pos(), true); si; ++si) { if (si->base_type == OBJ_CORPSES && si->sub_type == CORPSE_BODY) { @@ -1476,7 +1476,7 @@ bool cast_fragmentation(int pow, const dist& spd) goto all_done; } - for (stack_iterator si(spd.target); si; ++si) + for (stack_iterator si(spd.target, true); si; ++si) { if (si->base_type == OBJ_CORPSES) { diff --git a/crawl-ref/source/stash.cc b/crawl-ref/source/stash.cc index 147dbc67d8..f40dc4005e 100644 --- a/crawl-ref/source/stash.cc +++ b/crawl-ref/source/stash.cc @@ -326,7 +326,7 @@ static bool _grid_has_mimic_item(const coord_def& pos) static bool _grid_has_perceived_item(const coord_def& pos) { - return (igrd(pos) != NON_ITEM || _grid_has_mimic_item(pos)); + return (you.visible_igrd(pos) != NON_ITEM || _grid_has_mimic_item(pos)); } static bool _grid_has_perceived_multiple_items(const coord_def& pos) @@ -336,7 +336,7 @@ static bool _grid_has_perceived_multiple_items(const coord_def& pos) if (_grid_has_mimic_item(pos)) ++count; - for (stack_iterator si(pos); si && count < 2; ++si) + for (stack_iterator si(pos, true); si && count < 2; ++si) ++count; return (count > 1); @@ -361,7 +361,7 @@ void Stash::update() items.clear(); // Now, grab all items on that square and fill our vector - for (stack_iterator si(p); si; ++si) + for (stack_iterator si(p, true); si; ++si) if (!is_filtered(*si)) add_item(*si); @@ -384,7 +384,7 @@ void Stash::update() pitem = &get_mimic_item(monster_at(p)); else { - pitem = &mitm[igrd(p)]; + pitem = &mitm[you.visible_igrd(p)]; tutorial_first_item(*pitem); } diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc index ccff7125aa..9094d9b214 100644 --- a/crawl-ref/source/stuff.cc +++ b/crawl-ref/source/stuff.cc @@ -65,9 +65,9 @@ #include "tutorial.h" #include "view.h" -stack_iterator::stack_iterator(const coord_def& pos) +stack_iterator::stack_iterator(const coord_def& pos, bool accesible) { - cur_link = igrd(pos); + cur_link = accesible ? you.visible_igrd(pos) : igrd(pos); if ( cur_link != NON_ITEM ) next_link = mitm[cur_link].link; else diff --git a/crawl-ref/source/stuff.h b/crawl-ref/source/stuff.h index 684df4175d..8d0e288db6 100644 --- a/crawl-ref/source/stuff.h +++ b/crawl-ref/source/stuff.h @@ -24,7 +24,7 @@ class stack_iterator : public std::iterator { public: - explicit stack_iterator( const coord_def& pos ); + explicit stack_iterator( const coord_def& pos, bool accessible = false ); explicit stack_iterator( int start_link ); operator bool() const; diff --git a/crawl-ref/source/tilepick.cc b/crawl-ref/source/tilepick.cc index 723dbc0d00..8881bc867b 100644 --- a/crawl-ref/source/tilepick.cc +++ b/crawl-ref/source/tilepick.cc @@ -4795,7 +4795,7 @@ void tile_place_monster(int gx, int gy, int idx, bool foreground, bool detected) if (!mons_is_known_mimic(mon)) { // If necessary add item brand. - if (igrd(gc) != NON_ITEM) + if (you.visible_igrd(gc) != NON_ITEM) { if (foreground) t |= TILE_FLAG_S_UNDER; @@ -4815,7 +4815,7 @@ void tile_place_monster(int gx, int gy, int idx, bool foreground, bool detected) else if (menv[idx].holiness() == MH_PLANT) { // If necessary add item brand. - if (igrd(gc) != NON_ITEM) + if (you.visible_igrd(gc) != NON_ITEM) { if (foreground) t |= TILE_FLAG_S_UNDER; diff --git a/crawl-ref/source/tilereg.cc b/crawl-ref/source/tilereg.cc index 4490e3a59a..65383f46b4 100644 --- a/crawl-ref/source/tilereg.cc +++ b/crawl-ref/source/tilereg.cc @@ -1745,7 +1745,7 @@ bool DungeonRegion::update_tip_text(std::string& tip) tip += get_class_abbrev(you.char_class); tip += ")"; - if (igrd(m_cursor[CURSOR_MOUSE]) != NON_ITEM) + if (you.visible_igrd(m_cursor[CURSOR_MOUSE]) != NON_ITEM) tip += "\n[L-Click] Pick up items (g)"; const dungeon_feature_type feat = grd(m_cursor[CURSOR_MOUSE]); diff --git a/crawl-ref/source/tilesdl.cc b/crawl-ref/source/tilesdl.cc index 50dbb83f58..62ac431970 100644 --- a/crawl-ref/source/tilesdl.cc +++ b/crawl-ref/source/tilesdl.cc @@ -1550,7 +1550,7 @@ void TilesFramework::update_inventory() memset(inv_shown, 0, sizeof(inv_shown)); int num_ground = 0; - for (int i = igrd(you.pos()); i != NON_ITEM; i = mitm[i].link) + for (int i = you.visible_igrd(you.pos()); i != NON_ITEM; i = mitm[i].link) num_ground++; // If the inventory is full, show at least one row of the ground. @@ -1676,7 +1676,7 @@ void TilesFramework::update_inventory() type = (object_class_type)(find - obj_syms); } - for (int i = igrd(you.pos()); i != NON_ITEM; i = mitm[i].link) + for (int i = you.visible_igrd(you.pos()); i != NON_ITEM; i = mitm[i].link) { if ((int)inv.size() >= mx * my) break; diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc index 28b593d97a..296e39318a 100644 --- a/crawl-ref/source/travel.cc +++ b/crawl-ref/source/travel.cc @@ -550,8 +550,8 @@ inline static void _check_interesting_square(int x, int y, ed.found_item(pos, get_mimic_item(mons)); } - if (igrd(pos) != NON_ITEM) - ed.found_item( pos, mitm[ igrd(pos) ] ); + if (you.visible_igrd(pos) != NON_ITEM) + ed.found_item( pos, mitm[ you.visible_igrd(pos) ] ); } ed.found_feature( pos, grd(pos) ); diff --git a/crawl-ref/source/tutorial.cc b/crawl-ref/source/tutorial.cc index 69aeb760a2..e0e7d53b72 100644 --- a/crawl-ref/source/tutorial.cc +++ b/crawl-ref/source/tutorial.cc @@ -1887,7 +1887,7 @@ void learned_something_new(tutorial_event_type seen_what, coord_def gc) text << "Ah, a corpse!"; else { - int i = igrd(gc); + int i = you.visible_igrd(gc); while (i != NON_ITEM) { if (mitm[i].base_type == OBJ_CORPSES) @@ -4680,7 +4680,7 @@ void tutorial_observe_cell(const coord_def& gc) else if (grd(gc) == DNGN_ENTER_PORTAL_VAULT) learned_something_new(TUT_SEEN_PORTAL, gc); - const int it = igrd(gc); + const int it = you.visible_igrd(gc); if (it != NON_ITEM) { const item_def& item(mitm[it]); -- cgit v1.2.3-54-g00ecf From dc6da664d1b8aebf9c7baf96dc26513863affadb Mon Sep 17 00:00:00 2001 From: Stefan O'Rear Date: Wed, 30 Dec 2009 04:10:14 -0800 Subject: Implement fish corpses and kraken zombies. --- crawl-ref/source/mon-act.cc | 2 +- crawl-ref/source/mon-cast.cc | 10 ++++++++-- crawl-ref/source/mon-data.h | 24 ++++++++++++------------ crawl-ref/source/mon-place.cc | 4 +++- crawl-ref/source/mon-stuff.cc | 4 ++-- crawl-ref/source/mon-util.cc | 5 +++++ crawl-ref/source/mon-util.h | 1 + crawl-ref/source/monster.cc | 4 ++-- 8 files changed, 34 insertions(+), 20 deletions(-) (limited to 'crawl-ref/source/mon-act.cc') diff --git a/crawl-ref/source/mon-act.cc b/crawl-ref/source/mon-act.cc index 6aca56ffa8..067d59d3a6 100644 --- a/crawl-ref/source/mon-act.cc +++ b/crawl-ref/source/mon-act.cc @@ -2793,7 +2793,7 @@ static bool _mon_can_move_to_pos(const monsters *monster, // The kraken is so large it cannot enter shallow water. // Its tentacles can, and will, though. - if (monster->type == MONS_KRAKEN && target_grid == DNGN_SHALLOW_WATER) + if (mons_base_type(monster) == MONS_KRAKEN && target_grid == DNGN_SHALLOW_WATER) return (false); // Effectively slows down monster movement across water. diff --git a/crawl-ref/source/mon-cast.cc b/crawl-ref/source/mon-cast.cc index fb9b5092d4..e1bca14d78 100644 --- a/crawl-ref/source/mon-cast.cc +++ b/crawl-ref/source/mon-cast.cc @@ -1818,15 +1818,21 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast, // Tentacles aren't really summoned (controlled by spell_cast // being passed to summon_type), so I'm not sure what the // abjuration value (3) is doing there. (jpeg) - if (create_monster( + int tentacle = create_monster( mgen_data(MONS_KRAKEN_TENTACLE, SAME_ATTITUDE(monster), monster, 3, spell_cast, monster->pos(), monster->foe, 0, god, MONS_NO_MONSTER, kraken_index, monster->colour, you.your_level, PROX_CLOSE_TO_PLAYER, - you.level_type)) == -1) + you.level_type)); + + if (tentacle < 0) { sumcount2--; } + else if (monster->holiness() == MH_UNDEAD) + { + menv[tentacle].flags |= MF_HONORARY_UNDEAD; + } } if (sumcount2 == 1) mpr("A tentacle rises from the water!"); diff --git a/crawl-ref/source/mon-data.h b/crawl-ref/source/mon-data.h index afecaf42fa..ac0bb050f1 100644 --- a/crawl-ref/source/mon-data.h +++ b/crawl-ref/source/mon-data.h @@ -3276,10 +3276,10 @@ static monsterentry mondata[] = { MONS_BIG_FISH, ';', LIGHTGREEN, "big fish", M_COLD_BLOOD, MR_NO_FLAGS, - 0, 10, MONS_BIG_FISH, MONS_BIG_FISH, MH_NATURAL, -3, + 300, 10, MONS_BIG_FISH, MONS_BIG_FISH, MH_NATURAL, -3, { {AT_BITE, AF_PLAIN, 8}, AT_NO_ATK, AT_NO_ATK, AT_NO_ATK }, { 4, 3, 5, 0 }, - 1, 12, MST_NO_SPELLS, CE_NOCORPSE, Z_SMALL, S_SILENT, + 1, 12, MST_NO_SPELLS, CE_CLEAN, Z_SMALL, S_SILENT, I_ANIMAL, HT_WATER, FL_NONE, 10, DEFAULT_ENERGY, MONUSE_NOTHING, MONEAT_NOTHING, SIZE_SMALL }, @@ -3288,10 +3288,10 @@ static monsterentry mondata[] = { MONS_GIANT_GOLDFISH, ';', LIGHTRED, "giant goldfish", M_COLD_BLOOD, MR_NO_FLAGS, - 0, 10, MONS_BIG_FISH, MONS_GIANT_GOLDFISH, MH_NATURAL, -3, + 500, 10, MONS_BIG_FISH, MONS_GIANT_GOLDFISH, MH_NATURAL, -3, { {AT_BITE, AF_PLAIN, 15}, AT_NO_ATK, AT_NO_ATK, AT_NO_ATK }, { 7, 3, 5, 0 }, - 5, 7, MST_NO_SPELLS, CE_NOCORPSE, Z_SMALL, S_SILENT, + 5, 7, MST_NO_SPELLS, CE_CLEAN, Z_SMALL, S_SILENT, I_ANIMAL, HT_WATER, FL_NONE, 10, DEFAULT_ENERGY, MONUSE_NOTHING, MONEAT_NOTHING, SIZE_LITTLE }, @@ -3300,10 +3300,10 @@ static monsterentry mondata[] = { MONS_ELECTRIC_EEL, ';', LIGHTBLUE, "electric eel", M_COLD_BLOOD | M_SPECIAL_ABILITY, MR_RES_ELEC, - 0, 10, MONS_ELECTRIC_EEL, MONS_ELECTRIC_EEL, MH_NATURAL, -3, + 700, 10, MONS_ELECTRIC_EEL, MONS_ELECTRIC_EEL, MH_NATURAL, -3, { AT_NO_ATK, AT_NO_ATK, AT_NO_ATK, AT_NO_ATK }, { 3, 3, 5, 0 }, - 1, 15, MST_NO_SPELLS, CE_NOCORPSE, Z_SMALL, S_SILENT, + 1, 15, MST_NO_SPELLS, CE_CLEAN, Z_SMALL, S_SILENT, I_ANIMAL, HT_WATER, FL_NONE, 10, DEFAULT_ENERGY, MONUSE_NOTHING, MONEAT_NOTHING, SIZE_SMALL }, @@ -3312,11 +3312,11 @@ static monsterentry mondata[] = { MONS_JELLYFISH, 'J', CYAN, "jellyfish", M_NO_FLAGS, MR_RES_POISON, - 0, 10, MONS_JELLYFISH, MONS_JELLYFISH, MH_NATURAL, -3, + 1000, 10, MONS_JELLYFISH, MONS_JELLYFISH, MH_NATURAL, -3, { {AT_STING, AF_POISON_STR, 1}, {AT_HIT, AF_PLAIN, 1}, AT_NO_ATK, AT_NO_ATK }, { 4, 3, 5, 0 }, - 0, 5, MST_NO_SPELLS, CE_NOCORPSE, Z_SMALL, S_SILENT, + 0, 5, MST_NO_SPELLS, CE_POISONOUS, Z_SMALL, S_SILENT, I_PLANT, HT_WATER, FL_NONE, 10, DEFAULT_ENERGY, MONUSE_NOTHING, MONEAT_NOTHING, SIZE_LITTLE }, @@ -3326,10 +3326,10 @@ static monsterentry mondata[] = { MONS_SHARK, ';', WHITE, "shark", M_COLD_BLOOD | M_BLOOD_SCENT, MR_NO_FLAGS, - 0, 12, MONS_SHARK, MONS_SHARK, MH_NATURAL, -3, + 2000, 12, MONS_SHARK, MONS_SHARK, MH_NATURAL, -3, { {AT_BITE, AF_PLAIN, 15}, {AT_BITE, AF_PLAIN, 8}, AT_NO_ATK, AT_NO_ATK }, { 7, 3, 5, 0 }, - 9, 5, MST_NO_SPELLS, CE_NOCORPSE, Z_BIG, S_SILENT, + 9, 5, MST_NO_SPELLS, CE_CONTAMINATED, Z_BIG, S_SILENT, I_ANIMAL, HT_WATER, FL_NONE, 10, DEFAULT_ENERGY, MONUSE_NOTHING, MONEAT_NOTHING, SIZE_LARGE }, @@ -3339,10 +3339,10 @@ static monsterentry mondata[] = { MONS_KRAKEN, 'X', BLACK, "kraken", M_COLD_BLOOD | M_SPELLCASTER, MR_NO_FLAGS, - 1500, 20, MONS_KRAKEN, MONS_KRAKEN, MH_NATURAL, -3, + 3500, 20, MONS_KRAKEN, MONS_KRAKEN, MH_NATURAL, -3, { {AT_BITE, AF_PLAIN, 50}, AT_NO_ATK, AT_NO_ATK, AT_NO_ATK }, { 20, 10, 10, 0 }, - 20, 0, MST_KRAKEN, CE_NOCORPSE, Z_NOZOMBIE, S_SILENT, + 20, 0, MST_KRAKEN, CE_POISONOUS, Z_BIG, S_SILENT, I_ANIMAL, HT_WATER, FL_NONE, 10, DEFAULT_ENERGY, MONUSE_NOTHING, MONEAT_NOTHING, SIZE_HUGE }, diff --git a/crawl-ref/source/mon-place.cc b/crawl-ref/source/mon-place.cc index dc5c47ba00..10dd3c615c 100644 --- a/crawl-ref/source/mon-place.cc +++ b/crawl-ref/source/mon-place.cc @@ -1681,7 +1681,9 @@ static void _define_zombie(int mid, monster_type ztype, monster_type cs, define_monster(mid); // Turn off all spellcasting flags. - menv[mid].flags &= ~MF_SPELLCASTER & ~MF_ACTUAL_SPELLS & ~MF_PRIEST; + // Hack - kraken get to keep their spell-like ability. + if (menv[mid].base_monster != MONS_KRAKEN) + menv[mid].flags &= ~MF_SPELLCASTER & ~MF_ACTUAL_SPELLS & ~MF_PRIEST; menv[mid].hit_points = hit_points(menv[mid].hit_dice, 6, 5); menv[mid].max_hit_points = menv[mid].hit_points; diff --git a/crawl-ref/source/mon-stuff.cc b/crawl-ref/source/mon-stuff.cc index cb14b67710..95a418b0a7 100644 --- a/crawl-ref/source/mon-stuff.cc +++ b/crawl-ref/source/mon-stuff.cc @@ -1306,7 +1306,7 @@ static int _tentacle_too_far(monsters *head, monsters *tentacle) void mons_relocated(monsters *monster) { - if (monster->type == MONS_KRAKEN) + if (mons_base_type(monster) == MONS_KRAKEN) { int headnum = monster->mindex(); @@ -2098,7 +2098,7 @@ int monster_die(monsters *monster, killer_type killer, // he goes away. pikel_band_neutralise(); } - else if (monster->type == MONS_KRAKEN) + else if (mons_base_type(monster) == MONS_KRAKEN) { if (_destroy_tentacles(monster) && !in_transit) { diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index 5895a0c542..fa2ce2be15 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -922,6 +922,11 @@ bool mons_is_zombified(const monsters *mon) return (mons_class_is_zombified(mon->type)); } +monster_type mons_base_type(const monsters *mon) +{ + return mons_is_zombified(mon) ? mon->base_monster : mon->type; +} + bool mons_class_can_be_zombified(int mc) { int ms = mons_species(mc); diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h index b9c5424aee..95a0ca5d55 100644 --- a/crawl-ref/source/mon-util.h +++ b/crawl-ref/source/mon-util.h @@ -557,6 +557,7 @@ bool mons_can_regenerate(const monsters *mon); int mons_zombie_size(int mc); monster_type mons_zombie_base(const monsters *mon); bool mons_class_is_zombified(int mc); +monster_type mons_base_type(const monsters *mon); bool mons_is_zombified(const monsters *monster); bool mons_class_can_be_zombified(int mc); bool mons_can_be_zombified(const monsters *mon); diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc index 8d0f02f428..1e88b10f33 100644 --- a/crawl-ref/source/monster.cc +++ b/crawl-ref/source/monster.cc @@ -188,7 +188,7 @@ static bool _player_near_water() bool monsters::wants_submerge() const { // Krakens never retreat when food (the player) is in range. - if (type == MONS_KRAKEN) + if (mons_base_type(this) == MONS_KRAKEN) if (_player_near_water()) return (false); @@ -5994,7 +5994,7 @@ void monsters::react_to_damage(int damage, beam_type flavour, kill_category whos else if (type == MONS_KRAKEN_TENTACLE && flavour != BEAM_TORMENT_DAMAGE) { if (!invalid_monster_index(number) - && menv[number].type == MONS_KRAKEN) + && mons_base_type(&menv[number]) == MONS_KRAKEN) { menv[number].hurt(&you, damage, flavour); -- cgit v1.2.3-54-g00ecf