From 547d7729392c008d4baaac82ea81d794a552fcd2 Mon Sep 17 00:00:00 2001 From: dolorous Date: Sat, 15 Mar 2008 15:07:01 +0000 Subject: Clean up handling of zombie-types. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3650 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/mon-util.cc | 20 +++++++++----------- crawl-ref/source/mon-util.h | 1 + crawl-ref/source/monplace.cc | 8 +------- crawl-ref/source/monstuff.cc | 43 +++++++++++++++---------------------------- crawl-ref/source/spells4.cc | 22 +++++++++++----------- 5 files changed, 37 insertions(+), 57 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index f20ff790a3..ef3e325ce2 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -586,7 +586,6 @@ bool mons_see_invis(const monsters *mon) return (false); } // end mons_see_invis() - // This does NOT do line of sight! It checks the targ's visibility // with respect to mon's perception, but doesn't do walls or range. bool mons_monster_visible( const monsters *mon, const monsters *targ ) @@ -643,18 +642,17 @@ int mons_zombie_base(const monsters *monster) return (monster->number); } +bool mons_class_is_zombified(int mc) +{ + return (mc == MONS_ZOMBIE_SMALL || mc == MONS_ZOMBIE_LARGE + || mc == MONS_SKELETON_SMALL || mc == MONS_SKELETON_LARGE + || mc == MONS_SIMULACRUM_SMALL || mc == MONS_SIMULACRUM_LARGE + || mc == MONS_SPECTRAL_THING); +} + bool mons_is_zombified(const monsters *monster) { - switch (monster->type) - { - case MONS_ZOMBIE_SMALL: case MONS_ZOMBIE_LARGE: - case MONS_SKELETON_SMALL: case MONS_SKELETON_LARGE: - case MONS_SIMULACRUM_SMALL: case MONS_SIMULACRUM_LARGE: - case MONS_SPECTRAL_THING: - return (true); - default: - return (false); - } + return mons_class_is_zombified(monster->type); } int downscale_zombie_damage(int damage) diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h index 4e3b7083ea..7afdf12b91 100644 --- a/crawl-ref/source/mon-util.h +++ b/crawl-ref/source/mon-util.h @@ -535,6 +535,7 @@ int mons_speed(int mclass); * *********************************************************************** */ int mons_zombie_size(int mc); int mons_zombie_base(const monsters *monster); +bool mons_class_is_zombified(int mc); bool mons_is_zombified(const monsters *monster); // last updated 12may2000 {dlb} diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc index 8aa8bedff3..2a51fcf882 100644 --- a/crawl-ref/source/monplace.cc +++ b/crawl-ref/source/monplace.cc @@ -769,13 +769,7 @@ static int place_monster_aux( int mon_type, beh_type behaviour, int target, mgrd[fx][fy] = id; // generate a brand shiny new monster, or zombie - if (mon_type == MONS_ZOMBIE_SMALL - || mon_type == MONS_ZOMBIE_LARGE - || mon_type == MONS_SIMULACRUM_SMALL - || mon_type == MONS_SIMULACRUM_LARGE - || mon_type == MONS_SKELETON_SMALL - || mon_type == MONS_SKELETON_LARGE - || mon_type == MONS_SPECTRAL_THING) + if (mons_class_is_zombified(mon_type)) { define_zombie( id, extra, mon_type, power ); } diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index c4bf18a5d5..11306b9c81 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -1182,14 +1182,11 @@ static bool valid_morph( monsters *monster, int new_mclass ) || new_mclass == MONS_GLOWING_SHAPESHIFTER // These require manual setting of mons.number to indicate - // what they are a simulacrum/zombie of, which we currently - // aren't smart enough to handle. - || new_mclass == MONS_SIMULACRUM_LARGE - || new_mclass == MONS_SIMULACRUM_SMALL - || new_mclass == MONS_ZOMBIE_SMALL - || new_mclass == MONS_ZOMBIE_LARGE - - // These shouldn't happen anyways (demons unaffected + holiness check), + // what they are a skeleton/zombie/simulacrum/spectral thing of, + // which we currently aren't smart enough to handle. + || mons_class_is_zombified(new_mclass) + + // These shouldn't happen anyways (demons unaffected + holiness check), // but if we ever do have polydemon, these will be needed: || new_mclass == MONS_PLAYER_GHOST || new_mclass == MONS_PANDEMONIUM_DEMON @@ -4424,18 +4421,14 @@ static void handle_monster_move(int i, monsters *monster) continue; } - if (monster->type == MONS_ZOMBIE_SMALL - || monster->type == MONS_ZOMBIE_LARGE - || monster->type == MONS_SIMULACRUM_SMALL - || monster->type == MONS_SIMULACRUM_LARGE - || monster->type == MONS_SKELETON_SMALL - || monster->type == MONS_SKELETON_LARGE) + if (mons_is_zombified(monster) + && monster->type != MONS_SPECTRAL_THING) { monster->max_hit_points = monster->hit_points; } if (igrd[monster->x][monster->y] != NON_ITEM - && (mons_itemuse(monster->type) == MONUSE_WEAPONS_ARMOUR + && (mons_itemuse(monster->type) == MONUSE_WEAPONS_ARMOUR || mons_itemuse(monster->type) == MONUSE_EATS_ITEMS || monster->type == MONS_NECROPHAGE || monster->type == MONS_GHOUL)) @@ -5647,13 +5640,7 @@ static bool monster_move(monsters *monster) && (mons_intel(monster_index(monster)) == I_HIGH || mons_intel(monster_index(monster)) == I_NORMAL))) { - if (monster->type == MONS_ZOMBIE_SMALL - || monster->type == MONS_ZOMBIE_LARGE - || monster->type == MONS_SIMULACRUM_SMALL - || monster->type == MONS_SIMULACRUM_LARGE - || monster->type == MONS_SKELETON_SMALL - || monster->type == MONS_SKELETON_LARGE - || monster->type == MONS_SPECTRAL_THING) + if (mons_is_zombified(monster)) { // for zombies, monster type is kept in mon->number if (mons_itemuse(monster->number) >= MONUSE_OPEN_DOORS) @@ -6181,16 +6168,16 @@ bool monster_descriptor(int which_class, unsigned char which_descriptor) if (which_descriptor == MDSC_NOMSG_WOUNDS) { + if (mons_class_is_zombified(which_class) + && which_class != MONS_SPECTRAL_THING) + { + return (true); + } + switch (which_class) { case MONS_RAKSHASA: case MONS_RAKSHASA_FAKE: - case MONS_SKELETON_LARGE: - case MONS_SKELETON_SMALL: - case MONS_ZOMBIE_LARGE: - case MONS_ZOMBIE_SMALL: - case MONS_SIMULACRUM_SMALL: - case MONS_SIMULACRUM_LARGE: return (true); default: return (false); diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc index 462aa582d9..556024aa99 100644 --- a/crawl-ref/source/spells4.cc +++ b/crawl-ref/source/spells4.cc @@ -1918,24 +1918,24 @@ static int rot_undead(int x, int y, int pow, int garbage) // rot, discorporeal undead don't rot. if you wanna // insist that monsters get the same treatment as // players, I demand my player mummies get to worship - // the evil mummy & orc god. + // the evil mummy & orc gods. switch (menv[mon].type) { - case MONS_NECROPHAGE: case MONS_ZOMBIE_SMALL: - case MONS_LICH: - case MONS_MUMMY: - case MONS_VAMPIRE: case MONS_ZOMBIE_LARGE: - case MONS_WIGHT: - case MONS_GHOUL: - case MONS_BORIS: - case MONS_ANCIENT_LICH: - case MONS_VAMPIRE_KNIGHT: - case MONS_VAMPIRE_MAGE: + case MONS_MUMMY: case MONS_GUARDIAN_MUMMY: case MONS_GREATER_MUMMY: case MONS_MUMMY_PRIEST: + case MONS_GHOUL: + case MONS_NECROPHAGE: + case MONS_VAMPIRE: + case MONS_VAMPIRE_KNIGHT: + case MONS_VAMPIRE_MAGE: + case MONS_LICH: + case MONS_ANCIENT_LICH: + case MONS_WIGHT: + case MONS_BORIS: break; case MONS_ROTTING_HULK: default: -- cgit v1.2.3-54-g00ecf