diff options
author | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-10-07 03:09:27 +0000 |
---|---|---|
committer | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-10-07 03:09:27 +0000 |
commit | b6484c07a27d0856140792f33397930f9e6e7689 (patch) | |
tree | db416d9f1ec48a1df9e9db47ab5fec8dbf2b8cf1 /crawl-ref/source/mon-util.cc | |
parent | 2a69f07bc9c2422df79641a79a80568fea28f2b9 (diff) | |
download | crawl-ref-b6484c07a27d0856140792f33397930f9e6e7689.tar.gz crawl-ref-b6484c07a27d0856140792f33397930f9e6e7689.zip |
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
Diffstat (limited to 'crawl-ref/source/mon-util.cc')
-rw-r--r-- | crawl-ref/source/mon-util.cc | 27 |
1 files changed, 18 insertions, 9 deletions
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) |