diff options
Diffstat (limited to 'crawl-ref')
-rw-r--r-- | crawl-ref/source/food.cc | 11 | ||||
-rw-r--r-- | crawl-ref/source/newgame.cc | 342 | ||||
-rw-r--r-- | crawl-ref/source/travel.cc | 11 |
3 files changed, 306 insertions, 58 deletions
diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc index 210b6f50f7..0723e53728 100644 --- a/crawl-ref/source/food.cc +++ b/crawl-ref/source/food.cc @@ -582,9 +582,9 @@ bool butchery(int which_corpse) && god_likes_butchery(you.religion)); // We don't need to check for undead because - // * Mummies can't eat - // * Ghouls relish the bad things - // * Vampires won't bottle bad corpses + // * Mummies can't eat. + // * Ghouls relish the bad things. + // * Vampires won't bottle bad corpses. // Also, don't bother colouring if it's only for sacrificing. if (!sacrifice && !you.is_undead) { @@ -1187,10 +1187,13 @@ int eat_from_floor() } found_valid = true; + std::string item_name = get_message_colour_tags(*si, DESC_NOCAP_A, + MSGCH_PROMPT); + mprf(MSGCH_PROMPT, "%s %s%s? (ye/n/q/i?)", (you.species == SP_VAMPIRE ? "Drink blood from" : "Eat"), ((si->quantity > 1) ? "one of " : ""), - si->name(DESC_NOCAP_A).c_str()); + item_name.c_str()); int keyin = tolower(c_getch()); switch (keyin) diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc index 68347be2a0..c69231a801 100644 --- a/crawl-ref/source/newgame.cc +++ b/crawl-ref/source/newgame.cc @@ -2416,26 +2416,134 @@ static bool _choose_weapon() // Gods are not restricted but there are some choices that are banned (false). // Everything else will be unrestricted. -static bool _is_valid_religion(god_type god) +static char_choice_restriction _religion_restriction(god_type god) { // Sanity check. if (you.species == SP_DEMIGOD) - return (false); - - if (god == GOD_BEOGH) - return (you.species == SP_HILL_ORC); + return (CC_BANNED); - switch (you.species) + switch (god) { - case SP_DEMONSPAWN: - case SP_MUMMY: - case SP_GHOUL: - case SP_VAMPIRE: - return (!is_good_god(god)); + case GOD_BEOGH: + if (you.species == SP_HILL_ORC) + return (CC_UNRESTRICTED); + return (CC_BANNED); + + case GOD_ZIN: + switch (you.species) + { + case SP_DEMONSPAWN: + case SP_MUMMY: + case SP_GHOUL: + case SP_VAMPIRE: + return (CC_BANNED); + case SP_HIGH_ELF: + case SP_MOUNTAIN_DWARF: + return (CC_UNRESTRICTED); + default: + return (CC_RESTRICTED); + } + + case GOD_YREDELEMNUL: + switch (you.species) + { + case SP_HILL_ORC: + // Restrict in favour of Beogh, else unrestricted. + if (you.char_class == JOB_PRIEST) + return (CC_RESTRICTED); + // intentional fall-through + case SP_HUMAN: + case SP_HIGH_ELF: + case SP_SLUDGE_ELF: + case SP_MOUNTAIN_DWARF: + case SP_MERFOLK: + case SP_HALFLING: + case SP_KOBOLD: + case SP_CENTAUR: + case SP_OGRE: + case SP_TROLL: + case SP_MINOTAUR: + case SP_DEMONSPAWN: + case SP_MUMMY: + case SP_GHOUL: + case SP_VAMPIRE: + return (CC_UNRESTRICTED); + default: + if (player_genus(GENPC_DRACONIAN)) + return (CC_UNRESTRICTED); + return (CC_RESTRICTED); + } + + case GOD_XOM: + switch (you.species) + { + case SP_HUMAN: + case SP_MOUNTAIN_DWARF: + case SP_HILL_ORC: + case SP_MERFOLK: + case SP_CENTAUR: + case SP_OGRE: + case SP_TROLL: + case SP_MINOTAUR: + case SP_KENKU: + case SP_DEMONSPAWN: + case SP_VAMPIRE: + return (CC_UNRESTRICTED); + default: + if (player_genus(GENPC_DRACONIAN)) + return (CC_UNRESTRICTED); + return (CC_RESTRICTED); + } + + case GOD_MAKHLEB: + switch (you.species) + { + case SP_HUMAN: + case SP_HIGH_ELF: + case SP_SLUDGE_ELF: + case SP_MOUNTAIN_DWARF: + case SP_MERFOLK: + case SP_HALFLING: + case SP_GNOME: + case SP_KOBOLD: + case SP_CENTAUR: + case SP_OGRE: + case SP_TROLL: + case SP_MINOTAUR: + case SP_DEMONSPAWN: + case SP_MUMMY: + case SP_GHOUL: + case SP_VAMPIRE: + return (CC_UNRESTRICTED); + default: + if (player_genus(GENPC_DRACONIAN)) + return (CC_UNRESTRICTED); + return (CC_RESTRICTED); + } + + case GOD_LUGONU: + switch (you.species) + { + case SP_HUMAN: + case SP_MOUNTAIN_DWARF: + case SP_HILL_ORC: + case SP_MERFOLK: + case SP_SPRIGGAN: + case SP_CENTAUR: + case SP_OGRE: + case SP_TROLL: + case SP_MINOTAUR: + case SP_DEMONSPAWN: + case SP_VAMPIRE: + return (CC_UNRESTRICTED); + default: + if (player_genus(GENPC_DRACONIAN)) + return (CC_UNRESTRICTED); + return (CC_RESTRICTED); + } default: - // All gods are allowed. - return (true); + return (CC_RESTRICTED); } } @@ -4179,20 +4287,42 @@ bool _give_items_skills() } else { + const god_type gods[3] = { GOD_ZIN, GOD_YREDELEMNUL, GOD_BEOGH }; + // Disallow invalid choices. - if (!_is_valid_religion(Options.priest)) + if (_religion_restriction(Options.priest) == CC_BANNED) Options.priest = GOD_NO_GOD; if (Options.priest != GOD_NO_GOD && Options.priest != GOD_RANDOM) ng_pr = you.religion = static_cast<god_type>( Options.priest ); else if (Options.random_pick || Options.priest == GOD_RANDOM) { - you.religion = coinflip() ? GOD_YREDELEMNUL : GOD_ZIN; + bool did_chose = false; + if (Options.good_random) + { + int count = 0; + for (int i = 0; i < 3; i++) + { + if (_religion_restriction(gods[i]) == CC_BANNED) + continue; + + if (_religion_restriction(gods[i]) == CC_UNRESTRICTED + && one_chance_in(++count)) + { + you.religion = gods[i]; + did_chose = true; + } + } + } - // For orcs 50% chance of Beogh instead. - if (you.species == SP_HILL_ORC && coinflip()) - you.religion = GOD_BEOGH; + if (!did_chose) + { + you.religion = (coinflip() ? GOD_YREDELEMNUL : GOD_ZIN); + // For orcs 50% chance of Beogh instead. + if (you.species == SP_HILL_ORC && coinflip()) + you.religion = GOD_BEOGH; + } ng_pr = GOD_RANDOM; } else @@ -4202,34 +4332,40 @@ bool _give_items_skills() textcolor( CYAN ); cprintf(EOL "Which god do you wish to serve?" EOL); - // Zin and Yredelemnul are valid for everyone. - // (The undead have been handled above.) - textcolor(LIGHTGREY); - cprintf("a - Zin (for traditional priests)" EOL); - cprintf("b - Yredelemnul (for priests of death)" EOL); + const char* god_name[3] = {"Zin (for traditional priests)", + "Yredelemnul (for priests of death)", + "Beogh (for priests of Orcs)"}; - if (_is_valid_religion(GOD_BEOGH)) + for (int i = 0; i < 3; i++) { - textcolor(LIGHTGREY); - cprintf("c - Beogh (priest of Orcs)" EOL); + if (_religion_restriction(gods[i]) == CC_BANNED) + continue; + + if (_religion_restriction(gods[i]) == CC_UNRESTRICTED) + textcolor(LIGHTGREY); + else + textcolor(DARKGREY); + + const char letter = 'a' + i; + cprintf("%c - %s" EOL, letter, god_name[i]); } textcolor( BROWN ); - cprintf(EOL "* - Random choice; " + cprintf(EOL "* - Random choice; + - Good random choice" EOL "Bksp - Back to species and class selection; " "X - Quit" EOL); - if (!_is_valid_religion(Options.prev_pr)) + if (_religion_restriction(Options.prev_pr) == CC_BANNED) Options.prev_pr = GOD_NO_GOD; if (Options.prev_pr != GOD_NO_GOD) { textcolor(BROWN); cprintf(EOL "Enter - %s" EOL, - Options.prev_pr == GOD_ZIN ? "Zin" : + Options.prev_pr == GOD_ZIN ? "Zin" : Options.prev_pr == GOD_YREDELEMNUL ? "Yredelemnul" : - Options.prev_pr == GOD_BEOGH ? "Beogh" - : "Random"); + Options.prev_pr == GOD_BEOGH ? "Beogh" + : "Random"); } do @@ -4263,8 +4399,27 @@ bool _give_items_skills() } keyn = '*'; // for ng_pr setting // fall-through for random - case '*': case '+': + if (keyn == '+') + { + int count = 0; + for (int i = 0; i < 3; i++) + { + if (_religion_restriction(gods[i]) == CC_BANNED) + continue; + + if (_religion_restriction(gods[i]) + == CC_UNRESTRICTED + && one_chance_in(++count)) + { + you.religion = gods[i]; + } + } + if (count > 0) + break; + } + // intentional fall-through + case '*': you.religion = coinflip() ? GOD_ZIN : GOD_YREDELEMNUL; if (you.species == SP_HILL_ORC && coinflip()) you.religion = GOD_BEOGH; @@ -4315,6 +4470,8 @@ bool _give_items_skills() if (!_choose_weapon()) return (false); + const god_type gods[3] = { GOD_XOM, GOD_MAKHLEB, GOD_LUGONU }; + if (Options.chaos_knight != GOD_NO_GOD && Options.chaos_knight != GOD_RANDOM) { @@ -4323,9 +4480,30 @@ bool _give_items_skills() } else if (Options.random_pick || Options.chaos_knight == GOD_RANDOM) { - you.religion = (one_chance_in(3) ? GOD_XOM : - coinflip() ? GOD_MAKHLEB - : GOD_LUGONU); + bool did_chose = false; + if (Options.good_random) + { + int count = 0; + for (int i = 0; i < 3; i++) + { + if (_religion_restriction(gods[i]) == CC_BANNED) + continue; + + if (_religion_restriction(gods[i]) == CC_UNRESTRICTED + && one_chance_in(++count)) + { + you.religion = gods[i]; + did_chose = true; + } + } + } + + if (!did_chose) + { + you.religion = (one_chance_in(3) ? GOD_XOM : + coinflip() ? GOD_MAKHLEB + : GOD_LUGONU); + } ng_ck = GOD_RANDOM; } else @@ -4335,14 +4513,26 @@ bool _give_items_skills() textcolor( CYAN ); cprintf(EOL "Which god of chaos do you wish to serve?" EOL); - // Xom, Makhleb, and Lugonu are okay choices for everyone. - textcolor( LIGHTGREY ); - cprintf("a - Xom of Chaos" EOL); - cprintf("b - Makhleb the Destroyer" EOL); - cprintf("c - Lugonu the Unformed" EOL); + const char* god_name[3] = {"Xom of Chaos", + "Makhleb the Destroyer", + "Lugonu the Unformed"}; + + for (int i = 0; i < 3; i++) + { + if (_religion_restriction(gods[i]) == CC_BANNED) + continue; + + if (_religion_restriction(gods[i]) == CC_UNRESTRICTED) + textcolor(LIGHTGREY); + else + textcolor(DARKGREY); + + const char letter = 'a' + i; + cprintf("%c - %s" EOL, letter, god_name[i]); + } textcolor( BROWN ); - cprintf(EOL "* - Random choice; " + cprintf(EOL "* - Random choice; + - Good random choice" EOL "Bksp - Back to species and class selection; " "X - Quit" EOL); @@ -4383,8 +4573,27 @@ bool _give_items_skills() } keyn = '*'; // for ng_ck setting // fall-through for random - case '*': case '+': + if (keyn == '+') + { + int count = 0; + for (int i = 0; i < 3; i++) + { + if (_religion_restriction(gods[i]) == CC_BANNED) + continue; + + if (_religion_restriction(gods[i]) + == CC_UNRESTRICTED + && one_chance_in(++count)) + { + you.religion = gods[i]; + } + } + if (count > 0) + break; + } + // intentional fall-through + case '*': you.religion = (one_chance_in(3) ? GOD_XOM : coinflip() ? GOD_MAKHLEB : GOD_LUGONU); @@ -4470,9 +4679,24 @@ bool _give_items_skills() { ng_dk = DK_RANDOM; - if (Options.good_random && !_necromancy_okay()) - choice = DK_YREDELEMNUL; - else + bool did_chose = false; + if (Options.good_random) + { + if (_necromancy_okay()) + { + choice = DK_NECROMANCY; + did_chose = true; + } + + if (_religion_restriction(GOD_YREDELEMNUL) == CC_UNRESTRICTED) + { + if (!did_chose || coinflip()) + choice = DK_YREDELEMNUL; + did_chose = true; + } + } + + if (!did_chose) choice = (coinflip() ? DK_NECROMANCY : DK_YREDELEMNUL); } else @@ -4490,11 +4714,15 @@ bool _give_items_skills() cprintf("a - Necromantic magic" EOL); // Yredelemnul is an okay choice for everyone. - textcolor(LIGHTGREY); + if (_religion_restriction(GOD_YREDELEMNUL) == CC_UNRESTRICTED) + textcolor(LIGHTGREY); + else + textcolor(DARKGREY); + cprintf("b - the god Yredelemnul" EOL); textcolor( BROWN ); - cprintf(EOL "* - Random choice; " + cprintf(EOL "* - Random choice; + - Good random choice " EOL "Bksp - Back to species and class selection; " "X - Quit" EOL); @@ -4534,10 +4762,24 @@ bool _give_items_skills() keyn = '*'; // for ng_dk setting // fall-through for random case '+': - if (keyn == '+' && !_necromancy_okay()) + if (keyn == '+') { - choice = DK_YREDELEMNUL; - break; + bool did_chose = false; + if (_necromancy_okay()) + { + choice = DK_NECROMANCY; + did_chose = true; + } + + if (_religion_restriction(GOD_YREDELEMNUL) + == CC_UNRESTRICTED) + { + if (!did_chose || coinflip()) + choice = DK_YREDELEMNUL; + did_chose = true; + } + if (did_chose) + break; } // fall-through for random case '*': diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc index 6326b38708..e8fbe6dc2b 100644 --- a/crawl-ref/source/travel.cc +++ b/crawl-ref/source/travel.cc @@ -1983,7 +1983,7 @@ static bool _is_known_branch_id(int branch) return (true); // The Vestibule is special: there are no stairs to it, just a - // portal + // portal. if (branch == BRANCH_VESTIBULE_OF_HELL) return overmap_knows_portal(DNGN_ENTER_HELL); @@ -3430,13 +3430,16 @@ void LevelInfo::fixup() bool TravelCache::know_stair(const coord_def &c) const { travel_levels_map::const_iterator i = levels.find(level_id::current()); - return (i == levels.end()? false : i->second.know_stair(c)); + return (i == levels.end() ? false : i->second.know_stair(c)); } void TravelCache::travel_to_waypoint(int num) { - if (num < 0 || num >= TRAVEL_WAYPOINT_COUNT) return; - if (waypoints[num].id.depth == -1) return; + if (num < 0 || num >= TRAVEL_WAYPOINT_COUNT) + return; + + if (waypoints[num].id.depth == -1) + return; start_translevel_travel(waypoints[num]); } |