From b6484c07a27d0856140792f33397930f9e6e7689 Mon Sep 17 00:00:00 2001 From: dolorous Date: Tue, 7 Oct 2008 03:09:27 +0000 Subject: Fix flight type handling so that spectral things can at least always levitate again (since their class can), regardless of what actual type they are. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7169 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/mon-util.cc | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'crawl-ref/source/mon-util.cc') diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index 19a23a236f..07f3f24b38 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -1263,12 +1263,12 @@ bool mons_skeleton(int mc) flight_type mons_class_flies(int mc) { - if (mons_class_flag(mc, M_FLIES)) - return (FL_FLY); - if (mons_class_flag(mc, M_LEVITATE)) return (FL_LEVITATE); + if (mons_class_flag(mc, M_FLIES)) + return (FL_FLY); + return (FL_NONE); } @@ -1280,13 +1280,22 @@ flight_type mons_flies(const monsters *mon) return (mon->ghost->fly); } - const int montype = mons_is_zombified(mon) ? mons_zombie_base(mon) - : mon->type; + flight_type ret = FL_NONE; + + if (mons_is_zombified(mon)) + ret = mons_class_flies(mon->base_monster); - const flight_type ret = mons_class_flies(montype); - return (ret ? ret - : (_scan_mon_inv_randarts(mon, RAP_LEVITATE) > 0) ? FL_LEVITATE - : FL_NONE); + // Set flight status this way so that monsters will always have the + // best flight status possible. This is necessary so that monsters + // with FL_NONE status when alive get FL_LEVITATE status as spectral + // things, and monsters with FL_FLY status when alive retain it as + // spectral things. + ret = std::max(mons_class_flies(mon->type), ret); + + if (ret == FL_NONE && _scan_mon_inv_randarts(mon, RAP_LEVITATE) > 0) + ret = FL_LEVITATE; + + return (ret); } bool mons_class_amphibious(int mc) -- cgit v1.2.3-54-g00ecf