diff options
-rw-r--r-- | crawl-ref/source/monplace.cc | 4 | ||||
-rw-r--r-- | crawl-ref/source/monplace.h | 2 | ||||
-rw-r--r-- | crawl-ref/source/xom.cc | 52 |
3 files changed, 36 insertions, 22 deletions
diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc index 9e69932070..0144a77bcf 100644 --- a/crawl-ref/source/monplace.cc +++ b/crawl-ref/source/monplace.cc @@ -1733,9 +1733,9 @@ bool empty_surrounds(int emx, int emy, unsigned char spc_wanted, return (good_count > 0); } // end empty_surrounds() -int summon_any_demon(demon_class_type demon_class) +monster_type summon_any_demon(demon_class_type demon_class) { - int summoned; // error trapping {dlb} + monster_type summoned = MONS_PROGRAM_BUG; int temp_rand; // probability determination {dlb} switch (demon_class) diff --git a/crawl-ref/source/monplace.h b/crawl-ref/source/monplace.h index 7cfb7fe015..fa896279c2 100644 --- a/crawl-ref/source/monplace.h +++ b/crawl-ref/source/monplace.h @@ -145,7 +145,7 @@ bool empty_surrounds( int emx, int emy, unsigned char spc_wanted, int radius, /* *********************************************************************** * called from: ability - acr - items - maps - mstuff2 - spell - spells * *********************************************************************** */ -int summon_any_demon( demon_class_type demon_class ); +monster_type summon_any_demon( demon_class_type demon_class ); // last update 13mar2001 {gdl} diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc index 40d1ca8389..93c0fa630c 100644 --- a/crawl-ref/source/xom.cc +++ b/crawl-ref/source/xom.cc @@ -455,21 +455,34 @@ monsters *get_random_nearby_monster() return (monster); } -static int xom_random_demon(int sever) +static monster_type xom_random_demon(int sever, bool use_greater_demons = true) { - int demontype; + const int roll = random2(1000 - (27 - you.experience_level) * 10); +#ifdef DEBUG_DIAGNOSTICS + mprf(MSGCH_DIAGNOSTICS, "xom_random_demon: sever = %d, roll: %d", + sever, roll); +#endif + const demon_class_type dct = + roll >= 850 ? DEMON_GREATER : + roll >= 340 ? DEMON_COMMON : + DEMON_LESSER; + const monster_type demontype = + summon_any_demon( + use_greater_demons || dct != DEMON_GREATER? dct : DEMON_COMMON); + return (demontype); +} +// Returns a demon suitable for use in Xom's punishments, filtering out the +// really nasty ones early on. +static monster_type xom_random_punishment_demon(int sever) +{ + monster_type demon = MONS_PROGRAM_BUG; do - { - // XXX Change the 20 if we add/remove demons! - // XXX Maybe we should use summon_any_demon() instead? - demontype = MONS_WHITE_IMP + - std::min(random2(random2(random2(sever))), 20); - - // Don't make Green Deaths for non-poison-resistant characters. - } while ( demontype == MONS_GREEN_DEATH && !player_res_poison()); - - return demontype; + demon = xom_random_demon(sever); + while ((demon == MONS_HELLION + && you.experience_level < 12 + && !one_chance_in(3 + (12 - you.experience_level) / 2))); + return (demon); } static bool xom_is_good(int sever) @@ -541,7 +554,7 @@ static bool xom_is_good(int sever) (temp_rand == 1) ? "Xom grants you some temporary aid." : "Xom momentarily opens a gate."); - int numdemons = std::min(random2(random2(random2(sever+1)+1)+1)+2, 24); + int numdemons = std::min(random2(random2(random2(sever+1)+1)+1)+2, 16); for (int i = 0; i < numdemons; i++) { create_monster(xom_random_demon(sever), 3, BEH_GOD_GIFT, @@ -566,7 +579,6 @@ static bool xom_is_good(int sever) (temp_rand == 0) ? "\"Serve the mortal, my child!\"" : (temp_rand == 1) ? "Xom grants you a demonic assistant." : "Xom opens a gate."); - done = true; } } @@ -623,7 +635,8 @@ static bool xom_is_good(int sever) } else if (random2(sever) <= 9) { - if (create_monster( xom_random_demon(sever), 0, BEH_GOD_GIFT, + if (create_monster( xom_random_demon(sever, one_chance_in(8)), + 0, BEH_GOD_GIFT, you.x_pos, you.y_pos, you.pet_target, 250 ) != -1) { temp_rand = random2(3); @@ -825,12 +838,13 @@ static bool xom_is_bad(int sever) else { const int numdemons = - std::min(random2(random2(random2(sever+1)+1)+1)+1, 24); + std::min(random2(random2(random2(sever+1)+1)+1)+1, 14); for (int i = 0; i < numdemons; i++) { - create_monster(MONS_WHITE_IMP + random2(random2(random2(std::min(sever,22)))), - 4, BEH_HOSTILE, you.x_pos, you.y_pos, - MHITNOT, 250); + create_monster( + xom_random_punishment_demon(sever), + 4, BEH_HOSTILE, you.x_pos, you.y_pos, + MHITNOT, 250); } } |