From eb8fb2b966c556c85ae176a98596b15d604e3fe9 Mon Sep 17 00:00:00 2001 From: dolorous Date: Tue, 23 Dec 2008 18:02:07 +0000 Subject: Make enslaved souls the EC_UNHOLY color, and make zombies shovable. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7916 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/files.cc | 6 +++--- crawl-ref/source/mon-util.cc | 33 +++++++++++++++------------------ crawl-ref/source/monstuff.cc | 1 + crawl-ref/source/religion.cc | 1 + crawl-ref/source/spells3.cc | 2 +- crawl-ref/source/stuff.cc | 36 ++++++++++++++++-------------------- crawl-ref/source/stuff.h | 2 +- 7 files changed, 38 insertions(+), 43 deletions(-) (limited to 'crawl-ref/source') diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc index 5e56f77f61..7dad243f4b 100644 --- a/crawl-ref/source/files.cc +++ b/crawl-ref/source/files.cc @@ -954,8 +954,8 @@ static bool _grab_follower_at(const coord_def &pos) if (!fmenv || !fmenv->alive()) return (false); - // Monster has to be already tagged in order to follow. - if (!testbits( fmenv->flags, MF_TAKING_STAIRS )) + // The monster has to already be tagged in order to follow. + if (!testbits(fmenv->flags, MF_TAKING_STAIRS)) return (false); level_id dest = level_id::current(); @@ -978,7 +978,7 @@ static void _grab_followers() const bool can_follow = level_type_allows_followers(you.level_type); // Handle nearby ghosts. - for ( adjacent_iterator ai; ai; ++ai ) + for (adjacent_iterator ai; ai; ++ai) { if (mgrd(*ai) == NON_MONSTER) continue; diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index 47286768aa..2c950d763d 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -3153,12 +3153,15 @@ bool monster_shover(const monsters *m) // Efreet and fire elementals are disqualified because they leave behind // clouds of flame. Rotting devils trail clouds of miasma. if (m->type == MONS_EFREET || m->type == MONS_FIRE_ELEMENTAL - || m->type == MONS_ROTTING_DEVIL - || m->type == MONS_CURSE_TOE) + || m->type == MONS_ROTTING_DEVIL || m->type == MONS_CURSE_TOE) { return (false); } + // Monsters too stupid to use stairs (e.g. zombies) are also disqualified. + if (!m->can_use_stairs()) + return (false); + // Smiters profit from staying back and smiting. if (_mons_can_smite(m)) return (false); @@ -3167,11 +3170,10 @@ bool monster_shover(const monsters *m) // Somewhat arbitrary: giants and dragons are too big to get past anything, // beetles are too dumb (arguable), dancing weapons can't communicate, eyes - // aren't pushers and shovers, zombies are zombies. Worms and elementals - // are on the list because all 'w' are currently unrelated. + // aren't pushers and shovers. Worms and elementals are on the list because + // all 'w' are currently unrelated. return (mchar != 'C' && mchar != 'B' && mchar != '(' && mchar != 'D' - && mchar != 'G' && mchar != 'Z' && mchar != 'z' - && mchar != 'w' && mchar != '#'); + && mchar != 'G' && mchar != 'w' && mchar != '#'); } // Returns true if m1 and m2 are related, and m1 is higher up the totem pole @@ -3185,8 +3187,8 @@ bool monster_senior(const monsters *m1, const monsters *m2) if (!me1 || !me2) return (false); - int mchar1 = me1->showchar, - mchar2 = me2->showchar; + int mchar1 = me1->showchar; + int mchar2 = me2->showchar; // If both are demons, the smaller number is the nastier demon. if (isdigit(mchar1) && isdigit(mchar2)) @@ -3197,9 +3199,10 @@ bool monster_senior(const monsters *m1, const monsters *m2) if (mchar1 == '&' && isdigit(mchar2) && m1->type != MONS_GERYON) return (m1->hit_dice > m2->hit_dice); - // Skeletal warriors can push past zombies large and small. - if (m1->type == MONS_SKELETAL_WARRIOR && (mchar2 == 'z' || mchar2 == 'Z')) - return (m1->hit_dice > m2->hit_dice); + // Monsters that are smart enough to use stairs can push past monsters + // too stupid to use stairs (e.g. zombies). + if (m1->can_use_stairs() && !m2->can_use_stairs()) + return (true); if (m1->type == MONS_QUEEN_BEE && (m2->type == MONS_KILLER_BEE @@ -5770,13 +5773,7 @@ bool monsters::is_patrolling() const bool monsters::can_use_stairs() const { - if (type == MONS_PLAYER_GHOST) - return (false); - - if (mons_is_zombified(this) && !mons_enslaved_intact_soul(this)) - return (false); - - return (true); + return (!mons_is_zombified(this) || mons_enslaved_intact_soul(this)); } bool monsters::needs_transit() const diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index e670451c3f..b179065d2c 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -4106,6 +4106,7 @@ static bool _allied_monster_at(monsters *mon, coord_def a, coord_def b, if (mons_aligned(monster_index(mon), mgrd(pos[i]))) return (true); } + return (false); } diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 28cf8059e1..3d3066d83e 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -5417,6 +5417,7 @@ void yred_make_enslaved_soul(monsters *mon, bool force_hostile, monster_drop_ething(mon); } + mon->colour = EC_UNHOLY; mon->flags |= MF_ENSLAVED_SOUL; if (mons_is_unique(type)) diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc index c03ab68b98..5c5eff2ae3 100644 --- a/crawl-ref/source/spells3.cc +++ b/crawl-ref/source/spells3.cc @@ -1034,7 +1034,7 @@ bool cast_twisted_resurrection(int pow, god_type god) int total_mass = 0; int rotted = 0; - for ( stack_iterator si(you.pos()); si; ++si ) + for (stack_iterator si(you.pos()); si; ++si) { if (si->base_type == OBJ_CORPSES && si->sub_type == CORPSE_BODY) { diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc index 0c3576e2be..8c3aef9208 100644 --- a/crawl-ref/source/stuff.cc +++ b/crawl-ref/source/stuff.cc @@ -301,7 +301,7 @@ radius_iterator radius_iterator::operator--(int dummy) } // Crude, but functional. -std::string make_time_string( time_t abs_time, bool terse ) +std::string make_time_string(time_t abs_time, bool terse) { const int days = abs_time / 86400; const int hours = (abs_time % 86400) / 3600; @@ -325,12 +325,12 @@ std::string make_time_string( time_t abs_time, bool terse ) return buff.str(); } -void set_redraw_status( unsigned long flags ) +void set_redraw_status(unsigned long flags) { you.redraw_status_flags |= flags; } -static bool tag_follower_at(const coord_def &pos) +static bool _tag_follower_at(const coord_def &pos) { if (!in_bounds(pos) || pos == you.pos()) return (false); @@ -340,7 +340,9 @@ static bool tag_follower_at(const coord_def &pos) monsters *fmenv = &menv[mgrd(pos)]; - if (!fmenv->alive() + if (fmenv->type == MONS_PLAYER_GHOST + || !fmenv->alive() + || !fmenv->can_use_stairs() || fmenv->incapacitated() || mons_is_stationary(fmenv)) { @@ -377,24 +379,18 @@ static bool tag_follower_at(const coord_def &pos) } } - // Return true for monsters that can't use stairs (so that friendly - // monsters adjacent to them can still follow you through stairs), - // but don't tag them as followers. - if (fmenv->can_use_stairs()) - { - // Monster is chasing player through stairs. - fmenv->flags |= MF_TAKING_STAIRS; + // Monster is chasing player through stairs. + fmenv->flags |= MF_TAKING_STAIRS; - // Clear patrolling/travel markers. - fmenv->patrol_point.reset(); - fmenv->travel_path.clear(); - fmenv->travel_target = MTRAV_NONE; + // Clear patrolling/travel markers. + fmenv->patrol_point.reset(); + fmenv->travel_path.clear(); + fmenv->travel_target = MTRAV_NONE; #if DEBUG_DIAGNOSTICS - mprf(MSGCH_DIAGNOSTICS, "%s is marked for following.", - fmenv->name(DESC_CAP_THE, true).c_str() ); + mprf(MSGCH_DIAGNOSTICS, "%s is marked for following.", + fmenv->name(DESC_CAP_THE, true).c_str() ); #endif - } return (true); } @@ -403,7 +399,7 @@ static int follower_tag_radius2() { // If only friendlies are adjacent, we set a max radius of 6, otherwise // only adjacent friendlies may follow. - for ( adjacent_iterator ai; ai; ++ai ) + for (adjacent_iterator ai; ai; ++ai) if (const monsters *mon = monster_at(*ai)) if (!mons_friendly(mon)) return (2); @@ -437,7 +433,7 @@ void tag_followers() continue; } travel_point_distance[fp.x][fp.y] = 1; - if (tag_follower_at(fp)) + if (_tag_follower_at(fp)) { // If we've run out of our follower allowance, bail. if (--n_followers <= 0) diff --git a/crawl-ref/source/stuff.h b/crawl-ref/source/stuff.h index 47245e42f2..408292ecb6 100644 --- a/crawl-ref/source/stuff.h +++ b/crawl-ref/source/stuff.h @@ -14,7 +14,7 @@ #include std::string make_time_string(time_t abs_time, bool terse = false); -void set_redraw_status( unsigned long flags ); +void set_redraw_status(unsigned long flags); void tag_followers(); void untag_followers(); -- cgit v1.2.3-54-g00ecf