diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-03-18 07:05:07 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-03-18 07:05:07 +0000 |
commit | 3fdf3ab24ea63ecde6537ea122e2ab1cd6b8d4f1 (patch) | |
tree | a838b57e94a87f84fcdbf3e551b365aec922259d /crawl-ref/source/abyss.cc | |
parent | de11c27378236139089c48ecfb0b66457cc0d67c (diff) | |
download | crawl-ref-3fdf3ab24ea63ecde6537ea122e2ab1cd6b8d4f1.tar.gz crawl-ref-3fdf3ab24ea63ecde6537ea122e2ab1cd6b8d4f1.zip |
Banished uniques (including ghosts) will now be sent to the Abyss. Banished
non-uniques may also get the Abyss treatment if they clear a HD roll.
Crawl tries very hard not to lose banished monsters, preserving them across
Abyss shifts and teleports, and saving them on the transit list when the player
escapes the Abyss.
Breaks savefile compatibility.
Toned down Vehumet and wizardry boosts a touch.
Fixed bugginess where player could get aux unarmed attacks on a monster that
just teleported away (by weapon of distortion).
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1052 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/abyss.cc')
-rw-r--r-- | crawl-ref/source/abyss.cc | 63 |
1 files changed, 36 insertions, 27 deletions
diff --git a/crawl-ref/source/abyss.cc b/crawl-ref/source/abyss.cc index ac82243fff..eb00207c74 100644 --- a/crawl-ref/source/abyss.cc +++ b/crawl-ref/source/abyss.cc @@ -21,6 +21,7 @@ #include "cloud.h" #include "misc.h" #include "monplace.h" +#include "mtransit.h" #include "dungeon.h" #include "items.h" #include "lev-pand.h" @@ -190,35 +191,27 @@ static void generate_area(unsigned char gx1, unsigned char gy1, } } +static void abyss_lose_monster(monsters &mons) +{ + if (mons.needs_transit()) + mons.set_transit( level_id(LEVEL_ABYSS) ); + + mons.reset(); +} void area_shift(void) /*******************/ { for (unsigned int i = 0; i < MAX_MONSTERS; i++) { - if (menv[i].type == -1) - { + monsters &m = menv[i]; + + if (!m.alive()) continue; - } // remove non-nearby monsters - if (menv[i].x < you.x_pos - 10 - || menv[i].x >= you.x_pos + 11 - || menv[i].y < you.y_pos - 10 || menv[i].y >= you.y_pos + 11) - { - menv[i].type = -1; - - mgrd[menv[i].x][menv[i].y] = NON_MONSTER; - - for (unsigned int j = 0; j < NUM_MONSTER_SLOTS; j++) - { - if (menv[i].inv[j] != NON_ITEM) - { - destroy_item( menv[i].inv[j] ); - menv[i].inv[j] = NON_ITEM; - } - } - } + if (grid_distance(m.x, m.y, you.x_pos, you.y_pos) > 10) + abyss_lose_monster(m); } for (int i = 5; i < (GXM - 5); i++) @@ -226,17 +219,17 @@ void area_shift(void) for (int j = 5; j < (GYM - 5); j++) { // don't modify terrain by player - if (i >= you.x_pos - 10 && i < you.x_pos + 11 - && j >= you.y_pos - 10 && j < you.y_pos + 11) - { + if (grid_distance(i, j, you.x_pos, you.y_pos) <= 10) continue; - } // nuke terrain otherwise grd[i][j] = DNGN_UNSEEN; // nuke items destroy_item_stack( i, j ); + + if (mgrd[i][j] != NON_MONSTER) + abyss_lose_monster( menv[ mgrd[i][j] ] ); } } @@ -298,8 +291,20 @@ void area_shift(void) mons_place( RANDOM_MONSTER, BEH_HOSTILE, MHITNOT, false, 1, 1, LEVEL_ABYSS, PROX_AWAY_FROM_PLAYER ); // PROX_ANYWHERE? } + + // And allow monsters in transit another chance to return. + place_transiting_monsters(); } +void save_abyss_uniques() +{ + for (int i = 0; i < MAX_MONSTERS; ++i) + { + monsters &m = menv[i]; + if (m.alive() && m.needs_transit()) + m.set_transit( level_id(LEVEL_ABYSS) ); + } +} void abyss_teleport( bool new_area ) /**********************************/ @@ -336,6 +341,12 @@ void abyss_teleport( bool new_area ) init_pandemonium(); // get new monsters set_colours_from_monsters(); // and new colours + for (i = 0; i < MAX_MONSTERS; i++) + { + if (menv[i].alive()) + abyss_lose_monster(menv[i]); + } + // Orbs and fixed artefacts are marked as "lost in the abyss" for (k = 0; k < MAX_ITEMS; k++) { @@ -356,9 +367,6 @@ void abyss_teleport( bool new_area ) } } - for (i = 0; i < MAX_MONSTERS; i++) - menv[i].type = -1; - for (i = 0; i < MAX_CLOUDS; i++) delete_cloud( i ); @@ -384,4 +392,5 @@ void abyss_teleport( bool new_area ) if ( one_chance_in(5) ) grd[you.x_pos + 1][you.y_pos] = DNGN_ALTAR_LUCY; + place_transiting_monsters(); } |