From 9b5bc8fd4f63dda5b587ab08b634d4f9cdf20a06 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Thu, 20 Sep 2007 11:51:22 +0000 Subject: Previous commit applied to trunk: * cleanup of weird_colour() * hooves mutation one level only * fixes for vampire food level checks * Xom gifts interrupt travel git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2164 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/effects.cc | 4 +- crawl-ref/source/fight.cc | 12 ++--- crawl-ref/source/item_use.cc | 2 +- crawl-ref/source/itemprop.cc | 4 +- crawl-ref/source/misc.cc | 101 +++++++++++++++++++++---------------------- crawl-ref/source/misc.h | 2 +- crawl-ref/source/mstuff2.cc | 2 +- crawl-ref/source/mutation.cc | 14 +++--- crawl-ref/source/newgame.cc | 2 +- crawl-ref/source/output.cc | 4 +- crawl-ref/source/player.cc | 17 ++++---- crawl-ref/source/religion.cc | 2 +- crawl-ref/source/skills2.cc | 2 +- crawl-ref/source/xom.cc | 1 + 14 files changed, 85 insertions(+), 84 deletions(-) diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc index bf9753216a..604e3f852a 100644 --- a/crawl-ref/source/effects.cc +++ b/crawl-ref/source/effects.cc @@ -387,7 +387,7 @@ void random_uselessness(unsigned char ru, unsigned char sc_read_2) switch (ru) { case 0: - msg::stream << "The dust glows a " << weird_colours(random2(256)) + msg::stream << "The dust glows a " << weird_glow_colour() << " colour!" << std::endl; break; @@ -400,7 +400,7 @@ void random_uselessness(unsigned char ru, unsigned char sc_read_2) if (you.equip[EQ_WEAPON] != -1) { msg::stream << you.inv[you.equip[EQ_WEAPON]].name(DESC_CAP_YOUR) - << " glows " << weird_colours(random2(256)) + << " glows " << weird_glow_colour() << " for a moment." << std::endl; } else diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index e9e6370a61..ccc022ddb7 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -186,13 +186,13 @@ static int calc_your_to_hit_unarmed(int uattack = UNAT_NO_ATTACK, your_to_hit += 1; if (vampiric) { - if (you.hunger_state == HS_HUNGRY) - your_to_hit += 1; - else if (you.hunger_state == HS_STARVING) + if (you.hunger_state <= HS_STARVING) your_to_hit += 2; + else if (you.hunger_state <= HS_HUNGRY) + your_to_hit += 1; } } - else if (you.species != SP_VAMPIRE && you.hunger_state == HS_STARVING) + else if (you.species != SP_VAMPIRE && you.hunger_state <= HS_STARVING) your_to_hit -= 3; your_to_hit += slaying_bonus(PWPN_HIT); @@ -1089,7 +1089,7 @@ int melee_attack::player_apply_misc_modifiers(int damage) if (you.duration[DUR_MIGHT] > 1) damage += 1 + random2(10); - if (you.hunger_state == HS_STARVING && you.species != SP_VAMPIRE) + if (you.hunger_state <= HS_STARVING && you.species != SP_VAMPIRE) damage -= random2(5); return (damage); @@ -2335,7 +2335,7 @@ int melee_attack::player_to_hit(bool random_factor) your_to_hit += slaying_bonus(PWPN_HIT); // hunger penalty - if (you.hunger_state == HS_STARVING) + if (you.hunger_state <= HS_STARVING) your_to_hit -= 3; // armour penalty diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index ba39906bb7..242358acbe 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -769,7 +769,7 @@ bool can_wear_armour(const item_def &item, bool verbose, bool ignore_temporary) if (sub_type == ARM_BOOTS) { - if (you.mutation[MUT_HOOVES] >= 2) + if (you.mutation[MUT_HOOVES]) { if (verbose) mpr("You can't wear boots with hooves!"); diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc index 625a89c337..cd77235da0 100644 --- a/crawl-ref/source/itemprop.cc +++ b/crawl-ref/source/itemprop.cc @@ -1056,7 +1056,7 @@ bool check_armour_shape( const item_def &item, bool quiet ) { case EQ_BOOTS: - if (you.mutation[MUT_HOOVES] >= 2) + if (you.mutation[MUT_HOOVES]) { if (!quiet) mpr("You can't wear boots with hooves!"); @@ -1115,7 +1115,7 @@ bool check_armour_shape( const item_def &item, bool quiet ) return (false); } - if (you.mutation[MUT_HOOVES] >= 2) + if (you.mutation[MUT_HOOVES]) { if (!quiet) mpr( "You can't wear boots with hooves!" ); diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index e0b013e45c..aa3c39638c 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -1107,6 +1107,43 @@ void new_level(void) #endif } +static std::string weird_colour() +{ + int temp_rand; // for probability determinations {dlb} + std::string result; + + temp_rand = random2(25); + result = + (temp_rand == 0) ? "red" : + (temp_rand == 1) ? "purple" : + (temp_rand == 2) ? "orange" : + (temp_rand == 3) ? "green" : + (temp_rand == 4) ? "magenta" : + (temp_rand == 5) ? "black" : + (temp_rand == 6) ? "blue" : + (temp_rand == 7) ? "grey" : + (temp_rand == 8) ? "umber" : + (temp_rand == 9) ? "charcoal" : + (temp_rand == 10) ? "bronze" : + (temp_rand == 11) ? "silver" : + (temp_rand == 12) ? "gold" : + (temp_rand == 13) ? "pink" : + (temp_rand == 14) ? "yellow" : + (temp_rand == 15) ? "white" : + (temp_rand == 16) ? "brown" : + (temp_rand == 17) ? "aubergine" : + (temp_rand == 18) ? "ochre" : + (temp_rand == 19) ? "leaf green" : + (temp_rand == 20) ? "mauve" : + (temp_rand == 21) ? "azure" : + (temp_rand == 22) ? "lime green" : + (temp_rand == 23) ? "scarlet" : + (temp_rand == 24) ? "chartreuse" + : "colourless"; + + return result; +} + std::string weird_writing() { int temp_rand; // for probability determinations {dlb} @@ -1127,24 +1164,7 @@ std::string weird_writing() if (!result.empty()) result += ' '; - temp_rand = random2(14); - - result += - (temp_rand == 0) ? "yellow" : - (temp_rand == 1) ? "brown" : - (temp_rand == 2) ? "black" : - (temp_rand == 3) ? "purple" : - (temp_rand == 4) ? "orange" : - (temp_rand == 5) ? "lime-green" : - (temp_rand == 6) ? "blue" : - (temp_rand == 7) ? "grey" : - (temp_rand == 8) ? "silver" : - (temp_rand == 9) ? "gold" : - (temp_rand == 10) ? "umber" : - (temp_rand == 11) ? "charcoal" : - (temp_rand == 12) ? "pastel" : - (temp_rand == 13) ? "mauve" - : "colourless"; + result += weird_colour(); result += ' '; @@ -1176,47 +1196,26 @@ bool scramble(void) return true; } // end scramble() -std::string weird_colours(unsigned char coll) +std::string weird_glow_colour() { - unsigned char coll_div16 = coll / 16; // conceivable max is then 16 {dlb} + int temp_rand; // for probability determinations {dlb} std::string result; // Must start with a consonant! + temp_rand = random2(8); result = - (coll_div16 == 0 || coll_div16 == 7) ? "brilliant" : - (coll_div16 == 1 || coll_div16 == 8) ? "pale" : - (coll_div16 == 2 || coll_div16 == 9) ? "mottled" : - (coll_div16 == 3 || coll_div16 == 10) ? "shimmering" : - (coll_div16 == 4 || coll_div16 == 11) ? "bright" : - (coll_div16 == 5 || coll_div16 == 12) ? "dark" : - (coll_div16 == 6 || coll_div16 == 13) ? "shining" - : "faint"; + (temp_rand == 0) ? "brilliant" : + (temp_rand == 1) ? "pale" : + (temp_rand == 2) ? "mottled" : + (temp_rand == 3) ? "shimmering" : + (temp_rand == 4) ? "bright" : + (temp_rand == 5) ? "dark" : + (temp_rand == 6) ? "shining" + : "faint"; result += ' '; - while (coll > 17) - coll -= 10; - - result += - (coll == 0) ? "red" : - (coll == 1) ? "purple" : - (coll == 2) ? "green" : - (coll == 3) ? "orange" : - (coll == 4) ? "magenta" : - (coll == 5) ? "black" : - (coll == 6) ? "grey" : - (coll == 7) ? "silver" : - (coll == 8) ? "gold" : - (coll == 9) ? "pink" : - (coll == 10) ? "yellow" : - (coll == 11) ? "white" : - (coll == 12) ? "brown" : - (coll == 13) ? "aubergine" : - (coll == 14) ? "ochre" : - (coll == 15) ? "leaf green" : - (coll == 16) ? "mauve" : - (coll == 17) ? "azure" - : "colourless"; + result += weird_colour(); return result; } diff --git a/crawl-ref/source/misc.h b/crawl-ref/source/misc.h index 7a192db181..7d594af86e 100644 --- a/crawl-ref/source/misc.h +++ b/crawl-ref/source/misc.h @@ -81,7 +81,7 @@ void up_stairs(dungeon_feature_type force_stair = DNGN_UNSEEN); /* *********************************************************************** * called from: acr - effects * *********************************************************************** */ -std::string weird_colours(unsigned char coll); +std::string weird_glow_colour(); // last updated 12may2000 {dlb} diff --git a/crawl-ref/source/mstuff2.cc b/crawl-ref/source/mstuff2.cc index 9995f108b7..a202ea04dc 100644 --- a/crawl-ref/source/mstuff2.cc +++ b/crawl-ref/source/mstuff2.cc @@ -2083,7 +2083,7 @@ bool silver_statue_effects(monsters *mons) if ((mons_player_visible(mons) || one_chance_in(3)) && !one_chance_in(3)) { const std::string msg = - "'s eyes glow " + weird_colours(random2(256)) + '.'; + "'s eyes glow " + weird_glow_colour() + '.'; simple_monster_message(mons, msg.c_str(), MSGCH_WARN); create_monster( summon_any_demon((coinflip() ? DEMON_COMMON diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc index 61068227ad..b09cf787dd 100644 --- a/crawl-ref/source/mutation.cc +++ b/crawl-ref/source/mutation.cc @@ -1106,12 +1106,12 @@ formatted_string describe_mutations() result += "You can see invisible." EOL; result += ""; } - if (you.hunger_state == HS_FULL) - result += "Your natural rate of healing is unusually fast." EOL; - else if (you.hunger_state == HS_HUNGRY) - result += "You heal slowly." EOL; - else if (you.hunger_state < HS_HUNGRY) + if (you.hunger_state <= HS_STARVING) result += "You do not heal." EOL; + else if (you.hunger_state <= HS_HUNGRY) + result += "You heal slowly." EOL; + else if (you.hunger_state >= HS_FULL) + result += "Your natural rate of healing is unusually fast." EOL; have_any = true; break; @@ -1449,7 +1449,7 @@ bool mutate(mutation_type which_mutation, bool failMsg, bool force_mutation, // putting boots on after they are forced off. -- bwr if (mutat == MUT_HOOVES - && (you.species == SP_NAGA || you.species == SP_CENTAUR + && (you.species == SP_NAGA || you.mutation[MUT_HOOVES] || you.species == SP_KENKU || player_genus(GENPC_DRACONIAN))) { return false; @@ -2392,7 +2392,7 @@ bool give_cosmetic_mutation() how_much = 1 + random2(3); } - if (you.species != SP_CENTAUR && you.species != SP_NAGA + if (you.species != SP_NAGA && !you.mutation[MUT_HOOVES] && you.species != SP_KENKU && !player_genus(GENPC_DRACONIAN) && one_chance_in(5)) { diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc index fbd065ab20..1adff19d97 100644 --- a/crawl-ref/source/newgame.cc +++ b/crawl-ref/source/newgame.cc @@ -1947,7 +1947,7 @@ static void give_basic_mutations(species_type speci) you.mutation[MUT_FAST] = 2; you.mutation[MUT_DEFORMED] = 1; you.mutation[MUT_FAST_METABOLISM] = 2; - you.mutation[MUT_HOOVES] = 2; + you.mutation[MUT_HOOVES] = 1; break; case SP_NAGA: you.mutation[MUT_ACUTE_VISION] = 1; diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index e3c60647f6..7910a27c87 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -1366,12 +1366,12 @@ std::string status_mut_abilities() if (you.duration[DUR_REGENERATION] && (you.species != SP_VAMPIRE || you.hunger_state >= HS_HUNGRY) - || you.species == SP_VAMPIRE && you.hunger_state == HS_FULL) + || you.species == SP_VAMPIRE && you.hunger_state >= HS_FULL) { if (you.disease) text += "recuperating, "; else - text += "regenerating, "; + text += "regenerating, "; } // not used as resistance part already says so diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index a7888acab3..50dd36bc1f 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -519,7 +519,7 @@ bool you_tran_can_wear(int eq, bool check_mutation) if (eq == EQ_BOOTS && (player_is_swimming() && you.species == SP_MERFOLK - || you.mutation[MUT_HOOVES] >= 2)) + || you.mutation[MUT_HOOVES])) { return false; } @@ -844,17 +844,17 @@ int player_regen(void) // healing depending on satiation if (you.species == SP_VAMPIRE) { - if (you.hunger_state == HS_FULL) + if (you.hunger_state <= HS_STARVING) + return 0; // no regeneration for starving vampires + else if (you.hunger_state <= HS_HUNGRY) + return (rr / 2); + else if (you.hunger_state >= HS_FULL) return (rr + 20); else if (you.attribute[ATTR_TRANSFORMATION] == TRAN_BAT || you.hunger_state > HS_HUNGRY) { return rr; } - else if (you.hunger_state == HS_HUNGRY) - return (rr / 2); - else if (you.hunger_state == HS_STARVING) - return 0; // no regeneration for starving vampires } if (rr < 1) @@ -3293,8 +3293,9 @@ void display_char_status() if (you.duration[DUR_PRAYER]) mpr( "You are praying." ); - if (you.duration[DUR_REGENERATION] && - (you.species != SP_VAMPIRE || you.hunger_state >= HS_HUNGRY)) + if (you.duration[DUR_REGENERATION] + && (you.species != SP_VAMPIRE || you.hunger_state >= HS_HUNGRY) + || you.species == SP_VAMPIRE && you.hunger_state >= HS_FULL) { if (you.disease) mpr("You are recuperating from your illness."); diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 76371d0065..cfc721e263 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -509,7 +509,7 @@ static void do_god_gift(bool prayed_for) case GOD_ZIN: //jmf: "good" god will feed you (a la Nethack) - if (you.hunger_state == HS_STARVING + if (you.hunger_state <= HS_STARVING && you.piety >= 30) { god_speaks(you.religion, "Your stomach feels content."); diff --git a/crawl-ref/source/skills2.cc b/crawl-ref/source/skills2.cc index 860573feab..67bd7cce8b 100644 --- a/crawl-ref/source/skills2.cc +++ b/crawl-ref/source/skills2.cc @@ -1931,7 +1931,7 @@ static void display_skill_table(bool show_aptitudes) { gotoxy(1, bottom_line); formatted_string::parse_string("Press '!' to toggle between " - "progress and " + "progress and " "aptitude " "display.").display(); } diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc index ec62a0273f..096dc27117 100644 --- a/crawl-ref/source/xom.cc +++ b/crawl-ref/source/xom.cc @@ -167,6 +167,7 @@ static void xom_make_item(object_class_type base, move_item_to_grid( &thing_created, you.x_pos, you.y_pos ); canned_msg(MSG_SOMETHING_APPEARS); + stop_running(); origin_acquired(mitm[thing_created], GOD_XOM); } -- cgit v1.2.3-54-g00ecf