diff options
Diffstat (limited to 'crawl-ref/source/mon-behv.cc')
-rw-r--r-- | crawl-ref/source/mon-behv.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/crawl-ref/source/mon-behv.cc b/crawl-ref/source/mon-behv.cc index c48e01301a..642b9baed1 100644 --- a/crawl-ref/source/mon-behv.cc +++ b/crawl-ref/source/mon-behv.cc @@ -253,12 +253,19 @@ void handle_behaviour(monsters *mon) actor* afoe = mon->get_foe(); proxFoe = afoe && mon->can_see(afoe); + if (mon->foe == MHITYOU) + { + // monsters::get_foe returns NULL for friendly monsters with + // foe == MHITYOU, so make afoe point to the player here. + // -cao + afoe = &you; + proxFoe = proxPlayer; // Take invis into account. + } + coord_def foepos = coord_def(0,0); if (afoe) foepos = afoe->pos(); - if (mon->foe == MHITYOU) - proxFoe = proxPlayer; // Take invis into account. // Track changes to state; attitude never changes here. beh_type new_beh = mon->behaviour; |