From 4189018dba56b0f4b56ccd402174d56f8f9f6979 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Tue, 1 Apr 2008 11:31:25 +0000 Subject: Allow autotargeting of monsters hiding in shallow water ("You see a strange disturbance here"), assuming them to be enemy monsters. Fix Daevas being so incredibly chatty. Friendly holy beings will now give the holy_being speech with a chance of 1/20, and else stay silent. This is rare! Neutrals have the same behaviour but speak with a chance of 1/11 since you won't be around them as often as around friendlies. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4005 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/dat/database/monspeak.txt | 12 ++++++++--- crawl-ref/source/direct.cc | 32 ++++++++++++++++++++---------- crawl-ref/source/item_use.cc | 2 +- crawl-ref/source/mstuff2.cc | 2 +- 4 files changed, 33 insertions(+), 15 deletions(-) (limited to 'crawl-ref/source') diff --git a/crawl-ref/source/dat/database/monspeak.txt b/crawl-ref/source/dat/database/monspeak.txt index 876aa4693e..b67de8e3c9 100644 --- a/crawl-ref/source/dat/database/monspeak.txt +++ b/crawl-ref/source/dat/database/monspeak.txt @@ -1899,16 +1899,22 @@ neutral good god 'cap-A' __NONE -w:2 +w:1 @holy_being@ %%%% friendly good god 'cap-A' -@default friendly humanoid@ +w:19 +__NONE -w:4 +w:1 @holy_being@ +%%%% +# Otherwise, they'll stay silent. +default 'cap-A' + +__NONE %%%% good_god_neutral_holy_being_reaction diff --git a/crawl-ref/source/direct.cc b/crawl-ref/source/direct.cc index 55c807cfc6..3b89368585 100644 --- a/crawl-ref/source/direct.cc +++ b/crawl-ref/source/direct.cc @@ -1127,11 +1127,22 @@ static bool find_monster( int x, int y, int mode, int range = -1) const int targ_mon = mgrd[ x ][ y ]; - // Is target a (known) monster? - if (targ_mon == NON_MONSTER || !in_los(x,y) - || !player_monster_visible( &(menv[targ_mon]) ) - || mons_is_mimic(menv[targ_mon].type) - && !(menv[targ_mon].flags & MF_KNOWN_MIMIC)) + // No monster or outside LOS. + if (targ_mon == NON_MONSTER || !in_los(x,y)) + return (false); + + // Unseen monsters in shallow water show a "strange disturbance" + // (unless flying!) + if (!player_monster_visible(&menv[targ_mon])) + { + // since you can't see the monster, assume it's not a friend + return (mode != TARG_FRIEND && grd[x][y] == DNGN_SHALLOW_WATER + && !mons_flies(&menv[targ_mon])); + } + + // Unknown mimics don't count as monsters, either. + if (mons_is_mimic(menv[targ_mon].type) + && !(menv[targ_mon].flags & MF_KNOWN_MIMIC)) { return (false); } @@ -1143,12 +1154,13 @@ static bool find_monster( int x, int y, int mode, int range = -1) if (mode == TARG_FRIEND) return (mons_friendly(&menv[targ_mon] )); - if (mode != TARG_ENEMY) + ASSERT(mode == TARG_ENEMY); + if (mons_friendly(&menv[targ_mon])) return false; - - return ( !mons_friendly( &menv[targ_mon] ) - && (Options.target_zero_exp - || !mons_class_flag( menv[targ_mon].type, M_NO_EXP_GAIN )) ); + + // Don't target zero xp monsters, unless target_zero_exp is set. + return (Options.target_zero_exp + || !mons_class_flag( menv[targ_mon].type, M_NO_EXP_GAIN )); } static bool find_feature( int x, int y, int mode, int /* range */) diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index ca1cf7a46f..dec8fc2c54 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -1510,7 +1510,7 @@ static bool _fire_choose_item_and_target(int& item, dist& target) } beh.message_ammo_prompt(); - message_current_target(); // XXX: this stuff should be done by direction() + message_current_target(); // XXX: this stuff should be done by direction() direction( target, DIR_NONE, TARG_ENEMY, -1, false, true, NULL, &beh ); if (beh.item == ENDOFPACK) diff --git a/crawl-ref/source/mstuff2.cc b/crawl-ref/source/mstuff2.cc index 1bc7e071ea..5313dd04f8 100644 --- a/crawl-ref/source/mstuff2.cc +++ b/crawl-ref/source/mstuff2.cc @@ -1001,7 +1001,7 @@ void monster_teleport(struct monsters *monster, bool instan, bool silent) /* Mimics change form/colour when t'ported */ if (mons_is_mimic( monster->type )) { - monster->type = MONS_GOLD_MIMIC + random2(5); + monster->type = MONS_GOLD_MIMIC + random2(5); monster->colour = get_mimic_colour( monster ); } -- cgit v1.2.3-54-g00ecf