diff options
author | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-04-21 17:02:35 +0000 |
---|---|---|
committer | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-04-21 17:02:35 +0000 |
commit | 01e87f9679a3c5bf2ce3e45c59d7c7df97644940 (patch) | |
tree | cb8652227fe34d8d164b999ab704616973193ae6 /crawl-ref/source | |
parent | ca2fa8e5208ae5882a352193dcbdca194c59e3b7 (diff) | |
download | crawl-ref-01e87f9679a3c5bf2ce3e45c59d7c7df97644940.tar.gz crawl-ref-01e87f9679a3c5bf2ce3e45c59d7c7df97644940.zip |
Add mesilliac's patch in [1944555] for improved handling of
followers/summoned creatures, with one minor tweak to take good neutral
monsters into account.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4444 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/acr.cc | 3 | ||||
-rw-r--r-- | crawl-ref/source/effects.cc | 11 | ||||
-rw-r--r-- | crawl-ref/source/fight.cc | 10 | ||||
-rw-r--r-- | crawl-ref/source/misc.cc | 6 | ||||
-rw-r--r-- | crawl-ref/source/spells1.cc | 6 | ||||
-rw-r--r-- | crawl-ref/source/spells3.cc | 3 | ||||
-rw-r--r-- | crawl-ref/source/spells4.cc | 3 |
7 files changed, 33 insertions, 9 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index 22100827a0..f2fe7b805b 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -4225,7 +4225,8 @@ static void _move_player(int move_x, int move_y) || you.y_pos <= 15 || you.y_pos >= (GYM - 16))) { area_shift(); - you.pet_target = MHITNOT; + if (you.pet_target != MHITYOU) + you.pet_target = MHITNOT; #if DEBUG_DIAGNOSTICS mpr( "Shifting.", MSGCH_DIAGNOSTICS ); diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc index b8cd4e72b5..1503094343 100644 --- a/crawl-ref/source/effects.cc +++ b/crawl-ref/source/effects.cc @@ -1913,6 +1913,8 @@ void yell(bool force) targ_prev = true; } } + + mpr(" h - Order allies to stop attacking"); } mprf(" Anything else - Stay silent%s", @@ -1967,7 +1969,12 @@ void yell(bool force) mons_targd = you.prev_targ; break; } - /* fall through... */ + + case 'h': + mons_targd = MHITYOU; + break; + + /* fall through... */ default: mpr("Okely-dokely."); return; @@ -1980,7 +1987,7 @@ void yell(bool force) } noisy( 10, you.x_pos, you.y_pos ); - mpr("Attack!"); + mpr(mons_targd == MHITYOU ? "Heel!" : "Attack!"); } // end yell() bool forget_inventory(bool quiet) diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index ff453ddf27..82543ee2ad 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -3038,11 +3038,21 @@ int melee_attack::player_calc_base_weapon_damage() bool melee_attack::mons_attack_mons() { mons_perform_attack(); + if (perceived_attack && (def->foe == MHITNOT || one_chance_in(3)) && atk->alive() && def->alive()) { behaviour_event(def, ME_WHACK, monster_index(atk)); } + + // if an enemy attacked a friend, set the pet target if it isn't + // set already + if (perceived_attack && atk->alive() && mons_friendly(def) + && !mons_wont_attack(atk) && you.pet_target == MHITNOT) + { + you.pet_target = monster_index(atk); + } + return (did_hit); } diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index 6b5207dedb..cab1c2f877 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -1648,7 +1648,8 @@ void up_stairs(dungeon_feature_type force_stair, } you.prev_targ = MHITNOT; - you.pet_target = MHITNOT; + if (you.pet_target != MHITYOU) + you.pet_target = MHITNOT; you.prev_grd_targ = coord_def(0, 0); @@ -1982,7 +1983,8 @@ void down_stairs( int old_level, dungeon_feature_type force_stair, } you.prev_targ = MHITNOT; - you.pet_target = MHITNOT; + if (you.pet_target != MHITYOU) + you.pet_target = MHITNOT; you.prev_grd_targ = coord_def(0, 0); diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc index 8b1d90d9a4..95de265140 100644 --- a/crawl-ref/source/spells1.cc +++ b/crawl-ref/source/spells1.cc @@ -151,7 +151,8 @@ int blink(int pow, bool high_level_controlled_blink, bool wizard_blink) else if (you.level_type == LEVEL_ABYSS && !wizard_blink) { abyss_teleport( false ); - you.pet_target = MHITNOT; + if (you.pet_target != MHITYOU) + you.pet_target = MHITNOT; } else { @@ -222,7 +223,8 @@ void random_blink(bool allow_partial_control, bool override_abyss) if (you.level_type == LEVEL_ABYSS) { abyss_teleport( false ); - you.pet_target = MHITNOT; + if (you.pet_target != MHITYOU) + you.pet_target = MHITNOT; } } diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc index 1a75a1ccc2..3b6fc8915f 100644 --- a/crawl-ref/source/spells3.cc +++ b/crawl-ref/source/spells3.cc @@ -612,7 +612,8 @@ static bool _teleport_player( bool allow_control, bool new_abyss_area ) if (you.level_type == LEVEL_ABYSS) { abyss_teleport( new_abyss_area ); - you.pet_target = MHITNOT; + if (you.pet_target != MHITYOU) + you.pet_target = MHITNOT; return true; } diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc index 1563b48d54..8f978e68c5 100644 --- a/crawl-ref/source/spells4.cc +++ b/crawl-ref/source/spells4.cc @@ -2795,7 +2795,8 @@ static int quadrant_blink(int x, int y, int pow, int garbage) if (you.level_type == LEVEL_ABYSS) { abyss_teleport( false ); - you.pet_target = MHITNOT; + if (you.pet_target != MHITYOU) + you.pet_target = MHITNOT; return (1); } |