From 86076a641fc7b9cc1ce20a8f3dca87655bbf62ca Mon Sep 17 00:00:00 2001 From: dshaligram Date: Tue, 30 Oct 2007 13:09:37 +0000 Subject: Updated CREDITS and INSTALL, fixed Tomb:2 (David), fixed Xom's mutation-as-reward strategy. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2683 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/CREDITS | 39 +++--- crawl-ref/INSTALL | 67 ++++++---- crawl-ref/source/acr.cc | 3 + crawl-ref/source/dat/crypt.des | 7 +- crawl-ref/source/enum.h | 3 +- crawl-ref/source/mutation.cc | 284 ++++++++++++++++++++++++----------------- crawl-ref/source/mutation.h | 6 +- crawl-ref/source/xom.cc | 5 +- 8 files changed, 245 insertions(+), 169 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/CREDITS b/crawl-ref/CREDITS index e14462d1d0..6976aff2c6 100644 --- a/crawl-ref/CREDITS +++ b/crawl-ref/CREDITS @@ -1,6 +1,6 @@ The Dungeon Crawl Stone Soup team (Peter Berger, Matthew Cline, Nat Lanza, -Haran Pilpel, Erik Piper, David Ploog, Johanna Ploog, Darshan Shaligram) would -like to thank: +Haran Pilpel, David Ploog, Johanna Ploog, Darshan Shaligram) would like to +thank: * Linley Henzell, the author of Dungeon Crawl, for writing this great game. @@ -14,20 +14,21 @@ like to thank: We'd also like to thank members of the Dungeon Crawl community who have contributed to Dungeon Crawl Stone Soup: -Warwick Allison Benoit Hudson Pedro -Juha Arpiainen Ilyak Lemuel Pitkin -Roy Axenov Mitsuhiro Itakura David Lawrence Ramsey -Alexander Beisig Eino Keskitalo Remsleep -Erik Inge Bolsø Jarmo Kielosto David Rose -Peter Borgmann Kornel Kisielewicz Sebastian Salman -Rachel Elizabeth Dillon Ryan Kusnery Brett Scarborough -Dylan O'Donnell Jukka Kuusisto Roman Sêk -Jesse Luehrs Jordan Lewis Sigurd -Mike Drinen Icy Lich Edgar Simo -Kieron Dunbar Arien Malec Solf -Elethiomel Shawn M Moore Johan Strandell -Christopher Evenstar Eva Myers Marc H. Thoben -Ben Goetter Onia Ninara Matt Titus -Ciaran Hamilton Erkki Nurmi Steven Wheeler -Chris Hamons nyra Jeremey Wilson -R. Dan Henry Yuuma Oohara Zooko +Warwick Allison Ilyak Lemuel Pitkin +Juha Arpiainen Mitsuhiro Itakura David Lawrence Ramsey +Roy Axenov Eino Keskitalo Remsleep +Alexander Beisig Jarmo Kielosto David Rose +Erik Inge Bolsø Kornel Kisielewicz Sebastian Salman +Peter Borgmann Ryan Kusnery Brett Scarborough +Rachel Elizabeth Dillon Jukka Kuusisto Roman Sêk +Dylan O'Donnell Jordan Lewis Sigurd +Jesse Luehrs Icy Lich Edgar Simo +Mike Drinen Arien Malec Solf +Kieron Dunbar Shawn M Moore Johan Strandell +Elethiomel Eva Myers Marc H. Thoben +Christopher Evenstar Onia Ninara Matt Titus +Ben Goetter Erkki Nurmi Enne Walker +Ciaran Hamilton nyra Steven Wheeler +Chris Hamons Yuuma Oohara Jeremey Wilson +R. Dan Henry Pedro Zooko +Benoit Hudson Erik Piper diff --git a/crawl-ref/INSTALL b/crawl-ref/INSTALL index 8b80c8b49d..4a4ca0c082 100644 --- a/crawl-ref/INSTALL +++ b/crawl-ref/INSTALL @@ -1,12 +1,12 @@ Install instructions for Dungeon Crawl Stone Soup (DCSS) -------------------------------------------------------- -(Last updated on 20070331 for Dungeon Crawl Stone Soup 0.2.) +(Last updated on 20071030 for Dungeon Crawl Stone Soup 0.3.) Building Dungeon Crawl Stone Soup --------------------------------- Crawl Stone Soup is known to compile successfully on the following -platforms as of version 0.2: +platforms as of version 0.3: - Any Unix with a recent gcc (and g++), GNU make and libncurses, including Linux and Mac OS X. "Recent" is defined as gcc 3.3 or @@ -64,9 +64,9 @@ Makefile system --------------- Crawl uses a selector makefile (under source/makefile) to control what -platform it's building for. Your first step in building Crawl should -be to edit source/makefile and point it at the correct platform -makefile. For instance, if you're building for Windows, you'd use +platform it's building for. Your first step in building Crawl should be +to edit source/makefile and point it at the correct platform makefile. +For instance, if you're building for Windows, you'd use MAKEFILE=makefile.mgw to build with MinGW for Windows (# is used for comments in makefiles). @@ -77,6 +77,24 @@ information on building Crawl. Building on Unix (Linux, *BSD, Solaris, etc.) --------------------------------------------- +Security: + +If you have untrusted local users, we highly recommend you do not +install Crawl setgid or setuid. Just running "make install" will install +Crawl setgid games, do *not* do this unless you're sure you trust your +users. + +If you have untrusted users, the correct way to install a multiplayer +Crawl is using a chrooted game launcher such as dgamelaunch. + + +To install or not to install: + +If only one user on the system (you) is going to be playing Crawl, you +do not need to use "make install". A simple "make" will build Crawl in +the source directory, where you can run it as "./crawl". + + Prerequisites: GNU gcc and g++, GNU make, libncurses or libcurses. You need the @@ -86,10 +104,12 @@ on some Unixes. flex and bison are optional but highly recommended. Recent versions of byacc are also fine (edit your makefile appropriately). -If you have ncursesw and the development headers (usually in the -/usr/include/ncursesw directory) you can build Crawl with support for -Unicode display characters in the map by setting UNICODE_GLYPHS = y -in makefile.unix. +If you want to use Unicode, you need to link with a curses library that +understands Unicode characters, usually named libncursesw (the +development headers for libncursesw are usually in +/usr/include/ncursesw.) You also need to have a UTF-8 locale installed. +You can then build Crawl with support for Unicode by setting +UNICODE_GLYPHS = y in makefile.unix. Building: @@ -117,7 +137,7 @@ Building: * Run make to build the normal (non-wizard) Crawl. On systems such as Solaris, you may have to use gmake for GNU make. Make sure your make - identifies itself as GNU make when you do make --version. + identifies itself as GNU Make when you do make --version. * If you're installing Crawl for multiple users, run make install. Crawl will be copied into the directory specified by INSTALLDIR. The @@ -125,11 +145,8 @@ Building: level layout (.des) and help files will be copied to the data directory. -* If you'd like users to be able to script Crawl with Lua, you can - edit AppHdr.h, uncomment - // #define CLUA_BINDINGS - clean, and rebuild to compile with user Lua support. See the section - on Lua (below) for more information. +* If you do not want players to be able to script Crawl with Lua, + edit makefile.unix and remove -DCLUA_BINDINGS from the CFOTHERS line. Building on Mac OS X @@ -180,11 +197,11 @@ NT family). If you're on 9x/ME, you can use the Cygwin build instructions, or build a binary on a Windows NT/2k/XP system (the binary will run on 9x), or build a DOS binary. -* Install MinGW from http://www.mingw.org. The MinGW 5.0.2 installer - is best so you don't have to fiddle with individual packages (you - can mess with the individual packages if you like to, of course). If - you want to edit the level compiler, also get the flex and bison - packages (available from the GnuWin32 project on Sourceforge: +* Install MinGW from http://www.mingw.org. The MinGW installer + is best so you don't have to fiddle with individual packages (you can + mess with the individual packages if you like to, of course). If you + want to edit the level compiler, also get the flex and bison packages + (available from the GnuWin32 project on Sourceforge: http://gnuwin32.sourceforge.net/). * Make sure you have g++ and mingw32-make in your path. @@ -198,7 +215,8 @@ binary will run on 9x), or build a DOS binary. uncomment this line: // #define REGEX_PCRE Note that there are multiple // #define REGEX_PCRE lines in AppHdr.h - - find the one in the Windows-specific section. + - find the one in the Windows-specific section. Also see the section + below on obtaining the pcre library to link against. * If you have flex and bison, edit makefile.mgw and set DOYACC := y. @@ -343,6 +361,7 @@ not UTF-8, you can force it to UTF-8 on most systems by doing "export LC_ALL=en_US.UTF-8" or the equivalent, depending on your language locale and what shell you're using. -If you're playing Crawl on a remote machine, the remote Crawl should -be built with Unicode support, *and* your local terminal (where you're -running telnet/ssh) needs to be able to decode UTF-8. \ No newline at end of file +If you're playing Crawl on a remote machine, the remote Crawl should be +built with Unicode support, it needs to have a UTF-8 locale installed, +*and* your local terminal (where you're running telnet/ssh) needs to be +able to decode UTF-8. diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index aee9c4f90b..b868e61bee 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -3482,6 +3482,9 @@ static bool initialise(void) const bool newc = new_game(); if (!newc) restore_game(); + + // Fix the mutation definitions for the species we're playing. + fixup_mutations(); // Load macros macro_init(); diff --git a/crawl-ref/source/dat/crypt.des b/crawl-ref/source/dat/crypt.des index e56cb741fb..4f2acba0d8 100644 --- a/crawl-ref/source/dat/crypt.des +++ b/crawl-ref/source/dat/crypt.des @@ -455,7 +455,8 @@ PLACE: Tomb:2 # Can be rotated! ORIENT: encompass # -SHUFFLE: ABCD[, Ww/Yy/Zz, Uu/Vv, Qq/Rr/Ss +NSUBST: A = [ / ' +SHUFFLE: Ww/Yy/Zz, Uu/Vv, Qq/Rr/Ss SUBST: W=', w=c, Y=T, y=+, Z=T, z=+ SUBST: U=', u=c, V=T, v=+ SUBST: Q=', q=c, R=T, r=+, S=T, s=+ @@ -521,14 +522,14 @@ xxxxxxxxxxxxxxcccczcc..ccc.........1.........ccc..c''''ccxxxxxxxxxxxxx xxxxxxxxxxxxxxcc'ZZZc..ccc...................ccc..c''''ccxxxxxxxxxxxxx xxxxxxxxxxxxxxccA'''c..ccc4.................4ccc..c''''ccxxxxxxxxxxxxx xxxxxxxxxxxxxxcc'YYYc.............................c''''ccxxxxxxxxxxxxx -xxxxxxxxxxxxxxccccycc.............................cRRR[ccxxxxxxxxxxxxx +xxxxxxxxxxxxxxccccycc.............................cRRRAccxxxxxxxxxxxxx xxxxxxxxxxxxxxcc'YYYc.............................ccrccccxxxxxxxxxxxxx xxxxxxxxxxxxxxcc''''ccccc+ccccccccccccccc+cccccccccRRR'ccxxxxxxxxxxxxx xxxxxxxxxxxxxxcc''''''c'TTTc''''''''''''cTT''''''c'''''ccxxxxxxxxxxxxx xxxxxxxxxxxxxxcc'''''WcW''UcU''''''''''VcV''''''ScS''''ccxxxxxxxxxxxxx xxxxxxxxxxxxxxcc'''''WwW''UuU''''''''''VvV''''''SsS''''ccxxxxxxxxxxxxx xxxxxxxxxxxxxxcc'''''WcW''UcU''''''''''VcV''''''ScS''''ccxxxxxxxxxxxxx -xxxxxxxxxxxxxxccB'''''c''''cC'''''''''''c''''''''c''''Dccxxxxxxxxxxxxx +xxxxxxxxxxxxxxccA'''''c''''cA'''''''''''c''''''''c''''Accxxxxxxxxxxxxx xxxxxxxxxxxxxxcccccccccccccccccccccccccccccccccccccccccccxxxxxxxxxxxxx xxxxxxxxxxxxxxcccccccccccccccccccccccccccccccccccccccccccxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h index 2595d53732..269a706212 100644 --- a/crawl-ref/source/enum.h +++ b/crawl-ref/source/enum.h @@ -2041,7 +2041,8 @@ enum mutation_type NUM_MUTATIONS, RANDOM_MUTATION = 100, - RANDOM_XOM_MUTATION = 101 + RANDOM_XOM_MUTATION = 101, + RANDOM_GOOD_MUTATION = 102 }; enum object_class_type // (unsigned char) mitm[].base_type diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc index f794bdd5cf..7c2d5d4acc 100644 --- a/crawl-ref/source/mutation.cc +++ b/crawl-ref/source/mutation.cc @@ -884,120 +884,119 @@ const char *lose_mutation[][3] = { /* mutation definitions: first number = probability (0 means it doesn't appear naturally?) second number = maximum levels */ -static const mutation_def mutation_defs[] = { - { MUT_TOUGH_SKIN, 10, 3 }, - { MUT_STRONG, 8, 14 }, - { MUT_CLEVER, 8, 14 }, - { MUT_AGILE, 8, 14 }, - { MUT_GREEN_SCALES, 2, 3 }, - { MUT_BLACK_SCALES, 1, 3 }, - { MUT_GREY_SCALES, 2, 3 }, - { MUT_BONEY_PLATES, 1, 3 }, - { MUT_REPULSION_FIELD, 1, 3 }, - { MUT_POISON_RESISTANCE, 4, 1 }, +static mutation_def mutation_defs[] = { + { MUT_TOUGH_SKIN, 10, 3, false }, + { MUT_STRONG, 8, 14, false }, + { MUT_CLEVER, 8, 14, false }, + { MUT_AGILE, 8, 14, false }, + { MUT_GREEN_SCALES, 2, 3, false }, + { MUT_BLACK_SCALES, 1, 3, false }, + { MUT_GREY_SCALES, 2, 3, false }, + { MUT_BONEY_PLATES, 1, 3, false }, + { MUT_REPULSION_FIELD, 1, 3, false }, + { MUT_POISON_RESISTANCE, 4, 1, false }, // 10 - { MUT_CARNIVOROUS, 5, 3 }, - { MUT_HERBIVOROUS, 5, 3 }, - { MUT_HEAT_RESISTANCE, 4, 3 }, - { MUT_COLD_RESISTANCE, 4, 3 }, - { MUT_SHOCK_RESISTANCE, 2, 1 }, - { MUT_REGENERATION, 3, 3 }, - { MUT_FAST_METABOLISM, 10, 3 }, - { MUT_SLOW_METABOLISM, 7, 3 }, - { MUT_WEAK, 10, 14 }, - { MUT_DOPEY, 10, 14 }, + { MUT_CARNIVOROUS, 5, 3, false }, + { MUT_HERBIVOROUS, 5, 3, true }, + { MUT_HEAT_RESISTANCE, 4, 3, false }, + { MUT_COLD_RESISTANCE, 4, 3, false }, + { MUT_SHOCK_RESISTANCE, 2, 1, false }, + { MUT_REGENERATION, 3, 3, false }, + { MUT_FAST_METABOLISM, 10, 3, true }, + { MUT_SLOW_METABOLISM, 7, 3, false }, + { MUT_WEAK, 10, 14, true }, + { MUT_DOPEY, 10, 14, true }, // 20 - { MUT_CLUMSY, 10, 14 }, - { MUT_TELEPORT_CONTROL, 2, 1 }, - { MUT_TELEPORT, 3, 3 }, - { MUT_MAGIC_RESISTANCE, 5, 3 }, - { MUT_FAST, 1, 3 }, - { MUT_ACUTE_VISION, 2, 1 }, - { MUT_DEFORMED, 8, 3 }, - { MUT_TELEPORT_AT_WILL, 2, 3 }, - { MUT_SPIT_POISON, 8, 3 }, - { MUT_MAPPING, 3, 3 }, + { MUT_CLUMSY, 10, 14, true }, + { MUT_TELEPORT_CONTROL, 2, 1, false }, + { MUT_TELEPORT, 3, 3, true }, + { MUT_MAGIC_RESISTANCE, 5, 3, false }, + { MUT_FAST, 1, 3, false }, + { MUT_ACUTE_VISION, 2, 1, false }, + { MUT_DEFORMED, 8, 3, true }, + { MUT_TELEPORT_AT_WILL, 2, 3, false }, + { MUT_SPIT_POISON, 8, 3, false }, + { MUT_MAPPING, 3, 3, false }, // 30 - { MUT_BREATHE_FLAMES, 4, 3 }, - { MUT_BLINK, 3, 3 }, - { MUT_HORNS, 7, 3 }, - { MUT_STRONG_STIFF, 10, 3 }, - { MUT_FLEXIBLE_WEAK, 10, 3 }, - { MUT_SCREAM, 6, 3 }, - { MUT_CLARITY, 6, 1 }, - { MUT_BERSERK, 7, 3 }, - { MUT_DETERIORATION, 10, 3 }, - { MUT_BLURRY_VISION, 10, 3 }, + { MUT_BREATHE_FLAMES, 4, 3, false }, + { MUT_BLINK, 3, 3, false }, + { MUT_HORNS, 7, 3, false }, + { MUT_STRONG_STIFF, 10, 3, false }, + { MUT_FLEXIBLE_WEAK, 10, 3, false }, + { MUT_SCREAM, 6, 3, true }, + { MUT_CLARITY, 6, 1, false }, + { MUT_BERSERK, 7, 3, true }, + { MUT_DETERIORATION, 10, 3, true }, + { MUT_BLURRY_VISION, 10, 3, true }, // 40 - { MUT_MUTATION_RESISTANCE, 4, 3 }, - { MUT_FRAIL, 10, 3 }, - { MUT_ROBUST, 5, 3 }, + { MUT_MUTATION_RESISTANCE, 4, 3, false }, + { MUT_FRAIL, 10, 3, true }, + { MUT_ROBUST, 5, 3, false }, /* Some demonic powers start here: */ - { MUT_TORMENT_RESISTANCE, 0, 1 }, - { MUT_NEGATIVE_ENERGY_RESISTANCE, 0, 3 }, - { MUT_SUMMON_MINOR_DEMONS, 0, 1 }, - { MUT_SUMMON_DEMONS, 0, 1 }, - { MUT_HURL_HELLFIRE, 0, 1 }, - { MUT_CALL_TORMENT, 0, 1 }, - { MUT_RAISE_DEAD, 0, 1 }, + { MUT_TORMENT_RESISTANCE, 0, 1, false }, + { MUT_NEGATIVE_ENERGY_RESISTANCE, 0, 3, false }, + { MUT_SUMMON_MINOR_DEMONS, 0, 1, false }, + { MUT_SUMMON_DEMONS, 0, 1, false }, + { MUT_HURL_HELLFIRE, 0, 1, false }, + { MUT_CALL_TORMENT, 0, 1, false }, + { MUT_RAISE_DEAD, 0, 1, false }, // 50 - { MUT_CONTROL_DEMONS, 0, 1 }, - { MUT_PANDEMONIUM, 0, 1 }, - { MUT_DEATH_STRENGTH, 0, 1 }, - { MUT_CHANNEL_HELL, 0, 1 }, - { MUT_DRAIN_LIFE, 0, 1 }, - { MUT_THROW_FLAMES, 0, 1 }, - { MUT_THROW_FROST, 0, 1 }, - { MUT_SMITE, 0, 1 }, + { MUT_CONTROL_DEMONS, 0, 1, false }, + { MUT_PANDEMONIUM, 0, 1, false }, + { MUT_DEATH_STRENGTH, 0, 1, false }, + { MUT_CHANNEL_HELL, 0, 1, false }, + { MUT_DRAIN_LIFE, 0, 1, false }, + { MUT_THROW_FLAMES, 0, 1, false }, + { MUT_THROW_FROST, 0, 1, false }, + { MUT_SMITE, 0, 1, false }, /* end of demonic powers */ - { MUT_CLAWS, 2, 3 }, - { MUT_FANGS, 1, 3 }, + { MUT_CLAWS, 2, 3, false }, + { MUT_FANGS, 1, 3, false }, // 60 - { MUT_HOOVES, 1, 1 }, - { MUT_TALONS, 1, 1 }, - { MUT_PAWS, 1, 1 }, + { MUT_HOOVES, 1, 1, false }, + { MUT_TALONS, 1, 1, false }, + { MUT_PAWS, 1, 1, false }, - { MUT_BREATHE_POISON, 0, 1 }, // Naga only - { MUT_STINGER, 0, 3 }, // Naga and Draconian only + { MUT_BREATHE_POISON, 0, 1, false }, // Naga only + { MUT_STINGER, 0, 3, false }, // Naga and Draconian only // 65 - { MUT_BIG_WINGS, 0, 3 }, // Draconian only - { MUT_BLUE_MARKS, 0, 3 }, // used by evil gods to mark followers - { MUT_GREEN_MARKS, 0, 3 }, + { MUT_BIG_WINGS, 0, 3, false }, // Draconian only + { MUT_BLUE_MARKS, 0, 3, false }, // used by evil gods to mark followers + { MUT_GREEN_MARKS, 0, 3, false }, - { MUT_DRIFTING, 2, 3 }, - { MUT_SAPROVOROUS, 0, 3 }, // species-dependent innate mutation + { MUT_DRIFTING, 2, 3, true }, + { MUT_SAPROVOROUS, 0, 3, false }, // species-dependent innate mutation // 70 - { MUT_SHAGGY_FUR, 2, 3 }, - { MUT_HIGH_MAGIC, 1, 3 }, - { MUT_LOW_MAGIC, 9, 3 }, - { MUT_SLEEPINESS, 3, 3 }, - { RANDOM_MUTATION, 0, 3 }, + { MUT_SHAGGY_FUR, 2, 3, false }, + { MUT_HIGH_MAGIC, 1, 3, false }, + { MUT_LOW_MAGIC, 9, 3, true }, + { MUT_SLEEPINESS, 3, 3, true }, + { RANDOM_MUTATION, 0, 3, false }, // 75 -- scales of various colours and effects - { MUT_RED_SCALES, 2, 3 }, - { MUT_NACREOUS_SCALES, 1, 3 }, - { MUT_GREY2_SCALES, 2, 3 }, - { MUT_METALLIC_SCALES, 1, 3 }, - { MUT_BLACK2_SCALES, 2, 3 }, - { MUT_WHITE_SCALES, 2, 3 }, - { MUT_YELLOW_SCALES, 2, 3 }, - { MUT_BROWN_SCALES, 2, 3 }, - { MUT_BLUE_SCALES, 2, 3 }, - { MUT_PURPLE_SCALES, 2, 3 }, + { MUT_RED_SCALES, 2, 3, false }, + { MUT_NACREOUS_SCALES, 1, 3, false }, + { MUT_GREY2_SCALES, 2, 3, false }, + { MUT_METALLIC_SCALES, 1, 3, false }, + { MUT_BLACK2_SCALES, 2, 3, false }, + { MUT_WHITE_SCALES, 2, 3, false }, + { MUT_YELLOW_SCALES, 2, 3, false }, + { MUT_BROWN_SCALES, 2, 3, false }, + { MUT_BLUE_SCALES, 2, 3, false }, + { MUT_PURPLE_SCALES, 2, 3, false }, // 85 - { MUT_SPECKLED_SCALES, 2, 3 }, - { MUT_ORANGE_SCALES, 2, 3 }, - { MUT_INDIGO_SCALES, 2, 3 }, - { MUT_RED2_SCALES, 1, 3 }, - { MUT_IRIDESCENT_SCALES, 1, 3 }, - { MUT_PATTERNED_SCALES, 1, 3 } + { MUT_SPECKLED_SCALES, 2, 3, false }, + { MUT_ORANGE_SCALES, 2, 3, false }, + { MUT_INDIGO_SCALES, 2, 3, false }, + { MUT_RED2_SCALES, 1, 3, false }, + { MUT_IRIDESCENT_SCALES, 1, 3, false }, + { MUT_PATTERNED_SCALES, 1, 3, false } }; #ifdef DEBUG_DIAGNOSTICS - void sanity_check_mutation_defs() { ASSERT(ARRAYSIZE(mutation_defs) == NUM_MUTATIONS); @@ -1009,9 +1008,14 @@ void sanity_check_mutation_defs() || mdef.mutation == RANDOM_MUTATION); } } - #endif +void fixup_mutations() +{ + if (player_genus(GENPC_DRACONIAN)) + mutation_defs[MUT_BIG_WINGS].rarity = 1; +} + formatted_string describe_mutations() { std::string result; @@ -1397,16 +1401,75 @@ static int calc_mutation_amusement_value(mutation_type which_mutation) return (amusement); } -static bool accept_mutation( mutation_type mutat ) +static bool accept_mutation( mutation_type mutat, bool ignore_rarity = false ) { if ( you.mutation[mutat] >= mutation_defs[mutat].levels ) - return false; + return (false); + + if ( ignore_rarity ) + return (true); const int rarity = mutation_defs[mutat].rarity + you.demon_pow[mutat]; // low rarity means unlikely to choose it return (rarity > random2(10)); } +static mutation_type get_random_xom_mutation() +{ + mutation_type mutat = NUM_MUTATIONS; + do + { + mutat = static_cast(random2(NUM_MUTATIONS)); + + if (one_chance_in(1000)) + return (NUM_MUTATIONS); + if (one_chance_in(5)) + { + switch (random2(8)) + { + case 0: mutat = MUT_WEAK; break; + case 1: mutat = MUT_DOPEY; break; + case 2: mutat = MUT_CLUMSY; break; + case 3: mutat = MUT_DEFORMED; break; + case 4: mutat = MUT_SCREAM; break; + case 5: mutat = MUT_DETERIORATION; break; + case 6: mutat = MUT_BLURRY_VISION; break; + case 7: mutat = MUT_FRAIL; break; + } + } + } + while ( !accept_mutation(mutat) ); + + return (mutat); +} + +static mutation_type get_random_mutation(bool prefer_good, + int preferred_multiplier) +{ + int cweight = 0; + mutation_type chosen = NUM_MUTATIONS; + for (int i = 0; i < NUM_MUTATIONS; ++i) + { + if (!mutation_defs[i].rarity) + continue; + + const mutation_type curr = static_cast(i); + if (!accept_mutation(curr, true)) + continue; + + const bool weighted = mutation_defs[i].bad != prefer_good; + int weight = mutation_defs[i].rarity; + if (weighted) + weight = weight * preferred_multiplier / 100; + + cweight += weight; + + if (random2(cweight) < weight) + chosen = curr; + } + return (chosen); +} + bool mutate(mutation_type which_mutation, bool failMsg, bool force_mutation, bool demonspawn) { @@ -1482,28 +1545,13 @@ bool mutate(mutation_type which_mutation, bool failMsg, bool force_mutation, } else if (which_mutation == RANDOM_XOM_MUTATION) { - do - { - mutat = static_cast(random2(NUM_MUTATIONS)); - - if (one_chance_in(1000)) - return false; - if (one_chance_in(5)) - { - switch (random2(8)) - { - case 0: mutat = MUT_WEAK; break; - case 1: mutat = MUT_DOPEY; break; - case 2: mutat = MUT_CLUMSY; break; - case 3: mutat = MUT_DEFORMED; break; - case 4: mutat = MUT_SCREAM; break; - case 5: mutat = MUT_DETERIORATION; break; - case 6: mutat = MUT_BLURRY_VISION; break; - case 7: mutat = MUT_FRAIL; break; - } - } - } - while ( !accept_mutation(mutat) ); + if ((mutat = get_random_xom_mutation()) == NUM_MUTATIONS) + return (false); + } + else if (which_mutation == RANDOM_GOOD_MUTATION) + { + if ((mutat = get_random_mutation(true, 500)) == NUM_MUTATIONS) + return (false); } else if (you.mutation[mutat] >= 3 && mutat != MUT_STRONG && mutat != MUT_CLEVER && diff --git a/crawl-ref/source/mutation.h b/crawl-ref/source/mutation.h index 35419cf737..6f653e3c30 100644 --- a/crawl-ref/source/mutation.h +++ b/crawl-ref/source/mutation.h @@ -22,8 +22,13 @@ struct mutation_def mutation_type mutation; short rarity; // Rarity of the mutation. short levels; // The number of levels of the mutation. + bool bad; // A mutation that's more bad than good. Xom uses + // this to decide which mutations to hand out as + // rewards. }; +void fixup_mutations(); + // last updated 12may2000 {dlb} /* *********************************************************************** * called from: acr - decks - effects - fight - food - it_use2 - items - @@ -32,7 +37,6 @@ struct mutation_def bool mutate(mutation_type which_mutation, bool failMsg = true, bool force_mutation = false, bool demonspawn = false); - // last updated 12may2000 {dlb} /* *********************************************************************** * called from: acr diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc index 93c0fa630c..d08588ced8 100644 --- a/crawl-ref/source/xom.cc +++ b/crawl-ref/source/xom.cc @@ -626,7 +626,7 @@ static bool xom_is_good(int sever) int j = random2(4); while (i < j) { - if (mutate(RANDOM_MUTATION, failMsg, true)) + if (mutate(RANDOM_GOOD_MUTATION, failMsg, true)) done = true; else failMsg = false; @@ -704,8 +704,7 @@ static bool xom_is_bad(int sever) (temp_rand == 2) ? "Xom's power almost touches on you for a moment." : "You almost hear Xom's maniacal laughter."); - miscast_effect( SPTYP_RANDOM, 0, 0, 0, - "the mischievity of Xom" ); + miscast_effect( SPTYP_RANDOM, 0, 0, 0, "the mischief of Xom" ); done = true; } -- cgit v1.2.3-54-g00ecf