From 0e65534b50e40a32611842551af39a089eff48af Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Mon, 30 Jun 2008 14:32:21 +0000 Subject: Enable Chaos Knights of Lugonu starting out in the Abyss. I've marked these characters with GDT_GAME_START, so that * the player starts out on an altar to Lugonu * there's an exit back to the Dungeon near-by * returning into the Dungeon always places them into the entry vault on level 1 * no abyssal runes are ever generated * item generation matches that of level 1 * monster spawn rates are that of the orb run to enforce a quick return into the Dungeon Once the player returns to the Dungeon (via an exit or with Lugonu's first power) char_direction is properly set to GDT_DESCENDING and from then on the game continues as if they had started in the Dungeon. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6245 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/abyss.cc | 74 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 52 insertions(+), 22 deletions(-) (limited to 'crawl-ref/source/abyss.cc') diff --git a/crawl-ref/source/abyss.cc b/crawl-ref/source/abyss.cc index 416515d1e9..14ab8056bd 100644 --- a/crawl-ref/source/abyss.cc +++ b/crawl-ref/source/abyss.cc @@ -90,11 +90,24 @@ void generate_abyss() : DNGN_CLOSED_DOOR); // 1 in 4000 } - grd[45][35] = DNGN_FLOOR; - if (one_chance_in(5)) + // If we're starting out in the Abyss, make sure the starting grid is + // an altar to Lugonu and there's an exit near-by. + // Otherwise, we start out on floor and there's a chance there's an + // altar near-by. + if (you.char_direction == GDT_GAME_START) { + grd[45][35] = DNGN_ALTAR_LUGONU; _place_feature_near( coord_def(45, 35), LOS_RADIUS, - DNGN_FLOOR, DNGN_ALTAR_LUGONU, 50 ); + DNGN_FLOOR, DNGN_EXIT_ABYSS, 50 ); + } + else + { + grd[45][35] = DNGN_FLOOR; + if (one_chance_in(5)) + { + _place_feature_near( coord_def(45, 35), LOS_RADIUS, + DNGN_FLOOR, DNGN_ALTAR_LUGONU, 50 ); + } } } @@ -209,6 +222,7 @@ static void _generate_area(int gx1, int gy1, int gx2, int gy2, if (items_placed < 150 && one_chance_in(200)) { if (!placed_abyssal_rune && abyssal_rune_roll != -1 + && you.char_direction != GDT_GAME_START && one_chance_in(abyssal_rune_roll)) { thing_created = items(1, OBJ_MISCELLANY, @@ -220,8 +234,19 @@ static void _generate_area(int gx1, int gy1, int gx2, int gy2, } else { - thing_created = items(1, OBJ_RANDOM, - OBJ_RANDOM, true, 51, 250); + if (you.char_direction == GDT_GAME_START) + { + // Number and level of items as that on level 1. + const int num_items = 3 + roll_dice( 3, 11 ); + const int items_level = 0; + thing_created = items(1, OBJ_RANDOM, OBJ_RANDOM, + true, items_level, num_items); + } + else + { + thing_created = items(1, OBJ_RANDOM, + OBJ_RANDOM, true, 51, 250); + } } move_item_to_grid( &thing_created, i, j ); @@ -254,29 +279,34 @@ static void _generate_area(int gx1, int gy1, int gx2, int gy2, #endif } - if (one_chance_in(10000)) // Place an altar. - altars_wanted++; - - // Don't place altars under items. - if (altars_wanted > 0 && igrd[i][j] == NON_ITEM) + // Except for the altar on the starting position, don't place + // any altars. + if (you.char_direction != GDT_GAME_START) { - do + if (one_chance_in(10000)) // Place an altar. + altars_wanted++; + + // Don't place altars under items. + if (altars_wanted > 0 && igrd[i][j] == NON_ITEM) { - grd[i][j] = static_cast( - DNGN_ALTAR_ZIN + random2(NUM_GODS-1) ); - } - while (grd[i][j] == DNGN_ALTAR_ZIN - || grd[i][j] == DNGN_ALTAR_SHINING_ONE - || grd[i][j] == DNGN_ALTAR_ELYVILON); + do + { + grd[i][j] = static_cast( + DNGN_ALTAR_ZIN + random2(NUM_GODS-1) ); + } + while (grd[i][j] == DNGN_ALTAR_ZIN + || grd[i][j] == DNGN_ALTAR_SHINING_ONE + || grd[i][j] == DNGN_ALTAR_ELYVILON); - // Lugonu has a flat 50% chance of corrupting the altar. - if (coinflip()) - grd[i][j] = DNGN_ALTAR_LUGONU; + // Lugonu has a flat 50% chance of corrupting the altar. + if (coinflip()) + grd[i][j] = DNGN_ALTAR_LUGONU; - altars_wanted--; + altars_wanted--; #if DEBUG_ABYSS - mpr("Placing altar.", MSGCH_DIAGNOSTICS); + mpr("Placing altar.", MSGCH_DIAGNOSTICS); #endif + } } } -- cgit v1.2.3-54-g00ecf