diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-10-28 08:11:28 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-10-28 08:11:28 +0000 |
commit | c6bb48f632ee793c54ea97d2551a1a5730bb2c9a (patch) | |
tree | 90e2024c17c8b58ef0502ae8301fddc41c38f118 | |
parent | d84295a22efbece1d87710fd6ff3dcfea8371e39 (diff) | |
download | crawl-ref-c6bb48f632ee793c54ea97d2551a1a5730bb2c9a.tar.gz crawl-ref-c6bb48f632ee793c54ea97d2551a1a5730bb2c9a.zip |
Trunk->0.3 merge (2632): Xom demon fix.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup-0.3@2633 c06c8d41-db1a-0410-9941-cceddc491573
-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 a95b212310..63ed816d5f 100644 --- a/crawl-ref/source/monplace.cc +++ b/crawl-ref/source/monplace.cc @@ -1696,9 +1696,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 a7170e05e0..3e91d49568 100644 --- a/crawl-ref/source/monplace.h +++ b/crawl-ref/source/monplace.h @@ -144,7 +144,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 eadf039a69..9d97519a83 100644 --- a/crawl-ref/source/xom.cc +++ b/crawl-ref/source/xom.cc @@ -372,21 +372,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) @@ -457,7 +470,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, @@ -482,7 +495,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; } } @@ -539,7 +551,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); @@ -738,12 +751,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); } } |